Commit Graph

12311 Commits

Author SHA1 Message Date
Tim van der Meij
403a994556
Convert all three-digit HEX colors to RGBA colors 2020-01-01 14:52:37 +01:00
Tim van der Meij
d002637405
Convert all named colors to RGBA colors 2020-01-01 14:48:56 +01:00
Tim van der Meij
2c2fc36c54
Normalize all RGBA colors
This is not only useful to have one format for consistency, but also to
be able to quickly search for colors for e.g., finding duplicates or
when tweaking the CSS for custom deployments.
2020-01-01 14:48:55 +01:00
Tim van der Meij
dd1c8a9149
Convert all RGB colors to RGBA colors 2020-01-01 14:48:55 +01:00
Tim van der Meij
3717dcdf57
Convert all HSLA colors to RGBA colors 2020-01-01 14:48:55 +01:00
Tim van der Meij
0bdb1ab202
Convert all HSL colors to RGBA colors 2019-12-28 20:54:57 +01:00
Tim van der Meij
3b44861197
Merge pull request #11455 from Snuffleupagus/update-packages
Update `npm` packages and l10n files
2019-12-28 20:35:44 +01:00
Jonas Jenwald
cac953f5a9 Update l10n files 2019-12-28 20:00:03 +01:00
Jonas Jenwald
05129deb00 Update npm packages 2019-12-28 19:57:25 +01:00
Tim van der Meij
a0fe7a77d6
Merge pull request #11454 from Snuffleupagus/move-SegoeUISymbol
Move the SegoeUISymbol font to the `getNonStdFontMap` (PR 8698 follow-up)
2019-12-28 13:37:36 +01:00
Jonas Jenwald
f8ab8c4d3a Move the SegoeUISymbol font to the getNonStdFontMap (PR 8698 follow-up)
For reasons that I now cannot even begin to understand, the non-standard SegoeUISymbol font was placed in the `getStdFontMap`. That honestly makes no sense, hence this patch which does what I *should* have done from the start.
2019-12-28 11:02:49 +01:00
Tim van der Meij
47ab4b839f
Merge pull request #11450 from Snuffleupagus/eslint-web-prefer-const
Enable the ESLint `prefer-const` rule in the `web/` directory
2019-12-27 12:12:51 +01:00
Jonas Jenwald
d9a5d50664 Fix remaining linting errors, from enabling the prefer-const ESLint rule in the web/ directory
This covers the handful of cases that the `--fix` command couldn't deal with, and the changes aren't just fixing the linting errors but attempt to slightly improve the relevant code.
2019-12-27 01:03:58 +01:00
Jonas Jenwald
5d14e68bec Enable the ESLint prefer-const rule in the web/ directory
Please find additional details about the ESLint rule at https://eslint.org/docs/rules/prefer-const

Note that this patch is generated automatically, by using the ESLint `--fix` argument, and will thus require some additional clean-up (which is done separately).
2019-12-27 01:03:58 +01:00
Tim van der Meij
9c767e3875
Merge pull request #11449 from Snuffleupagus/AutoPrintRegExp
Move the regular expression, used with auto printing in the viewer, to `web/ui_utils.js` and also use it in the API unit-tests
2019-12-27 00:53:51 +01:00
Jonas Jenwald
d9d856020f Move the regular expression, used with auto printing in the viewer, to web/ui_utils.js and also use it in the API unit-tests
Rather than having a copy of this regular expression in the `test/unit/api_spec.js` file, with a comment about keeping it up-to-date with the code in the viewer (note the incorrect file reference as well), we can just import it instead to simplify all of this.
2019-12-27 00:38:28 +01:00
Tim van der Meij
db8fcdf34a
Merge pull request #11445 from timvandermeij/openaction-print-unit-test
Include a unit test for OpenAction dictionaries without `Type` entries (PR 11443 follow-up)
2019-12-27 00:19:42 +01:00
Tim van der Meij
dfe42a5ca4
Include a unit test for OpenAction dictionaries without Type entries (PR 11443 follow-up)
The original issue did not contain a (reduced) test case that we could
include and linked test cases are not ideal for unit tests, so the
original PR could only be verified manually.

I found this a bit unfortunate considering that the print data is
exposed through the API, so I thought about how we could have an
automated test and managed to create a reduced test case with the
OpenAction dictionary from the file in the original issue.

Therefore, this commit includes a unit test for parsing OpenAction
dictionaries without `Type` entries. I verified that this PDF file
behaves the same as the original one, i.e., no print dialog is shown for
older viewers and the print dialog is shown for the most recent viewer.
2019-12-27 00:05:51 +01:00
Tim van der Meij
81af207428
Merge pull request #11446 from Snuffleupagus/prettier
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
2019-12-26 23:35:56 +01:00
Jonas Jenwald
a63f7ad486 Fix the linting errors, from the Prettier auto-formatting, that ESLint --fix couldn't handle
This patch makes the follow changes:
 - Remove no longer necessary inline `// eslint-disable-...` comments.
 - Fix `// eslint-disable-...` comments that Prettier moved down, thus causing new linting errors.
 - Concatenate strings which now fit on just one line.
 - Fix comments that are now too long.
 - Finally, and most importantly, adjust comments that Prettier moved down, since the new positions often is confusing or outright wrong.
2019-12-26 12:35:12 +01:00
Jonas Jenwald
de36b2aaba Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).

Prettier is being used for a couple of reasons:

 - To be consistent with `mozilla-central`, where Prettier is already in use across the tree.

 - To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.

Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.

*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.

(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-26 12:34:24 +01:00
Jonas Jenwald
8ec1dfde49 Add // prettier-ignore comments to prevent re-formatting of certain data structures
There's a fair number of (primarily) `Array`s/`TypedArray`s whose formatting we don't want disturb, since in many cases that would lead to the code becoming much more difficult to read and/or break existing inline comments.

*Please note:* It may be a good idea to look through these cases individually, and possibly re-write some of the them (especially the `String` ones) to reduce the need for all of these ignore commands.
2019-12-26 00:14:03 +01:00
Tim van der Meij
c3a1c67950
Merge pull request #11443 from Snuffleupagus/issue-11442
Support OpenAction dictionaries without `Type` entries when parsing `Print` actions (issue 11442)
2019-12-24 23:17:37 +01:00
Tim van der Meij
11b56ad0f7
Merge pull request #11423 from Snuffleupagus/bug-1605526
Ignore Metadata entries with incorrectly encoded characters, when setting the viewer title (bug 1605526)
2019-12-24 22:44:31 +01:00
Tim van der Meij
c54bdab4aa
Merge pull request #11432 from wojtekmaj/preferences-const
Use const in perferences.js
2019-12-24 19:43:42 +01:00
Tim van der Meij
0f641e66cc
Merge pull request #11433 from wojtekmaj/pdf-thumbnail-viewer-const
Use const in pdf_thumbnail_viewer.js
2019-12-24 19:31:34 +01:00
Jonas Jenwald
70e3345cb4 Support OpenAction dictionaries without Type entries when parsing Print actions (issue 11442)
The PDF generator didn't bother including the `Type` entry in the OpenAction dictionary, hence we skipped parsing the `Print` action.
2019-12-24 10:41:33 +01:00
Tim van der Meij
1a708d8993
Merge pull request #11430 from wojtekmaj/text-layer-builder-const
Use const in text_layer_builder.js
2019-12-24 00:09:51 +01:00
Tim van der Meij
a6188a5c98
Merge pull request #11431 from wojtekmaj/secondary-toolbar-const
Use const in secondary_toolbar.js
2019-12-24 00:03:58 +01:00
Tim van der Meij
bcf8ae3527
Merge pull request #11437 from wojtekmaj/create-headers
Extract & use createHeaders helper
2019-12-23 23:55:34 +01:00
Tim van der Meij
32c3434c31
Merge pull request #11440 from Snuffleupagus/stats-pdfBug-tweak-test
Tweak the "gets page stats after rendering page, with `pdfBug` set" unit-test to remove an intermittent failure on Travis
2019-12-23 23:44:55 +01:00
Tim van der Meij
934d7cbc23
Merge pull request #11436 from wojtekmaj/npm-audit-fix
Update webpack-stream to fix vulnerabiliy reported by npm and dedupe Webpack
2019-12-23 23:41:25 +01:00
Jonas Jenwald
b4d95f3763 Tweak the "gets page stats after rendering page, with pdfBug set" unit-test to remove an intermittent failure on Travis
I recently noticed a couple of intermittent failures on Travis, hence this patch which changes the expectation to be identical to the 'Page Request' check in the preceding test-case.
2019-12-23 23:07:02 +01:00
Tim van der Meij
b5281e56c8
Merge pull request #11429 from wojtekmaj/toolbar-const
Use const in toolbar.js
2019-12-23 22:42:06 +01:00
Tim van der Meij
47c1f625f3
Merge pull request #11428 from wojtekmaj/ui-utils-const
Use const in ui_utils.js
2019-12-23 22:38:26 +01:00
Tim van der Meij
8638b0c88a
Merge pull request #11427 from wojtekmaj/view-history-const
Use const in view_history.js
2019-12-23 22:33:11 +01:00
Tim van der Meij
2de0447e63
Merge pull request #11426 from wojtekmaj/viewer-const
Use const in viewer.js
2019-12-23 22:29:15 +01:00
Tim van der Meij
d96d8c55e1
Merge pull request #11425 from wojtekmaj/viewer-compatibility-const
Use const in viewer_compatibility.js
2019-12-23 22:25:30 +01:00
Wojciech Maj
0330d1d286
Update webpack-stream to fix vulnerabiliy reported by npm
https://npmjs.com/advisories/1084

webpack-stream between 4.0.3 and 5.0.0 added official support for Webpack 4. Which is nice since we ARE using Webpack 4... Also, dropped support for Node.js 4 which shouldn't be a big deal for us since we are already using packages that are incompatible with Node.js 4 (Webpack 4.x supports Node.js 6 and up).
2019-12-23 09:00:45 +01:00
Wojciech Maj
d40d33682b
Extract & use createHeaders helper in src/display/fetch_stream.js 2019-12-23 08:08:17 +01:00
Wojciech Maj
74e442ef4c
Use const in pdf_thumbnail_viewer.js 2019-12-23 08:07:12 +01:00
Wojciech Maj
de6982e58e
Use const in preferences.js 2019-12-23 08:06:01 +01:00
Wojciech Maj
5ea9127391
Use const in secondary_toolbar.js 2019-12-23 08:04:56 +01:00
Wojciech Maj
8a8f75cf68
Use const in text_layer_builder.js 2019-12-23 08:04:35 +01:00
Wojciech Maj
790b0aede6
Use const in toolbar.js 2019-12-23 08:04:13 +01:00
Wojciech Maj
cf5af97b02
Use const in view_history.js 2019-12-23 08:03:12 +01:00
Wojciech Maj
276631db30
Use const in viewer.js 2019-12-23 08:02:42 +01:00
Wojciech Maj
b777e775f4
Use const in viewer_compatibility.js 2019-12-23 08:02:19 +01:00
Wojciech Maj
cd03fe014d
Use const in ui_utils.js 2019-12-23 08:00:15 +01:00
Jonas Jenwald
ad0b0d60a5 Ignore Metadata entries with incorrectly encoded characters, when setting the viewer title (bug 1605526)
Apparently Ghostscript can, in some cases, generate/include `Metadata` with incorrectly encoded characters.[1] This results in the viewer title looking wrong, which we thus attempt to avoid by falling back to the `Info` entry instead.

*Please note:* Obviously it would be better if this was fixed in the `Metadata` parser instead, rather than using a viewer work-around, but I'm just not sure how or even *if* that could actually be done given that the `Metadata` stream contains no trace of the *original* character.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1605526

---
[1] The problematic characters are from the Specials Unicode block, see https://en.wikipedia.org/wiki/Specials_(Unicode_block)
2019-12-22 17:20:14 +01:00