Nicolò Ribaudo
dc5d6aad8a
Avoid degrading scroll performance due to the detail view
...
When scrolling quickly, the constant re-rendering of the detail view
significantly affects rendering performance, causing Firefox to
not render even the _background canvas_, which is just a static canvas
not being re-drawn by JavaScript.
This commit changes the viewer to only render the detail view while
scrolling if its rendering hasn't just been cancelled. This means that:
- when the user is scrolling slowly, we have enough time to render the
detail view before that we need to change its area, so the user always
sees the full screen as high resolution.
- when the user is scrolling quickly, as soon as we have to cancel a
rendering we just give up, and the user will see the lower resolution
canvas. When then the user stops scrolling, we render the detail view
for the new visible area.
2025-02-21 10:00:57 -08:00
Nicolò Ribaudo
458b2ee402
[api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303)
...
When rendering big PDF pages at high zoom levels, we currently fall back
to CSS zoom to avoid rendering canvases with too many pixels. This
causes zoomed in PDF to look blurry, and the text to be potentially
unreadable.
This commit adds support for rendering _part_ of a page (called
`PDFPageDetailView` in the code), so that we can render portion of a
page in a smaller canvas without hiting the maximun canvas size limit.
Specifically, we render an area of that page that is slightly larger
than the area that is visible on the screen (100% larger in each
direction, unless we have to limit it due to the maximum canvas size).
As the user scrolls around the page, we re-render a new area centered
around what is currently visible.
2025-02-21 10:00:55 -08:00
Nicolò Ribaudo
06257f782e
Extract PDFPageViewBase
class out of PDFPageView
...
This base class contains the generic logic for:
- Creating a canvas and showing when appropriate
- Rendering in the canvas
- Keeping track of the rendering state
2025-02-21 09:48:31 -08:00
Jonas Jenwald
e3ea92603d
Merge pull request #19493 from Snuffleupagus/URL-parse
...
Introduce some `URL.parse()` usage in the code-base
2025-02-21 10:40:32 +01:00
Calixte Denizet
cd94c19f9a
[Editor] Fix the color of the labels in the editing doorhangers
...
The fix in #19522 wasn't correct.
This one should be better.
2025-02-20 19:31:57 +01:00
Calixte Denizet
8be6d744cd
[Editor] Fix the outline of a focused button in the doorhanger while navigating with the keyboard
...
It's a follow-up of #19507 .
Without this patch the outline is partially hidden.
2025-02-20 18:33:19 +01:00
Calixte Denizet
b7e65b854b
[Editor] Make the editing toolbar buttons text visible when hovered in HCM with Desert theme (bug 1949417)
2025-02-20 15:01:52 +01:00
Calixte Denizet
12ba81718c
[Editor] Remove the error panel when the user click on an other tab (bug 1949201)
2025-02-20 14:03:59 +01:00
Ujjwal Sharma
38ab358fb1
Fix autolinking error due to redundant annotations on zooming
...
Fix an issue where redundant links were being added to the annotation
layer on zooming on the page with the links.
2025-02-19 13:18:31 +01:00
Ujjwal Sharma
70e2873430
Fix autolinking errors due to regex and email validation
...
Fix some edge cases in the autolinking logic with the regex as well as
validating email domains and add unit tests for them.
Fixes: https://github.com/mozilla/pdf.js/issues/19462
2025-02-19 13:18:31 +01:00
Calixte Denizet
cde7d83319
[Editor] Add a scrollbar to the signature doorhanger when it's overflowing (bug 1948771)
2025-02-17 21:09:56 +01:00
Jonas Jenwald
affce70a09
Merge pull request #19503 from Snuffleupagus/web-rm-some-eslint-disable
...
Remove a few `eslint-disable` statements in the `web/` folder
2025-02-17 15:21:57 +01:00
Calixte Denizet
b8993cfcc8
[Editor] Add two integration tests for the signature UI
2025-02-17 13:58:54 +01:00
Jonas Jenwald
a2d15ceb84
Remove a few eslint-disable
statements in the web/
folder
...
These cases could be easily re-written to avoid having to disable ESLint rules.
2025-02-17 13:40:09 +01:00
Jonas Jenwald
c2e33307b1
Introduce some URL.parse()
usage in the code-base
...
This (fairly new) static method allows parsing URLs without having to wrap `new URL(...)` calls within `try...catch` blocks, thus simplifying the code; see https://developer.mozilla.org/en-US/docs/Web/API/URL/parse_static
For older browsers/environments the functionality will be polyfilled, but *only* in `legacy` builds, via `core-js`; see https://github.com/zloirock/core-js?tab=readme-ov-file#url-and-urlsearchparams
*Please note:* This is currently limited to the `src/`- and `web/`-folders, such that we don't break development/testing, since the functionality is not available in all Node.js versions that we support; see https://developer.mozilla.org/en-US/docs/Web/API/URL/parse_static#browser_compatibility
2025-02-15 19:10:36 +01:00
Jonas Jenwald
96f5dcbd91
Add a new closeIfActive
method in the OverlayManager
class
...
It's now pretty common that we only want to close a `dialog` *if* it's currently active, to avoid throwing errors, and this new method provides a shorter and more convenient way to achieve that.
2025-02-14 15:43:00 +01:00
calixteman
6258a77bd7
Merge pull request #19486 from calixteman/signature_edit_desc
...
[Editor] Add the possibility to change a signature description (bug 1948116)
2025-02-14 15:41:45 +01:00
Jonas Jenwald
6ad56135c9
Merge pull request #19481 from Snuffleupagus/GenericL10n-fetch-bundles-parallel
...
[GenericL10n] Fetch the language bundles in parallel to reduce load time
2025-02-14 15:33:29 +01:00
Jonas Jenwald
c81a404138
Merge pull request #19475 from Snuffleupagus/injectLinkAnnotations-method-event
...
Move the auto-link handling into its own `PDFPageView` helper-method, and dispatch a "linkannotationsadded" event
2025-02-14 14:05:06 +01:00
Calixte Denizet
1d82b2ce94
[Editor] Add the possibility to change a signature description (bug 1948116)
2025-02-14 14:00:45 +01:00
Jonas Jenwald
7dbf8c8e4b
Slightly shorten an Array.from
usage in the SignatureManager
class
...
This should be equivalent to the old code, and besides being ever so slightly shorter I'm also finding it a little bit easier to read at a glance.
2025-02-13 20:04:02 +01:00
Calixte Denizet
68451fe17e
[Editor] Populate the 'Add signature' menu with the saved signatures (bug 1947828)
2025-02-13 15:59:57 +01:00
Jonas Jenwald
8d8e25c89d
[GenericL10n] Fetch the language bundles in parallel to reduce load time
...
For non `en-US` locales this will, ever so slightly, shorten the time it takes to load and parse the language bundles.
2025-02-13 11:53:45 +01:00
Jonas Jenwald
8727a04ae5
Move the auto-link handling into its own PDFPageView
helper-method, and dispatch a "linkannotationsadded" event
...
This is similar to a lot of existing functionality for various layers, and the new event might be helpful in e.g. the integration-tests.
2025-02-12 14:57:44 +01:00
Jonas Jenwald
d6f63d0e4b
Merge pull request #19469 from Snuffleupagus/bug-1947248
...
[api-major] Apply the `userUnit` using CSS, to fix the text/annotation layers (bug 1947248)
2025-02-11 23:13:46 +01:00
calixteman
5b13ea14c2
Merge pull request #19472 from calixteman/update_button_hover_color
...
Fix the color of the background button when hovering it
2025-02-11 22:42:51 +01:00
Calixte Denizet
6950a312aa
Fix the color of the background button when hovering it
2025-02-11 20:15:17 +01:00
Jonas Jenwald
e2d2263788
Merge pull request #19464 from Snuffleupagus/autolinking-catch
...
Catch and ignore any errors during auto-linking parsing (PR 19110 follow-up)
2025-02-11 20:06:33 +01:00
Jonas Jenwald
bd05b255fa
[api-major] Apply the userUnit
using CSS, to fix the text/annotation layers (bug 1947248)
...
Rather than modifying the "raw" dimensions of the page, we'll instead apply the `userUnit` as an *additional* scale-factor via CSS.
*Please note:* It's not clear to me if this solution is fully correct either, or if there's other problems with it, but it at least *appears* to work.
---
With these changes, the following CSS variables are now assumed to be available/set as necessary: `--total-scale-factor`, `--scale-factor`, `--user-unit`, `--scale-round-x`, and `--scale-round-y`.
2025-02-11 14:36:06 +01:00
calixteman
e3cca6d513
Merge pull request #19425 from calixteman/signature_save
...
[Editor] Add the possibility to compress/decompress the signature data in order to store them in the logins storage in Firefox (bug 1946171)
2025-02-10 19:20:32 +01:00
Calixte Denizet
6b95095e14
Add the possibility to compress/decompress the signature data in order to store them in the logins storage in Firefox (bug 1946171)
2025-02-10 19:09:51 +01:00
Jonas Jenwald
29fbed384a
Merge pull request #19461 from Snuffleupagus/autolinking-lazy-borderStyle
...
Create the `borderStyle` of inferred links lazily (PR 19110 follow-up)
2025-02-10 16:32:12 +01:00
Jonas Jenwald
357ff4afde
Catch and ignore any errors during auto-linking parsing (PR 19110 follow-up)
...
While investigating a bug, that I've not yet had time to fully investigate and report, I found that if there's ever an error thrown from the `Autolinker` class it'll prevent the annotationEditorLayer from rendering *and* the renderTask itself will be treated as having failed.
2025-02-10 16:28:02 +01:00
Jonas Jenwald
de1c2146b8
Merge pull request #19458 from timvandermeij/updates
...
Update dependencies and translations to the most recent versions
2025-02-10 12:47:56 +01:00
Jonas Jenwald
fba5f3c237
Create the borderStyle
of inferred links lazily (PR 19110 follow-up)
...
Given that most inferred links will overlap existing LinkAnnotations, creating a lot of unused `borderStyle` objects seem unnecessary.
Hence we can move that into the `AnnotationLayer.prototype.addLinkAnnotations` method instead, which also allows us to slightly reduce the API-surface.
2025-02-10 11:53:22 +01:00
Jonas Jenwald
81e99da440
Check that the annotationLayer is still active before injecting inferred links (PR 19110 follow-up)
...
This issue is quite difficult to trigger reliably, however it's possible for rendering to have been aborted and thus for the annotationLayer to have been removed once we're invoking `injectLinkAnnotations`. In that case, an Error is thrown[1].
The way that I'm able to *intermittently* trigger this is by:
- Loading http://localhost:8888/web/viewer.html?file=/test/pdfs/pdf.pdf#disableHistory=true
- Enable "Wrapped Srolling" mode.
- Quickly zoom out, to the minimum zoom level.
---
[1]
```
renderView: TypeError: can't access property "injectLinkAnnotations", this.annotationLayer is null
resultPromise http://localhost:8888/web/pdf_page_view.js:1116
draw http://localhost:8888/web/pdf_page_view.js:1099
renderView http://localhost:8888/web/pdf_rendering_queue.js:196
forceRendering http://localhost:8888/web/pdf_viewer.js:1849
promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
renderView http://localhost:8888/web/pdf_rendering_queue.js:198
renderView http://localhost:8888/web/pdf_rendering_queue.js:197
forceRendering http://localhost:8888/web/pdf_viewer.js:1849
promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
renderView http://localhost:8888/web/pdf_rendering_queue.js:198
renderView http://localhost:8888/web/pdf_rendering_queue.js:197
forceRendering http://localhost:8888/web/pdf_viewer.js:1849
promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
renderView http://localhost:8888/web/pdf_rendering_queue.js:198
renderView http://localhost:8888/web/pdf_rendering_queue.js:197
forceRendering http://localhost:8888/web/pdf_viewer.js:1849
promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
renderView http://localhost:8888/web/pdf_rendering_queue.js:198
renderView http://localhost:8888/web/pdf_rendering_queue.js:197
forceRendering http://localhost:8888/web/pdf_viewer.js:1849
promise callback*forceRendering http://localhost:8888/web/pdf_viewer.js:1848
renderHighestPriority http://localhost:8888/web/pdf_rendering_queue.js:79
update http://localhost:8888/web/pdf_viewer.js:1677
onScaleChanging http://localhost:8888/web/app.js:2550
dispatch http://localhost:8888/web/event_utils.js:115
#setScaleUpdatePages http://localhost:8888/web/pdf_viewer.js:1363
#setScale http://localhost:8888/web/pdf_viewer.js:1389
updateScale http://localhost:8888/web/pdf_viewer.js:2263
updateZoom http://localhost:8888/web/app.js:814
zoomOut http://localhost:8888/web/app.js:827
onKeyDown http://localhost:8888/web/app.js:2780
bindWindowEvents http://localhost:8888/web/app.js:2097
initialize http://localhost:8888/web/app.js:262
run http://localhost:8888/web/app.js:704
webViewerLoad http://localhost:8888/web/viewer.js:294
<anonymous> http://localhost:8888/web/viewer.js:305
pdf_rendering_queue.js:204:21
```
2025-02-10 09:19:04 +01:00
Jonas Jenwald
37ef0b4a86
Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
...
*Note:* For the issue mentioned on Matrix it'll obviously still make sense to improve the regular expression to detect more URL edge-cases.
However it occurred to me that even once that particular case is fixed there'll always be a risk that inferred links could overlap, and effectively block, the actual LinkAnnotations.
Hence this patch removes the URL comparison to ensure that overlapping inferred links will always be ignored.
2025-02-09 22:06:58 +01:00
Tim van der Meij
d2a07dcac6
Update dependencies to the most recent versions
...
Moreover, fix the linting issues (using `npx gulp lint --fix`) that are
found by the new versions of the linting tools.
2025-02-09 18:58:26 +01:00
Calixte Denizet
24417a1a0b
[Editor] Add the ability to print and save some newly added signatures (bug 1946795)
2025-02-07 23:07:27 +01:00
Calixte Denizet
5ee7307bf5
[Editor] Add an icon for the signature tool and move it before the highlight one
2025-02-06 20:58:59 +01:00
Jonas Jenwald
41a918b0fe
Merge pull request #19430 from Snuffleupagus/Fluent-PLATFORM
...
[GENERIC viewer] Add Fluent `PLATFORM` function (PR 19414 follow-up)
2025-02-06 20:07:07 +01:00
Jonas Jenwald
314928ffd7
Fix --save-warning-color
CSS variable typo (PR 19414 follow-up)
2025-02-06 19:06:04 +01:00
Jonas Jenwald
d5d3d8b3f7
[GENERIC viewer] Add Fluent PLATFORM
function (PR 19414 follow-up)
...
This patch extends the `FeatureTest.platform` getter to provide the necessary information, and uses that one to implement a Fluent `PLATFORM` function based on: https://searchfox.org/mozilla-central/rev/d1fbe983fb7720f0a4aca0e748817af11c1a374e/intl/l10n/rust/fluent-ffi/src/bundle.rs#81-98
2025-02-06 18:59:35 +01:00
Calixte Denizet
76c06c5996
Enable autolinking in Firefox (bug 1019475)
2025-02-06 17:02:54 +01:00
calixteman
2d773cb773
Merge pull request #19110 from ryzokuken/autolink-demo
...
Enable automatic URL linking (bug 1019475)
2025-02-06 16:53:48 +01:00
Calixte Denizet
fa25ab9c13
[Editor] Add a new dialog for the signature editor (bug 1945574)
2025-02-05 23:00:38 +01:00
Ujjwal Sharma
61ba1ea48c
Enable automatic URL linking
...
Automatically detect links in the text content of a file and automatically
generate link annotations at the appropriate locations to achieve
automatic link detection and hyperlinking.
2025-02-05 16:56:54 +01:00
calixteman
58c8f069f7
Merge pull request #19395 from calixteman/fix_overlay_manager
...
Avoid to remove the active overlay when a cancelled dialog (like the file picker) was called from a dialog
2025-01-30 16:51:26 +01:00
Calixte Denizet
eca1e6c52e
Avoid to remove the active overlay when a cancelled dialog (like the file picker) was called from a dialog
2025-01-30 16:13:48 +01:00
Calixte Denizet
2c737bc420
Move the array containing the supported image mime types in display_utils
...
and make it available for the viewer (it'll be used in the signature UI).
2025-01-30 15:35:17 +01:00