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

18911 commits

Author SHA1 Message Date
Tim van der Meij
fb21c4261d
Merge pull request #17890 from timvandermeij/font-tests-callbacks
Modernize the TTX driver code
2024-04-08 20:12:08 +02:00
Tim van der Meij
be4b56edda
Merge pull request #17891 from timvandermeij/thumbnail-private-methods
Convert the thumbnail view(er) code to use proper private methods
2024-04-08 20:11:42 +02:00
Calixte Denizet
976ee96aa8 [Editor] Don't add an already added editor (bug 1890367) 2024-04-08 19:50:55 +02:00
Tim van der Meij
2aeafc0d55
Merge pull request #17905 from timvandermeij/annotation-dash-array
Fix annotation border style parsing by handling empty dash arrays
2024-04-08 18:11:10 +02:00
Tim van der Meij
d01a0bd0c8
Fix annotation border style parsing by handling empty dash arrays
The PDF specification states that empty dash arrays, i.e. arrays with
zero elements, are in fact valid. In that case the dash array simply
corresponds to a solid, unbroken line. However, this case was erroneously
being flagged as invalid and therefore the annotation was not drawn
because its width was set to zero. This commit fixes the issue by
allowing dash arrays to have a length of zero.
2024-04-08 16:34:27 +02:00
Tim van der Meij
862c27ee67
Convert the thumbnail view(er) code to use proper private methods
This allows us to get rid of the `@private` JSDoc comments, which were
used to convey intent back when proper private methods could not be used
yet in JavaScript. This improves code readability/maintenance and enables
better usage validation by tooling such as ESlint.
2024-04-05 14:44:48 +02:00
Tim van der Meij
ac03d7054d
Convert the TTX driver code to promises
This commit removes the final callbacks in this code by switching to a
promises-based interface, overall simplifying the code. Moreover, we
document why we write to files on disk and modernize the code using e.g.
template strings.
2024-04-05 13:34:54 +02:00
Tim van der Meij
64065141b6
Remove the timeout logic from the TTX driver code
The original `test.py` code, see
c2376e5cea/test/test.py,
did not have any timeout logic for TTX, but it got introduced when
`test.py` was ported from Python to JavaScript as `test.js` in
c2376e5cea (diff-a561630bb56b82342bc66697aee2ad96efddcbc9d150665abd6fb7ecb7c0ab2f).

However, I don't think we've ever actually seen TTX timing out.
Moreover, back then we used a very old version of TTX and ran the font
tests on the bots (where a hanging process would block other jobs and
would require a manual action to fix), so this code was most likely
only included defensively.

Fortunately, nowadays it should not be necessary anymore because we use
the most recent version of TTX (which either returns the result or
errors out, but isn't known to hang on inputs) and we run the font tests
on GitHub Actions which doesn't block other jobs anymore and also
automatically times the job out for us in the unlikely event that a hang
would ever occur.

In short, we can safely remove this logic to simplify the code and to get
rid of a callback.
2024-04-05 12:49:26 +02:00
Tim van der Meij
5adad89eb3
Merge pull request #17880 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-04-04 19:09:25 +02:00
Tim van der Meij
a5308e129a
Merge pull request #17885 from calixteman/bug1889623
[Editor] Remove the mark from the highlight element and set its role to mark (bug 1889623)
2024-04-04 18:24:59 +02:00
Calixte Denizet
54110de109 [Editor] Remove the mark from the highlight element and set its role to mark (bug 1889623)
Set aria-label to the highlighted text, this way the focus frame is exactly set
on the highlight element and the higlighted text is read.
2024-04-04 18:06:05 +02:00
calixteman
25f6a0c139
Merge pull request #17875 from calixteman/jbig2_issue
Update the current stride before composing when decoding a text region
2024-04-03 20:41:24 +02:00
Calixte Denizet
3f2f98336e Update the current stride before composing when decoding a text region
Fixes #17871.

We do something similar to:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/pdfium/core/fxcodec/jbig2/JBig2_TrdProc.cpp;l=373-379;drc=24c6be6924df3ff585bb63f6aed4e2c81e791fb2
2024-04-03 18:44:50 +02:00
calixteman
d8331e3100
Merge pull request #17810 from calixteman/issue17808
Don't translate char codes when platform,encoding isn't (3,0)
2024-04-03 17:05:14 +02:00
Calixte Denizet
8f5d907a52 Don't translate char codes when platform,encoding isn't (3,0) 2024-04-03 16:08:11 +02:00
Tim van der Meij
cecbcd126f
Update translations to the most recent versions 2024-04-03 14:43:26 +02:00
Tim van der Meij
97f40807c7
Update dependencies to the most recent versions 2024-04-03 14:42:19 +02:00
Tim van der Meij
2e5282928f
Merge pull request #17854 from Snuffleupagus/rm-PromiseCapability
[api-minor] Replace the `PromiseCapability` with  `Promise.withResolvers()`
2024-04-02 15:21:43 +02:00
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