Commit Graph

8017 Commits

Author SHA1 Message Date
Yury Delendik
8e59528e60 Merge pull request #6175 from Rob--W/font-loading-promises
fontLoadPromises -> fontsToLoad
2015-07-06 16:00:47 -05:00
Jonas Jenwald
e5b7258586 Merge pull request #6180 from timvandermeij/border-regression
Do not draw a border if neither a Border nor a BS entry is present
2015-07-06 18:04:57 +02:00
Jonas Jenwald
5aaf18db12 Merge pull request #6169 from yurydelendik/rm-playpreview
Bug 1179262 - Remove PlayPreview registration from PDF Viewer.
2015-07-06 17:32:29 +02:00
Rob Wu
f9dd7318f7 fontLoadPromises -> fontsToLoad
fontsToLoad is always an empty array, Promise.all should wait for
fontLoadPromises instead of fontsToLoad.
2015-07-06 17:31:42 +02:00
Jonas Jenwald
d0c071a40d Prevent re-rendering of pages because of rounding errors when computing the scale value
Currently if the zoom level is reset multiple times in a row, i.e. by pressing <kbd>Ctrl</kbd>+<kbd>0</kbd>, the pages can be re-rendered each time even though their size shouldn't change. Whether this happens can depend on the size of the viewer, but documents with pages in landscape mode seem to be very susceptible to this. (An example is: https://wiki.mozilla.org/images/5/55/MobileOpportunity.pdf.)
This can also effect documents with pages in portrait mode, when they are displayed in Presentation Mode.

The reason for this unnecessary re-rendering is that due to limited numerical precision, the new scale value may change in *only* the last decimal place.
2015-07-06 17:22:03 +02:00
Rob Wu
c7a5da332c Add --downloadOnly flag to test.js 2015-07-06 17:17:11 +02:00
Rob Wu
ffbe669730 [CRX] Respect download requests in main frame
When the URL contains "=download", respect the Content-Disposition
header in the Chrome extension.
2015-07-06 17:13:44 +02:00
Jonas Jenwald
d9975ea778 Move annotation related CSS rules from pdf_viewer.css to its own file
This is similar to the already existing, separate, CSS file used for the `textLayer`, and it's necessary in order for the `pageviewer` components example to actually show annotations correctly.
2015-07-06 16:37:33 +02:00
Jonas Jenwald
4364b37e55 Simplify the SimpleLinkService and use it to pass in a linkService instance in DefaultAnnotationsLayerFactory
Considering that most methods of `SimpleLinkService` are complete stubs, or practically "useless" considering what they return, we can actually simplify it even more.

*Note:* This depends on the previous patch, that did a small amount of refactoring of `PDFViewer_scrollPageIntoView`, since `PDFViewer.linkService.page` is no longer accessed.

----------

Currently the `pageviewer` components example doesn't work correctly (an error is printed in the console), since no `linkService` is present when the `AnnotationsLayerBuilder` is created.

*Note:* Given that this uses the `SimpleLinkService`, clicking on e.g. internal links won't actually do anything. However, given that internal links (and similar features) are pretty much useless when only *one* page is loaded the `pageviewer` example, I don't think that really matters.
Also, using the complete `PDFLinkService` would require a `PDFViewer` instance. That would significantly complicate the example, thus making it both less clear and less self contained.
2015-07-06 16:34:55 +02:00
Jonas Jenwald
ac3233bfa4 Use "private" properties in PDFViewer_scrollPageIntoView
Currently in `PDFViewer_scrollPageIntoView`, we're accessing a number of properties in an indirect and overly complicated way. In particular, using `this.linkService.page` is a *very* roundabout way to access `this.currentPageNumber`.

The reason for this appears to be entirely historical, since prior to PR 5361 the code was placed in `PDFPageView` (or `PageView` as it was called at the time).
2015-07-06 16:33:01 +02:00
Jonas Jenwald
9e08737f4e Merge pull request #6178 from timvandermeij/remove-interactive-annotation
Remove InteractiveAnnotation abstraction
2015-07-06 16:29:09 +02:00
Tim van der Meij
3a6eed6248 Do not draw a border if neither a Border nor a BS entry is present
Fixes #6179.
2015-07-06 14:48:59 +02:00
Tim van der Meij
5aa1d9fdfd Remove InteractiveAnnotation abstraction
This became obsolete in bdeca30fbf. All it does is call the Annotation contructor and add hasHtml. This patch lets the Link and Text annotations directly extend the Annotation class and add hasHtml themselves.

This patch also removes an unused global.
2015-07-06 11:58:26 +02:00
Tim van der Meij
56e3a66c16 Merge pull request #6177 from Snuffleupagus/pdfPresentationMode-pdfViewer
Pass in a `PDFViewer` instance to `PDFPresentationMode` and use it to eliminate all references to `PDFViewerApplication`
2015-07-06 11:19:31 +02:00
Jonas Jenwald
6b2810f1f0 Pass in a PDFViewer instance to PDFPresentationMode and use it to eliminate all references to PDFViewerApplication
This patch is the the first step towards to addressing issue 6158, which will be done by refactoring the code for setting/getting the current scale in `viewer.js`.
2015-07-06 09:49:51 +02:00
Jonas Jenwald
7a6a3f10ad Merge pull request #6176 from Rob--W/crx-ignore-embed-6174
[CRX] Ignore PDFs from responses to POST requests
2015-07-05 13:15:52 +02:00
Rob Wu
4367dd5130 [CRX] Ignore PDFs from responses to POST requests
As explained in
https://github.com/mozilla/pdf.js/issues/6174#issuecomment-118502802.

To verify that this patch works:
1. Build the Chrome extension (node make chromium)
2. Load the Chrome extension (at chrome://extensions)
3. Visit https://robwu.nl/pdfjs/issue6174/.
4. Verify that PDF.js is not used to load the PDF. Either Chrome's
   default PDF Viewer is used, or the PDF is offered as a file download.
2015-07-05 01:01:03 +02:00
Tim van der Meij
93bc8ea64c Merge pull request #6173 from Snuffleupagus/pr-6171-tests
Add more reduced test-cases for PR 6171
2015-07-04 21:06:04 +02:00
Yury Delendik
3ffed9d083 Merge pull request #6170 from Rob--W/zoom-at-cursor
Zoom relative to cursor position via mouse wheel
2015-07-03 13:14:11 -05:00
Jonas Jenwald
60fc462bd6 Add more reduced test-cases for PR 6171 2015-07-03 13:14:41 +02:00
Jonas Jenwald
e3b348162d Merge pull request #6171 from yurydelendik/usepua
Adds more characters to the PUA range
2015-07-03 11:22:06 +02:00
Yury Delendik
0787182e6f Adds more characters to the PUA range 2015-07-02 16:47:47 -05:00
Rob Wu
2932f7c676 Zoom relative to cursor position via mouse wheel
Before this patch, zooming in/out via the scroll wheel caused the page
to be zoomed relative to the upper-left corner of the page, i.e. the
upper-left corner of the page stays at a fixed position.

After this patch, the page is zoomed relative to the cursor position,
i.e. after zooming in/out, the part under the cursor 'has not moved'.

This only applies when the page does not fit in the viewport, because
pages smaller than the viewpoer are always centered.
2015-07-02 23:20:37 +02:00
Yury Delendik
0b5330781c Bug 1179262 - Remove PlayPreview registration from PDF Viewer. 2015-07-02 12:59:17 -05:00
Yury Delendik
9ad6af4a3f Merge pull request #5531 from Rob--W/moz-chunked-only-moz
Feature-test moz-chunked-arraybuffer before use
2015-07-02 09:08:08 -05:00
Jonas Jenwald
d0477302be Add a supplemental glyph map for non-embedded ArialBlack fonts (issue 5801)
This should, hopefully, finally fix 5801.
2015-07-01 22:16:52 +02:00
Brendan Dahl
d8e201446d Merge pull request #6135 from Snuffleupagus/issue-5677-v2
Skip mapping of CIDFontType2 glyphs when the font either has a |IdentityToUnicodeMap| or a |toUnicodeMap| with 65536 elements (issue 5677)
2015-07-01 11:15:55 -07:00
Brendan Dahl
9bb2908d67 Merge pull request #6155 from LilyBin/cmap
Update Adobe CMaps URL and license
2015-07-01 11:03:42 -07:00
Brendan Dahl
98339f63a8 Merge pull request #5585 from timvandermeij/annotation-layer-borderstyle
Annotation border styles
2015-07-01 10:48:12 -07:00
Rob Wu
2e63dcdcf5 Feature-test moz-chunked-arraybuffer before use 2015-07-01 15:31:40 +02:00
Tim van der Meij
0a744fb326 Merge pull request #5947 from yurydelendik/b2g-viewer
Simplify B2G viewer
2015-07-01 00:26:44 +02:00
Yury Delendik
f3c3b1fc2d Removes B2G preprocessing directives. 2015-06-30 16:53:32 -05:00
Yury Delendik
1b847df2f3 Using pdfjs-dist as a library for b2g viewer. 2015-06-30 16:53:32 -05:00
Jonas Jenwald
d940078d95 Make sure that the document is rendered on zooming and rotation for PDFViewer instances using the defaultRenderingQueue
In `viewer.js` we have code that ensures that the document is re-rendered on zooming and rotation. However, for `components` based viewers this might not work correctly, since there's currently no code which handles that.

Note that there is a good chance that this "just works" in many `components` viewers already, thanks to the `watchScroll` function.
The explanation is that zooming or rotation, most of the time, causes the viewer to change its (scrollable) size, thus triggering `PDFViewer_update` through `PDFViewer_scrollUpdate`.

However, in general there's no guarantee that this will actually work (since zooming and rotation doesn't necessarily change the size of the viewer for all documents), and requiring every viewer `components` implementer to provide methods for this doesn't seem like a great idea.
2015-06-30 23:09:17 +02:00
Yury Delendik
1da0b3a363 Merge pull request #6140 from Snuffleupagus/move-pagechange-into-PDFViewer
Move the page switching code into `set currentPageNumber` in `PDFViewer` instead of placing it in the `pagechange` event handler
2015-06-30 10:31:42 -05:00
Timothy Gu
a5cfb0a73b Update Adobe CMaps URL and license
They are now using Apache 2.0 as well.
2015-06-30 00:42:21 -07:00
Tim van der Meij
1b370da735 Merge pull request #6150 from timvandermeij/l10n-update
Localization updates (June 29, 2015)
2015-06-29 19:47:47 +02:00
Tim van der Meij
5f50f8b291 Localization updates (June 29, 2015) 2015-06-29 19:28:24 +02:00
Tim van der Meij
e9a6d4451d Merge pull request #6146 from Snuffleupagus/issue-4909-test
Add a reduced test-case for issue 4909
2015-06-29 17:11:10 +02:00
Yury Delendik
548e4b422b Merge pull request #6147 from Snuffleupagus/api-improved-unittests-getStats-getDownloadInfo
Further improvements of the getStats and getDownloadInfo unit tests
2015-06-29 09:46:42 -05:00
Jonas Jenwald
38955d491f Further improvements of the getStats and getDownloadInfo unit tests
The patch adds a test to ensure that `getStats` returns the expected result after the page has been parsed, and cleans up the existing test a bit.
Also, since I'm touching the file anyway, I'm making a small adjustment of the `getDownloadInfo` test. (I have no idea why I didn't just write it like this initially.)
2015-06-25 23:00:26 +02:00
Jonas Jenwald
7b77408dc1 Add a reduced test-case for issue 4909
I *should* have included this is PR 4910, but for some reason I didn't so better late than never.
2015-06-25 22:34:44 +02:00
Jonas Jenwald
ffeba9c630 Move the page switching code into set currentPageNumber in PDFViewer instead of placing it in the pagechange event handler
The reason that this code can be moved is that the `if (this.loading && page === 1)` check, in the `pagechange` event handler in viewer.js, is never satisfied since `this.loading` is not defined in that scope.
This *could* be considered a regression from PR 5295, since prior to that `this.loading` was using the `PDFViewerApplication` scope (or `PDFView` as it were).
However, I don't think that we need to fix that since we've been shipping this code in no less than *three* Firefox releases (uplifted in https://bugzilla.mozilla.org/show_bug.cgi?id=1084158), without breaking the world.

An explanation of why the `pagechange` code works, despite `this.loading === undefined`, is that `set currentPageNumber` (in `PDFViewer`) returns early whenever `this.pdfDocument` isn't set. This check is, for all intents and purposes, functionally equivalent to checking `PDFViewerApplication.loading`.
Hence we can move the page switching code into `PDFViewer`, and also remove `PDFViewerApplication.loading` since it's not used any more.
(The `this.loading` property was added in PR 686, which was before the current viewer even existed.)

*Note:* The changes in this patch should also be beneficial to the viewer `components`, since requiring every implementer to provide their own `pagechange` event handler just to get `PDFViewer.currentPageNumber` to actually work seems like an unnecessary complication.
2015-06-24 14:07:07 +02:00
Tim van der Meij
18e1a14e65 Merge pull request #6138 from Snuffleupagus/issue-4558
Ignore paint form XObject when the name is missing (issue 4558)
2015-06-23 20:28:02 +02:00
Jonas Jenwald
46a8485db4 Ignore paint form XObject when the name is missing (issue 4558)
Fixes 4558 (since the font issues already appear to be fixed).
2015-06-22 22:10:26 +02:00
Tim van der Meij
d504cde774 Merge pull request #6134 from Snuffleupagus/ColorSpace-parseToIR-fetchIfRef
Ensure that we fetch all indirect objects (i.e. |Ref|s) in ColorSpace_parseToIR
2015-06-22 21:53:30 +02:00
Jonas Jenwald
bc865b9e2d Ensure that we fetch all indirect objects (i.e. |Ref|s) in ColorSpace_parseToIR
Recently I've landed a number patches which fixed issues with ColorSpaces. In most of these cases the cause of the failures were, either partially or entirely, related to the fact that we didn't resolve indirect objects (i.e. the code was missing `xref.fetchIfRef(...)`).

The purpose of this patch is to fix the few remaining cases where indirect objects *could* potentially cause failures.
Given that we have seen how this causes failures in practice, I thus think that it makes sense to try and avoid further issues, instead of waiting for users to file even more bugs for this part of the code-base.
2015-06-19 10:34:27 +02:00
Jonas Jenwald
aa3a64e975 Skip mapping of CIDFontType2 glyphs when the font either has a |IdentityToUnicodeMap| or a |toUnicodeMap| with 65536 elements (issue 5677)
This patch slightly extends the heuristics used when trying to skip mapping of missing glyphs.

Fixes 5677.
2015-06-18 21:53:15 +02:00
Yury Delendik
99415a75b7 Update l10n files. 2015-06-18 09:47:47 -05:00
Yury Delendik
7dcd615001 Merge pull request #6131 from yurydelendik/version1.1.215
Version 1.1.215
2015-06-18 09:41:26 -05:00