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

20445 commits

Author SHA1 Message Date
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
Tim van der Meij
b43efdd545
Merge pull request #19436 from Snuffleupagus/api-FetchBinaryData
Combine the main-thread message handlers for CMap-, StandardFontData-, and Wasm-files
2025-02-07 21:13:58 +01:00
Tim van der Meij
01148d35bc
Merge pull request #19423 from Snuffleupagus/annotation-more-getPdfColorArray
Use the `getPdfColorArray` helper more in the `src/core/annotation.js` file
2025-02-07 21:05:52 +01:00
Tim van der Meij
5b7bc27c46
Merge pull request #19419 from Snuffleupagus/blank_issues_enabled-false
Disable the "Blank issue" alternative when using the GitHub "New issue"-button
2025-02-07 20:52:26 +01:00
Jonas Jenwald
88e5da1e37 Combine the main-thread message handlers for CMap-, StandardFontData-, and Wasm-files
Currently we have three separate and virtually identical message handlers for this data, which can easily be combined into a single message handler instead.
2025-02-07 14:33:15 +01:00
calixteman
651d712109
Merge pull request #19433 from calixteman/signature_icon
[Editor] Add an icon for the signature tool and move it before the highlight one
2025-02-06 21:59:27 +01:00
Jonas Jenwald
7d9cfbf597
Merge pull request #19432 from Snuffleupagus/isSyncFontLoadingSupported-FeatureTest
Use the `FeatureTest` helper in the `src/display/font_loader.js` file
2025-02-06 21:36:28 +01:00
Calixte Denizet
5ee7307bf5 [Editor] Add an icon for the signature tool and move it before the highlight one 2025-02-06 20:58:59 +01:00
Jonas Jenwald
33f3506842 Use the FeatureTest helper in the src/display/font_loader.js file 2025-02-06 20:45:18 +01:00
Jonas Jenwald
41a918b0fe
Merge pull request #19430 from Snuffleupagus/Fluent-PLATFORM
[GENERIC viewer] Add Fluent `PLATFORM` function (PR 19414 follow-up)
2025-02-06 20:07:07 +01:00
calixteman
16155fd801
Merge pull request #19431 from Snuffleupagus/var--save-warning-color
Fix `--save-warning-color` CSS variable typo (PR 19414 follow-up)
2025-02-06 19:09:20 +01:00
Jonas Jenwald
314928ffd7 Fix --save-warning-color CSS variable typo (PR 19414 follow-up) 2025-02-06 19:06:04 +01:00
Jonas Jenwald
d5d3d8b3f7 [GENERIC viewer] Add Fluent PLATFORM function (PR 19414 follow-up)
This patch extends the `FeatureTest.platform` getter to provide the necessary information, and uses that one to implement a Fluent `PLATFORM` function based on: https://searchfox.org/mozilla-central/rev/d1fbe983fb7720f0a4aca0e748817af11c1a374e/intl/l10n/rust/fluent-ffi/src/bundle.rs#81-98
2025-02-06 18:59:35 +01:00
calixteman
f1152f5caf
Merge pull request #19429 from calixteman/autolinking_firefox
Enable autolinking in Firefox (bug 1019475)
2025-02-06 17:47:55 +01:00
Calixte Denizet
76c06c5996 Enable autolinking in Firefox (bug 1019475) 2025-02-06 17:02:54 +01:00
calixteman
2d773cb773
Merge pull request #19110 from ryzokuken/autolink-demo
Enable automatic URL linking (bug 1019475)
2025-02-06 16:53:48 +01:00
calixteman
08663f715b
Merge pull request #19414 from calixteman/signature_dialog2
[Editor] Add a new dialog for the signature editor (bug 1945574)
2025-02-06 16:20:01 +01:00
Calixte Denizet
185ec1faf6 Add some unicode mapping for ligatures when writing the cmap table in the font (bug 1946181) 2025-02-06 10:51:15 +01:00
Calixte Denizet
fa25ab9c13 [Editor] Add a new dialog for the signature editor (bug 1945574) 2025-02-05 23:00:38 +01:00
Ujjwal Sharma
61ba1ea48c Enable automatic URL linking
Automatically detect links in the text content of a file and automatically
generate link annotations at the appropriate locations to achieve
automatic link detection and hyperlinking.
2025-02-05 16:56:54 +01:00
Jonas Jenwald
925071ab46 Use the getPdfColorArray helper more in the src/core/annotation.js file
While the file-size reduction is obviously tiny, it should never hurt to remove code duplication.
2025-02-05 11:37:32 +01:00