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

20565 commits

Author SHA1 Message Date
Jonas Jenwald
65df1d336f Check more of the stream when looking for commands after inline image (issue 19494)
Currently we only check `followingBytes`, which turns out to be too short to find e.g. valid transform (cm) commands with decimal arguments.
2025-02-15 15:14:47 +01:00
Jonas Jenwald
a722ca4de5 Shorten the CipherTransformFactory.prototype.#buildObjectKey method
- Use `TypedArray.prototype.set()` rather than a manual loop when building the `key`.

 - Use an existing local variable to avoid re-computing the length of the `encryptionKey`.
2025-02-15 13:00:42 +01:00
calixteman
92ff26e4ff
Merge pull request #19427 from calixteman/bug1946181
Add some unicode mapping for ligatures when writing the cmap table in the font (bug 1946181)
2025-02-14 17:46:07 +01:00
Jonas Jenwald
144e5fe196
Merge pull request #19476 from Snuffleupagus/issue-19474
Search for destinations in both /Names and /Dests dictionaries (issue 19474)
2025-02-14 16:05:36 +01:00
Jonas Jenwald
33cba30bdb Search for destinations in both /Names and /Dests dictionaries (issue 19474)
Currently we only use either one of them, preferring the NameTree when it's available.
2025-02-14 15:49:05 +01:00
Jonas Jenwald
c69282a64f
Merge pull request #19487 from Snuffleupagus/OverlayManager-closeIfActive
Add a new `closeIfActive` method in the `OverlayManager` class
2025-02-14 15:46:13 +01:00
Jonas Jenwald
96f5dcbd91 Add a new closeIfActive method in the OverlayManager class
It's now pretty common that we only want to close a `dialog` *if* it's currently active, to avoid throwing errors, and this new method provides a shorter and more convenient way to achieve that.
2025-02-14 15:43:00 +01:00
calixteman
6258a77bd7
Merge pull request #19486 from calixteman/signature_edit_desc
[Editor] Add the possibility to change a signature description (bug 1948116)
2025-02-14 15:41:45 +01:00
Jonas Jenwald
6ad56135c9
Merge pull request #19481 from Snuffleupagus/GenericL10n-fetch-bundles-parallel
[GenericL10n] Fetch the language bundles in parallel to reduce load time
2025-02-14 15:33:29 +01:00
Jonas Jenwald
c81a404138
Merge pull request #19475 from Snuffleupagus/injectLinkAnnotations-method-event
Move the auto-link handling into its own `PDFPageView` helper-method, and dispatch a "linkannotationsadded" event
2025-02-14 14:05:06 +01:00
Calixte Denizet
1d82b2ce94 [Editor] Add the possibility to change a signature description (bug 1948116) 2025-02-14 14:00:45 +01:00
Jonas Jenwald
a877493826
Merge pull request #19485 from Snuffleupagus/SignatureManager-Array-from-shorten
Slightly shorten an `Array.from` usage in the `SignatureManager` class
2025-02-14 10:44:37 +01:00
Jonas Jenwald
7dbf8c8e4b Slightly shorten an Array.from usage in the SignatureManager class
This should be equivalent to the old code, and besides being ever so slightly shorter I'm also finding it a little bit easier to read at a glance.
2025-02-13 20:04:02 +01:00
calixteman
74a7576c2c
Merge pull request #19478 from calixteman/signature_init
[Editor] Populate the 'Add signature' menu with the saved signatures (bug 1947828)
2025-02-13 16:46:01 +01:00
Calixte Denizet
68451fe17e [Editor] Populate the 'Add signature' menu with the saved signatures (bug 1947828) 2025-02-13 15:59:57 +01:00
Jonas Jenwald
8d8e25c89d [GenericL10n] Fetch the language bundles in parallel to reduce load time
For non `en-US` locales this will, ever so slightly, shorten the time it takes to load and parse the language bundles.
2025-02-13 11:53:45 +01:00
Jonas Jenwald
8727a04ae5 Move the auto-link handling into its own PDFPageView helper-method, and dispatch a "linkannotationsadded" event
This is similar to a lot of existing functionality for various layers, and the new event might be helpful in e.g. the integration-tests.
2025-02-12 14:57:44 +01:00
Jonas Jenwald
d6f63d0e4b
Merge pull request #19469 from Snuffleupagus/bug-1947248
[api-major] Apply the `userUnit` using CSS, to fix the text/annotation layers (bug 1947248)
2025-02-11 23:13:46 +01:00
calixteman
5b13ea14c2
Merge pull request #19472 from calixteman/update_button_hover_color
Fix the color of the background button when hovering it
2025-02-11 22:42:51 +01:00
Calixte Denizet
6950a312aa Fix the color of the background button when hovering it 2025-02-11 20:15:17 +01:00
Jonas Jenwald
e2d2263788
Merge pull request #19464 from Snuffleupagus/autolinking-catch
Catch and ignore any errors during auto-linking parsing (PR 19110 follow-up)
2025-02-11 20:06:33 +01:00
Jonas Jenwald
bd05b255fa [api-major] Apply the userUnit using CSS, to fix the text/annotation layers (bug 1947248)
Rather than modifying the "raw" dimensions of the page, we'll instead apply the `userUnit` as an *additional* scale-factor via CSS.

*Please note:* It's not clear to me if this solution is fully correct either, or if there's other problems with it, but it at least *appears* to work.

---

With these changes, the following CSS variables are now assumed to be available/set as necessary: `--total-scale-factor`, `--scale-factor`, `--user-unit`, `--scale-round-x`, and `--scale-round-y`.
2025-02-11 14:36:06 +01:00
calixteman
e3cca6d513
Merge pull request #19425 from calixteman/signature_save
[Editor] Add the possibility to compress/decompress the signature data in  order to store them in the logins storage in Firefox (bug 1946171)
2025-02-10 19:20:32 +01:00
Calixte Denizet
6b95095e14 Add the possibility to compress/decompress the signature data in order to store them in the logins storage in Firefox (bug 1946171) 2025-02-10 19:09:51 +01:00
Jonas Jenwald
29fbed384a
Merge pull request #19461 from Snuffleupagus/autolinking-lazy-borderStyle
Create the `borderStyle` of inferred links lazily (PR 19110 follow-up)
2025-02-10 16:32:12 +01:00
Jonas Jenwald
357ff4afde Catch and ignore any errors during auto-linking parsing (PR 19110 follow-up)
While investigating a bug, that I've not yet had time to fully investigate and report, I found that if there's ever an error thrown from the `Autolinker` class it'll prevent the annotationEditorLayer from rendering *and* the renderTask itself will be treated as having failed.
2025-02-10 16:28:02 +01:00
Jonas Jenwald
de1c2146b8
Merge pull request #19458 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-02-10 12:47:56 +01:00
Jonas Jenwald
fba5f3c237 Create the borderStyle of inferred links lazily (PR 19110 follow-up)
Given that most inferred links will overlap existing LinkAnnotations, creating a lot of unused `borderStyle` objects seem unnecessary.
Hence we can move that into the `AnnotationLayer.prototype.addLinkAnnotations` method instead, which also allows us to slightly reduce the API-surface.
2025-02-10 11:53:22 +01:00
Jonas Jenwald
e608daed9f
Merge pull request #19460 from Snuffleupagus/autolinking-check-annotationLayer
Check that the annotationLayer is still active before injecting inferred links (PR 19110 follow-up)
2025-02-10 10:08:47 +01:00
Jonas Jenwald
81e99da440 Check that the annotationLayer is still active before injecting inferred links (PR 19110 follow-up)
This issue is quite difficult to trigger reliably, however it's possible for rendering to have been aborted and thus for the annotationLayer to have been removed once we're invoking `injectLinkAnnotations`. In that case, an Error is thrown[1].

The way that I'm able to *intermittently* trigger this is by:
 - Loading http://localhost:8888/web/viewer.html?file=/test/pdfs/pdf.pdf#disableHistory=true
 - Enable "Wrapped Srolling" mode.
 - Quickly zoom out, to the minimum zoom level.

---
[1]
```
renderView: TypeError: can't access property "injectLinkAnnotations", this.annotationLayer is null
    resultPromise http://localhost:8888/web/pdf_page_view.js:1116
    draw http://localhost:8888/web/pdf_page_view.js:1099
    renderView http://localhost:8888/web/pdf_rendering_queue.js:196
    forceRendering http://localhost:8888/web/pdf_viewer.js:1849
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
    renderView http://localhost:8888/web/pdf_rendering_queue.js:198
    renderView http://localhost:8888/web/pdf_rendering_queue.js:197
    forceRendering http://localhost:8888/web/pdf_viewer.js:1849
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
    renderView http://localhost:8888/web/pdf_rendering_queue.js:198
    renderView http://localhost:8888/web/pdf_rendering_queue.js:197
    forceRendering http://localhost:8888/web/pdf_viewer.js:1849
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
    renderView http://localhost:8888/web/pdf_rendering_queue.js:198
    renderView http://localhost:8888/web/pdf_rendering_queue.js:197
    forceRendering http://localhost:8888/web/pdf_viewer.js:1849
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
    renderView http://localhost:8888/web/pdf_rendering_queue.js:198
    renderView http://localhost:8888/web/pdf_rendering_queue.js:197
    forceRendering http://localhost:8888/web/pdf_viewer.js:1849
    promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
    renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
    update http://localhost:8888/web/pdf_viewer.js:1677
    onScaleChanging http://localhost:8888/web/app.js:2550
    dispatch http://localhost:8888/web/event_utils.js:115
    #setScaleUpdatePages http://localhost:8888/web/pdf_viewer.js:1363
    #setScale http://localhost:8888/web/pdf_viewer.js:1389
    updateScale http://localhost:8888/web/pdf_viewer.js:2263
    updateZoom http://localhost:8888/web/app.js:814
    zoomOut http://localhost:8888/web/app.js:827
    onKeyDown http://localhost:8888/web/app.js:2780
    bindWindowEvents http://localhost:8888/web/app.js:2097
    initialize http://localhost:8888/web/app.js:262
    run http://localhost:8888/web/app.js:704
    webViewerLoad http://localhost:8888/web/viewer.js:294
    <anonymous> http://localhost:8888/web/viewer.js:305
pdf_rendering_queue.js:204:21
```
2025-02-10 09:19:04 +01:00
Jonas Jenwald
86ae2ca01c
Merge pull request #19449 from Snuffleupagus/autolinking-URL-fuzzy-match
Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
2025-02-09 22:51:37 +01:00
Jonas Jenwald
37ef0b4a86 Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
*Note:* For the issue mentioned on Matrix it'll obviously still make sense to improve the regular expression to detect more URL edge-cases.

However it occurred to me that even once that particular case is fixed there'll always be a risk that inferred links could overlap, and effectively block, the actual LinkAnnotations.
Hence this patch removes the URL comparison to ensure that overlapping inferred links will always be ignored.
2025-02-09 22:06:58 +01:00
Tim van der Meij
58a60b8959
Update translations to the most recent versions 2025-02-09 18:59:00 +01:00
Tim van der Meij
d2a07dcac6
Update dependencies to the most recent versions
Moreover, fix the linting issues (using `npx gulp lint --fix`) that are
found by the new versions of the linting tools.
2025-02-09 18:58:26 +01:00
Tim van der Meij
d88035525c
Merge pull request #19457 from timvandermeij/integration-tests-ink-isolate
Isolate the ink editor integration tests
2025-02-09 18:10:29 +01:00
Jonas Jenwald
b4a6b1ba0b
Merge pull request #19456 from Snuffleupagus/more-TypedArray-fill
Replace a couple of loops with `TypedArray.prototype.fill()`
2025-02-09 17:45:17 +01:00
calixteman
6862e84daa
Merge pull request #19437 from calixteman/signature_save_print1
[Editor] Add the ability to print and save some newly added signatures (bug 1946795)
2025-02-09 17:13:01 +01:00
Tim van der Meij
6d9ff34611
Isolate the ink editor integration tests
To avoid being able to introduce dependencies between tests, and to
bring existing dependencies to the surface, this commit makes sure that
we close the document between tests so that we can't accidentally rely
on state set by a previous test. This prevents multiple tests from
failing if one of them fails and makes debugging easier by being able to
run each test on their own independent of other tests.

This commit, combined with the previous one, is enough to make the ink
editor integration test suite pass consistently if random mode in
Jasmine is enabled, proving that the tests are fully isolated now.
2025-02-09 16:46:58 +01:00
Tim van der Meij
ced1268ec3
Remove the dependency between two ink editor integration tests
The second test of the basic operations block for the ink editor
depends on the first test to work. This becomes visible if we only run
the second test, using `fit`, which always fails with:

`ProtocolError: Waiting for selector '.annotationEditorLayer' failed:
Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting
in launch/connect calls for a higher timeout if needed.`

The problem is that the second test doesn't enable the ink editor and
relies on the first test having done that already (because we don't
close the document between tests yet). This commit fixes the issue by
unconditionally enabling the ink editor in the second test to remove the
dependency between the two tests so they both pass in isolation.
2025-02-09 16:46:58 +01:00
Jonas Jenwald
294fa3e4e6 Replace a couple of loops with TypedArray.prototype.fill()
When you want to initialize a TypedArray with a non-zero value for all elements the `fill`-method is simpler than manually looping through it.
2025-02-09 16:24:45 +01:00
Tim van der Meij
c1035e4356
Merge pull request #19454 from Snuffleupagus/Chrome-110
[api-minor] Update the minimum supported Google Chrome version to 110
2025-02-09 15:59:50 +01:00
Jonas Jenwald
ad1c79e6af [api-minor] Update the minimum supported Google Chrome version to 110
This patch updates the minimum supported browsers as follows:
 - Google Chrome 110, which was released on 2023-02-07; see https://chromereleases.googleblog.com/2023/02/stable-channel-update-for-desktop.html

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
2025-02-09 13:33:55 +01:00
Tim van der Meij
8ba8e75d6c
Merge pull request #19446 from Snuffleupagus/shorten-MeshStreamReader-readBits
Shorten the `MeshStreamReader.prototype.readBits` method a little bit
2025-02-09 12:57:53 +01:00
Tim van der Meij
739324d77e
Merge pull request #19447 from Snuffleupagus/fix-integrationtest-inferred_link_
Check for the correct link-id prefix in "must not add links when unnecessary" integration-test (PR 19110 follow-up)
2025-02-09 12:55:10 +01:00
Tim van der Meij
1921aefccf
Merge pull request #19450 from Snuffleupagus/crypto-CipherTransform-iv-getRandomValues
Use `crypto.getRandomValues` unconditionally in the `src/core/crypto.js` file
2025-02-09 12:53:27 +01:00
Jonas Jenwald
7919f4e84f Use crypto.getRandomValues unconditionally in the src/core/crypto.js file
This functionality is now available in all browsers/environments that we support, please see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#browser_compatibility
2025-02-09 11:42:17 +01:00
Jonas Jenwald
6eec20afc0 Check for the correct link-id prefix in "must not add links when unnecessary" integration-test (PR 19110 follow-up)
Currently this test-case would never fail, even if the actual implementation was broken, since it checks for a link-id prefix that we're not using.
2025-02-08 15:42:31 +01:00
Jonas Jenwald
36522d85cc Shorten the MeshStreamReader.prototype.readBits method a little bit
- Use a `BaseStream`-instance method to directly get the int32 value.

 - Use local variables more.
2025-02-08 11:17:35 +01:00
Jonas Jenwald
72339dc561
Merge pull request #19399 from Snuffleupagus/TextLayer-#getAscent-simplify
[api-minor] Simplify the `TextLayer.#getAscent` fallback (PR 12896 follow-up)
2025-02-08 00:01:40 +01:00
Calixte Denizet
24417a1a0b [Editor] Add the ability to print and save some newly added signatures (bug 1946795) 2025-02-07 23:07:27 +01:00