Commit Graph

11527 Commits

Author SHA1 Message Date
Jonas Jenwald
d7d1f23826 Zero the width/height of the temporary canvas used during TextLayer rendering
The default size of these canvases seem to be `300 x 150` (two orders of magnitude larger than the ones in PR 10597), which probably is sufficient enough to matter since there's one such canvas for each textLayer that's rendered in the viewer.

Also fixes the incorrect rejection reason, i.e. one using a string rather than an `Error`, in the `TextLayerRenderTask.cancel` method.
2019-03-01 04:05:37 +01:00
Brendan Dahl
34022d2fd1
Merge pull request #10591 from brendandahl/fix-charset
Add unique glyph names for CFF fonts.
2019-02-28 17:22:29 -08:00
Tim van der Meij
9559d57636
Merge pull request #10595 from Snuffleupagus/JpegDecode-zero-tmpCanvas
Zero the width/height of the temporary canvas used during `JpegDecode` (issue 10594)
2019-02-28 23:41:22 +01:00
Tim van der Meij
39fa26ea33
Merge pull request #10597 from Snuffleupagus/isFontSubpixelAAEnabled-canvas-cleanup
Ensure that the temporary canvas created in `CanvasGraphics.isFontSubpixelAAEnabled` will be cleared
2019-02-28 23:37:24 +01:00
Tim van der Meij
85537fac4d
Merge pull request #10599 from Snuffleupagus/upgrade-webpack
Update Webpack to the latest stable version (4.29.6)
2019-02-28 23:32:29 +01:00
Tim van der Meij
af5597b7e5
Merge pull request #10573 from Snuffleupagus/type3-avoid-truncation
Avoid truncating/breaking some Type3 glyphs in `compileType3Glyph` (bug 1245391, issue 10568)
2019-02-28 23:25:45 +01:00
Jonas Jenwald
5750a7e557 Update Webpack to the latest stable version (4.29.6) 2019-02-28 14:27:43 +01:00
Jonas Jenwald
0f24bb73a6 Revert "Try to *temporarily* hack around the __non_webpack_require__ bug (issue 10177)"
This reverts commit 6f67e39a0a, since the regressing bug was fixed upstream.
2019-02-28 14:26:14 +01:00
Jonas Jenwald
b61b4d3229 Ensure that the temporary canvas created in CanvasGraphics.isFontSubpixelAAEnabled will be cleared
While this particular canvas may be small, there can still be an arbitrarily large number of them (one per page rendered), which can/will eventually add up memory wise. This can be easily avoided by using the `cachedCanvases` abstraction instead, which will ensure that the `isFontSubpixelAAEnabled` canvas is removed together with other temporary canvases in `CanvasGraphics.endDrawing`.
2019-02-28 14:18:38 +01:00
Jonas Jenwald
4687cc85ac Zero the width/height of the temporary canvas used during JpegDecode (issue 10594) 2019-02-28 12:23:34 +01:00
Brendan Dahl
8a596ef5d5 Add unique glyph names for CFF fonts.
Printing on MacOS was broken with the previous approach of just mapping
all the glyphs to notdef.
2019-02-27 15:00:29 -08:00
Tim van der Meij
21d70b19c2
Merge pull request #10585 from Snuffleupagus/cmap-fetch
Load built-in CMap files using the Fetch API when possible
2019-02-27 23:45:20 +01:00
Jonas Jenwald
f664e074c9 Avoid using the Fetch API, in GENERIC builds, for unsupported protocols (issue 10587) 2019-02-27 13:04:20 +01:00
Jonas Jenwald
cbc07f985b Load built-in CMap files using the Fetch API when possible 2019-02-27 13:04:19 +01:00
Tim van der Meij
df7756d2a4
Merge pull request #10589 from Snuffleupagus/custom_spec-node
Run the `custom_spec` unit-tests in Node.js/Travis (PR 10537 follow-up)
2019-02-26 23:47:49 +01:00
Jonas Jenwald
c5cf3ab808 Run the custom_spec unit-tests in Node.js/Travis (PR 10537 follow-up) 2019-02-26 22:40:55 +01:00
Jani Pehkonen
52e8e9b059 Fix missing moveTos in SVG paths 2019-02-26 20:00:35 +02:00
Tim van der Meij
652059056c
Merge pull request #10582 from Snuffleupagus/web-finally
Use `Promise.prototype.finally` in the `PDFRenderingQueue.renderView` method
2019-02-25 23:58:47 +01:00
Jonas Jenwald
954bebb3c3 Use Promise.prototype.finally in the PDFRenderingQueue.renderView method
Since [`finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) is now supported through `src/shared/compatibility.js`, the temporary variable is no longer necessary.

Also, this patch fixes the inconsistent return type of `PDFRenderingQueue.getHighestPriority` when no pages/thumbnails are visible.
2019-02-25 12:20:51 +01:00
Tim van der Meij
de56518799
Merge pull request #10577 from Snuffleupagus/util-split
Move worker-thread only functions from `src/shared/util.js` and into a new `src/core/core_utils.js` file
2019-02-24 19:43:40 +01:00
Tim van der Meij
77a7e04d68
Merge pull request #10578 from Snuffleupagus/non_webpack_require
Try to *temporarily* hack around the `__non_webpack_require__` bug, and update Webpack to the latest stable version (issue 10177)
2019-02-24 19:06:25 +01:00
Tim van der Meij
220b56717e
Merge pull request #10579 from Snuffleupagus/PDFSidebar-signature
Re-factor the `PDFSidebar` constructor to simplify its call-site (PR 10123 follow-up)
2019-02-24 15:53:43 +01:00
Jonas Jenwald
1753f91c6b Re-factor the PDFSidebar constructor to simplify its call-site (PR 10123 follow-up) 2019-02-24 13:15:24 +01:00
Jonas Jenwald
3a09a2f7a5 Update the year in the license_header files 2019-02-24 00:35:42 +01:00
Jonas Jenwald
db5dc14158 Move worker-thread only functions from src/shared/util.js and into a new src/core/core_utils.js file
The `src/shared/util.js` file is being bundled into both the `pdf.js` and `pdf.worker.js` files, meaning that its code is by definition duplicated.
Some main-thread only utility functions have already been moved to a separate `src/display/display_utils.js` file, and this patch simply extends that concept to utility functions which are used *only* on the worker-thread.

Note in particular the `getInheritableProperty` function, which expects a `Dict` as input and thus *cannot* possibly ever be used on the main-thread.
2019-02-24 00:35:39 +01:00
Jonas Jenwald
c67ad32554 Update Webpack to the latest stable version (4.29.5) 2019-02-23 21:34:12 +01:00
Jonas Jenwald
6f67e39a0a Try to *temporarily* hack around the __non_webpack_require__ bug (issue 10177)
In order to, quickly, unblock future Webpack updates this patch implements a *temporary* work-around for the regression; please refer to issue 10177 for additional details.
Please note that this patch doesn't require *any* changes to the source code, but only (small) build-time changes to `gulpfile.js` and as such will be easy to revert.
2019-02-23 21:34:08 +01:00
Jonas Jenwald
a1f7517996 Rename the src/display/dom_utils.js file to src/display/display_utils.js
This file (currently) contains not only DOM-specific helper functions/classes, but is used generally for various helper code relevant for main-thread functionality.
2019-02-23 16:30:16 +01:00
Jonas Jenwald
fb774a65b0 Avoid truncating/breaking some Type3 glyphs in compileType3Glyph (bug 1245391, issue 10568)
*Hopefully this patch makes sense, since I cannot claim to fully understand this function.*

With the changes made in PR 3354 *some* Type3 glyph outlines are no longer rendering correctly, since the final paths were being accidentally ignored.
The fact that Type3 fonts are not very common in PDF documents, and that most Type3 glyphs are unaffected by this regression, probably explains why this has gone unnoticed since 2013.
2019-02-21 23:29:43 +01:00
Tim van der Meij
ece6a31a44
Merge pull request #10560 from timvandermeij/updates
Update translations and packages
2019-02-17 17:38:49 +01:00
Tim van der Meij
a4fd6aa947
Update packages 2019-02-17 17:26:35 +01:00
Tim van der Meij
01ac6cd8c6
Update translations 2019-02-17 16:40:22 +01:00
Tim van der Meij
ff74a66672
Merge pull request #10558 from Snuffleupagus/PDFDataRangeTransport-tests
Re-factor the `PDFDataRangeTransport` unit-tests and enable them in Node.js/Travis
2019-02-17 16:06:55 +01:00
Jonas Jenwald
a0354494bd Re-factor the PDFDataRangeTransport unit-tests and enable them in Node.js/Travis
There doesn't appear to be any particular reason for only running these unit-tests in browsers, since the `PDFDataRangeTransport` functionality itself should be back-end agnostic.
2019-02-17 14:45:17 +01:00
Jonas Jenwald
507e0a4907 Add a new DOMFileReaderFactory helper to the unit-tests, and re-factor NodeFileReaderFactory to be asynchronous
This allows simplification of the 'creates pdf doc from URL and aborts loading after worker initialized' API unit-test.

Note that the `DOMFileReaderFactory` uses the Fetch API, for simplicity, since it should be available in all browsers where we're running tests.
2019-02-17 14:41:14 +01:00
Tim van der Meij
43491c19ee
Merge pull request #10548 from Snuffleupagus/generate-default_preferences
Generate the `default_preferences.json` file from `AppOptions`
2019-02-16 20:02:59 +01:00
Tim van der Meij
b6f58191ca
Merge pull request #10554 from Snuffleupagus/rendering-cancelled
Simplify the `updatetextlayermatches` event handling in `TextLayerBuilder`
2019-02-16 19:41:59 +01:00
Tim van der Meij
50afff9918
Merge pull request #10556 from Snuffleupagus/documentInfo-collection
[api-minor] Expose the existence of a `Collection` dictionary via the  `getMetadata` API method (issue 10555)
2019-02-16 19:26:44 +01:00
Tim van der Meij
ac7522d34b
Merge pull request #10557 from timvandermeij/config
Bump versions in `pdfjs.config`
2019-02-16 19:09:42 +01:00
Tim van der Meij
77de6ee1f6
Bump versions in pdfjs.config 2019-02-16 19:07:23 +01:00
Jonas Jenwald
599dcf5a44 Fix {PDFPageView, PDFThumbnailView}.cancelRendering to avoid visual artifacts when called directly
Currently these methods are only used from the respective `reset` methods, and from `{BaseViewer, PDFThumbnailViewer}._cancelRendering` which only runs when the active document is closed.

This patch changes `{PDFPageView, PDFThumbnailView}.cancelRendering` to *only* cancel any pending rendering operations, and doesn't attempt to reset e.g. the `renderingState`, since that causes visual glitches (duplicated canvases in the viewer) when called directly.
Furthermore, unless you "know" what you're doing, the `{PDFPageView, PDFThumbnailView}.reset` methods are what *should* normally be used instead.
2019-02-16 11:11:07 +01:00
Jonas Jenwald
1ded729130 Simplify the updatetextlayermatches event handling in TextLayerBuilder
This implements the nice suggestion from https://github.com/mozilla/pdf.js/pull/10099#discussion_r219698000, which I at the time didn't think would work.
I'll probably have to plead temporary insanity here, since it *should* have been totally obvious to me how this could be implemented. By simply not registering the event until the `textLayer` is actually rendered, removing the event on `cancel` works just fine.

This patch also removes the `pagecancelled` event, given that it's no longer used anywhere in the code-base and that its implemention was flawed since it wasn't guaranteed to be called in *every* situation where rendering was actually cancelled.
2019-02-16 11:11:04 +01:00
Jonas Jenwald
60f6d49ff7 [api-minor] Expose the existence of a Collection dictionary via the getMetadata API method (issue 10555)
Given the complexity of this functionality, and the fact that it doesn't seem widely used, I highly doubt that it'd ever make sense to support Collections; see also https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#M11.9.39646.2Heading.824.Collections
2019-02-15 15:40:31 +01:00
Jonas Jenwald
0f0650f426 Generate the default_preferences.json file from AppOptions
Currently any editing of the preferences require updates in *three* separate files, which isn't a great developer experience to say the least.

This has annoyed me sufficiently to write this patch, which moves the definition of all preferences into `AppOptions` and adds a new `gulp` task to generate the `default_preferences.json` file for the builds where it's needed.
2019-02-14 20:40:34 +01:00
Brendan Dahl
81f5835cd7
Merge pull request #10539 from Snuffleupagus/fallback-disableFontFace-v2
[api-minor] Fallback to the built-in font renderer when font loading fails
2019-02-12 12:08:01 -08:00
Tim van der Meij
a045a00af3
Merge pull request #10540 from Snuffleupagus/viewOnLoad-pref-schema-type
[Chrome extension] Add missing "type" entry for the `viewOnLoad` preference in the `preferences_schema.json` file (PR 10502 follow-up)
2019-02-12 00:14:01 +01:00
Tim van der Meij
1d90c76097
Merge pull request #10537 from timvandermeij/unittest
Improve unit test coverage
2019-02-12 00:12:29 +01:00
Tim van der Meij
9fa7ae1397
Merge pull request #10545 from timvandermeij/undo-bump
Undo the `pdfjs.config` version bumps
2019-02-12 00:07:38 +01:00
Tim van der Meij
67f3e48832
Undo the pdfjs.config version bumps
The release needs to be made again for the version number to be correct.
2019-02-12 00:05:51 +01:00
Jonas Jenwald
2b4709d1a8 [Chrome extension] Add missing "type" entry for the viewOnLoad preference in the preferences_schema.json file (PR 10502 follow-up)
Fixes 10538
2019-02-11 10:56:43 +01:00