Commit Graph

16457 Commits

Author SHA1 Message Date
Calixte Denizet
0de804a256 [JS] Some functions (print, alert,...) must be called only after a user activation
- Some events, which require a user interaction, will allow those functions to be called.
But after few seconds, if there are no more user interaction, it won't be possible
anymore.
The idea is to give an opportunity to the user to leave the pdf.
- Disable print function when we're printing, the same with saving and disallow to save
on open events.
2022-10-28 18:52:07 +02:00
Jonas Jenwald
a7232339d8
Merge pull request #15637 from Snuffleupagus/Array-from-map
Combine `Array.from` and `Array.prototype.map` calls
2022-10-28 18:29:02 +02:00
Jonas Jenwald
ba05e47b3e Combine Array.from and Array.prototype.map calls
This isn't just a tiny bit more compact, but it also avoids an intermediate allocation; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#description
2022-10-28 13:46:30 +02:00
Jonas Jenwald
1e7274e9c6 [api-minor] Move the handling of unbalanced markedContent to the worker-thread (PR 15630 follow-up) 2022-10-27 11:14:54 +02:00
calixteman
27b251ac99
Merge pull request #15631 from calixteman/15627
[JS] Avoid to trigger a commit event on 'ENTER' when the textfield is multiline
2022-10-27 10:29:25 +02:00
Calixte Denizet
87f53b9cc9 [JS] Avoid to trigger a commit event on 'ENTER' when the textfield is multiline 2022-10-26 19:29:13 +02:00
Jonas Jenwald
05e5927c41
Merge pull request #15630 from Snuffleupagus/issue-15629
Prevent textLayer errors in documents with unbalanced beginMarkedContent/endMarkedContent operators (issue 15629)
2022-10-26 19:27:23 +02:00
Jonas Jenwald
980acddbfa Prevent textLayer errors in documents with unbalanced beginMarkedContent/endMarkedContent operators (issue 15629) 2022-10-26 18:35:48 +02:00
Calixte Denizet
9f95a14e91 [Form] Don't use field appearances when /NeedAppearances is set to true (bug 1796741)
When a form isn't changed, we used the appearances we had in the file, but when
/NeedAppearances is true, all the appearances have to be regenerated whatever they're.
2022-10-26 12:10:51 +02:00
calixteman
9a33a0fba9
Merge pull request #15623 from calixteman/editor_int_test
Fix editor tests on Windows
2022-10-26 11:31:07 +02:00
calixteman
00279d6e64
Merge pull request #15625 from calixteman/bug1797310
Fix font for the 'current view' entry in the secondary toolbar (bug 1797310)
2022-10-26 11:02:55 +02:00
Calixte Denizet
0996398372 Fix font for the 'current view' entry in the secondary toolbar (bug 1797310) 2022-10-26 10:49:23 +02:00
Calixte Denizet
2384fbcb89 Fix editor tests on Windows
- In #15373, we implemented copy/paste actions in using the system
clipboard.
For any reasons, on Windows, the clipboard doesn't contain the expected
data when the tests are ran in parallel, hence the tests which are
using the clipboard need to be ran sequentially.
- Make sure that we can paste after having copied.
2022-10-25 22:48:02 +02:00
Jonas Jenwald
098ca670d0
Merge pull request #15616 from Snuffleupagus/PdfManager-requestLoadedStream-return
Let the `PdfManager.requestLoadedStream` method return the stream
2022-10-25 11:39:01 +02:00
Jonas Jenwald
22225a1eaa
Merge pull request #15617 from Snuffleupagus/bug-1662416
Update the l10n-strings for the download-buttons (bug 1662416)
2022-10-24 19:18:30 +02:00
Jonas Jenwald
03775917db Update the l10n-strings for the download-buttons (bug 1662416)
According to https://bugzilla.mozilla.org/show_bug.cgi?id=1662416#c8
2022-10-24 18:29:44 +02:00
Jonas Jenwald
bcffbf74f3 Let the PdfManager.requestLoadedStream method return the stream
*This is very old code, and it could thus do with some simplification.*

Note how in the `src/core/worker.js` file we're combining both the `PdfManager.requestLoadedStream` and `PdfManager.onLoadedStream` methods in order to access the stream-data. This seems unnecessary, and it's simple enough to always let the `PdfManager.requestLoadedStream` method return the stream-data as well.
2022-10-24 17:00:48 +02:00
Jonas Jenwald
987062c302
Merge pull request #15581 from Snuffleupagus/rm-setTransform-catch
Revert "Avoid all rendering breaking completely when CanvasPattern.setTransform() is unsupported" (PR 13725 follow-up)
2022-10-22 14:09:43 +02:00
Jonas Jenwald
497edbd0ee Revert "Avoid all rendering breaking completely when CanvasPattern.setTransform() is unsupported" (PR 13725 follow-up)
PR 13725 was only intended as a temporary work-around, and it seems that we can now revert that.
 - Firefox 102 is the currently maintained ESR-branch, and the PDF.js project only supports the active one.
 - Node.js now works, thanks to the `node-canvas` package, and I've confirmed locally that following the STR in issue 13724 generates a correct image.
2022-10-22 10:58:51 +02:00
Jonas Jenwald
f5711fc385
Merge pull request #15606 from Snuffleupagus/issue-15604
Let `Lexer.getNumber` treat more invalid "numbers" as zero (issue 15604)
2022-10-21 17:23:55 +02:00
calixteman
5e045b8688
Merge pull request #15608 from calixteman/new_icons
Update icons (last and final update)
2022-10-21 12:46:40 +02:00
Calixte Denizet
80dfd5404f Update icons (last and final update) 2022-10-21 12:31:34 +02:00
Jonas Jenwald
71bd8b4de9 Let Lexer.getNumber treat more invalid "numbers" as zero (issue 15604)
In the referenced PDF document there are "numbers" which consist only of `-.`, and while that's obviously not valid Adobe Reader seems to handle it just fine.
Letting this method ignore more invalid "numbers" was suggested during the review of PR 14543, so let's simply relax our the validation here.
2022-10-20 22:36:15 +02:00
Jonas Jenwald
7dc16c237a
Merge pull request #15603 from Snuffleupagus/pr-15593-followup
Restore a weaker version of the /Pages dictionary /Count check for corrupt documents (PR 15593 follow-up)
2022-10-20 15:13:25 +02:00
Jonas Jenwald
e591378ff1 Restore a weaker version of the /Pages dictionary /Count check for corrupt documents (PR 15593 follow-up)
It appears that PR 15593 broke `issue12402`, and we thus need to partially restore the /Count check.
 I completely missed this when looking at the test-results for PR 15593, both locally and on the bots, since the `Driver._getLastPageNumber` method would "swallow" an unavailable page number.
2022-10-20 14:22:29 +02:00
Jonas Jenwald
36967fcedb
Merge pull request #15586 from Snuffleupagus/rm-matchesForCache
Remove the `Glyph.matchesForCache` method (PR 13494 follow-up)
2022-10-20 10:35:00 +02:00
Jonas Jenwald
f3949ba69d
Merge pull request #15598 from calixteman/15597
[Annotation] Replace use of id by data-element-id to have the correct id
2022-10-20 00:01:24 +02:00
Calixte Denizet
6db9cefaaf [Annotation] Replace use of id by data-element-id to have the correct id 2022-10-19 23:36:28 +02:00
calixteman
ba3a0e104a
Merge pull request #15595 from calixteman/1793419
[Editor] Make FreeText annotations visible for screen readers when in editing mode (bug 1793419)
2022-10-19 19:33:49 +02:00
Jonas Jenwald
238570c0da
Merge pull request #15596 from Snuffleupagus/issue-15594
Extend `getSupplementalGlyphMapForCalibri` with some umlauts (issue 15594)
2022-10-19 18:35:10 +02:00
Jonas Jenwald
3c046c0a21 Extend getSupplementalGlyphMapForCalibri with some umlauts (issue 15594) 2022-10-19 17:49:40 +02:00
Jonas Jenwald
e00a040a80
Merge pull request #15593 from Snuffleupagus/issue-9105-other
Relax the /Pages dictionary /Count check for corrupt documents (issue 9105)
2022-10-19 16:26:14 +02:00
Calixte Denizet
535c624e0d [Editor] Make FreeText annotations visible for screen readers when in editing mode (bug 1793419)
- When we're editing some annotations, keeping the role="text-box" make them visible
as editable and VoiceOver (Mac) is able to read the contents when they're focused;
- Add an attribute "aria-activedescendant" in order to make the content discoverable
by NVDA on Windows.
2022-10-19 16:21:04 +02:00
calixteman
cc450b405d
Merge pull request #15592 from calixteman/1794403
[Annotation] Take the border into account when computing the font size (bug 1794403)
2022-10-19 12:33:11 +02:00
Jonas Jenwald
bc13a277ce Relax the /Pages dictionary /Count check for corrupt documents (issue 9105)
After PR 14311, and follow-up patches, we no longer require that the /Count entry (in the /Pages dictionary) is either present or even valid in order to parse/render a PDF document.
Hence it seems strange to keep this requirement for *corrupt* PDF documents, when trying to find a usable `trailer` in the `XRef.indexObjects` method.
2022-10-19 12:28:25 +02:00
Calixte Denizet
69b01d4398 [Annotation] Take the border into account when computing the font size (bug 1794403) 2022-10-19 10:27:27 +02:00
Jonas Jenwald
fd35cda8bc Re-factor the glyph-cache lookup in the Font._charToGlyph method
With the changes in the previous patch we can move the glyph-cache lookup to the top of the method and thus avoid a bunch of, in *almost* every case, completely unnecessary re-parsing for every `charCode`.
2022-10-19 09:55:09 +02:00
Jonas Jenwald
3e391aaed9 Remove the Glyph.matchesForCache method (PR 13494 follow-up)
This method, and its class, was originally added in PR 4453 to reduce memory usage when parsing text. Then PR 13494 extended the `Glyph`-representation slightly to also include the `charCode`, which made the `matchesForCache` method *effectively* redundant since most properties on a `Glyph`-instance indirectly depends on that one. The only exception is potentially `isSpace` in multi-byte strings.

Also, something that I noticed when testing this code: The `matchesForCache` method never worked correctly for `Glyph`s containing `accent`-data, since Objects are passed by reference in JavaScript. For affected fonts, of which there's only a handful of examples in our test-suite, we'd fail to find an already existing `Glyph` because of this.
2022-10-19 09:54:35 +02:00
Jonas Jenwald
782d098baf
Merge pull request #15589 from Snuffleupagus/issue-15577
Fallback and try a *previous* generation if all else fails in `XRef.indexObjects` (issue 15577)
2022-10-19 09:44:18 +02:00
Jonas Jenwald
de99f99a01 Fallback and try a *previous* generation if all else fails in XRef.indexObjects (issue 15577)
When we fail to find a usable PDF document `trailer` *and* there were errors during parsing, try and fallback to a *previous* generation as a last resort during fetching of uncompressed references.
*Please note:* This will not affect "normal" PDF documents, with valid /XRef data, and even most *corrupt* documents should be completely unaffected by these changes.
2022-10-18 20:24:01 +02:00
calixteman
9355b72931
Merge pull request #15583 from calixteman/15582
[Editor] Commit the current editor before setting the new viewport
2022-10-17 12:56:21 +02:00
Calixte Denizet
6fb694658e [Editor] Commit the current editor before setting the new viewport 2022-10-17 11:58:29 +02:00
Tim van der Meij
54c97d295f
Merge pull request #15580 from Snuffleupagus/update-packages
Update packages and translations
2022-10-16 13:25:40 +02:00
Tim van der Meij
8bf56078c5
Merge pull request #15579 from Snuffleupagus/sidebar-notification-position
Tweak the vertical position of the sidebar notification icon
2022-10-16 13:21:11 +02:00
Jonas Jenwald
db215fe289 Update l10n files 2022-10-16 09:39:00 +02:00
Jonas Jenwald
7bd484ebd3 Update npm packages 2022-10-16 09:38:58 +02:00
Jonas Jenwald
0983ebb257 Tweak the vertical position of the sidebar notification icon
Given that the new sidebar icon is slightly shorter than the old one, it cannot hurt to ever so slightly tweak the vertical position of the notification icon.

(While the patch also changes the CSS rule used for the horizontal position, this is a no-op and was done to improve consistency between the two values.)
2022-10-15 22:19:24 +02:00
calixteman
e0cf25d109
Merge pull request #15578 from calixteman/15571
[Editor] Ink editors must have their dimensions in percents after having been resized
2022-10-15 20:59:24 +02:00
Calixte Denizet
9e2bc8853f [Editor] Ink editors must have their dimensions in percents after having been resized 2022-10-15 19:59:10 +02:00
Tim van der Meij
06599f487f
Merge pull request #15576 from Snuffleupagus/version
Re-factor the PDF version parsing in the worker-thread
2022-10-15 13:03:43 +02:00