Commit Graph

17469 Commits

Author SHA1 Message Date
Jonas Jenwald
32964db6ef
Merge pull request #16504 from wojtekmaj/fix-canvasMaxAreaInBytes
Fix canvasMaxAreaInBytes type
2023-06-01 17:28:24 +02:00
Wojciech Maj
1add9bc131
Fix canvasMaxAreaInBytes type
Fixes #16503
2023-06-01 15:41:43 +02:00
calixteman
1ef918239c
Merge pull request #16501 from calixteman/issue16500
Try to not omit some values when printing a choice list with several selected items
2023-06-01 12:05:58 +02:00
Calixte Denizet
0e610cab04 Try to not omit some values when printing a choice list with several selected items 2023-05-31 21:17:22 +02:00
calixteman
a2118f52b0
Merge pull request #16494 from calixteman/save_more_info_for_ink
[Editor] Add few more info when saving ink data (thickness, opacity, …)
2023-05-31 15:56:45 +02:00
Calixte Denizet
133d103186 [Editor] Add few more info when saving ink data (thickness, opacity, ...)
Fix the InkList entry: the coordinates were relative to the page and not
to the bounding box of the annotation.
2023-05-31 15:43:07 +02:00
Jonas Jenwald
c60a3ce96a [api-minor] Update the minimum supported Google Chrome version to 92
This patch updates the minimum supported browsers as follows:
 - Google Chrome 92, which was released on 2021-07-20; see https://support.google.com/chrome/a/answer/10314655

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2023-05-31 11:03:39 +02:00
Jonas Jenwald
d3c0928121 Use the Util.getAxialAlignedBoundingBox helper function more
There's a couple of spots in the code-base that effectively re-implement this helper function, which seems like unnecessary repetition.
2023-05-31 09:32:19 +02:00
Jonas Jenwald
e8c727742c Limit some PDFRenderingQueue-related code to the GENERIC viewer
Given that this functionality is only relevant in third-party use-cases, for example the viewer-components, we can avoid needlessly including it in e.g. the MOZCENTRAL build.
2023-05-30 21:24:19 +02:00
Tim van der Meij
071e6bc7e7
Merge pull request #16489 from timvandermeij/puppeteer
Update Puppeteer to version 20
2023-05-29 18:56:10 +02:00
Tim van der Meij
ca620e4cc9
Update Puppeteer to version 20
This commit makes the following required changes:

- Replace custom cache trimming logic in favor of the (per our request)
  newly added `trimCache` method in Puppeteer. Not only does this greatly
  simplify our code and prevents having to import Puppeteer internals,
  it's also necessary because Puppeteer 20 removed the `BrowserFetcher`
  API in favor of the new separate `@puppeteer/browsers` package.
- Start browsers in series instead of in parallel. Parallel browser
  starts broke since Puppetter 19.1.0 and it turns out that it has never
  been supported officially, so it worked more-or-less by accident.
  Starting browsers in series is the supported way, is almost equally
  fast and ensures that we avoid any race conditions during startup.
  Finally, it also allows us to remove the `browserPromise` state on our
  session objects.

Fixes #15865.
2023-05-29 15:45:24 +02:00
Tim van der Meij
7f6f33da3c
Merge pull request #16487 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-05-29 14:23:44 +02:00
Tim van der Meij
1096e69879
Bump versions in pdfjs.config 2023-05-29 14:16:43 +02:00
Tim van der Meij
036f855dca
Merge pull request #16484 from Snuffleupagus/PDFSidebar-onUpdateThumbnails
Re-factor updating of thumbnails in the `PDFSidebar`-class
2023-05-29 12:56:24 +02:00
calixteman
f06d0b2a9e
Merge pull request #16483 from calixteman/bug1529502
[OTS] Remove cntrmask instruction with no stem in charstring (bug 1529502)
2023-05-28 20:42:59 +02:00
Calixte Denizet
78e6020a6e [OTS] Remove cntrmask instruction with no stem in charstring (bug 1529502) 2023-05-28 19:03:37 +02:00
Jonas Jenwald
c4c8227d20 Re-factor updating of thumbnails in the PDFSidebar-class
This patch does two things:
 - Moves the updating of thumbnails into `web/app.js`, via a new `PDFSidebar` callback-function, to avoid having to include otherwise unnecessary parameters when initializing a `PDFSidebar`-instance.
 - Only attempt to generate thumbnail-images from pages that are *cached* in the viewer. Note that only pages that exist in the `PDFPageViewBuffer`-instance can be rendered, hence it's not actually meaningful to check every single page when updating the thumbnails.
   For large documents, with thousands of pages, this should be a tiny bit more efficient when e.g. opening the sidebar since we no longer need to check pages that we know have not been rendered.
2023-05-28 17:54:34 +02:00
Jonas Jenwald
0e604f8f42 Use local variables more in PDFViewerApplication._initializeViewerComponents 2023-05-28 15:33:23 +02:00
Tim van der Meij
60feb2d5b6
Merge pull request #16470 from Snuffleupagus/thumbnailrendered-event
Introduce a "thumbnailrendered" event to simplify cleanup after thumbnail rendering (PR 12613 follow-up)
2023-05-28 14:15:24 +02:00
Tim van der Meij
9b3e1d41ae
Merge pull request #16481 from Snuffleupagus/update-packages
Update packages and translations
2023-05-28 14:12:32 +02:00
Jonas Jenwald
b51bbdf055 Update l10n files 2023-05-28 09:44:15 +02:00
Jonas Jenwald
0e129c9e5e Update npm packages 2023-05-28 09:39:34 +02:00
Jonas Jenwald
bc8523ac29 Introduce a "thumbnailrendered" event to simplify cleanup after thumbnail rendering (PR 12613 follow-up)
The way that the cleanup was implemented in PR 12613 has always bothered me slightly, since the `isPageCached`-method that I introduced there always felt quite out-of-place in the `IPDFLinkService`-implementations.
By introducing a new "thumbnailrendered" event, similar to the existing "pagerendered" one, we're able to move the cleanup handling into the `PDFViewer`-class instead.
2023-05-26 15:30:22 +02:00
Jonas Jenwald
6d8810b55c
Merge pull request #16479 from Snuffleupagus/PDFFindController-onIsPageVisible
Re-factor the `isPageVisible`-handling in the find-controller (PR 10217 follow-up)
2023-05-26 15:25:55 +02:00
Jonas Jenwald
d0bf505312 Re-factor the isPageVisible-handling in the find-controller (PR 10217 follow-up)
The way that this was implemented in PR 10217 has always bothered me slightly, since the `isPageVisible`-method that I introduced there always felt quite out-of-place in the `IPDFLinkService`-implementations.
Hence this is instead replaced by a callback-function in `PDFFindController`, to handle the page-visibility checks. Note that since the `PDFViewer`-constructor always sets this callback-function, e.g. the viewer-component examples still work as-is.
2023-05-26 13:59:39 +02:00
calixteman
cbc4b20b12
Merge pull request #16474 from calixteman/issue16473
Reset the formatted value when after a text field has been modified
2023-05-26 10:43:40 +02:00
Calixte Denizet
be5db13005 Reset the formatted value when after a text field has been modified 2023-05-26 10:17:14 +02:00
Jonas Jenwald
2bf68f3c7f
Merge pull request #16472 from calixteman/issue16471
Extract all the text of text annotations
2023-05-26 09:33:48 +02:00
Calixte Denizet
35a58ed987 Extract all the text of text annotations 2023-05-25 23:11:42 +02:00
Jonas Jenwald
2890c464da
Merge pull request #16466 from Snuffleupagus/gv-rm-Toolbar-stub
[GeckoView] Remove the `Toolbar`-stub since the viewer has an actual toolbar now
2023-05-25 22:23:10 +02:00
calixteman
8d5da54cd5
Merge pull request #16467 from calixteman/non_null_ultimate
Avoid to have a null fallback if none has been provided
2023-05-24 17:00:14 +02:00
Jonas Jenwald
ba654343e1
Merge pull request #16451 from Snuffleupagus/Wingdings
Attempt to improve non-embedded Wingdings font support (bug 1652224)
2023-05-24 16:04:12 +02:00
Jonas Jenwald
5a7beb9f30 Attempt to improve non-embedded Wingdings font support (bug 1652224)
Now that font-substitution has been implemented, we should be able to do much a better job at supporting non-embedded Wingdings fonts.
Given that this is a Windows-specific font, see https://en.wikipedia.org/wiki/Wingdings, this is however not guaranteed to work (well) on other platforms.
2023-05-24 14:59:13 +02:00
Calixte Denizet
7dce0a27f6 Avoid to have a null fallback if none has been provided 2023-05-24 14:44:36 +02:00
Jonas Jenwald
76ca395c32 [GeckoView] Remove the Toolbar-stub since the viewer has an actual toolbar now 2023-05-24 12:31:27 +02:00
Jonas Jenwald
daa48e5305
Merge pull request #16465 from Snuffleupagus/issue-16464
Ignore named encoding for non-embedded symbol fonts (issue 16464)
2023-05-24 11:56:59 +02:00
Jonas Jenwald
aeed6f2b67 Ignore named encoding for non-embedded symbol fonts (issue 16464)
The affected font is non-embedded ZapfDingbats, however the PDF document for some inexplicable reason specifies the encoding as "WinAnsiEncoding" (which is obviously wrong).
To work-around this bug in the PDF generator, we'll simply ignore any explicitly specified named encoding for non-embedded symbol fonts.
2023-05-24 10:48:47 +02:00
Jonas Jenwald
a6f9505a39
Merge pull request #16461 from Snuffleupagus/issue-16454
Improve "EI" detection in inline images (PR 12028 follow-up, issue 16454)
2023-05-23 22:23:22 +02:00
calixteman
1886012874
Merge pull request #16462 from calixteman/last_elem_TJ
Take into account the final space if any in the TJ command
2023-05-23 21:26:58 +02:00
calixteman
7cfe00a190
Merge pull request #16445 from calixteman/smoothing
[Editor] Improve curve smoothing for Ink tool (bug 1789443)
2023-05-23 19:20:24 +02:00
Calixte Denizet
d2b4ed3cea [Editor] Improve curve smoothing for Ink tool (bug 1789443)
- Remove the dependency on fit-curve;
- Improve the way to draw the current line in using a Path2D and
  in clearing only the last part of the curve instead of clearing
  all the canvas;
- Smooth the curve when drawing to avoid to have some changes after
  the drawing ends;
- Make the smoothing a bit less agressive.
2023-05-23 17:15:21 +02:00
Calixte Denizet
a76a69e1ed Take into account the final space if any in the TJ command
The final space was just ignored and that led to wrongly position
the next chunk of text.
2023-05-23 17:09:32 +02:00
Jonas Jenwald
dfbbb8c0ac Improve "EI" detection in inline images (PR 12028 follow-up, issue 16454)
Given that inline images may contain "EI"-sequences in the image-data itself, actually finding the end-of-image operator isn't always straightforward.
Here we extend the implementation from PR 12028 to potentially check all of the following bytes, rather than stopping immediately. While we have fairly decent test-coverage for this code, whenever you're changing it there's unfortunately a slightly higher than normal risk of regressions. (You'd really wish that PDF generators just stop using inline images.)
2023-05-23 17:04:51 +02:00
calixteman
094fb3c783
Merge pull request #16453 from calixteman/gv_telemetry
[GeckoView] Add some telemetry for the toolbar buttons (bug 1829216)
2023-05-22 17:08:43 +02:00
Calixte Denizet
7f1e8d1920 [GeckoView] Add some telemetry for the toolbar buttons (bug 1829216) 2023-05-22 16:43:09 +02:00
calixteman
1c4e4b4092
Merge pull request #16450 from calixteman/issue16300
Sanitize the glyph bounding box
2023-05-21 17:40:36 +02:00
Calixte Denizet
ca12bca276 Sanitize the glyph bounding box
- if the contours count is lower than -1, the glyph is really likely wrong
so just remove it from the font;
- if a contour has the repeat flag then repeats count mustn't be 0.
2023-05-21 16:24:41 +02:00
Tim van der Meij
d09c27d231
Merge pull request #16449 from Snuffleupagus/attachments-viewer-rm-sort
Stop trying to sort the attachments in the sidebar
2023-05-21 12:25:28 +02:00
Jonas Jenwald
14fd59c4d0 Stop trying to sort the attachments in the sidebar
Looking at the behaviour in Adobe Reader it doesn't appear that attachments are sorted alphabetically, hence it doesn't seem necessary for us to do so either in the viewer.
An additional benefit of *not* sorting the attachments is that any "actual" attachments are now always placed at the top of the list in the sidebar, and if any `FileAttachment`-annotations exist in the document they will now be appended at the end.
2023-05-21 09:54:24 +02:00
calixteman
65e23432cd
Merge pull request #16448 from calixteman/improve_rescaleandstroke
Improve performance of canvas::rescaleAndStroke by around 30% (bug 1135277)
2023-05-20 21:06:40 +02:00