Commit Graph

10193 Commits

Author SHA1 Message Date
Jonas Jenwald
563b68e74d Remove manual clamping code in src/core/jpx.js
Since we're now using `Uint8ClampedArray`, rather than `Uint8Array`, doing manual clamping shouldn't be necessary given that that is now handled natively.

This shouldn't have any measurable performance impact, but just to sanity check that I've done some quick benchmarking with the following manifest file:
```json
[
    {  "id": "S2-eq",
       "file": "pdfs/S2.pdf",
       "md5": "d0b6137846df6e0fe058f234a87fb588",
       "rounds": 100,
       "type": "eq"
    }
]
```
which gave the following results against the current `master` (repeated benchmark runs didn't result in any meaningful differences):
```
-- Grouped By browser, stat --
browser | stat         | Count | Baseline(ms) | Current(ms) | +/- |    %  | Result(P<.05)
------- | ------------ | ----- | ------------ | ----------- | --- | ----- | -------------
firefox | Overall      |   100 |          592 |         592 |   1 |  0.12 |
firefox | Page Request |   100 |            3 |           3 |   0 | -9.88 |
firefox | Rendering    |   100 |          588 |         589 |   1 |  0.18 |
```
2017-08-16 13:24:28 +02:00
Jonas Jenwald
f6636d6b19 Use Uint8ClampedArray when returning image data in src/core/jbig2.js and src/core/jpg.js 2017-08-16 13:24:28 +02:00
Jonas Jenwald
74ad90cb8f Update the mask data inversion in PDFImage.createMask to be compatible with both Uint8Array and Uint8ClampedArray 2017-08-16 13:24:21 +02:00
Rob Wu
d253889d97 __non_webpack_require__ -> require in SystemJS
When running browser tests, e.g. via `gulp unittest`, the test files are not
processed by babel, and neither by the "unittestcli" gulp target.

This commit copies the babelPluginReplaceNonWebPackRequire plugin from the
unittestcli target to the SystemJS config so that `__non_webpack_require__` is
replaced with `require` for all build targets, and adds a unit test to ensure
that this indeed works as expected.
2017-08-15 12:14:30 +02:00
Yury Delendik
ba5dbc9632 Merge pull request #8780 from yurydelendik/v1.9.426
Version 1.9.426
2017-08-14 18:41:32 -05:00
Yury Delendik
163ecf9b95 Version 1.9.426 2017-08-14 18:37:57 -05:00
Tim van der Meij
602250031e Merge pull request #8778 from Snuffleupagus/jpg-Uint8ClampedArray
Use `Uint8ClampedArray`, when returning data, and remove manual clamping in `src/core/jpg.js` (issue 4901)
2017-08-14 23:44:41 +02:00
Yury Delendik
2558a58dbb Merge pull request #8749 from yurydelendik/version-1.9
Version 1.9
2017-08-14 15:42:21 -05:00
Jonas Jenwald
d6cd5355f0 Use Uint8ClampedArray, when returning data, and remove manual clamping in src/core/jpg.js (issue 4901)
This patch removes the `clamp0to255` helper function, as well as manual clamping code in `src/core/jpg.js`.
The adjusted constants in `_convertCmykToRgb` were taken from CMYK to RGB conversion code found in `src/core/colorspace.js`.

*Please note:* There will be some very slight movement in a number of existing test-cases, since `Uint8ClampedArray` appears to use `Math.round` (or equivalent) and the old code used (basically) `Math.floor`.
2017-08-14 16:19:57 +02:00
Jonas Jenwald
be36c60e0f Polyfill Uint8ClampedArray using core-js
https://github.com/zloirock/core-js
2017-08-14 16:19:55 +02:00
Jonas Jenwald
e49dfe4ed7 Don't load compatibility.js in the viewer while in non-PRODUCTION mode
At this point, the default viewer is already not usable in older browsers in `gulp server` mode, since we only run the code through Babel as part of the build step.
Hence there shouldn't be much point in manually loading `compatibility.js` in `viewer.html` the way that we've been doing, especially considering that it's already being loaded by `src/shared/util.js`.
2017-08-14 15:57:18 +02:00
Jonas Jenwald
723bc25bc3 Update l10n files 2017-08-14 10:19:07 +02:00
Tim van der Meij
21cc2c0200 Merge pull request #8764 from Snuffleupagus/es6-DownloadManager-class
Convert `DownloadManager` to an ES6 class
2017-08-09 22:26:25 +02:00
Tim van der Meij
903f372e3d Merge pull request #8762 from Snuffleupagus/evaluator-coded-isType3Font
Replace the `coded` property with `isType3Font` when building the font `properties` object in `PartialEvaluator.translateFont`
2017-08-08 22:02:28 +02:00
Jonas Jenwald
11ea21265d Merge pull request #8761 from tobytailor/master
Fallback to plain object for globalScope.
2017-08-08 19:48:33 +02:00
Tobias Schneider
da44d10af1 Fallback to plain object for globalScope. 2017-08-08 09:17:48 -07:00
Jani Pehkonen
9a581ee9ed Implement JBIG2 halftone regions and pattern dictionaries 2017-08-08 15:38:29 +03:00
Jonas Jenwald
093afd1212 Replace the coded property with isType3Font when building the font properties object in PartialEvaluator.translateFont
This appears to simply have been forgotten in the re-factoring in PR 4815, where the `coded` property was renamed to the *much* more descriptive `isType3Font` property.
2017-08-08 14:03:02 +02:00
Tim van der Meij
a1d88d8e2e Merge pull request #8756 from Snuffleupagus/evaluator-paintXObject-rm-code-property
Remove leftover `args[0].code` checks from the `OPS.paintXObject` cases in evaluator.js
2017-08-07 22:34:07 +02:00
Jonas Jenwald
4729e96fb7 Remove leftover args[0].code checks from the OPS.paintXObject cases in evaluator.js
From looking at blame, it seems that these checks became obsolete with PR 692 (which landed close to six years ago). Note how, after that PR, there's no longer anything being assigned to the `code` property of an Object.
2017-08-07 10:48:37 +02:00
Jonas Jenwald
5cb8389757 Update l10n files 2017-08-07 10:10:49 +02:00
Jonas Jenwald
cbc411a2c7 Convert DownloadManager to an ES6 class 2017-08-06 14:15:18 +02:00
Tim van der Meij
f83bd721fc Merge pull request #8752 from Snuffleupagus/es6-dom_events
ES6-ify the code in `web/dom_events.js`
2017-08-05 15:32:50 +02:00
Brendan Dahl
1419b7ffe7 Merge pull request #8746 from yurydelendik/page-errors
More robust getPage() error handling.
2017-08-04 15:16:50 -07:00
Yury Delendik
d0e93721ae More robust getPage() error handling. 2017-08-04 17:03:33 -05:00
Yury Delendik
da372d5a57 Version 1.9 2017-08-04 16:13:49 -05:00
Jonas Jenwald
ace9de6f7d Merge pull request #8747 from brendandahl/first-cmap
Fix two cmap related issues.
2017-08-04 14:11:12 +02:00
Jonas Jenwald
bbf5b4d706 Merge pull request #8745 from yurydelendik/cancel-stream
Properly cancel streams and guard at getTextContent.
2017-08-04 13:00:31 +02:00
Brendan Dahl
0bef50d56d Fix two cmap related issues.
In issue #8707, there's a char code mapped to a non-
existing glyph which shouldn't be drawn. However, we
saw it was missing and tried to then use the post table and
end up mapping it incorrectly.

This illuminated a problem with issue #5704 and bug
893730 where glyphs disappeared after above fix.  This was
from the cmap returning the wrong glyph id. Which in turn was
caused because the font had multiple of the same type of cmap
table and we were choosing the last one. Now, we instead
default to the first one. I'm unsure if we should instead be
merging the multiple cmaps, but using only the first one works.
2017-08-03 22:19:36 -07:00
Yury Delendik
a1dfbec532 Properly cancel streams and guard at getTextContent. 2017-08-03 16:36:46 -05:00
Yury Delendik
5b5781b45d Merge pull request #8738 from ChenMachluf/remove_workerPort_after_PDFWorker_destroy
Delete workerPort to PDFWorker cache after PDFWorker destroy
2017-08-03 15:49:40 -05:00
Yury Delendik
0c95bc7d83 Merge pull request #8744 from yurydelendik/stream-edge
Checks Edge support for streams.
2017-08-03 09:16:43 -05:00
Yury Delendik
6beb925f0b Checks Edge support for streams. 2017-08-03 08:48:51 -05:00
Jonas Jenwald
e20d4a9c21 Merge pull request #8681 from brendandahl/glyph-ids
Fix several issues with glyph id mappings (issue 8668, bug 1383504)
2017-08-03 14:25:34 +02:00
Chen Machluf
9b1b160d4f remove PDFWorker from cache after detsroy 2017-08-02 23:48:42 +03:00
Brendan Dahl
5b7f712ca7 Merge pull request #8627 from yurydelendik/issue-8591
Fallback on font widths if CFF data is broken
2017-08-02 10:53:14 -07:00
Jonas Jenwald
f62d0a10a5 Merge pull request #8721 from mukulmishra18/data-send-via-GetDocRequest
Reduces the amount of data send via GetDocRequest.
2017-07-30 20:16:14 +02:00
Tim van der Meij
4597926148 Merge pull request #8722 from Snuffleupagus/fix-helloworld-example
Fix the helloworld example by importing the `network.js` file (PR 8617 follow-up)
2017-07-30 12:34:44 +02:00
Jonas Jenwald
1f6de75585 Fix the helloworld example by importing the network.js file (PR 8617 follow-up)
Fixes https://stackoverflow.com/q/45393309/5317012
2017-07-29 22:47:46 +02:00
Mukul Mishra
00e026ebcd Reduces the amount of data send via GetDocRequest. 2017-07-30 00:00:03 +05:30
Tim van der Meij
2702021a84 Merge pull request #8718 from Snuffleupagus/loadingBar-downloadComplete-check
Ensure that the loadingBar isn't displayed again when the entire file has already been fetched
2017-07-29 15:39:43 +02:00
Tim van der Meij
ec916566d7 Merge pull request #8717 from timvandermeij/mocks
Move the `XRefMock` in the unit tests to a central location
2017-07-29 15:36:46 +02:00
Tim van der Meij
ab820438ae
Move the XRefMock in the unit tests to a central location
This patch helps to avoid code duplication for this mock since more unit
tests are depending on it.
2017-07-29 15:16:19 +02:00
Jonas Jenwald
b2b1752005 ES6-ify the code in web/dom_events.js 2017-07-29 13:17:22 +02:00
Jonas Jenwald
fce31c3f83 Ensure that the loadingBar isn't displayed again when the entire file has already been fetched
This could only (potentially) happen when `disableAutoFetch` is used.
2017-07-29 11:36:45 +02:00
Tim van der Meij
783d42ec2b Merge pull request #8611 from apoorv-mishra/colorspace-tests
Add unit-tests for colorspace.js
2017-07-29 00:14:03 +02:00
Tim van der Meij
27b49a34ee Merge pull request #8715 from yurydelendik/streams-polyfill
Use streams-lib as polyfill
2017-07-28 22:31:10 +02:00
Yury Delendik
01b47d9012 Use streams-lib as polyfill 2017-07-28 11:54:33 -05:00
Apoorv Mishra
a129de7bd1 Add unit-tests for colorspace.js
Added unit-tests for DeviceGray, DeviceRGB and DeviceCMYK

Added unit-tests for CalGray

Added unit-tests for CalRGB

Removed redundant code

Added unit-tests for LabCS

Added unit-tests for IndexedCS

Update comment

Change lookup to Uint8Array as mentioned in pdf specs(these tests will pass after PR #8666 is merged).

Added unit-tests for AlternateCS

Resolved code-style issues

Fixed code-style issues

Addressed issues pointed out in https://github.com/mozilla/pdf.js/pull/8611#pullrequestreview-52865469
2017-07-28 14:24:56 +05:30
Yury Delendik
343b4dc2b6 Merge pull request #8617 from mukulmishra18/network-streaming
Adds Streams API support for networking task of PDF.js project.
2017-07-27 16:15:06 -05:00