4232 Commits

Author SHA1 Message Date
Tim van der Meij
844681a2fa
Disable AI/ML features using Firefox preferences for testing
We don't need AI/ML features in the tests, so this should reduce CPU
usage by not having the inference process running. Moreover, it prevents
the following lines from being logged in the test output:

```
JavaScript error: resource://gre/actors/MLEngineParent.sys.mjs, line 509: Error: Unable to get the ML engine from Remote Settings.
JavaScript error: resource://gre/actors/MLEngineParent.sys.mjs, line 1279: TypeError: can't access property "postMessage", this[#port] is null
```
2025-08-17 16:05:04 +02:00
Tim van der Meij
a05dc9c1c5
Remove obsolete Firefox preferences for testing
The following preferences don't have to be set manually anymore:

- `print.show_print_progress`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1770536
  - Commit: b522664310

- `gfx.offscreencanvas.enabled`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1914083
  - Commit: 7d2c688920

- `layout.css.round.enabled`
  - Why: removed
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1874633
  - Commit: 97909653e7

- `dom.events.asyncClipboard.clipboardItem`
  - Why: enabled by default
  - Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1887845
  - Commit: de56ae88bf
2025-08-17 14:53:35 +02:00
Tim van der Meij
17dc9e9917
Skip the "must check that an existing highlight is ignored on hovering" integration test on Windows
This is a temporary measure to reduce noise until #20136 is fixed. Note
that this shouldn't be an issue in terms of coverage because we still
run the test on Linux.
2025-08-14 20:54:41 +02:00
Tim van der Meij
7294377cd9
Implement a delay for Chrome protocol calls in the integration tests
In Chrome protocol calls are faster than in Firefox and thus trigger in
quicker succession. This can cause intermittent failures because new
protocol calls can run before events triggered by the previous protocol
calls had a chance to be processed (essentially causing events to get
lost).

This commit fixes the issue by configuring Chrome with a protocol call
delay value that gives it a more similar execution speed as Firefox
(which also gives us more consistency between the two browser runs).

Note that this doesn't negatively impact the overall runtime of the
integration tests because Puppeteer already waits for a test to complete
in both browsers before continuing to the next one and Chrome
consistently was, and with this patch still slightly is, faster in
completing the tests.
2025-08-14 20:54:37 +02:00
Calixte Denizet
6a00174688 [Editor] Correctly hide deleted annotations 2025-08-13 22:41:19 +02:00
Calixte Denizet
1d4ae786f4 Check the setDash arguments
It fixes #20155.
2025-08-09 22:34:44 +02:00
calixteman
fcf69d8536
Merge pull request #20093 from Aditi-1400/fix-horizontal-scroll
Make horizontal padding relative to device width
2025-08-06 11:44:55 +02:00
Aditi
9babc144a7 Make horizontal padding relative to device width
The fixed -400px horizontal offset used by
scrollIntoView led to horizontal scroll only moving
part-way right on narrow screens. The highlights near
the right-edge remained party or completely off
screen.

This centres the highlighted match on any viewport width while
clamping the left margin to 20-400px. On very narrow screens
the scrollbar now moves all the way to the right instead of
stopping midway.
2025-08-04 15:29:52 +05:30
Calixte Denizet
a81e99168a [Editor] Highlight text on a selectionchange event which hasn't been triggered by the pointer or the keyboard (bug 1976597)
It's useful for users highlighting with NVDA.
They've to enable native selection and then selection some text.
In this case only a selectionchange is triggered once the selection is done.
2025-07-31 21:03:32 +02:00
calixteman
e5922f2e72
Merge pull request #20129 from calixteman/bug1978985
Disable printing when enablePermission is true and the pdf isn't allowed to be printed (bug 1978985)
2025-07-30 20:03:44 +02:00
Calixte Denizet
806f9c1cee Disable printing when enablePermission is true and the pdf isn't allowed to be printed (bug 1978985) 2025-07-30 19:29:01 +02:00
Tim van der Meij
48c6253b32
Fix intermittent failure in the "must check that the computed value is correct" scripting integration test
Typing in the text field causes a sandbox event to trigger, which we
should await to avoid continuing to the next part of the test before
the sandbox event is fully processed.
2025-07-29 19:31:08 +02:00
calixteman
2e974e8f30
Merge pull request #20109 from maettuu/reg-test-pr-19639
Add regression test for PR 19639
2025-07-28 18:53:24 +02:00
Calixte Denizet
3fb7cd40e7 [Editor] Add a floating button in order to highlight the text selection and add a comment (bug 1979381)
The callback called when clicking on the button is the same as the one trigged by clicking in the context menu (in m-c).
2025-07-28 15:32:23 +02:00
Calixte Denizet
57ce4f8f43 Use a HTML date/time input when a field requires a date or a time.
The user will be able to enter a date in the format corresponding to their locale
and it'll be formatted in using the format provided by the pdf.
2025-07-24 22:01:45 +02:00
Calixte Denizet
78391ed85a Fix the xref table with the values we've at the beginning of a xref stream (bug 1978317) 2025-07-22 22:10:23 +02:00
maettuu
ac8757f36f Add regression test for negative LW normalization in gs operator
Ensure that negative “LW” entries in an ExtGState dictionary are converted to their absolute values when the “gs” operator is processed.

See PR https://github.com/mozilla/pdf.js/pull/19639
2025-07-20 16:03:46 +02:00
Tim van der Meij
ed141970e6
Merge pull request #20099 from calixteman/bug1977259
[Editor] Fix the highlighting colors in HCM (bug 1977259)
2025-07-18 22:25:43 +02:00
Tim van der Meij
f3080a185b
Merge pull request #20106 from timvandermeij/fix-viewer-alert-intermittent
Fix intermittent failure in the viewer alert tests
2025-07-18 21:32:26 +02:00
Tim van der Meij
603fd2524a
Fix intermittent failure in the viewer alert tests
It takes some time for the viewer alert to be updated after the editor
is committed, but the current tests don't await that and proceed too
fast to the viewer alert string assertion. This commit fixes the issue
by waiting for the expected viewer alert string to appear instead.
2025-07-18 20:56:02 +02:00
Calixte Denizet
f695e0ca62 Make the link annotations correctly announced by screen readers (bug 1708041)
And focus the targeted page when the user clicks on a link.
2025-07-18 20:15:31 +02:00
Calixte Denizet
c022a3294a [Editor] Fix the highlighting colors in HCM (bug 1977259)
Using the same color in HCM or non-HCM was inducing a too small contrast between
some bg/fg colors making the text a bit hard to read.
2025-07-18 20:11:28 +02:00
Calixte Denizet
8b17e5ecd8 Use canvas context text primitives when the font file is missing
It fixes #20065.

The only to get a path (from the path generator) is when the font is embedded.
So when we need a path (disableFontFace: true or when we want to use a pattern for stroking/filling), it's impossible
to fulfil.
2025-07-18 19:57:30 +02:00
Tim van der Meij
23bd705cea
Merge pull request #20080 from calixteman/add_comment_1
[Editor] Add the possibility to add Popup annotations (bug 1976724)
2025-07-17 21:07:06 +02:00
calixteman
d2f8e60794
Merge pull request #20098 from calixteman/update_highlight_color
[Editor] Make possible to change the highlight color from the main panel
2025-07-17 21:06:29 +02:00
Calixte Denizet
5162209b27 [Editor] Make possible to change the highlight color from the main panel
It's consistent with the way to change colors for FreeText or Ink annotations.
2025-07-17 20:57:51 +02:00
Calixte Denizet
86d58b637f Don't add an undefined id to the span for marked content
It fixes #20102.
2025-07-17 19:13:30 +02:00
Calixte Denizet
636ff503ff [Editor] Add the possibility to add Popup annotations (bug 1976724)
It's a first big step.
This patch contains a new modal dialog to let the user edit/update a Popup
2025-07-15 22:39:16 +02:00
calixteman
4f2390a607
Merge pull request #20070 from calixteman/editor_toolbar_color
[Editor] Add a color picker in the toolbar of Ink and Freetext annotations
2025-07-14 23:55:51 +02:00
Calixte Denizet
dbd6f8cdd4 [Editor] Add a color picker in the toolbar of Ink and Freetext annotations 2025-07-14 23:00:01 +02:00
calixteman
ac2a0c5080
Merge pull request #20085 from calixteman/bug1975719
Handle the case where all the image data are in the alpha channel (bug 1975719)
2025-07-14 22:44:19 +02:00
Tim van der Meij
a0f8cbafcf
Fix the "must check that canvas perfectly fits the page whatever the zoom level" viewer integration test
In order to screenshot the page and assert that it's monochrome,
providing a regression test for #18694, the viewer background is
configured to match the page background because screenshotting the page
always captures a small part of the viewer background as well, and this
way we can easily go over all pixels and check that they are all equal.

However, in addition to configuring the viewer background the test also
hides the toolbar and removes the page border. Especially the latter
makes `scrollIntoView` fail in both Chrome and Firefox with recent
Puppeteer versions, for reasons which remain a bit unclear.

Fortunately both hiding the toolbar and removing the page border is not
actually necessary (anymore) for the test to work, so we can simply
remove those actions to fix the issue and reduce the amount of code. To
make sure that the test still covers the original issue correctly we've
reverted the changes from #18698 and then test still fails as expected.

Fixes #19811.
Fixes 68332ec2.
2025-07-12 21:49:33 +02:00
Tim van der Meij
b7a0f01f40
Merge pull request #19976 from calixteman/write_popup
[Editor] Add the possibility to add a popup to an annotation when saving
2025-07-12 15:28:56 +02:00
Tim van der Meij
64b150f78f
Merge pull request #20077 from calixteman/remove_popup
[Editor] Remove a popup from the DOM when it's deleted
2025-07-12 15:25:49 +02:00
Calixte Denizet
6f8796d2c8 Handle the case where all the image data are in the alpha channel (bug 1975719)
and add an error message in case where there is no data in the image.
2025-07-11 22:34:37 +02:00
Calixte Denizet
b07914843b [Editor] Remove a popup from the DOM when it's deleted 2025-07-11 21:55:14 +02:00
Calixte Denizet
8fc51dc089 [Editor] Add the possibility to add a popup to an annotation when saving
When saving/printing, only update the properties which are provided and set
a default value only when there is no pre-existing one.
2025-07-11 21:42:21 +02:00
Calixte Denizet
0f504d9a1a Add the l10n parameter when pasting a Signature annotation 2025-07-10 21:01:24 +02:00
Calixte Denizet
e36f58ee4d Revert "Make horizontal padding relative to device width"
This reverts commit c138887c1f7613bce44b99d22b63e2d744b0fb40.
2025-07-09 17:38:49 +02:00
calixteman
1b427a3af5
Merge pull request #20016 from ryzokuken/move-getcontext
[api-minor] Move getContext call to InternalRenderTask
2025-07-08 22:20:19 +02:00
calixteman
0e2b59e3d5
Merge pull request #20064 from calixteman/dict_api
Add few methods to the Dict class in order to simplify the code when writing an annotation
2025-07-08 22:16:57 +02:00
calixteman
481b74a1c2
Merge pull request #20063 from calixteman/issue20062
Fix the default appearance of a Polygon annotation when a fill color is provided
2025-07-08 22:10:52 +02:00
Calixte Denizet
63b37b4371 Add few methods to the Dict class in order to simplify the code when writing an annotation 2025-07-08 21:23:29 +02:00
Calixte Denizet
ecc7096a80 Fix the default appearance of a Polygon annotation when a fill color is provided
It fixes #20062.
2025-07-08 20:51:58 +02:00
Tim van der Meij
b999d5ce58
Merge pull request #20060 from noritaka1166/fix-typos
Fix typos across the codebase
2025-07-08 18:28:52 +02:00
Calixte Denizet
bb52a440ce Use the creation date in the popup when there is no modification date
Remove the h1 element in popup title because it caused a warning in Firefox and use a span instead.
2025-07-07 10:51:35 +02:00
Noritaka Kobayashi
fa568e826d
Fix typos across the codebase 2025-07-07 09:59:36 +09:00
Tim van der Meij
cbeef3233f
Merge pull request #20056 from calixteman/one_click
[Editor] Allow to change the editor mode when selecting the corresponding editor (bug 1975538)
2025-07-06 19:35:31 +02:00
Ujjwal Sharma
b1b728d47f [api-minor] Move getContext call to InternalRenderTask
This is a precursor to moving the call into a
worker thread to let us use `OffscreenCanvas`. The
current position wouldn't work since we make
transformations to the canvas object after the
getContext call, which isn't allowed for
OffscreenCanvas. Also it isn't allowed to clone or
`transferControlToOffscreen` the canvas after the
`getContext` call.
2025-07-04 00:53:51 +02:00
Calixte Denizet
6d2c6cfc9f [Editor] Allow to change the editor mode when selecting the corresponding editor (bug 1975538)
For example, selecting an ink editor just after having created a freetext will switch to ink mode.
2025-07-03 23:27:34 +02:00