Commit Graph

17078 Commits

Author SHA1 Message Date
Jonas Jenwald
a6409e9887 Update l10n files 2023-04-15 22:18:24 +02:00
Jonas Jenwald
877c867a92 Update npm packages 2023-04-15 22:10:02 +02:00
calixteman
92baf14531
Merge pull request #16286 from calixteman/copy_all
Add the possibility to copy all the pdf text whatever the rendered pages are (bug 1788035)
2023-04-15 19:43:13 +02:00
Calixte Denizet
ca54ea12b3 Add the possibility to copy all the pdf text whatever the rendered pages are (bug 1788035) 2023-04-15 18:59:40 +02:00
Tim van der Meij
4d8a60b435
Merge pull request #16288 from Snuffleupagus/print-code-cleanup
Slightly modernize print-related code
2023-04-15 13:08:37 +02:00
Tim van der Meij
953c29873d
Merge pull request #16281 from Snuffleupagus/toggleCheckedBtn
Reduce some duplication when toggling buttons in the viewer toolbars
2023-04-15 13:00:23 +02:00
Jonas Jenwald
c7daa66b26
Merge pull request #16294 from Snuffleupagus/rm-compileGlobalSubrIndex
Remove `CFFCompiler.compileGlobalSubrIndex`, and simplify `CFFCompiler.compileTypedArray`
2023-04-15 12:17:02 +02:00
Jonas Jenwald
c79bdd6ae6 Simplify the CFFCompiler.compileTypedArray method
Rather than manually creating the Array, we can use the now existing `Array.from` method instead.
2023-04-15 11:13:34 +02:00
Jonas Jenwald
0ce568e789 Remove CFFCompiler.compileGlobalSubrIndex since it's completely unused
This method was originally added in PR 1320, eleven years ago, however it doesn't appear to ever have been used (not even from the start).
Furthermore, this method also tries to access a property that doesn't exist (`this.out`) and then call a method that also doesn't exist (`writeByteArray`).
2023-04-15 11:13:21 +02:00
Jonas Jenwald
ab2773416b
Merge pull request #16291 from Snuffleupagus/issue-16289
Limit the `Path2D`-checks in the worker-thread to Node.js (PR 16238 follow-up, issue 16289)
2023-04-14 21:26:12 +02:00
calixteman
a44173ea51
Merge pull request #16292 from calixteman/improve_cff_compiling
Avoid when it's possible to use Array.concat when compiling a CFF font
2023-04-14 21:17:53 +02:00
Calixte Denizet
5eab8ec610 Avoid when it's possible to use Array.concat when compiling a CFF font
In looking at https://bugs.ghostscript.com/show_bug.cgi?id=706451 I noticed that bug2.pdf was pretty
slow to load for such a basic file.
In profiling I noticed that a lot of time is spent in Array.concat, hence this patch use Array.push when
it's possible (it's now ~3 times faster).
2023-04-14 19:01:01 +02:00
Jonas Jenwald
edd13895dd Limit the Path2D-checks in the worker-thread to Node.js (PR 16238 follow-up, issue 16289)
The changes in PR 16238 were intended specifically for Node.js environments, however they accidentally applied to older browsers as well.

*Please note:* In up-to-date browsers `Path2D` is available in Workers, which should be connected to the introduction of `OffscreenCanvas`.
2023-04-14 11:51:11 +02:00
Jonas Jenwald
aeb8e36cdb Convert FirefoxPrintService and PDFPrintService into standard classes
Note that both of the affected files are old enough to predate the general availability of `class`.
2023-04-14 10:02:28 +02:00
Jonas Jenwald
ebf493f726 Slightly modernize the print layout-methods
By getting the width/height of the first page initially, we can slightly reduce the amount of code needed both in the `hasEqualPageSizes`-check and when building the print-styles.
2023-04-14 10:02:25 +02:00
calixteman
342dc760da
Merge pull request #16284 from calixteman/gv_keep_button
[GeckoView] Show the download button by default and add a pref to disable it (bug 1827963)
2023-04-13 21:17:32 +02:00
Calixte Denizet
7f0d45ce47 [GeckoView] Show the download button by default and add a pref to disable it (bug 1827963)
For the moment there is no real consensus on how we should download a pdf on Android.
Hence we keep this solution for the moment but behind a pref (which will be true on
nightly only).
2023-04-13 20:33:03 +02:00
Jonas Jenwald
2a195beb30 Reduce some duplication when toggling buttons in the viewer toolbars
Currently we repeat the same code in lots of places, to update the "toggled" class and "aria-checked" attribute, when various toolbar buttons are clicked.

For the MOZCENTRAL build-target this patch reduces the size of the *built* `web/viewer.js` file by just over `1.2` kilo-bytes.
2023-04-13 13:18:37 +02:00
Jonas Jenwald
b3932f70ed
Merge pull request #16279 from Snuffleupagus/structuredClone-transfer-legacy
Skip transfers, in `LoopbackPort.postMessage`, for PDF.js `legacy`-builds (issue 16255)
2023-04-13 10:20:11 +02:00
Jonas Jenwald
82a0bcecfa Skip transfers, in LoopbackPort.postMessage, for PDF.js legacy-builds (issue 16255)
Apparently the `structuredClone` polyfill doesn't handle transfers correctly, and `DOMException`s may thus be thrown. This is particularly problematical in Node.js environments, where that exception (obviously) isn't available.

To work-around these issues we'll simply ignore any transfers in `legacy`-builds, since those *may* use the `structuredClone` polyfill. This will obviously lead to slightly higher memory usage in those builds, however this really only affects Node.js environments. (Browsers are only affected if workers are disabled, however that's never been an officially recommended/supported configuration.)
2023-04-12 14:18:29 +02:00
calixteman
7571842d84
Merge pull request #16275 from calixteman/ifx_search_with_fractions
Fix search of numbers inside fractions
2023-04-11 21:52:56 +02:00
Calixte Denizet
d8795f9f8f Fix search of numbers inside fractions 2023-04-11 20:57:26 +02:00
Jonas Jenwald
3a36a9d337
Merge pull request #16268 from Snuffleupagus/RegionalImageCache
Attempt to also cache images at the "page"-level (issue 16263)
2023-04-11 12:06:29 +02:00
calixteman
c1c372c320
Merge pull request #16225 from calixteman/16224
Thin whitespaces must have their own span
2023-04-11 11:13:16 +02:00
Jonas Jenwald
a43151103e
Merge pull request #16265 from Snuffleupagus/float-inline
[Firefox] Use `float: inline-start/inline-end` directly in MOZCENTRAL builds (PR 15968 follow-up)
2023-04-10 16:36:28 +02:00
Jonas Jenwald
d3d16b15ac [Firefox] Use float: inline-start/inline-end directly in MOZCENTRAL builds (PR 15968 follow-up)
Currently `float: inline-start/inline-end` is only supported in Firefox, see https://developer.mozilla.org/en-US/docs/Web/CSS/float#browser_compatibility, and in order to support other browsers we're thus forced to jump through some hoops.
This leads to slightly less nice code in the *built-in* Firefox PDF Viewer, and this patch attempts to improve the current situation:
 - Use Stylelint to forbid direct use of `float: inline-start/inline-end` in the CSS files, to prevent future bugs in the general PDF.js viewer.
 - Do a build-time replacement, only in MOZCENTRAL builds, to replace the CSS-variables with raw `float: inline-start/inline-end` instances.
2023-04-10 16:26:19 +02:00
Tim van der Meij
8398cabd17
Merge pull request #16249 from Snuffleupagus/Chrome-88
[api-minor] Update the minimum supported Google Chrome version
2023-04-10 15:41:42 +02:00
Tim van der Meij
20f79f870e
Merge pull request #16246 from Snuffleupagus/dist-install-force
Force-install when using `gulp dist-install` (issue 15435)
2023-04-10 15:40:09 +02:00
Jonas Jenwald
9881dbf927 Attempt to also cache images at the "page"-level (issue 16263)
Currently we have two separate image-caches on the worker-thread:
 - A local one, which is unique to each `PartialEvaluator.getOperatorList` invocation. This one caches both names *and* references, since image-resources may be accessed in either way.
 - A global one, which applies to the entire PDF documents and all its pages. This one only caches references, since nothing else would work.

This patch introduces a third image-cache, which essentially sits "between" the two existing ones. The new `RegionalImageCache`[1] will be usable throughout a `PartialEvaluator` instance, and consequently it *only* caches references, which thus allows us to keep track of repeated image-resources found in e.g. different /Form and /SMask objects.

---
[1] For lack of a better word, since naming things is hard...
2023-04-10 11:34:41 +02:00
Jonas Jenwald
195db2cff5
Merge pull request #16262 from Snuffleupagus/pageNumber-rtl
Tweak the `pageNumber` CSS to better support RTL locales
2023-04-08 20:19:12 +02:00
Jonas Jenwald
c95a09047a
Merge pull request #16261 from Snuffleupagus/loadingBar-rtl
Tweak the `loadingBar` CSS to better support RTL locales
2023-04-08 20:17:09 +02:00
Jonas Jenwald
61860ff56f Tweak the pageNumber CSS to better support RTL locales
This effectively implements some of the changes from https://phabricator.services.mozilla.com/D170496, but in such a way that the loading-icon won't overlay the page-number in RTL locales.
2023-04-08 13:57:17 +02:00
calixteman
1e9e3cafb8
Merge pull request #16260 from calixteman/gv_add_dl_button
[GeckoView] Add a basic toolbar with a download button for GV (bug 1823164)
2023-04-07 19:20:44 +02:00
Jonas Jenwald
6419e59036 Tweak the loadingBar CSS to better support RTL locales
This effectively implements some of the changes from https://phabricator.services.mozilla.com/D170496, but using our existing "direction aware" CSS-variable to limit the amount of code changes needed.
2023-04-07 13:36:06 +02:00
Calixte Denizet
3b147205ba [GeckoView] Add a basic toolbar with a download button for GV (bug 1823164) 2023-04-07 11:54:16 +02:00
Jonas Jenwald
08c8d310d3
Merge pull request #16256 from Snuffleupagus/issue-16254
Tweak the `--scale-factor` CSS-variable warning threshold (issue 16254)
2023-04-06 15:47:55 +02:00
Jonas Jenwald
4bf8e5c13d Tweak the --scale-factor CSS-variable warning threshold (issue 16254)
This is apparently needed to account for the rounding used in Chromium-browsers, such that the warning message isn't displayed unnecessarily.
2023-04-06 13:11:12 +02:00
Jonas Jenwald
65c4a4b3fe
Merge pull request #16241 from fchasen/bug_1820651
[Firefox] Add CSS at-page size when printing from FirefoxPrintService (bug 1820651)
2023-04-05 21:03:46 +02:00
Fred Chasen
3c326974a0 [Firefox] Add CSS at-page size when printing from FirefoxPrintService (bug 1820651)
- Duplicates at-page size method from PDFPrintService
- Updates getPagesOverview to rotate pages to fit the initial orientation
2023-04-05 10:33:56 -07:00
Jonas Jenwald
184076fe7a
Merge pull request #16226 from Snuffleupagus/rm-svg-viewer
[api-minor] Remove SVG-rendering from the viewer (PR 15173 follow-up)
2023-04-04 15:10:27 +02:00
Jonas Jenwald
96a3210501
Merge pull request #16248 from Snuffleupagus/editor-params-dispatchEvent
Reduce duplication when dispatching the "switchannotationeditorparams" event
2023-04-03 13:32:33 +02:00
Jonas Jenwald
ce3ea58778 [api-minor] Update the minimum supported Google Chrome version
The patch changes the minimum supported version of Google Chrome as follows:
 - Chrome 88, which was released on 2021-01-19; see https://en.wikipedia.org/wiki/Google_Chrome_version_history

This is done to allow use of modern CSS features, such as e.g. `:is()` and `:where()` in the code-base.
2023-04-03 13:23:26 +02:00
Jonas Jenwald
d256168b62 Reduce duplication when dispatching the "switchannotationeditorparams" event
Currently we repeat virtually the same code multiple times, which can be avoided by the introduction of a simple helper function.
2023-04-03 09:05:07 +02:00
Jonas Jenwald
bf57a8f660 Force-install when using gulp dist-install (issue 15435)
When installing the PDF.js project itself it's currently necessary to use `--force` in order for all packages to install correctly, see issue 15429, hence the same is also necessary when using the `gulp dist-install` command for local development/testing.
2023-04-02 16:06:36 +02:00
Jonas Jenwald
484da62f50 Inline PDFPageView.paintOnCanvas in the draw method, now that SVG-rendering is removed 2023-04-02 15:23:45 +02:00
Jonas Jenwald
92cf183f56 Re-factor the showCanvas function, reducing function calls during rendering 2023-04-02 15:23:45 +02:00
Jonas Jenwald
6858dae1c3 Change the finishPaintTask/finishPaintTask helpers into private methods 2023-04-02 15:23:45 +02:00
Jonas Jenwald
c2f1e65cc3 [api-minor] Remove SVG-rendering from the viewer (PR 15173 follow-up) 2023-04-02 15:23:45 +02:00
Tim van der Meij
b135dadb17
Merge pull request #16244 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-04-02 15:08:44 +02:00
Tim van der Meij
4eecd9e308
Bump versions in pdfjs.config 2023-04-02 15:03:13 +02:00