21385 Commits

Author SHA1 Message Date
Tim van der Meij
1cae8e2933
Merge pull request #20269 from calixteman/dichotomic_find_color
Use a dichotomy to find a color with a good contrast ratio
2025-09-14 18:15:52 +02:00
Tim van der Meij
e78c7d0cc2
Merge pull request #20256 from nicolo-ribaudo/bboxes-when-needed
Only record bboxes when needed
2025-09-14 16:22:46 +02:00
Calixte Denizet
634bef5fb4 Use a dichotomy to find a color with a good contrast ratio
It helps to reduce the number of iterations so it makes the algorithm
slightly faster in general.
2025-09-13 15:45:00 +02:00
calixteman
2138ec17cc
Merge pull request #20267 from nicolo-ribaudo/fix-jsdoc
Fix JSDoc description in src/display/api.js
2025-09-13 15:40:47 +02:00
Nicolò Ribaudo
5de14aa429
Only record bboxes when needed
Before this patch, when `enableOptimizedPartialRendering`
is enabled we would record the bounding boxes of the
various operations on the first render.

This patches change it to happen on the first render that we
know will also need a detail view, so that the performance
cost is not paid for the case when the detail view is not used.
2025-09-12 15:02:24 +02:00
Nicolò Ribaudo
42b4d97115
Fix JSDoc description in src/display/api.js 2025-09-12 15:01:41 +02:00
calixteman
beb5f5ca85
Merge pull request #20208 from nicolo-ribaudo/bboxes-typedarray
Store ops bboxes in a linear Uint8Array
2025-09-12 14:52:42 +02:00
calixteman
d77f89026f
Merge pull request #20240 from calixteman/fix_contrast
Make sure that a good constrast ratio is respected when darkening/lightening a color
2025-09-12 09:24:40 +02:00
calixteman
0e28b5c3c4
Merge pull request #20258 from calixteman/cleanup_before_editing_mode
[Editor] Cleanup the pages not being fully rendered before switching to editing mode
2025-09-11 23:03:08 +02:00
Tim van der Meij
e8cc25c0ae
Merge pull request #20259 from calixteman/no_throw_when_switching_editing_mode
[Editor] Don't throw when switching to editing mode before an annotation editor layer is rendered
2025-09-11 22:04:47 +02:00
Calixte Denizet
7f85c00ee6 Make sure that a good constrast ratio is respected when darkening/lightening a color 2025-09-11 21:29:28 +02:00
Tim van der Meij
557eb2c7e1
Merge pull request #20253 from calixteman/scroll_and_center
Add an option in scrollIntoView and goToXY in order to be able to center vertically or horizontally the point XY in the viewer container
2025-09-11 21:20:55 +02:00
Tim van der Meij
f049360689
Merge pull request #20255 from nicolo-ribaudo/low-res
Reduce background canvas resolution
2025-09-11 21:04:27 +02:00
Nicolò Ribaudo
4c7bbd0fef
Reduce background canvas resolution
The size of the canvas has significant impact on the rendering
performance. If we are going to render a high-res detail
view on top of the full-page canvas, we can further
reduce the full-page canvas resolution to improve
rendering time without affecting the resolution seen by
the user.

Users will se the lower resolution when quickly scrolling around the
page, but it will then be replaced with the high-res
detail view.
2025-09-10 16:52:57 +02:00
Calixte Denizet
593ceadc93 [Editor] Don't throw when switching to editing mode before an annotation editor layer is rendered
It can happen with a pdf having a large text layer.
Instead of waiting for the first rendered page to enable the buttons we wait for
a rendered annotation editor layer.
2025-09-10 11:04:47 +02:00
Calixte Denizet
0fc8986dc6 [Editor] Cleanup the pages not being fully rendered before switching to editing mode
In order to see the issue this patch is fixing:
 - open a pdf with some highlights and a comment on page 1, at page 7
 - open the comment sidebar
 - click on the comment on page 1

Opening at page 7 lets a not fully rendered page which means that when jumping to it
with the sidebar, we re-use what we've instead of redrawing it.
2025-09-10 10:23:29 +02:00
Calixte Denizet
e1bdc34b4a Add an option in scrollIntoView and goToXY in order to be able to center vertically or horizontally the point XY in the viewer container 2025-09-09 13:10:49 +02:00
Nicolò Ribaudo
e4ea2e0c79
Store ops bboxes in a linear Uint8Array
This PR changes the way we store bounding boxes so that they use less
memory and can be more easily shared across threads in the future.

Instead of storing the bounding box and list of dependencies for each
operation that renders _something_, we now only store the bounding box
of _every_ operation and no dependencies list. The bounding box of
each operation covers the bounding box of all the operations affected
by it that render something. For example, the bounding box of a
`setFont` operation will be the bounding box of all the `showText`
operations that use that font.

This affects the debugging experience in pdfBug, since now the bounding
box of an operation may be larger than what it renders itself. To help
with this, now when hovering on an operation we also highlight (in red)
all its dependents. We highlight with white stripes operations that do
not affect any part of the page (i.e. with an empty bbox).

To save memory, we now save bounding box x/y coordinates as uint8
rather than float64. This effectively gives us a 256x256 uniform grid
that covers the page, which is high enough resolution for the usecase.
2025-09-09 10:24:48 +02:00
calixteman
5b7f9ca8b9
Merge pull request #20247 from calixteman/wait_for_rendered_editors
[Editor] When clicking on a comment in the sidebar, wait for the annotation editor layer to be rendered
2025-09-09 09:26:45 +02:00
calixteman
d009c434f5
Merge pull request #20248 from calixteman/toolbar_button_position
[Editor] Make sure the comment button is at the right place when adding it in the toolbar
2025-09-08 23:06:02 +02:00
calixteman
b5113d9a74
Merge pull request #20239 from timvandermeij/integration-test-unskip-timezone
Unskip the `must check that date entered by the user is consistent` scripting integration test for Firefox
2025-09-08 22:35:18 +02:00
calixteman
17a27806c6
Merge pull request #20245 from calixteman/comment_richtext
[Editor] Add the dates and rich text if any to the editors in order to use them when displaying the popup
2025-09-08 22:23:03 +02:00
Tim van der Meij
3f0d39b024
Merge pull request #20244 from calixteman/fix_deleting_popup
[Editor] Fix saving a deleted popup
2025-09-08 21:23:47 +02:00
Tim van der Meij
512c30b1f6
Unskip the must check that date entered by the user is consistent scripting integration test for Firefox
Bug 1978027 has been fixed upstream 10 days ago, so this integration
test can be enabled for Firefox too now that it passed with recent
Nightly versions.
2025-09-08 20:48:24 +02:00
Tim van der Meij
8bd13f7f25
Merge pull request #20172 from timvandermeij/misc-test-improvements
Improve the integration test code
2025-09-08 20:44:29 +02:00
Tim van der Meij
5382c54803
Merge pull request #20243 from mozilla/dependabot/github_actions/actions/setup-node-5
Bump actions/setup-node from 4 to 5
2025-09-08 20:43:01 +02:00
Tim van der Meij
7e3417f862
Merge pull request #20242 from mozilla/dependabot/github_actions/actions/setup-python-6
Bump actions/setup-python from 5 to 6
2025-09-08 20:42:35 +02:00
Calixte Denizet
f5c913bc9e [Editor] Make sure the comment button is at the right place when adding it in the toolbar 2025-09-08 17:59:28 +02:00
Calixte Denizet
94d72e903f [Editor] Add the dates and rich text if any to the editors in order to use them when displaying the popup 2025-09-08 17:40:47 +02:00
Calixte Denizet
54351ee437 [Editor] When clicking on a comment in the sidebar, wait for the annotation editor layer to be rendered
and add a getter for the layer bounding rect.
2025-09-08 17:13:37 +02:00
Calixte Denizet
2d5794f79d [Editor] Fix saving a deleted popup 2025-09-08 15:36:41 +02:00
dependabot[bot]
f9be06a8c1
Bump actions/setup-node from 4 to 5
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 5.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 12:31:52 +00:00
dependabot[bot]
a5ef8ca828
Bump actions/setup-python from 5 to 6
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 12:26:36 +00:00
calixteman
d946de904c
Merge pull request #20238 from timvandermeij/fix-freetext-permafail
Fix the rendering of XFA rich text in popup annotations
2025-09-07 20:59:36 +02:00
Tim van der Meij
f1f8ee47ff
Fix the rendering of XFA rich text in popup annotations
Before the introduction of the `renderRichText` helper function we
exclusively used `this.#html` for XFA rich text and exclusively used
`this.#contentsObj` for plain text. However, after the refactoring we
tried to access `this.#contentsObj.dir` in both cases, which fails for
XFA rich text because `this.#contentsObj` is `null` in that case.

This commit fixes the issue by using optional chaining to make sure we
don't try to access non-existent `this.#contentsObj` properties, which
makes the `must update an existing annotation and show the right popup`
freetext integration pass again.

Fixes #20237.
Fixes 35c90984.
2025-09-07 18:35:17 +02:00
Tim van der Meij
7f74fbf8fd
Fix block spacing inconsistencies in the integration test code
Most places have a newline before/after `before{Each,All}`,
`after{Each,All}` and `it` to visually separate the blocks for clarity,
but in a handful of places this wasn't done. This commit removes the
inconsistencies so that the test code is formatted consistently.
2025-09-07 14:39:52 +02:00
Tim van der Meij
cf5bffef2e
Use the getAnnotationSelector helper function more in the integration test code
The helper function was used in a number of places, but also a lot of
places contained the annotation selector string inline. This commit
makes sure that all places use `getAnnotationSelector` consistently to
make sure the annotation selector string is only defined in a single
place and to improve readability of the test code.
2025-09-07 14:39:52 +02:00
Tim van der Meij
c09ad5a2ce
Use the closePages helper function more in the integration test code
This test called `closeSinglePage` manually at the end of the test,
which is inconsistent with all other tests that call `closePages` in an
`afterEach` block. This commit fixes the difference for consistency.
2025-09-07 14:39:48 +02:00
calixteman
2a93ade197
Merge pull request #20231 from calixteman/xfa_render_richtext
Add a new function renderRichText to be used in the annotation layer
2025-09-05 08:36:28 +02:00
Calixte Denizet
35c909843b Add a new function renderRichText to be used in the annotation layer
and which will be used in order to make the contents of the new popup used for comments.
2025-09-04 22:27:31 +02:00
calixteman
7b87c220a5
Merge pull request #20233 from calixteman/dont_add_image_stamp_update
[Editor] Don't save the image when updating a stamp annotation
2025-09-04 22:19:36 +02:00
Tim van der Meij
84e32964ed
Merge pull request #20221 from calixteman/button_color_comment
[Editor] Use the color of the annotation for the background of the comment button
2025-09-04 21:27:07 +02:00
Calixte Denizet
2354ae4233 [Editor] Don't save the image when updating a stamp annotation
It adds some useless bytes in the file.
2025-09-04 18:54:13 +02:00
Calixte Denizet
ca280399c2 [Editor] Use the color of the annotation for the background of the comment button 2025-09-02 21:17:08 +02:00
Tim van der Meij
c386d9b87d
Merge pull request #20222 from calixteman/sidebar_scroll
[Editor] Make scrollable the area containing the comments in the sidebar
2025-09-01 20:28:35 +02:00
Calixte Denizet
dd4b475109 [Editor] Make scrollable the area containing the comments in the sidebar 2025-08-31 23:21:19 +02:00
calixteman
c8d49db624
Merge pull request #20217 from calixteman/comment_editor_sidebar
[Editor] Add editors with a comment in the sidebar
2025-08-31 21:48:52 +02:00
Calixte Denizet
2a459857ce [Editor] Add editors with a comment in the sidebar
and add a button close to the editor.
Clicking on the button will display a popup with the comment but it's for a next patch.
2025-08-31 19:59:16 +02:00
Tim van der Meij
9855d85fb5
Merge pull request #20220 from timvandermeij/editor-hint-bugfix
[Editor] Hide the comment sidebar on document change
2025-08-31 18:56:27 +02:00
Tim van der Meij
5a7c872618
[Editor] Hide the comment sidebar on document change
If the document changes the comment state from the old document should
be replaced with that of the new document. To do this the comment
manager is destroyed, but the corresponding comment sidebar wasn't
destroyed yet, which resulted in the comment state from the old document
still being visible for the new document.

This commit fixes the issue by hiding the comment sidebar if the comment
manager is destroyed. Note that hiding the comment sidebar effectively
destroys all its state, and we already set the annotation mode to "none"
on document change so we don't want to keep showing the comment sidebar
anyway.
2025-08-31 16:26:03 +02:00