Commit Graph

10052 Commits

Author SHA1 Message Date
Tim van der Meij
7969802739 Merge pull request #8794 from Snuffleupagus/ViewHistory-rm-migration-code
Remove the migration code for old localStorage data in `ViewHistory`
2017-08-19 15:09:17 +02:00
Jonas Jenwald
81b4761e6e Remove the migration code for old localStorage data in ViewHistory
This was added in PR 7793, which has now been present in a number of PDF.js releases (from version `v1.7.225`).
Hence we should be able to remove it now, considering that the migration code was only intended as a best effort solution to avoid wiping out all existing user data at once. Also, keep in mind that `ViewHistory` is already limited with regards to the number of documents it will simultaneous store data for.
2017-08-19 11:41:04 +02:00
Jonas Jenwald
9b26bec1d7 Merge pull request #8792 from Snuffleupagus/issue-8790
Fix caching of small inline images in `Parser.makeInlineImage` (issue 8790)
2017-08-19 09:12:55 +02:00
Jonas Jenwald
18902ec414 Add the ttest npm package to the devDependencies in package.json
I've gotten tired of having to manually re-install the `ttest` package on numerous occasions when benchmarking changes, so let's just list it in package.json to simplify things.
2017-08-18 23:17:59 +02:00
Jonas Jenwald
2112999db7 Fix caching of small inline images in Parser.makeInlineImage (issue 8790)
*Follow-up to PR 5445.*

Using the PDF file from issue 2618, i.e. http://bugzilla-attachments.gnome.org/attachment.cgi?id=226471, with the following manifest file:
```json
[
    {  "id": "issue2618",
       "file": "../web/pdfs/issue2618.pdf",
       "md5": "",
       "rounds": 50,
       "type": "eq"
    }
]
```
I get the following results when comparing `master` against this patch:
```
browser | stat         | Count | Baseline(ms) | Current(ms) |  +/- |     %  | Result(P<.05)
------- | ------------ | ----- | ------------ | ----------- | ---- | ------ | -------------
firefox | Overall      |    50 |         4694 |        3974 | -721 | -15.35 |        faster
firefox | Page Request |    50 |            2 |           1 |    0 | -22.83 |
firefox | Rendering    |    50 |         4692 |        3972 | -720 | -15.35 |        faster
```

So, based on these results, it seems like a fairly clear win to fix this broken caching :-)
2017-08-18 23:08:55 +02:00
Tim van der Meij
8c8d8fa239 Merge pull request #8788 from Snuffleupagus/pageMode-followup
Attempt to delay disabling of the attachment view until FileAttachment annotations of the *initial* page has been parsed
2017-08-18 00:04:37 +02:00
Tim van der Meij
50e10fdafc Merge pull request #8785 from Rob--W/svg-ignore-missing-glyph
SVG: Don't render missing glyphs
2017-08-17 23:40:57 +02:00
Jonas Jenwald
9273350c6b Attempt to delay disabling of the attachment view until FileAttachment annotations of the *initial* page has been parsed
As discussed in PR 8673, we cannot solve the general issue (since that would require parsing every single page). However, we can mitigate the effect somewhat, by waiting for the FileAttachment annotations of the initially rendered page.
2017-08-17 14:30:03 +02:00
Jonas Jenwald
96fb0c0370 Call the reset() methods in the PDFAttachmentViewer and PDFOutlineViewer constructors
Rather than duplicating initialization code, we can just call `this.reset()` instead (which is also similar to other existing code, e.g. `PDFViewer`). This will also help ensure that the DOM is completely reset, before any outline items or attachments are displayed.
2017-08-17 13:04:24 +02:00
Rob Wu
f07ce2bbc2 SVG: Don't render missing glyphs
This bug is similar to the canvas bug of #6721.
I found this bug when I tried to run pdf2svg on a SVG file, and the generated
SVG could not be viewed in Chrome due to a SVG/XML parsing error:
"PCDATA invalid Char value 3"

Reduced test case:
- https://github.com/mozilla/pdf.js/files/1229507/pcdatainvalidchar.pdf
- expected: "hardware performance"
- Actual SVG source: "hardware\x03performance"
  (where "\x03" is a non-printable character, and invalid XML).

In terms of rendering, this bug is similar to #6721, where an unexpected glyph
appeared in the canvas renderer. This was fixed by #7023, which skips over
missing glyphs. This commit follows a similar logic.

The test case from #6721 can be used here too:
- https://github.com/mozilla/pdf.js/files/52205/issue6721_reduced.pdf
  expected: "Issue   6721"
  actual (before this patch): "Issue ààà6721"
2017-08-16 23:49:55 +02:00
Tim van der Meij
3a017b4317 Merge pull request #8783 from Snuffleupagus/image-decoders-Uint8ClampedArray
Use `Uint8ClampedArray` when returning image data in `src/core/jbig2.js` and `src/core/jpg.js`
2017-08-16 22:52:12 +02:00
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
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
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