Commit Graph

17817 Commits

Author SHA1 Message Date
Calixte Denizet
8daf2f1eb1 [Annotation] Use the clip-path property when an annotation has some quad points
This way it'll avoid to split a div in multiple divs having the same id (which
is supposed to be unique).
2023-07-20 10:53:23 +02:00
calixteman
dca4bc0f24
Merge pull request #16713 from calixteman/draw_bg
Draw correctly background images in ref tests
2023-07-19 21:18:04 +02:00
Calixte Denizet
7cd062ec68 Draw correctly background images in ref tests
It's a workaround for bug https://bugzilla.mozilla.org/show_bug.cgi?id=1844414.
It should be reverted (in order to avoid a perf penalty) once the bug is fixed
in Firefox.
2023-07-19 20:29:54 +02:00
calixteman
9f390755b0
Merge pull request #16709 from calixteman/bug1844293
[Editor] Bind redo action on meta+shift+z on mac (bug 1844293)
2023-07-19 12:01:58 +02:00
Calixte Denizet
295eb13a44 [Editor] Bind redo action on meta+shift+z on mac (bug 1844293) 2023-07-19 11:17:50 +02:00
Jonas Jenwald
f19991a36f
Merge pull request #16707 from mozilla/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-07-19 08:41:03 +02:00
dependabot[bot]
186a6fd0cb
Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-18 20:14:51 +00:00
calixteman
e83febcbb6
Merge pull request #16706 from calixteman/bug1844036
[Editor] Don't forget to generate non-missing images when printing (bug 1844036)
2023-07-18 17:01:10 +02:00
Calixte Denizet
7ac3bf6f17 [Editor] Don't forget to generate non-missing images when printing (bug 1844036) 2023-07-18 15:39:18 +02:00
Jonas Jenwald
43fc78899f
Merge pull request #16698 from Snuffleupagus/src-display-rm-require
Remove most build-time `require`-calls from the `src/display/`-folder
2023-07-18 11:35:57 +02:00
Jonas Jenwald
d9350c3899 Temporarily stop running gulp typestest in GitHub Actions
This is necessary to unblock the previous patch, which removes more build-time `require`-calls from the `src/display/` folder.
2023-07-18 09:07:32 +02:00
Jonas Jenwald
d022912719 Remove most build-time require-calls from the src/display/-folder
By leveraging import maps we can get rid of *most* of the remaining `require`-calls in the `src/display/`-folder, since we should strive to use modern `import`-statements wherever possible.
The only remaining cases are Node.js-specific dependencies, since those seem very difficult to convert unless we start producing a bundle *specifically* for Node.js environments.
2023-07-17 19:47:13 +02:00
Jonas Jenwald
e81c084a92
Merge pull request #16703 from Snuffleupagus/babel-corejs
[api-minor] Let Babel handle the necessary `core-js` polyfills automatically
2023-07-17 19:45:06 +02:00
Jonas Jenwald
3a886e7264 Move the isNodeJS-helper into the src/shared/util.js file
With the changes in the previous patch the `isNodeJS`-helper no longer needs to live in its own file, which helps get rid of a closure in the *built* files.
2023-07-17 16:42:25 +02:00
Jonas Jenwald
67303b16f1 [api-minor] Let Babel handle the necessary core-js polyfills automatically
In the last couple of years we've been quicker to remove support for older browsers/environments, which means that at this point in time we don't bundle that many polyfills. (The polyfills are also generally simpler nowadays, ever since we removed support for e.g. Internet Explorer.)
Rather than having to *manually* handle the polyfills, we can actually let Babel take care of bundling the necessary polyfills for us; please refer to https://babeljs.io/docs/babel-preset-env

The only exception here is the Node.js-specific compatibility-code, which is moved into the `src/display/node_utils.js` file. This ought to be fine since workers are not available/used in Node.js-environments.

*Please note:* For the `legacy`-builds this will increase the size of the *built* files, however that seems like a very small price to pay in order to simplify maintenance of the general PDF.js library.
2023-07-17 16:42:08 +02:00
calixteman
9db65ad083
Merge pull request #16702 from calixteman/editor_2_decimals
[Editor] Use 2 decimals for editor positions and dimensions
2023-07-17 15:43:26 +02:00
Calixte Denizet
983b269e26 [Editor] Use 2 decimals for editor positions and dimensions
I noticed that after adding an image in issue16278.pdf, the image was constantly
resizing itself.
It appears that it's because of rounding errors.
2023-07-17 15:08:09 +02:00
calixteman
67e19171c4
Merge pull request #16689 from calixteman/bug1843303
[Editor] Avoid to have some part of an editor outside its page (bug 1843303)
2023-07-17 14:59:21 +02:00
Calixte Denizet
a8867cf68a [Editor] Avoid to have some part of an editor outside its page (bug 1843303) 2023-07-17 14:27:15 +02:00
Jonas Jenwald
717c766a42
Merge pull request #16701 from Snuffleupagus/gv-fix-toolbar-l10n
[GeckoView] Fix l10n of the download toolbar-button (PR 16340 follow-up)
2023-07-17 13:16:49 +02:00
Jonas Jenwald
8614621d8d [GeckoView] Fix l10n of the download toolbar-button (PR 16340 follow-up)
Localization of this button broke in PR 16340, which I assume was completely accidental, since the download-button now tries to access a l10n-id that was removed some time ago (see PR 15617).
Note how loading even the development viewer, i.e. http://localhost:8888/web/viewer-geckoview.html#locale=en-US, currently logs l10n-warnings on the `master` branch.
2023-07-17 11:47:11 +02:00
Tim van der Meij
d03a8d0efc
Merge pull request #16687 from Snuffleupagus/rm-more-require
Re-factor the `PDFScriptingManager`-class for the viewer-components
2023-07-16 15:16:07 +02:00
Tim van der Meij
8765306203
Merge pull request #16697 from Snuffleupagus/eslint-more-unicorn
Enable more ESLint `unicorn` plugin rules
2023-07-16 15:10:35 +02:00
Jonas Jenwald
9660ca53af Enable more ESLint unicorn plugin rules
- `prefer-array-some`, which didn't require any code changes; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md

 - `prefer-modern-math-apis`, which should be fine given the currently supported browsers; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md
2023-07-16 09:24:14 +02:00
Jonas Jenwald
bad4bfffdf Remove the require from the web/pdfjs.js
Having a `require` in this file has never made sense in e.g. the Firefox PDF Viewer and shouldn't really be necessary.
Possibly the idea was to facilitate some kind of third-party bundling, however the *built* `pdf.js` file has always exposed the API-contents globally.
2023-07-16 08:51:46 +02:00
Jonas Jenwald
86a868189c Re-factor the PDFScriptingManager-class for the viewer-components
Currently this class contains a few "special" code-paths for the COMPONENTS build-target, which normally wouldn't be a problem. However, in this particular case that means accessing code that we don't want to include unconditionally in all builds.
This is currently implemented using build-time `require`-calls which we nowadays want to avoid, and we should strive to remove all such cases from the code-base. (Generally speaking `import` is the future, and build-tools may not always play well with a mix of both formats.)

We can easily improve things here by using sub-classing for the COMPONENTS build-target, and then use the ability to re-name when exporting (to avoid breaking existing code).
2023-07-16 08:51:46 +02:00
Jonas Jenwald
337cba736e [ESM] Remove the remaining require from the gulpfile 2023-07-16 08:51:46 +02:00
Jonas Jenwald
bd67f7841f
Merge pull request #16695 from Snuffleupagus/tests-NaN
Ensure that a test-suite that runs no tests is treated as a failure
2023-07-16 08:32:43 +02:00
Jonas Jenwald
22c0bf4ec2
Merge pull request #16693 from Snuffleupagus/update-packages
Update packages and translations
2023-07-16 08:21:13 +02:00
Jonas Jenwald
b019c13b33 Ensure that a test-suite that runs no tests is treated as a failure
Occasionally some test-suites may fail to start on the bots, however that's not correctly reflected in the botio-output posted to GitHub which makes it easy to accidentally overlook this situation.
Looking at the raw logs when that happens they always seem to contain a line such as `Run NaN tests` which means that we should be able to easily make this situation a *failure* as intended.
2023-07-15 12:03:47 +02:00
Jonas Jenwald
b05c2e0343 Update l10n files 2023-07-15 10:44:39 +02:00
Jonas Jenwald
f84657d837 Address formatting changes from Prettier version 3 2023-07-15 10:44:39 +02:00
Jonas Jenwald
1a4bfd2fc3 Update npm packages
Note that while some packages increased the *major* version, it doesn't appear to cause any breakage as far as I can tell.
2023-07-15 10:44:30 +02:00
calixteman
ee373b313b
Merge pull request #16690 from calixteman/stamp_resize
[Editor] Resize the image when the page is zoomed
2023-07-14 12:16:44 +02:00
Calixte Denizet
5a692b2c33 [Editor] Resize the image when the page is zoomed
In order to reproduce the issue:
 - scale down the image
 - zoom the page and the image is pixellated
So this patch allow to redraw the image when zooming.
2023-07-13 20:36:23 +02:00
calixteman
36fc34ebe8
Merge pull request #16686 from calixteman/bug1843255
[Editor] Always use the data url when loading a SVG in order to avoid CSP issue (bug 1843255)
2023-07-13 15:12:49 +02:00
Calixte Denizet
ed42577d9c [Editor] Always use the data url when loading a SVG in order to avoid CSP issue (bug 1843255) 2023-07-13 14:10:28 +02:00
Jonas Jenwald
762d86a59e
Merge pull request #16683 from Snuffleupagus/app-isOffscreenCanvasSupported
Access the `isOffscreenCanvasSupported` option *once* in `PDFViewerApplication._initializeViewerComponents`
2023-07-12 21:44:34 +02:00
Jonas Jenwald
b449da31ca
Merge pull request #16678 from Snuffleupagus/writeStream-tweaks
Tweak the `writeStream` implementation slightly
2023-07-12 21:43:01 +02:00
Jonas Jenwald
040d5bb294
Merge pull request #16675 from Snuffleupagus/pr-16659-followup
Re-enable editing, if necessary, when exiting PresentationMode (PR 16659 follow-up)
2023-07-12 21:41:43 +02:00
calixteman
46cec96900
Merge pull request #16642 from calixteman/issue16633
[Editor] Try to make the position of an edited FreeText the more accurated as possible
2023-07-12 21:08:16 +02:00
Calixte Denizet
944c68ee85 [Editor] Try to make the position of an edited FreeText the more accurated as possible
- Take into account the page translation,
- Take into account the correct translation for the editor border,
- Take into account the position of the first glyph in the annotation,
- Take into account the rotation of the editor.

Close #16633.
2023-07-12 19:53:57 +02:00
Jonas Jenwald
7e04ca395f Access the isOffscreenCanvasSupported option *once* in PDFViewerApplication._initializeViewerComponents
There's no good reason for getting this option multiple times in the same method. Also, we can slightly re-factor how the `editorStampButton` is made visible.
2023-07-12 17:33:20 +02:00
Jonas Jenwald
5cfe792349 Tweak the writeStream implementation slightly
- Do the /Filter and /DecodeParms lookup in parallel, since that ought to be a *tiny* bit more efficient.
 - Avoid code-duplication when `CompressionStream` isn't supported, since we already have a fallback code-path at the end of the function.
2023-07-12 13:24:02 +02:00
Jonas Jenwald
7daa6b5fd8 Re-enable editing, if necessary, when exiting PresentationMode (PR 16659 follow-up)
This regressed in PR 16659, when the signature of the `PDFViewer.annotationEditorMode`-setter was changed, and it currently leads to an Error being thrown when exiting PresentationMode.
2023-07-11 22:34:20 +02:00
Jonas Jenwald
73d650af3e
Merge pull request #16669 from Snuffleupagus/esm-builder
[ESM] Convert the `external/builder/`-folder to use standard modules
2023-07-11 12:29:33 +02:00
Jonas Jenwald
5174232326 [ESM] Convert the external/builder/-folder to use standard modules 2023-07-11 11:38:59 +02:00
Jonas Jenwald
bcf14a49c0
Merge pull request #16668 from Snuffleupagus/esm-gulpfile
[ESM] Convert the `gulpfile` to use standard modules
2023-07-11 11:38:24 +02:00
calixteman
09d1be72f4
Merge pull request #16672 from calixteman/cheat_editorStamp_svg
[Editor] Cheat the stamp editor icon to make a linter in m-c happy
2023-07-11 09:59:32 +02:00
Calixte Denizet
414ea4a365 [Editor] Cheat the stamp editor icon to make a linter in m-c happy
At some point we won't use this icon anymore in the build-in pdf viewer
but we'll the one already in the m-c tree.
2023-07-10 21:18:05 +02:00