Commit Graph

15976 Commits

Author SHA1 Message Date
Jonas Jenwald
f4e60ae986 Limit even more SVG-specific code to the GENERIC viewer
Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a bit more unnecessary code in e.g. the Firefox PDF Viewer.
2022-07-21 10:03:02 +02:00
Jonas Jenwald
bf7eef7109 Remove the svgviewer example
Given that the SVG back-end is now deprecated, we probably don't need to keep this example around any more.
2022-07-21 09:59:10 +02:00
Jonas Jenwald
5e7eab4dd8
Merge pull request #15196 from calixteman/zindex
[Editor] Add a z-index in order to draw them in the right order
2022-07-21 09:38:12 +02:00
Jonas Jenwald
c78fbe5282
Merge pull request #15199 from mozilla/dependabot/npm_and_yarn/terser-5.14.2
Bump terser from 5.14.1 to 5.14.2
2022-07-21 09:17:41 +02:00
dependabot[bot]
a5b50d06bd
Bump terser from 5.14.1 to 5.14.2
Bumps [terser](https://github.com/terser/terser) from 5.14.1 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-21 06:01:41 +00:00
Calixte Denizet
a7a5e98b7e [Editor] Add a z-index in order to draw them in the right order
The elements in the annotationEditor layer are rearranged to make them
more accessible, but we must draw them in the order they have been created,
hence this patch adds a z-index to the editors.
2022-07-20 15:47:43 +02:00
calixteman
408c10b5bb
Merge pull request #15195 from calixteman/empty_editor
[Editor] No need to click twice to create an editor when the last one is empty
2022-07-20 14:29:16 +02:00
Calixte Denizet
6d0676fd86 [Editor] No need to click twice to create an editor when the last one is empty 2022-07-20 14:15:00 +02:00
Jonas Jenwald
a9fc8792c8
Merge pull request #15192 from Snuffleupagus/issue-15139
Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
2022-07-20 12:45:04 +02:00
calixteman
f18a27bee9
Merge pull request #15186 from calixteman/freetext_commit
[Editor] Move the keyboard manager at the container level
2022-07-20 12:38:31 +02:00
Calixte Denizet
e1f28d3504 [Editor] Move the keyboard manager at the container level
- This way, the keyboard callbacks are called even if the page has not
the focus, hence the user doesn't have to guess that they have to click
on the page which is a bit painful especially in Ink mode.
- Add two keyboard shortcuts to commit a Freetext editor (ctrl+enter and
escape).
2022-07-20 12:24:30 +02:00
Jonas Jenwald
60bd9580e2 Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
In the referenced PDF document the fonts have /CIDToGIDMap-entries that cannot be loaded. Hence, only when `ignoreErrors` is set, we'll now ignore these corrupt /CIDToGIDMap-entries and fallback to simply assume that no such data is available.

Given that this is *clearly* a case of a corrupt PDF document, there's no guarantee that this will "fix" things in the general case since a /CIDToGIDMap may be *required* in order for some composite fonts to render correctly. However, attempting to render *something* is surely better than skipping a font altogether.
2022-07-20 11:58:44 +02:00
calixteman
7a4b72ed11
Merge pull request #15185 from calixteman/ink_translation
[Editor] Ink editor was too much translated after commit
2022-07-20 10:34:37 +02:00
calixteman
33d7a35515
Merge pull request #15187 from calixteman/rm_useless_ed
[Editor] Remove useless and potentially deleted editors
2022-07-20 10:04:22 +02:00
Calixte Denizet
964fb77fa5 [Editor] Remove useless and potentially deleted editors
After a deletion, a reference on a deleted editor can still be used
(for example in changing the font size just after having deleted all
editors).
2022-07-19 23:04:33 +02:00
Jonas Jenwald
f46895d750
Merge pull request #15110 from calixteman/editing_a11y
[Editor] Improve a11y for newly added element (#15109)
2022-07-19 20:02:53 +02:00
Jonas Jenwald
98f70d87f6
Merge pull request #15174 from Snuffleupagus/more-for-of
Use more `for...of` loops in the code-base
2022-07-19 19:04:47 +02:00
Calixte Denizet
624b26e1de [Editor] Improve a11y for newly added element (#15109)
- In the annotationEditorLayer, reorder the editors in the DOM according
  the position of the elements on the screen;
- add an aria-owns attribute on the "nearest" element in the text layer
  which points to the added editor.
2022-07-19 18:52:17 +02:00
calixteman
ad15532235
Merge pull request #15179 from calixteman/editor_cp
[Editor] Use serialized data when copying/pasting
2022-07-19 18:31:37 +02:00
calixteman
642676a3b7
Merge pull request #15184 from calixteman/rm_allowclick
[Editor] Simplify the way to create an editor on click
2022-07-19 17:56:07 +02:00
Calixte Denizet
3c17dbb43e [Editor] Use serialized data when copying/pasting
- in using the global clipboard, it'll be possible to copy from a
  pdf and paste in an other one;
- it'll allow to edit a previously created annotation;
- copy the editors in the current page.
2022-07-19 17:54:06 +02:00
Calixte Denizet
7024a53e79 [Editor] Simplify the way to create an editor on click
Previously, we had to set the #allowClick property by hand which was
a bit painful because it's easy to overlook one case or an other.
So with this patch a new editor (for now FreeText one only because the
Ink one is a bit different) is created on the first click if none is selected
on mousedown, else the first click will just commit the data and then the
second will creater a new editor.
2022-07-19 17:41:35 +02:00
Calixte Denizet
35671127d9 [Editor] Ink editor was too much translated after commit
The problem is clearly visible when the thickness is at max.
It's mainly because the thickness was not taken into account when
translating the div but it was when the line is drawn on the canvas.
2022-07-19 17:33:34 +02:00
Jonas Jenwald
37ebc28756 Use more for...of loops in the code-base
Note that these cases, which are all in older code, were found using the [`unicorn/no-for-loop`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md) ESLint plugin rule.
However, note that I've opted not to enable this rule by default since there's still *some* cases where I do think that it makes sense to allow "regular" for-loops.
2022-07-17 16:18:54 +02:00
Tim van der Meij
5bfba89b0a
Merge pull request #15173 from Snuffleupagus/deprecated-svg
[api-minor] Deprecate the SVG back-end
2022-07-17 12:47:58 +02:00
Jonas Jenwald
290aeaf755 Limit more SVG-specific code to the GENERIC viewer
Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a little bit more unnecessary code in e.g. the Firefox PDF Viewer.
2022-07-16 11:24:09 +02:00
Jonas Jenwald
90bf659b29 [api-minor] Deprecate the SVG back-end 2022-07-16 10:24:24 +02:00
Jonas Jenwald
de7d1d2167
Merge pull request #15170 from calixteman/js_rm_null
[JS] Embedded JS scripts can have some null chars
2022-07-15 17:11:29 +02:00
Jonas Jenwald
75b8647a32
Merge pull request #15169 from Snuffleupagus/loadFont-fontRef
Handle errors in the "Loading by ref" code-path in `PartialEvaluator.loadFont`
2022-07-15 16:40:56 +02:00
Jonas Jenwald
acd61a138e Handle errors in the "Loading by ref" code-path in PartialEvaluator.loadFont
Note how we currently throw a "raw" Error, which is problematical since all of the `PartialEvaluator.loadFont` call-sites expect a Promise to be returned. Furthermore, this also means that we don't benefit from the fallback code-path that now exists below.

*Please note:* Unfortunately I don't have a test-case that fails without this patch, since it's something I happened to notice when reading the code while working on another patch.
2022-07-15 16:33:36 +02:00
Calixte Denizet
5f0c95e70e [JS] Embedded JS scripts can have some null chars 2022-07-15 16:05:25 +02:00
calixteman
3256761ead
Merge pull request #15168 from calixteman/disable_canvas_acc
Disable canvas acceleration for linux tests
2022-07-15 14:43:30 +02:00
Calixte Denizet
ad62ae561c Disable canvas acceleration for linux tests 2022-07-15 13:31:37 +02:00
calixteman
41b2f52f70
Merge pull request #15157 from calixteman/1778484
Add unicode mapping in the font cmap to have correct chars when printing in pdf (bug 1778484)
2022-07-13 14:45:12 +02:00
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