4949 Commits

Author SHA1 Message Date
Jonas Jenwald
1f69cf964c Ensure that percent === NaN is consistently reported by the onProgress callback
With these changes `0`, `NaN`, `null`, and `undefined` in the `total`-property all result in `percent === NaN` being reported by the callback, since previously e.g. `0` would result in `percent === 100` being reported unconditionally which doesn't make a lot of sense.

Also, remove the "indeterminate" loadingBar (in the viewer) if the `PDFDocumentLoadingTask` fails since there won't be any more data arriving and displaying the animation thus seems wrong.
2026-03-08 10:21:55 +01:00
Calixte Denizet
d489ad0b5b
Once a page has been deleted or pasted, make sure the focus stays in the sidebar (bug 2020731) 2026-03-05 21:52:12 +01:00
Tim van der Meij
d3e04d29ac
Merge pull request #20798 from calixteman/bug2016437
Fix the position of the thumbnails on the last line (bug 2016437)
2026-03-05 21:19:39 +01:00
Tim van der Meij
874ba23afc
Merge pull request #20802 from calixteman/rm_sidebar_resize_observer
Remove the sidebar resize observer when killing the UI
2026-03-05 20:39:28 +01:00
Tim van der Meij
60a0e24605
Merge pull request #20792 from calixteman/bug2020758
Add some aria-labels to the paste button in order to know where the buttons are (bug 2020758)
2026-03-05 20:32:20 +01:00
Tim van der Meij
a8d1aa9db8
Merge pull request #20797 from calixteman/bug2020774
Fix few colors in the Manage menu in HCM (bug 2020774)
2026-03-05 20:29:44 +01:00
Tim van der Meij
2463f4dc73
Merge pull request #20794 from calixteman/bug2020737
Move the heading role on the sidebar label (bug 2020737)
2026-03-05 20:29:07 +01:00
Tim van der Meij
cbc0362357
Merge pull request #20787 from Snuffleupagus/improve-PdfTextExtractor
Improve and simplify the `PdfTextExtractor` implementation
2026-03-05 20:23:23 +01:00
Calixte Denizet
dd52343d58
Fix downloading the current pdf 2026-03-05 13:05:03 +01:00
Calixte Denizet
1ac5dfeba8 Remove the sidebar resize observer when killing the UI 2026-03-05 09:51:35 +01:00
Calixte Denizet
7f76a111c4
Fix the position of the thumbnails on the last line (bug 2016437)
The original issue can only be reproduce when the thumbnails are on two lines.
The fix is just a matter of computing the number of elements on the last line once we've
finished the first line.
2026-03-04 17:30:10 +01:00
Calixte Denizet
f9c50bb7ce
Fix few colors in the Manage menu in HCM (bug 2020774) 2026-03-04 16:47:48 +01:00
Calixte Denizet
f6401e4344
Move the heading role on the sidebar label (bug 2020737) 2026-03-04 15:25:11 +01:00
Calixte Denizet
18bafeb1c6
Add some aria-labels to the paste button in order to know where the buttons are (bug 2020758) 2026-03-04 10:32:57 +01:00
Calixte Denizet
d90530b86c
Add the pages organization actions in the Firefox context menu (bug 2018138) 2026-03-04 09:02:39 +01:00
calixteman
68cca32e20
Merge pull request #20785 from calixteman/extract_pages
Add a way to extract some pages from a pdf (bug 2019682)
2026-03-04 08:44:13 +01:00
Calixte Denizet
27aea732a2
Fix the paste button position and add a button before the first thumbnail 2026-03-03 21:46:51 +01:00
Calixte Denizet
a474e81b8a
Add a way to extract some pages from a pdf (bug 2019682)
The user has to select some pages and then click on the "Save As" menu item in the Manage menu.
If they modify the structure of the pdf (deleted, moved, copied pages), they have to use the usual
save button.
2026-03-03 21:39:13 +01:00
calixteman
973add845f
Merge pull request #20779 from calixteman/fix_sidebar_css
Fix layout of thumbnails when split/merge is disabled
2026-03-03 16:19:03 +01:00
Jonas Jenwald
c70ff5a7c0 Improve and simplify the PdfTextExtractor implementation
Working on PR 20784, I couldn't help noticing that this code can be improved a little bit.

 - Only initialize `PdfTextExtractor` in development mode and MOZCENTRAL builds, since it's unused elsewhere.

 - Re-factor how `PdfTextExtractor` waits for the viewer to be available/ready, by using existing (internal) events.
   This simplifies the `PdfTextExtractor` class and removes its `setViewer` method, which improves general consistency since normally the viewer-components don't use such a method in that way (here it was effectively used as a stand-in for a `setDocument` method).

 - Finally, while slightly unrelated, rename the `#getAllTextInProgress` field in the `PDFViewer` class to `#copyAllInProgress` to clearly indicate what it's for since the `getAllText` method is used more generally now.
2026-03-03 15:51:08 +01:00
Jonas Jenwald
54a8c049fd Prevent PdfTextExtractor.prototype.extractTextContent from failing intermittently
Given that extracting all text can take a while to complete, especially in long PDF documents[1], it's technically possible for the user to "select all", copy, and finally abort copying (with the `Esc` key) while `PdfTextExtractor.prototype.extractTextContent` is still running.
If that happens the `PDFViewer.prototype.getAllText` code would be interrupted, and text-extraction would thus fail in an intermittent and (likely) hard to debug way. To avoid this we replace the current "global" interrupt handling with an optional `AbortSignal` instead.

---

[1] See e.g. `pdf.pdf` in the test-suite.
2026-03-03 11:55:33 +01:00
Calixte Denizet
cdc1c8af40
Fix layout of thumbnails when split/merge is disabled 2026-03-02 15:16:16 +01:00
calixteman
d859d78bb5
Merge pull request #20775 from Snuffleupagus/hide-select-pages
Hide the "Select pages" label, in the thumbnails sidebar, when split-merge is disabled
2026-03-02 14:53:15 +01:00
Jonas Jenwald
0d131f0957 Use L10n.prototype.getDirection rather than querying the DOM, when initializing the CommentManager instance
Hopefully I'm not misunderstanding why it was written like that, however using an existing method should be a tiny bit more efficient than querying the DOM.
2026-03-02 11:33:34 +01:00
Jonas Jenwald
a0e70eb6aa Hide the "Select pages" label, in the thumbnails sidebar, when split-merge is disabled
Currently there's a "pointless" label displayed, thus taking up vertical space, when `enableSplitMerge = false` is set.
2026-03-02 11:19:02 +01:00
Tim van der Meij
5279646985
Merge pull request #20751 from calixteman/bug2016693
Avoid to scroll too much when the thumbnail is at the bottom of the sidebar (bug 2016693)
2026-03-01 21:14:44 +01:00
Tim van der Meij
e0ea84fdac
Merge pull request #20761 from calixteman/tweak_dims
Tweak few elements: dimensions and the checkbox color in the new sidebar
2026-03-01 20:01:07 +01:00
Tim van der Meij
9dfcc62bb9
Merge pull request #20758 from calixteman/fix_sidebar_height
Fix the page sidebar height
2026-03-01 19:58:18 +01:00
calixteman
00d9d3a6ea
Merge pull request #20742 from Snuffleupagus/tree-viewer-scrollIntoView
Fix scrolling of outline item into view (PR 20495 follow-up)
2026-03-01 13:01:21 +01:00
Calixte Denizet
c272cbdf5a
Tweak few elements: dimensions and the checkbox color in the new sidebar 2026-02-27 18:36:38 +01:00
Calixte Denizet
aa928105b4
Fix tooltips on thumbnails and checkbox (bug 2019714)
And fix an issue with some integration tests where the manage button was disabled (hence not in the tab cycle).
2026-02-27 17:43:27 +01:00
calixteman
45b0f8b05e
Merge pull request #20748 from calixteman/add_file_button
Make the 'add file' button not hidden but just not visible in order to fix the layout
2026-02-27 17:34:53 +01:00
Calixte Denizet
a251b99e2b
Make the 'add file' button not hidden but just not visible in order to fix the layout
The feature will be plugged later.
2026-02-27 16:53:30 +01:00
Calixte Denizet
79942b7720
Fix the page sidebar height
It has to be the viewer height but with a padding of 8px.
2026-02-27 16:13:14 +01:00
Calixte Denizet
4b7fa1c003 Avoid to scroll too much when the thumbnail is at the bottom of the sidebar (bug 2016693) 2026-02-26 22:30:13 +01:00
Tim van der Meij
f626a368a5
Merge pull request #20743 from calixteman/bug2010822
Tweak the background color of the sidebar (bug 2010822)
2026-02-26 22:01:50 +01:00
Tim van der Meij
52efe65f12
Merge pull request #20741 from calixteman/fix_resizer_position
Slightly move the resizer on the sidebar (bug 2019585)
2026-02-26 22:00:32 +01:00
Tim van der Meij
f05caaf5e9
Merge pull request #20731 from calixteman/remove_page_id
Remove useless page-id attribute in thumbnails
2026-02-26 21:58:36 +01:00
calixteman
881f9779e6
Don't check for surrogates when verifying the chars to normalize 2026-02-26 16:46:34 +01:00
Calixte Denizet
b263841584
Tweak the background color of the sidebar (bug 2010822)
And tweak its position as required by UX/UI.
2026-02-26 15:39:08 +01:00
Jonas Jenwald
e89335e776 Fix scrolling of outline item into view (PR 20495 follow-up)
Clicking on the "Find Current Outline Item" button is (obviously) supposed to scroll that outline item into view, however that seems to have broken accidentally in PR 20495.
2026-02-26 14:52:20 +01:00
Calixte Denizet
241e8c18b9
Slightly move the resizer on the sidebar (bug 2019585)
And add a white border to the resizer in order to make it visible whatever the background is.
2026-02-26 14:35:13 +01:00
Jonas Jenwald
b07d14c88c Don't expand/collapse the entire outline when shift-clicking on the triangles (PR 20508 follow-up) 2026-02-26 13:00:06 +01:00
Calixte Denizet
a48118db41 Remove useless page-id attribute in thumbnails
And make sure that the sidebar is fully open before starting the tests in
order to have an intermittent exception when finishing the test.
2026-02-25 15:15:41 +01:00
Jonas Jenwald
185fee680a Use Map.prototype.getOrInsertComputed() in the web/struct_tree_layer_builder.js file 2026-02-24 09:04:37 +01:00
Jonas Jenwald
0d4e587a5f Reduce allocations when using Map.prototype.getOrInsert() with Arrays
Change all these cases to use `Map.prototype.getOrInsertComputed()` instead, in combination with a helper function for creating the `Array`s (similar to the previous patch).
2026-02-24 09:03:32 +01:00
Jonas Jenwald
2e07715c9d Reduce function creation when using Map.prototype.getOrInsertComputed()
With the exception of the first invocation the callback function is unused, which means that a lot of pointless functions may be created.
To avoid this we introduce helper functions for simple cases, such as creating `Map`s and `Objects`s.
2026-02-24 08:58:28 +01:00
Calixte Denizet
63c340fa35
Add keyboard shortcuts for copying/cutting/deleting the pages (bug 2018139, bug 2010831) 2026-02-22 22:17:59 +01:00
calixteman
fb902c16e1
Correctly generate the NormalizeWithNFKC string in generic build
It fixes #20689.
2026-02-22 19:50:42 +01:00
Jonas Jenwald
e62a990ae2
Merge pull request #20704 from Snuffleupagus/getPageAdvance-getOrInsert
Use `Map.prototype.getOrInsert()` in the `_getPageAdvance` method
2026-02-22 10:32:44 +01:00