Commit Graph

9414 Commits

Author SHA1 Message Date
Yury Delendik
b4a90121f0 Merge pull request #7692 from yurydelendik/v1.6.210
Release of 1.6.210
2016-10-04 12:21:07 -05:00
Yury Delendik
970cf8e891 Release of 1.6.210 2016-10-04 12:19:51 -05:00
Yury Delendik
4ce2356a59 Merge pull request #7691 from yurydelendik/version-1.6
Version 1.6
2016-10-04 12:14:18 -05:00
Yury Delendik
c1539f584a Version 1.6 2016-10-04 12:12:37 -05:00
Yury Delendik
d2a4974785 Merge pull request #7681 from Snuffleupagus/bug-1122280-unit-test
Add a unit-test for annotations where the `URI` action has an incorrect encoding (bug 1122280, PR 5999)
2016-09-30 08:28:23 -05:00
Jonas Jenwald
93830032ac Add a unit-test for annotations where the URI action has an incorrect encoding (bug 1122280, PR 5999) 2016-09-30 11:44:24 +02:00
Tim van der Meij
1564dc311a Merge pull request #7618 from jeremypress/fix-enhanced-double-click
fixing #7590 by delaying div shrink after mouse up
2016-09-28 23:30:35 +02:00
Yury Delendik
869914529d Merge pull request #7656 from Snuffleupagus/issue-4090
Attempt to skip zero bytes at the end of Scan blocks when decoding JPEG images (issue 4090)
2016-09-28 11:43:38 -05:00
Yury Delendik
b4be1e91ab Merge pull request #7653 from staktrace/touch_swipe_presentation_mode
Add support for touch-swiping between pages in presentation mode (bug…
2016-09-28 11:30:37 -05:00
Kartikaya Gupta
ba9e8cb184 Add support for touch-swiping between pages in presentation mode (bug 1300878). 2016-09-28 11:35:25 -04:00
Jonas Jenwald
54ee83eb12 Attempt to skip zero bytes at the end of Scan blocks when decoding JPEG images (issue 4090) 2016-09-28 16:31:02 +02:00
Tim van der Meij
a9a3396f3d Merge pull request #7181 from yurydelendik/mouse-wheel
Simplified wheel processing
2016-09-27 22:50:50 +02:00
Yury Delendik
223a18ccc8 Simplified wheel processing. 2016-09-27 15:27:42 -05:00
Tim van der Meij
7f381c8064 Merge pull request #7661 from Snuffleupagus/bug-956965
Respect the 'ColorTransform' entry in the image dictionary when decoding JPEG images (bug 956965, issue 6574)
2016-09-27 20:22:43 +02:00
Jonas Jenwald
116ba19dd9 Respect the 'ColorTransform' entry in the image dictionary when decoding JPEG images (bug 956965, issue 6574)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=956965.
Fixes 6574.
2016-09-26 21:55:43 +02:00
Jonas Jenwald
a22f0ae820 Only skip parsing a stream in Parser_makeFilter when we know for sure that it is empty (PR 6372 follow-up)
For PDF files with multiple `/Filter`s, where the `/Length` entry is zero, we fail to render the file correctly. The reason is that `maybeLength` is `null` for the every filter except the first, and `!maybeLength` is thus truthy.
Hence it seems that we should completely ignore the `/Length` entry and also explicitly check `maybeLength === 0`.

Note that I've not (yet) come across a PDF file with this issue in the wild, but given all the stupid things PDF generators do I wouldn't be surprised if such a file actually exists. In order to prevent a possible future bug, I'm submitting this patch which includes a hand-edited PDF file that we currently cannot render correctly (but e.g. Adobe Reader can).
2016-09-25 12:40:15 +02:00
Jonas Jenwald
4d2de9b47e Add a reduced load test for issue 7665 2016-09-25 00:19:42 +02:00
Jonas Jenwald
3e77cf6b32 Prevent an infinite loop in XRef_fetchUncompressed for encrypted PDF files with indirect objects in the /Encrypt dictionary (issue 7665) 2016-09-25 00:18:47 +02:00
Jonas Jenwald
6c263c1994 Merge pull request #7649 from timvandermeij/interactive-forms-tx-comb
Text widget annotations: implement comb support
2016-09-22 11:36:30 +02:00
Tim van der Meij
375229d6b9 Widget annotations: simplify field flag handling
Directly use the hexadecimal representation, just like the
`AnnotationFlags`, to avoid calculations and to improve readability.
This allows us to simplify the unit tests for text widget annotations as
well.
2016-09-21 21:11:37 +02:00
Tim van der Meij
7820f58c49 Merge pull request #7647 from Snuffleupagus/Annotation_appendToOperatorList-pass-in-forms
Ensure that `test/driver.js` actually takes the same `Annotation` code-path as the viewer when running `forms` tests (PR 7633 follow-up)
2016-09-21 21:09:44 +02:00
Yury Delendik
431af8cf85 Merge pull request #7652 from Snuffleupagus/resize-event-handler-prevent-error-before-eventBus-initialized
Prevent errors if the 'resize' event is fired before the `eventBus` has been initialized
2016-09-21 08:22:29 -05:00
Jonas Jenwald
1a2f142a14 Prevent errors if the 'resize' event is fired before the eventBus has been initialized
When opening a PDF file that triggers the browser fallback bar in the Firefox addon/built-in version, e.g. http://web.archive.org/web/20110918100215/http://www.irs.gov/pub/irs-pdf/f1040.pdf (with forms *disabled*), and then reloading the document an error can be thrown.
The reason is that displaying the fallback bar triggers 'resize' events, and they can arrive *before* the viewer has had a chance to run all the necessary initialization code.
2016-09-21 13:32:17 +02:00
Jonas Jenwald
5f16cbd2c0 When rendering forms, don't use element.value since it prevents the AnnotationLayer rasterizer (in test/driver.js) from parsing the elements correctly
Without this, the reference test images will have empty fields despite the viewer working as intended.
2016-09-21 12:33:04 +02:00
Jonas Jenwald
3a105e37f4 Ensure that test/driver.js actually takes the same Annotation code-path as the viewer when running forms tests (PR 7633 follow-up)
Unfortunately PR 7633 missed, and I didn't catch it during review, to update `test/driver.js` such that the `forms` tests takes the correct code-path.
This resultet in the `forms` reference test images looking better than they should, and more problematicly differing from the rendering in the viewer.

With this patch, the tests now correctly skip over any `Appearance` streams.
The `forms` tests now highlights quite clearly (e.g. look at `annotation-tx2.pdf`/`annotation-tx3.pdf`) that we cannot just skip the `Appearance` streams when rendering forms. Hence we're going to have to find a way to fix that *before* enabling forms by default, since both display *and* print would look completely wrong otherwise.
Finally, this patch also uncovers one more existing bug that still needs to be fixed, since the current `rasterizeAnnotationLayer` in `test/driver.js` isn't able to handle the contents of e.g. `<input>` and `<textarea>`.
2016-09-21 12:21:20 +02:00
Jonas Jenwald
ded01356c7 Pass in the renderInteractiveForms parameter to Annotation_appendToOperatorList, in Page_getOperatorList, instead of to the Annotation constructor (PR 7633 follow-up)
When debugging issue 7643, I noticed that the `forms` tests currently doesn't look like the rendering in the viewer (with `renderInteractiveForms = true` set).
After scratching my head for a little while, I realized that PR 7633 make the implicit assumption that `Page_getOperatorList` (in `core/document.js`) is called *before* fetching the annotation with `PDFPageProxy_getAnnotations` (in `display/api.js`).

Hence this patch, that changes it so that we instead pass in the `renderInteractiveForms` parameter to `Annotation_appendToOperatorList` to ensure that it's always correctly set.
2016-09-21 12:21:20 +02:00
Tim van der Meij
6100ab4b18 Text widget annotations: implement comb support 2016-09-20 22:31:10 +02:00
Brendan Dahl
15e1ae4e3f Merge pull request #7639 from Snuffleupagus/bug-1252420
Replace empty CharStrings with '.notdef' in `Type1Font_wrap` to prevent OTS from rejecting the font (bug 1252420)
2016-09-20 11:56:47 -07:00
Jonas Jenwald
9e927ded93 Update l10n files 2016-09-20 12:51:52 +02:00
Tim van der Meij
c0e82dbc38 Merge pull request #7642 from Rob--W/crx-type-from-content-disposition-header
Deduct file type from content-disposition if needed
2016-09-19 01:20:58 +02:00
Tim van der Meij
ab1b4cec5d Merge pull request #7640 from timvandermeij/interactive-forms-rm-global
Interactive forms: remove global PDFJS usage
2016-09-19 01:02:44 +02:00
Tim van der Meij
2da2c45889 Interactive forms: remove global PDFJS usage 2016-09-19 00:12:42 +02:00
Tim van der Meij
2d287c867e Merge pull request #7645 from Snuffleupagus/TextWidgetAnnotation-double-rendering
Prevent rendering `TextWidgetAnnotation`s in both the `core`/`display` layer (issue 7643)
2016-09-18 22:49:32 +02:00
Jonas Jenwald
170871ab3d Prevent rendering TextWidgetAnnotations in both the core/display layer (issue 7643) 2016-09-18 15:42:22 +02:00
Rob Wu
ae74e1bbd6 Deduct file type from content-disposition
A user encountered a response that looks like:

URL: some gibberish
Headers:

    Content-Type: application/octet-stream
    Content-Disposition: attachment; filename="something.pdf"

In the Chrome extension, the "attachment" content disposition is almost
always ignored (i.e. the PDF Viewer will try to view it anyway). So we
need to fall back to the Content-Disposition header if the URL check is
inconclusive.
2016-09-17 22:34:18 -07:00
Tim van der Meij
f062695d62 Merge pull request #7633 from timvandermeij/interactive-forms-tx-flags
Text widget annotations: support read-only/multiline fields and improve testing
2016-09-17 17:19:47 +02:00
Tim van der Meij
dbea302a6e Text widget annotations: do not render on canvas as well
If interactive forms are enabled, then the display layer takes care of
rendering the form elements. There is no need to draw them on the canvas
as well. This also leads to issues when values are prefilled, because
the text fields are transparent, so the contents that have been rendered
onto the canvas will be visible too.

We address this issue by passing the `renderInteractiveForms` parameter
to the render task and handling it when the page is rendered (i.e., when
the canvas is rendered).
2016-09-17 15:24:48 +02:00
Tim van der Meij
adf0972ca5 Text widget annotations: improve unit and reference tests
This patch improves the unit tests by testing the support for read-only
and multiline fields. Moreover, we add a reference test to ensure that
the text widgets are not only rendered, but also that their contents are
styled properly.

Finally, we perform minor improvements in `src/core/annotation.js`, for
example adding missing comments.
2016-09-17 15:24:48 +02:00
Tim van der Meij
f6965fadc0 Text widget annotations: support multiline and read-only fields
Moreover, this patch provides us with a framework for handling field
flags in general for all types of widget annotations.
2016-09-17 15:24:47 +02:00
Jonas Jenwald
aadcbe98c8 Replace empty CharStrings with '.notdef' in Type1Font_wrap to prevent OTS from rejecting the font (bug 1252420)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1252420.
2016-09-17 14:39:10 +02:00
Jonas Jenwald
4acd31f51e Merge pull request #7550 from Snuffleupagus/Type1-toUnicode-builtInEncoding-fallback
For embedded Type1 fonts without included `ToUnicode`/`Encoding` data, attempt to improve text selection by using the `builtInEncoding` to amend the `toUnicode` map (issue 6901, issue 7182, issue 7217, bug 917796, bug 1242142)
2016-09-16 17:51:55 +02:00
Brendan Dahl
834a7ff329 Merge pull request #7636 from yurydelendik/rm-refresh
Drops unneeded HTTP refresh header for the extension.
2016-09-15 10:01:11 -07:00
Yury Delendik
503bf45eca Drops unneeded HTTP refresh header for the extension.
Some sites doing that by mistake. Aligning the extension functionality with behavior of other browsers/plugins..
2016-09-15 09:12:16 -05:00
Tim van der Meij
26da2d57ce Merge pull request #7632 from Snuffleupagus/more-efficient-expandTextDivs
[EnhanceTextSelection] Make `expandTextDivs` more efficient by updating all styles at once instead of piecewise
2016-09-15 16:01:07 +02:00
Tim van der Meij
3b94ecf563 Merge pull request #7634 from Snuffleupagus/remove-mozDash
Remove the deprecated `mozDash`/`mozDashOffset` canvas 2D context methods
2016-09-15 14:10:31 +02:00
Jonas Jenwald
8eaa2cbce3 Remove the deprecated mozDash/mozDashOffset canvas 2D context methods
According to [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility) the standard versions of these methods have been supported since Firefox 27, which was released over two and a half years ago. (See the dates in https://wiki.mozilla.org/RapidRelease/Calendar#Past_branch_dates)

Furthermore the non-standard properties are now in the process of being removed, please see https://groups.google.com/forum/#!topic/mozilla.dev.platform/UIudMABegcY.
Hence I don't think that we need to keep the old `moz` prefixed ones as fallback any more.
2016-09-15 10:05:40 +02:00
Jonas Jenwald
cb5f9df0c8 [EnhanceTextSelection] Make expandTextDivs more efficient by updating all styles at once instead of piecewise
I intended to provide proper benchmarking results here, as outlined in https://github.com/mozilla/pdf.js/wiki/Benchmarking-your-changes, but after wasting a couple of hours over the weekend getting weird results I gave up.
It appears that there's a lot of, i.e. way too much, variance between subsequent runs of `text` tests for the results to be meaningful.
(Previously I've only benchmarked `eq` tests, so I don't know if the `text` tests has never worked well or if it's a newer problem. For reference, please see the results of back-to-back benchmark runs on the current `master` with a *very* simple manifest file: [link here].)

Instead I used `console.time/timeEnd` in `appendText` and `expandTextDivs` to be able to compare the performance with/without the patch. The entire viewer was (skip-cache) reloaded between measurements, and the result are available here: [link here].
Given the troubles I've had with benchmarking, I've not yet computed any statistics on the results (e.g. mean, variance, confidence intervals, and so on).
However, just by looking at the data I think it's safe to say that this patch first of all doesn't seem to regress the current performance. Secondly it certainly looks *very* likely that this patch actually improves the performance, especially for the one-glyph-per-text-div case (cf. issue 7224).

Re: issue 7584.
2016-09-14 21:19:28 +02:00
Jonas Jenwald
a7c35025fe Merge pull request #7629 from timvandermeij/interactive-form-unit-tests
Text widget annotations: implement unit testing and sanitize data values
2016-09-13 16:52:30 +02:00
Tim van der Meij
323e86c442 Text widget annotations: implement unit testing and sanitize data values 2016-09-13 14:57:11 +02:00
Jonas Jenwald
356b321f6d Fallback to the StandardEncoding for Nonsymbolic fonts without /Encoding entry (issue 7580)
Even though this patch passes all tests (unit/font/reference) locally, including the new ones that I added in PR 7621, I'm still a bit nervous about modifying the code that choose the fallback encoding for fonts without an `/Encoding` entry.
Note that over the years this code has been changed on a number of occasions, see a possibly incomplete [list here], to deal with various cases of incorrect font data.

According to the PDF specification, see http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G8.1904184, it seems that we should fallback to the `StandardEncoding` for Nonsymbolic fonts.
There's obviously a risk that fixing this particular issue *could* break other PDF files for which we don't have tests. However I've tried to change the logic as little as possible in this patch, to hopefully reduce possible breakage.

Based on debugging numerous font issue, it seems that a lot of fonts actually set the Symbolic flag, even when they are in fact *not* Symbolic. Fonts actually marked as Nonsymbolic seem to be somewhat less common, which I hope should reduce the risk of the patch somewhat.

Fixes 7580.
2016-09-13 14:07:16 +02:00