1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00
Commit graph

20562 commits

Author SHA1 Message Date
calixteman
c2e616dfc9
Merge pull request #19534 from calixteman/signature_description_test
[Editor] Add a test for copy & paste a signature editor
2025-02-21 23:01:31 +01:00
Jonas Jenwald
553ec7babc
Merge pull request #19128 from nicolo-ribaudo/draw-page-portion
[api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303)
2025-02-21 22:24:41 +01:00
calixteman
b4e26dc425
Merge pull request #19533 from Xiphoseer/type3-text-rise
Consider textRise when showing Type3 font glyphs (issue 19532)
2025-02-21 22:10:58 +01:00
Calixte Denizet
814d2bbe6d [Editor] Add a test for copy & paste a signature editor
This patch fixes an issue when pasting: an exception was thrown when pasting.
And while writing the test and comparing the paths in the svg, I found a difference
which is fixed thanks to call to the right constructor (to take into account the inheritance)
in inkdraw.js
2025-02-21 21:43:19 +01:00
Xiphoseer
24aa39eb14 Consider textRise when showing type3 font glyphs
Add test case for issue 19532
2025-02-21 21:31:04 +01:00
Calixte Denizet
36e4f5c222 Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076) 2025-02-21 19:03:47 +01:00
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
Christophe Coevoet
93a5fa5b88
Disable the loading of node types in the type tests
Those type tests are performing type checking on a project using DOM APIs, intended to reflect the usage in a non-node project.
Not loading the node types in that project ensures that the library type declarations don't force a dependency on the node types.
2025-02-21 14:10:35 +01: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
calixteman
34ef74cf0e
Merge pull request #19518 from Snuffleupagus/JpegStream-EXIF-replace
Move the EXIF-block replacement into `JpegStream` (PR 19356 follow-up)
2025-02-20 23:11:43 +01:00
calixteman
c64d3d7cc0
Merge pull request #19524 from calixteman/fix_doorhanger_color
[Editor] Fix the color of the labels in the editing doorhangers
2025-02-20 22:45:51 +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
calixteman
6713c239e3
Merge pull request #19523 from calixteman/signature_menu_outline
[Editor] Fix the outline of a focused button in the doorhanger while navigating with the keyboard
2025-02-20 19:23:54 +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
calixteman
b1d579d4ab
Merge pull request #19522 from calixteman/bug1949417
[Editor] Make the editing toolbar buttons text visible when hovered in HCM with Desert theme (bug 1949417)
2025-02-20 15:45:20 +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
calixteman
c52b5bac6c
Merge pull request #19516 from calixteman/bug1949201
[Editor] Remove the error panel when the user click on an other tab (bug 1949201)
2025-02-20 14:07:07 +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
Jonas Jenwald
d5ce35f744 Move the EXIF-block replacement into JpegStream (PR 19356 follow-up)
Currently we modify the EXIF-block in place, which may end up "breaking" the JPEG-data of the original PDF document since e.g. saving it from the viewer no longer contains the real EXIF-block.
Hence the EXIF-block replacement is moved into the `JpegStream` class, such that we can copy the data before doing the replacement.
2025-02-20 12:41:39 +01:00
Jonas Jenwald
d10cea5dd0
Merge pull request #19470 from ryzokuken/fix-autolinking-edge-cases
Fix autolinking errors
2025-02-19 14:43:14 +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
Jonas Jenwald
63b397f49d
Merge pull request #19513 from Snuffleupagus/issue-19510
Don't cache free/missing XRef entries (issue 19510)
2025-02-18 21:23:01 +01:00
Jonas Jenwald
db7cf40a30 Don't cache free/missing XRef entries (issue 19510)
During the XRef stream parsing we're attempting to lookup an entry that hasn't yet been found, since parsing is currently running, and given that we'd also cache free/missing XRef entries we'd then return an incorrect value during normal PDF parsing.

The simplest solution here is to just not cache free/missing XRef entries, since a properly generated PDF document shouldn't be trying to access objects it doesn't contain.
Furthermore, the amount of "extra" parsing now needed for such XRef entries shouldn't be significant enough to be an issue.
2025-02-18 18:04:00 +01:00
calixteman
5bc3cb839b
Merge pull request #19512 from calixteman/signature_test2
[Editor] Add two integration tests for the signature feature
2025-02-18 18:03:00 +01:00
Jonas Jenwald
426c730e11
Merge pull request #19504 from Snuffleupagus/eslint-fix-arrow-body-style
Fix all outstanding ESLint `arrow-body-style` warnings
2025-02-18 17:52:36 +01:00
Calixte Denizet
3fe55baa5e [Editor] Add two integration tests for the signature feature
- one test about adding a drawn signature
- an other one about adding a signature extracted from an image.
2025-02-18 15:24:03 +01:00
calixteman
a857ca3261
Merge pull request #19511 from calixteman/editor_dnd_image
[Editor] Wait for switching to stamp mode before adding a new editor when dnd'ing an image
2025-02-18 13:16:30 +01:00
Calixte Denizet
9984afe6a6 [Editor] Wait for switching to stamp mode before adding a new editor when dnd'ing an image
When dnd'ing an image with the FreeText mode enabled, the image wasn't correctly added.
2025-02-18 10:53:34 +01:00
calixteman
203452c170
Merge pull request #19508 from calixteman/issue19505
[JS] Skip throwing actions
2025-02-17 22:57:14 +01:00
calixteman
d0107566ba
Merge pull request #19506 from calixteman/bug1948741
[Editor] Scale the signature editor when it's too large (bug 1948741)
2025-02-17 21:59:46 +01:00
Calixte Denizet
8f9232202f [JS] Skip throwing actions
It fixes #19505.

We were invaliding throwing actions (in setting event.rc to false) and all the event process was stopped.
Now we're just dumping the exception in the console: the action is skipped and event.rc is not set
else the input fields aren't updated wit KeyStroke actions.
2025-02-17 21:58:20 +01:00
calixteman
a0bdd67bc3
Merge pull request #19507 from calixteman/bug1948771
[Editor] Add a scrollbar to the signature doorhanger when it's overflowing (bug 1948771)
2025-02-17 21:31:01 +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
Calixte Denizet
3fc6b1321f [Editor] Scale the signature editor when it's too large (bug 1948741) 2025-02-17 20:20:26 +01:00
Jonas Jenwald
36979e9eb2 Fix all outstanding ESLint arrow-body-style warnings
Currently this rule is disabled in a number of spots across the code-base, and unless absolutely necessary we probably shouldn't disable linting, so let's just update the code to fix all the outstanding cases.
2025-02-17 15:45:44 +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
calixteman
2df0f925b9
Merge pull request #19500 from calixteman/test_signature1
[Editor] Add two integration tests for the signature UI
2025-02-17 14:48:07 +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
Tim van der Meij
33c97570f5
Merge pull request #19499 from Snuffleupagus/useWorkerFetch-ensure-boolean
Ensure that the `useWorkerFetch` fallback value is always a boolean
2025-02-16 14:50:29 +01:00
Jonas Jenwald
06e4580f8b Ensure that the useWorkerFetch fallback value is always a boolean
If either of the factory-urls are missing or invalid, the fallback value would currently become `useWorkerFetch === null`.
While that is obviously a falsy value, which means that the code still works as intended, we should ensure that this is consistent.
2025-02-16 14:04:30 +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
3f15e0c469
Merge pull request #19495 from Snuffleupagus/issue-19494
Check more of the stream when looking for commands after inline image (issue 19494)
2025-02-15 17:05:59 +01:00
Jonas Jenwald
8dec353c7a
Merge pull request #19496 from Snuffleupagus/shorter-#buildObjectKey
Shorten the `CipherTransformFactory.prototype.#buildObjectKey` method
2025-02-15 17:03:35 +01:00
Jonas Jenwald
65df1d336f Check more of the stream when looking for commands after inline image (issue 19494)
Currently we only check `followingBytes`, which turns out to be too short to find e.g. valid transform (cm) commands with decimal arguments.
2025-02-15 15:14:47 +01:00
Jonas Jenwald
a722ca4de5 Shorten the CipherTransformFactory.prototype.#buildObjectKey method
- Use `TypedArray.prototype.set()` rather than a manual loop when building the `key`.

 - Use an existing local variable to avoid re-computing the length of the `encryptionKey`.
2025-02-15 13:00:42 +01:00
calixteman
92ff26e4ff
Merge pull request #19427 from calixteman/bug1946181
Add some unicode mapping for ligatures when writing the cmap table in the font (bug 1946181)
2025-02-14 17:46:07 +01:00