Commit Graph

16980 Commits

Author SHA1 Message Date
calixteman
e1f7355de4
Merge pull request #15900 from calixteman/15289
Set ExpansionFactor to 0.06 when it's equals to 0 in the private dict of CFF fonts
2023-01-07 16:13:33 +01:00
Calixte Denizet
e565e455e2 Set ExpansionFactor to 0.06 when it's equals to 0 in the private dict of CFF fonts 2023-01-07 14:53:13 +01:00
Tim van der Meij
d6984f9395
Merge pull request #15899 from Snuffleupagus/tweak-toolbar-border-color
Tweak the `--toolbar-border-color` CSS variable (PR 15850 follow-up)
2023-01-07 13:53:35 +01:00
Jonas Jenwald
bd84bf4ebd Tweak the --toolbar-border-color CSS variable (PR 15850 follow-up)
After the changes in PR 15850, the toolbar-border is now quite difficult to spot in the light-theme. Hence, let's tweak it slightly to improve things.
2023-01-07 13:44:21 +01:00
Tim van der Meij
38e46e7614
Merge pull request #15850 from calixteman/15836
Remove shadow around each pages (fix issue #15836)
2023-01-07 13:29:41 +01:00
Tim van der Meij
69113f08f2
Merge pull request #15887 from Snuffleupagus/rm-setPDFNetworkStreamFactory
Inline the `setPDFNetworkStreamFactory` functionality in `src/display/api.js`
2023-01-07 13:16:23 +01:00
Tim van der Meij
b428824269
Merge pull request #15879 from Snuffleupagus/useWorkerFetch-defaults
[api-minor] Improve the `useWorkerFetch` default value checks
2023-01-07 13:13:25 +01:00
calixteman
91c44ec7ab
Merge pull request #15857 from calixteman/delay_loading_icon
Delay the loading icon display
2023-01-06 16:09:32 +01:00
Jonas Jenwald
1d5de9f4f4 Inline the setPDFNetworkStreamFactory functionality in src/display/api.js
Given that this is internal functionality, not exposed in the official API, it's not entirely clear (at least to me) why we can't just initialize this directly in `src/display/api.js` instead.
When testing both the development viewer and all the ways in which we run tests, everthing still appears to work just fine with this patch.
2023-01-06 13:23:07 +01:00
Jonas Jenwald
7d94fdeb48 Support parsing encrypted documents in XRef.indexObjects (issue 15893)
*Please note:* The reduced test-case is *not* a perfect reproduction of the original PDF document, since this one fails to open in e.g. Adobe Reader, but I do believe that it captures the most important points here.

For corrupt *and* encrypted PDF documents, it's possible that only some trailer dictionaries actually contain an /Encrypt-entry. Previously we'd could easily miss that, since we generally pick the first not obviously corrupt trailer dictionary, and the solution implemented here is to simply pre-parse all trailer dictionaries to see if there's any /Encrypt-entries.
2023-01-06 13:09:37 +01:00
Calixte Denizet
dd29f8705c Delay the loading icon display
In most of the cases, showing the loading icon is useless because
it's for a very short time, consequently it doesn't bring any useful
information for the user.
After a delay (400ms), the icon is shown in order to inform the user
that the viewer isn't stuck but it's doing something.
2023-01-06 12:28:32 +01:00
calixteman
e36564668b
Merge pull request #15896 from calixteman/gv_update_matches_count
[GV] Add an option in the find controller to update matches count only when the last page is reached (bug 1803188).
2023-01-06 12:11:20 +01:00
Calixte Denizet
661f425934 [GV] Add an option in the find controller to update matches count only when the last page is reached (bug 1803188).
In GeckoView, on an event, a callback must be executed with the result of an action,
but the callback can be used only one time.
So for each FindInPage event, we must trigger only one matches count update.
2023-01-06 10:56:26 +01:00
calixteman
8a0ca04399
Merge pull request #15894 from calixteman/gv_disable_print
[GV] Remove print stuff because window.print isn't implemented (bug 1808668)
2023-01-05 13:43:53 +01:00
Calixte Denizet
409c8b344f [GV] Remove print stuff because window.print isn't implemented (bug 1808668) 2023-01-05 13:02:29 +01:00
calixteman
7da591048c
Merge pull request #15892 from calixteman/fix_autoprint
[JS] UserActivation must be enabled before running document actions
2023-01-04 21:50:29 +01:00
Calixte Denizet
dea2471e96 [JS] UserActivation must be enabled before running document actions
else auto-print is broken (it's a regression from patch #15822).
2023-01-04 21:26:36 +01:00
Jonas Jenwald
1e1a2fce49
Merge pull request #15891 from Snuffleupagus/accumulateTicks
Reduce duplication in the `accumulateWheelTicks`/`accumulateTouchTicks` methods (PR 15886 follow-up)
2023-01-04 19:30:47 +01:00
Jonas Jenwald
66a3aa28fd Reduce duplication in the accumulateWheelTicks/accumulateTouchTicks methods (PR 15886 follow-up)
It just occurred to me that we can reduce some duplication by having the, virtually identical, `accumulateWheelTicks`/`accumulateTouchTicks` methods use a common helper instead that takes advantage of [bracket notation](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics#bracket_notation).
2023-01-04 18:19:39 +01:00
calixteman
4faf927030
Merge pull request #15886 from calixteman/pinch_to_zoom
[api-minor] Add the pinch-to-zoom feature (bug 1677933)
2023-01-04 17:20:29 +01:00
Calixte Denizet
d6b7a1f034 [api-minor] Add the pinch-to-zoom feature (bug 1677933) 2023-01-04 16:00:46 +01:00
Jonas Jenwald
da1365a309
Merge pull request #15885 from Snuffleupagus/font-update-type-subtype
Update the `type`/`subtype` at the end of font parsing
2023-01-02 17:18:05 +01:00
Jonas Jenwald
6bdbb5c5ca Update the type/subtype at the end of font parsing
This fixes a warning reported by CodeQL, and should also make general sense given that we parse the font-data to determine the *actual* `type`/`subtype` rather than trusting the PDF document.
2023-01-02 16:21:48 +01:00
Jonas Jenwald
42aa08563b
Merge pull request #15880 from Snuffleupagus/rm-docStats
[api-minor] Remove the `PDFDocumentProxy.stats` getter (PR 15758 follow-up)
2023-01-02 16:03:53 +01:00
Jonas Jenwald
1ba6e9437c
Merge pull request #15884 from Snuffleupagus/enable-defaultZoomDelay
Enable the `defaultZoomDelay` option/preference unconditionally, and other (small) improvements
2023-01-02 15:38:29 +01:00
Calixte Denizet
685b5866e4 Remove shadow around each pages (fix issue #15836) 2023-01-02 14:58:53 +01:00
Jonas Jenwald
9089e75cce Validate the options before adding the ResizeObserver in the PDFViewer constructor (PR 15830 follow-up)
In the GENERIC viewer, it doesn't make sense to register the `ResizeObserver` if the `container`/`viewer` options are not valid.
2023-01-02 14:52:00 +01:00
Jonas Jenwald
0860a5b168 Ensure that a document is loaded in PDFViewer.{increaseScale, decreaseScale} (PR 14053 follow-up)
This was always "wrong", since these methods (just like all the zoom-related ones) don't make sense unless there's an active document.
2023-01-02 14:05:33 +01:00
Jonas Jenwald
9f50b0af37 Enable the defaultZoomDelay option/preference unconditionally (PR 15812 follow-up)
This option/preference was disabled in GENERIC builds, see PR 15812, to avoid landing it *just before* a new release. Hence it should be fine to enable this now.
2023-01-02 14:00:16 +01:00
calixteman
e7cea29ad4
Merge pull request #15883 from calixteman/infinite_loop_search_diacritic
Avoid an infinite loop when searching for a single diacritic
2023-01-02 13:13:32 +01:00
Calixte Denizet
69c88477a9 Avoid an infinite loop when searching for a single diacritic 2023-01-02 12:27:07 +01:00
Jonas Jenwald
1a69d537c1 [api-minor] Limit the PDFDocumentLoadingTask.onUnsupportedFeature functionality to GENERIC builds (PR 15758 follow-up)
This was deprecated in PR 15758 but it's unfortunately quite difficult to tell if third-party users are depending on this, e.g. to implement custom error reporting, and if so to what extent.
However, thanks to the pre-processor we can limit *most* of this code to GENERIC builds which still seem like a worthwhile change.

These changes reduce the bundle size of the Firefox PDF Viewer by 3.8 kB in total.
2023-01-01 17:53:12 +01:00
Jonas Jenwald
0c1fb4e740 [api-minor] Remove the PDFDocumentProxy.stats getter (PR 15758 follow-up)
This was deprecated in PR 15758 and given that it's quite unlikely that any third-party users are relying on this functionality, since it was only ever added to support telemetry reporting in the Firefox PDF Viewer, it should hopefully be fine to remove this fairly quickly.

These changes reduce the bundle size of the Firefox PDF Viewer by 4.5 kB in total.
2023-01-01 17:06:47 +01:00
Jonas Jenwald
2c57a4232c [api-minor] Improve the useWorkerFetch default value checks
Given that the Fetch API only supports the http/https protocols, worker-thread fetching of CMaps and Standard-fonts may thus fail in certain cases. To improve the default behaviour we'll now also check that the `cMapUrl` and `standardFontDataUrl` options are appropriate, except in Firefox where this should always work.
2023-01-01 14:48:28 +01:00
Tim van der Meij
1e3e2defe4
Merge pull request #15878 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-01-01 14:44:41 +01:00
Tim van der Meij
195846a716
Bump versions in pdfjs.config 2023-01-01 14:35:58 +01:00
Tim van der Meij
3fd2a35482
Merge pull request #15874 from Snuffleupagus/progressBar-decouple-colors
Decouple the loadingBar `background-color` from the rest of the viewer
2022-12-31 15:14:59 +01:00
Jonas Jenwald
c791e01bfc
Merge pull request #15875 from Snuffleupagus/viewer-name-consistency
Improve name consistency in the viewer (PR 15812 follow-up)
2022-12-29 11:52:25 +01:00
Jonas Jenwald
88432a0e3f Improve name consistency in the viewer (PR 15812 follow-up)
This tweaks a few name that originated in PR 15812, to improve overall consistency:
 - Use the `drawingDelay` parameter-name in all methods that accept a delay.
 - Use the `postponeDrawing` variable-name in all relevant methods.
2022-12-28 13:26:01 +01:00
Jonas Jenwald
c2d17cac34 [GeckoView] Remove the progressBar CSS variables, since they're unused
Given that there's no loadingBar element present in the GeckoView-viewer, we shouldn't need CSS variables for it.
2022-12-28 12:14:22 +01:00
Jonas Jenwald
49c09eda9b Decouple the loadingBar background-color from the rest of the viewer
With upcoming background changes elsewhere in the viewer, this should be helpful in separating the styling of the loadingBar. These changes also means that both the "regular" and the "indeterminate" loadingBar now uses the same `background-color` value.

Also, shortens the related CSS variables a little bit since that can't hurt.
2022-12-28 12:07:39 +01:00
Jonas Jenwald
35ca6ab319
Merge pull request #15867 from Snuffleupagus/loadingIcon-toggle
Only display the loadingIcons when rendering is currently running
2022-12-27 13:51:20 +01:00
Jonas Jenwald
4224984525 Only display the pageNumber-loadingIcon when rendering is currently running
*This makes the same kind of changes as in the previous patch, but for the pageNumber-loadingIcon in the main toolbar.*

To display the pageNumber-loadingIcon when rendering starts, if the page is the most visible one, we'll utilize the existing "pagerender" event.
To toggle the pageNumber-loadingIcon as the user moves through the document we'll now instead utilize the "pagechanging" event, which should actually be slightly more efficient overall[1]. Note how we'd, in the old code, only consider the most visible page anyway when toggling the pageNumber-loadingIcon.

---
[1] Even in a PDF document as relatively short/simple as `tracemonkey.pdf`, scrolling through the entire document can easily trigger the "updateviewarea" event more than a thousand times.
2022-12-27 13:28:39 +01:00
Jonas Jenwald
a578571f59 Only display the page-loadingIcon when rendering is currently running
Given that we only render one page at a time, this will lead to only *one* page-loadingIcon being displayed at a time even if multiple pages are visible in the viewer. However, this will make it clearer which page is the currently parsing/rendering one.

To simplify toggling of the page-loadingIcon visibility, the existing `PDFPageView.renderingState` is changed into a getter/setter-pair with the latter also handling the page-loadingIcon state.
An additional benefit of these changes is that the `PDFViewer` no longer needs to handling toggling of page-loadingIcon visibility during rendering, since there can only ever be *one* page rendering.
Finally, this may also simplify future changes w.r.t. page-loadingIcon visibility toggling (using e.g. a show-timeout).
2022-12-27 13:28:39 +01:00
Jonas Jenwald
3110d1f29a
Merge pull request #15869 from Snuffleupagus/_abortOperatorList-clearTimeout
Always abort a pending `streamReader` cancel timeout in `PDFPageProxy._abortOperatorList` (PR 15825 follow-up)
2022-12-27 13:26:43 +01:00
Jonas Jenwald
1dce95613a
Merge pull request #15870 from Snuffleupagus/rm-PDFPageProxy-getJSActions-caching
Remove `PDFPageProxy.getJSActions` caching, since it's unused, in the API
2022-12-27 13:25:24 +01:00
Jonas Jenwald
ec6ad91bb7
Merge pull request #15872 from Snuffleupagus/PDFPageView-setDimensions-regression
[Regression] Ensure that documents with varying page sizes are initialized correctly (PR 15812 follow-up)
2022-12-27 13:24:06 +01:00
Jonas Jenwald
05169efec1 [Regression] Ensure that documents with varying page sizes are initialized correctly (PR 15812 follow-up)
The rotation-caching added in PR 15812 completely breaks initialization of PDF documents with varying page sizes, causing all pages to wrongly get the same size; see e.g. `sizes.pdf` from the test-suite.
To fix that without having to e.g. add a new parameter, which feels error prone, this patch changes the `PDFPageView.#setDimensions` method to completely ignore the rotation-caching until the `setPdfPage`-method has been called.
2022-12-27 12:14:42 +01:00
Jonas Jenwald
841abb53e6 Remove PDFPageProxy.getJSActions caching, since it's unused, in the API
Note how, in the scripting initialization in the viewer, we only ever invoke `PDFPageProxy.getJSActions` *once* per page in order to improve overall performance; see a575aa13b9/web/pdf_scripting_manager.js (L372-L375)

Hence it really shouldn't be necessary to cache its result in the API, especially when that is done *manually* rather than using something like `shadow`.
2022-12-27 10:39:33 +01:00
Jonas Jenwald
ae24dbd064 Always abort a pending streamReader cancel timeout in PDFPageProxy._abortOperatorList (PR 15825 follow-up)
When we're destroying a `PDFPageProxy`-instance, during full document destruction, we'll force-abort any worker-thread parsing of operatorLists. Hence we should make sure that any pending cancel timeout is always aborted, since a later `PDFPageProxy._abortOperatorList` call should always "replace" a previous one.

*Please note:* Technically this was always wrong, but with the changes in PR 15825 it became *ever so slightly* easier to trigger this thanks to the potentially longer timeout.
2022-12-27 10:19:39 +01:00