4224 Commits

Author SHA1 Message Date
Calixte Denizet
b9368b576d Lint and format the HTML in using Prettier
The linter found some issues in viewer.html with </input> which isn't required
and a missing closing div in test/resources/reftest-analyzer.html.
The HTML can now be nicely formatted. In order to not break the build for
mozilla-central, the preprocessor has been fixed in order to take into account
the white spaces at the beginning of a comment line.
And finally, make .prettierrc (which is supposed to be either json or yaml)
itself lintable.
2025-11-18 17:22:50 +01:00
calixteman
264046736d
Merge pull request #20151 from maettuu/reg-test-pr-19184
Add regression test for PR 19184
2025-11-18 09:26:11 +01:00
Calixte Denizet
e13a618df3 Merge the structure trees coming from different pdfs (bug 1997379) 2025-11-17 19:56:36 +01:00
Tim van der Meij
603e3a8f3e
Merge pull request #20430 from timvandermeij/freetext-helper
Introduce a helper function to create a freetext editor in the integration tests
2025-11-16 14:50:17 +01:00
Tim van der Meij
b5b821365e
Introduce a helper function to create a freetext editor in the integration tests
Doing so has a number of advantages:

- it removes code duplication, thereby improving readability;
- it removes hardcoded editor IDs, by using the `getNextEditorId` helper
  function that was previously introduced for the highlight editor
  integration tests, thereby improving readability and reusability;
- it removes potential for intermittent failures by not proceeding until
  the freetext editor is fully created and all assertions pass, which
  didn't happen consistently before because the code wasn't centralized.
2025-11-09 14:32:24 +01:00
Calixte Denizet
37f4712f7e Update the named page destinations when some pdf are combined (bug 1997379)
and remove link annotations pointing on a deleted page.
2025-11-07 18:22:19 +01:00
Calixte Denizet
ad97c5b816 Update the page labels tree when a pdf is extracted (bug 1997379) 2025-11-07 15:59:57 +01:00
Calixte Denizet
bc87f4e8d6 Add the possibility to create a pdf from different ones (bug 1997379)
For now it's just possible to create a single pdf in selecting some pages in different pdf sources.
The merge is for now pretty basic (it's why it's still a WIP) none of these data are merged for now:
 - the struct trees
 - the page labels
 - the outlines
 - named destinations
For there are 2 new ref tests where some new pdfs are created: one with some extracted pages and an other
one (encrypted) which is just rewritten.
The ref images are generated from the original pdfs in selecting the page we want and the new images are
taken from the generated pdfs.
2025-11-07 14:57:48 +01:00
Calixte Denizet
6db23139be Don't set the MathML namespace for attributes in MathML tags (bug 1997343)
And by default a XML file is UTF-8 encoded so correctly decode the embedded file.
2025-10-30 18:37:19 +01:00
Edoardo Cavazza
a932a063ea Revert unwanted change 2025-10-29 17:34:34 +01:00
Edoardo Cavazza
17cdd9b1e7 Move tables test to specific struct tree spec file 2025-10-29 17:33:36 +01:00
Edoardo Cavazza
d04832a82f Add test case for empty cells 2025-10-29 17:31:49 +01:00
Coelacanthus
6590063614
Add the font PT Astra Serif as a possible substitution for Times New Roman
Metric-compatible font with Times New Roman created by ParaType, based on
their serif font PT Serif, released under OFL-1.1 license.

https://www.paratype.com/fonts/pt/pt-astra-serif

Signed-off-by: Coelacanthus <uwu@coelacanthus.name>
2025-10-29 17:15:31 +08:00
calixteman
520363b350
Merge pull request #20384 from calixteman/bug1937438
Make MathML elements visible in the struct tree (bug 1937438)
2025-10-23 17:55:42 +02:00
Calixte Denizet
e5a62c8d06 Make MathML elements visible in the struct tree (bug 1937438)
It'll help to make math equations "visible" for screen readers.
MS Office has a specific way to add some MathML code to struc tree leaf
and this patch handles it.
2025-10-23 16:29:01 +02:00
calixteman
1a8689b9be
Merge pull request #20340 from Aditi-1400/serialize-pattern-ab
Serialize pattern data into ArrayBuffer
2025-10-22 11:05:22 +02:00
calixteman
9f397a632c
Merge pull request #20378 from timvandermeij/integration-tests-aboutstacks
Don't use the `aboutstacks.pdf` file in the integration tests
2025-10-19 20:40:10 +02:00
calixteman
a40df9a5be
Merge pull request #20380 from timvandermeij/integration-tests-tweak-viewer-scroll
Tweak the "scroll into view" viewer integration test
2025-10-19 20:37:30 +02:00
Calixte Denizet
9205305dbb Add a highlightSpan function in order to simplify a bit the integration tests 2025-10-19 19:37:41 +02:00
Tim van der Meij
4fd3bad67f
Tweak the "scroll into view" viewer integration test
On GitHub Actions this test could fail with `Expected 1.3125 to be less
than 1` due to slight differences in the decimals of the `rect.y` value.
However, for this check we're only really interested in full pixels, so
this commit rounds the value up to the next integer to not be affected
by small decimal differences so the test passes on GitHub Actions too.
2025-10-19 17:33:11 +02:00
Tim van der Meij
9ab4de5c04
Don't use the aboutstacks.pdf file in the integration tests
For the integration tests we prefer non-linked test cases because those
PDF files are directly checked into the Git repository and thus don't
need a separate download step that linked test cases do.

However, for the freetext and ink integration tests we currently use
`aboutstacks.pdf` which is a linked test case. Fortunately we don't need
to use it because for most tests we don't actually use any properties of
it: we only create editors on top of the canvas, but for that any PDF
file works, so we can simply use the non-linked `empty.pdf` file instead.

The only exception is the "aria-owns" test that needs a line of text from
the PDF file, so we move that particular test to a dedicated `describe`
block and adapt it to use the non-linked `attachment.pdf` file that just
contains a single line of text that can be used for this purpose.

The changes combined make 12 more integration tests run out-of-the-box
after a Git clone, which also simplifies running on GitHub Actions.
2025-10-19 13:05:46 +02:00
Tim van der Meij
b2810513c9
Merge pull request #20377 from calixteman/fix_integration_test1
[Editor] Fix integration test after #20372
2025-10-18 13:43:25 +02:00
Tim van der Meij
bd0bf03a68
Merge pull request #20375 from calixteman/fix_color_copy_paste
[Editor] Make sure the color picker has the right color when pasting an editor
2025-10-17 21:05:44 +02:00
Calixte Denizet
c2535b32fe [Editor] Fix integration test after #20372 2025-10-17 20:44:02 +02:00
Calixte Denizet
97fec3ab81 [Editor] Make sure the color picker has the right color when pasting an editor 2025-10-17 19:37:05 +02:00
Calixte Denizet
18a7a82c29 [Editor] FreeText annotations aren't supposed to have an attached popup so disable commenting for them (bug 1995028) 2025-10-17 18:33:15 +02:00
Calixte Denizet
fd3f7528b6 [Editor] Correctly focus the annotation once the comment has been removed in the annotation layer (bug 1994738) 2025-10-16 16:12:36 +02:00
Aditi
fa631806bf Serialize pattern data into ArrayBuffer
Follow up on https://github.com/mozilla/pdf.js/pull/20197,
This serializes pattern data into an ArrayBuffer which is
then transferred from the worker to the main thread.

It sets up the stage for us to eventually switch to a
SharedArrayBuffer in the future.
2025-10-11 01:58:07 +05:30
Calixte Denizet
f5a6dd4164 [Annotation] Use the annotations rect in order to fix the order in the DOM (bug 1987914)
It's just a partial fix for bug 1987914 but the time spent to add the annotations in the DOM
is divided by 5.
2025-10-09 17:43:49 +02:00
Calixte Denizet
41dea1e38b [Editor] Make sure that annotation positions in the DOM respect the visual order (bug 1992770) 2025-10-08 15:11:09 +02:00
calixteman
d83cbb28a9
Merge pull request #20341 from calixteman/bug1992868
[Editor] Make sure all editors are focusable with the keyboard (bug 1992868)
2025-10-07 22:34:10 +02:00
Calixte Denizet
76e0de6c08 [Editor] Make sure the editor is focused after the comment has been deleted (bug 1992832) 2025-10-07 21:31:09 +02:00
Calixte Denizet
5c28346abc [Editor] Make sure all editors are focusable with the keyboard (bug 1992868) 2025-10-07 21:15:26 +02:00
Calixte Denizet
be987f2fbf [Editor] Make sure that comment stuff is removed when an editor is deleted (bug 1992987) 2025-10-07 19:09:48 +02:00
Tim van der Meij
f4104326f3
Merge pull request #20338 from calixteman/test_date_tz
Add a test for PR #20320
2025-10-05 20:24:02 +02:00
Calixte Denizet
25ce14042f Add a test for PR #20320 2025-10-05 19:38:37 +02:00
Calixte Denizet
19ff148163 Fix incremental saving with hybrid references
This patch removes some previous fixes which are now likely fixed by #17636.

Fixes #20302.
2025-10-04 18:31:55 +02:00
Calixte Denizet
4d15bfec0d Only apply word spacing when there is a 0x20 in the text chunk
Fixes #20319.
2025-10-03 22:18:02 +02:00
Calixte Denizet
17993a0c5d Fix the creation of the annotation layer in the ref tests 2025-10-02 20:27:29 +02:00
calixteman
9d917b2896
Merge pull request #20323 from calixteman/bug1991482
Increase the rendering quality of the detail view (bug 1991482)
2025-10-01 19:29:17 +02:00
Calixte Denizet
91e2f6c400 Increase the rendering quality of the detail view (bug 1991482)
But keep a lower quality when enableOptimizedPartialRendering is true because we need to compensate the time
used to compute the bboxes and since subsequent rendering are faster it's more acceptable to see
a lower quality image for few tenths of seconds.
2025-10-01 16:40:41 +02:00
Calixte Denizet
bb556dcb5c [Editor] Add the possibility to unselect a comment from the sidebar 2025-10-01 14:36:12 +02:00
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