Commit Graph

961 Commits

Author SHA1 Message Date
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
Yury Delendik
95bb727931 Merge pull request #3494 from SSk123/master
Fixing the offset of vertical CJK text
2013-07-20 10:26:13 -07:00
Srishti
6c3e5e5d92 Fixing the offset of vertical CJK text 2013-07-20 20:56:33 +05:30
Jonas
d99b7753d6 Check if viewer is embedded only once and cache the result 2013-07-20 16:33:40 +02:00
Jonas
8708f8beb5 Fixes regression that cause scrolling using spacebar to break in Firefox 2013-07-19 22:09:37 +02:00
Yury Delendik
c6e698e21f Merge pull request #3332 from Snuffleupagus/fix-loadingBar
Fix the positioning of the progressive loadingBar
2013-07-18 09:39:25 -07:00
Jonas
4890c5d017 Fix the positioning of the progressive loadingBar 2013-07-18 18:28:59 +02:00
Jonas
09e0c9b65d Move PDFHistory from viewer.js to its own file 2013-07-18 17:18:27 +02:00
Tim van der Meij
343bb7488a Presentation mode shortcut implementation 2013-07-18 16:28:06 +02:00
Yury Delendik
0dd0e2ee64 Merge pull request #3477 from brendandahl/font-loading
Use dummy font for testing when pdf fonts are loaded.
2013-07-18 07:01:55 -07:00
Yury Delendik
fb189f4fdf Merge pull request #3476 from Rob--W/no-google-translate
Disable Google Translate on viewer in Chrome.
2013-07-18 06:21:57 -07:00
Yury Delendik
984b9bf78b Merge pull request #3486 from Rob--W/csp-unsafe-inline
Remove all inline JavaScript from viewer.html to comply with CSP unsafe-inline and correct error textarea's height
2013-07-18 06:08:39 -07:00
Tim van der Meij
22120005b7 Removing code duplication 2013-07-18 13:37:55 +02:00
Rob Wu
d5e16ab85c Viewer: Remove inline events; set height on error
Move inline event handlers to viewer.js to comply with a
Content-Security-Policy where directive "unsafe-inline" is not set.

Change textarea.rows = <number of newlines> to
textarea.style.height = textarea.scrollHeight.
(The former is extremely unreliable; consider long lines...)
2013-07-18 10:38:44 +02:00
Brendan Dahl
5fa609584e Merge pull request #3449 from Snuffleupagus/history-remove-beforeunload
[Browsing history] Remove 'beforeunload' to enable caching and prevent duplicate entries
2013-07-17 16:03:12 -07:00
Brendan Dahl
fde86cde54 Merge pull request #3473 from Rob--W/chrome-printing
Fix printing behaviour in Chrome
2013-07-17 11:04:49 -07:00
Brendan Dahl
e9f5336cc9 Add atob polyfill. Remove uneeded data uri polyfill. 2013-07-17 10:26:12 -07:00
Brendan Dahl
7a1049216c Merge pull request #3440 from peerlibrary/syncing-order
Syncing order of JS files in viewer.html and make.js. See #3414
2013-07-16 16:10:25 -07:00
Brendan Dahl
330f6212ba Merge pull request #3341 from Snuffleupagus/navigateTo-fix
Tweak the behaviour of navigateTo during document load
2013-07-15 16:16:46 -07:00
Rob Wu
97efe7886e Disable Google Translate on viewer in Chrome.
test/pdfs/yo01.pdf triggered "This page is in Japanese. Would you like
to translate it?" info bar in Chrome.
2013-07-16 00:13:05 +02:00
Rob Wu
066dffde3c Fix printing behaviour in Chrome
Two major issues:
1. Border/shadow around every page. Removed by adding "border:none".
2. Added "overflow:visible" (overrides "overflow:auto") in #viewContainer.
   This solves two problems:
   - It prevents scrollbars from appearing.
   - Every "page" is automatically resized to fit on a printed page,
     just like the Firefox.
To see what's wrong, here's a picture of how PDF.js rendered the pdf in
 Chrome (using "Print to PDF" feature of Chrome):
 https://robwu.nl/pdfjs/pdfjs-print-with-chromium-28.pdf

Successfully tested with Chrome 28 and Firefox 22.

Solves #3445
2013-07-15 16:23:43 +02:00
Yury Delendik
81c8730e4b Restoring PR 3455 functionality 2013-07-12 17:00:43 -05:00
Yury Delendik
28778e6c1b Rejects incorrect url in download manager 2013-07-12 13:38:49 -05:00
Yury Delendik
ef658bf5f1 Refactoring download button logic 2013-07-12 13:14:13 -05:00
Brendan Dahl
077f08fa6d Merge pull request #3456 from brendandahl/cap-image-size
Limit image size to 1024*1024 for b2g.
2013-07-11 11:44:51 -07:00
Rob Wu
b076cd1d6a Always declare window.URL even if undefined
Otherwise it breaks feature detection,
"ReferenceError: Can't find variabl: URL" in Safari 5.1
2013-07-10 23:34:10 +02:00
Rob Wu
e583070deb Download PDF from cache for IE10 / IE11
IE9 falls back to downloading from the original URL.
2013-07-10 22:07:23 +02:00
Rob Wu
84ae29c21d Improve suggested filename on download
For all of the following URLs, "file.pdf" will be suggested:
http://.../file.pdf
http://.../download.aspx?file=file.pdf&whatever
http://.../get.pdf?name=file.pdf&whatever
http://.../single-page-app#view=file.pdf
http://.../download.aspx?file=%2Fpath%2Fto%2Ffile.pdf&whatever

Fixes #3161
2013-07-10 21:50:56 +02:00
Brendan Dahl
bcc085ec52 Limit image size to 1024*1024 for b2g. 2013-07-10 09:52:37 -07:00
Rob Wu
69a64d45bc Put URL = URL || webkitURL in compatibility.js
Declares the URL variable globally. If the feature is not
supported, the variable will still be declared, but have the
"undefined" value.

Supported by:

- Firefox 4
  Firefox 21 in Web worker

- Chrome 8  (prefixed as webkitURL), 23+ unprefixed
  Chrome 10 (prefixed as webkitURL) in Web Worker, 23+ unprefixed

- Opera 15
  Opera 15 in Web Worker

- Internet Explorer 10
  Internet Explorer 11 in Web Worker

- Safari 6 (prefixed as webkitURL)
  Safari 6 (prefixed as webkitURL) in Web Worker
2013-07-09 22:54:12 +02:00
Rob Wu
4ffc408512 Download PDF from cache for non-Firefox add-on
This feature relies on URL.createObjectURL, which is supported by
- Firefox 4
- Chrome 8
- Opera 15
- Internet Explorer 10

If the feature is missing, it falls back to downloading from the server.

The environment-specific code are put in ifdef's. Two methods are
defined:
- noData
  This function is used as a fallback in case of failure, it triggers
  a download directly from the server.
- triggerSaveAs(String url, optional String blob)
  This function attempts to show a Save As dialog for a given URL.
  It attempts to use the a.download attribute, if available, and
  falls back to window.open(<url>, '_parent') if unavailable.

See also http://caniuse.com/download
2013-07-09 22:54:12 +02:00
Brendan Dahl
c17f90e1aa Merge pull request #3406 from Snuffleupagus/remove-old-moz-prefixes
Remove old -moz prefixed rules from viewer.css
2013-07-09 13:13:20 -07:00
Yury Delendik
160403197b Merge pull request #3447 from Rob--W/chrome-arrow-keys-3443
Allow scrolling by keyboard in Chrome/Opera
2013-07-09 07:44:01 -07:00
Rob Wu
cc04cf5d1f Configurable IMAGE_DIR for annotations
The Chrome extension activates PDF.js by inserting the script tags
in a document whose URL and location origin is identical to the PDF
file.
Because of this, the path './images/' was resolved relatively to the
location of the PDF file instead of the extension.

To fix this, the IMAGE_DIR constant is moved outside the local scope,
to allow extensions/chrome/insertviewer.js to override the value.

Originally, the IMAGE_DIR variable was a global variable, but commit
f8f4b3f45d moved the global variable
to the local scope, causing the extension to malfunction.

Impact: low, the only consequence is that some rarely used images
were not visible.

Trivial test:
At the center of page 2, the annotation icon
(images/annotation-comment.svg) should be visible:
http://linorg.usp.br/CTAN/macros/latex/contrib/pdfcomment/doc/pdfcomment.pdf
2013-07-09 16:24:25 +02:00
Jonas
db1d8cf76e [Browsing history] Remove 'beforeunload' to enable caching and prevent duplicate entries 2013-07-08 16:16:43 +02:00
Rob Wu
4a2eefe1b6 Allow scrolling by keyboard in Chrome/Opera
Set "tabindex" attribute to allow focus;
Added "outline: none" to prevent focus ring from appearing.

Fixes #3443
2013-07-06 15:37:03 +02:00
Mitar
e0a2ee09b5 Syncing order of JS files in viewer.html and make.js. See #3414 2013-07-02 17:03:16 -07:00
Yury Delendik
ba87d2fe11 Merge pull request #3373 from SSk123/master
rotation causes textLayer to get messed up
2013-06-29 17:24:12 -07:00
Srishti
21a8d62624 Fixes Text rotation issue #2095 2013-06-30 03:52:30 +05:30
benbro
74ee295812 Add IE 11 to the text/html data URI shim 2013-06-29 23:43:41 +03:00
Jonas
d417ef9a39 Remove old -moz prefixed rules from viewer.css 2013-06-28 17:21:07 +02:00
Jonas
94be9c07f1 Enable changing page using Shift+Spacebar in presentation mode 2013-06-26 22:46:34 +02:00
Jonas
5c93ec3a2c Check if the browser supports manipulation of the history 2013-06-24 20:46:13 +02:00
Jonas
6867083c07 Fix typo causing destinations using '/FitR' to fail 2013-06-24 00:39:28 +02:00
Vivin Paliath
83b6eaed16 pr #3356
squashing commits.
2013-06-18 09:05:55 -07:00
Yury Delendik
167ac98f9c Fixes presentation mode page 2013-06-12 16:18:21 -05:00
Yury Delendik
729e35079f Disables range requestes for safari immediately 2013-06-12 12:03:27 -05:00
Yury Delendik
152e376971 Capturing disableRange set on capture phase of DOMContentLoaded event 2013-06-11 09:01:36 -05:00
Brendan Dahl
2fa15a0d03 Merge pull request #3338 from Snuffleupagus/history-wrong-pageNumber-fix
(Yet another) browsing history bug
2013-06-10 14:16:16 -07:00
Jonas
d3c82750c4 Tweak the behaviour of navigateTo during document load 2013-06-05 22:15:39 +02:00
Brendan Dahl
ae1f973204 Use A+ spec compatible promises. 2013-06-05 12:28:31 -07:00
Yury Delendik
5d97434736 Properly disables presentation mode 2013-06-05 11:01:09 -05:00
Jonas
5cb3df7bde (Yet another) browsing history bug 2013-06-05 16:02:29 +02:00
Brendan Dahl
e6dadaadb8 Disable range request loading for safari. 2013-06-03 15:31:42 -07:00
Jonas
ab9bc2bc34 Fix issue with resizing the zoom box width - follow-up of 2816 2013-06-02 14:31:28 +02:00
Yury Delendik
f700e61e9e Merge pull request #3308 from brendandahl/hide-overflow
Hide canvas overflow for high dpi screens.
2013-06-01 17:45:50 -07:00
Brendan Dahl
4a7bd37162 Hide canvas overflow for high dpi screens. 2013-05-30 08:17:16 -07:00
Jonas
a4343436c7 Fix remaining issues in the browsing history 2013-05-28 18:43:06 +02:00
Brendan Dahl
3641c22750 Merge pull request #3278 from Snuffleupagus/history-regression
Fix regressions caused by the recent implementation of browsing history
2013-05-22 10:49:59 -07:00
Brendan Dahl
efde079417 Merge pull request #3195 from yurydelendik/no-filltext
Drawing without fillText; refactoring ADD_TO_PATH
2013-05-21 16:53:42 -07:00
Jonas
d3c9a9d856 Fix regressions caused by the recent implementation of browsing history - address comments v3 2013-05-21 11:35:33 +02:00
Jonas
766b92c27e PDF browsing history - v6.50 2013-05-16 00:31:17 +02:00
Yury Delendik
0e133f0090 Drawing without fillText; refactoring ADD_TO_PATH 2013-05-15 15:57:27 -05:00
Yury Delendik
61a7738a5d Fixes password for range request loading 2013-05-09 19:18:31 -05:00
Mack Duan
f8f4b3f45d Refactor code for annotations 2013-05-07 14:22:13 -04:00
Brendan Dahl
e5b5c94925 Merge pull request #3060 from saebekassebil/fixpassword
Ask for password on failed decryption
2013-05-07 09:27:38 -07:00
Jakob Miland
297c305150 Ask for password on failed decryption 2013-05-07 18:24:59 +02:00
Yury Delendik
5db963abf4 Merge pull request #3193 from Snuffleupagus/issue3076
Fixes issue 3076
2013-05-07 05:46:46 -07:00
Jonas
40718bdb7b Fixes bug 863591 2013-05-06 17:39:22 +02:00
Yury Delendik
a081c2d0f1 Merge pull request #3124 from mduan/issue3118-1
Update loading bar during onprogress of range requests
2013-05-03 16:51:32 -07:00
Jonas
32f54c3272 Fixes issue 3076 2013-05-03 17:50:18 +02:00
Kalervo Kujala
5e08f8039d Replace fullscreen with presentationMode 2013-05-01 09:22:17 +03:00
Brendan Dahl
b89d7272e2 Remove background when printing. 2013-04-30 14:39:57 -07:00
Jonas
93b8e1fc01 Fix disabling of zoom buttons and add camel case button names 2013-04-30 21:14:18 +02:00
Jonas
adf61ea5b0 Make spacebar work on document load - fixes bug 864619 2013-04-30 16:44:51 +02:00
vyv03354
2c504120b8 Fixes the unprefixed gradient declaration 2013-04-30 20:24:01 +09:00
Yury Delendik
2a320f851e Merge branch 'vyv03354/unprefix_gradient'
Conflicts:
	web/viewer.css
2013-04-29 22:06:59 -05:00
Mack Duan
91f9948df4 Only update progress bar if it increases 2013-04-23 10:00:31 -07:00