Commit Graph

15801 Commits

Author SHA1 Message Date
Jonas Jenwald
5b67202851
Merge pull request #14929 from calixteman/14928
Display background when printing or saving a text widget (issue #14928)
2022-05-20 18:11:10 +02:00
Jonas Jenwald
bf211eeef5
Merge pull request #14947 from IsaacLK/master
Twitter should be capitalized.
2022-05-20 18:03:37 +02:00
IsaacLK
e003e82c98
Twitter should be capitalized. 2022-05-20 09:36:10 -04:00
calixteman
3c877f9520
Merge pull request #14945 from calixteman/devicepixels
Allow to have float numbers when getting image information in reftest-analyzer
2022-05-20 13:55:23 +02:00
Calixte Denizet
0a66e1f5ea Allow to have float numbers when getting image information in reftest-analyzer
- outputScale can be e.g. 1.5 in real life.
2022-05-20 13:02:22 +02:00
Calixte Denizet
60498c67e4 Display background when printing or saving a text widget (issue #14928) 2022-05-19 16:41:54 +02:00
Jonas Jenwald
8a349801dc [Firefox viewer] Stop using FirefoxCom.requestAsync in the DownloadManager
After the changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1757771, that simplified the MOZCENTRAL downloading code, the `ChromeActions.download`-method will no longer invoke the `sendResponse`-callback.
Hence it should no longer be necessary for the `DownloadManager`, in the MOZCENTRAL viewer, to use `FirefoxCom.requestAsync` since no response is ever provided.[1] For the allocated BlobURLs, they should (hopefully) be released when navigating away from the viewer.

---
[1] Note that that was *already* the case, for one of the previous code-paths in the `ChromeActions.download`-method.
2022-05-15 18:18:37 +02:00
Jonas Jenwald
4f1cd6a9c2 Remove the sourceEventType from the viewer (bug 1757771 follow-up)
After the changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1757771, that simplified the MOZCENTRAL downloading code, the `sourceEventType` is now completely unused and should thus be removed (in my opinion).

Furthermore, with these changes, we also no longer need a *separate* internal "save"-event and can instead just use the older "download"-event everywhere.
2022-05-15 18:18:37 +02:00
Jonas Jenwald
60e9065bf6
Merge pull request #14898 from calixteman/progress
[api-minor] Use a CSS transform to update the progress bar instead of changing the width (bug 1768481)
2022-05-15 18:18:08 +02:00
Calixte Denizet
e94b9d1d7f Use a CSS transform to update the progress bar instead of changing the width (bug 1768481)
- it isn't a fix for bug 1768481 but just a tiny improvement to refresh the progress bar on the compositor thread.
2022-05-15 17:30:37 +02:00
Jonas Jenwald
63441e8f1e
Merge pull request #14921 from Snuffleupagus/issue-14917
Adjust the heuristics for handling of incomplete path operators (issue 14917)
2022-05-15 15:02:52 +02:00
Tim van der Meij
c06384054d
Merge pull request #14920 from Snuffleupagus/update-packages
Update packages and translations
2022-05-15 11:37:56 +02:00
Jonas Jenwald
5a774b7ed3 Adjust the heuristics for handling of incomplete path operators (issue 14917)
This limits the heuristics for handling of incomplete path operators, see PR 9838, to only apply to *sequences* of such operators. In practice a couple of invalid path operators are (hopefully) unlikely to completely break rendering, whereas a sequence of them will easily lead to fairly chaotic rendering artifacts.
2022-05-15 11:24:39 +02:00
Jonas Jenwald
54080b6884 Update l10n files 2022-05-15 09:12:37 +02:00
Jonas Jenwald
5320316f73 Update npm packages 2022-05-15 09:07:35 +02:00
Tim van der Meij
46e4a305eb
Merge pull request #14919 from timvandermeij/bump
Bump versions in `pdfjs.config`
2022-05-14 14:47:27 +02:00
Tim van der Meij
bfb0880523
Bump versions in pdfjs.config 2022-05-14 14:45:59 +02:00
Tim van der Meij
eaaa8b4ade
Merge pull request #14918 from Snuffleupagus/ProgressBar-modernize
[api-minor] Modernize and simplify the `ProgressBar` class
2022-05-14 14:15:13 +02:00
Jonas Jenwald
1f3da032b4 [api-minor] Modernize and simplify the ProgressBar class
The original `ProgressBar`-functionality is very old, and could thus do with some general clean-up.
In particular, while it currently accepts various options those have never really been used in either the default viewer or in any examples. The sort of "styling" that these options provided are *much better*, not to mention simpler, done directly with CSS rules.

As part of these changes, the "progress" is now updated using CSS variables rather than by directly modifying the `style` of DOM elements. This should hopefully simplify future changes to this code, see e.g. PR 14898.

Finally, this also fixes a couple of other small things in the "mobile viewer" example.
2022-05-14 13:49:10 +02:00
Tim van der Meij
b5f2bd8bfd
Merge pull request #14910 from Snuffleupagus/adjustScaleWidth-animationStarted
Ensure that setting the width of the zoom dropdown works correctly (PR 14028 follow-up)
2022-05-14 13:29:15 +02:00
Jonas Jenwald
efe3cb2982 Remove unnecessary clean-up in Toolbar.#adjustScaleWidth
While zeroing the temporary `canvas` makes sense, manually clearing the canvas and its context doesn't really accomplish anything since those are tied to the scope of the method.
2022-05-13 17:20:35 +02:00
Jonas Jenwald
3dd8b9cccf Ensure that setting the width of the zoom dropdown works correctly (PR 14028 follow-up)
We need to wait for UI rendering to start *before* getting the CSS variable values, since otherwise the values will be `NaN`.
This is only an issue if the viewer is completely hidden during loading, e.g. in a `display: none` iframe-element.
2022-05-13 17:10:42 +02:00
Jonas Jenwald
96b125fb72
Merge pull request #14911 from Snuffleupagus/more-TypedArray-fill
Use `TypedArray.prototype.fill()` a bit more in the code-base
2022-05-13 13:47:17 +02:00
Jonas Jenwald
d540df0582 Use TypedArray.prototype.fill() a bit more in the code-base
Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/fill, which is implemented in all browsers that we currently support.
2022-05-13 12:42:51 +02:00
Tim van der Meij
fbc7981c98
Merge pull request #14894 from Snuffleupagus/rm-mozOpaque
Try to remove the `mozOpaque` canvas-property (PR 6551 follow-up)
2022-05-12 22:03:05 +02:00
Jonas Jenwald
ed70ec8726
Merge pull request #14899 from Snuffleupagus/issue-14896
[api-minor] Include line endings in Line/Polyline Annotation-data (issue 14896)
2022-05-12 11:29:17 +02:00
Jonas Jenwald
6bcc5b615d [api-minor] Include line endings in Line/Polyline Annotation-data (issue 14896)
Please refer to:
 - https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2109792
 - https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2096489
 - https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2096447

Note that we still won't attempt to use the /LE-data when creating fallback appearance streams, as mentioned in PR 13448, since custom line endings aren't common enough to warrant the added complexity.
Finally, note that according to the PDF specification we should *potentially* also take the line endings into account for FreeText Annotations. However, in that case their use is conditional on other parameters that we currently don't support.
2022-05-12 11:08:30 +02:00
Jonas Jenwald
8dc836d105
Merge pull request #14904 from Snuffleupagus/preprocess-blank-lines
Avoid the `preprocess`-function adding consecutive blank lines
2022-05-12 10:07:52 +02:00
Jonas Jenwald
ec6575db00 Avoid the preprocess-function adding consecutive blank lines
When pre-processor blocks are being removed, since they don't apply to the current build target, we may currently end up with consecutive blank lines.
While this is obviously not a big issue, it's nonetheless undesirable and we can adjust the `writeLine` function to prevent that.
2022-05-11 14:21:16 +02:00
Jonas Jenwald
9ceceaeeb5
Merge pull request #14903 from Snuffleupagus/issue-14902
Update the `preprocess`-function to avoid adding trailing new-lines (issue 14902)
2022-05-11 12:52:07 +02:00
Jonas Jenwald
527251d62b Update the preprocess-function to avoid adding trailing new-lines (issue 14902)
*This is a follow-up to PR 14886, which "broke" this.*

In addition to fixing the issue, using an Array and `join`-ing it at the end may also be a tiny bit more efficient than using a growing string.
2022-05-11 12:36:00 +02:00
Jonas Jenwald
af5789125f Try to remove the mozOpaque canvas-property (PR 6551 follow-up)
According to MDN, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/mozOpaque, the `mozOpaque` canvas-property is not only non-standard (obviously) but it's also been deprecated.
Instead it's recommended to use `alpha = false` when getting the canvas-context, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#contextattributes, which all of our affected code is already doing.
2022-05-09 13:03:08 +02:00
Jonas Jenwald
38c82357b2
Merge pull request #14890 from calixteman/14889
[JS] Formatted value has to be a string when neither null nor undefined
2022-05-08 17:25:29 +02:00
Calixte Denizet
ab3958d6e8 [JS] Formatted value has to be a string when neither null nor undefined 2022-05-08 16:43:57 +02:00
Tim van der Meij
72943ae630
Merge pull request #14886 from Snuffleupagus/preprocessCSS-refactor
Use the regular `preprocess`-function for the CSS files as well
2022-05-08 13:53:14 +02:00
Tim van der Meij
753abc383e
Merge pull request #14888 from Snuffleupagus/attachmentsCount-zero
Try to fix dispatching of "attachmentsloaded"-events, when the document contains no "regular" attachments (PR 8788, 12163 follow-up)
2022-05-08 13:44:14 +02:00
Tim van der Meij
7111a172df
Merge pull request #14885 from Snuffleupagus/mozcentral-rm-unbindEvents
Stop bundling `PDFViewerApplication.{unbindEvents, unbindWindowEvents}` in MOZCENTRAL builds
2022-05-08 13:35:22 +02:00
Jonas Jenwald
3d9b2c9cd5
Merge pull request #14887 from Snuffleupagus/pageColors-followup
Ignore `pageColors` when the background/foreground is identical (PR 14874 follow-up)
2022-05-08 12:58:55 +02:00
Jonas Jenwald
dacea52966 Try to fix dispatching of "attachmentsloaded"-events, when the document contains no "regular" attachments (PR 8788, 12163 follow-up)
*This patch can be tested, in the viewer, using the `annotation-fileattachment.pdf` document from the test-suite.*

It seems that the code to delay dispatching of the "attachmentsloaded"-event, when `attachmentsCount === 0`, is now effectively broken.[1]
Rather than only using an arbitrary timeout, the new code will instead wait for an "annotationlayerrendered"-event and only *fallback* to using a timeout.

---
[1] The timing of the annotationLayer-rendering changed slightly in PR 14247, and the old code in `PDFAttachmentViewer` wasn't good enough to handle that.
2022-05-08 12:12:49 +02:00
Jonas Jenwald
472a1f9c91 Ignore pageColors when the background/foreground is identical (PR 14874 follow-up)
If the computed background/foreground colors are identical, the `canvas` would be rendered mostly blank with only images visible. Hence it seems reasonable to also ignore the `pageColors`-option in this case.

Also, the patch tries to *briefly* outline the various cases in which we ignore the `pageColors`-option in a comment.
2022-05-08 11:40:50 +02:00
Jonas Jenwald
39251c5789 Re-order the names of the new pageColors options/preferences (PR 14874 follow-up)
Given that the new API-option is an Object named `pageColors`, with `background`/`foreground` keys, it occurred to me that it'd be slightly more consistent if the options/preferences names fully reflected that.
2022-05-08 11:15:04 +02:00
Jonas Jenwald
80910f44e5 Stop bundling the openFile-buttons in the CHROME build
This is, for all intents and purposes, equivalent to PR 14833 and slightly reduces the size of the `gulp chromium` output.
2022-05-07 22:45:56 +02:00
Jonas Jenwald
d1f13a6af3 Use the regular preprocess-function for the CSS files as well
An old shortcoming of the `preprocessCSS`-function is its complete lack of support for our "normal" defines, which makes it very difficult to have build-specific CSS rules. Recently we've started using specially crafted comments to remove CSS rules from the MOZCENTRAL build, but (ab)using the `preprocessCSS`-function in this way really doesn't feel great.
However, it turns out to be surprisingly simple to instead use the "regular" `preprocess`-function for the CSS files as well. The only special-handling that's still necessary is the helper-function for dealing with CSS-imports, but apart from that everything seems to just work.

One reason, as far as I can tell, for having a separate `preprocessCSS`-function was likely that we originally used *lots* of vendor-prefixed CSS rules in our CSS files. With improvements over the years, especially thanks to Autoprefixer and PostCSS, we've been able to remove *almost* all non-standard CSS rules and the need for special-casing the CSS parsing has mostly vanished.

*Please note:* As part of testing this patch I've diffed the output of `gulp generic`, `gulp mozcentral`, and `gulp chromium` against the `master`-branch to check that there was no obvious breakage.
2022-05-07 22:45:52 +02:00
Jonas Jenwald
ed8b172d12 Stop bundling PDFViewerApplication.{unbindEvents, unbindWindowEvents} in MOZCENTRAL builds
These methods are completely unused in the Firefox PDF Viewer, and were only added to supplement the `PDFViewerApplication.{bindEvents, bindWindowEvents}`-methods since third-party implementations may apparently need to remove event listeners (see PR 8525).
However, in the MOZCENTRAL build that's just dead code and this patch reduces the size of the *built* `web/viewer.js`-file by `~3.5` kB.
2022-05-07 15:51:32 +02:00
Tim van der Meij
f8838eb794
Merge pull request #14882 from Snuffleupagus/issue-14881
Add support for TrueType format 12 `cmap`s (issue 14881)
2022-05-07 11:45:54 +02:00
Tim van der Meij
0a34b3bb81
Merge pull request #14884 from Snuffleupagus/fileattachmentannotation-event
Simplify the "fileattachmentannotation"-event handling a little bit
2022-05-07 11:35:40 +02:00
Tim van der Meij
82353cf728
Merge pull request #14880 from Snuffleupagus/CSS--viewer-container-height
Introduce a `--viewer-container-height` CSS variable to simplify the code
2022-05-07 11:25:32 +02:00
Tim van der Meij
be67ec4a10
Merge pull request #14877 from Snuffleupagus/PresentationMode-spreadMode
Add (basic) support for Spread modes in PresentationMode (issue 14749)
2022-05-07 11:19:20 +02:00
Jonas Jenwald
7f40ef41a5 Simplify the "fileattachmentannotation"-event handling a little bit
*This patch can be tested, in the viewer, using the `annotation-fileattachment.pdf` document from the test-suite.*

Note how the `FileSpec`-implementation already uses `stringToPDFString` during the filename lookup, see cfac6fa511/src/core/file_spec.js (L70)
Hence there's no reason to repeat that again in the `FileAttachmentAnnotationElement`-constructor, and we can thus simplify the "fileattachmentannotation"-event handling a little bit.
2022-05-06 20:55:18 +02:00
Jonas Jenwald
9817230ef8 Introduce a --viewer-container-height CSS variable to simplify the code
This new CSS variable will allow us to simplify a couple of different viewer components, since we no longer need to use JavaScript-based hacks and can directly set the CSS rules instead. In particular:

 - The `BaseViewer`-handling, used as part of the code that will center pages *vertically* in PresentationMode, can be simplified.
   By using CSS to control the height of the "dummy"-page we avoid unnecessarily invalidating the scale-value, which can reduce *some* unneeded re-rendering while PresentationMode is active.

 - The `SecondaryToolbar.#setMaxHeight`-method, and its associated parameters, are no longer necessary and can be completely removed.

Note that in order for things to work correctly in general, the new `--viewer-container-height` CSS variable must potentially be updated on any window-based "resize"-event (even when there's no zooming). While this is currently only done in the default viewer, that shouldn't be an issue since neither PresentationMode nor Toolbar-functionality is included in the "viewer components".
2022-05-06 13:45:39 +02:00