Commit Graph

17140 Commits

Author SHA1 Message Date
Tim van der Meij
28f96d2ac2
Merge pull request #16336 from timvandermeij/custom-event
Don't use the deprecated `CustomEvent.initCustomEvent` method anymore
2023-04-23 16:06:10 +02:00
Tim van der Meij
870b942568
Don't use the deprecated CustomEvent.initCustomEvent method anymore
In PR #16295 one occurrence of this was changed, but a few more remained
in the codebase. This commit fixes the other occurrences so that we
don't use the deprecated way of creating custom events anywhere anymore.

According to MDN, see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent,
using the `CustomEvent.initCustomEvent` method is deprecated and the
`CustomEvent` constructor should be used instead.

Extends d9bf571f5c.
2023-04-23 15:41:02 +02:00
Tim van der Meij
2f86f5bb75
Merge pull request #16338 from timvandermeij/updates
Update translations and packages
2023-04-23 15:39:06 +02:00
Tim van der Meij
edb09855dc
Fix package vulnerabilities reported by npm audit
This commit is generated automatically using `npm audit fix`.
2023-04-23 14:37:51 +02:00
Tim van der Meij
f6f33065ef
Update mkdirp to version 3.0.0
The only change in this major version is the removal of the default
export, so we must simply use the named export instead.
2023-04-23 14:37:40 +02:00
Tim van der Meij
1b228091fa
Update packages to the most recent versions 2023-04-23 14:12:17 +02:00
Tim van der Meij
9c023c847c
Update translations to the most recent versions 2023-04-23 14:12:05 +02:00
Tim van der Meij
d6d3fdc489
Merge pull request #16335 from timvandermeij/npm-install-force
Don't force-install packages in the CI job anymore
2023-04-23 12:53:18 +02:00
Tim van der Meij
43d390759b
Don't force-install packages in the CI job anymore
In PR #16327 the `eslint-plugin-mozilla` package was updated so we no
longer have to force-install packages, and the force-install flags for
`npm install` were removed. However, the CI job was missing from this
commit, which we fix here. In general force-installing packages
shouldn't be necessary unless there are problems with dependencies,
which we would like to know about, so especially in the CI job it seems
like a good idea to not force-install packages to catch upcoming defects
early on.

Extends 19526d2322.
2023-04-23 12:45:29 +02:00
Tim van der Meij
bf01edb452
Merge pull request #16334 from Snuffleupagus/rm-PDF20-closure
Remove the `PDF20` closure, in the `src/core/crypto.js` file
2023-04-23 11:39:49 +02:00
Jonas Jenwald
74585c7c59 Remove the unused PDF20.hash method
This method was added in PR 4938, almost nine years ago, however it doesn't appear to ever have been used.
Given the similarities between the `PDF17` and `PDF20` classes, and how they're used, if the `PDF20.hash` method was actually necessary you'd also expect a similiar method in the `PDF17` class.
2023-04-23 10:13:46 +02:00
Jonas Jenwald
5e0722e4c2 Remove the PDF20 closure, in the src/core/crypto.js file
To allow doing this the existing helper function was changed into a "private" method instead.
2023-04-23 10:08:17 +02:00
Jonas Jenwald
6e1b234c6b
Merge pull request #16332 from Snuffleupagus/rm-primitives-closures
Remove the remaining unnecessary closures in the `src/core/primitives.js` file
2023-04-22 15:55:10 +02:00
Jonas Jenwald
9cb3236ac0 Remove the remaining unnecessary closures in the src/core/primitives.js file 2023-04-22 15:33:04 +02:00
Tim van der Meij
e304423ba1
Merge pull request #16331 from Snuffleupagus/cmap-rm-closure
Remove unnecessary closures in the CMap code
2023-04-22 14:58:13 +02:00
Tim van der Meij
2588924b0f
Merge pull request #16326 from Snuffleupagus/limit-Chrome-CSS
Don't include Chrome-specific CSS rules in MOZCENTRAL builds
2023-04-22 14:54:50 +02:00
Tim van der Meij
c9359957e6
Merge pull request #16305 from Snuffleupagus/PDFJSDev-skip-PRODUCTION
Remove the `PRODUCTION` build-target
2023-04-22 14:53:30 +02:00
Jonas Jenwald
bc7aa8a585 Re-factor some String.fromCharCode usage in the src/core/binary_cmap.js file
We can replace one case of `apply` with rest parameters, and avoid doing repeated `String.fromCharCode` calls within a loop.
2023-04-21 12:21:31 +02:00
Jonas Jenwald
cabc98f310 Remove the remaining closure in the src/core/cmap.js file
With modern JavaScript we (usually) no longer need to keep old closures, which slightly reduces the size of the code.
2023-04-21 12:21:31 +02:00
Jonas Jenwald
244002502b Move the BinaryCMapReader into its own file
The "binary" CMap-format is specific to the PDF.js library, and is used to reduce the size of the built-in CMap data-files.
By moving this code to its own file we can remove the nowadays unnecessary closures, which helps to slightly reduce the size of this code.
2023-04-21 12:21:20 +02:00
Jonas Jenwald
434445973d
Merge pull request #16327 from Snuffleupagus/update-eslint-plugin-mozilla
Update `eslint-plugin-mozilla` to avoid having to force-install packages (issue 15429)
2023-04-20 16:20:31 +02:00
Jonas Jenwald
19526d2322 Update eslint-plugin-mozilla to avoid having to force-install packages (issue 15429)
The latest version of `eslint-plugin-mozilla` removed the Prettier dependency, see https://bugzilla.mozilla.org/show_bug.cgi?id=1677562, which means that we no longer need to use `npm install --force` in the PDF.js library.
2023-04-20 16:14:31 +02:00
Jonas Jenwald
d4e8657e8f
Merge pull request #16324 from Snuffleupagus/debugger-CSS-is
Introduce some `:is` usage in the debugger CSS
2023-04-20 15:17:03 +02:00
Jonas Jenwald
1b2b6910ac Don't include Chrome-specific CSS rules in MOZCENTRAL builds 2023-04-20 14:14:33 +02:00
Jonas Jenwald
f675bfe178
Merge pull request #16323 from Snuffleupagus/viewer-CSS-is
Introduce some `:is` usage in the viewer CSS
2023-04-20 09:34:46 +02:00
Jonas Jenwald
7926c1bc88 Introduce some :is usage in the viewer CSS 2023-04-20 09:26:19 +02:00
Jonas Jenwald
3e05d7e7fd Introduce some :is usage in the debugger CSS
Also adds one more instance of `:is` in the `web/annotation_editor_layer_builder.css` file.
2023-04-19 20:47:57 +02:00
Jonas Jenwald
58b5eb89b8
Merge pull request #16315 from Snuffleupagus/annotationLayer-CSS-is
Introduce some `:is` usage in the annotationLayer CSS
2023-04-19 15:32:10 +02:00
Jonas Jenwald
36ff19c53b
Merge pull request #16314 from Snuffleupagus/pdfViewer-CSS-is
Introduce some `:is` usage in the PDFViewer CSS
2023-04-19 15:28:53 +02:00
Jonas Jenwald
5119e7fd6a
Merge pull request #16313 from Snuffleupagus/textLayer-CSS-is
Introduce some `:is` usage in the textLayer CSS
2023-04-19 15:17:22 +02:00
Jonas Jenwald
f98358aa45
Merge pull request #16310 from Snuffleupagus/xfaLayer-CSS-is
Introduce some `:is` usage in the xfaLayer CSS
2023-04-19 15:15:38 +02:00
Jonas Jenwald
3420b2fe8a
Merge pull request #16317 from Snuffleupagus/css-before-after
Enforce double-colon notation for CSS pseudo-elements
2023-04-19 15:14:01 +02:00
Jonas Jenwald
42faecf310
Merge pull request #16320 from Snuffleupagus/enablePermissions-disable-copy-all
Disable the "copy all text" feature when `enablePermissions` is set (PR 16286 follow-up)
2023-04-18 22:13:19 +02:00
Jonas Jenwald
6bfcc96651 Disable the "copy all text" feature when enablePermissions is set (PR 16286 follow-up)
When permissions are enabled and the PDF document doesn't have the COPY-flag set, it shouldn't be possible for the user to trigger the "copy all text" feature.
2023-04-18 21:12:18 +02:00
calixteman
3e292dc222
Merge pull request #16318 from calixteman/issue16316
Correctly clip the text in the text layer (fixes #16316)
2023-04-18 17:48:51 +02:00
Calixte Denizet
19ca41896e Correctly clip the text in the text layer (fixes #16316) 2023-04-18 17:00:42 +02:00
Jonas Jenwald
529dbf9b65 Enforce double-colon notation for CSS pseudo-elements
These changes are part of https://phabricator.services.mozilla.com/D170496, and thanks to a Stylelint rule we can both enforce and fix this automatically; see also https://stylelint.io/user-guide/rules/selector-pseudo-element-colon-notation/
2023-04-18 15:50:22 +02:00
Jonas Jenwald
88e2d04b90
Merge pull request #16311 from linxianxi/fix-viewer-browser-compatibility
Compatible with ResizeObserver borderBoxSize in legacy safari
2023-04-18 13:05:13 +02:00
Jonas Jenwald
fcc535706a Introduce some :is usage in the annotationLayer CSS
While this slightly reduces duplication in the CSS rules, some of the auto-formatting done by Prettier is perhaps not great. (Given the overall advantage of using Prettier, we'll probably have to simply accept this.)
2023-04-18 12:42:13 +02:00
Jonas Jenwald
04ed5ddeba Introduce some :is usage in the PDFViewer CSS 2023-04-18 12:01:08 +02:00
linxianxi
6ca702d680 Compatible with ResizeObserver borderBoxSize in legacy safari
See https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize\#browser_compatibility
2023-04-18 17:40:26 +08:00
Jonas Jenwald
5cb99321d7 Introduce some :is usage in the textLayer CSS 2023-04-18 11:39:09 +02:00
Jonas Jenwald
9be2ba6170 Introduce some :is usage in the xfaLayer CSS
Hopefully these changes make sense (since this functionality is new to me), however the existing `xfa`-tests should help avoid any outright regressions.
2023-04-17 23:32:04 +02:00
calixteman
f1b005d7b8
Merge pull request #16308 from calixteman/gv_remove_button_hover
[GeckoView] Don't change style for the download button when focused/hovered
2023-04-17 16:53:33 +02:00
calixteman
dbe0c4e60c
Merge pull request #16200 from calixteman/dont_normalize
[api-minor] Don't normalize the text used in the text layer.
2023-04-17 16:50:26 +02:00
Calixte Denizet
dde79edba1 [GeckoView] Don't change style for the download button when focused/hovered 2023-04-17 16:47:05 +02:00
Calixte Denizet
117bbf7cd9 [api-minor] Don't normalize the text used in the text layer.
Some arabic chars like \ufe94 could be searched in a pdf, hence it must be normalized
when creating the search query. So to avoid to duplicate the normalization code,
everything is moved in the find controller.
The previous code to normalize text was using NFKC but with a hardcoded map, hence it
has been replaced by the use of normalize("NFKC") (it helps to reduce the bundle size
by 30kb).
In playing with this \ufe94 char, I noticed that the bidi algorithm wasn't taking into
account some RTL unicode ranges, the generated font wasn't embedding the mapping this
char and the unicode ranges in the OS/2 table weren't up-to-date.

When normalized some chars can be replaced by several ones and it induced to have
some extra chars in the text layer. To avoid any regression, when copying some text
from the text layer, a copied string is normalized (NFKC) before being put in the
clipboard (it works like this in either Acrobat or Chrome).
2023-04-17 14:31:23 +02:00
Jonas Jenwald
89b0fd9628 Remove the remaining PRODUCTION build-target usage
After the previous patch we now have only *a single* `PRODUCTION` occurrence in the entire code-base, more specifically in the `web/viewer.html` file.
This special build-target can be replaced with any condition that always evaluate to `false`, such as e.g. a comment.

*Please note:* This patch might be considered too hacky, hence I completely understand if it's rejected.
2023-04-17 12:07:20 +02:00
Jonas Jenwald
804aa896a7 Stop using the PRODUCTION build-target in the JavaScript code
This *special* build-target is very old, and was introduced with the first pre-processor that only uses comments to enable/disable code.
When the new pre-processor was added `PRODUCTION` effectively became redundant, at least in JavaScript code, since `typeof PDFJSDev === "undefined"` checks now do the same thing.

This patch proposes that we remove `PRODUCTION` from the JavaScript code, since that simplifies the conditions and thus improves readability in many cases.
*Please note:* There's not, nor has there ever been, any gulp-task that set `PRODUCTION = false` during building.
2023-04-17 12:04:34 +02:00
calixteman
3e08eee511
Merge pull request #16301 from calixteman/issue16278
[Editor] Take into account the initial rotation (issue #16278)
2023-04-17 09:42:07 +02:00