Commit Graph

10209 Commits

Author SHA1 Message Date
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
Mukul Mishra
109106794d Adds Streams API support for networking task of PDF.js project.
network.js file moved to main thread and `PDFNetworkStream` implemented
at worker thread, that is used to ask for data whenever worker needs.
2017-07-28 02:32:30 +05:30
Brendan Dahl
ac33358e1f Fix several issues with glyph id mappings.
The initial issue with #8255 was I added a missing glyphs
check to adjustMapping, but this caused us to skip re-mapping
a glyph if the fontCharCode was a missingGlyph which in turn
caused us to overwrite a valid glyph id with an invalid one. While
fixing this, I also added a warning if the private use area is full since
this also accidentally happened when I made a different mistake.

This brought to light a number of issues where we map
missing glyphs to notdef, but often the notdef is actually defined
and then ends up being drawn. Now the glyphs don't get
mapped in toFontChar and so they are not drawn by the canvas.

Fixing the above brought up another issue though in bug1050040.pdf.
In this PDF, the font fails to load by the browser and before we were still
drawing the glyphs because it looked like the font had them, but with the fixes
above the glyphs showed up as missing so we didn't attempt draw them. To
fix this, I now throw an error when the loca table is in really bad shape and
we fall back to trying to use a system font. We now also use this fall back if
there are any format errors during converting fonts.
2017-07-26 13:00:55 -07:00
Tim van der Meij
37ac8f8623 Merge pull request #8698 from Snuffleupagus/issue-8697
Add a fallback for non-embedded SegoeUISymbol font (issue 8697)
2017-07-25 22:35:52 +02:00
Tim van der Meij
44a5cec25e Merge pull request #8666 from apoorv-mishra/fix-colorspace
Fix TypeError that occurs in colorspace.js on accidentally passing an 'Array' instead of 'TypedArray'
2017-07-25 22:13:20 +02:00
Yury Delendik
c830021b07 Fixes CFF data glyph widths 2017-07-25 12:29:51 -05:00
Jonas Jenwald
23ec6b16ca Add a fallback for non-embedded SegoeUISymbol font (issue 8697)
The PDF file uses a non-embedded SegoeUISymbol font, which is *not* a standard font (and is mainly used by Microsoft, see https://en.wikipedia.org/wiki/Segoe).

Fixes 8697.
2017-07-25 12:45:11 +02:00
Yury Delendik
bd8c12119a Merge pull request #8696 from mukulmishra18/sink-ready-rejection
Adds ready capability rejection logic for stream sink.
2017-07-24 16:40:30 -05:00
Tim van der Meij
d1727b2566 Merge pull request #8692 from Snuffleupagus/issue-7696-ref-test
Add a reduced test-case for issue 7696
2017-07-24 23:28:28 +02:00
Mukul Mishra
568b0b6a42 Adds ready capability rejection logic for stream sink. 2017-07-25 02:07:38 +05:30
Jonas Jenwald
794b099385 Add a reduced test-case for issue 7696
Issue 7696 was one of the issues fixed by PR 8580. The other ones were all cases of missing glyphs, however in this particular one glyphs did render but every single one was incorrect.
Hence it probably cannot hurt to have a small, reduced, reference test for that PDF file as well.
2017-07-24 09:55:16 +02:00
Jonas Jenwald
38d566f1e5 Update l10n files 2017-07-24 09:37:07 +02:00
Tim van der Meij
53cd2f9d0a Merge pull request #8689 from tiagmoraismorgado/patch-1
Update README.md
2017-07-23 19:30:46 +02:00
Tiago Morais Morgado
60fc8c932a Update README.md 2017-07-23 17:57:19 +01:00
Tim van der Meij
af71ea7a7d Merge pull request #8673 from Snuffleupagus/api-pageMode
[api-minor] Add support for PageMode in the API and viewer (issue 8657)
2017-07-23 13:17:07 +02:00
Tim van der Meij
e7cddcce28 Merge pull request #8684 from Snuffleupagus/rm-assert
Remove most `assert()` calls (issue 8506)
2017-07-22 19:42:24 +02:00
Tim van der Meij
7ded895d0c Merge pull request #8638 from Snuffleupagus/issue-4926-built-in-jpg
In `src/core/jpg.js`, ensure that the Adobe JPEG marker always takes precedence, even when the color transform code is zero
2017-07-22 17:25:09 +02:00
Jonas Jenwald
814fa1dee3 Remove most assert() calls (issue 8506)
This replaces `assert` calls with `throw new FormatError()`/`throw new Error()`.
In a few places, throwing an `Error` (which is what `assert` meant) isn't correct since the enclosing function is supposed to return a `Promise`, hence some cases were changed to `Promise.reject(...)` and similarily for `createPromiseCapability` instances.
2017-07-21 18:51:02 +02:00
Tim van der Meij
09f04eccda Merge pull request #8678 from Snuffleupagus/fix-Catalog-numPages-shadow
Fix a typo, in the `Catalog.numPages` getter, than prevents shadowing from working correctly
2017-07-20 23:08:50 +02:00
Apoorv Mishra
d14956d4b8 Fix TypeError that occurs in colorspace.js on accidentally passing an 'Array' instead of 'TypedArray'
Fix TypeError that occurs in colorspace.js on accidentally passing an 'Array' instead of 'TypedArray'

Changed getRgbItem(...) to getRgbBuffer(...) since this.lookup has values in range[0, 255] whereas getRgbItem(...) expects those to be in range [0, 1]

Revert changes for IE9 compatibility
2017-07-21 01:15:05 +05:30
Jonas Jenwald
15f0963f51 Fix a typo, in the Catalog.numPages getter, than prevents shadowing from working correctly
Looking at the blame, it seems that this typo was present even before PR 700 (almost six years ago).
The result of using `'num'`, rather than the *correct* `'numPages'` string, is that the `Catalog.numPages` getter isn't actually being shadowed.
2017-07-20 12:35:09 +02:00
Jonas Jenwald
20d6286cce Add support for, the API property, PageMode in the viewer (issue 8657)
Note that the PageMode, as specified in the API, will only be honoured when either: the user hasn't set the `sidebarViewOnLoad` preference to a non-default value, or a non-default `sidebarView` entry doesn't exist in the view history, or the "pagemode" hash parameter is included in the URL.

Since this is new functionality, the patch also includes a preference (`disablePageMode`), to make it easy to opt-out of this functionality if the user/implementor so wishes.
2017-07-19 16:58:25 +02:00
Jonas Jenwald
f7c4ed4bc3 Refactor reading from the ViewHistory in PDFViewerApplication.load 2017-07-19 16:40:47 +02:00
Jonas Jenwald
16c5d41c5b [api-minor] Add support for PageMode in the API (issue 8657)
Please refer to https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf#page=82.
2017-07-19 16:40:03 +02:00
Tim van der Meij
4a74cc418c Merge pull request #8653 from Rob--W/crx-migrate-pref-enableHandToolOnLoad-to-cursorToolOnLoad
Add UI for the cursorToolOnLoad pref in the Chrome extension + migration logic
2017-07-16 22:40:37 +02:00
Jonas Jenwald
5187f0fcbb Merge pull request #8636 from Snuffleupagus/es6-PDFViewer-class
Convert `PDFViewer` to an ES6 class
2017-07-16 15:57:22 +02:00
Tim van der Meij
947b2f59fc Merge pull request #8651 from Rob--W/issue-8620-follow-up-fix-tests
Fix display_svg_spec tests.
2017-07-16 15:17:06 +02:00
Rob Wu
18566091aa Fix display_svg_spec tests.
- Mark the test as async, and don't swallow exceptions.
- Fix the DOMElement polyfill to behave closer to the actual getAttributeNS
  method, which excludes the namespace prefix.
2017-07-16 11:01:52 +02:00
Jonas Jenwald
e1536251d5 Convert PDFViewer to an ES6 class 2017-07-16 10:20:35 +02:00
Jonas Jenwald
49333ddd44 Move the hasEqualPageSizes getter from PDFViewerApplication and into PDFViewer instead
Since the method needs to access properties that are directly available inside of `PDFViewer`, it seems simpler to just have it live there.
2017-07-16 10:17:38 +02:00
Rob Wu
19549bb7d6 [CRX] Integrate cursorToolOnLoad pref + migration logic
Add UI for the cursorToolOnLoad pref in the UI of the Chrome extension.

Add logic to migrate the enableHandToolOnLoad pref to cursorToolOnLoad.
For past values in the mutable extension storage area:
1. If enableHandToolOnLoad=true, save cursorToolOnLoad=1.
2. Remove enableHandToolOnLoad.

For the managed extension storage, which is immutable since it is based
on administrative policies, use the following logic:
1. If enableHandToolOnLoad=true and cursorToolOnLoad=0 (default).
   set cursorToolOnLoad=0 and assume enableHandToolOnLoad=false.
2. As usual, managed preferences can (and will) be overridden by the user.

The first migration logic is in extensions/chromium/options/migration.js
and can be removed after a few months / less than many years.

The second migration logic is in web/chromecom.js, and should be kept
around for a long while (many years).

The need for this migration logic arises from the change by:
https://github.com/mozilla/pdf.js/pull/7635
2017-07-15 01:50:15 +02:00
Tim van der Meij
afb1cd7377 Merge pull request #8649 from Snuffleupagus/es6-PDFLinkService-class
Convert `PDFLinkService` to an ES6 class
2017-07-15 01:22:02 +02:00
Jonas Jenwald
8ba8072937 Convert PDFLinkService to an ES6 class 2017-07-14 16:30:25 +02:00
Yury Delendik
ca3c08f12b Merge pull request #8620 from Rob--W/issue-8560-improve-png-compression
Improve compression of PNG images embedded in generated SVG files
2017-07-14 07:23:38 -05:00
Tim van der Meij
26be1df5f7 Merge pull request #8641 from Snuffleupagus/eslint-version-4-upgrade
Update ESLint (and eslint-plugin-mozilla) to the latest version
2017-07-14 14:17:42 +02:00