Commit Graph

11423 Commits

Author SHA1 Message Date
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
Tim van der Meij
dfe7d9bc26
Merge pull request #10530 from a4lg/fix-copytext-outofucs2
Fix copying on supplementary plane characters
2019-02-10 16:22:45 +01:00
Tim van der Meij
6757b6e2d0
Merge pull request #10534 from Snuffleupagus/dist-link
Try to hack-around the broken `pdfjs-dist` links, such that they will point to the main library releases (issue 10391)
2019-02-10 15:14:59 +01:00
Tsukasa OI
96ba6afd47 Fix copying on supplementary plane characters
pdf.js had a problem when copying characters on supplementary planes
(0xPPXXXX where PP is nonzero).  This is because certain methods of
PartialEvaluator use classic String.fromCharCode instead of ES6's
String.fromCodePoint.

Despite the fact that readToUnicode method *tried* to parse out-of-UCS2
code points by parsing UTF-16BE, it was inadequate because
String.fromCharCode only supports UCS-2 range of Unicode.
2019-02-10 18:14:53 +09:00
Jonas Jenwald
62d7332d49 Try to hack-around the broken pdfjs-dist links, such that they will point to the main library releases (issue 10391) 2019-02-09 17:25:20 +01:00
Tim van der Meij
eb7fc2625f
Merge pull request #10533 from timvandermeij/bump
Bump the version number in `pdfjs.config`
2019-02-09 15:26:10 +01:00
Tim van der Meij
554d50563f
Bump the version number in pdfjs.config 2019-02-09 15:23:51 +01:00
Tim van der Meij
14c012b650
Merge pull request #10532 from timvandermeij/bump
Bump base version and version prefix in `pdfjs.config`
2019-02-09 15:06:47 +01:00
Tim van der Meij
6a40f2fc62
Bump base version and version prefix in pdfjs.config 2019-02-09 14:59:48 +01:00
Tim van der Meij
2b6e6364ef
Merge pull request #10527 from Snuffleupagus/classList-add-remove
Add a polyfill for `classList.{add, remove}` with more than one parameter
2019-02-08 22:40:16 +01:00
Jonas Jenwald
3bcf9187ec Add a polyfill for classList.{add, remove} with more than one parameter
Unsurprisingly IE11 doesn't support this, so a polyfill is needed since otherwise the sidebar can no longer be opened.

Also, simplifies the existing `classList.toggle` polyfill.
2019-02-08 13:35:01 +01:00
Tim van der Meij
7d24fc34f9
Merge pull request #10525 from Snuffleupagus/more-classList-toggle
Convert more code to use `classList.toggle` with the `force` parameter
2019-02-06 23:53:43 +01:00
Jonas Jenwald
19795597a2 Convert more code to use classList.toggle with the force parameter
There's a bunch of code, in the viewer, which for historical reasons use `switch` statements to add and remove CSS classes.
This code can be simplified, and unnecessary duplication avoided, by using `classList.toggle` instead.
2019-02-06 17:18:45 +01:00
Tim van der Meij
c0d6e46e39
Merge pull request #10502 from Snuffleupagus/adjust-onLoad-prefs
Modify a number of the viewer preferences, whose current default value is `0`, such that they behave as expected with the view history
2019-02-04 23:54:14 +01:00
Tim van der Meij
9f9d87c3ce
Merge pull request #10517 from Snuffleupagus/rm-currentScript-polyfill
[api-minor] Remove the `document.currentScript` polyfill
2019-02-03 15:42:30 +01:00
Jonas Jenwald
614e502227 [api-minor] Remove the document.currentScript polyfill
This polyfill is currently used in only *one* file, i.e. `src/display/api.js`, and only when trying to build a *fallback* `workerSrc` path.

Given that the global `workerSrc` should *always* be set[1] when using the PDF.js library[2], and that the fallback `workerSrc` should only be regarded as a best-effort solution anyway, there isn't a particularily strong reason to keep the compatibility code in my opinion.

---
[1] Other supported options include setting the global `workerPort`, or passing in a `PDFWorker` instance as part of the `getDocument` call.

[2] Which is clearly mentioned in the JSDocs in `src/display/worker_options.js`.
2019-02-03 14:09:24 +01:00
Tim van der Meij
80495e61b7
Merge pull request #10515 from Snuffleupagus/createPromiseCapability-settled
Add a `settled` property, tracking the fulfilled/rejected stated of the Promise, to `createPromiseCapability`
2019-02-02 15:41:25 +01:00
Jonas Jenwald
22468817e1 Add a settled property, tracking the fulfilled/rejected stated of the Promise, to createPromiseCapability
This allows cleaning-up code which is currently manually tracking the state of the Promise of a `createPromiseCapability` instance.
2019-02-02 15:18:56 +01:00
Jonas Jenwald
ef634b51e1 Re-factor how the "compatibility" values are specified in AppOptions
The intention with this change is to, more clearly, highlight when the default values may possibly be overridden by "compatibility" values.
2019-02-02 10:21:18 +01:00
Jonas Jenwald
9d8342002c Move the PDFHistory initialization into a helper method in PDFViewerApplication
This avoids having the initialization code "spread out", and will become even simpler once the `TODO` is addressed (which I'm planning on fixing as soon as possible).
2019-02-02 10:21:18 +01:00
Jonas Jenwald
4d4c98d1eb Attempt to migrate the old showPreviousViewOnLoad/disablePageMode preferences to the new viewOnLoad preference
This patch ignores the recently added `disableOpenActionDestination` preference, since the latest PDF.js version found on the "Chrome Web Store" doesn't include it.
2019-02-02 10:21:18 +01:00
Jonas Jenwald
6806248030 Modify a number of the viewer preferences, whose current default value is 0, such that they behave as expected with the view history
The intention with preferences such as `sidebarViewOnLoad`/`scrollModeOnLoad`/`spreadModeOnLoad` were always that they should be able to *unconditionally* override their view history counterparts.
Due to the way that these preferences were initially implemented[1], trying to e.g. force the sidebar to remain hidden on load cannot be guaranteed[2]. The reason for this is the use of "enumeration values" containing zero, which in hindsight was an unfortunate choice on my part.
At this point it's also not as simple as just re-numbering the affected structures, since that would wreak havoc on existing (modified) preferences. The only reasonable solution that I was able to come up with was to change the *default* values of the preferences themselves, but not their actual values or the meaning thereof.

As part of the refactoring, the `disablePageMode` preference was combined with the *adjusted* `sidebarViewOnLoad` one, to hopefully reduce confusion by not tracking related state separately.

Additionally, the `showPreviousViewOnLoad` and `disableOpenActionDestination` preferences were combined into a *new* `viewOnLoad` enumeration preference, to further avoid tracking related state separately.
2019-02-02 10:21:18 +01:00
Jonas Jenwald
dd4620530d Change PDFSidebar.switchView to act as a wrapper for a "private" PDFSidebar._switchView method
The new "private" method will return a boolean, indicating if the `sidebarviewchanged` event was dispatched, thus allowing some simplification of the `PDFSidebar.setInitialView` method.
2019-02-02 10:21:16 +01:00
Tim van der Meij
291e62b41e
Merge pull request #10508 from Snuffleupagus/issue-8276
Do the final text scaling correctly in `flushTextContentItem` (issue 8276)
2019-01-29 22:46:36 +01:00
Jonas Jenwald
2b0b6178f7 Clean-up after the gets operatorList with JPEG image (issue 4888) unit-test
This unit-test wasn't destroying the `loadingTask` when complete, as it should have done.
2019-01-29 15:24:08 +01:00
Jonas Jenwald
6f94a05a29 Do the final text scaling correctly in flushTextContentItem (issue 8276)
It's necessary to take into account whether or not the text is vertical, to avoid either the textContent `width` or `height` becoming incorrect.
2019-01-29 15:24:04 +01:00
Tim van der Meij
55b12f5fd9
Merge pull request #10504 from Snuffleupagus/eslint-no-useless-catch
Enable the `no-useless-catch` ESLint rule
2019-01-28 22:37:14 +01:00
Jonas Jenwald
86472e9981 Enable the no-useless-catch ESLint rule
See https://eslint.org/docs/rules/no-useless-catch
2019-01-28 11:00:09 +01:00
Tim van der Meij
1f3e7700d2
Merge pull request #10499 from Snuffleupagus/renderTask-error-cleanup
Attempt to clean-up/restore pending rendering operations when errors occurs while a `RenderTask` runs (PR 10202 follow-up)
2019-01-27 15:12:59 +01:00
Tim van der Meij
d03d990e2e
Merge pull request #10501 from Snuffleupagus/getVisibleElements-avoid-unnecessary-backtrack
In `getVisibleElements`, check `firstVisibleElementInd` rather than `numViews` before backtracking (PR 10443 follow-up)
2019-01-27 15:06:13 +01:00
Jonas Jenwald
b50a512660 In getVisibleElements, check firstVisibleElementInd rather than numViews before backtracking (PR 10443 follow-up)
When `firstVisibleElementInd === 0`, regardless of the number of views, there's no reason to attempt to backtrack at all since it's never possible to find an element before the *first* one anyway.
2019-01-27 14:57:11 +01:00
Jonas Jenwald
5081063b9e Attempt to clean-up/restore pending rendering operations when errors occurs while a RenderTask runs (PR 10202 follow-up)
This piggybacks of the existing `cancel` functionality, to ensure that any pending operations are closed *and* that any temporary canvases are actually being removed.

Also simplifies `finishPaintTask` in `PDFPageView.draw` slightly, by converting it to an async function.
2019-01-26 16:02:51 +01:00
Tim van der Meij
40863eb275
Merge pull request #10489 from Snuffleupagus/single-page-scrollIntoView
Move more code/methods into `BaseViewer`, and simplify the `PDFSinglePageViewer._scrollIntoView` method slightly
2019-01-25 23:09:09 +01:00
Tim van der Meij
1eee1c5d2e
Merge pull request #10494 from Snuffleupagus/ColorSpace-isDefaultDecode
Reduce unnecessary duplication of the `isDefaultDecode` methods on `ColorSpace` instances
2019-01-25 22:43:28 +01:00
Jonas Jenwald
29f36d7a1b Reduce unnecessary duplication of the isDefaultDecode methods on ColorSpace instances
The recent PR 10482 made me realize that I missed an opportunity for simplification when doing the class conversion of this code in PR 10007.
2019-01-25 08:53:08 +01:00
Tim van der Meij
e2701d5422
Merge pull request #10482 from janpe2/indexed-decode
Implement Decode entry in Indexed images
2019-01-24 23:46:55 +01:00
Tim van der Meij
0d3c8d86a2
Merge pull request #10492 from Snuffleupagus/issue-10491
Ensure that `XRef.indexObjects` can handle object numbers with zero-padding (issue 10491)
2019-01-24 23:46:26 +01:00
Jonas Jenwald
41fbc71ef9 Ensure that XRef.indexObjects can handle object numbers with zero-padding (issue 10491)
All objects in the PDF document follow this pattern:
```
0000000001 0 obj
<<
% Some content here...
>>
endobj
0000000002 0 obj
<<
% More content here...
endobj

```
2019-01-24 22:37:18 +01:00
Jonas Jenwald
48e4adf770 Try to simplify the PDFSinglePageViewer._scrollIntoView method slightly, by unconditionally ensuring that rendering always occurs 2019-01-24 12:01:07 +01:00
Jonas Jenwald
06cda4c2e7 Move additional code/methods into BaseViewer and have the extending classes override/extend methods as necessary
This attempts to provide more "default" methods in the base class, in order to reduce unnecessary duplication and to improve self-documentation of the `BaseViewer` class slightly.
The following changes are made (in no particular order):
 - Have `BaseViewer` implement the `_scrollIntoView` method, and *extend* it as necessary in `PDFViewer`/`PDFSinglePageViewer`.
 - Simply inline the `BaseViewer._resizeBuffer` method, in `BaseViewer.update`, since there's only one call-site at this point.
 - Provide a default implementation of `_isScrollModeHorizontal` in `BaseViewer`, and have `PDFSinglePageViewer` override it.
 - Provide a default implementation of `_getVisiblePages`, and have `PDFViewer` extend it and `PDFSinglePageViewer` override it.
2019-01-24 10:31:06 +01:00
Tim van der Meij
9128335c4d
Merge pull request #10484 from Snuffleupagus/rm-mozcentral-streams
Stop bundling the `ReadableStream` polyfill in MOZCENTRAL builds (PR 10470 follow-up)
2019-01-23 22:30:42 +01:00
Tim van der Meij
f3da413ea5
Merge pull request #10483 from Snuffleupagus/mobile-viewer-PDFHistory-init
Update the `mobile-viewer` example to use the new `PDFHistory.initialize` format (PR 10423 follow-up)
2019-01-23 22:20:14 +01:00
Jonas Jenwald
249b199ff1 Stop bundling the ReadableStream polyfill in MOZCENTRAL builds (PR 10470 follow-up)
Based on the discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1521413, this patch simply removes the `ReadableStream` polyfill completely from MOZCENTRAL builds.

With this patch, the size of the `gulp mozcentral` build target is thus further reduced (building on PR 10470):

|       | `build/mozcentral`
|-------|-------------------
|master |   3 339 666
|patch  |   3 209 572
2019-01-23 20:33:20 +01:00
Jonas Jenwald
f06b2e4e9f Update the mobile-viewer example to use the new PDFHistory.initialize format (PR 10423 follow-up) 2019-01-23 15:27:19 +01:00
Jani Pehkonen
26121177ab Implement Decode entry in Indexed images 2019-01-22 22:51:04 +02:00
Brendan Dahl
d614cabfa0
Merge pull request #10480 from Snuffleupagus/debugger-FontInspector
[Regression] Fix the `FontInspector` in the PDFBug debugging tools
2019-01-22 10:02:58 -08:00
Jonas Jenwald
6a4dae927c [Regression] Fix the FontInspector in the PDFBug debugging tools
The `FontInspector` was completely broken by PR 10197, and trying to select a particular font (using the checkboxes) or clicking on a piece of text currently does nothing.
2019-01-22 13:22:36 +01:00
Tim van der Meij
f26129de26
Merge pull request #10474 from timvandermeij/updates
Update translations and packages
2019-01-20 16:40:25 +01:00
Tim van der Meij
810dbeb4e5
Update packages 2019-01-20 16:34:24 +01:00
Tim van der Meij
a84541b271
Update translations 2019-01-20 16:32:35 +01:00