Commit Graph

11261 Commits

Author SHA1 Message Date
Tim van der Meij
7b7cd6dc95
Merge pull request #9990 from timvandermeij/catalog
Convert the `Catalog` class, in `src/core/obj.js`, to ES6 syntax
2018-08-25 17:11:07 +02:00
Tim van der Meij
4a0d15aa0e
Slightly simplify the catalog code 2018-08-25 16:40:59 +02:00
Tim van der Meij
aec236f6d8
Convert the Catalog class, in src/core/obj.js, to ES6 syntax 2018-08-25 16:38:22 +02:00
Tim van der Meij
6a4fc45522
Merge pull request #10008 from timvandermeij/updates
Update translations/packages and fix duplicated function name in the Esprima fixtures
2018-08-25 16:29:42 +02:00
Tim van der Meij
c454868be1
Fix duplicated function name in the Esprima fixtures
This makes `gulp externaltest` work again. It looks like this wasn't
validated before, but is now after recent package updates.
2018-08-25 16:23:20 +02:00
Tim van der Meij
fb8695d481
Update packages 2018-08-25 16:22:24 +02:00
Tim van der Meij
b6d89ffa9c
Update translations 2018-08-25 16:21:27 +02:00
Jonas Jenwald
a182907592 Replace all occurences of var with let/const in src/core/colorspace.js 2018-08-25 03:20:21 +02:00
Jonas Jenwald
ce9a38c536 Convert the code in `src/core/colorspace.js to use ES6 classes
Reduces the amount of boilerplate code when defining the the sub-classes.

Please note that a couple of the closures were kept, since it's not (yet) possible to include helper functions inside of `class`es.
2018-08-25 03:20:19 +02:00
Tim van der Meij
32d02c511c
Merge pull request #10000 from Snuffleupagus/rm-ColorSpace-defaultColor
Remove the unused `defaultColor` property on `ColorSpace` instances
2018-08-24 23:27:57 +02:00
Jonas Jenwald
45b7b861b8 Remove the unused defaultColor property on ColorSpace instances
This property is not only completely unused now, it never actually appears to have been used. Even though the memory savings, from not initializing these extra typed arrays, won't be significant in the grand scheme of things it still seems completely unnecessary to keep allocating this data.

As far as I can tell, the main reason for the existence of `defaultColor` seem to be for documentation purposes. Hence the code is changed into comments instead, to keep the information around (but without the unnecessary allocations).
2018-08-23 11:16:52 +02:00
Brendan Dahl
20cd1b354b
Merge pull request #9977 from Snuffleupagus/async-src
Add support for `async`/`await` using Babel
2018-08-20 17:28:24 -07:00
Tim van der Meij
19e9a2bf34
Merge pull request #9991 from Snuffleupagus/rm-deprecated-scroll-spread
Remove the deprecated ways, in `BaseViewer`, of setting the Scroll/Spread modes (PR 9858 follow-up)
2018-08-20 23:45:22 +02:00
Jonas Jenwald
d7f6f4f051 Remove left-over this.enhanceTextSelection property from the BaseViewer constructor (PR 9479 follow-up) 2018-08-20 16:01:31 +02:00
Jonas Jenwald
0b32dfea86 Use ES6 features, rather than a temporary variable, when swapping padding values in BaseViewer._setScale 2018-08-20 14:18:16 +02:00
Jonas Jenwald
eef70c1eae Remove the deprecated ways, in BaseViewer, of setting the Scroll/Spread modes (PR 9858 follow-up)
Considering that a number of `[api-minor]` changes have landed since PR 9858, removing this code ought to be OK now (the less time these methods remain exposed, the better); implements https://github.com/mozilla/pdf.js/pull/9858#issuecomment-401730065.
2018-08-20 14:11:47 +02:00
Jonas Jenwald
099ed08852 Add support for async/await using Babel
For proof-of-concept, this patch converts a couple of `Promise` returning methods to use `async` instead.
Please note that the `generic` build, based on this patch, has been successfully testing in IE11 (i.e. the viewer loads and nothing is obviously broken).

Being able to use modern JavaScript features like `async`/`await` is a huge plus, but there's one (obvious) side-effect: The size of the built files will increase slightly (unless `SKIP_BABEL == true`). That's unavoidable, but seems like a small price to pay in the grand scheme of things.

Finally, note that the `chromium` build target was changed to no longer skip Babel translation, since the Chrome extension still supports version `49` of the browser (where native `async` support isn't available).
2018-08-19 16:54:11 +02:00
Tim van der Meij
4ea663aa8a
Merge pull request #9987 from Snuffleupagus/rm-createBlob
[api-minor] Remove the obsolete `createBlob` helper function
2018-08-19 16:43:36 +02:00
Tim van der Meij
46ae238cf1
Merge pull request #9989 from timvandermeij/updates
Update translations and packages
2018-08-19 16:33:19 +02:00
Tim van der Meij
d43c8bafca
Update packages 2018-08-19 16:17:23 +02:00
Tim van der Meij
8cae41d25d
Update translations 2018-08-19 16:14:30 +02:00
Tim van der Meij
88e87ce240
Merge pull request #9988 from Snuffleupagus/rm-mainXRefEntriesOffset
Remove the unused `PDFDocument.mainXRefEntriesOffset` method
2018-08-19 16:04:56 +02:00
Jonas Jenwald
75923ea515 Remove the unused PDFDocument.mainXRefEntriesOffset method
Not only is this method completely unused *now*, looking through the history of the code it never appears to have been used for anything either.
Years ago `mainXRefEntriesOffset` was included when creating `XRef` instances, however it wasn't actually used for anything (the parameter was never checked, nor assigned to a property on `XRef`).

If this method ever becomes useful (again) it's easy enough to restore it thanks to version control, but including dead code in the builds just seems wasteful.
2018-08-19 14:08:39 +02:00
Jonas Jenwald
50a47be190 [api-minor] Remove the obsolete createBlob helper function
At this point in time, all supported browsers have native support for `Blob`; please see https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#Browser_compatibility.
Furthermore, note how the helper function was throwing an error if `Blob` isn't available anyway.
2018-08-19 13:37:19 +02:00
Jonas Jenwald
497b765ede Attempt to combine separate beginText/endText sequences in getTextContent (issue 9984)
Please note that while this *improves* issue 9984 slightly (and likely others too), it's not a complete solution.
The remaining issues are related to the, more general, problems with the existing heuristics related to attempting to combine separate text items.
2018-08-18 13:45:32 +02:00
Tim van der Meij
160ca55163
Merge pull request #9980 from Snuffleupagus/paintInline-Uint8ClampedArray
Ensure that `Uint8ClampedArray` is used for image data transfered by `getTransfers` (PR 9802 follow-up)
2018-08-16 23:25:31 +02:00
Jonas Jenwald
bc89edb8f0 Ensure that Uint8ClampedArray is used for image data transfered by getTransfers (PR 9802 follow-up)
One of the `QueueOptimizer` cases wasn't updated to use `Uint8ClampedArray`s, which leads to inconsistent image data on the API side (but no actual rendering bugs, as far as I can tell).
To prevent future errors, a non-production/test-only `assert` was added to ensure that the relevant image data only uses `Uint8ClampedArray`s.
2018-08-16 10:29:44 +02:00
Tim van der Meij
1268aea2b6
Merge pull request #9975 from Snuffleupagus/getDestination-refactor
Re-factor `destinations`/`getDestination` to reduce unnecessary duplication, and reject non-string inputs
2018-08-12 15:51:58 +02:00
Tim van der Meij
af19ed6ee9
Merge pull request #9822 from timvandermeij/annotations
[api-minor] Refactor the annotation code to be asynchronous
2018-08-11 20:39:50 +02:00
Tim van der Meij
bbc769cf81
Convert test/unit/annotation_spec.js to ES6 syntax 2018-08-11 19:00:29 +02:00
dmitryskey
3741becb9b
[api-minor] Refactor the annotation code to be asynchronous
This commit is the first step towards implementing parsing for the
appearance streams of annotations.

Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com>
Co-authored-by: Tim van der Meij <timvandermeij@gmail.com>
2018-08-11 19:00:29 +02:00
Jonas Jenwald
1179584fd6 Reject getDestination, in the API, for non-string inputs
Note how e.g. the `getPage` method does basic validation of the input.
2018-08-11 16:06:35 +02:00
Jonas Jenwald
b74c813353 Re-factor destinations/getDestination, in the Catalog, to reduce unnecessary duplication
Currently, these two methods contain the same boilerplate code for getting the /Dests data.
2018-08-11 16:04:58 +02:00
Brendan Dahl
309b6f820e
Merge pull request #9968 from Snuffleupagus/getFontFileType-MMType1
Tweak the MMType1 font detection in `getFontFileType` to improve font telemetry (PR 9961 follow-up)
2018-08-08 08:10:08 -07:00
Jonas Jenwald
06d1ff5af4 Tweak the MMType1 font detection in getFontFileType to improve font telemetry (PR 9961 follow-up)
Please note that this patch does *not* affect rendering in any way, however it's relevant for font telemetry[1].

According to the specification, see https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G8.1904956, Type1C is a valid subtype for *both* Type1 and MMType1 fonts.

---
[1] Refer to the font telemetry results in https://telemetry.mozilla.org/new-pipeline/dist.html#!cumulative=0&end_date=2018-06-25&keys=__none__!__none__!__none__&max_channel_version=nightly%252F62&measure=PDF_VIEWER_FONT_TYPES&min_channel_version=nightly%252F59&processType=*&product=Firefox&sanitize=1&sort_keys=submissions&start_date=2018-05-07&table=0&trim=1&use_submission_date=0

See also https://github.com/mozilla/pdf.js/wiki/Enumeration-Assignments-for-the-Telemetry-Histograms#pdf_viewer_font_types for help with interpreting the data.
2018-08-08 12:18:37 +02:00
Tim van der Meij
13b98746d9
Merge pull request #9964 from Snuffleupagus/node-MissingPDFException
Attempt to throw `MissingPDFException` when applicable in `node_stream.js` (issue 9791)
2018-08-06 23:42:24 +02:00
Jonas Jenwald
f78efd883e Attempt to throw MissingPDFException when applicable in node_stream.js (issue 9791) 2018-08-06 10:00:03 +02:00
Tim van der Meij
c8ee63319d
Merge pull request #9965 from timvandermeij/updates
Update translations and packages
2018-08-05 21:35:22 +02:00
Tim van der Meij
f6eaa99cb2
Reword test reporter message
The font tests use Jasmine too, so while they are technically unit
tests, it's a bit confusing to see `Started unit tests` when the font
tests are run on the bots.
2018-08-05 21:21:46 +02:00
Tim van der Meij
0a2ec871b6
Update packages 2018-08-05 21:20:37 +02:00
Tim van der Meij
fa40c068af
Update translations 2018-08-05 21:15:58 +02:00
Tim van der Meij
4111871ac5
Merge pull request #9958 from brendandahl/always-fallback
Always fallback to system font on font failure.
2018-08-05 19:58:48 +02:00
Tim van der Meij
eec7e185d9
Merge pull request #9961 from Snuffleupagus/getFontFileType
Parse the font file to determine the correct type/subtype, rather than relying on the (often incorrect) data in the font dictionary
2018-08-05 17:30:10 +02:00
Tim van der Meij
27e8a2f6fe
Merge pull request #9959 from brendandahl/test-util
Utility script to add a reference test.
2018-08-05 16:53:37 +02:00
Tim van der Meij
b65d0450f5
Merge pull request #9960 from brendandahl/strict-verify
Fail when MD5 of test files fails on bots.
2018-08-05 16:44:12 +02:00
Jonas Jenwald
3177f6aa55 Parse the font file to determine the correct type/subtype, rather than relying on the (often incorrect) data in the font dictionary
The current font type/subtype detection code is quite inconsistent/unwieldy. In some cases it will simply assume that the font dictionary is correct, in others it will somewhat "arbitrarily" check the actual font file (more of these cases have been added over the years to fix specific bugs).

As is evident from e.g. issue 9949, the font type/subtype detection code is continuing to cause issues. In an attempt to get rid of these hacks once and for all, this patch instead re-factors the type/subtype detection to *always* parse the font file.

Please note that, as far as I can tell, we still appear to need to rely on the composite font detection based on the font dictionary. However, even if the composite/non-composite detection would get it wrong, that shouldn't really matter too much given that there's basically only two different code-paths (for "TrueType-like" vs "Type1-like" fonts).
2018-08-05 11:13:16 +02:00
Jonas Jenwald
9bbca04579 Add a (basic) isCFFFile helper function to detect CFF font files
Compared to most other font formats, the CFF doesn't have a constant header which makes is slightly more difficult to detect such font files.

Please refer to the Compact Font Format specification: https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf#G3.32094
2018-08-05 11:13:14 +02:00
Jonas Jenwald
f4db38aadf Update the TrueType font file detection to also recognize the Mac specific header 'true'
Please refer to the TrueType specification: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html#ScalerTypeNote
2018-08-05 10:33:56 +02:00
Brendan Dahl
482ea2af32 Fail when MD5 of test files fails on bots. 2018-08-03 17:48:47 -07:00
Brendan Dahl
8b3ed473c1 Utility script to add a reference test. 2018-08-03 17:24:24 -07:00