Commit Graph

1471 Commits

Author SHA1 Message Date
Yury Delendik
2565e627a3 Refactors draw method in PDFPageView; makes optional some PDFPageViewOptions options 2014-12-20 23:41:34 -06:00
Yury Delendik
2ac7ac4678 Removes lastScrollSource and isViewerInPresentationMode from TextLayerBuilderOptions 2014-12-20 11:14:13 -06:00
Yury Delendik
b930228788 Refactors Cache into PDFPageViewBuffer 2014-12-19 16:54:32 -06:00
Yury Delendik
22c62685b0 Removes Stats dependency from PDFPageView. 2014-12-19 13:07:28 -06:00
Yury Delendik
9f384bbb41 Creates AnnotationsLayerBuilder. 2014-12-19 13:07:28 -06:00
Yury Delendik
fe4ac86781 Removes PDFPageSource 2014-12-19 09:55:11 -06:00
Yury Delendik
7663942ee5 Creates IPDFTextLayerFactory interface 2014-12-17 15:21:54 -06:00
Yury Delendik
f68678086d Simple restructuring PageView into PDFPageView 2014-12-17 15:21:54 -06:00
Yury Delendik
863d583ae1 Renames page_view.js file. 2014-12-17 10:32:07 -06:00
dustyrockpyle
7a0e764ffd Added page break hints in viewer css. 2014-11-26 11:56:00 -05:00
Tim van der Meij
dc5961d969 Merge pull request #5465 from Snuffleupagus/findbar-notFound-color
[GENERIC viewer] Fix the background color of the findInput when the search term is not found
2014-11-18 20:07:31 +01:00
Jonas Jenwald
6078901962 Prevent a "TypeError: pdfViewer is null" when the viewer loads (PR 5413 followup)
Currently if you manage to e.g. open the console (with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd>) before the viewer is initialized, the following will be printed in the console: `TypeError: pdfViewer is null`.
This doesn't cause any actual errors, but nevertheless it seems like something we should avoid.

Followup to PR 5413.
2014-11-15 12:17:10 +01:00
Yury Delendik
bb91aa5e38 Merge pull request #5478 from Snuffleupagus/bug-1018882
Prevent text selection in Presentation Mode (bug 1018882)
2014-11-11 09:15:50 -06:00
Yury Delendik
e294c8883a Merge pull request #5203 from Snuffleupagus/disableAutoFetch-loadingBar
Fix loadingBar hiding when disableAutoFetch is enabled (issue 3590)
2014-11-11 09:05:16 -06:00
Yury Delendik
3b9a78d3d8 Merge pull request #5416 from Snuffleupagus/percent-sign-l10n
Allow localization of the placement of percent signs in the zoom box
2014-11-11 08:30:07 -06:00
Jonas Jenwald
ce62b9387d Remove any active text selection when entering Presentation Mode 2014-11-07 12:53:21 +01:00
Jonas Jenwald
86309faf3c Prevent text selection in Presentation Mode (bug 1018882) 2014-11-07 12:02:48 +01:00
Jonas Jenwald
fbca0e1ab0 [GENERIC viewer] Fix the background color of the findInput when the search term is not found
When a search term isn't found, the background color of the findInput is supposed to change (to red). This is currently not working as intended, because the CSS rule is not being applied correctly. (It seems that this broke in PR 2208.)

This patch also changes the background color to match the one used in the native Firefox findbar, since the old color seemed a bit too pink.
2014-11-01 20:26:44 +01:00
Jonas Jenwald
4ed3074011 Fix regression that prevents downloading of font files in the debugger
This is a regression from PR 5366.
2014-10-28 19:56:55 +01:00
Jonas Jenwald
2505c8613b Allow localization of the placement of percent signs in the zoom box 2014-10-21 21:41:06 +02:00
Jonas Jenwald
a1f4bff4f3 Disable zooming in Presentation Mode 2014-10-15 22:25:31 +02:00
Jonas Jenwald
670b842e09 Fix "Automatic Zoom" for landscape documents with very wide pages (issue 5398) 2014-10-12 02:25:35 +02:00
Brendan Dahl
c8d729ff39 Merge pull request #5325 from fzembow/findcontrollerfix
Update findbar to wrap on initial search
2014-10-08 11:05:07 -07:00
Tim van der Meij
b215af30d3 Require destinations when they are needed and do not fetch all of them in advance 2014-10-06 22:26:18 +02:00
Jonas Jenwald
ecbb39f983 Fix loadingBar hiding when disableAutoFetch is enabled (issue 3590) 2014-10-05 23:16:36 +02:00
Jonas Jenwald
cfeb4c1019 Small refactoring of the loadingBar hiding code 2014-10-05 23:15:10 +02:00
Fil Zembowicz
dcb931dbe0 Use existing page count in nextMatch 2014-10-02 08:57:01 -04:00
Fil Zembowicz
4275481e08 Fix how matches are found in search
Instead of keeping track of where the search starts, just
keep track of the number of pages and make sure we don't
visit pages more than once.
2014-10-01 19:57:57 -04:00
Jonas Jenwald
5f83739190 Fix |cleanup| regression in the viewer 2014-10-02 00:24:01 +02:00
Jonas Jenwald
a429e88c3b Fix inconsistencies in the preference names used by PDFViewerApplication
Since `preferenceSidebarViewOnLoad` is an enumeration value, it seems better to initialize it with the default one instead of a boolean.
`preferencesPdfBugEnabled` uses a superfluous "s", which is a typo I made when I introduced it.
2014-10-01 12:30:11 +02:00
Yury Delendik
29eb147d42 Merge pull request #4150 from Snuffleupagus/issue-3990
Add a page loading indicator to the page number input
2014-09-30 18:06:39 -05:00
Yury Delendik
193b55dba0 Fixes printing regression a10fde1 2014-09-30 18:01:30 -05:00
Jonas Jenwald
902b72ba50 Add updated loading-small.png (and corresponding Retina) asset 2014-10-01 00:13:45 +02:00
Jonas Jenwald
b9ef80e167 Add a page loading indicator to the page number input 2014-10-01 00:13:44 +02:00
Yury Delendik
1858fbfe82 Merge pull request #5366 from Rob--W/use-font-loader-api
Use font loader api
2014-09-30 16:35:41 -05:00
Yury Delendik
5e0b2d383f Fixes enabling pdfBug 2014-09-30 15:19:39 -05:00
Rob Wu
d0845df971 Use Font Loading API if available
http://dev.w3.org/csswg/css-font-loading/
2014-09-30 22:18:53 +02:00
Yury Delendik
5740b96020 Introduces 'pagesinit' event. 2014-09-30 12:41:53 -05:00
Yury Delendik
b16a406f3a Packages PDFViewer as a UI component. 2014-09-30 12:41:53 -05:00
Jonas Jenwald
a10fde165c Merge pull request #5362 from yurydelendik/css-import
Use CSS import to separate pdfviewer styles
2014-09-30 17:55:13 +02:00
Yury Delendik
70a0935737 Move text_layer_builder and pdf_viewer styles out 2014-09-30 10:48:29 -05:00
Yury Delendik
374b94381d Moves scrollPageIntoView to the PDFViewer. 2014-09-30 07:13:46 -05:00
Jonas Jenwald
b06e65e5d6 Followup fix for entering/exiting Presentation mode
Even after PR 5359, switching to/from Presentation mode is still sluggish and I'm still seeing `too much recursion` printed in the console.
I've managed to track down the issue to line https://github.com/mozilla/pdf.js/blob/master/web/page_view.js#L371. It appears that for this particular case, we actually *need* to set `noScroll = true` when calling the `_setScale` function. (Note that it only applies to *this* line, and not to Presentation mode in general.)
Given the amount of refactoring done to the viewer, I'm not sure what the best way to fix this would be. However I'm submitting this patch as an easy workaround for now, but we should probably refactor this to avoid calling a "private" method directly.
2014-09-30 13:02:53 +02:00
Yury Delendik
504d2c19e0 Fixes typo/regression of #5295 for presentation mode 2014-09-29 20:17:26 -05:00
Brendan Dahl
1145eb8c09 Merge pull request #5295 from yurydelendik/pdfviewer
Refactoring to move page display code into separate class
2014-09-29 15:23:35 -07:00
Yury Delendik
44779f14b0 Renames and refactors PDFView to PDFViewerApplication. 2014-09-28 10:39:56 -05:00
Yury Delendik
a89bba35b2 Adds types definitions (jsdoc) for the PDFViewer code. 2014-09-28 10:39:56 -05:00
Yury Delendik
3773972dce Marks some private methods in PDFViewer and PDFThumbnailViewer
Conflicts:
	web/pdf_viewer.js
2014-09-28 10:39:56 -05:00
Brendan Dahl
9c56c6f9f6 Merge pull request #5263 from yurydelendik/stream
Implement streaming using moz-chunk-arraybuffer
2014-09-25 16:40:28 -07:00
Yury Delendik
e0bb2f76d2 Merge pull request #5335 from Snuffleupagus/pdfBug-text-highlight
Fix text highlighting in the Font Inspector in the debugger
2014-09-24 07:14:03 -05:00
Jonas Jenwald
7af46b433d Fix a regression preventing page change in the Stepper in the debugger
This is a regression from ddd3c8fc2f, which prevents changing pages in the Stepper.

(Apart from fixing the bug, for the sake of consistency, I also removed one instance of `parseInt`.)
2014-09-24 10:38:27 +02:00
Jonas Jenwald
9c3ea3c40b Fix text highlighting in the Font Inspector in the debugger
After PR #5282, the text highlighting in the Font Inspector is very hard to see against a white background. That seems to be an oversight from the mentioned PR, hence this patch fixes that.
2014-09-24 00:18:35 +02:00
Brendan Dahl
a2e8a5ee7f Merge pull request #5282 from CodingFabian/nicer-overlapping-text-selection
TextLayer selection coloring improvement for overlap.
2014-09-23 14:15:47 -07:00
Yury Delendik
a1eca2084d Moves constants to avoid dependency on PDFView 2014-09-21 12:47:26 -05:00
Yury Delendik
f1851c6393 Removes any usage of PDFView in the PageView 2014-09-21 12:47:26 -05:00
Yury Delendik
fbd7eedce8 Removes PresentationMode dependency from PDFViewer 2014-09-21 12:47:26 -05:00
Yury Delendik
a06a974f78 Moves rendering queue logic from PDFView 2014-09-21 12:47:26 -05:00
Yury Delendik
7642c39734 Moves pdfDocument.getPage/getTextContent requests out of PDFView 2014-09-21 12:47:26 -05:00
Yury Delendik
7af8748151 Moves viewer code into PDFViewer and some code from PageView. 2014-09-21 12:47:07 -05:00
Yury Delendik
3bce14761a Moves thumbs logic into PDFThumbnailViewer. 2014-09-20 08:19:04 -05:00
Yury Delendik
bfefadb87c Moves watchScroll and getVisibleElements from PDFView 2014-09-20 08:19:04 -05:00
Yury Delendik
12ec2a000b Merge pull request #5318 from mitar/patch-2
textLayer is not used anymore in render context
2014-09-20 08:17:35 -05:00
Yury Delendik
c3f191a27c Implement streaming using moz-chunk-arraybuffer 2014-09-19 19:05:25 -05:00
Yury Delendik
63b7fa5634 Merge branch 'issue-4954' of https://github.com/Snuffleupagus/pdf.js into hashes
Conflicts:
	web/viewer.js
2014-09-19 18:25:11 -05:00
Mitar
2f72ac1255 textLayer is not used anymore in render context.
It should be removed to prevent confusion when reading the code.
2014-09-19 15:13:01 -07:00
Manuel Padrón Martínez
293d566f67 Changed to lowercase everywhere the hashParams is compared 2014-09-18 20:18:23 +01:00
Manuel Padrón Martínez
4623f20221 Lowerize the params to allow case sensitive 2014-09-18 19:42:04 +01:00
Yury Delendik
ffb613bbac Merge pull request #5275 from Snuffleupagus/exception-propagation
Fix the exception propagation when rejecting workerReadyCapability
2014-09-16 10:05:34 -05:00
Jonas Jenwald
ed5fc43510 Add |UnexpectedResponseException| to fix the exception handling when file loading fails because the server responds with a non 404 status message 2014-09-14 11:52:33 +02:00
Yury Delendik
74d02c3406 Merge pull request #5254 from mancas/bug
Avoid showing 'blob..' as a title when using pdfjs from B2G
2014-09-11 17:03:47 -05:00
sangm
f4ccb1b61c Bug 1031612 - In PDF Viewer, the buggy XMP title "Untitled" overrides the document info title 2014-09-11 11:10:47 -05:00
Manuel Casas Barrado
f40fa1ac2a Bug 1054643 - [B2G][PDF Viewer]PDF Viewer title is shown as blob:... 2014-09-11 08:09:56 +02:00
Yury Delendik
9261cd9766 Merge pull request #5271 from Rob--W/opera-fixes
Opera fixes
2014-09-09 10:10:04 -05:00
Yury Delendik
15059ea603 Merge pull request #5229 from cpeterso/cpeterso/auto-fit-landscape
Auto zoom landscape documents (like slide presentations) to fit their height
2014-09-09 09:49:15 -05:00
Fabian Lange
931b444e00 TextLayer selection coloring improvement for overlap.
As a consequence of merging #5221 it is more likely to have multiple
overlapping selection divs inside the text layer. Because each individual
element gets the selection style applied, the 30%opacity stacks, making a
60% bar visible where the overlap happens.

As proposed by @rocallahan, this can be fixed by making the selection
style solid and setting opacity for the overall layer.

I assume also that this should make the work for the renderer easier, but
was unable to bench it.
2014-09-09 15:21:50 +02:00
Jonas Jenwald
2701edc7c6 Change getDocumentError in web/viewer.js to use instanceof instead of the exception name 2014-09-08 22:34:25 +02:00
Jonas Jenwald
ca027ebfdb Fix the exception propagation when rejecting workerReadyCapability
Currently when an exception is thrown, we try to reject `workerReadyCapability` with multiple arguments in src/core/api.js. This obviously doesn't work, hence this patch changes that to instead reject with the exception object as is.
In src/core/worker.js the exception is currently (unncessarily) wrapped in an object, so this patch also simplifies that to directly send the exception object instead.
2014-09-08 22:20:41 +02:00
Yury Delendik
b3be74d81c Merge pull request #5221 from nnethercote/dont-scale-single-char-text-divs
Don't scale single-char text divs.
2014-09-08 11:17:25 -05:00
Rob Wu
c9b3ea2f84 Adjust use of chrome.storage.managed for Opera
It turns out that chrome.storage.managed is defined for Opera, so the
previous feature detection method did not work.
2014-09-06 00:37:30 +02:00
Tim van der Meij
8c76501a49 Merge pull request #5226 from Snuffleupagus/issue-5224
Fix Zoom box resizing when it's hidden when the viewer loads (issue 5224)
2014-09-05 19:06:39 +02:00
Tim van der Meij
2158fcc0f1 Merge pull request #5259 from Rob--W/handtool-unfocus
Handtool: Remove focus from previous node on click
2014-09-03 20:34:20 +02:00
Tim van der Meij
d9ec0e58e0 Merge pull request #5237 from Snuffleupagus/fix-findInput-RTL-loading-indicator
Fix the placement of the findInput loading indicator in RTL locales
2014-09-03 20:31:33 +02:00
Rob Wu
204d540af2 Handtool: Remove focus from previous node on click
"This commit fixes the issue that a focused element cannot lose
focus when the draggable element is clicked."
https://github.com/Rob--W/grab-to-pan.js/commit/11c368f97cebe19

Steps to reproduce/verify:
1. Enable the hand tool (e.g. by using the H shortcut)
2. Click on the Page number input.
3. Click or drag the PDF canvas.
4. Observe that the page number input is still focused.
   Consequently, the hand tool cannot be disabled using the H shortcut.
2014-09-03 16:31:47 +02:00
yscumc
4acb744f77 Update document_properties.js
Fix for minutes tz calculation
2014-08-28 16:22:57 -04:00
Jonas Jenwald
5c84dd319f Fix the placement of the findInput loading indicator in RTL locales
Currently in RTL locales, the loading indicator is placed such that it is in the way when entring a search term. Hence this patch moves it to the other side of the input field to fix this.
2014-08-25 22:58:44 +02:00
Chris Peterson
81d5bd86ea Replace magic scale value 0 with UNKNOWN_SCALE 2014-08-23 00:14:44 -07:00
Chris Peterson
50a4510ab7 Auto zoom landscape documents to fit their height 2014-08-23 00:14:18 -07:00
Jonas Jenwald
5abe1cae6a Fix Zoom box resizing when it's hidden when the viewer loads (issue 5224) 2014-08-21 17:57:57 +02:00
Nicholas Nethercote
cd61aad24f Don't scale single-char text divs.
This change makes scrolling noticeably smoother on files with many
single-char text divs, such as the one in #1045. The trade-off is that
the visual appearance of text selection in such documents is slightly
worse, because more text divs overlap.

This change also uses `scaleX(N)` instead of `scale(N, 1)`. This might
be marginally more efficient in terms of JS string concatenation.
2014-08-20 19:34:33 -07:00
Tim van der Meij
b4fb1e21e7 Merge pull request #5209 from CodingFabian/text-layer-transform-origin
Set transformOrigin for text layer in css.
2014-08-19 22:59:55 +02:00
Fabian Lange
1da38ec91e no need to set textlayer properties which are overwritten in individual styles. 2014-08-19 22:47:39 +02:00
Fabian Lange
6a0aa2cf49 Set transformOrigin for text layer in css.
transformOrigin is set to 0% 0% in all cases. This adds extra memory
impact into the dom tree. It also involves the CustomStyles workaround
to determine the correct css rule for the browser.
By setting all vendor and standard variants in css, the rule is applied
without the dom memory overhead and without the minor computation
overhead to set the value.
2014-08-19 22:46:09 +02:00
Yury Delendik
2f5c6d6c3a Merge pull request #5208 from CodingFabian/debounce-scroll
Debounces scroll events in web viewer.
2014-08-18 22:53:28 -05:00
Fabian Lange
403a4e2bda Debounces scroll events in web viewer.
As requested in #5178, this change debounces the scroll events.
The reason for doing so is that browsers can event-storm especially on
scroll, communicating hundreds of subpixel changes.

The main reason for this resulting in poor performance is that on each
scroll event `scrollTop` was queried, which forces layouting.

This change will use `requestAnimationFrame` to make sure the browser can
allocate enough time to other tasks. The delay is however quite small, thus
the reduction in executions is less noticeable. Modern browsers however utilize
`requestAnimationFrame` to smoothen out rendering.
2014-08-18 23:23:32 +02:00
Yury Delendik
4ef70588de Merge pull request #5193 from nnethercote/data-font-name
Only use data-font-name attributes when necessary.
2014-08-18 13:54:07 -05:00
Nicholas Nethercote
eda7dcbb9e Only use data-font-name attributes when necessary.
The data-font-name attribute of textLayer divs are only used by the Font
Inspector. This change ensures they are only present when the pdfBug
tools are enabled.
2014-08-17 15:56:11 -07:00
Jonas Jenwald
61e24c6f45 Small re-factoring of DocumentProperties
With the changes made in PR 5169 to enable quicker display of the File size, `setFileSize()` can now be called during file loading. This function parses *and* localizes the file size, where the l10n is a synchronous operation.
This patch:
* Re-factors `setFileSize()` to *only* update `rawFileSize`, and moves parsing and fetching of the l10n string to a separate method that isn't called until the Document Properties dialog is actually opened.

* Adds a couple of checks to make sure that `rawFileSize` is set to a positive number.

* Removes the `fileName` and `fileSize` properties. Since they are parsed every time the Document Properties dialog is opened, it doesn't seem necessary to cache them.
2014-08-16 12:15:49 +02:00
Yan Or
d8bc16362c Bug 1054590 - [pdf.js] Update to use gaia-header 2014-08-15 17:57:07 -07:00
Yury Delendik
c2f4b9d301 Merge pull request #5194 from nnethercote/no-absolute
Remove `position: absolute` from text divs.
2014-08-15 10:38:23 -05:00
Nicholas Nethercote
9695958ebc Remove position: absolute from text divs.
It's not necessary in each text div, because it's specified in the
`.textLayer > div` rule.
2014-08-15 08:17:20 -07:00