Commit Graph

16042 Commits

Author SHA1 Message Date
Calixte Denizet
680c293c34 Add unicode mapping in the font cmap to have correct chars when printing in pdf (bug 1778484)
It aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1778484.
2022-07-13 14:38:27 +02:00
Jonas Jenwald
b4a3fd31c8
Merge pull request #15162 from Snuffleupagus/prefer-logical-operator-over-ternary
Enable the `unicorn/prefer-logical-operator-over-ternary` ESLint plugin rule
2022-07-13 09:50:04 +02:00
calixteman
1301b71b7c
Merge pull request #15163 from calixteman/prepare_touch
[Editor] Always have an ink editor (when in ink mode)
2022-07-12 19:35:32 +02:00
Calixte Denizet
2df2defa02 [Editor] Always have an ink editor (when in ink mode)
Previously it was created only on mouseover event but on a touch screen
there are no fingerover event...
The idea behind creating the ink editor on mouseover was to avoid to have
a canvas on each visible page.
So now, when the editor is created, the canvas has dimensions 1x1 and
only when the user starts drawing the dimensions are set to the page ones.
2022-07-12 19:18:37 +02:00
Jonas Jenwald
dcc73423e5 Enable the unicorn/prefer-logical-operator-over-ternary ESLint plugin rule
This leads to ever so slightly more compact code, and can in some cases remove the need for a temporary variable.

Please find additional information here:
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
2022-07-12 10:52:37 +02:00
calixteman
aa6512e70f
Merge pull request #15159 from calixteman/1778982
[Editor] Avoid to have the ink editor smaller than the resizer (bug 1778982)
2022-07-11 18:53:16 +02:00
Calixte Denizet
1b3c0f1799 [Editor] Avoid to have the ink editor smaller than the resizer (bug 1778982) 2022-07-11 17:00:34 +02:00
Jonas Jenwald
e572bc4e76
Merge pull request #15158 from timvandermeij/ttx
Update `ttx` from version 2.5 to version 3.19.0
2022-07-11 11:05:34 +02:00
Tim van der Meij
3d4476ac53
Update ttx from version 2.5 to version 3.19.0
The current version 2.5 is from September 2014, which is almost 8 years
old now. The new version 3.19.0 is from November 2017, which is still
almost 5 years old, but is a step forward towards eventually using the
most recent version. Note that we currently can't update any further;
see #11802 for the details.

Fortunately using this newer version only required a few changes:

- The `ttx` output regexes needed updating to ignore comments that `ttx`
  now puts after some XML nodes (`<!-- ... -->` and `/* ... */`).
- The `ttx` invocation now explicitly uses `python2` (except on Windows
  where this alias doesn't exist) since otherwise the font tests can't
  be run on modern systems anymore given that `python` is nowadays an
  alias for `python3`, and it now points at the new location of the
  `ttx.py` file since the `Tools` folder got removed.
- The note about needing a 32-bit Python 2.6 version is dropped since
  it's obsolete: this version (and also the existing one already) work
  just fine on a 64-bit Python 2.7 as well.
2022-07-10 21:18:36 +02:00
Jonas Jenwald
0205597bd0
Merge pull request #15154 from Snuffleupagus/xfa-rm-id
Replace element `id`s with custom attributes in the xfaLayer
2022-07-10 16:06:17 +02:00
Jonas Jenwald
4b7bf74da2 Replace element ids with custom attributes in the xfaLayer
We want to avoid adding regular `id`s to xfaLayer-elements, since that means that they become "linkable" through the URL hash in a way that's not supported/intended. This could end up clashing with "named destinations", and that could easily lead to bugs; see issue 11499 and PR 11503 for some context.

Rather than using `id`s, we'll instead use a *custom* `data-element-id` attribute such that it's still possible to access the DOM-elements directly if needed. *Please note:* This is basically the xfaLayer-equivalent of PR 15057.
2022-07-10 15:44:54 +02:00
Tim van der Meij
fb1340f74b
Merge pull request #15155 from Snuffleupagus/update-packages
Update packages and translations
2022-07-10 12:49:41 +02:00
Jonas Jenwald
e4a7264564 Update l10n files 2022-07-10 10:45:22 +02:00
Jonas Jenwald
dd10f6397f Update npm packages 2022-07-10 10:43:08 +02:00
Tim van der Meij
220f980e12
Merge pull request #15145 from Snuffleupagus/deprecated-enhanceTextSelection
[api-minor] Deprecate the `enhanceTextSelection` functionality
2022-07-09 12:38:41 +02:00
calixteman
2b6a67c5d0
Merge pull request #15153 from calixteman/1778692
[Annotation] A push button can have no action (bug 1778692)
2022-07-08 21:06:53 +02:00
Calixte Denizet
8f26ba5487 [Annotation] A push button can have no action (bug 1778692) 2022-07-08 15:39:56 +02:00
Jonas Jenwald
4b493c2c33
Merge pull request #15152 from Snuffleupagus/validate-Resources
Ensure that the /Resources-entry is actually a dictionary (issue 15150)
2022-07-08 13:24:47 +02:00
Jonas Jenwald
c2f7942aea Ensure that the /Resources-entry is actually a dictionary (issue 15150)
Prevent issues in *corrupt* PDF documents, if the /Resources-entry is not of the correct and expected type.
2022-07-08 12:43:43 +02:00
Jonas Jenwald
efbd429115
Merge pull request #15151 from calixteman/15149
[Editor] Remove useless and faulty code when destroying the global manager
2022-07-08 11:58:14 +02:00
Calixte Denizet
cec2172225 [Editor] Remove useless and faulty code when destroying the global manager 2022-07-08 11:49:19 +02:00
calixteman
b0a3c9e8cf
Merge pull request #15135 from calixteman/forced_colors
Use default colors only in forced-colors mode (bug 1778068)
2022-07-07 20:30:03 +02:00
calixteman
657edb3892
Merge pull request #15147 from calixteman/editor_size
[Editor] Avoid to resize and redraw the ink canvas when it's useless
2022-07-07 19:49:59 +02:00
Calixte Denizet
fe93742c8f Use default colors only in forced-colors mode (bug 1778068) 2022-07-07 19:36:03 +02:00
Jonas Jenwald
d6a75262d5
Merge pull request #15143 from bernatgy/typescript-compilation-fix
[jsdoc] failing typescript builds - wrong type
2022-07-07 19:27:53 +02:00
calixteman
32d8c55642
Merge pull request #15146 from calixteman/editing_cursor
[Editor] Change the cursor to a pen for the Ink editor
2022-07-07 18:43:41 +02:00
Calixte Denizet
9c4077ebc4 [Editor] Avoid to resize and redraw the ink canvas when it's useless
- and because of rounding errors it led to slightly resize again and again
the ink container;
- when zooming the size is changing but not the ratio, so in this case we
don't need to change the dimension of the container.
2022-07-07 18:39:20 +02:00
Calixte Denizet
edc9ad13bf [Editor] Change the cursor to a pen for the Ink editor 2022-07-07 18:23:59 +02:00
Bernát Gyovai
3d62f09fbd [jsdoc] failing typescript builds - wrong type
`HTMLSectionElement` is not part of the DOM, so the generated typescript definitions contain a non-existing type.

HTML Section elements have to be handled as simple `HTMLElements`.

fixing punctuation and lint problems

[jsdoc] failing typescript builds - wrong type
2022-07-07 17:03:46 +02:00
Jonas Jenwald
815c28da0e [api-minor] Deprecate the enhanceTextSelection functionality 2022-07-07 16:15:31 +02:00
calixteman
403ed07ad9
Merge pull request #15144 from calixteman/editing_delete
[Editor] Allow editors deletion on Backspace or Delete keys
2022-07-07 15:37:06 +02:00
Calixte Denizet
a4329d326c [Editor] Allow editors deletion on Backspace or Delete keys 2022-07-07 15:16:01 +02:00
Jonas Jenwald
7f160d49f9
Merge pull request #15142 from Snuffleupagus/fitCurve
[editor] Use the `fit-curve` package (issue 15004)
2022-07-07 14:03:14 +02:00
Jonas Jenwald
345bb18575 [editor] Use the fit-curve package (issue 15004)
Rather than including all of this external code in the PDF.js repository, we should be using the npm package instead.
Unfortunately this is slightly more complicated than you'd hope, since the `fit-curve` package (which is older) isn't directly compatible with modern JavaScript modules.
In particular, the following cases needed to be considered:
 - For the development viewer (i.e. `gulp server`) and the unit-tests, we thus need to build a fitCurve-bundle that can be directly `import`ed.
 - For the actual PDF.js build-targets, we can slightly reduce the sizes by depending on the "raw" `fit-curve` source-code.
 - For the Node.js unit-tests, the `fit-curve` package can be used as-is.
2022-07-07 10:43:43 +02:00
Jonas Jenwald
bde46632d4
Merge pull request #15130 from calixteman/context_menu
[Editor] Dispatch an event when some global states are changing (bug 1777695)
2022-07-05 22:40:12 +02:00
Calixte Denizet
ec0f9f6dcf [Editor] Dispatch an event when some global states are changing
- this way the context menu in Firefox can take into account what we
  have in the clipboard, if an editor is selected, ...
- when the user will click on a context menu item, an action will be
  triggered, hence this patch adds what is required to handle it;
- some tests will be added in the Firefox' patch.
2022-07-05 22:12:56 +02:00
Jonas Jenwald
45fafb2769
Merge pull request #15133 from Snuffleupagus/issue-14999
Improve text-selection for Type3 fonts with bogus /FontBBox-entries (issue 14999)
2022-07-05 22:00:28 +02:00
Jonas Jenwald
79cfc548fc Improve text-selection for Type3 fonts with bogus /FontBBox-entries (issue 14999)
This extends PR 13461, by also building a fallback bounding box for Type3 fonts that contain a much too small /FontBBox-entry.

*Please note:* While this patch improves things overall, copy-and-pasting still doesn't work perfectly for this document. In particular the lowercase letter "c" cannot be selected/copied, however this can be reproduced in both Adobe Reader and PDFium (in Google Chrome) too, which is caused by a lack of proper /ToUnicode-data in the PDF document.
2022-07-05 14:27:14 +02:00
Jonas Jenwald
a1ac1a61b7
Merge pull request #15124 from Snuffleupagus/private-setDimensions
Call `AnnotationLayer.setDimensions` as part of the `render`/`update`-methods (PR 15036 follow-up)
2022-07-04 14:05:47 +02:00
Jonas Jenwald
552ee9decd Call AnnotationLayer.setDimensions as part of the render/update-methods (PR 15036 follow-up)
Rather than forcing the user to *manually* call `setDimensions`, which is also breaking any existing third-party code, it seems that we can simply let the `AnnotationLayer.{render, update}`-methods handle that internally.

As far as I can tell, based on testing manually in the viewer *and* running the browser-tests, everything still appears to work correctly with this patch.
2022-07-04 12:27:20 +02:00
Jonas Jenwald
ca8b112e8c
Merge pull request #15125 from Snuffleupagus/FileAttachmentAnnotationElement-trigger
Fix the Popup-trigger for `FileAttachmentAnnotationElement` (PR 15036 follow-up)
2022-07-04 11:00:24 +02:00
Jonas Jenwald
fda0a87cb5
Merge pull request #15126 from calixteman/update_l10n_id
[Editor] Update the id for a l10n string
2022-07-04 10:59:26 +02:00
Calixte Denizet
ae2cf7e1e7 [Editor] Update the id for a l10n string 2022-07-04 10:18:42 +02:00
Jonas Jenwald
315f450b01 Fix the Popup-trigger for FileAttachmentAnnotationElement (PR 15036 follow-up)
After the changes in PR 15036, the trigger-element created in `FileAttachmentAnnotationElement.render` is now too small. This can be fixed by using the same approach as in PR 15065, and the patch can be tested using the `annotation-fileattachment.pdf` document in the test-suite.
2022-07-04 09:33:27 +02:00
Jonas Jenwald
03c6febc44
Merge pull request #15121 from Snuffleupagus/loadingBar-cleanup
[api-minor] Further modernize the `ProgressBar` class (PR 14918 follow-up)
2022-07-02 16:46:40 +02:00
Jonas Jenwald
845b7f06f9
Merge pull request #15123 from Snuffleupagus/editor-presentation-disable
[editor] Disable editing while PresentationMode is active
2022-07-02 16:39:38 +02:00
Jonas Jenwald
ff0ff75d22
Merge pull request #15122 from Snuffleupagus/editor-max-width
[editor] Tweak `@media` CSS rules to account for the new toolbar buttons
2022-07-02 16:38:21 +02:00
Jonas Jenwald
37b61f2228 [editor] Disable editing while PresentationMode is active 2022-07-01 16:52:17 +02:00
Jonas Jenwald
84ae9f9c58 [editor] Tweak @media CSS rules to account for the new toolbar buttons 2022-07-01 13:27:13 +02:00
Jonas Jenwald
d9ce17642f [api-minor] Further modernize the ProgressBar class (PR 14918 follow-up)
- Simplify how we look-up the DOM-element, which should also be a tiny bit more efficent.

 - Use private class-fields, rather than property-names prefixed with underscores.

 - Inline the `#updateBar` helper-method directly in the `percent`-setter, since having a separate method doesn't seem necessary in this case.

 - Set the `indeterminate`-class on the ProgressBar DOM-element, to simplify the code.

Finally, also (slightly) re-factors the `PDFViewerApplication.progress`-method to make it a bit smaller.
2022-07-01 10:31:25 +02:00