Commit Graph

8978 Commits

Author SHA1 Message Date
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
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
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
Tim van der Meij
f4b2ad4ec2 Merge pull request #7505 from timvandermeij/travis-ci-update
Use the latest stable Node.js version on Travis CI and enable caching
2016-07-25 15:29:37 +02:00
Tim van der Meij
7bbc2f079a Use the latest stable Node.js version on Travis CI and enable caching 2016-07-25 15:17:30 +02:00
Jonas Jenwald
558a22cd02 Prevent errors when parsing Annotations with missing (or invalid) /Subtype entries (issue 7446)
Note that I used a separate warning message for this case, instead of utilizing the same one as in the unsupported subtype case, to more clearly indicate that the PDF file itself is to blame rather than PDF.js.

Fixes 7446.
2016-07-25 13:59:26 +02:00
Jonas Jenwald
b7cb44af88 Remove the previousPageNumber parameter from the pagechanging/pagechange` events, and stop dispatching the events if the input is out of bounds
This patch attempts to cleanup a couple of things:
 - Remove the `previousPageNumber` paramater. Prior to PR 7289, when the events were dispatched even when the active page didn't change, it made sense to be able to detect that in an event listener. However, now that's no longer the case, and furthermore other similar events (e.g. `scalechanging`/`scalechange`) don't include information about the previous state.

 - Don't dispatch the events when the value passed to `set currentPageNumber` is out of bounds. Given that the active page doesn't change in this case, again similar to PR 7289, I don't think that the events should actually be dispatched in this case.

 - Ensure that the value passed to `set currentPageNumber` is actually an integer, to avoid any issues (note how e.g. `set currentScale` has similar validation code).

Given that these changes could possibly affect the PDF.js `mochitest` integration tests in mozilla-central, in particular https://dxr.mozilla.org/mozilla-central/source/browser/extensions/pdfjs/test/browser_pdfjs_navigation.js, I ran the tests locally with this patch applied to ensure that they still pass.
2016-07-25 10:08:53 +02:00
Brendan Dahl
5678486802 Merge pull request #7347 from Snuffleupagus/evaluator-more-Ref_toString
Slightly refactor the `fontRef` handling in `PartialEvaluator_loadFont` (issue 7403 and issue 7402)
2016-07-22 17:21:47 -07:00
Brendan Dahl
50d6e4f147 Merge pull request #7447 from Snuffleupagus/buildToUnicode-notdef
Ignore .notdef in the `differences` array when building a fallback `toUnicode` map in `PartialEvaluator_buildToUnicode` (issue 5256)
2016-07-22 14:33:32 -07:00
Jonas Jenwald
390c02a3e9 Attempt to cache fonts that are direct objects (i.e. Dicts), as opposed to Refs, to prevent re-rendering after cleanup from breaking (issue 7403 and issue 7402)
Fonts that are not referenced by `Ref`s are very uncommon in practice, but it can unfortunately happen. In this case, we're currently not caching them in the usual way, i.e. by `Ref`, which leads to failures when a page is rendered after `cleanup` has run.
The simplest solution would have been to remove the `font.translated` workaround, but since this would have meant loading these kind of fonts over and over, the patch attempts to be a bit clever about this situation.

Note that if we instead loaded fonts per *page*, instead of per document, this issue wouldn't have existed.
2016-07-21 16:04:07 +02:00
Jonas Jenwald
4fe891c5e7 Add a reduced test-case for issue 7403 2016-07-21 16:04:07 +02:00
Jonas Jenwald
2e9cd3ea64 Slightly refactor the fontRef handling in PartialEvaluator_loadFont (issue 7403 and issue 7402)
Originally, I was just going to change this code to use `Ref_toString` in a couple more places. When I started reading the code, I figured that it wouldn't hurt to clean up a couple of comments. While doing this, I noticed that the logic for the (rare) `isDict(fontRef)` case could do with a few improvements.

There should be no functional changes with this patch, but given the added reference checks, we will now avoid bogus `Ref`s when resolving font aliases. In practice, as issue 7403 shows, the current code can break certain PDF files even if it's very rare.

Note that the only thing that this patch will change, is the `font.loadedName` in the case where a `fontRef` is a reference *and* the font doesn't have a descriptor. Previously for `fontRef = Ref(4, 0)` we'd get `font.loadedName = 'g_d0_f4_0'`, and with this patch `font.loadedName = g_d0_f4R`, which is actually one character shorted in most cases. (Given that `Ref_toString` contains an optimization for the `gen === 0` case, which is by far the most common `gen` value.)

In the already existing fallback case, where the `fontName` is used to when creating the `font.loadedName`, we allow any alphanumeric character. Hence I don't see how (as mentioned above) e.g. `font.loadedName = g_d0_f4R` would be an issue here.
2016-07-21 16:03:33 +02:00
Tim van der Meij
10f9f11ec4 Merge pull request #7490 from Snuffleupagus/issue-7426
Don't map glyphs to the Lepcha Unicode block (issue 7426)
2016-07-21 14:39:19 +02:00
Jonas Jenwald
f297e4d17c [api-minor] Add a parameter to PDFPageProxy_getTextContent that controls whether PartialEvaluator_getTextContent will attempt to combine same line text items
From the discussion in issue 7445, it seems that there may be cases where an API consumer would want to get the text content as is, without combined text items.
2016-07-19 13:38:57 +02:00
Jonas Jenwald
9228a04061 Merge pull request #7493 from Snuffleupagus/issue-7492
Catch errors and continue parsing in `parseCMap` (issue 7492)
2016-07-19 10:31:26 +02:00
Jonas Jenwald
90d19de935 Catch errors and continue parsing in parseCMap (issue 7492)
After PR 7039, the PDF file in issue 7492 no longer renders at all, but note that text selection wasn't working correctly previously.

The problem with the PDF file in issue 7492 is that the `cMap`, in the `toUnicode` entry in the font, contains an invalid name:
```
/CMapName /-usr-share-fonts-truetype-Panton-Panton Family-Fontfabric - Panton.otf,000-UTF16 def
```
When we parse that line, things obviously break because there are spaces present in the wrong places.
To avoid that issue, the patch simply lets `parseCMap` continue when errors are encountered, to try and recover usable data. Note that by not aborting immediatly when an error is encountered, we are also able to fix the text selection.

Obviously, it could be argued that we should just immediatly reject a corrupt `cMap`. But given that they usually are correct, it seems that trying to recover as much data as possible from corrupt one can only be a good thing for both glyph mapping and text selection.

Fixes 7492.
2016-07-18 16:39:56 +02:00
Tim van der Meij
0da97ad2a0 Merge pull request #7485 from Snuffleupagus/resetCurrentPageView
Ensure that we don't reset the current page view if the user inputs an invalid page number (PR 7289 follow-up)
2016-07-17 19:49:11 +02:00
Tim van der Meij
3ab68f2e06 Merge pull request #7489 from ka7/spelling
trivial spelling fixes
2016-07-17 19:40:17 +02:00
Jonas Jenwald
64783c8b6e Don't map glyphs to the Lepcha Unicode block (issue 7426)
In the PDF file in the issue, some of the glyphs end up being mapped to the Lepcha Unicode block; see https://en.wikipedia.org/wiki/Lepcha_(Unicode_block).
This didn't use to matter, but after HarfBuzz updates that improved support for Lepcha fonts, in particular https://bugzilla.mozilla.org/show_bug.cgi?id=1249861, some glyphs are now moved horizontally.
To avoid that, this patch adds the Lepcha block to the list of Unicode ranges that we skip when building the glyph mapping.

Fixes 7426.
2016-07-17 16:53:36 +02:00
klemens
6f03f62327 trivial spelling fixes 2016-07-17 14:33:41 +02:00
Jonas Jenwald
11381cdb0f Update l10n files 2016-07-15 11:48:37 +02:00
Jonas Jenwald
9f34700e0d Ensure that we don't reset the current page view if the user inputs an invalid page number (PR 7289 follow-up)
After PR 7289, we'll now reset the current page view in cases where I don't think we should. To avoid this, this patch ensures that we'll not modify the position when the page number is out-of-bounds.

**STR:**
1. Open http://mozilla.github.io/pdf.js/web/viewer.html#page=1&zoom=auto,-98,696
2. Enter an invalid number, e.g. `1000`, in the `pageNumber` input.

**ER:**
The current position in the document shouldn't change, since the page number wasn't valid.

**AR:**
The document resets to the top of the page `1`.
2016-07-14 12:46:33 +02:00
Tim van der Meij
1695893526 Merge pull request #7478 from PeterDaveHelloKitchen/image-optimize
optimize png images using zopflipng
2016-07-10 13:46:54 +02:00
Peter Dave Hello
625d637297 optimize png images using zopflipng 2016-07-10 17:49:16 +08:00
Tim van der Meij
223adf4656 Merge pull request #7481 from Snuffleupagus/firefox-addon-remove-compatibility
[Firefox addon] Remove compatibility.js
2016-07-09 20:45:46 +02:00
Tim van der Meij
bd562bb39c Merge pull request #7480 from Snuffleupagus/remove-MozBlobBuilder-fallback
Remove the obsolete `MozBlobBuilder` fallback from the `createBlob` utility function
2016-07-09 20:40:24 +02:00
Jonas Jenwald
a69e862bc4 [Firefox addon] Remove compatibility.js
This was added in PR 4865, but hasn't been necessary for quite some time now (and the minimum version is currently Firefox 38 for the addon).
2016-07-09 17:59:06 +02:00
Jonas Jenwald
8f4ec669d0 Remove the obsolete MozBlobBuilder fallback from the createBlob utility function
`MozBlobBuilder` has been obsolete since Firefox 14, so there's no reason to keep this code around anymore.
2016-07-09 16:37:05 +02:00
Tim van der Meij
43613f19f9 Merge pull request #7466 from Snuffleupagus/PDFViewerApplication-open-remove-fallback-args
Remove handling of fallback arguments from `PDFViewerApplication.open`
2016-07-09 15:51:25 +02:00
Tim van der Meij
d728651455 Merge pull request #7479 from Snuffleupagus/recoverGlyphName-warn-to-info
Change the `warn` to `info` in `recoverGlyphName` to reduce the console spam
2016-07-09 15:34:59 +02:00
Jonas Jenwald
51e46fa1a7 Change the warn to info in recoverGlyphName to reduce the console spam
After PR 7441, where `recoverGlyphName` is used a lot more than before, many PDF files will generate a lot of warnings the console. For normal usage, compared to debugging/development, this is probably more annoying than helpful.
2016-07-09 12:08:41 +02:00
Yury Delendik
bca1aebeac Merge pull request #7458 from Snuffleupagus/updateUIToolbar
Consolidate updating of various Toolbar state (e.g. page and scale) in one method in `PDFViewerApplication`
2016-07-08 12:34:39 -05:00
Yury Delendik
b87676078c Merge pull request #7455 from Snuffleupagus/issue-7448
Ensure that the necessary src/* dependencies are loaded before the viewer, when it's run with `gulp server` (issue 7448)
2016-07-08 12:34:09 -05:00
Tim van der Meij
b6826a46a8 Merge pull request #7453 from simoncpu/master
Expose the text widget's maximum length.
2016-07-07 01:03:40 +02:00
Tim van der Meij
10cd37cfb2 Merge pull request #7473 from Snuffleupagus/links-mxr-to-dxr
Update `mxr.mozilla.org` links to point to `dxr.mozilla.org` instead
2016-07-06 22:26:38 +02:00
Brendan Dahl
1f3f4a8dd7 Merge pull request #7441 from Snuffleupagus/issue-7439
Fallback to attempt to recover standard glyph names when amending the `charCodeToGlyphId` with entries from the `differences` array in `type1FontGlyphMapping` (issue 7439)
2016-07-06 13:02:21 -07:00
Jonas Jenwald
87229a086f Update mxr.mozilla.org links to point to dxr.mozilla.org instead
Given that MXR has been officially retired, see https://groups.google.com/forum/#!topic/mozilla.dev.platform/_k-ditFrne4, we've got a couple of links that are no longer working.
2016-07-06 11:42:16 +02:00