4672 Commits

Author SHA1 Message Date
calixteman
fd87e668e0
Merge pull request #20047 from Aditi-1400/fix-horizontal-scroll
Make horizontal padding relative to device width
2025-07-03 16:52:15 +02:00
calixteman
426ee03488
Merge pull request #20041 from calixteman/bug1974436
Remove the shadow from the links (bug 1974436)
2025-07-01 12:59:17 +02:00
Tim van der Meij
8f2a4561b2
Merge pull request #20039 from calixteman/bug1974257
[Editor] In the signature modal, disable the save checkbox when the storage is full (bug 1974257)
2025-06-30 21:46:38 +02:00
Calixte Denizet
9acd16a0c7 [Editor] In the signature modal, disable the save checkbox when the storage is full (bug 1974257) 2025-06-30 21:42:28 +02:00
Calixte Denizet
fc9ba0cda3 Remove the shadow from the links (bug 1974436)
The shadow was taken into account when computing the bounding box of the section
containing the link and it was making the clip path wrong.
Since the shadow is almost invisible because of the opacity, the yellow color and the clip
we can remove it without causing any visual regressions (and as a side effect it'll avoid
to use resources to compute it when displayed).
2025-06-30 21:39:22 +02:00
Aditi
c138887c1f 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-06-30 19:08:02 +05:30
Calixte Denizet
bb6b42177c Don't remove a dash at the end of a line when guessing urls (bug 1974112) 2025-06-26 18:55:59 +02:00
Calixte Denizet
194e2ede4d Add some telemetry in order to know what are the certificates used in pdfs (bug 1973573) 2025-06-24 22:23:29 +02:00
Calixte Denizet
3bdc5d54fe Get the text under highlight/squiggly/underline/strikethrough annotations (bug 1885505)
and add an invisible element containing the text in the annotation layer to make
it readable by a screen reader.
2025-06-22 21:47:29 +02:00
Tim van der Meij
ac399e77e8
Merge pull request #20023 from calixteman/edit_added_annotation
[Editor] When editing mode is disabled, allow to double click on a added annotation to edit it
2025-06-21 16:23:56 +02:00
Calixte Denizet
eafc040734 Allow to have an URL as file parameter when loading the viewer 2025-06-21 14:57:24 +02:00
calixteman
c7796c7f8d
Merge pull request #19993 from calixteman/editor_toolbar_simplification
Slightly simplify the way to create the editor toolbar
2025-06-20 21:59:01 +02:00
Calixte Denizet
b97cee2ab5 Correctly handle files with a hash sign in their names (bug 1894166)
It fixes #19990.
2025-06-20 09:21:41 +02:00
Calixte Denizet
2548405401 Slightly simplify the way to create the editor toolbar 2025-06-19 23:03:06 +02:00
Calixte Denizet
d0b0064643 [Editor] When editing mode is disabled, allow to double click on a added annotation to edit it
It's already possible but only when double clicking outside the the text layer.
This patach adds the possibility to click on the text layer.
2025-06-19 21:15:08 +02:00
calixteman
3baea2feff
Merge pull request #20003 from calixteman/bug1971299
Remove the possibility to go to the next page in using the ENTER key (bug 1971299)
2025-06-17 22:43:18 +02:00
Calixte Denizet
8d7246af98 [Editor] Fix the text alignment in freetext annotations (bug 1971134) 2025-06-16 15:11:32 +02:00
Calixte Denizet
07f94825c3 Remove the possibility to go to the next page in using the ENTER key (bug 1971299) 2025-06-10 14:58:18 +02:00
calixteman
d63aabd662
Merge pull request #19969 from calixteman/editor_inconsistencies
[Editor] Change mode when double clicking on an editor
2025-05-28 18:00:26 +02:00
Calixte Denizet
47e69e93a3 [Editor] Change mode when double clicking on an editor
It was only possible to double click on a FreeText editor while being in ink mode (or any other).
2025-05-28 17:49:16 +02:00
Calixte Denizet
de1a9e7055 Fix the colors of disabled buttons in the dialogs 2025-05-26 19:11:24 +02:00
Jonas Jenwald
a8e05d82e2
Merge pull request #19961 from nicolo-ribaudo/debugger-contructPath-op
Show the op dispatched by constructPath in the debugger
2025-05-23 13:15:55 +02:00
Jonas Jenwald
d81174d7bc
Merge pull request #19956 from Snuffleupagus/versionInfoHeader
Improve how the PDF.js version/commit information is exposed in the *built* files
2025-05-22 15:24:02 +02:00
Nicolò Ribaudo
0596f03d4e
Show the op dispatched by constructPath in the debugger
The `constructPath` op receives as arguments not only the
information to construct the path, but also the op to apply
the path to (such as "fill", or "stroke").

This commit updates the Stepper tool in the debugger to decode
that op, showing its name rather than just its numeric ID.
2025-05-19 19:33:14 +02:00
Calixte Denizet
69231e2dbd Fix pdfjsPreloadedWorker when it's undefined 2025-05-19 17:05:37 +02:00
Jonas Jenwald
97a42486f5 Improve how the PDF.js version/commit information is exposed in the *built* files
To make it easier to tell which PDF.js version/commit that the *built* files correspond to, they have (since many years) included `pdfjsVersion` and `pdfjsBuild` constants with that information.

As currently implemented this has a few shortcomings:
 - It requires manually adding the code, with its preprocessor statements, in all relevant files.

 - It requires ESLint disable statements, since it's obviously unused code.

 - Being unused, this code is removed in the minified builds.

 - This information would be more appropriate as comments, however Babel discards all comments during building.

 - It would be helpful to have this information at the top of the *built* files, however it's being moved during building.

To address all of these issues, we'll instead utilize Webpack to insert the version/commit information as a comment placed just after the license header.
2025-05-19 15:01:05 +02:00
Jonas Jenwald
eef1e3e87f Ensure that the viewer clears the workerPort option when using "fake" workers
Without this "fake" workers may be ignored in the API, which isn't really what you want when manually providing the `disableWorker=true` hash parameter. (Note that this requires the `pdfBugEnabled` option/preference to be set as well.)

Also, after the changes in PR 19810 we can just load the "fake" worker directly in development mode and don't need to manually assign it to the global scope.
2025-05-17 11:41:33 +02:00
Calixte Denizet
f01b13d332 Use the worker created in the child actor (bug 1966721) 2025-05-15 21:17:44 +02:00
Jonas Jenwald
ab89773e49 Prefer the /Metadata, when available, in the document properties dialog (bug 1966086) 2025-05-15 15:12:09 +02:00
Jonas Jenwald
d5c534fb83 Reduce duplication when computing the maximum canvas pixels
*This is something that occurred to me when reviewing the latest PDF.js update in mozilla-central.*

Currently we duplicate essentially the same code in both the `OutputScale.prototype.limitCanvas` and `PDFPageDetailView.prototype.update` methods, which seems unnecessary, and to avoid that we introduce a new `OutputScale.capPixels` method that is used to compute the maximum canvas pixels.
2025-05-10 20:12:38 +02:00
Calixte Denizet
1225c1e39a Add a pref in order to cap the canvas area to a factor of the window one (bug 1958015)
This way it helps to reduce the overall canvas dimensions and make the rendering faster.
The drawback is that when scrolling, the page can be blurry in waiting for the rendering.

The default value is 200% on desktop and will be 100% for GeckoView.
2025-05-09 13:57:16 +02:00
calixteman
b8de9a372f
Merge pull request #19856 from calixteman/bug1936605
Don't update the visible canvas at 60 fps (bug 1936605)
2025-04-29 22:31:02 +02:00
Calixte Denizet
ecc56a61e6 Don't update the visible canvas at 60 fps (bug 1936605)
Instead, we update the visible canvas every 500ms.
With large canvas, updating at 60fps lead to a lot gfx transactions and it can take a lot of time.
For example, with wuppertal_2012.pdf on Windows, displaying it at 150% takes around 14 min !!! without
this patch when it takes only around 14 sec with. Even at 30% it helps to improve the performance
by around 20%.
2025-04-29 18:35:21 +02:00
Jonas Jenwald
3d4e8bb17e Add a basic navigator polyfill for older Node.js versions
Modern Node.js versions now include a `navigator` implementation, with a few basic properties, that's actually enough for the PDF.js use-cases; please see https://nodejs.org/api/globals.html#navigator
Unfortunately we still support Node.js version `20`, hence we add a basic polyfill since that allows simplifying the code slightly.
2025-04-28 13:07:12 +02:00
Jonas Jenwald
0852c42c15 Always render the Annotation- and XFA-layers with light color-scheme (issue 19871)
The intention with PR 19819 was to change how colours are specified for the viewer UI, however it wasn't intended to affect elements in the Annotation- and XFA-layers.
Hence we enforce the light `color-scheme` for these layers, and also make sure to provide a default `color` for PopupAnnotations.
2025-04-26 20:44:07 +02:00
Tim van der Meij
a40bf37184
Merge pull request #19866 from Snuffleupagus/updateUrlHash
Avoid (most) string parsing when removing/replacing the hash property of a URL
2025-04-26 12:21:38 +02:00
Jonas Jenwald
af3d13c22d Use the MathClamp helper function more in the web/ folder (PR 19617 follow-up)
There's one more spot that I missed in PR 19617.
2025-04-26 11:09:52 +02:00
Jonas Jenwald
abc9522886 Avoid (most) string parsing when removing/replacing the hash property of a URL 2025-04-25 23:13:05 +02:00
Jonas Jenwald
6b76bdac3a Fix the debugger CSS when using the dark theme (PR 19819 follow-up)
Perhaps we should update the debugger CSS to properly account for the light/dark theme, however since that's not UI that end-users ever see we simply force using the light theme for now.
2025-04-24 17:34:29 +02:00
Calixte Denizet
8630822a63 Fix errors when running the integration tests
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs, line 5822: TypeError: this[#state] is null
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs, line 6001: TypeError: can't access property "getPage", this._pdfDocument is null
2025-04-23 23:04:24 +02:00
Jonas Jenwald
ae1cbc6a9e Use the light-dark CSS function in the viewer (issue 17780)
This removes the need for (most) separate `@media (prefers-color-scheme: dark)` blocks when defining colors values, and also provides a simple way of forcing use of either the light or dark theme.

Please refer to https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark and https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

*NOTE:* To support this in older browsers, we utilize a [PostCSS plugin](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function).
2025-04-23 15:31:39 +02:00
Jonas Jenwald
63e6566597
Merge pull request #19816 from Snuffleupagus/bug-1957401
Add a "supportsPrinting" viewer-option (bug 1957401)
2025-04-22 15:25:20 +02:00
Jonas Jenwald
213d51d7e9
Merge pull request #19823 from Snuffleupagus/rm-duplicate-secondaryToolbar-mask-image
Remove duplicate secondaryToolbar button `mask-image` definitions (PR 18385 follow-up)
2025-04-22 15:14:47 +02:00
Jonas Jenwald
b4626a77a2 Fix printing of XFA documents, by calling XfaLayerBuilder.prototype.render correctly (issue 19840)
When changing the format of various `render`-methods in PR 19365 I forgot to update the code used to print XFA documents, sorry about that.
2025-04-22 09:15:52 +02:00
Calixte Denizet
75e9f2a0e8 Replace the info icon in the undo bar by the right one (bug 1960523) 2025-04-18 14:13:02 +02:00
Jonas Jenwald
8e7060158e Remove duplicate secondaryToolbar button mask-image definitions (PR 18385 follow-up)
It appears that all secondaryToolbar buttons currently have their `mask-image` definitions duplicated, which leads to larger than necessary CSS files.
2025-04-17 10:51:51 +02:00
Jonas Jenwald
97fe7d6a19 Add a "supportsPrinting" viewer-option (bug 1957401)
This will allow us to respect the `print.enabled` Firefox preference, by extending [this method](https://searchfox.org/mozilla-central/rev/56117379696ea0cffb94cd09c14cd022a8c5e4e8/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#426-453), which will hide the toolbar and secondaryToolbar print-buttons.
2025-04-15 12:43:11 +02:00
Jonas Jenwald
6b961c424f Update Webpack to version 5.99.5 (issue 19808)
In Webpack version `5.99.0` the way that `export` statements are handled was changed slightly, with much less boilerplate code being generated, which unfortunately breaks our `tweakWebpackOutput` function that's used to expose the exported properties globally and that e.g. the viewer depends upon.

Given that we were depending on formatting that should most likely be viewed as nothing more than an internal implementation detail in Webpack, we instead work-around this by manually defining the structures that were previously generated.
Obviously this will lead to a tiny bit more manual work in the future, however we don't change the API-surface often enough that it should be a big issue *and* the relevant unit-tests are updated such that it shouldn't be possible to break this.

*NOTE:* In the future we might want to consider no longer using global properties like this, and instead rely only on proper `export`s throughout the code-base.
However changing this would likely be non-trivial (given edge-cases), and it'd be an `api-major` change, so let's just do the minimal amount of work to unblock Webpack updates for now.
2025-04-13 16:48:19 +02:00
Tim van der Meij
5f3e8806fe
Merge pull request #19789 from Snuffleupagus/generic-SignatureStorage-save
Simplify `Object.fromEntries` usage a tiny bit in the `web/generic_signature_storage.js` file
2025-04-12 13:37:40 +02:00
Calixte Denizet
88d58f393b [Editor] Fix the border line of the thickness slider in the signature modal while in HCM (bug 1959774) 2025-04-10 19:55:22 +02:00