Commit Graph

1532 Commits

Author SHA1 Message Date
Tim van der Meij
12be47c57c Merge pull request #5598 from CodingFabian/chrome39-range-disable
Disable Range Support for Chrome 39+40 (#5512)
2015-04-30 22:31:50 +02:00
Fabian Lange
1d4758dadf Disable Range Support for Chrome 39+40 (#5512)
Disabling Range Support for Chrome 39 and 40, due to regression in
Chromium. https://crbug.com/442318
2015-04-29 23:25:58 +02:00
Tim van der Meij
6f3024f366 Merge pull request #5977 from Snuffleupagus/pr-5966-followup
Prevent Firefox from warning about |unreachable code after return statement|
2015-04-29 21:28:47 +02:00
Tim van der Meij
6159da0598 Merge pull request #5828 from Rob--W/mozCurrentTransform-fix
Fix flaw in mozCurrentTransform polyfill
2015-04-29 19:27:02 +02:00
Jonas Jenwald
66b12974c9 Prevent Firefox from warning about |unreachable code after return statement|
*This is a follow-up to PR 5966.*

Now that https://bugzilla.mozilla.org/show_bug.cgi?id=1151931 has landed, we're unfortunately in a situation where Firefox warns about `unreachable code after return statement` multiple times when using the PDF.js code in `node make server` mode.

I'm really sorry about the churn in this code!
However I don't think it's a good idea to let Firefox continue to printing these warnings in the console, since it increases the risk of missing actual errors.
2015-04-29 19:26:05 +02:00
Tim van der Meij
080ab204d6 Merge pull request #5953 from Snuffleupagus/issue-3498
Remove no longer needed hacks that enable spacebar scrolling in Firefox (issue 3498)
2015-04-27 19:10:49 +02:00
Tim van der Meij
c91f736db7 Merge pull request #5966 from Snuffleupagus/lint-viewer-preprocesser-code
Enable linting of Firefox specific code in viewer.js
2015-04-27 18:59:55 +02:00
Tim van der Meij
6abf3d6ba3 Simplify document properties field logic
This patch:
- Simplifies the way fields are passed to the document properties overlay
- Simplifies the way fields are filled internally in the document properties overlay
- Avoids passing a document properties reference to the secondary toolbar
2015-04-27 15:25:40 +02:00
Jonas Jenwald
91ce16bc1d Enable linting of Firefox specific code in viewer.js
- This patch uncomments a large portion of the Firefox specific code in viewer.js, by using a preprocessor "trick", to enable linting. Doing this actually uncovered some issues, e.g. variables defined multiple times.

 - This patch also fixes a spelling error, `adobe pdfwritter` -> `abobe pdfwriter`, in the `KNOWN_GENERATORS` list used when reporting telemetry data in Firefox.

*Please note:* there's still some Firefox specific code that is commented out, but it's usually just one (or two) lines of code. Hence the risk that errors creep in should be much lower, compared to entire code-blocks.
2015-04-26 19:52:09 +02:00
Tim van der Meij
1a5de56675 Group public/private methods and add comments
This patch:
- Puts public methods at the top of the file
- Puts private methods below the public methods and marks them with an underscore
- Adds JSDoc comments to the class
- Adds setDocumentAndUrl to avoid having to handle that in `viewer.js`
2015-04-26 15:50:28 +02:00
Tim van der Meij
7cf440c560 Refactor PDFDocumentProperties to be more class-like 2015-04-24 20:47:38 +02:00
Tim van der Meij
ca8f842d87 Rename DocumentProperties to PDFDocumentProperties 2015-04-24 20:35:11 +02:00
Jonas Jenwald
10f134bcc2 Remove no longer needed hacks that enable spacebar scrolling in Firefox (issue 3498)
Now that [bug 915962](https://bugzilla.mozilla.org/show_bug.cgi?id=915962) has landed, we no longer need any hacks to enable <kbd>spacebar</kbd> scrolling in Firefox.

Fixes 3498.
2015-04-21 22:26:50 +02:00
Jonas Jenwald
601bd4a930 Preface all "fullscreen" CSS rules with a |pdfPresentationMode| class, and add it to the |viewerContainer| while Presentation Mode is active 2015-04-21 16:28:50 +02:00
Jonas Jenwald
4211df63eb Refactor PDFPresentationMode to be more class-like 2015-04-21 16:28:50 +02:00
Jonas Jenwald
4edee12e92 Re-ordering the PDFPresentationMode code so that the "public" functions are placed towards the top of the file 2015-04-21 16:28:49 +02:00
Jonas Jenwald
d5089f42fa Initial refactoring of the PDFPresentationMode code
Noteworthy changes:

 - Adds JSDoc comments to PDFPresentationMode.

 - Removes a couple of, no longer necessary, helper functions.
2015-04-21 16:28:49 +02:00
Jonas Jenwald
f15d5c8cfe Rename the presentation_mode.js file and adjust the function names
Also moves the |fullscreenchange| event listeners into PDFPresentationMode.
2015-04-21 16:28:48 +02:00
Jonas Jenwald
e7fd5b4d4d Refactor the options passed to |PresentationMode.initialize| and clean-up some code in viewer.js and presentation_mode.js
This patch:
 - Passes in a reference to the current PDFThumbnailViewer, which is used to ensure that the current thumbnail becomes visible when exiting PresentationMode.

 - Changes the way that the event listeners for the contextmenu items are defined, to avoid passing in a reference to the SecondaryToolbar.

 - Ensures that |supportsFullscreen| always returns a boolean.
   Currently `supportsFullscreen` will, when the browser supports the fullscreen API, return e.g. `function mozRequestFullScreen()` instead of `true`.

 - Simplifies the |click| handler code when PresentationMode is active.
   This code has been obsolete ever since PR 2919 landed.

 - Removes hack used to workaround a bug in WebKit browsers, which caused |mousemove| events to be fired when the cursor changed.
   This was fixed close to a year ago, see http://code.google.com/p/chromium/issues/detail?id=103041.
2015-04-21 16:27:41 +02:00
Jonas Jenwald
95b2ec124b Move the PresentationMode-specific scrollWheel code from PDFViewerApplication 2015-04-21 16:08:37 +02:00
Jonas Jenwald
2dc1af8028 Break dependencies between PresentationMode and other code, and add PresentationMode related utility methods to PDFViewer
This patch:
 - Adds a couple of utility methods to `PDFViewer` to enable checking `presentationModeState` without cumbersome comparisons.

 - Disentangles `PresentationMode` from `PDFHistory` and `HandTool`, by adding event listeners for `presentationmodechanged` to both of them.

 - Adds a utility function to `PDFViewerApplication` for requesting PresentationMode.

 - Prevents initialization of `PresentationMode` if the browser does not support the fullscreen API.
2015-04-21 16:02:32 +02:00
arai
5c4e3c31b8 Bug 1156287 - Do not extract unreachable code after return 2015-04-21 00:22:45 +09:00
Tim van der Meij
e4e9a2adea Merge pull request #5926 from browtayl/1018932
prevent viewer from zooming on cmd+mousewheel (bug 1018932)
2015-04-13 20:57:23 +02:00
Jonas Jenwald
bc0d55bf43 Remove commented out code from viewer.html
The line that this patch removes has been commented out since 2012 (!), see commit c8a6a9ba00.

Also, since the patch is trivial, I'm fixing the formatting of a comment to stop [GitHub from marking it with a red color](https://github.com/mozilla/pdf.js/blob/master/web/viewer.html#L394) (and IE from complaining).
2015-04-13 12:44:05 +02:00
Taylor Brown
34d3b96b52 prevent viewer from zooming on cmd+mousewheel 2015-04-10 15:08:32 -07:00
Jonas Jenwald
48242abe72 [B2G] Stub the |DownloadManager| to avoid error
After the refactoring in PR 5678, the B2G viewer now prints the following in the console:
```
ReferenceError: DownloadManager is not defined
```

This will obviously not matter once the B2G viewer is replaced with the new components-based one. But until that happens, I think it makes sense to just stub the class to suppress the error.
2015-04-04 21:26:33 +02:00
Tim van der Meij
01f1761a8b Merge pull request #5881 from mbbaig/master
Added the data-page-number dom attribute to the page rendered in the browser
2015-04-01 20:57:07 +02:00
Jonas Jenwald
e5c4819601 Small refactoring of the code that calls |PDFViewerApplication.setInitialView|
This is a minor cleanup, to avoid an unnecessary `Promise.all` and to simplify catching |ViewHistory| errors.
2015-03-31 20:35:00 +02:00
Jonas Jenwald
6091e7bd6b Move the code that resets the history state when the |showPreviousViewOnLoad| preference is set to |false|
Since this code is *only* necessary if/when the history is actually enabled, this patch refactors it to actually reflect that.
2015-03-31 18:12:15 +02:00
Jonas Jenwald
03497eabd5 Move fetching of the |defaultZoomValue| preference value to |PDFViewerApplication.initialize|
For consistency, this preference should be placed amongst the others. The current position is purely for "historical" reasons, since it was one of the first preferences that was added to the code.
2015-03-31 15:33:21 +02:00
Jonas Jenwald
3974adcc22 Remove reference to GNUpdf from comment in |DocumentProperties.parseDate|
Since the link is no longer valid, we should remove it from the comment.

(Using the Internet Archive, it seems that the contents of that page was basically identical to the PDF specification.)
2015-03-28 11:53:20 +01:00
Mohamed Baig
6d8adb31ad Added the data-page-number dom attribute to the page rendered in the browser
Added data-page-id attribute to page container divs

Updated the attribute with a better label
2015-03-27 18:23:39 -04:00
Jonas Jenwald
94cc731616 Add custom |outlineloaded| and |attachmentsloaded| events to the viewer (bug 1112947) 2015-03-21 17:49:34 +01:00
Tim van der Meij
2d11266a52 Merge pull request #5866 from Snuffleupagus/scalechange-evt-pageActualOption
Add |pageActualOption| to the list of predefined zoom options in the |scalechange| event handler in viewer.js
2015-03-20 22:26:07 +01:00
Jonas Jenwald
36400ae48d Add |pageActualOption| to the list of predefined zoom options in the |scalechange| event handler in viewer.js
This patch also rearrange the order of the references to the DOM elements of the predefined zoom values, in viewer.js, to correspond with the element order in the current viewer UI. (The previous ordering is a leftover from the previous viewer UI.)
2015-03-20 22:09:34 +01:00
Jonas Jenwald
4a3b0d9c64 Add a |PDFViewer| option to remove the border shadow around pages (issue 5559) 2015-03-16 12:28:28 +01:00
Jonas Jenwald
65a5543efe Disable PresentationMode for certain problematic configurations
Instead of trying to hack around various browser defects, let's just disable PresentationMode in the affected browsers. This patch:

- Disables PresentationMode in IE11+ when the viewer is embedded; fixes 4711.
2015-03-13 22:09:36 +01:00
Tim van der Meij
230d8c40e4 Make presentation mode work again in Safari 2015-03-13 21:41:14 +01:00
Tim van der Meij
ac5d1fbb2d Merge pull request #5785 from Snuffleupagus/bug-1138993
Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox
2015-03-12 21:16:29 +01:00
Rob Wu
6eb9e6a6a4 Fix flaw in mozCurrentTransform polyfill
Set transformation matrix in (polyfilled) mozPrintCallback when a scale
is applied. Removed _scaleX and _scaleY in favor of _transformMatrix to
emphasize that the caller MUST ensure that the state of the matrix is
correct before `addContextCurrentTransform` is called.
2015-03-11 20:55:26 +01:00
Yury Delendik
da258f8972 Merge pull request #5692 from Rob--W/webl10n-fix
[l10n] Treat language as case-insensitive
2015-03-09 23:24:57 -05:00
Yury Delendik
c2dc665332 Merge pull request #5582 from Snuffleupagus/setHash-Fit-values
Fix handling of "Fit" zoom values in setHash (issue 5581)
2015-03-09 23:20:23 -05:00
Yury Delendik
f4dbd69e06 Merge pull request #5595 from fkaelberer/useBinarySearchToFindVisibleElements
Use binary search in getVisibleElements()
2015-03-09 23:11:50 -05:00
Jonas Jenwald
f0d538d7cf Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox
See https://bugzilla.mozilla.org/show_bug.cgi?id=1138993.
2015-03-07 00:16:55 +01:00
speedplane
80d85b5fe7 Embedded PDF viewers should not be changing their parent page's title. 2015-03-05 22:36:08 -05:00
Jonas Jenwald
43e6de7e38 Merge pull request #5680 from Rob--W/forget-showPreviousViewOnLoad
Reset state upon load if showPreviousViewOnLoad
2015-03-02 21:49:34 +01:00
Rob Wu
6a16d7dd44 Reset state upon load if showPreviousViewOnLoad
And moved showPreviousViewOnLoad up to PDFViewerApplication.initialize
2015-03-02 21:35:44 +01:00
fkaelberer
a78bb6b946 Use binary search in getVisibleElements() 2015-03-01 17:41:20 +01:00
Tim van der Meij
a033b4bf3d Merge pull request #5769 from dumyan/findcontroller-nbsp
nbsp normalization
2015-02-28 14:50:25 +01:00
Jonas Jenwald
00ee6bd6b6 Merge pull request #5693 from collinanderson/whitespace
cleaned whitespace
2015-02-28 10:09:21 +01:00