1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 17:18:07 +02:00
Commit graph

20495 commits

Author SHA1 Message Date
Jonas Jenwald
aa70b28365
Merge pull request #19555 from rossj/master
Pad rev 4 encryption keys to be >= 16 bytes (issue 19484)
2025-02-25 10:03:56 +01:00
calixteman
e999f77959
Merge pull request #19554 from calixteman/signature_telemetry
[Editor] Add some telemetry for the signature editor (bug 1945827)
2025-02-24 22:53:49 +01:00
Ross Johnson
4f25d7f6cd Fix decryption of R=4, V=4 files with < 16-byte keys by 0-padding - undocumented but matches Acrobat behavior (issue #19484) 2025-02-24 15:36:37 -06:00
Calixte Denizet
9e672ff05e [Editor] Add some telemetry for the signature editor (bug 1945827) 2025-02-24 21:10:04 +01:00
calixteman
fef706233d
Merge pull request #19551 from Snuffleupagus/loadSystemFont-fix-assert
Fix the `assert` in `FontLoader.prototype.loadSystemFont`
2025-02-24 16:49:03 +01:00
calixteman
12d2f1b04a
Merge pull request #19552 from calixteman/add_generated_header_openjpeg
Add a comment 'THIS FILE IS GENERATED - DO NOT EDIT' in openjpeg files generated with emscripten
2025-02-24 16:17:48 +01:00
Jonas Jenwald
2966171a2b Fix the assert in FontLoader.prototype.loadSystemFont
Currently this `assert` isn't actually doing what it's supposed to, since the `FontLoader`-class doesn't have a `disableFontFace`-field.
The `FontFaceObject`-class on the other hand has such a field, hence we update the method-signature to be able to check the intended thing.
2025-02-24 16:09:07 +01:00
calixteman
f9aa8e1d15
Merge pull request #19539 from calixteman/paste_signature
[Editor] Shift the signature editor when pasted
2025-02-24 16:07:50 +01:00
Calixte Denizet
c099245daa Add a comment 'THIS FILE IS GENERATED - DO NOT EDIT' in openjpeg files generated with emscripten 2025-02-24 16:05:19 +01:00
Jonas Jenwald
132ccf04db [api-minor] Stop exporting, by default, a few additional Font properties (PR 11777 follow-up)
None of the "composite", "subtype", or "type" properties are normally used on the main-thread and/or in the API, hence there's no need to include them in the exported font-data by default.
Given that these properties may still be useful when debugging, and that `debugger.mjs` actually relies on the "type" property, they will instead only be sent to the main-thread when the `fontExtraProperties` API-option is used.
2025-02-24 12:27:51 +01:00
Jonas Jenwald
c4784832ac
Merge pull request #19545 from hecerinc/hecerinc/issueLinkFix
Fix the link for issue5939.pdf
2025-02-24 10:08:15 +01:00
Jonas Jenwald
d428db63c3 Improve the "FontFallback" handling on the worker-thread
Remove the `Catalog.prototype.fontFallback` method, and move its code into `PDFDocument.prototype.fontFallback` instead, to reduce the indirection a little bit.
Pass the `evaluatorOptions` directly to the `TranslatedFont.prototype.fallback` method, since nothing else in the `TranslatedFont`-class needs it now.
2025-02-24 09:34:58 +01:00
Jonas Jenwald
839e23f5c2 Send disableFontFace and fontExtraProperties as part of the exported font-data
These options are needed in the `FontFaceObject` class, and indirectly in `FontLoader` as well, which means that we currently need to pass them around manually in the API.
Given that the options are (obviously) available on the worker-thread, it's very easy to just provide them when creating `Font`-instances and then send them as part of the exported font-data. This way we're able to simplify the code (primarily on the main-thread), and note that `Font`-instances even had a `disableFontFace`-field already (but it wasn't properly initialized).
2025-02-24 09:34:48 +01:00
Hector Rincon
c19e70f6d9 Fix the link for issue5939.pdf
Web archive no longer has the revision for the saved PDF referenced in
that test case, so this updates that link to a more recent revision to
enable the tests to run on a clean clone.
2025-02-23 15:15:11 -08:00
Jonas Jenwald
ed64faa88c
Merge pull request #19543 from timvandermeij/integration-tests-helpers
Refactor the editor integration test helper functions
2025-02-23 22:56:38 +01:00
Calixte Denizet
cc3d6ab539 [Editor] Shift the signature editor when pasted
The idea is to avoid to have the pasted editor hidding the copied one:
the user could think that nothing happened.
So the top-left corner of the pasted one is moved to the bottom-right corner of the copied one.
2025-02-23 21:35:01 +01:00
Tim van der Meij
acc5a2153a
Introduce a generic clearEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:49:04 +01:00
Tim van der Meij
f155b69c07
Introduce a generic selectEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:48:24 +01:00
Tim van der Meij
060ef0e15e
Deduplicate the waitForPointerUp helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
3fe55ba, so we can remove the local copy by importing it.
2025-02-23 20:48:17 +01:00
Tim van der Meij
07629e105c
Deduplicate the getXY helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
301f1bb, so by exporting it there it can be reused.
2025-02-23 20:48:17 +01:00
Tim van der Meij
4f3dbcf24d
Remove the waitForEditorMovedInDOM helper function export
It's no longer used outside of `test_utils.mjs` since commit 301f1bb.
2025-02-23 20:48:17 +01:00
Tim van der Meij
fcf94e8c38
Merge pull request #19542 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-02-23 20:47:10 +01:00
Tim van der Meij
33c53dfaa9
Update translations to the most recent versions 2025-02-23 19:31:20 +01:00
Tim van der Meij
cd6c5b009f
Upgrade globals to version 16.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/globals/releases/tag/v16.0.0
doesn't indicate any breaking changes that should impact us.
2025-02-23 19:31:20 +01:00
Tim van der Meij
8b0f1641ee
Upgrade eslint-plugin-unicorn to version 57.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v57.0.0
doesn't indicate any breaking changes that should impact us.

However, we do replace the deprecated `no-instanceof-array` rule with
the new `no-instanceof-builtins` rule. Note that the changelog calls
this rule `no-instanceof-builtin-object`, but it got renamed in
https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2537.
2025-02-23 19:28:28 +01:00
Tim van der Meij
08ba910ef0
Update dependencies to the most recent versions 2025-02-23 18:21:50 +01:00
calixteman
878d206c79
Merge pull request #19538 from calixteman/move_draw
[Editor] Fix the position in the page of a drawing after it has been moved with the keyboard
2025-02-22 15:55:26 +01:00
Calixte Denizet
301f1bbf2b [Editor] Fix the position in the page of a drawing after it has been moved with the keyboard
When a drawing was moved with arrow keys and then printed or saved, the drawing wasn't moved finally.
So the fix is just about calling onTranslated once the translation is done.
2025-02-22 15:19:14 +01:00
Jonas Jenwald
a648e1e769
Merge pull request #19537 from Snuffleupagus/api-useWasm
[api-minor] Re-factor how the `useWorkerFetch` option is used internally
2025-02-22 14:16:31 +01:00
Tim van der Meij
23d7398371
Merge pull request #19531 from stof/patch-1
Disable the loading of node types in the type tests
2025-02-22 13:47:44 +01:00
Jonas Jenwald
637e95985a Simplify JpxImage.setOptions a little bit
After PR 19392 we're only invoking this method *once* per document, hence the early-return branch shouldn't be necessary any more.
2025-02-22 13:38:10 +01:00
Jonas Jenwald
641e2f506e [api-minor] Re-factor how the useWorkerFetch option is used internally
With the recently added OpenJPEG no-wasm fallback we need to send the `wasmUrl` option to the worker-thread *regardless* of the value of the `useWorkerFetch` option, since the fallback won't work if we don't have a URL to `import` it from.
For consistency the code is re-factored to always send the factory-urls to the worker-thread, and simply check the `useWorkerFetch` option there instead.

Also, as a follow-up to PR 19525, introduce a new `useWasm` option that can be used in e.g. browser-tests to forcibly disable WebAssembly usage.
2025-02-22 09:56:53 +01:00
Jonas Jenwald
6d3bb47655
Merge pull request #19525 from calixteman/bug1935076_part2
Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076)
2025-02-22 09:34:40 +01:00
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