Commit Graph

1038 Commits

Author SHA1 Message Date
Brendan Dahl
c79acf5861 Fix the B2G viewer and enable bot preview. 2013-10-09 15:04:58 -07:00
Tim van der Meij
b1b661a274 Refactoring thumbnail scroll code to fix jumps 2013-10-09 20:40:21 +02:00
Brendan Dahl
f1a6e9015f Fix css rotation for canvas and text layer. 2013-10-09 11:29:05 -07:00
Tim van der Meij
ec7064ea74 Trivial typo fix 2013-10-09 20:24:12 +02:00
Brendan Dahl
6f61a9c83e Merge pull request #3727 from brendandahl/css-zoom2
Use css to initially scale on zoom.
2013-10-08 20:34:22 -07:00
Brendan Dahl
52e429550c Simplify the output scale for css zoom. 2013-10-08 20:31:49 -07:00
Jonas Jenwald
631333c486 Fix hiding of the cursor in Presentation Mode in WebKit browsers 2013-10-08 20:42:35 +02:00
Tim van der Meij
64757dd481 Merge pull request #3774 from Snuffleupagus/contextMenu-PresentationMode
Enabling clicking to close the context menu in Presentation Mode, without going to the next page
2013-10-08 11:31:02 -07:00
Jonas Jenwald
dfb8e62079 Enabling clicking to close the context menu in Presentation Mode, without going to the next page 2013-10-08 20:11:04 +02:00
Rob Wu
194a734e5d Resolved severe memory leak (mozPrintCallback)
Do NOT save the temporary <canvas> element as `this.canvas`.
`PDFViewer.pages[i].canvas` appears to be used to generate the thumbnail
icons. Well, that's no justification for preventing GC of those
temporary <canvas> elements used during mozPrintCallback.

With a document consisting of 79 pages, this resulted in a 600-700MB
leaked memory.
2013-10-08 19:50:45 +02:00
Rob Wu
1731c0fb42 Add mozPrintCallback shim
This shim does the following:
1. Intercept window.print()
2. For a window.print() call (if allowed, ie. no previous print job):
   1. Dispatch the beforeprint event.
   2. Render a printg progress dialog.
   3. For each canvas, call mozPrintCallback if existent (one at a time, async).
   4. During each mozPrintCallback callback, update the progress dialog.
   5. When all <canvas>es have been rendered, invoke the real window.print().
   6. Dispatch the afterprint event.

The shim is not included in Firefox through the preprocessor.

Keyboard shortcuts (Ctrl/Cmd + P) are intercepted and default behavior
(i.e. printing) is prevented, and the steps for window.print() are run.
window.attachEvent is used, in order to cancel printing in IE10 and
earlier (courtesy of Stack Overflow - http://stackoverflow.com/a/15302847).
Unfortunately, this doesn't work in IE11 - if Ctrl + P is used, the
print dialog will be shown twice: Once because of Ctrl + P, and again
when all pages have finished rendering.

This logic of this polyfill is not specific to PDF.js, so it can also
be used in other projects.

There's one additional modification in PDF.js's viewer.js: The printed
<canvas> element is wrapped in a <div>. This is needed, because Chrome
would otherwise print one canvas on two pages.
2013-10-08 19:46:59 +02:00
Jonas Jenwald
d795c8ec14 Refactor Presentation Mode code 2013-10-06 20:10:26 +02:00
Tim van der Meij
e2f44361f5 Merge pull request #3759 from Snuffleupagus/issue-3755
Fix external links in Presentation Mode (issue 3755)
2013-10-04 13:49:30 -07:00
Tim van der Meij
a68375c48e Merge pull request #3739 from Snuffleupagus/bug-921162
Add the viewBookmark button to the Secondary Toolbar
2013-10-04 13:16:38 -07:00
Brendan Dahl
2d489bab22 Merge pull request #3582 from Rob--W/pushState
Set URL in history.replaceState/pushState
2013-10-03 11:35:36 -07:00
Brendan Dahl
df249da923 Use css to initially scale on zoom. 2013-10-02 09:05:46 -07:00
Jonas Jenwald
87eb2dccbe Fix external links in Presentation Mode (issue #3755) 2013-10-02 16:17:38 +02:00
Jonas Jenwald
43b0b66ada Fix coding style and improve comment in settings.js 2013-10-02 15:57:23 +02:00
Jonas Jenwald
d6ab0c61e8 Move Settings from viewer.js to its own file 2013-10-02 15:55:31 +02:00
Jonas Jenwald
bfc66626a0 Move Presentation Mode related code from viewer.js to its own file 2013-10-01 23:11:46 +02:00
Brendan Dahl
17a953c7b3 Merge pull request #3643 from Snuffleupagus/issue-3423
Change the cursor so that text selection doesn't appear possible in presentation mode
2013-10-01 13:27:19 -07:00
Jonas Jenwald
b148c9cb51 Add the viewBookmark button to the secondary toolbar 2013-09-27 11:51:32 +02:00
Jonas Jenwald
9fcb1a9e40 Merge pull request #3671 from Rob--W/toolbar-layout-fix
Fix layout of main toolbar
2013-09-26 07:55:52 -07:00
Tim van der Meij
63233fa8c2 Improved password prompt 2013-09-24 17:46:54 +02:00
Brendan Dahl
e79935d8b3 Merge pull request #3691 from Snuffleupagus/PDFHistory-followup-3341
[PDFHistory] Prevent the history from skipping entries in certain edge cases, when specifying an initialBookmark in the hash parameters on document load
2013-09-23 18:06:21 -07:00
mark-5
866186dcaa dont display file input when printing
closes #2464
2013-09-20 19:08:41 -04:00
Brendan Dahl
6ef44da10b Use canvas and css width/height instead of css transform for high dpi. 2013-09-20 12:11:14 -07:00
Tim van der Meij
31fda50123 Merge pull request #3663 from Snuffleupagus/move-PageView
Move PageView from viewer.js to its own file
2013-09-20 10:52:21 -07:00
Tim van der Meij
bf1b945101 Merge pull request #3692 from Snuffleupagus/issue-3690
Prevent trying to set the 'maxHeight' property of the secondaryToolbar before the viewer is completely loaded
2013-09-20 10:43:15 -07:00
Jonas Jenwald
2cf2eb0dfc Fix coding style in page_view.js 2013-09-20 09:28:03 +02:00
Jonas Jenwald
cebf3c60e2 Move PageView from viewer.js to its own file 2013-09-20 09:25:41 +02:00
Yury Delendik
a8320b2e18 Merge pull request #3695 from SSk123/transform
Adding transformation to the extract code
2013-09-19 18:45:59 -07:00
Srishti
3808d02a53 implementing transform matrix to getTextContent 2013-09-20 06:37:08 +05:30
Yury Delendik
9cdcb3881d Merge pull request #3686 from timvandermeij/rtl-improvements
Improvements for RTL languages
2013-09-19 16:21:39 -07:00
Brendan Dahl
c270d7e056 Merge pull request #3641 from Snuffleupagus/properly-disable-presentationMode-when-embedded
Properly disable presentation mode when the viewer is embedded
2013-09-17 13:49:11 -07:00
Brendan Dahl
0b7d54f9f6 Merge pull request #3623 from Snuffleupagus/disable-range-requests-in-old-Android
Disable range requests in old Android versions
2013-09-17 11:36:31 -07:00
Tim van der Meij
67e4c03786 Improvements for RTL languages 2013-09-14 19:33:00 +02:00
Jonas Jenwald
fabed80b5f Prevent trying to set the 'maxHeight' property of the secondaryToolbar before the viewer is completely loaded 2013-09-14 18:00:36 +02:00
Jonas Jenwald
fc73dbe695 [PDFHistory] Prevent the history from skipping entries in certain edge cases, when specifying an initialBookmark in the hash parameters on document load 2013-09-14 17:14:04 +02:00
Rob Wu
d45d622354 Fix layout of main toolbar
Before this commit there were two main issues:

- In small windows, the zoom controls visually floated above the page number
  (e.g. 733px).
- In small windows, the (transparent) zoom container covered the go-to-page
  input box, which prevented one from using the input field to quickly navigate
  to a different page.
2013-09-11 18:56:10 +02:00
Thor Larholm
3c2d079c42 Fixed review notes: Adding specificity and removing redundant declaration 2013-09-10 22:17:40 +02:00
Thor Larholm
0f07d8ad55 Squashed: Added basic support for presentationMode in IE11 2013-09-10 21:40:14 +02:00
Brendan Dahl
da1c944929 Merge pull request #3656 from timvandermeij/annotation-svg
Fixing annotation icon issues
2013-09-09 12:46:26 -07:00
Yury Delendik
69eff38d09 Merge pull request #3660 from maxidirienzo/master
viewer.js: Do not process keyboard shortcuts when focused element is a t...
2013-09-09 08:17:50 -07:00
maxidirienzo
ee5d8ca56d viewer.js: Do not process keyboard shortcuts when focused element is a textarea
If focused element is a textarea, viewer should not process keyboard shortcuts (as it does with input and select elements) because while writing on a textarea, if you press k,p,l, or n, the viewer scrolls next/prev page and the letter is not added to the textarea (eg. in my case I had a viewer displaying a product specs in PDF and a "request a quote" form at it's right, the form had a textarea field and users complains that they couldn't write in it, after checking it, I've realized it was this particular issue and fixd it with the change I'm commiting.
2013-09-09 11:50:49 -03:00
Tim van der Meij
48a24a48c1 Fixing annotation icon issues 2013-09-06 21:00:02 +02:00
Brendan Dahl
ec52dea70e Merge pull request #3645 from Snuffleupagus/presentationMode-fix-search
Fix searching in presentation mode in Firefox
2013-09-06 08:18:46 -07:00
Jonas
b118ade9ae Fix searching in presentation mode in Firefox 2013-09-06 09:08:43 +02:00
Tim van der Meij
14912b5a03 Annotation selection 2013-09-05 23:19:04 +02:00
Brendan Dahl
7cf8b8d70c Merge pull request #3607 from Snuffleupagus/issue-3604
Prevent searching during load from breaking the find functionality
2013-09-05 08:13:45 -07:00
Jonas
433397f877 Simplify getVisiblePages() in presentation mode 2013-09-05 00:42:36 +02:00
Jonas
54dfe05e30 Prevent searching during load from breaking the find functionality 2013-09-05 00:25:19 +02:00
Jonas
3cce7be9ce Properly disable presentation mode when the viewer is embedded 2013-09-05 00:23:16 +02:00
Jonas
afbff781a7 Change the cursor so that text selection doesn't appear possible in presentation mode 2013-09-05 00:18:36 +02:00
Tim van der Meij
3c0ac37292 Secondary toolbar 2013-09-04 23:48:31 +02:00
Brendan Dahl
189d444ded Merge pull request #3507 from Snuffleupagus/PDFHistory-fix-multiple-identical-states
[PDFHistory] Prevent the history from getting stuck in certain edge cases
2013-09-04 12:09:41 -07:00
Brendan Dahl
d26fcd5468 Merge pull request #3618 from Snuffleupagus/followup-3557
Prevent named actions from displaying a 'resource://' URL in Firefox
2013-09-04 11:16:15 -07:00
Brendan Dahl
b368a99f20 Merge pull request #3421 from Snuffleupagus/avoid-multiple-rendering-on-wheel-zoom
Avoid triggering rendering multiple times when zooming using the mouse wheel
2013-09-04 10:25:31 -07:00
Nils Maier
16a1c38c1f Download: Use the typed array view instead of the buffer
The ArrayBuffer holding the data might be over-sized in case the
data length was not known during the transfer, e.g. when using a
Content-Encoding other than `identity` or when using a
Transfer-Encoding.
Only the view into the buffer has the correct length then, hence
always use the view directly when creating the blob URI for the
download, instead of the over-sized underlying buffer.

Closes GH-3627
Closes GH-3634
2013-09-01 16:45:26 +02:00
Jonas
f61d272754 Disable range requests in old Android versions 2013-08-29 01:53:57 +02:00
Brendan Dahl
d00157d3ab Merge pull request #3587 from debloper/master
Stripping down some CSS prefixes [#868160]
2013-08-26 12:59:32 -07:00
Jonas
8630e29054 Avoid triggering rendering multiple times when zooming using the mouse wheel 2013-08-26 21:00:35 +02:00
Brendan Dahl
427dd3948b Merge pull request #3569 from yurydelendik/bug900193
Fixes canvas alignment for small scale...
2013-08-26 10:52:47 -07:00
Brendan Dahl
e2ca1d0e5e Merge pull request #3613 from Snuffleupagus/remove-dead-find-code
Remove old dead find related code from viewer.js
2013-08-26 10:46:58 -07:00
Brendan Dahl
e9a3ac175c Merge pull request #3612 from Snuffleupagus/fix-find-when-loading-new-file
Prevent searching from breaking when opening a new file in the web viewer
2013-08-26 10:44:54 -07:00
Brendan Dahl
c17a7c9d04 Merge pull request #3505 from Snuffleupagus/move-ThumbnailView
Move ThumbnailView from viewer.js to its own file
2013-08-26 10:30:24 -07:00
Yury Delendik
1de48f1805 Merge pull request #3595 from brendandahl/fix-clip
Move the creation of canvas path fonts to the worker.
2013-08-26 06:48:05 -07:00
Jonas
e69fc0072a Prevent named actions from displaying a 'resource://' URL in Firefox 2013-08-24 20:27:58 +02:00
Jonas
8892beeb08 Remove old dead find related code from viewer.js 2013-08-23 13:08:51 +02:00
Jonas
baba41f702 Prevent searching from breaking when opening a new file in the web viewer 2013-08-23 11:08:03 +02:00
Yury Delendik
bde863a8ac Merge pull request #3573 from Rob--W/crx-view-local-files
[CRX] Fixes to view local files again
2013-08-21 07:37:32 -07:00
Brendan Dahl
bb2529de03 Move the creation of canvas path fonts to the worker. 2013-08-19 16:33:20 -07:00
Brendan Dahl
695e92cc00 Merge pull request #3532 from yurydelendik/telem-1
Adds initial telemetry probes
2013-08-19 12:34:27 -07:00
Yury Delendik
6a0ca99da4 Merge pull request #3519 from Snuffleupagus/move-errorWrapper-during-load
Prevent the loadingBar from overlaying the errorWrapper
2013-08-16 10:53:56 -07:00
Yury Delendik
ab2cfaf128 Merge pull request #3575 from brendandahl/text-debugger
Show sensible output for showText commands in the stepper.
2013-08-16 10:42:39 -07:00
Rob Wu
c653bf3aff Set URL in history.replaceState/pushState
When <base href> is present, history.replaceState and
history.pushState behave inconsistent with relative URLs.
http://code.google.com/p/chromium/issues/detail?id=274024

Contrary to what one expect, passing '' as the URL parameter to
replaceState/pushState does not associate the currently active
URL with the history entry, but a path relative to <base href>.

To fix the issue, explicitly associate the current active URL
with the history's state.
2013-08-16 17:30:07 +02:00
Yury Delendik
ba23a9e8f9 Adds initial telemetry probes 2013-08-16 09:53:05 -05:00
Yury Delendik
7e145c1228 Merge remote-tracking branch 'mozilla/master' into pushState 2013-08-16 09:18:00 -05:00
Yury Delendik
fa885678df Don't provide optional pushState parameter 2013-08-16 09:09:32 -05:00
Soumya Deb
de52e711f8 Unprefixing CSS as current browsers support 2013-08-16 14:18:37 +05:30
Brendan Dahl
2bd9901d62 Show sensible output for showText commands in the stepper. 2013-08-14 15:34:55 -07:00
Rob Wu
a4dd4b1789 [CRX] Fixes to view local files again
pdfHandler-local.js references the isPdfDownloadable function from
pdfHandler.js, but the function didn't expect that the responseHeaders
property was absent. Added a check to prevent a runtime error when a
local file is displayed in a frame, and show local PDF files again.

Local files are rendered on the chrome-extension:-protocol. The previous
method of getting the PDF URL was incorrect, this has been fixed as well.
2013-08-14 23:50:51 +02:00
Yury Delendik
86077810b0 Fixes canvas alignment for small scale and scale adjustment after Cmd+0 2013-08-13 18:45:06 -05:00
Brendan Dahl
5ecce4996b Split files into worker and main thread pieces. 2013-08-12 10:48:06 -07:00
Tim van der Meij
75035a2970 Named actions implementation 2013-08-08 21:59:59 +02:00
Jonas
d99879bfbf Move ThumbnailView from viewer.js to its own file 2013-08-06 22:19:03 +02:00
Brendan Dahl
820145da05 Merge pull request #3523 from yurydelendik/csp
Bug 889320 - [CSP] removes inlined styles and scripts, also HTTP headers
2013-08-06 13:10:33 -07:00
Brendan Dahl
d85e38d629 Fix intermittent blank page on fast zoom. 2013-08-05 16:34:57 -07:00
Yury Delendik
bea2e41e45 Backout of #3513 (except formatting) 2013-08-05 07:52:24 -05:00
Yury Delendik
7435b267f9 Merge pull request #3535 from Snuffleupagus/issue-3534
Fix issue with initial scale when opening a new file and another one is already loaded
2013-08-04 17:29:36 -07:00
Brendan Dahl
65fd2c77d0 Merge pull request #3513 from Snuffleupagus/keep-scroll-position-on-zoom-v2
Keep current scroll position when zooming the document
2013-08-02 15:22:52 -07:00
Jonas
8170d67a6b Fix issue with initial scale when opening a new file and another one is already loaded 2013-08-02 16:09:33 +02:00
Brendan Dahl
bf72bc94e2 Incrementally render by sending the operator list by chunks as they're ready. 2013-07-31 11:17:36 -07:00
Jonas
edf3163fa6 Keep current scroll position when zooming the document 2013-07-31 19:43:03 +02:00
Yury Delendik
99c9079f54 [CSP] removes inlined styles and scripts 2013-07-30 21:00:37 -05:00
Brendan Dahl
81308d153d Merge pull request #3516 from Rob--W/crx-dont-parse-querystring
[CRX] Get pdf name from URL instead of query string
2013-07-29 10:22:14 -07:00
Brendan Dahl
e39083ddc3 Merge pull request #3495 from Snuffleupagus/check-if-viewer-embedded
Check if viewer is embedded only once and cache the result
2013-07-29 09:44:11 -07:00
Jonas
d031c2bd62 Prevent the loadingBar from overlaying the errorWrapper 2013-07-29 12:43:42 +02:00
Rob Wu
b2b2e85ba2 [CRX] Get pdf name from URL instead of querystring 2013-07-27 12:31:51 +02:00
Jonas
869c4de289 [PDFHistory] Prevent the history from getting stuck in certain edge cases 2013-07-23 21:50:09 +02:00