4232 Commits

Author SHA1 Message Date
Calixte Denizet
12066af578 [Editor] Add a fake annotation (in the annotation layer) associated with an editor in order to be able to show the comment button (bug 1989420) 2025-10-01 09:08:57 +02:00
Calixte Denizet
7fc7b79cd0 [Annotation] In reading mode with new commment stuff enabled, use the comment popup for annotations without a popup but with some contents (bug 1991029) 2025-09-26 18:24:55 +02:00
Calixte Denizet
f547e834e1 [Editor] Give the focus to the comment button after editing in reading mode 2025-09-26 17:18:37 +02:00
calixteman
28fb4f0f47
Merge pull request #20310 from calixteman/bug1990762
[Editor] Show the comments in the sidebar in the chronological order,newest to oldest (bug 1990762)
2025-09-26 11:09:27 +02:00
Calixte Denizet
f854770806 [Editor] Show the comments in the sidebar in the chronological order, newest to oldest (bug 1990762) 2025-09-26 10:10:43 +02:00
calixteman
7051fd0215
Merge pull request #20307 from calixteman/bug1990872
[Editor] Make sure the selected editor is correctly focused after switching editing mode (bug 1990872)
2025-09-26 09:17:48 +02:00
Calixte Denizet
888df7c319 [Editor] Make sure the selected editor is correctly focused after switching editing mode (bug 1990872) 2025-09-25 22:42:32 +02:00
Calixte Denizet
442932f0b3 [Editor] Move the focus to the comment button once editing is done (bug 1990820) 2025-09-25 20:17:52 +02:00
Calixte Denizet
90e56b706e [Editor] Add a title to the comment buttons (bug 1990813) 2025-09-25 18:47:49 +02:00
Calixte Denizet
a372294ea3 [Editor] Make the comment sidebar resizable (bug 1990544) 2025-09-25 15:29:41 +02:00
Calixte Denizet
0b40bf1743 [Editor] Update the color and the position of the comment button in reading mode they've been modified 2025-09-24 09:45:37 +02:00
calixteman
225b07aa29
Merge pull request #20283 from calixteman/bug1989304
[Editor] Make sure the comment dialog is visible on the screen (bug 1989304)
2025-09-23 19:30:28 +02:00
calixteman
44affa76b9
Merge pull request #20197 from ryzokuken/sab-font-data
Serialize font data into an ArrayBuffer
2025-09-22 09:40:14 +02:00
Ujjwal Sharma
4bed7370f4 [WIP] Serialize font data into an ArrayBuffer
This PR serializes font data into an ArrayBuffer
that is then transfered from the worker to the
main thread. It's more efficient than the current
solution which clones the "export data" object
which includes the font data as a Uint8Array.

It prepares us to switch to a SharedArrayBuffer
in the future, which would allow us to share
the font data with multiple agents, which would be
crucial for the upcoming "renderer" worker.
2025-09-19 12:02:40 +05:30
Calixte Denizet
623d422ddb [Editor] Make sure the comment dialog is visible on the screen (bug 1989304) 2025-09-18 21:23:42 +02:00
Calixte Denizet
cbc5241b53 [Editor] Make sure to not add extra editors when showing again a destroyed page 2025-09-18 15:18:50 +02:00
calixteman
adf9233f46
Merge pull request #20270 from calixteman/issue20232
Consider a ttf font with both Symbolic and Nonsymbolic flags set with a Differences array in the encoding dict as non-symbolic
2025-09-14 21:37:58 +02:00
Calixte Denizet
b6d772d71d Consider a ttf font with both Symbolic and Nonsymbolic flags set with a Differences array in the encoding dict as non-symbolic
It fixes #20232.
2025-09-14 18:52:16 +02:00
Tim van der Meij
ffeaa9111a
Replace manual returns with pending in the integration tests
This allows Jasmine to track skipped tests and makes it easier to
discover them using e.g. `grep`.
2025-09-14 18:30:17 +02:00
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
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
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
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
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
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
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
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
Calixte Denizet
2d5794f79d [Editor] Fix saving a deleted popup 2025-09-08 15:36:41 +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
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
maettuu
2d8dfb0b62 Add regression test for Unicode mapping
Verifies that ToUnicodeMap correctly maps Extension B characters to their full Unicode code points using codePointAt

See PR https://github.com/mozilla/pdf.js/pull/19184
2025-09-04 17:17:34 +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
Calixte Denizet
0ec503e5ef Add a function changeLightness in order to change the lightness of a RGB color 2025-08-30 21:18:12 +02:00
Tim van der Meij
11d5d6d0ce
Skip the curvature ink editor integration test for Chrome on Windows
This test permafails for that particular OS/browser combination.

Fixes 18d3dc18.
2025-08-25 20:09:32 +02:00
Tim van der Meij
ab41f5095c
Merge pull request #20190 from timvandermeij/text-layer-permafail
Improve the selection check in the "doesn't jump when moving selection" integration test
2025-08-25 19:40:27 +02:00
Calixte Denizet
af144be3ba Don't iterate over all empty slots in the xref entries (bug 1980958) 2025-08-25 14:02:08 +02:00
Tim van der Meij
4cc93af364
Improve the selection check in the "doesn't jump when moving selection" integration test
Locally, on Arch Linux, this integration test permafails:

```
1) Text layer Text selection using selection carets doesn't jump when moving selection
  Message:
    second selection:
        Expected '(frequently executed) bytecode sequences, records
        them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s.
  Stack:
        at <Jasmine>
        at UserContext.<anonymous> (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:521:12)
  Message:
    third selection:
        Expected '(frequently executed) bytecode sequences, records
        them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s.
  Stack:
        at <Jasmine>
        at UserContext.<anonymous> (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:529:12
```

The exact selection can differ a bit per OS/browser. In this case the
last character was consistently not selected while on other platforms it
is, so this commit fixes the issue by relaxing the regex to not consider
the final character so that the test passes if the rest matches.
2025-08-24 20:46:20 +02:00
Tim van der Meij
18d3dc18e0
Use WebDriver BiDi for Chrome 2025-08-24 15:58:52 +02:00
calixteman
592d6c070a
Merge pull request #20179 from calixteman/add_rect_popup
[Editor] Add a Rect entry to a saved popup in order to avoid to have an invalid pdf
2025-08-24 12:01:31 +02:00
calixteman
cfe08bd035
Merge pull request #20184 from calixteman/use_cached_annotations
Use the cached annotations when collecting them by types
2025-08-24 11:57:17 +02:00
Nicolò Ribaudo
6a22da9c2e
Add logic to track rendering area of various PDF ops
This commit is a first step towards #6419, and it can also help with
first compute which ops can affect what is visible in that part of
the page.

This commit adds logic to track operations with their respective
bounding boxes. Only operations that actually cause something to
be rendered have a bounding box and dependencies.

Consider the following example:
```
0. setFillRGBColor
1. beginText
2. showText "Hello"
3. endText
4. constructPath [...] -> eoFill
```
here we have three rendering operations: the showText op (2) and the
path (4). (2) depends on (0), (1) and (3), while (4) only depends on
(0). Both (2) and (4) have a bounding box.

This tracking happens when first rendering a PDF: we then use the
recorded information to optimize future partial renderings of a PDF, so
that we can skip operations that do not affected the PDF area on the
canvas.

All this logic only runs when the new `enableOptimizedPartialRendering`
preference, disabled by default, is enabled.

The bounding boxes and dependencies are also shown in the pdfBug
stepper. When hovering over a step now:
- it highlights the steps that they depend on
- it highlights on the PDF itself the bounding box
2025-08-22 18:26:59 +02:00
Calixte Denizet
ebc3411727 Use the cached annotations when collecting them by types 2025-08-21 18:04:00 +02:00
Calixte Denizet
f8466c9ff8 [Editor] Add a Rect entry to a saved popup in order to avoid to have an invalid pdf 2025-08-20 17:56:50 +02:00
Calixte Denizet
9e5ee1e5a7 [Editor] Add the ability to get all the editable annotations in a pdf document
We want to be able to show all the comments in a pdf even if the pages where they are
haven't been rendered.
And it'll help to fix the issue #18915.
2025-08-18 21:31:11 +02:00