Commit Graph

17765 Commits

Author SHA1 Message Date
calixteman
4735ed8f16
Merge pull request #16776 from calixteman/gv_print_or_save
[GeckoView] Allow to query pdf.js to know if we can avoid to print a pdf (bug 1846296)
2023-08-01 15:21:10 +02:00
Calixte Denizet
8bd4a18190 [GeckoView] Allow to query pdf.js to know if we can avoid to print a pdf (bug 1846296) 2023-08-01 15:15:04 +02:00
Jonas Jenwald
64e8557fb5 [api-minor] Deprecate the PDFDocumentProxy.getJavaScript method
This method is very old, however with the exception of the auto-print hack (when scripting is disabled) in the viewer it's never actually been used.

Most likely the idea with `PDFDocumentProxy.getJavaScript` was that it'd be useful if scripting support was added, however it turned out that it was a bit too simplistic and instead a number of new methods were added for the scripting use-cases.
2023-08-01 09:02:05 +02:00
calixteman
5b8f680480
Merge pull request #16029 from calixteman/bug1815196
[api-minor] Don't print hidden annotations (bug 1815196)
2023-07-31 20:14:43 +02:00
Calixte Denizet
71960bea64 Don't print hidden annotatons (bug 1815196)
and handle correctly the NoView and NoPrint flags when they're changed
from JS.
2023-07-31 13:04:15 +02:00
calixteman
ce9f94848c
Merge pull request #16773 from calixteman/editor_stamp_input_filter
[Editor] Limit image types to the ones supported by the browser (bug 1846230)
2023-07-31 11:06:21 +02:00
Calixte Denizet
f2bf0ccc4f [Editor] Limit image types to the ones supported by the browser (bug 1846230) 2023-07-31 11:01:28 +02:00
Jonas Jenwald
0e6d141edf
Merge pull request #16771 from Snuffleupagus/gv-dialog-css-vars
[GeckoView] Add missing CSS variables for the dialog functionality
2023-07-30 19:45:09 +02:00
calixteman
621c92dbdd
Merge pull request #16766 from calixteman/fix_willprint
Make sure WillPrint ran before starting printing
2023-07-30 18:37:26 +02:00
Jonas Jenwald
ffb932b84a [GeckoView] Add missing CSS variables for the dialog functionality
Without this patch the password dialog is pretty difficult to use in the GeckoView-viewer, because of a number of missing CSS variables.

*Please note:* This patch makes no effort at actually styling the dialog to better suite the overall look of the GeckoView-viewer, but focuses solely on making it actually usable (since password protected PDF documents are somewhat rare).
2023-07-30 17:23:21 +02:00
Jonas Jenwald
02aa561003 Ensure that the password dialog is always closed with the document
If the current PDF document is closed while the password dialog is open, e.g. manually by calling `PDFViewerApplication.close()` from the console, the password dialog wouldn't be closed as intended.

*Please note:* This could only affect the GENERIC viewer, although it's very unlikely to ever happen, since that's the only one that supports opening more than one PDF document.
2023-07-30 17:13:39 +02:00
Tim van der Meij
f7155ad8fa
Merge pull request #16770 from Snuffleupagus/fix-baseVersion
Fix typo in the `baseVersion` commit hash (PR 16769 follow-up)
2023-07-30 16:58:53 +02:00
Jonas Jenwald
1ca3bbd2b6 Fix typo in the baseVersion commit hash (PR 16769 follow-up)
Looking at the demo-viewer I noticed that the version number seems to be stuck at version `3.10.0` despite a couple of PRs having landed since the version bump in PR 16769.

Searching for the current `baseVersion` doesn't find an actual commit, see https://github.com/search?q=repo%3Amozilla%2Fpdf.js+1ef6fbc525856318e78a6035b200ba1c6ec02d491&type=commits

However, looking at the commit hash it seems to be too long and removing the trailing `1` appears to fix things; see https://github.com/search?q=repo%3Amozilla%2Fpdf.js+1ef6fbc525856318e78a6035b200ba1c6ec02d49&type=commits
2023-07-30 15:21:49 +02:00
calixteman
7bdd3491b0
Merge pull request #16767 from calixteman/color_storage
Add the color changes in the annotation storage
2023-07-30 15:17:27 +02:00
Calixte Denizet
d16d1f0d23 Add the color changes in the annotation storage 2023-07-30 14:03:27 +02:00
Tim van der Meij
8ad0f08099
Merge pull request #16769 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-07-30 13:17:48 +02:00
Tim van der Meij
445ffa920a
Bump versions in pdfjs.config 2023-07-30 13:13:09 +02:00
Calixte Denizet
8439e11160 Make sure WillPrint ran before starting printing 2023-07-30 12:38:46 +02:00
Tim van der Meij
1ef6fbc525
Merge pull request #16768 from Snuffleupagus/pr-15335-followup
Ensure that failing to open the password dialog once won't permanently disable it (PR 15335 follow-up)
2023-07-30 12:18:49 +02:00
Jonas Jenwald
930cbc4d27 Make the passwordCapability field, in WorkerTransport, actually private as intended 2023-07-30 11:45:35 +02:00
Jonas Jenwald
81dfa61777 Ensure that failing to open the password dialog once won't permanently disable it (PR 15335 follow-up)
*Please note:* This situation should never happen in practice, but it nonetheless cannot hurt to fix this.

If the `PasswordPrompt.open` method would ever be called synchronously back-to-back *and* if opening of the dialog fails the first time, then the second invocation would remain pending indefinitely since we just clear out the capability.
2023-07-30 08:46:11 +02:00
Tim van der Meij
7ae5a0fef7
Merge pull request #16731 from Snuffleupagus/rm-useOnlyCssZoom
[api-minor] Replace the `useOnlyCssZoom` option with `maxCanvasPixels = 0` instead (PR 16729 follow-up)
2023-07-29 14:07:45 +02:00
Jonas Jenwald
0ee2a352ec [api-minor] Replace the useOnlyCssZoom option with maxCanvasPixels = 0 instead (PR 16729 follow-up)
Given that the `useOnlyCssZoom` option is essentially just a special-case of the `maxCanvasPixels` functionality, we can combine the two options in order to simplify the overall implementation.
Note that the `useOnlyCssZoom` functionality was only ever used, by default, in the PDF Viewer for the B2G/FirefoxOS project (which was abandoned years ago).
2023-07-29 13:58:03 +02:00
Tim van der Meij
2a77f0877c
Merge pull request #16765 from Snuffleupagus/bug-858128-test
Add an `eq` test for bug 858128
2023-07-29 13:48:30 +02:00
Tim van der Meij
aea13b4478
Merge pull request #16744 from Snuffleupagus/app-small-simplifications
A few small `web/app.js` simplifications
2023-07-29 13:41:01 +02:00
Jonas Jenwald
69a9d777d7 Add an eq test for bug 858128
The ten year old bug 858128 was recently fixed upstream, see https://bugzilla.mozilla.org/show_bug.cgi?id=858128#c25, and it seems like a good idea for us to add a test-case to help catch any future regressions here.
2023-07-29 12:37:58 +02:00
calixteman
cfd179f23f
Merge pull request #16163 from Snuffleupagus/bug-1810111
[GeckoView] Bundle the Firefox printing code in the viewer (bug 1810111)
2023-07-28 14:28:57 +02:00
Jonas Jenwald
e77c7f336d [GeckoView] Bundle the Firefox printing code in the viewer (bug 1810111)
This may not be enough, on its own, to completely fix [bug 1810111](https://bugzilla.mozilla.org/show_bug.cgi?id=1810111) however it's impossible for printing to work in GeckoView without this patch.
2023-07-28 14:10:40 +02:00
calixteman
0b715e2a73
Merge pull request #16762 from calixteman/editor_focus
[Editor] When an editor is unselected give the focus to the current page
2023-07-27 21:31:24 +02:00
Calixte Denizet
9d576d5097 [Editor] When an editor is unselected give the focus to the current page
Follow-up of #16756.
2023-07-27 21:12:26 +02:00
Jonas Jenwald
0ad5a5551a
Merge pull request #16760 from Snuffleupagus/issue-16759
Avoid eagerly matching "trailer"-strings when searching for incomplete objects in `XRef.indexObjects` (issue 16759, PR 15854 follow-up, bug 1845762)
2023-07-27 18:39:50 +02:00
Jonas Jenwald
d6c0950389 Avoid eagerly matching "trailer"-strings when searching for incomplete objects in XRef.indexObjects (issue 16759, PR 15854 follow-up, bug 1845762)
When searching for "endobj"-operators, make sure that we don't accidentally match a "trailer"-string in /Content-streams without /Filter-entries (i.e. streams that contain "raw" and thus human-readable data).
2023-07-27 17:57:12 +02:00
Jonas Jenwald
5560643597
Merge pull request #16758 from Snuffleupagus/cMapUrl-standardFontDataUrl-validation
Tweak the `useWorkerFetch` default value checks (PR 15879 follow-up)
2023-07-27 17:52:57 +02:00
calixteman
8679199a2f
Merge pull request #16756 from calixteman/editor_blur_unselected
[Editor] Blur unselected editors
2023-07-27 16:57:20 +02:00
Jonas Jenwald
c09bd5568c Tweak the useWorkerFetch default value checks (PR 15879 follow-up)
Currently we accidentally accept `cMapUrl` and `standardFontDataUrl` parameters that are empty strings or `null`, since e.g. `new URL(null, document.baseURI)` doesn't throw, when validating the `useWorkerFetch` parameter via the `isValidFetchUrl` helper function.
Please note that we are currently failing gracefully in this case, as intended, however the warning-messages printed in the console are perhaps less helpful without this patch.
2023-07-27 16:26:39 +02:00
Calixte Denizet
59bcfd9b9e [Editor] Blur unselected editors
When an editor is selected in using the keyboard then it has the focus.
But then if the editor is unselected with Escape key then the focus must
be removed otherwise we still have a blue outline around it.
And add few missing timeout in the integration tests.
2023-07-27 16:26:38 +02:00
Jonas Jenwald
611acf52c4
Merge pull request #16755 from Snuffleupagus/_keyboardManager-proto
[Editor] Reduce a bit of duplication on `_keyboardManager` initialization
2023-07-27 12:43:11 +02:00
Jonas Jenwald
2fbfd9517f Remove the unneeded error-handling at the end of PDFViewerApplication.run
This is quite old code, however the error-handling no longer seems necessary for a couple of reasons:
 - The `PDFViewerApplication.open` method is asynchronous, which means that it cannot throw a "raw" `Error` and the try-catch is not needed in that case.
 - None of the other affected methods should throw, and if they do that'd rather indicate an *implementation* error in the code.
 - Finally, and most importantly, with the `PDFViewerApplication.run` method now being asynchronous an (unlikely) `Error` thrown within it will lead to a rejected `Promise` and not affect execution of other code.
2023-07-27 12:14:14 +02:00
Jonas Jenwald
ecf95e552f Simplify handling of any ViewHistory errors during document loading in the viewer
We can use modern JavaScript features, in this case optional chaining, to (ever so slightly) simplify how `ViewHistory` errors are handled.

Also, use arrow functions when handling a few other (very rare) errors during loading since that's a tiny bit shorter.
2023-07-27 12:12:19 +02:00
Jonas Jenwald
34f2e7d4f9 [Editor] Reduce a bit of duplication on _keyboardManager initialization
The way that the callback-methods are specified feels unnecessarily verbose, however we can introduce a short-hand to improve this.

Also, adds a couple of new-lines to improve overall readability.
2023-07-27 11:42:01 +02:00
calixteman
82faae26c0
Merge pull request #16750 from calixteman/editor_keeboard_freetext
[Editor] Add the possibility to move an empty freetext editor with the keyboard (bug 1845088)
2023-07-27 11:38:17 +02:00
Jonas Jenwald
ef776eaacd
Merge pull request #16753 from Snuffleupagus/eslint-prefer-ternary
Enable the `unicorn/prefer-ternary` ESLint plugin rule
2023-07-27 10:39:12 +02:00
Calixte Denizet
93b09f6320 [Editor] Add the possibility to move an empty freetext editor with the keyboard (bug 1845088) 2023-07-27 09:56:26 +02:00
Jonas Jenwald
c0fe96b8fe Additional *manual* unicorn/prefer-ternary changes
Not all cases could be automatically fixed, and the changes also triggered a number of `prefer-const` errors that needed to be handled manually.
2023-07-27 09:48:24 +02:00
Jonas Jenwald
674e7ee381 Enable the unicorn/prefer-ternary ESLint plugin rule
To limit the readability impact of these changes, the `only-single-line` option was used; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md

These changes were done automatically, using the `gulp lint --fix` command.
2023-07-27 09:18:26 +02:00
calixteman
8f83a1359e
Merge pull request #16749 from calixteman/editor_mac_shortcut
[Editor] Use the same keyboard shortcut as in Preview to move an editor on mac
2023-07-26 21:40:20 +02:00
Calixte Denizet
9078587422 [Editor] Use the same keyboard shortcut as in Preview to move an editor on mac 2023-07-26 21:23:38 +02:00
calixteman
7f634e468f
Merge pull request #16746 from calixteman/editor_keyboard_movable
[Editor] Make editors movable in using the keyboard (bug 1845088)
2023-07-26 21:17:15 +02:00
Calixte Denizet
bb6936c931 [Editor] Make editors movable in using the keyboard (bug 1845088)
Selected editors can be moved in using the arrows:
 - up/down/left/right will move the editors of 1 in page unit;
 - ctrl (or meta)+up/down/left/right will move them of 10 in page unit.
2023-07-26 21:05:26 +02:00
calixteman
a2eca47ed1
Merge pull request #16748 from calixteman/hcm_toolbar_button
Improve rendering of buttons in the toolbar in HCM (bug 1845515)
2023-07-26 17:20:38 +02:00