21994 Commits

Author SHA1 Message Date
Calixte Denizet
bbf178c5ee Only focus the undo bar when the focus isn't inside
It should fix the test "must work properly when selecting undo by keyboard"
which calls focus() but it can be steal by fixed callback in setTimeout.
2026-03-13 13:53:51 +01:00
calixteman
b7698d617d
Merge pull request #20859 from mozilla/update-locales
l10n: Update locale files
2026-03-13 09:42:50 +01:00
github-actions[bot]
8b86f7bb16 l10n: Update locale files 2026-03-13 00:30:37 +00:00
calixteman
ea949b9a0a
Merge pull request #20845 from calixteman/new_debugger
Update the internal viewer to use a new debugger.
2026-03-12 22:41:47 +01:00
calixteman
2381ac6b16
Update the internal viewer to use a new debugger.
It has few cool features:
 - all the canvas used during the rendering can be viewed;
 - the different properties in the graphics state can be viewed;
 - the different paths can be viewed.
2026-03-12 22:38:08 +01:00
Tim van der Meij
d8a40d9372
Merge pull request #20849 from Snuffleupagus/viewer-rm-enableHWA-opts
Remove the `enableHWA` option from viewer components (PR 20016 follow-up)
2026-03-12 20:40:38 +01:00
Tim van der Meij
decbce7b9b
Merge pull request #20856 from Snuffleupagus/fix-font-clearData
Fix the `FontInfo.prototype.clearData` method to actually remove the data as intended (PR 20197 follow-up)
2026-03-12 20:39:02 +01:00
calixteman
2177c4bc00
Merge pull request #20848 from Snuffleupagus/mv-PagesMapper
Move the `PagesMapper` class into its own file
2026-03-12 18:26:33 +01:00
Jonas Jenwald
e88a5652de Fix the FontInfo.prototype.clearData method to actually remove the data as intended (PR 20197 follow-up)
The purpose of PR 11844 was to reduce memory usage once fonts have been attached to the DOM, since the font-data can be quite large in many cases.

Unfortunately the new `clearData` method added in PR 20197 doesn't actually remove *anything*, it just replaces the font-data with zeros which doesn't help when the underlying `ArrayBuffer` itself isn't modified.
The method does include a commented-out `resize` call[1], but uncommenting that just breaks rendering completely.

To address this regression, without having to make large or possibly complex changes, this patch simply changes the `clearData` method to replace the internal buffer/view with its contents *before* the font-data.
While this does lead to a data copy, the size of this data is usually orders of magnitude smaller than the font-data that we're removing.

---

[1] Slightly off-topic, but I don't think that patches should include commented-out code since there's a very real risk that those things never get found/fixed.
At the very least such cases should be clearly marked with `// TODO: ...` comments, and should possibly also have an issue filed about fixing the TODO.
2026-03-12 18:15:42 +01:00
Jonas Jenwald
63b4874b39 Remove the enableHWA option from viewer components (PR 20016 follow-up)
In PR 20016 the actual uses of the `enableHWA` option was removed from the viewer, but for some reason it's still being provided when initializing `PDFViewer` and `PDFThumbnailViewer` despite the fact that it's now dead code.
2026-03-11 15:28:43 +01:00
Jonas Jenwald
9aa1ce8f14 Move the PagesMapper class into its own file
The `PagesMapper` class currently makes up one third of the `src/display/display_utils.js` file size, and since its introduction it's grown (a fair bit) in size.
Note that the intention with files such as `src/display/display_utils.js` was to have somewhere to place functionality too small/simple to deserve its own file.
2026-03-11 12:28:13 +01:00
Jonas Jenwald
79df166e06
Merge pull request #20846 from Snuffleupagus/internal-viewer-followup
A couple of small improvements of the new internal viewer
2026-03-11 12:01:11 +01:00
calixteman
9d093d9607
Merge pull request #20626 from nicolo-ribaudo/images-right-click
Add support for right-clicking on images (bug 1012805)
2026-03-11 11:45:51 +01:00
calixteman
98f7e859ac
Merge pull request #20837 from calixteman/bug2021934
Disable dragging a thumbnail when the user has to paste what they copied (bug 2021934)
2026-03-11 09:13:25 +01:00
Jonas Jenwald
60d6abdf4f A couple of small improvements of the new internal viewer
- Mention the internal viewer in the README, such that it's easier to find.

 - Implement a new `INTERNAL_VIEWER` define, such that it's easier to limit code to only the "internal-viewer" gulp target.

 - Only include the "GetRawData" message-handler when needed. Note that the `MessageHandler` [already throws](eb159abd6a/src/shared/message_handler.js (L121-L123)) for any missing handler.

 - Move the various new helper functions from `src/core/document.js` and into their own file. The reasons for doing this are:
    - That file is already quite large and complex as-is, and these helper functions are slightly orthogonal to its main functionality.
    - Babel isn't able to remove all of the new code, and by moving this into a separate file we can guarantee that no extra code ends up in e.g. Firefox.
2026-03-10 23:41:35 +01:00
Tim van der Meij
eb159abd6a
Merge pull request #20822 from mozilla/update-locales
l10n: Update locale files
2026-03-10 21:39:05 +01:00
Tim van der Meij
654190366f
Merge pull request #20828 from timvandermeij/refactor-reporter
Refactor the custom reporters for testing
2026-03-10 21:31:00 +01:00
Tim van der Meij
5fb9f12d3e
Ignore pending tests in the custom reporters
Similar to excluded tests pending tests should not count towards runs or
result in console logging because they are effectively not (fully) run.
This reduces visual noise and helps to get the tests running on GitHub
Actions where non-passed tests will count towards a non-zero exit code.
2026-03-10 20:51:08 +01:00
Tim van der Meij
8a5f6f5157
Use the status property of Jasmine's result object in the custom reporters
This improves readability of the code and makes it consistent with the
recently added check for excluded tests.
2026-03-10 20:51:08 +01:00
Tim van der Meij
9c21d7016b
Check for passed tests first in test/integration/jasmine-boot.js
This makes the order of checks consistent with the one in
`test/reporter.js` and improves safety because now any status other
than passed will be treated as a failure (also if Jasmine adds more
statuses later on).
2026-03-10 20:51:02 +01:00
Tim van der Meij
44a63549b0
Merge pull request #20831 from calixteman/internal_viewer
Add a new internal viewer to explore the structure of PDF files.
2026-03-10 20:48:40 +01:00
Tim van der Meij
15e58f3912
Merge pull request #20830 from Snuffleupagus/validateRangeRequestCapabilities-fix-tests
Improve the `validateRangeRequestCapabilities` unit-tests
2026-03-10 20:23:14 +01:00
Tim van der Meij
bf20d3c7e8
Merge pull request #20838 from calixteman/bug2021886
Avoid to have a thumbnail with two paste buttons (bug 2021886)
2026-03-10 20:21:34 +01:00
Tim van der Meij
99dcb88dac
Merge pull request #20834 from calixteman/update_context_menu
Update the context menu after copying thumbnails
2026-03-10 20:15:51 +01:00
Tim van der Meij
3f75c4e511
Merge pull request #20829 from Snuffleupagus/Blob-bytes
Start using `Blob.prototype.bytes()` in the code-base
2026-03-10 20:14:49 +01:00
Tim van der Meij
0dce6f40d2
Merge pull request #20839 from calixteman/bug2020698
Fix the border & background colors of the placeholder for a dragged thumbnail (bug 2020698)
2026-03-10 20:14:05 +01:00
Tim van der Meij
27db42d6bc
Merge pull request #20841 from Snuffleupagus/misc-improvements
A couple of small improvements
2026-03-10 20:06:35 +01:00
Jonas Jenwald
51cde824ec
Merge pull request #20844 from nicolo-ribaudo/fix-lint-licenses-windows
Fix `lint-licenses` task on windows
2026-03-10 18:05:58 +01:00
Nicolò Ribaudo
f11d12dcc2
Fix lint-licenses task on windows 2026-03-10 17:49:52 +01:00
Jonas Jenwald
e6f32f2d3b Remove the "check_l10n.mjs" entry from the ESLint config
Linting works fine with this removed, since there's apparently no top-level file with that name.
2026-03-10 16:02:27 +01:00
Jonas Jenwald
bfa2753f3c Remove the "abort" listener, on the globalAbortSignal, in the web/sidebar.js file
This is consistent with a bunch of other viewer code, since an `AbortSignal` can only be aborted once any "abort" listeners can thus be removed when invoked.
2026-03-10 15:51:10 +01:00
Jonas Jenwald
5ef582fb20 Use optional chaining a little bit more in the src/display/api.js file
That format is preferred where possible, since it leads to ever so slightly shorter code overall.
2026-03-10 15:51:05 +01:00
Nicolò Ribaudo
4f7a025e21
Separate bbox tracking from dependencies tracking
When recording bboxes for images, it's enough to record their
clip box / bounding box without needing to run the full bbox
tracking of the image's dependencies.
2026-03-10 14:51:03 +01:00
Nicolò Ribaudo
886c90d1a5
Add support for right-clicking on images
This patch adds right-click support for images in the PDF, allowing
users to download them. To minimize memory consumption, we:
- Do not store the images separately, and instead crop them out of the
  PDF page canvas
- Only extract the images when needed (i.e. when the user right-clicks
  on them), rather than eagery having all of them available.

To do so, we layer one empty 0x0 canvas per image, stretched to cover
the whole image, and only populate its contents on right click.
These images need to be inside the text layer: they cannot be _behind_
it, otherwise they would be covered by the text layer's container and
not be clickable, and they cannot be in front of it, otherwise they
would make the text spans unselectable.

This feature is managed by a new preference, `imagesRightClickMinSize`:
- when it's set to `-1`, right-click support is disabled
- when set to `0`, all images are available for right click
- when set to a positive integer, only images whose width and height are
  greater than or equal to that value (in the PDF page frame of
  reference) are available for right click.

This features is disabled by default outside of MOZCENTRAL, as it
significantly degrades the text selection experience in non-Firefox
browsers.
2026-03-10 14:51:03 +01:00
Calixte Denizet
ad7a415220
Fix the border & background colors of the placeholder for a dragged thumbnail (bug 2020698) 2026-03-09 20:47:39 +01:00
Jonas Jenwald
873378b718
Merge pull request #20836 from Snuffleupagus/FontFaceObject-fix-asserts
Fix the `disableFontFace` and `fontExtraProperties` asserts in the `FontFaceObject` constructor (PR 20197 follow-up)
2026-03-09 20:08:58 +01:00
Jonas Jenwald
4bae676af1
Merge pull request #20835 from Snuffleupagus/return-iterators
Use iterators a little bit more, to avoid creating temporary Arrays
2026-03-09 20:07:19 +01:00
Calixte Denizet
645ef08764
Avoid to have a thumbnail with two paste buttons (bug 2021886) 2026-03-09 19:10:12 +01:00
Calixte Denizet
7010086cd5
Disable dragging a thumbnail when the user has to paste what they copied (bug 2021934) 2026-03-09 18:10:33 +01:00
Jonas Jenwald
9f69617109 Fix the disableFontFace and fontExtraProperties asserts in the FontFaceObject constructor (PR 20197 follow-up)
In PR 19548 these checks were added to ensure that the font-data sent from the worker-thread *always* include correct `disableFontFace` and `fontExtraProperties` data.

For some reason PR 20197 then changed the code such that these checks became effectively pointless, since these properties are now checked after the fact *and* the new getters provide fallback values.
2026-03-09 18:00:11 +01:00
Jonas Jenwald
dbb6ffb8d5 Change the Font.prototype.glyphCacheValues method to return an iterator
This method is only used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through the underlying data to create a temporary `Array` that we finally iterate through at the call-site.

*Please note:* As port of these changes the chars/glyph caches, on the `Font` instances, are changed to use `Map`s rather than Objects.
2026-03-09 16:18:48 +01:00
Jonas Jenwald
8bbb7c88d3 Change the AnnotationLayer.prototype.getEditableAnnotations method to return an iterator
This method is only used with loops, and it should be a tiny bit more efficient to use an iterator directly rather than first iterating through the underlying `Map` to create a temporary `Array` that we finally iterate through at the call-site.
2026-03-09 16:11:21 +01:00
Calixte Denizet
210b859a54
Update the context menu after copying thumbnails 2026-03-09 15:36:22 +01:00
calixteman
cc680f68c3
Merge pull request #20832 from calixteman/fix_labels
Fix the label and tooltip on the paste buttons
2026-03-09 15:20:59 +01:00
calixteman
c7d1a48f5e
Merge pull request #20833 from nicolo-ribaudo/claude-ignore-eslint
Do not lint folders for project-level AI coding agents
2026-03-09 15:02:44 +01:00
Nicolò Ribaudo
e69432cd89
Do not lint folders for project-level AI coding agents 2026-03-09 14:57:54 +01:00
Calixte Denizet
18a05354fb
Fix the label and tooltip on the paste buttons 2026-03-09 14:21:15 +01:00
calixteman
9d81fafa8c
Add a new internal viewer to explore the structure of PDF files.
The one from pdf.js.utils is a bit too old: a lot of bugs have been fixed
in the code that parses PDF files since then.
It's just an internal development tool, so it doesn't need to be perfect,
but it should be good enough to be useful.
2026-03-09 14:16:12 +01:00
calixteman
d5653a1f7c
Merge pull request #20646 from nicolo-ribaudo/allow-any-host
Add option allow external connections to `npx gulp server`
2026-03-09 11:37:22 +01:00
calixteman
4ef5ea9681
Merge pull request #20810 from calixteman/bug2010832
Add a UI to undo cut/delete and cancel a copy (bug 2021352, bug 2010832)
2026-03-09 11:36:37 +01:00