Commit Graph

15801 Commits

Author SHA1 Message Date
Tim van der Meij
1a6ae5f034
Merge pull request #15031 from Snuffleupagus/prefer-modern-dom-apis
Enable the `unicorn/prefer-modern-dom-apis` ESLint plugin rule
2022-06-12 20:36:40 +02:00
Tim van der Meij
0e1e265c61
Merge pull request #15030 from Snuffleupagus/update-packages
Update packages and translations
2022-06-12 20:16:11 +02:00
Tim van der Meij
720f77c7cd
Merge pull request #15028 from Snuffleupagus/update-compat
[api-minor] Update the minimum supported browsers/environments
2022-06-12 20:12:33 +02:00
Tim van der Meij
26ae50e449
Merge pull request #15023 from Snuffleupagus/prefer-array-flat
Enable the `unicorn/prefer-array-flat` and `unicorn/prefer-array-flat-map` ESLint plugin rules
2022-06-12 20:10:52 +02:00
Jonas Jenwald
4d39898823 Enable the unicorn/prefer-modern-dom-apis ESLint plugin rule
This rule will help enforce slightly shorter code, and according to MDN both `Element.replaceWith()` and `Element.before()` are available in all browsers that we currently support.

Please find additional information here:
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-dom-apis.md
 - https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith
 - https://developer.mozilla.org/en-US/docs/Web/API/Element/before
2022-06-12 20:05:05 +02:00
Jonas Jenwald
0c65926d5b
Merge pull request #15029 from Snuffleupagus/prefer-dom-node-append
Enable the `unicorn/prefer-dom-node-append` ESLint plugin rule
2022-06-12 19:58:37 +02:00
Jonas Jenwald
17d2380824 Update l10n files 2022-06-12 14:05:41 +02:00
Jonas Jenwald
f052a12968 Update npm packages 2022-06-12 14:02:31 +02:00
Jonas Jenwald
8129815538 Enable the unicorn/prefer-dom-node-append ESLint plugin rule
This rule will help enforce slightly shorter code, especially since you can insert multiple elements at once, and according to MDN `Element.append()` is available in all browsers that we currently support.

Please find additional information here:
 - https://developer.mozilla.org/en-US/docs/Web/API/Element/append
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md
2022-06-12 13:07:03 +02:00
Jonas Jenwald
2f0ed3a9ca [api-minor] Update the minimum supported browsers/environments
*Please note:* The dates below are still a little ways off, however that obviously won't affect the existing PDF.js releases. Hence I think that we can make these changes now, since by the time of the *next* official PDF.js release they'll likely match up pretty well.[1]

While we "support" some (by now) fairly old browsers, that essentially means that the library (and viewer) will load and that the basic functionality will work as intended.[2]
However, in older browsers, some functionality may not be available and generally we'll ask users to update to a modern browser when bugs (specific to old browsers) are reported.[3]

Since we've previously settled on only supporting browsers/environments that are approximately *three years old*, this patch updates the minimum supported browsers/environments as follows:
 - Chrome 76, which was released on 2019-07-30; see https://en.wikipedia.org/wiki/Google_Chrome_version_history
 - Firefox ESR (as before); see https://wiki.mozilla.org/Release_Management/Calendar
 - Safari 13, which was released on 2019-09-19; see https://en.wikipedia.org/wiki/Safari_version_history#Safari_13
 - Node.js 14, which was release on 2020-04-21 (all older versions have reached EOL); see https://en.wikipedia.org/wiki/Node.js#Releases

---
[1] Given that the releases usually happen every two to three months.

[2] Assuming that a `legacy/`-build is being used, of course.

[3] In general it's never a good idea to use old/outdated browsers, since those may contain *known* security vulnerabilities.
2022-06-11 16:50:01 +02:00
Jonas Jenwald
d7122becaf
Merge pull request #15027 from Snuffleupagus/parseFloat-fixes
Remove superfluous trailing arguments from `parseFloat`-calls (PR 14978 follow-up)
2022-06-11 15:25:24 +02:00
Jonas Jenwald
4b2526ebf2 Remove superfluous trailing arguments from parseFloat-calls (PR 14978 follow-up)
Fixes two recent "Code scanning alerts" on GitHub, which likely happened because these calls originally used `parseInt` instead (during initial development).
2022-06-11 15:11:34 +02:00
Jonas Jenwald
7f4b1c2149
Merge pull request #15026 from Snuffleupagus/rm-unused-annotation-ops
[api-minor] Stop using the `beginAnnotations`/`endAnnotations` operators (PR 14998 follow-up)
2022-06-11 15:04:51 +02:00
Jonas Jenwald
bbf857d635 [api-minor] Stop using the beginAnnotations/endAnnotations operators (PR 14998 follow-up)
After the changes in PR 14998, these operators are now no-ops in the `src/display/canvas.js` code and should no longer be necessary.
Given that `beginAnnotations`/`endAnnotations` are not in the PDF specification, but are rather *custom* PDF.js operators, it seems reasonable to stop using them now that they've become no-ops.
2022-06-11 14:21:26 +02:00
Marco Castelluccio
b5fb6cdb96
Merge pull request #15022 from Snuffleupagus/editorNone-icon-tweak
Tweak the `editorNone` icon to circumvent the "duplicated files"-check
2022-06-11 11:34:21 +02:00
Jonas Jenwald
010d996b74 Enable the unicorn/prefer-array-flat and unicorn/prefer-array-flat-map ESLint plugin rules
These rules will help enforce shorter and more readable code, and according to MDN these Array-methods are available in all browsers/environments that we currently support:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap#browser_compatibility

Please find additional information about these ESLint rules here:
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
2022-06-11 11:33:43 +02:00
Jonas Jenwald
1465471b10 Tweak the editorNone icon to circumvent the "duplicated files"-check
The update in https://bugzilla.mozilla.org/show_bug.cgi?id=1773794 failed, because the `editorNone` icon is identical to a pre-existing one. Given that all of the editor-icons are simply placeholders for now, we can just make a tiny change to the SVG-paths to prevent these kind of problems.
2022-06-11 11:17:08 +02:00
Tim van der Meij
a57a4bc6c2
Merge pull request #15018 from Snuffleupagus/issue-15016
Expose `TextLayerRenderTask` in the TypeScript definitions (issue 15016, PR 14013 follow-up)
2022-06-10 22:18:35 +02:00
Tim van der Meij
f0b5aee6b8
Merge pull request #15014 from Snuffleupagus/prefer-at
Enable the `unicorn/prefer-at` ESLint plugin rule (PR 15008 follow-up)
2022-06-10 22:12:35 +02:00
Jonas Jenwald
e046b811b7 Expose TextLayerRenderTask in the TypeScript definitions (issue 15016, PR 14013 follow-up)
While `TextLayerRenderTask` apparently makes sense in TypeScript environments, given that it's being returned by the `renderTextLayer`-function in the API, we really don't want to extend the *public* API by simply exporting the class directly in `src/pdf.js` since it should never be called/initialized manually.
Hence we follow the same pattern as in PR 14013, and add some very basic unit-tests to ensure that `renderTextLayer` always returns a `TextLayerRenderTask`-instance as expected.
2022-06-10 22:12:32 +02:00
calixteman
6e6d94ab8d
Merge pull request #15020 from calixteman/1773680
Add an empty entry in combo list when nothing is selected (bug 1773680)
2022-06-10 19:18:31 +02:00
Calixte Denizet
bfe816d0d2 Add an empty entry in combo list when nothing is selected (bug 1773680)
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1773680
- the empty is removed once something is selected.
2022-06-10 18:45:02 +02:00
Jonas Jenwald
d45ce8d6a3
Merge pull request #15015 from jerry1100/fix-container-type
Extend TextLayerRenderParameters.container type to include HTMLElement.
2022-06-10 17:05:47 +02:00
jerry1100
b716e82d18 Extend TextLayerRenderParameters.container type to include HTMLElement.
In PR #14717, the type was changed from a HTMLElement to a DocumentFragment.
This broke TypeScript projects that use a HTMLElement container.

To remedy this, we extend the type of container to also include HTMLElement.
2022-06-10 06:50:47 -07:00
calixteman
808a55e42b
Merge pull request #15019 from mozilla/revert-15003-mc
Revert "Change the name of the generated pdf.sandbox.external for mozilla-central"
2022-06-10 11:35:14 +02:00
calixteman
c8f6cb9fcf
Revert "Change the name of the generated pdf.sandbox.external for mozilla-central" 2022-06-10 11:34:28 +02:00
Jonas Jenwald
9ac4536693 Enable the unicorn/prefer-at ESLint plugin rule (PR 15008 follow-up)
Please find additional information here:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
2022-06-09 21:21:19 +02:00
calixteman
5d88233fbb
Merge pull request #15006 from calixteman/ink2
[editor] Add support for saving newly added Ink
2022-06-09 21:13:53 +02:00
calixteman
61a65344a3
Merge pull request #14989 from calixteman/ink1
[editor] Add an Ink editor
2022-06-09 21:13:06 +02:00
Calixte Denizet
c161a86ba1 [editor] Add an Ink editor
- Approximate the drawn curve by a set of Bezier curves in using
  js code from https://github.com/soswow/fit-curves.
  The code has been slightly modified in order to make the linter
  happy.
2022-06-09 19:35:59 +02:00
Jonas Jenwald
1eaef6645d
Merge pull request #15013 from Snuffleupagus/issue-15012
Render PopupAnnotations even if they have missing or empty /Rect-entries (issue 15012, PR 14439 follow-up)
2022-06-09 16:51:31 +02:00
Jonas Jenwald
6371a7605d Force-install npm packages to try and fix the repeated GitHub Action failures 2022-06-09 15:10:58 +02:00
Jonas Jenwald
3d244cb6a8 Render PopupAnnotations even if they have missing or empty /Rect-entries (issue 15012, PR 14439 follow-up)
This only applies to *corrupt* PDF documents, where Annotations are missing the required /Rect-entry. Rendering PopupAnnotations unconditionally shouldn't be a problem, since we're not using a `BaseSVGFactory`-instance in that case.
2022-06-09 15:10:54 +02:00
calixteman
a1bc5a8fe2
Merge pull request #15011 from Snuffleupagus/misc-review-comments
Fix a couple of old review comments
2022-06-09 13:52:51 +02:00
Jonas Jenwald
66bbc0e7ee Call WidgetAnnotation._getTextWidth correctly from the ChoiceWidgetAnnotation-class (PR 14720 follow-up)
In the "no fontSize available" code-path, in the `ChoiceWidgetAnnotation._getAppearance` method, we don't provide the necessary second argument when calling the `_getTextWidth`-method which will cause errors to be thrown.
2022-06-09 10:11:01 +02:00
Jonas Jenwald
b5cad9be03 Fix a bug in the ColorConverters.CMYK_HTML method (PR 12631 follow-up)
Because of a small oversight, this method accidentally handled the intermediate array incorrectly.
2022-06-09 10:03:36 +02:00
Jonas Jenwald
7a89f4a789 Set the MIME type correctly when downloading fonts in debugger.js (PR 5366 follow-up)
Because of a capitalization error, the MIME type wasn't actually being set correctly. However, please note that downloading of font files still worked correctly which is probably why this has gone unnoticed since 2014.
2022-06-09 09:52:28 +02:00
Jonas Jenwald
14e6d8a802
Merge pull request #15008 from Snuffleupagus/Array-at
Polyfill `Array.prototype.at` with core-js (PR 14976 follow-up)
2022-06-08 22:26:08 +02:00
Calixte Denizet
36aae436bf [editor] Add support for saving newly added Ink 2022-06-08 22:16:01 +02:00
Jonas Jenwald
9e24a1660e Polyfill Array.prototype.at with core-js (PR 14976 follow-up)
This Array-method is a fairly new addition to the ECMAScript specification, hence we need a polyfill to avoid the library/viewer breaking in older browsers.

Please find additional information at:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at#browser_compatibility
2022-06-08 22:10:59 +02:00
calixteman
2fbf14ace8
Merge pull request #14978 from calixteman/editor2
[editor] Add support for saving a newly added FreeText
2022-06-08 15:51:03 +02:00
Calixte Denizet
7773b3f5be [edition] Add support for saving a newly added FreeText 2022-06-08 14:34:09 +02:00
Jonas Jenwald
c8b8db6a17
Merge pull request #15003 from calixteman/mc
Change the name of the generated pdf.sandbox.external for mozilla-central
2022-06-08 10:44:10 +02:00
Calixte Denizet
7b37af7eb4 Change the name of the generated pdf.sandbox.external for mozilla-central
This patch is blocking https://phabricator.services.mozilla.com/D148600.
2022-06-08 10:36:38 +02:00
Jonas Jenwald
7761d2bf95
Merge pull request #15001 from marco-c/canvas_presentational
Set "presentation" role for page canvases (issue 14437)
2022-06-07 20:03:38 +02:00
Jonas Jenwald
ae9ad1d858
Merge pull request #15000 from calixteman/1724918
Outline fields which are required (bug 1724918)
2022-06-07 19:35:13 +02:00
Marco Castelluccio
8c9678158e Set "presentation" role for page canvases (issue 14437) 2022-06-07 18:56:30 +02:00
Calixte Denizet
2dd0c861bf Outline fields which are required (bug 1724918)
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1724918;

- it applies for both Acroform and XFA.
2022-06-07 17:02:11 +02:00
Jonas Jenwald
c25429be44
Merge pull request #14998 from calixteman/14105
Reset all the canvas states after rendering each annotations (#14105)
2022-06-07 16:07:45 +02:00
Calixte Denizet
96d0d22d66 Reset all the canvas states after rendering each annotations (#14105)
- each annotation must be rendered independently of the others. So
  after having rendered each annotation, the canvas states are reset
  in order to have something clean to render the next one.
2022-06-07 14:59:02 +02:00