Commit Graph

17056 Commits

Author SHA1 Message Date
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
Tim van der Meij
be0f6ee080
Merge pull request #16242 from Snuffleupagus/rm-render-canvasFactory
[api-minor] Remove the `canvasFactory` option from `PDFPageProxy.render` (PR 16100 follow-up)
2023-04-02 13:51:01 +02:00
Tim van der Meij
1c7e2defea
Merge pull request #16243 from Snuffleupagus/toolbars-object-spread
Use object-spread when dispatching events in the toolbars
2023-04-02 13:49:03 +02:00
Jonas Jenwald
51113c17e9 Use object-spread when dispatching events in the toolbars
This format is more compact, and should be available in all browsers that we currently support; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#browser_compatibility
2023-04-02 12:10:15 +02:00
Jonas Jenwald
b35c03ac3a [api-minor] Remove the canvasFactory option from PDFPageProxy.render (PR 16100 follow-up) 2023-04-01 16:00:31 +02:00
Jonas Jenwald
8b7e44682c
Merge pull request #16159 from nmtigor/b-Object_in_api
Write some {Object} in api.js more precise
2023-04-01 15:57:46 +02:00
Tim van der Meij
b384d3bc24
Merge pull request #16232 from Snuffleupagus/firefox-rm-linkService-baseUrl
[Firefox] Stop using a `baseUrl` in the `PDFLinkService` (PR 16153 follow-up)
2023-04-01 15:37:51 +02:00
Tim van der Meij
13f2426aab
Merge pull request #16238 from Snuffleupagus/update-Node-compat-check
Update the Node.js compatibility-check in the worker-thread
2023-04-01 14:20:33 +02:00
Tim van der Meij
a9af0a6cc2
Merge pull request #16234 from Snuffleupagus/rm-disableCombineTextItems
[api-minor] Remove the `disableCombineTextItems` option
2023-04-01 14:18:00 +02:00
Jonas Jenwald
57a307d0cd Update the Node.js compatibility-check in the worker-thread
*Please note:* In Node.js environments a `legacy`-build must be used since only those versions include any polyfills.

Previously we'd only check if `ReadableStream` is natively supported, however since Node.js version 18 that's now been implemented; please see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#browser_compatibility
Hence we'll also check for the availability of `Path2D`, since that's browser-specific functionality not expected to be available in Node.js environments; please see https://developer.mozilla.org/en-US/docs/Web/API/Path2D#browser_compatibility
2023-03-30 18:36:15 +02:00
Jonas Jenwald
2358757b66
Merge pull request #16235 from Standard8/bug-1825522-generate-cleanup
Remove now unnecessary eslint-disable statement generated for PdfJsDefaultPreferences.sys.mjs. (bug 1825522).
2023-03-30 18:02:09 +02:00
Mark Banner
bb5467789b Remove now unnecessary eslint-disable statement generated for PdfJsDefaultPreferences.sys.mjs. (bug 1825522). 2023-03-30 14:47:31 +01:00
Jonas Jenwald
5063a6f2a9 [api-minor] Remove the disableCombineTextItems option
*Please note:* This parameter has never been used within the PDF.js library/viewer itself, and it was only ever added for backwards compatibility reasons.

This parameter was added in PR 7475, over six years ago, to try and optionally maintain the previous *default* text-extraction behaviour.
However as part of the general text-extraction improvements in PR 13257, almost two years ago, the `disableCombineTextItems` functionality was accidentally "broken" in various ways. Note how the only (very basic) unit-test was updated in a way that doesn't really make sense, since generally speaking you'd expect that using the option should result in *more* (or at least the same number of) text-items. Furthermore there's also the recent issue 16209, where the option causes almost all textContent to be concatenated together.

Hence this patch proposes that we simply remove the `disableCombineTextItems` option since it's essentially unused/untested functionality, as evident from the fact that it took almost two years for someone to notice that it's broken.
2023-03-30 14:23:38 +02:00
Jonas Jenwald
40a96a2524 [Firefox] Stop using a baseUrl in the PDFLinkService (PR 16153 follow-up)
With the changes in PR 16153 we're no longer setting a `<base href>` in the Firefox PDF Viewer, hence it shouldn't be necessary to keep setting a `baseUrl` in the `PDFLinkService`-class.
Given that the original document URL is now kept, the browser itself will handle relative URLs and we can thus slightly reduce the amount of string parsing required when handling various links in the viewer.
2023-03-30 11:51:25 +02:00
Jonas Jenwald
09da8026b6
Merge pull request #16228 from Snuffleupagus/firefox-imageResourcesPath
[Firefox] Set the `imageResourcesPath` correctly (PR 16153 follow-up)
2023-03-29 14:57:58 +02:00
Jonas Jenwald
e0e56e9e9c [Firefox] Set the imageResourcesPath correctly (PR 16153 follow-up)
We missed updating this path in PR 16153, which breaks loading of annotation-icons in the Firefox PDF Viewer.
2023-03-29 14:33:08 +02:00
Jonas Jenwald
43917796c2
Merge pull request #16227 from Snuffleupagus/zooming-regressions
Fix various zooming regressions (PR 15812 follow-up)
2023-03-29 12:15:26 +02:00
Calixte Denizet
4b7eb1436d Thin whitespaces must have their own span 2023-03-29 11:23:58 +02:00
Jonas Jenwald
7bca3c81a9 Fix CSS-only zooming in the viewer (PR 15812 follow-up)
Currently if you e.g. enable the `useOnlyCssZoom` option rendering may no longer finish as intended. To reproduce:
 - Enable the `useOnlyCssZoom` option.
 - Load https://github.com/mozilla/pdf.js/files/1522715/wuppertal_2012.pdf (in the development viewer).
 - When rendering starts, *immediately* change the zoom-level.

In this case the document will never finish rendering, since the `postponeDrawing`-functionality will (here incorrectly) abort rendering and with CSS-only zooming rendering is only expected to happen once per page.
To fix this we'll simply ignore any `drawingDelay` when CSS-only zooming is used (regardless if it's triggered via the option or the zoom-level being very large).
2023-03-29 10:36:48 +02:00
Jonas Jenwald
2c5a2d112c Fix rotation of the zoomLayer (PR 15812 follow-up)
Currently the `zoomLayer` isn't rotated correctly in all cases. To reproduce:
 - Load https://github.com/mozilla/pdf.js/files/1522715/wuppertal_2012.pdf
 - Let the document render.
 - Rotate the document *four* times, such that the original rotation is restored.

The easiest solution, as far as I can tell, is that we always set the `transform` just as we did (for years) prior to the changes in PR 15812.
2023-03-29 10:04:20 +02:00
calixteman
622465dc20
Merge pull request #16223 from calixteman/16221
Create a new chunk when the char is too rised compared to the previous one
2023-03-28 15:30:14 +02:00
Calixte Denizet
a96f10e55d Create a new chunk when the char is too rised compared to the previouse one 2023-03-28 13:56:46 +02:00
Jonas Jenwald
d584513cb2
Merge pull request #16213 from Snuffleupagus/validateCSSFont-quotes
Reduce duplication in the `validateCSSFont` helper function
2023-03-28 12:40:23 +02:00