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

20678 commits

Author SHA1 Message Date
Tim van der Meij
cb818ce0d3
Merge pull request #19720 from Snuffleupagus/_initializeViewerComponents-shorten
Shorten the `PDFViewerApplication._initializeViewerComponents` method
2025-03-30 11:52:19 +02:00
Tim van der Meij
9d237b9f96
Merge pull request #19737 from Snuffleupagus/TilingPattern-color-param
Simplify handling of the color-parameter in `TilingPattern` (PR 4824 follow-up)
2025-03-30 11:49:11 +02:00
Tim van der Meij
9e58bac43c
Merge pull request #19740 from Snuffleupagus/integration-test-properly-spelling
Spell "properly" in viewer integration-test names
2025-03-30 11:48:12 +02:00
Jonas Jenwald
5b7b94c078 Spell "properly" in viewer integration-test names 2025-03-29 16:35:22 +01:00
Jonas Jenwald
8e3a3387e0 Reduce duplication when specifying the fn-operations in buildPaintImageXObject
Currently we explicitly specify the fn-`OPS` both when adding entries to the operatorList and to the image-caches, and by using a temporary variable we can reduce a bit of duplication (similar to the existing args-handling).
2025-03-29 15:56:46 +01:00
Jonas Jenwald
09118670ca Simplify handling of the color-parameter in TilingPattern (PR 4824 follow-up)
The color-parameter is already available through `IR` (i.e. the internal representation), and after the changes in PR 4824 (which landed in 2014) we no longer need any special handling for it.
2025-03-29 13:02:13 +01:00
Jonas Jenwald
667645798f Apply char/word-spacing correctly for missing Type3-glyphs
In the included PDF document the Type3-font doesn't contain any glyph definition for "space", despite that character being referenced in the /Contents stream.
While missing Type3-glyphs obviously cannot be rendered, we still need to update the current canvas position such that any char/word-spacing is correctly applied.

The test-case was found at https://github.com/pdf-association/pdf-differences/tree/main/Type3WordSpacing
2025-03-29 00:12:08 +01:00
calixteman
dfa553dc11
Merge pull request #19734 from calixteman/bug1952563
[Editor] Add a border to the undo button in the snackbar in order to make a contrast (bug 1952563)
2025-03-28 22:03:22 +01:00
Calixte Denizet
bb2ef20420 [Editor] Add a border to the undo button in the snackbar in order to make a contrast (bug 1952563) 2025-03-28 21:42:57 +01:00
Jonas Jenwald
8bcc3664c9 [api-minor] Attempt to improve support for using the PDF.js builds with Vite
Similar to Webpack there's apparently other bundlers that will not leave `import`-calls alone unless magic comments are used.
Hence we extend the builder to also append `/* @vite-ignore */` comments to `import`-calls, in order to attempt to improve support for using the PDF.js builds together with Vite.

This patch also renames `__non_webpack_import__` to `__raw_import__` since the functionality is no longer bundler-specific.

***PLEASE NOTE:*** This patch is provided as-is, and it does *not* mean that the PDF.js project can/will provide official support for Vite.
2025-03-28 16:34:00 +01:00
Jonas Jenwald
34136d7775
Merge pull request #19731 from Snuffleupagus/Type3-Path2D-pre-transform
Pre-apply the transform when building the `Path2D` objects for Type3-fonts
2025-03-28 16:29:18 +01:00
Jonas Jenwald
f577271908 Simplify the compileType3Glyph function to just return the Path2D objects
Originally this function would "manually" invoke the rendering commands for Type3-glyphs, however that was changed some time ago:
 - Initial `Path2D` support was added in PR 14858, but the old code kept for Node.js compatibility.
 - Since PR 15951 we've been using a `Path2D` polyfill in Node.js environments.

Hence, after the previous commit, we can further simplify this function by *directly* returning/using the `Path2D` object when rendering Type3-glyphs; see also https://github.com/mozilla/pdf.js/pull/19731#discussion_r2018712695
While this won't improve performance significantly, when compared to the introduction of `Path2D`, it definately cannot hurt.
2025-03-28 15:20:43 +01:00
Jonas Jenwald
852b7e407a Pre-apply the transform when building the Path2D objects for Type3-fonts
Rather than updating the transform every time that we're painting a Type3-glyph, we can instead just compute the "final" coordinates during building of the `Path2D` objects.
2025-03-28 13:28:25 +01:00
calixteman
31ec357282
Merge pull request #19730 from calixteman/update_fluent
Update @fluent/dom to 0.10.1
2025-03-28 11:13:53 +01:00
Calixte Denizet
6ff1626cf3 Update @fluent/dom to 0.10.1 2025-03-28 09:39:02 +01:00
calixteman
3da8901f26
Merge pull request #19728 from calixteman/bug1956513
[Editor] Set an aria-description for an added signature (bug 1956513)
2025-03-27 21:31:02 +01:00
Jonas Jenwald
f23087ca7e
Merge pull request #19726 from Snuffleupagus/_setDefaultAppearance-bbox
Use `Util.rectBoundingBox` more in the annotation code (PR 19713 follow-up)
2025-03-27 21:30:01 +01:00
Calixte Denizet
7d8c64b2ff [Editor] Set an aria-description for an added signature (bug 1956513)
NVDA behaves differently depending if the user is hovering or focusing an added signature.
An aria-description is read in both cases while an aria-label is not.
2025-03-27 18:14:06 +01:00
Jonas Jenwald
29788eb0b8 Use Util.rectBoundingBox more in the annotation code (PR 19713 follow-up)
By changing the return format of the various `pointsCallback` functions we can use the `Util.rectBoundingBox` helper in the `MarkupAnnotation.prototype._setDefaultAppearance` method as well, thus shortening the code slightly.
2025-03-27 13:46:36 +01:00
calixteman
2da54ffb59
Merge pull request #19725 from calixteman/bug1956114
[Editor] in the signature UI, disable the description input if there is no signature (bug 1956114)
2025-03-27 13:36:32 +01:00
Calixte Denizet
62df96894d [Editor] in the signature UI, disable the description input if there is no signature (bug 1956114) 2025-03-26 23:02:13 +01:00
calixteman
828398f60f
Merge pull request #19722 from calixteman/bug1956110
[Editor] Fix the border color of a tab panel in HCM (bug 1956110)
2025-03-26 18:54:19 +01:00
Calixte Denizet
5c3c003931 [Editor] Fix the border color of a tab panel in HCM (bug 1956110)
And fix the color of the signature itself when its a drawing or if it comes
from an image.
2025-03-26 14:56:24 +01:00
Jonas Jenwald
c6b9338f6f
Merge pull request #19719 from Snuffleupagus/structTree-xref
Pass the `XRef`-instance explicitly to the `StructTreeRoot` class, and simplify the `StructElementNode.prototype.role` getter
2025-03-25 19:41:20 +01:00
Jonas Jenwald
74ab29544e
Merge pull request #19701 from Snuffleupagus/enableAutoLinking-true
[api-minor] Enable `enableAutoLinking` by default
2025-03-25 18:18:08 +01:00
Jonas Jenwald
22107145df
Merge pull request #19691 from Snuffleupagus/xfa-template-rm-reduce
Remove `Array.prototype.reduce` usage from the `src/core/xfa/template.js` file
2025-03-25 18:17:12 +01:00
Jonas Jenwald
532406427b Simplify the StructElementNode.prototype.role getter a tiny bit
Given that the `roleMap` only contains `Name`-strings, the lookup can be simplified thanks to modern JavaScript features.
2025-03-25 18:04:56 +01:00
Jonas Jenwald
3c93d63731 Pass the XRef-instance explicitly to the StructTreeRoot class
This avoids the current situation where we're accessing it through various dictionaries, since that's a somewhat brittle solution given that in the general case a `Dict`-instance may not have the `xref`-field set (see e.g. the empty-Dict).
2025-03-25 18:04:51 +01:00
calixteman
d4c7aaa9d3
Merge pull request #19702 from calixteman/issue19694
In the struct tree a kid can be a reference to an MCID entry (issue #19694)
2025-03-25 18:02:46 +01:00
Calixte Denizet
6146e5fee7 Optimize save-transform-constructPath-restore
The 4 operations can be replaced with just one in applying the transform to the points coordinates.
2025-03-25 15:31:45 +01:00
Calixte Denizet
dee80cb082 In the struct tree a kid can be a reference to an MCID entry (issue #19694) 2025-03-25 15:01:52 +01:00
Jonas Jenwald
8f7d6f4118 Shorten the PDFViewerApplication._initializeViewerComponents method
By tweaking a few local variable names we can shorten various viewer-component initialization code, and we can also reduce some duplication when assigning components to the `PDFViewerApplication`-scope.
2025-03-25 12:51:40 +01:00
calixteman
a8c77633a1
Merge pull request #19717 from calixteman/issue16287
Don't overwrite the global alpha when switching to smask mode (bug 1764587)
2025-03-25 10:08:36 +01:00
Calixte Denizet
1d0227af62 Don't overwrite the global alpha when switching to smask mode
It fixes #issue16287.
2025-03-24 21:35:09 +01:00
calixteman
b57da32d70
Merge pull request #19716 from calixteman/issue16742
Take into account the group bbox
2025-03-24 16:57:34 +01:00
Jonas Jenwald
9456b88f6b Remove Array.prototype.reduce usage from the src/core/xfa/template.js file
Using `Array.prototype.reduce` often leads to less readable code, and in these cases we can replace that with other Array-methods instead.
2025-03-24 16:40:41 +01:00
Jonas Jenwald
fceaab8864
Merge pull request #19713 from Snuffleupagus/Util-minMax-methods
Add new bounding-box helpers in `Util` to reduce code duplication
2025-03-24 16:39:05 +01:00
Jonas Jenwald
d8d4f2a850
Merge pull request #19714 from Snuffleupagus/MathClamp-3
Use the `MathClamp` helper function even more (PR 19617 follow-up)
2025-03-24 16:35:07 +01:00
Calixte Denizet
a3c31904f1 Take into account the group bbox
It fixes #16742.
2025-03-24 15:07:31 +01:00
calixteman
bcba053a5e
Merge pull request #19715 from calixteman/issue18529
Take into account the path and the line width when consuming a stroked path
2025-03-24 14:41:29 +01:00
Jonas Jenwald
b85f0903ca Add new bounding-box helpers in Util to reduce code duplication
Currently we have a `Util`-helper for computing the bounding-box of a Bézier curve, however for simple points and rectangles we repeat virtually identical code in many spots throughout the code-base.

 - Introduce new `Util.pointBoundingBox` and `Util.rectBoundingBox` helpers.

 - Remove the "fallback" from `Util.bezierBoundingBox` and only support passing in a `minMax`-array, since there's only a single call-site using the other format and it could be easily updated.
2025-03-23 19:20:02 +01:00
Calixte Denizet
2369e2d84f Take into account the path and the line width when consuming a stroked path 2025-03-23 18:08:06 +01:00
Jonas Jenwald
4547e582ff Use the MathClamp helper function even more (PR 19617 follow-up)
There's a few more spots that I accidentally missed in PR 19617.
2025-03-23 17:11:06 +01:00
Tim van der Meij
19b4adac03
Merge pull request #19711 from timvandermeij/integration-tests-freetext-isolate-part-2
Isolate the "create editor with keyboard" freetext editor integration tests
2025-03-23 15:06:39 +01:00
calixteman
7c5695f5c6
Merge pull request #19708 from calixteman/fix_save_smask_mode
Fix save/restore while in smask mode
2025-03-23 14:45:09 +01:00
Tim van der Meij
d01913e62e
Isolate the "create editor with keyboard" freetext editor integration tests
This commit reduces the number of freetext editor integration test suite
failures, in full isolation, from 6 to 5 by fixing the following issues
in the "create editor with keyboard" block:

- The second test relied on the first test to enable freetext editing
  mode and put focus on the page (annotation layer). For isolation we
  now do that explicitly in the second test.
- The second test relied on the first test for the editor numbering. For
  isolation we change the editor numbering to the one after initial
  document load.

Moreover, the test names have been updated to clarify with scenario is
being tested, which came up during comparison of the changes against
commit ea5eafa to make sure that we are still testing the originally
intended scenarios (confirmed by disabling the relevant code from the
commit per scenario and noticing the corresponding test failing).
2025-03-23 14:28:03 +01:00
Tim van der Meij
94b2c86251
Merge pull request #19704 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2025-03-23 13:43:28 +01:00
Jonas Jenwald
c7c08bbd07
Merge pull request #19710 from Snuffleupagus/Math-sumPrecise
Introduce `Math.sumPrecise` usage in the code-base
2025-03-23 13:34:28 +01:00
Jonas Jenwald
e73224ded7 Introduce Math.sumPrecise usage in the code-base
This is a new JavaScript feature that makes it easy to compute the sum of list of values; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sumPrecise

This allows us to remove most cases of `Array.prototype.reduce`, which helps improve readability since that (in my opinion) often isn't the most intuitive code.
2025-03-23 13:03:56 +01:00
Tim van der Meij
7352d1d683
Update translations to the most recent versions 2025-03-23 12:46:06 +01:00