1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00
Commit graph

19543 commits

Author SHA1 Message Date
Tim van der Meij
10312105a4
Merge pull request #17861 from Snuffleupagus/compatibilityParams-init
Limit all `compatibilityParams` handling to the GENERIC viewer
2024-04-02 14:47:37 +02:00
calixteman
26466b50bc
Merge pull request #17855 from calixteman/bug1888657
Avoid useless CSS animation when nothing is done (bug 1888657)
2024-04-01 19:01:14 +02:00
Jonas Jenwald
3b87c31abb
Merge pull request #17865 from Snuffleupagus/pr-17767-followup
Remove the `addWindowResolutionChange` listener unconditionally (PR 17767 follow-up)
2024-04-01 18:55:07 +02:00
Calixte Denizet
d3a613dd5b Avoid useless CSS animation when nothing is done (bug 1888657) 2024-04-01 17:32:38 +02:00
Jonas Jenwald
0fdea4b05c Remove the addWindowResolutionChange listener unconditionally (PR 17767 follow-up)
Given that `PDFViewerApplication.unbindWindowEvents` can be invoked in mozilla-central tests, we should ensure that the listener is always removed.
2024-04-01 16:00:25 +02:00
Jonas Jenwald
e4d0e84802 [api-minor] Replace the PromiseCapability with Promise.withResolvers()
This replaces our custom `PromiseCapability`-class with the new native `Promise.withResolvers()` functionality, which does *almost* the same thing[1]; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers

The only difference is that `PromiseCapability` also had a `settled`-getter, which was however not widely used and the call-sites can either be removed or re-factored to avoid it. In particular:
 - In `src/display/api.js` we can tweak the `PDFObjects`-class to use a "special" initial data-value and just compare against that, in order to replace the `settled`-state.
 - In `web/app.js` we change the only case to manually track the `settled`-state, which should hopefully be OK given how this is being used.
 - In `web/pdf_outline_viewer.js` we can remove the `settled`-checks, since the code should work just fine without it. The only thing that could potentially happen is that we try to `resolve` a Promise multiple times, which is however *not* a problem since the value of a Promise cannot be changed once fulfilled or rejected.
 - In `web/pdf_viewer.js` we can remove the `settled`-checks, since the code should work fine without them:
     - For the `_onePageRenderedCapability` case the `settled`-check is used in a `EventBus`-listener which is *removed* on its first (valid) invocation.
     - For the `_pagesCapability` case the `settled`-check is used in a print-related helper that works just fine with "only" the other checks.
 - In `test/unit/api_spec.js` we can change the few relevant cases to manually track the `settled`-state, since this is both simple and *test-only* code.

---
[1] In browsers/environments that lack native support, note [the compatibility data](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers#browser_compatibility), it'll be polyfilled via the `core-js` library (but only in `legacy` builds).
2024-04-01 11:42:37 +02:00
Jonas Jenwald
3d2eb36e27
Merge pull request #17858 from Snuffleupagus/issue-17848
Ensure that Mesh /Shadings have non-zero width/height (issue 17848)
2024-03-30 21:59:58 +01:00
Jonas Jenwald
62568b27dc Limit all compatibilityParams handling to the GENERIC viewer
With recent improvements to the `AppOptions`, e.g. with better validation and testing, one remaining "annoyance" is the `compatibilityParams` handling. Especially since there's only *a single* parameter left, limited to GENERIC builds.

To further reduce the amount of unnecessary code in e.g. the Firefox PDF Viewer, we can move the `compatibilityParams` handling into the user-options instead since that keeps the previous precedence order between default/user-options.
2024-03-30 12:16:53 +01:00
Jonas Jenwald
07a8836ab2 Ensure that Mesh /Shadings have non-zero width/height (issue 17848) 2024-03-29 22:58:25 +01:00
calixteman
5f87da50d5
Merge pull request #17857 from calixteman/issue17856
Display outlines even if one has no title
2024-03-29 22:48:19 +01:00
Calixte Denizet
136c1faa7f Display outlines even if one has no title
Fixes #17856.
2024-03-29 21:30:24 +01:00
Tim van der Meij
55db43966e
Merge pull request #17847 from Snuffleupagus/issue-17846
Add better support for /Launch actions with /FileSpec dictionaries (issue 17846)
2024-03-28 13:03:01 +01:00
Tim van der Meij
236a4df200
Merge pull request #17851 from Snuffleupagus/Chrome-98
[api-minor] Update the minimum supported Google Chrome version to 98
2024-03-28 12:59:39 +01:00
calixteman
e384df6f16
Merge pull request #17852 from calixteman/freetext_paste
[Editor] Correctly handle lines when pasting some text in a freetext
2024-03-27 20:54:30 +01:00
Calixte Denizet
2dbd7acc41 [Editor] Correctly handle lines when pasting some text in a freetext 2024-03-27 17:48:43 +01:00
Jonas Jenwald
0f7cb531cf [api-minor] Update the minimum supported Google Chrome version to 98
This patch updates the minimum supported browsers as follows:
 - Google Chrome 98, which was released on 2022-02-01; see https://chromereleases.googleblog.com/2022/02/stable-channel-update-for-desktop.html

The primary reason for this version bump is `structuredClone` support, please see https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility
At this point in time we're using `structuredClone` in different parts of the code-base, and it's unfortunately functionality that's difficult to polyfill *completely* (affects the `transfer` option specifically).

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2024-03-27 11:40:00 +01:00
Jonas Jenwald
0d039937f9 Add better support for /Launch actions with /FileSpec dictionaries (issue 17846) 2024-03-26 20:15:48 +01:00
Tim van der Meij
841d57df46
Merge pull request #17844 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-03-26 19:03:26 +01:00
Tim van der Meij
01a68def44
Update translations to the most recent versions 2024-03-26 16:32:53 +01:00
Tim van der Meij
2ca65e860a
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`.
2024-03-26 16:32:24 +01:00
Tim van der Meij
98ef8a1be3
Upgrade gulp-cli to version 3.0.0
This is a major version bump, but the changelog at
https://github.com/gulpjs/gulp-cli/releases/tag/v3.0.0 doesn't
indicate any breaking changes that should impact us.
2024-03-26 16:29:24 +01:00
Tim van der Meij
8f3deedafa
Upgrade globals to version 15.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/globals/releases/tag/v15.0.0 doesn't
indicate any breaking changes that should impact us.
2024-03-26 16:29:20 +01:00
Tim van der Meij
3f7ea67f68
Update dependencies to the most recent versions 2024-03-26 16:26:24 +01:00
Tim van der Meij
1141af9d6f
Merge pull request #17842 from Snuffleupagus/Preference-tweaks
A couple of small tweaks of the `BasePreferences` class
2024-03-26 16:12:06 +01:00
Jonas Jenwald
5e08396696 A couple of small tweaks of the BasePreferences class
- Use slightly shorter variable names when initializing the preferences.
 - Correctly copy the "old" preference-values before writing to storage, since Objects are passed by reference in JavaScript. (Only applies to the GENERIC viewer.)
 - Use `await` fully when writing new preference-values to storage. (Only applies to the GENERIC viewer.)
 - Stub the `get`-method in the Firefox PDF Viewer, since it's unused there nowadays.
2024-03-26 13:38:40 +01:00
calixteman
3d7ea6076d
Merge pull request #17837 from calixteman/increase_max_canvas_pixels
Increase the maxCanvasPixels value to 2 ** 25
2024-03-25 19:55:48 +01:00
calixteman
3110a8a8dc
Merge pull request #17827 from calixteman/divider
[Editor] Add a divider before the show all button
2024-03-25 18:01:28 +01:00
Calixte Denizet
a4aca8a20d Increase the maxCanvasPixels value to 2 ** 25 2024-03-25 17:57:23 +01:00
calixteman
ad791cc462
Merge pull request #17835 from calixteman/annotation_alt_text
Add alternative text to annotation if any
2024-03-25 16:40:06 +01:00
Calixte Denizet
77b2a456d1 [Editor] Add a divider before the show all button
I overlooked it when implementing the toggle button.
2024-03-25 14:59:34 +01:00
Jonas Jenwald
90dfe52a76
Merge pull request #17830 from Snuffleupagus/path2d-new-polyfill
Update the `Path2D` polyfill for Node.js environments
2024-03-25 14:58:08 +01:00
calixteman
3fbd6b5a77
Merge pull request #17823 from calixteman/bug1886959
[Editor] Fix undoing an editor deletion (bug 1886959)
2024-03-25 14:42:32 +01:00
Calixte Denizet
d5a0e557c2 [Editor] Fix undoing an editor deletion (bug 1886959)
The original bug was because the parent was null when trying to show
an highlight annotation which led to an exception.
That led me to think about having some null/non-null parent when removing
an editor: it's a mess especially if a destroyed parent is still attached
to an editor. Consequently, this patch always sets the parent to null when
deleting the editor.
2024-03-25 14:17:40 +01:00
Calixte Denizet
a520ad4633 Add alternative text to annotation if any 2024-03-25 13:35:54 +01:00
calixteman
b0f54b2235
Merge pull request #17831 from calixteman/puppeteer_22_6_0
Update puppeteer to 22.6.0
2024-03-24 12:46:37 +01:00
Jonas Jenwald
dc0df0a3c2 Update the Path2D polyfill for Node.js environments
The polyfill that we use was recently split into two packages, and it now consists of a "core" package and a browser-specific package that build upon the former.
Hence we need to update to use the "core" package, and slightly tweak the code that loads/initializes the polyfill; see also https://www.npmjs.com/package/path2d

This patch was tested successfully with the [pdf2png example](https://github.com/mozilla/pdf.js/tree/master/examples/node/pdf2png), after running `gulp dist-install` locally, using [this PDF document](https://bug810214.bmoattachments.org/attachment.cgi?id=9254990) which contains Type3-fonts that render using `Path2D`.
2024-03-24 12:09:21 +01:00
calixteman
14307c04dd
Merge pull request #17825 from calixteman/bug1886964
[Editor] Add a label to the highight floating button readable with NVDA (bug 1886964)
2024-03-23 18:30:42 +01:00
Calixte Denizet
b7f3c78d01 Update puppeteer to 22.6.0 2024-03-23 16:22:51 +01:00
Calixte Denizet
63c1c787b4 [Editor] Add a label to the highight floating button readable with NVDA (bug 1886964) 2024-03-23 16:12:03 +01:00
Tim van der Meij
e7203f558f
Merge pull request #17813 from Snuffleupagus/initPassiveLoading-simplify
Remove `PDFViewerApplication.initPassiveLoading` and directly invoke the `open`-method from the extension-specific code
2024-03-22 10:02:51 +01:00
Jonas Jenwald
067c49dc49
Merge pull request #17818 from Snuffleupagus/updatePrefs
Allow listening for preference changes in the Firefox PDF viewer (bug 1886586)
2024-03-21 19:02:25 +01:00
Jonas Jenwald
44427fa7b2 Allow listening for preference changes in the Firefox PDF viewer (bug 1886586) 2024-03-21 17:07:49 +01:00
calixteman
1083087eee
Merge pull request #17817 from calixteman/zoom_reset
Avoid wrong scrolling when calling zoomReset
2024-03-21 16:28:19 +01:00
Calixte Denizet
918b500ca5 Avoid wrong scrolling when calling zoomReset
The goal of this patch is to fix the test:
https://searchfox.org/mozilla-central/source/toolkit/components/pdfjs/test/browser_pdfjs_zoom.js

It's a regression due to #17790.
2024-03-21 16:04:36 +01:00
calixteman
ae60221b0e
Merge pull request #17814 from calixteman/bug1886427
[Editor] Make sure the text in the mark has null dimensions to avoid to see a meaningless rectangle in voiceover (bug 1886427)
2024-03-20 16:23:10 +01:00
Calixte Denizet
3ac52ac359 [Editor] Make sure the text in the mark has null dimensions to avoid to see a meaningless rectangle in voiceover (bug 1886427) 2024-03-20 15:25:13 +01:00
Jonas Jenwald
ea1c910a66 Remove PDFViewerApplication.initPassiveLoading and directly invoke the open-method from the extension-specific code
This old method is essentially just adding, a small amount of, unnecessary indirection and we can easily invoke `PDFViewerApplication.open` directly from the extension-specific code instead.
2024-03-20 14:52:23 +01:00
Jonas Jenwald
b5e00e1fae Move the error message localization into PDFViewerApplication._otherError
When reporting errors in the viewer we currently localize the error messages "manually" at every call-site, which seems like unnecessary repetition.
2024-03-20 14:52:16 +01:00
Tim van der Meij
e8da59c6b1
Merge pull request #17691 from Snuffleupagus/createWebpackAlias
Move the `alias`-building out of the `createWebpackConfig` function
2024-03-20 14:17:42 +01:00
Tim van der Meij
9673a6d344
Merge pull request #17811 from calixteman/simplify_copy_paste_test
Simplify the copy & paste integration test
2024-03-20 14:09:25 +01:00