mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-13 02:25:47 +02:00
23033 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
17af706070 |
[api-minor] Use "data-l10n-id"/"data-l10n-args", rather than manually updating DOM-elements, to trigger translation (PR 17146 follow-up)
This patch changes almost all viewer-components[1] to use "data-l10n-id"/"data-l10n-args" for localization, which means that in many cases we no longer need to pass around the `L10n`-instance any more. One part of the code-base where the `L10n`-instance is still being used "directly" is the AnnotationEditors, however while it might be possible to convert (most of) that code as well that's not attempted in this patch. --- [1] The one exception is the `PDFDocumentProperties` dialog, since the way it's currently implemented makes that less straightforward to fix without a lot of code changes. |
||
|
|
898cc2e399
|
Merge pull request #17151 from Snuffleupagus/Fluent-PDFDocumentProperties-fixes
A couple of `PDFDocumentProperties` tweaks (PR 17115 follow-up) |
||
|
|
da186d1b89
|
Merge pull request #17146 from Snuffleupagus/NullL10n-refactor
[api-minor] Re-factor `NullL10n` and remove the hard-coded l10n strings (PR 17115 follow-up) |
||
|
|
4c4676e5a4
|
Merge pull request #17152 from Snuffleupagus/findbar-resizeObserver
Use a `ResizeObserver` to update the layout of `PDFFindBar` |
||
|
|
e20ef39f59 |
Use a ResizeObserver to update the layout of PDFFindBar
*Please note:* In the Firefox PDF Viewer this findbar is only used for PDF documents placed in e.g. `<iframe>` elements. By registering a `ResizeObserver` when the `PDFFindBar` is open we slightly unify and simplify how the findbar layout (row vs column) is handled. This will be especially helpful with upcoming changes, where we'll make use of "data-l10n-id"/"data-l10n-args" to trigger translation in the viewer. |
||
|
|
7df082fce3 |
A couple of PDFDocumentProperties tweaks (PR 17115 follow-up)
- The old translation engine handled language code casing slightly differently, hence we need to tweak the non-metric locale check in `PDFDocumentProperties` to account for that. - Use only lowercase names for the pre-defined page names, to improve overall consistency. |
||
|
|
f07675a6a8 |
[api-minor] Re-factor NullL10n and remove the hard-coded l10n strings (PR 17115 follow-up)
*Please note:* These changes only affect the GENERIC build, since `NullL10n` is only a stub elsewhere (see PR 17135). After the changes in PR 17115, which modernized and improved l10n-handling, the `NullL10n`-implementation is no longer a good fallback for the "proper" `L10n`-classes. To improve this situation, especially for the *standalone* viewer-components, this patch makes the following changes: - Let the `NullL10n`-implementation extend an actual `L10n`-class, which is constant and lazily initialized, to ensure that it works *exactly* like the "proper" ones. - Automatically bundle the "en-US" l10n-strings in the build, via the pre-processor, such that we don't need to remember to manually update them. - Ensure that the *standalone* viewer-components register their DOM-elements for translation, similar to the default viewer, since this will allow future code improvements by using "data-l10n-id"/"data-l10n-args" in most (if not all) parts of the viewer. - Remove the `NullL10n` from the `AnnotationLayer`, to avoid affecting bundle size too much. For third-party users that access the `AnnotationLayer`, as exposed in the main PDF.js library, they'll now need to *manually* register it for translation. (However, the *standalone* viewer-components still works given the point above.) |
||
|
|
a4cd2ef1db
|
Merge pull request #17148 from JT-External/support-rotated-imagemask
Fix size of maskCanvas to draw image masks correctly |
||
|
|
0eacd5c107 |
Fix size of maskCanvas to draw image masks correctly
Use existing helper to calculate the Box Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com> Ensure that there are non-zero Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com> Add a reference test for #17147 |
||
|
|
5f0e560949
|
Merge pull request #17140 from Snuffleupagus/l10n-move-init
Initialize the `L10n`-instance as soon as possible in Firefox (PR 17115 follow-up) |
||
|
|
5c14c559dd |
Initialize the L10n-instance as soon as possible in Firefox (PR 17115 follow-up)
Given that there's now a bit more asynchronicity in the l10n-initialization in the Firefox PDF Viewer, after PR 17115, try to limit the impact of that by moving it to occur a tiny bit earlier in the default viewer initialization. |
||
|
|
d094e8aab0
|
Merge pull request #17142 from calixteman/no_connect_root
[L10n] Don't try to connect the root element when it has already been done |
||
|
|
a0b9c937ae |
[L10n] Don't try to connect the root element when it has already been done
In Firefox debug builds, there is an assertion to check that we don't connect a subelement of an already connected root. Thanks to this assertion, we can see that the root has already been added to Fluent, hence we don't need to do it a second time. We don't need to await anymore on the translation in order to update the toolbar: it'll be done by Fluent, so we can safely remove the "localized" event and avoid to wait for it. |
||
|
|
e820688510 |
Remove the enableStampEditor preference
|
||
|
|
c60401a765
|
Merge pull request #17133 from Snuffleupagus/rm-builder-merge
Use object destructuring, rather than the `merge` helper, in the gulpfile |
||
|
|
d6cfbd2839
|
Merge pull request #17130 from Snuffleupagus/AppOption-move-init
Try to make the `Preferences`/`AppOptions` initialization slightly more efficient |
||
|
|
5ddc949159 |
Try to make the Preferences/AppOptions initialization slightly more efficient
*Please note:* This patch contains a couple of micro-optimizations, hence I understand if it's deemed unnecessary. Move the `AppOptions` initialization into the `Preferences` constructor, since that allows us to remove a couple of function calls, a bit of asynchronicity and one loop that's currently happening in the early stages of the default viewer initialization. Finally, move the `Preferences` initialization to occur a *tiny* bit earlier since that cannot hurt given that the entire viewer initialization depends on it being available. |
||
|
|
929311fb9d
|
Merge pull request #17135 from Snuffleupagus/bug-1859818
Only bundle `NullL10n` in GENERIC builds (bug 1859818) |
||
|
|
69ad0d9861 |
Only bundle NullL10n in GENERIC builds (bug 1859818)
|
||
|
|
f39bedd06c
|
Merge pull request #17138 from Snuffleupagus/issue-17137
Use a CSS-only solution to set the `dropdownToolbarButton` width (issue 17137) |
||
|
|
482b789edf |
Use a CSS-only solution to set the dropdownToolbarButton width (issue 17137)
Note that CSS-features such as e.g. `flex` didn't exist, or had poor cross-browser support, back when the JavaScript-based solution was initially implemented. |
||
|
|
5d8be99782
|
Merge pull request #17115 from calixteman/mv_to_fluent
[api-minor] Move to Fluent for the localization (bug 1858715) |
||
|
|
6a6f6f122c
|
Merge pull request #17131 from Snuffleupagus/openOrDownloadData-caching
Re-factor the blob-URL caching in `DownloadManager.openOrDownloadData` |
||
|
|
66982a2a11 |
[api-minor] Move to Fluent for the localization (bug 1858715)
- For the generic viewer we use @fluent/dom and @fluent/bundle - For the builtin pdf viewer in Firefox, we set a localization url and then we rely on document.l10n which is a DOMLocalization object. |
||
|
|
2a3090224f
|
Merge pull request #17134 from Snuffleupagus/writeStream-less-type-conversion
Reduce unnecessary type conversion in `writeStream` |
||
|
|
25a1a9d28f |
Reduce unnecessary type conversion in writeStream
Currently we're unnecessarily converting data between strings and typed-arrays, when dealing with compressible data, in the `writeStream` function. Note how we're *first* getting a string-representation of the stream, which involves converting the underlying typed-array into a string, only to immediately convert this back into a typed-array. This seems completely unnecessary, and is easy enough to avoid, and we'll now only do a *single* type-conversion in this function. |
||
|
|
ae664ea8e0 |
Use object destructuring, rather than the merge helper, in the gulpfile
This helper function was originally added in PR 1953, eleven years ago, at which point object destructuring didn't exist. |
||
|
|
674052d3fc |
Re-factor the blob-URL caching in DownloadManager.openOrDownloadData
Cache blob-URLs on the actual data, rather than DOM elements, to reduce potential duplicates (note the updated unit-test). |
||
|
|
22d6d95f03
|
Merge pull request #17125 from timvandermeij/find-intermittent
Fix intermittent problems on Windows in the XFA search integration test |
||
|
|
2bae8af96a
|
Fix intermittent problems on Windows in the XFA search integration test
The current test fails intermittently only on Windows for unknown reasons: the code is correct and on Linux it always passes. However, we have already spent quite a lot of time on this test, so rather than spending even more time on it I figured we should look at what behavior the test is trying to check and find an alternative way to do it that can't trigger this intermittent issue anymore. This commit changes the test to use a term that only exists once in the entire document so we cannot accidentally highlight another match anymore. This doesn't change anything about the behavior that this test aims to check: we still test searching in the XFA layer, we still test that the original term is matched case-insensitively and we still test that that match is actually highlighted. Note that the only objective of the test is confirming that the search functionality covers the XFA layer, so the exact phrase/match is not the interesting bit. |
||
|
|
a9a1195582
|
Merge pull request #17123 from Snuffleupagus/eslint-globals
Update the ESLint `globals` list (PR 17055 follow-up) |
||
|
|
93f24dd5d7 |
Remove the ESLint "amd" environment (PR 17055 follow-up)
Please see https://eslint.org/docs/latest/use/configure/language-options#specifying-environments |
||
|
|
d5acbbccd3 |
Update the ESLint globals list (PR 17055 follow-up)
Given that we only use standard `import`/`export` statements now, after recent PRs, the "exports" global is unused. Instead we add "__non_webpack_import__" to the `globals` to avoid having to sprinkle disable statements throughout the code. Finally, the way that `globals` are defined has changed in ESLint and we should thus explicitly specify them as "readonly"; please find additional details at https://eslint.org/docs/latest/use/configure/language-options#specifying-globals |
||
|
|
76bf3da4b1
|
Merge pull request #17122 from timvandermeij/autoprint
Remove Escape key press from the `autoprint` integration test, and tweak the protocol timeout configuration for Puppeteer |
||
|
|
0c763d6c5a
|
Tweak the protocol timeout configuration for Puppeteer
The previous change that set the timeout had effect because we have seen quite a few protocol timeouts now correctly being raised in the context of the active test, however we have also still seen a handful of cases where this wasn't the case and the one second difference turned out to be too low (likely because the operation was started slightly after one second into the test run). We therefore tweak the value to be 75% of the Jasmine timeout. This should be enough to catch operations that happen later on in the test run, and if a single operation takes that long any hope for success is already gone anyway. |
||
|
|
48e41617f5
|
Remove Escape key press from the autoprint integration test
It's not necessary because we have configured silent printing for Firefox and Chrome in the browser arguments we pass in `test.mjs`. This means that the print dialog is not even shown at all or disappears automatically once printing is done, so the Escape key press serves no purpose. Since it has been shown to time out, likely because the page loses focus during printing, and because the page itself doesn't know when the printing dialog is shown and we therefore can't possibly do the key press at the right time anyway, this commit gets rid of it to stabilize the test. |
||
|
|
5c45dfa0ae
|
Merge pull request #17119 from timvandermeij/updates
Update translations/dependencies to the most recent versions and fix dependency vulnerabilities |
||
|
|
d53e166538
|
Merge pull request #17120 from timvandermeij/code-scanning-alerts
Remove obsolete `src/shared/{cffStandardStrings,fonts_utils}.js` files
|
||
|
|
58e4fcdc6f
|
Remove obsolete src/shared/{cffStandardStrings,fonts_utils}.js files
Those files only contain old debugging code that is not used/imported anywhere anymore, which is generating code scanning alerts. Moreover, they rely on globals/platform-specific code and don't import/export logic properly. |
||
|
|
4c17f99fab
|
Fix dependency vulnerabilities with npm audit fix
|
||
|
|
e1307fdba8
|
Update dependencies to the most recent versions | ||
|
|
e79bb25086
|
Update translations to the most recent versions | ||
|
|
23b8dbb730
|
Merge pull request #17117 from Snuffleupagus/eslint-import-no-commonjs
Enable the `import/no-commonjs` ESLint plugin rule |
||
|
|
d53093045a |
Enable the import/no-commonjs ESLint plugin rule
Given the amount of work put into removing `require`-calls from the code-base, let's ensure that new ones aren't accidentally added in the future. Note that we still have a couple of files where `require` is being used, in particular: - The Node.js examples, however those will be updated to use `import` in PR 17081. - The Webpack examples, and related support files, however I unfortunately don't know enough about Webpack to be able to update those. (Hopefully users of that code will help out here, once version `4` is released.) - The `statcmp`-tool, since *some* of those `require`-calls cannot be converted to `import` without other code changes (and that file is only used during benchmarking). Please find additional details at https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md |
||
|
|
57866cd31b
|
Merge pull request #14743 from Snuffleupagus/native-import-maps
Use native `import maps` in development mode |
||
|
|
7dfe08a0ee
|
Merge pull request #17098 from Snuffleupagus/createCDNWrapper-import
Tweak `PDFWorkerUtil.createCDNWrapper` to account for JavaScript modules (PR 17055 follow-up) |
||
|
|
af9a7b0003 |
Tweak PDFWorkerUtil.createCDNWrapper to account for JavaScript modules (PR 17055 follow-up)
|
||
|
|
5e986cb514 |
Use native import maps in development mode
This patch seem to work fine locally now, and `mozregression` points to it being fixed in bug https://bugzilla.mozilla.org/show_bug.cgi?id=1803984 which landed in Firefox 116. By using the native `import maps` functionality, we can remove a development dependency. Please find the specification at https://wicg.github.io/import-maps/ |
||
|
|
36c3c0a4c1
|
Merge pull request #17114 from Snuffleupagus/lib-modules
Output JavaScript modules for the `LIB` build-target (PR 17055 follow-up) |
||
|
|
38245500fd |
Output JavaScript modules for the LIB build-target (PR 17055 follow-up)
This *finally* allows us to mark the entire PDF.js library as a "module", which should thus conclude the (multi-year) effort to re-factor and improve how we import files/resources in the code-base. This also means that the `gulp ci-test` target, which is what's run in GitHub Actions, now uses JavaScript modules since that's supported in modern Node.js versions. |