Commit Graph

17817 Commits

Author SHA1 Message Date
Jonas Jenwald
58252a528d Inline the webViewerInitialized function in PDFViewerApplication.run
Given the size of this function respectively method, it seems reasonable to simply inline the `webViewerInitialized`-code here.
2023-07-02 11:43:28 +02:00
Jonas Jenwald
cae8fe4c7e Move the setTitleUsingUrl-call into PDFViewerApplication.initPassiveLoading
This seems overall nicer, rather than having to "manually" call this when initializing passive loading.
2023-07-02 11:43:16 +02:00
Tim van der Meij
73b6ee5325
Merge pull request #16612 from erm1116/fix-contentscript-updateEmbedElement
Fix reading property of null object in chrome extension's updateEmbedElement function
2023-07-01 13:30:37 +02:00
Tim van der Meij
8a954823b5
Merge pull request #16616 from Snuffleupagus/PDFCursorTools-tweaks
A couple of small tweaks of the `PDFCursorTools` class
2023-07-01 13:04:44 +02:00
Tim van der Meij
e070e730c7
Merge pull request #16627 from Snuffleupagus/rm-Node-Buffer
[api-minor] Stop "supporting" binary data provided as `Buffer` in Node.js environments (PR 16055 follow-up)
2023-07-01 13:00:19 +02:00
Tim van der Meij
366a4ff1e9
Merge pull request #16626 from Snuffleupagus/rm-pageColors-supports-check
[api-minor] Remove the `CSS.supports` checks for the `pageColors`-option in the GENERIC viewer
2023-07-01 12:58:30 +02:00
Tim van der Meij
94015c71ad
Merge pull request #16601 from Rob--W/crx-maintained-again
Revert "Temporarily stop listing the official Chrome extension in the main README"
2023-07-01 12:54:45 +02:00
Tim van der Meij
d057caedf5
Merge pull request #16607 from Rob--W/lint-chromium-actionable-warnings
Improve lint-chromium to output actionable information
2023-07-01 12:53:56 +02:00
Jonas Jenwald
25bac064d8 [api-minor] Stop "supporting" binary data provided as Buffer in Node.js environments (PR 16055 follow-up)
Given that the PDF.js library has never officially supported/documented that binary data can be provided as a `Buffer`, and that it's been explicitly deprecated in *four* releases, it seems reasonable that we outright reject such data instead (to reduce the amount of Node.js specific code-paths).
2023-07-01 10:34:18 +02:00
Jonas Jenwald
be775143b2 [api-minor] Remove the CSS.supports checks for the pageColors-option in the GENERIC viewer
Given the browsers that we currently support it's probably not necessary to keep the checks for the color-values.
2023-06-30 18:37:16 +02:00
Jonas Jenwald
ac937a9b3c
Merge pull request #16622 from Snuffleupagus/image_decoders-rm-polyfill-comment
Remove outdated polyfill comment from `src/pdf.image_decoders.js`
2023-06-30 17:18:45 +02:00
erm1116
fcf38f6ae9 fix: use node.insertBefore for adding embed element 2023-06-30 22:38:59 +09:00
Jonas Jenwald
ffa9795ca9
Merge pull request #16620 from Snuffleupagus/AnnotationStorage-transfers
Move the `transfers` computation into the `AnnotationStorage` class
2023-06-30 14:28:55 +02:00
Jonas Jenwald
2f80fc1b3d
Merge pull request #16623 from Snuffleupagus/fully-rm-render-canvasFactory
Fully remove the `canvasFactory` option from `PDFPageProxy.render` (PR 16242 follow-up)
2023-06-30 10:25:45 +02:00
Jonas Jenwald
64aa28953d Fully remove the canvasFactory option from PDFPageProxy.render (PR 16242 follow-up)
We've now been throwing an Error in *three* releases if the `canvasFactory` option is provided, hence it ought to be fine to stop doing that and simply ignore the option instead.
2023-06-30 09:21:45 +02:00
Jonas Jenwald
d3723cec95 Remove outdated polyfill comment from src/pdf.image_decoders.js
Given that none of the mentioned polyfills are used any more, the comment is no longer helpful.
2023-06-30 07:29:45 +02:00
Jonas Jenwald
39113baa33 Move the transfers computation into the AnnotationStorage class
Rather than having to *manually* determine the potential `transfers` at various spots in the API, we can let the `AnnotationStorage.serializable` getter include this.
To further simplify things, we can also let the `serializable` getter compute and include the `hash`-string as well.
2023-06-29 19:51:57 +02:00
Jonas Jenwald
f373fcb356 Remove a couple of unused options from the GrabToPan constructor
These options are completely unused in the PDF.js viewer, and given that the last update of the `GrabToPan`-code from upstream was in 2016 it shouldn't hurt to remove them.
2023-06-29 13:16:10 +02:00
calixteman
88c7c8b5bf
Merge pull request #16588 from calixteman/editor_stamp_2
[Editor] Add support for printing/saving newly added Stamp annotations
2023-06-28 22:42:54 +02:00
Jonas Jenwald
d329267926 Use Element.scrollTo unconditionally in the GrabToPan class
According to the MDN compatibility data this is available in all browsers that we currently support; please see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo#browser_compatibility
2023-06-28 12:43:36 +02:00
Jonas Jenwald
4f82dd3932 Create a GrabToPan-instance lazily in the PDFCursorTools class
Unless the user enables the "HandTool" we don't actually need to create a `GrabToPan`-instance.
2023-06-28 12:43:36 +02:00
Jonas Jenwald
789e318cf7 A couple of small tweaks of the PDFCursorTools class
- Introduce a few private fields for internal state.

 - Inline a small method at its only call-site.
2023-06-28 12:43:34 +02:00
Rob Wu
8330390757 Improve lint-chromium to output actionable information
Before this commit, lint-chromium complained without an obvious course
of action:

> Warning: Pref objects doesn't have the same length.
> Error: chromium/preferences_schema is not in sync

With this commit, the error message is more actionable:

> Warning: extensions/chromium/preferences_schema.json does not contain an entry for pref: enableFloatingToolbar
> Error: chromium/preferences_schema is not in sync
2023-06-28 12:30:21 +02:00
Jonas Jenwald
50488d7a47
Merge pull request #16608 from Snuffleupagus/PDFPageView-refactor-filterFactory
Re-factor how HCM highlight-filters are handled in the viewer components (PR 16593 follow-up)
2023-06-27 15:13:00 +02:00
Jonas Jenwald
a024cd0127 Re-factor how HCM highlight-filters are handled in the viewer components (PR 16593 follow-up)
This is something that I completely overlooked during review of PR 16593, since the idea is (obviously) that the viewer-components should be usable as-is without the user needing to manually pass in any *additional* parameters.

To support this we can very easily expose the current `FilterFactory`-instance on the `PDFPageProxy`-class[1], and if needed initialize the highlight-filters when initializing the page (again limited to the viewer-components).
2023-06-26 23:37:39 +02:00
Rob Wu
9aedf00ffe Revert "Temporarily stop listing the official Chrome extension in the main README"
This reverts commit afabbc28c5.
2023-06-26 18:54:11 +02:00
calixteman
c4a61a7692
Merge pull request #16593 from calixteman/popup_hcm
Improve highlightments and popups in HCM (bug 1830850)
2023-06-26 16:34:17 +02:00
Jonas Jenwald
d357906c3f
Merge pull request #16605 from Snuffleupagus/rm-enableFloatingToolbar-pref
[GeckoView] Remove the `enableFloatingToolbar` preference
2023-06-26 15:56:14 +02:00
Calixte Denizet
599b9498f2 [Editor] Add support for printing/saving newly added Stamp annotations
In order to minimize the size the of a saved pdf, we generate only one
image and use a reference in each annotation using it.
When printing, it's slightly different since we have to render each page
independantly but we use the same image within a page.
2023-06-26 15:47:05 +02:00
Jonas Jenwald
80b4708fa3 [GeckoView] Remove the enableFloatingToolbar preference
Note that we'll now display the toolbar unconditionally in GeckoView.
2023-06-26 15:17:03 +02:00
Jonas Jenwald
21383fb2d1
Merge pull request #16602 from Snuffleupagus/gulpfile-TESTING-nullish-coalescing
Use nullish coalescing when handling the `TESTING` build-target
2023-06-26 14:54:45 +02:00
Jonas Jenwald
d7ae2f86e8
Merge pull request #16604 from Snuffleupagus/pdfviewer_api-test-Node
Run the PDF.js-viewer API unit-test in Node.js environments (PR 16592 follow-up)
2023-06-26 14:50:45 +02:00
Calixte Denizet
c519cc821b Improve highlightments and popups in HCM (bug 1830850)
- Modify the text and background colors in popup to fit a11y requirements
- Add a backdrop filter on clickable areas in using a svg filter mapping
  canvas colors to Highlight and HighlightText ones.
2023-06-26 14:45:03 +02:00
Jonas Jenwald
5f5db4b160 Run the PDF.js-viewer API unit-test in Node.js environments (PR 16592 follow-up)
It occurred to me that we can actually run this unit-test in Node.js environments by making use of the preprocessor to stub out the browser globals there.
2023-06-26 09:37:34 +02:00
Jonas Jenwald
9e7023776e Use nullish coalescing when handling the TESTING build-target
Given that nullish coalescing is now available in all environments/browser that we support, we can (ever so slightly) simplify handling of the `TESTING` build-target.
2023-06-25 16:02:31 +02:00
Tim van der Meij
ccb72073b0
Merge pull request #16598 from Snuffleupagus/update-packages
Update packages and translations
2023-06-25 15:19:01 +02:00
Tim van der Meij
0126774e98
Merge pull request #16600 from Rob--W/crx-min-version-88
[CRX] Set minimum_chrome_version to 88
2023-06-25 15:14:20 +02:00
Rob Wu
1f29baad22 Set minimum_chrome_version to 88
Set minimum_chrome_version to 88 to not distribute an incompatible
version of the extension to older Chrome versions.

See https://github.com/mozilla/pdf.js/issues/13669#issuecomment-1510485564
2023-06-25 14:19:50 +02:00
Jonas Jenwald
a4ddf7baaa Update l10n files 2023-06-25 09:19:03 +02:00
Jonas Jenwald
744b01b637 Update npm packages 2023-06-25 09:18:41 +02:00
Tim van der Meij
fa95bbce12
Merge pull request #16569 from Snuffleupagus/PDFScriptingManager-private
[api-minor] Re-factor the `PDFScriptingManager` class to use private fields/methods
2023-06-24 19:50:17 +02:00
Tim van der Meij
436699b0db
Merge pull request #16592 from Snuffleupagus/rm-viewer-component-default-factory
[api-minor] Remove the default-factories from the viewer components (PR 15811 follow-up)
2023-06-24 19:39:37 +02:00
Tim van der Meij
1ea502aaf9
Merge pull request #16590 from Snuffleupagus/rm-util-unused-const
Remove a couple of unused constants from `src/shared/util.js`
2023-06-24 19:36:11 +02:00
Tim van der Meij
371ee778ff
Merge pull request #16597 from Snuffleupagus/firefox-getPreferences-cleanup
[Firefox] Simplify `FirefoxPreferences._readFromStorage` (PR 16583 follow-up)
2023-06-24 19:34:42 +02:00
Jonas Jenwald
7667f55e45 [Firefox] Simplify FirefoxPreferences._readFromStorage (PR 16583 follow-up)
Now that https://bugzilla.mozilla.org/show_bug.cgi?id=1840064 has landed in mozilla-central we can implement the final piece of clean-up for the `FirefoxPreferences._readFromStorage` method.
2023-06-24 18:37:43 +02:00
Jonas Jenwald
e153e3a741 Expose FindState in the viewer-components (issue 16589) 2023-06-24 13:23:02 +02:00
Jonas Jenwald
f596490a1b Add a unit-test to check that the *official* PDF.js-viewer API exposes the expected functionality
Until now we've not actually had *any* tests that ensure that the *official* PDF.js-viewer API exposes the intended functionality, which means that things can easily break accidentally.

*Please note:* This unit-test cannot (easily) be run in Node.js-environments, since the `external/webL10n/l10n.js` file contains various browser-specific functionality.
2023-06-23 12:22:54 +02:00
Jonas Jenwald
c5e4a22ee0 [api-minor] Remove the default-factories from the viewer components (PR 15811 follow-up)
The changes in PR 15811 have now been included in no less than six official releases, hence it should hopefully be OK to remove this now.
2023-06-23 11:54:30 +02:00
Jonas Jenwald
b4b9419841 Remove a couple of unused constants from src/shared/util.js
These constants were added "speculatively" in PR 10820, almost four years ago, but have never actually been used. We already have issue 10982 that tracks *potentially* extending support for the affected annotation-format, however until that happens I really don't think that we should keep shipping completely unused code in the PDF.js library.

For the MOZCENTRAL build-target, i.e. the Firefox PDF Viewer, this reduces the total bundle size by 1.1 kilo-byte.
2023-06-23 10:44:08 +02:00
Jonas Jenwald
e9ccbd2856
Merge pull request #16587 from Snuffleupagus/test-pdfjs-API
Add a unit-test to check that the *official* PDF.js API exposes the expected functionality
2023-06-22 17:53:45 +02:00