Commit Graph

9112 Commits

Author SHA1 Message Date
Yury Delendik
ffa99397ad Merge pull request #7387 from Snuffleupagus/issue-5808
Attempt to ignore multiple identical Tf (setFont) commands in `PartialEvaluator_getTextContent` (issue 5808)
2016-08-30 15:21:41 -05:00
Tim van der Meij
a75b020423 Merge pull request #7575 from timvandermeij/update-l10n
Update translations
2016-08-28 16:20:21 +02:00
Tim van der Meij
d1ca5c11ec Update translations 2016-08-28 16:14:03 +02:00
Tim van der Meij
b0a0bef267 Merge pull request #7440 from Snuffleupagus/bug-874482
Prevent destinations with bad left/top values from scrolling the wrong page into view (bug 874482)
2016-08-28 15:47:40 +02:00
Tim van der Meij
f520616e00 Merge pull request #7570 from Snuffleupagus/issue-7569
Create a fallback annotation `id` for entries in `Annots` dictionaries that are not indirect objects (issue 7569)
2016-08-28 00:23:59 +02:00
Tim van der Meij
fb6fde9d00 Merge pull request #7574 from timvandermeij/unit-test-font-cleanup
Remove unused globals from fonts unit test file
2016-08-27 23:29:06 +02:00
Tim van der Meij
b81d661556 Remove unused globals from fonts unit test file 2016-08-27 23:20:03 +02:00
Tim van der Meij
d944c320b4 Merge pull request #7540 from Snuffleupagus/ProblematicCharRanges-unit-test
Add a unit-test to check that `ProblematicCharRanges` contains valid entries
2016-08-27 23:14:55 +02:00
Tim van der Meij
8aa9b790be Merge pull request #7573 from Snuffleupagus/mobile-viewer-async-open/close
[mobile-viewer] Add an async `close` method to the example, and change `open` to also be async (issue 7571)
2016-08-27 22:45:42 +02:00
Jonas Jenwald
65e9ff68aa [mobile-viewer] Add an async close method to the example, and change open to also be async (issue 7571)
Since the `mobile-viewer` example is based on the old FirefoxOS/B2G PDF viewer, it didn't need to have the same kind of `open/close` methods as the default viewer.
However, now that it has been re-purposed as a simple `mobile-viewer` example, it seems like a good idea to ensure that it has proper asynchronous `open/close` methods.

Fixes 7571.
2016-08-27 12:57:34 +02:00
Jonas Jenwald
088ce6c009 Add a unit-test to check that ProblematicCharRanges contains valid entries
When adding new entries to `ProblematicCharRanges`, you have to be careful to not make any mistakes since that could cause glyph mapping issues.
Currently the existing reference tests should probably help catch any errors, but based on experience I think that having a unit-test which specifically checks `ProblematicCharRanges` would be both helpful and timesaving when modifying/reviewing changes to this code.

Hence this patch which adds a function (and unit-test) that is used to validate the entries in `ProblematicCharRanges`, and also checks that we don't accidentally add more character ranges than the Private Use Area can actually contain.
The way that the validation code, and thus the unit-test, is implemented also means that we have an easy way to tell how much of the Private Use Area is potentially utilized by re-mapped characters.
2016-08-27 11:56:00 +02:00
Jonas Jenwald
78889646c8 Create a fallback annotation id for entries in Annots dictionaries that are not indirect objects (issue 7569)
According to the PDF specification, see http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#page=86, entries in `Annots` dictionaries should be indirect objects, but obviously there're PDF generators that ignore this.

Fixes 7569.
2016-08-27 10:56:16 +02:00
Brendan Dahl
0e20d44fef Merge pull request #7563 from brendandahl/upstream-l10n
Upstream l10n changes from Bug 1259859.
2016-08-24 09:49:17 -07:00
Brendan Dahl
8cf32cde6c Upstream l10n changes from Bug 1259859. 2016-08-24 09:47:36 -07:00
Jonas Jenwald
e5baf7ec36 Merge pull request #7330 from Snuffleupagus/issue-7188
Try to prevent `CanvasGraphics_getSinglePixelWidth` from intermittently returning incorrect values in Firefox (issue 7188)
2016-08-22 20:36:54 +02:00
Jonas Jenwald
5379749d4b Try to prevent CanvasGraphics_getSinglePixelWidth from intermittently returning incorrect values in Firefox (issue 7188)
Fixes 7188.
2016-08-22 20:00:24 +02:00
Tim van der Meij
200c8575ab Merge pull request #7555 from Snuffleupagus/primitives-async-unit-tests
Add unit-tests for asynchronous methods in `primitives.js`
2016-08-22 13:29:40 +02:00
Jonas Jenwald
db1526c59e Add unit-tests for asynchronous methods in primitives.js
In PR 7520, I missed the fact that we currently have no unit-tests for `Dict_getAsync`.
2016-08-21 18:44:58 +02:00
Brendan Dahl
a9c37c242e Merge pull request #7521 from brendandahl/bug-1291709
Bug 1291709 - PdfjsChromeUtils.jsm leaks browser.xul windows.
2016-08-17 14:35:39 -07:00
Tim van der Meij
ef45085f10 Merge pull request #7548 from Rob--W/window-print-avoid-microtask
Avoid window.print in a microtask
2016-08-17 21:35:12 +02:00
Tim van der Meij
b4c8814fc9 Merge pull request #7534 from Snuffleupagus/isName-name-check
Add a parameter to the `isName` function that enables checking not just that something is a `Name`, but also that the actual `name` properties matches
2016-08-17 15:48:42 +02:00
Rob Wu
76d29759c5 Avoid window.print in a microtask 2016-08-17 05:52:27 -07:00
Jonas Jenwald
084fc517fe Merge pull request #7021 from Snuffleupagus/bug-1250079
Add a `recoveryMode` that suppresses errors from the `Parser`, and utilize it when searching for the main trailer in `XRef_indexObjects` (bug 1250079)
2016-08-17 13:46:09 +02:00
Jonas Jenwald
544d29f5cb Add a recoveryMode that suppresses errors from the Parser, and utilize it when searching for the main trailer in XRef_indexObjects (bug 1250079)
Instead of having `Parser_getObj` fail unconditionally for the referenced PDF file, this patch attempts to let searching for the main trailer continue even if there are errors.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1250079.
2016-08-17 12:37:35 +02:00
Jonas Jenwald
83ce6f0b6d Adjust the (applicable) existing isName callsites to use the new isName(v, name) version of the function 2016-08-10 11:15:08 +02:00
Jonas Jenwald
af636aae96 Add a parameter to the isName function that enables checking not just that something is a Name, but also that the actual name properties matches
This is similar to the existing `isCmd` and `isDict` functions, which already support similar kind of checks.
With the updated `isName` function, we'll be able to simplify many callsites from: `isName(someVariable) && someVariable.name === 'someName'` to: `isName(someVariable, 'someName')`.
2016-08-10 11:15:03 +02:00
Brendan Dahl
94089960c0 Merge pull request #7532 from Snuffleupagus/PDFViewer-remove-obsolete-onAfterDraw-comment
Remove an obsolete comment for `onAfterDraw` in pdf_viewer.js
2016-08-08 10:53:01 -07:00
Jonas Jenwald
31cd23a6df Remove an obsolete comment for onAfterDraw in pdf_viewer.js
With the viewer code now being split into various components/files, having an obsolete comment in `PDFViewer` that references thumbnails despite there being no other mentions of them in the entire file seems strange.

*Note:* This comment is simply a left-over from older versions of PDF.js, where the *entire* default viewer code was placed in just one file (and where we unconditionally created thumbnails, regardless whether they were visible or not).
2016-08-08 13:49:31 +02:00
Jonas Jenwald
076e25f1ca Prevent destinations with bad left/top values from scrolling the wrong page into view (bug 874482)
There are PDF generators which create destinations with e.g. too large top values, which cause the wrong page to be scrolled into view because the offset becomes negative.
By ignoring negative offsets, we can prevent this issue, and get a similar behaviour as in Adobe Reader.

However, since we're also using `PDFViewer_scrollPageIntoView` in more cases than just when links (in the document/outline) are clicked, the patch adds a way to allow the caller to opt-out of this behaviour.
In e.g. the following situations, I think that we still want to be able to allow negative offsets: when restoring a position from the `ViewHistory`, when the `viewBookmark` button is used to obtain a link to the current position, or when maintaining the current position on zooming.

Rather than adding another parameter to `PDFViewer_scrollPageIntoView`, I've changed the signature to take an parameter object instead. To maintain backwards compatibility, I've added fallback code enclosed in a `GENERIC` preprocessor tag.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=874482.
2016-08-07 16:20:18 +02:00
Xiliang Chen
6cb77d6580 fix outline may jump to previous page issue 2016-08-07 16:20:18 +02:00
Tim van der Meij
ca81f4df18 Merge pull request #7529 from Snuffleupagus/setCurrentPageNumber-warn-on-outOfBounds
Log an error when the value passed to `set currentPageNumber` is out of bounds (PR 7502 followup)
2016-08-07 14:43:31 +02:00
Jonas Jenwald
7706cfa9fe Log an error when the value passed to set currentPageNumber is out of bounds (PR 7502 followup)
With PR 7502 we no longer dispatch an event when the `val` is out of bounds, so to better communicate why nothing happens this patch logs an error in that case (similar to the logging of errors when trying to set an invalid scale).

The way that the default viewer is currently implemented, means that e.g. keyboard short-cuts could trigger the new error. Hence this patch also adds the necessary validation code, both to `app.js` and `pdf_link_service.js` to prevent unnecessary errors.
2016-08-07 14:24:09 +02:00
Tim van der Meij
ac7b675603 Merge pull request #7526 from Snuffleupagus/PDFViewer_pagesRotation-validation
Add validation of the `rotation` argument passed to `set pagesRotation` in `PDFViewer`
2016-08-06 13:20:11 +02:00
Jonas Jenwald
50aeb00adf Add validation of the rotation argument passed to set pagesRotation in PDFViewer
*Similar to the validation done when setting page/scale.*
2016-08-06 13:01:17 +02:00
Jonas Jenwald
3a1e794512 Update l10n files 2016-08-06 12:44:06 +02:00
Tim van der Meij
f16b2d468a Merge pull request #7520 from Snuffleupagus/primitives-more-unit-tests
Add more unit-tests for `primitives.js`
2016-08-04 14:30:56 +02:00
Brendan Dahl
815c3a822f Bug 1291709 - PdfjsChromeUtils.jsm leaks browser.xul windows. 2016-08-03 14:18:40 -07:00
Yury Delendik
39412e5ace Merge pull request #7519 from timvandermeij/remove-amo
Stop building the AMO extension
2016-08-03 15:12:51 -05:00
Jonas Jenwald
d70e07fb90 Add more unit-tests for primitives.js 2016-08-03 17:04:12 +02:00
Tim van der Meij
79db293c36 Stop building the AMO extension
The AMO extension is no longer supported as PDF.js is integrated in
Firefox. It was already removed from the bot's preview messages around a
year ago and has not been used or updated since.
2016-08-03 14:44:18 +02:00
Jonas Jenwald
77c6ed5389 Attempt to ignore multiple identical Tf (setFont) commands in PartialEvaluator_getTextContent (issue 5808)
This patch improves the performance of issue 5808, but I'm not sure if it's enough to call it fixed. On average, this patch reduces the number of textLayer div's by a factor of 3, and it also reduces the time spend in `getTextContent` by a factor of ~2.

The PDF file is generated by `Scribus PDF`, which for reasons I cannot understand is placing redundant `Tf` commands before *every* showText command.
Note how the PDF file also contains lots of (basically) identical fonts, but with slightly different names, which causes unnecessary font-switching. This causes some unnecessary breaking of textLayer div's, but this issue cannot be easily worked around.
2016-07-27 21:37:52 +02:00
Yury Delendik
19105f0669 Merge pull request #7511 from timvandermeij/b2g-example
Convert the B2G viewer from an extension to an example
2016-07-27 13:57:52 -05:00
Tim van der Meij
a20f814265 Refactor the mobile viewer example
This mostly removes B2G-specific code and adds the styles from the B2G
components.
2016-07-27 17:31:52 +02:00
Tim van der Meij
a9dd2ab0ab Move B2G viewer to the examples folder 2016-07-27 17:31:52 +02:00
Tim van der Meij
b25bc27498 Remove B2G extension building target 2016-07-27 17:31:52 +02:00
Tim van der Meij
df0d21701a Merge pull request #7510 from timvandermeij/b2g-fix
Remove `previousPageNumber` from the B2G viewer
2016-07-27 15:59:55 +02:00
Tim van der Meij
e65606d271 Remove previousPageNumber from the B2G viewer 2016-07-27 15:55:40 +02:00
Tim van der Meij
0925503ce7 Merge pull request #7502 from Snuffleupagus/pagechanging-outOfBounds
Remove the `previousPageNumber` parameter from the `pagechanging`/pagechange` events, and stop dispatching the events if the input is out of bounds
2016-07-27 15:35:31 +02:00
Yury Delendik
a02e2686b9 Merge pull request #7475 from Snuffleupagus/api-getTextContent-combineTextItems
[api-minor] Add a parameter to `PDFPageProxy_getTextContent` that controls whether `PartialEvaluator_getTextContent` will attempt to combine same line text items
2016-07-27 08:34:24 -05:00
Tim van der Meij
336b26a39d Merge pull request #7506 from Snuffleupagus/annotation-missing-subtype
Prevent errors when parsing Annotations with missing (or invalid) /Subtype entries (issue 7446)
2016-07-25 16:25:29 +02:00