Commit Graph

16903 Commits

Author SHA1 Message Date
Jonas Jenwald
2f2f1e5088 Revert "Update rimraf to version 4"
This reverts commit 32357e3d17.
2023-03-06 19:57:00 +01:00
calixteman
e11371c75f
Merge pull request #16110 from calixteman/norotate
[Annotation] Don't rotate an annotation when it has the NoRotate flag
2023-03-06 19:17:44 +01:00
Calixte Denizet
3849063d36 [Annotation] Don't rotate an annotation when it has the NoRotate flag 2023-03-06 17:27:11 +01:00
calixteman
652a6df62b
Merge pull request #16077 from calixteman/large_image
Render large images even if they're larger than the canvas limits (bug 1720282)
2023-03-05 15:38:51 +01:00
Calixte Denizet
05b0c9d7e6 Render large images even if they're larger than the canvas limits (bug 1720282)
The idea is to encode large image in BMP format (which is very simple and doesn't
require to compute any checksums) and then use createImageBitmap with a BMP blob
(which doesn't suffer of the Canvas/ImageData limits).
From a performance point of view, it isn't crazy (generating a large blob + decoding
it on the main thread is really not ideal) but at least we've something to display
which is a way better than a blank page (and one can notice that most of the time is
spent in decoding the image from the pdf stream).
2023-03-05 14:07:07 +01:00
Jonas Jenwald
d7e4be9cdb
Merge pull request #16107 from mozilla/dependabot/npm_and_yarn/minimist-1.2.7
Bump minimist from 1.2.5 to 1.2.7
2023-03-04 10:10:37 +01:00
dependabot[bot]
5cc65d193f
Bump minimist from 1.2.5 to 1.2.7
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-04 02:42:21 +00:00
Jonas Jenwald
4e52bcee44
Merge pull request #16103 from Snuffleupagus/rm-direct-PDFDataRangeTransport
[api-minor] Remove calling `getDocument` directly with a `PDFDataRangeTransport`-instance (PR 15943 follow-up)
2023-03-02 18:25:00 +01:00
Jonas Jenwald
ceec93c832
[api-minor] Remove calling getDocument directly with a PDFDataRangeTransport-instance (PR 15943 follow-up)
This was deprecated in PR 15943, which has now been included in two official PDF.js releases.
Given that `PDFDataRangeTransport` is somewhat unlikely to be used outside of the *built-in* Firefox PDF Viewer, it doesn't seem necessary to wait longer before removing this.

Also, removes the specific error-message for GENERIC builds to not unnecessarily "advertise" using non-objects when calling the `getDocument`-function.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-03-02 15:12:01 +01:00
calixteman
d4216264e8
Merge pull request #16062 from calixteman/create_image_in_worker
[api-minor] Generate images in the worker instead of the main thread.
2023-03-02 13:34:50 +01:00
Calixte Denizet
fd03cd5493 [api-minor] Generate images in the worker instead of the main thread.
We introduced the use of OffscreenCanvas in #14754 and this patch aims
to use them for all kind of images.
It'll slightly improve performances (and maybe slightly decrease memory use).
Since an image can be rendered in using some transfer maps but because of
OffscreenCanvas we don't have the underlying pixels array the transfer maps
stuff is re-implemented in using the SVG filter feComponentTransfer.
2023-03-01 17:40:12 +01:00
Jonas Jenwald
9640add1f7
Merge pull request #16100 from Snuffleupagus/getDocument-canvasFactory
[api-minor] Move the `canvasFactory` option into `getDocument`
2023-03-01 10:34:11 +01:00
Jonas Jenwald
f42a2e8451
[api-minor] Move the canvasFactory option into getDocument
Rather than repeatedly initializing a `canvasFactory`-instance for every page, move it to the document-level instead.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-03-01 09:07:16 +01:00
Jonas Jenwald
22c9970309
Merge pull request #16095 from Snuffleupagus/worker-isOffscreenCanvasSupported
Check `OffscreenCanvas` support once on the worker-thread
2023-02-28 08:25:50 +01:00
Jonas Jenwald
45c332110e
Check OffscreenCanvas support once on the worker-thread
Currently we repeat the `FeatureTest.isOffscreenCanvasSupported` checks all over the worker-thread code, and with upcoming changes this will become even "worse".

Hence this patch, which changes the *worker-thread* default value for the `isOffscreenCanvasSupported`-parameter to `false` and moves the feature-testing into the `BasePdfManager`-constructor.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-02-27 12:27:28 +01:00
Tim van der Meij
2da2ac492e
Merge pull request #16093 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-02-26 13:22:23 +01:00
Tim van der Meij
580180a720
Bump versions in pdfjs.config 2023-02-26 13:15:43 +01:00
Jonas Jenwald
af64149885
Merge pull request #16086 from mozilla/Snuffleupagus-textLayer-OffscreenCanvas
Use `OffscreenCanvas` as intended for all code-paths in `src/display/text_layer.js` (PR 15722 follow-up)
2023-02-24 22:40:18 +01:00
Jonas Jenwald
5075d0495b
Use OffscreenCanvas as intended for all code-paths in src/display/text_layer.js (PR 15722 follow-up)
Currently some `getCtx` calls will have `isOffscreenCanvasSupported === undefined` set, meaning that `OffscreenCanvas` isn't being used as intended, since no `TextLayerRenderTask._isOffscreenCanvasSupported` property exists.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-02-24 11:29:58 +01:00
calixteman
9c58d4f7f2
Merge pull request #16082 from calixteman/fix_class_in_path
[Acroform] Use the full path to find the node in the XFA datasets where to store the value
2023-02-23 13:38:54 +01:00
Calixte Denizet
3a21423386 [Acroform] Use the full path to find the node in the XFA datasets where to store the value
I noticed several 'Path not found' errors because of a field called #subform[2].
From the XFA specs, the hash is used for a class of elements in the template tree.
When we're looking for a node in the datasets tree, it doesn't make sense to search
for a class. Hence the path element starting with a hash are just skipped.
2023-02-23 12:09:39 +01:00
calixteman
e676c9388d
Merge pull request #16080 from calixteman/link_hcm
[a11y] Improve the visibility of link annotations in HCM
2023-02-22 20:31:51 +01:00
Calixte Denizet
a074525bfb [a11y] Improve the visibility of link annotations in HCM
In order to help to identify a link, we add a border around it with the LinkText color.
And backdrop colors are inverted when the mouse pointer hovers them, this way it should
help to identify the link where the pointer is.
2023-02-22 19:39:28 +01:00
Jonas Jenwald
3f33fbf8cf
Merge pull request #16079 from mozilla/Snuffleupagus-PDFObjects-bitmap
Move the `ImageBitmap` clean-up into the `PDFObjects` class
2023-02-22 13:51:12 +01:00
Jonas Jenwald
1b076b7a35
Move the ImageBitmap clean-up into the PDFObjects class
With upcoming changes we'll potentially start to cache `ImageBitmap` data at the document-level, in addition to just at the page-level.
Hence we need to ensure that such data is actually released on clean-up, and rather than duplicating the existing *manual* handling this code is instead moved into the `PDFObjects.clear` method. (In my opinion, this is an overall improvement even without globally cached `ImageBitmap` data.)

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it's correct and makes sense.
2023-02-21 12:00:45 +01:00
calixteman
534b22aec5
Merge pull request #16071 from calixteman/issue16067
[JS] Send a Validate action on change on Choice widget
2023-02-20 11:15:20 +01:00
Calixte Denizet
dca54c8f8a [JS] Send a Validate action on change on Choice widget 2023-02-19 16:33:05 +01:00
Tim van der Meij
255e982542
Merge pull request #16056 from Snuffleupagus/xfaLayer-on-top
Don't try to place the `xfaLayer` "on top" in regular PDF documents
2023-02-19 12:22:10 +01:00
Tim van der Meij
f2baa48608
Merge pull request #16055 from Snuffleupagus/deprecated-Node-Buffer
[api-minor] Deprecate providing binary data as `Buffer` in Node.js environments
2023-02-19 12:20:09 +01:00
Tim van der Meij
9fac676796
Merge pull request #16054 from Snuffleupagus/Driver-getDocument-cleanup
A little clean-up of the `getDocument` call in `test/driver.js`
2023-02-19 12:12:07 +01:00
calixteman
13af3f3442
Merge pull request #16065 from calixteman/issue16063
Don't replace an eol by a whitespace when the last char is a Katakana-Hiragana diacritic
2023-02-17 13:40:54 +01:00
Calixte Denizet
fc7d74385f Don't replace an eol by a whitespace when the last char is a Katakana-Hiragana diacritic 2023-02-16 11:31:58 +01:00
Jonas Jenwald
3c66b031e3 Don't try to place the xfaLayer "on top" in regular PDF documents
Given that we only create an `xfaLayer` in "pure" XFA-documents, this code can be moved into the appropriate branch instead.
2023-02-14 12:54:44 +01:00
Jonas Jenwald
b6ba8cc84a [api-minor] Deprecate providing binary data as Buffer in Node.js environments
The `Buffer`-object is Node.js specific functionality[1], thus (obviously) not found in browsers. Please note that the PDF.js library has never officially supported/documented that binary data can be passed as a `Buffer`, and that *internally* in the `src/core`-code we only work with standard `Uint8Array`s.
This means that if, in Node.js environments, a `Buffer` is passed to the API we need to wrap it into a `Uint8Array`, which essentially means creating a copy of the data and thus increasing memory usage.

---
[1] Refer to https://nodejs.org/api/buffer.html#buffer
2023-02-14 11:30:40 +01:00
Jonas Jenwald
df3b359280 Remove "else after return" from the getUrlProp/getDataProp helper functions
This helps readability of this code a little bit, in my opinion, and it's actually ever so slightly less code in the *built* `pdf.js` file.
2023-02-14 10:50:22 +01:00
Jonas Jenwald
0e840f1c39 A little clean-up of the getDocument call in test/driver.js
- Pass the `URL`-object directly to `getDocument`, since that's been supported since PR 13166.
 - Remove support for the `disableRange`-option in the test-manifest, since it's completely unused. Please note that it's originally added in PR 2719, however there's never actually been any reference tests using it (not even from the start).
   Given that the option is `false` by default everywhere (e.g. in the Firefox PDF Viewer) and that we have unit-tests for `disableRange = true`, it doesn't seem necessary to add new reference tests for it now.
2023-02-13 14:49:33 +01:00
Jonas Jenwald
546902df63
Merge pull request #16053 from Snuffleupagus/test-set-annotationStorage
Reduce duplication for reference tests with an `annotationStorage` entry
2023-02-13 11:56:12 +01:00
Jonas Jenwald
8026ed6b0a Reduce duplication for reference tests with an annotationStorage entry
Currently we duplicate the same code more than once in the `test/driver.js` file, which we can avoid by adding a new `AnnotationStorage` helper method instead.
2023-02-13 11:09:16 +01:00
Tim van der Meij
f66cbb0b5e
Merge pull request #16051 from Snuffleupagus/rm-PDFThumbnailViewer-eventBus
Remove the unused `eventBus` option in `PDFThumbnailViewer` (PR 15215 follow-up)
2023-02-12 19:29:52 +01:00
Jonas Jenwald
6985286300 Remove the unused eventBus option in PDFThumbnailViewer (PR 15215 follow-up)
This became unused with PR 15215, but I unfortunately forgot to remove it.
2023-02-12 18:38:31 +01:00
Tim van der Meij
22618213c7
Merge pull request #16040 from Snuffleupagus/arrayBuffersToBytes
Re-factor the `arraysToBytes` helper function (PR 16032 follow-up)
2023-02-12 11:47:57 +01:00
Jonas Jenwald
6d4d402a78 Move the arrayBuffersToBytes helper function into the worker-thread
Given that this helper function is only used on the worker-thread, there's no reason to duplicate it in both of the *built* `pdf.js` and `pdf.worker.js` files.
2023-02-11 21:34:37 +01:00
Tim van der Meij
25a6bc4e01
Merge pull request #16013 from Snuffleupagus/COMPONENTS-rm-inline-attachment-open
Remove inline opening of PDF attachments in the COMPONENTS build
2023-02-11 19:03:51 +01:00
Tim van der Meij
ddf05b0795
Merge pull request #16028 from Snuffleupagus/move-CHROME-rewriteUrlClosure
Move `rewriteUrlClosure` into the `web/chromecom.js` file
2023-02-11 19:02:32 +01:00
Tim van der Meij
3daf4274e8
Merge pull request #16045 from Snuffleupagus/viewer-initializeOptions
Slightly re-factor preferences/options initialization in the viewer
2023-02-11 19:01:31 +01:00
Tim van der Meij
ec4c84176f
Merge pull request #16047 from Snuffleupagus/BasePdfManager-args
Improve the consistency between the `LocalPdfManager`/`NetworkPdfManager` constructor
2023-02-11 18:58:29 +01:00
Tim van der Meij
5c3017b6ae
Merge pull request #16048 from Snuffleupagus/update-Stylelint
Update Stylelint to version 15
2023-02-11 18:49:52 +01:00
Jonas Jenwald
5023a41fb7 Update Stylelint to version 15
Notably this obsoletes the `stylelint-config-prettier` package; please see https://github.com/stylelint/stylelint/blob/main/docs/migration-guide/to-15.md for additional details.
2023-02-11 14:41:32 +01:00
Tim van der Meij
fd1c9e34ac
Merge pull request #16046 from Snuffleupagus/update-packages
Update packages and translations
2023-02-11 14:10:09 +01:00
Jonas Jenwald
18042163ce Improve the consistency between the LocalPdfManager/NetworkPdfManager constructor
Currently these classes take a bunch of parameters (somewhat randomly ordered), probably because this is very old code that's been extended over the years.
Hence this patch changes the constructors to use parameter-objects instead, which improves consistency and (slightly) reduces the amount of code as well.

*Please note:* Also removes the `msgHandler`-property on these classes, since I cannot find a single call-site that accesses it.
2023-02-11 13:39:52 +01:00