22191 Commits

Author SHA1 Message Date
Calixte Denizet
f98ce9ca85
Avoid to have multiple selected pages after copy/cut operations (bug 2026639) 2026-03-26 21:35:10 +01:00
calixteman
466c6263ad
Merge pull request #20974 from calixteman/bug2025674
Don't walk the children of a node having some attached MathML (bug 2025674)
2026-03-26 21:33:13 +01:00
Tim van der Meij
377f6d8b73
Merge pull request #20984 from calixteman/debugger_dont_update_canvas_view
Update the canvas detail view only when drawing is done
2026-03-26 20:41:22 +01:00
Tim van der Meij
a924af2e0b
Merge pull request #20990 from calixteman/bug2026564
Hide the new badge while a page is selected (bug 2026564)
2026-03-26 20:35:56 +01:00
Tim van der Meij
bf7d25b35c
Merge pull request #20975 from Snuffleupagus/AnnotationStorage-rm-typeof-function
Use optional chaining rather than `typeof` checks when invoking the `AnnotationStorage` callbacks
2026-03-26 20:35:24 +01:00
Tim van der Meij
f52a50ba09
Merge pull request #20986 from Snuffleupagus/FontInfo-readString-simplify
Reduce allocations in the `FontInfo.prototype.#readString` method (PR 20197 follow-up)
2026-03-26 20:34:03 +01:00
Tim van der Meij
8531947112
Merge pull request #20978 from calixteman/debugger_tree_whitespace
Debugger: in the tree view, display the white spaces as they're
2026-03-26 20:30:32 +01:00
Tim van der Meij
d3fd72e7e8
Merge pull request #20982 from calixteman/debugger_images_preview
Display mask in the tree view in the debugger
2026-03-26 20:29:42 +01:00
Tim van der Meij
5716b6e8b5
Merge pull request #20972 from Snuffleupagus/downloadFile-skip-duplicates
Avoid downloading test PDFs multiple times
2026-03-26 20:26:52 +01:00
Tim van der Meij
c41403cc5e
Merge pull request #20979 from mozilla/dependabot/npm_and_yarn/multi-bf05dc1ecf
Bump picomatch
2026-03-26 20:25:17 +01:00
Calixte Denizet
b1d93d0e51 Hide the new badge while a page is selected (bug 2026564) 2026-03-26 19:23:04 +01:00
Jonas Jenwald
42566f40fb Reduce allocations in the FontInfo.prototype.#readString method (PR 20197 follow-up)
Looking at the very similar `CssFontInfo.prototype.#readString` and `SystemFontInfo.prototype.#readString` methods they decode using the data as-is, but the `FontInfo.prototype.#readString` method for some reason copies the data into a new `Uint8Array` first; fixes yet another bug/inefficiency in PR 20197.
2026-03-26 16:49:41 +01:00
calixteman
601d961fc3
Merge pull request #20900 from wooorm/wooorm/image-mask-perf
Refactor to improve performance around image masks (bug 1941562)
2026-03-26 16:10:30 +01:00
Calixte Denizet
c2ba6b0e33 Update the canvas detail view only when drawing is done
And remove the canvas from the view once it's destroyed.
2026-03-26 15:51:46 +01:00
Titus Wormer
e914326346
Refactor to improve performance around image masks (bug 1941562)
* add support for directly writing masks into `rgbaBuf` if their size matches
* add support for writing into `rgbaBuf` to `resizeImageMask` to avoid extra
  allocs/copies
* respect `actualHeight` to avoid unnecessary work on non-emitted rows
* mark more operations as `internal`

This changes the path for what I believe is the common case for masks:
a mask to add transparency to the accompanying opaque image, both being
equal in size.
The other paths are not meaninfully unchanged.
That increases my confidence as these new paths can be easily tested
with a PNG with transparency.
2026-03-26 14:39:50 +01:00
Calixte Denizet
867af5c1e5
Display mask in the tree view in the debugger 2026-03-26 14:35:31 +01:00
Jonas Jenwald
9be671dbbd
Merge pull request #20980 from Snuffleupagus/CanvasExtraState-rm-preInit
Remove unused `preInit` parameter from the `CanvasExtraState` constructor (PR 19043 follow-up)
2026-03-26 14:27:39 +01:00
Jonas Jenwald
39dd02cf32 Remove unused preInit parameter from the CanvasExtraState constructor (PR 19043 follow-up)
This parameter was added in PR 19043, however it never actually appears to have been used.
2026-03-26 11:07:47 +01:00
dependabot[bot]
5e4ca58785
Bump picomatch
Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-25 22:14:25 +00:00
Calixte Denizet
265de5d453
Debugger: in the tree view, display the white spaces as they're
And in the debug view, display the ltr chars in the same order as they are in showText argument.
2026-03-25 19:46:16 +01:00
Jonas Jenwald
fc3407cabd Use optional chaining rather than typeof checks when invoking the AnnotationStorage callbacks
This is a little bit shorter, and it should be fine considering that in the API there are no `typeof` checks when invoking user-provided callbacks (see e.g. `onPassword` and `onProgress`).
2026-03-25 13:57:00 +01:00
calixteman
eff11e88bb
Don't walk the children of a node having some attached MathML (bug 2025674)
And now Chrome has a MathML Sanitizer implementation (146), the tests related to MathML are updated to reflect that.
2026-03-25 10:21:34 +01:00
Jonas Jenwald
777251da85
Merge pull request #20968 from Snuffleupagus/getNetworkStream
Move the `NetworkStream` choice from `src/display/api.js` and into a separate file
2026-03-25 08:33:08 +01:00
Jonas Jenwald
9c857166cc Avoid downloading test PDFs multiple times
It's somewhat common for multiple test-cases to use the same PDF, for example tests for both `eq` and `text` with one PDF.
Currently the logic in `downloadManifestFiles` doesn't handle duplicate test PDFs, which leads to wasted time/resources by downloading the same PDF more than once. Naturally the effect of this is especially bad when downloading all linked PDFs.

Total number of test PDFs downloaded:
 - 507, with `master`.
 - 447, with this patch.
2026-03-25 08:18:05 +01:00
calixteman
ae84c662b8
Merge pull request #20966 from calixteman/rm_canvas_cache
Remove the canvases cache
2026-03-25 07:50:55 +01:00
calixteman
7b2901bd21
Merge pull request #20965 from calixteman/enable_hwa_default
Enable hardware acceleration by default
2026-03-25 07:49:36 +01:00
Calixte Denizet
f608d5682c Enable hardware acceleration by default 2026-03-24 23:41:05 +01:00
Calixte Denizet
c0e3977321 Remove the canvases cache
The cache has been added in #3312 in 2013 and a lot of things changed since.
Having too many cached accelerated canvases can lead to have to move their data from the GPU to the RAM
which is costly.
So this patch:
 - removes all the cached canvases;
 - destroys the useless canvases in order to free their associated memory asap;
 - slightly rewrite canvas.js::_scaleImage to avoid too much canvas creation.
2026-03-24 23:39:44 +01:00
calixteman
ae70a5d123
Merge pull request #20969 from calixteman/fix_test_comparaison
Strip private ancillary PNG chunks before comparing images in ref tests
2026-03-24 22:59:12 +01:00
Calixte Denizet
385028005b
Strip private ancillary PNG chunks before comparing images in ref tests
This regression is because of:
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1980264 which added the random ID;
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1990514 which re-enabled EfficientCanvasRandomization
2026-03-24 22:48:20 +01:00
Tim van der Meij
2bcf2bb911
Merge pull request #20955 from calixteman/bug2025247
Remove the selection after the pages have been extracted (bug 2025247)
2026-03-24 21:24:51 +01:00
Tim van der Meij
7035459c05
Merge pull request #20960 from Snuffleupagus/rm-PDFWorker-fromPort
Remove the deprecated `PDFWorker.fromPort` method (PR 19943 follow-up)
2026-03-24 21:23:00 +01:00
Tim van der Meij
b792f229d7
Merge pull request #20857 from mschoettle/build-add-legacy
Copy webpack.mjs to legacy in dist task
2026-03-24 21:21:44 +01:00
Tim van der Meij
1120b3d345
Merge pull request #20952 from timvandermeij/github-actions-caching
Implement Node.js caching, and fix Python caching, in the GitHub Actions workflows
2026-03-24 21:15:09 +01:00
Tim van der Meij
3e651dd690
Merge pull request #20971 from Snuffleupagus/downloadFile-fetch
Download test PDFs with the Fetch API
2026-03-24 21:13:47 +01:00
Jonas Jenwald
3e0571cd9c Download test PDFs with the Fetch API
Using the Fetch API simplifies and shortens the `downloadFile` function considerably, since among other things it handles redirects[1] by default.

Also, the regular expression in `downloadManifestFiles` can be replaced with a simple string function now.

---

[1] Implementations of the Fetch API should already prevent e.g. redirect loops and limit the total number of redirects allowed.
2026-03-24 21:01:42 +01:00
Jonas Jenwald
a0102abe76 Move the NetworkStream choice from src/display/api.js and into a separate file
This code already isn't used (or even bundled) in the Firefox PDF Viewer, and it also slightly reduces the number of import maps that need to be maintained.
2026-03-24 17:08:04 +01:00
Jonas Jenwald
ca8f8074a2 Remove the deprecated PDFWorker.fromPort method (PR 19943 follow-up)
This has been deprecated in ten releases, so let's just remove it now.
2026-03-23 17:24:54 +01:00
Matthias Schoettle
5c3878be25 Copy webpack.mjs to legacy in dist task 2026-03-23 14:40:34 +00:00
Calixte Denizet
12a4fc6893
Remove the selection after the pages have been extracted (bug 2025247) 2026-03-23 10:27:44 +01:00
calixteman
2643125a12
Merge pull request #20951 from calixteman/bug2021392
Correctly scroll the search result in the viewport with rotated pdfs (bug 2021392)
2026-03-22 21:36:46 +01:00
Tim van der Meij
1756b48417
Merge pull request #20949 from Snuffleupagus/BinaryDataFactory-2
[api-minor] Replace the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` API options with a single factory/option
2026-03-22 21:20:49 +01:00
calixteman
243659380a
Correctly scroll the search result in the viewport with rotated pdfs (bug 2021392) 2026-03-22 21:08:49 +01:00
Tim van der Meij
8d4151cfbb
Fix Python caching in the GitHub Actions workflows
For the Python-based workflows we were already using `pip` caching [1],
but sadly this isn't fully functional at the moment because the caching
functionality uses `requirements.txt` to determine when to create or
invalidate the cache. However, we have two different `pip` install
commands but only a `requirements.txt` for one of them (the Fluent
linter), which means that the other job (the font tests) will not
populate the cache with its dependencies.

This can be seen by opening any font tests or Fluent linting build and
noticing that they report the exact same cache key even though their
dependencies are different. In the installation step the dependencies
are reported as "Downloading [package].whl" instead of the expected
"Using cached [package].whl".

This commit fixes the issue by explicitly defining a `requirements.txt`
file for both jobs and pointing the caching functionality to the
specific file paths to make sure that unique caches with the correct
package data are used. While we're here we also align the syntax and
step titles in the files for consistency.

[1] https://github.com/actions/setup-python?tab=readme-ov-file#caching-packages-dependencies
2026-03-22 20:01:32 +01:00
Tim van der Meij
a3b19875ec
Implement Node.js caching in the GitHub Actions workflows
The `setup-node` action contains built-in support for caching [1], so
this commit makes sure we use it for all Node.js-based workflows to
reduce workflow execution time.

Note that, contrary what one might expect [2], the `node_modules`
directory is deliberately not cached because it can conflict with
differing Node.js versions and because it's not useful in combination
with `npm ci` usage which wipes the `node_modules` folder
unconditionally. Therefore, the action instead caches the global `npm`
cache directory instead which does not suffer from these problems and
still provides a speed-up at installation time.

[1] https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data
[2] https://github.com/actions/setup-node/issues/416
[3] https://github.com/actions/cache/issues/67
2026-03-22 19:40:10 +01:00
Tim van der Meij
0a6894d28b
Merge pull request #20948 from calixteman/issue20914
Interpret empty annotation border as [0, 0, 0]
2026-03-22 19:08:19 +01:00
Jonas Jenwald
3a372fde94 [api-minor] Replace the CMapReaderFactory, StandardFontDataFactory, and WasmFactory API options with a single factory/option
Currently we have no less than three different, but very similar, factories for reading built-in CMap files, standard font files, and wasm files on the main-thread.[1]
These factories were added at different points in time, since I cannot imagine that we'd add essentially three copies of the same code otherwise.

Nowadays these factories are often not even used[2], since worker-thread fetching is used whenever possible to improve performance. In particular, they will *only* be used when either:
 - The PDF.js library runs in Node.js environments.
 - The user manually sets `useWorkerFetch = false` when calling `getDocument`.
 - The user provides custom `CMapReaderFactory`, `StandardFontDataFactory`, and/or `WasmFactory` instances when calling `getDocument`.

By replacing these factories with *a single* new `BinaryDataFactory` factory/option the number of `getDocument` options are thus reduced, which cannot hurt.
This also reduces the total bundle-size of the Firefox PDF Viewer a little bit, and it slightly reduces the number of import maps that need to be maintained.

*Please note:* For users that provide custom `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` instances when calling `getDocument` this will be a breaking change, however it's unlikely that (many) such users exist.
(The *internal* format data-format of `CMapReaderFactory` was changed in PR 18951, and there hasn't been a single question/complaint about it in well over a year.)

---

[1] Any new functionality could easily lead to more such factories being added in the future, which wouldn't be great.

[2] Note that the Firefox PDF Viewer no longer use these factories, since it "forcibly" sets `useWorkerFetch = true` during building.
2026-03-22 15:49:06 +01:00
calixteman
de48af76d4
Interpret empty annotation border as [0, 0, 0]
It fixes #20914.
2026-03-22 15:49:04 +01:00
Tim van der Meij
56fe5fb622
Merge pull request #20950 from timvandermeij/revert-locale-stuck-actions
Revert "Avoid to have stuck actions when running update_locales task"
2026-03-22 15:42:30 +01:00
Tim van der Meij
921e258d35
Revert "Avoid to have stuck actions when running update_locales task"
This reverts commit d618a2bc7ebe550cfcef31df8ddd0c8a12cf6bf1.
Unfortunately it did not fix the hanging actions for the locale update
job; fixing the issue is tracked in #20813.
2026-03-22 15:38:25 +01:00