Commit Graph

10504 Commits

Author SHA1 Message Date
Jonas Jenwald
c61d197398
Merge pull request #9122 from wojtekmaj/change/remove-compatibility-from-examples
Remove mentions of compatibility.js from examples
2017-11-17 00:31:14 +01:00
Wojciech Maj
9e0559264c Remove mentions of compatibility.js from examples 2017-11-17 00:21:30 +01:00
Tim van der Meij
374709a40a
Merge pull request #9126 from Snuffleupagus/viewer-move-hash-parameter-parsing
Extract parsing of debugging hash parameters into its own method in `PDFViewerApplication`
2017-11-16 22:49:15 +01:00
Tim van der Meij
1d67d9dccd
Merge pull request #9131 from janpe2/svg-empty-paths
Filling and stroking empty paths in SVG backend
2017-11-16 22:43:24 +01:00
Jonas Jenwald
42099c564f Remove the console polyfills
All browsers that we intend to support with PDF.js version 2.0 already supports `console` natively.
2017-11-16 09:34:51 +01:00
Yury Delendik
e162df59bb
Merge pull request #9138 from Snuffleupagus/rm-requestAnimationFrame-polyfill
Remove the `requestAnimationFrame` polyfill
2017-11-15 10:48:34 -06:00
Jonas Jenwald
d5174cd826 Remove the requestAnimationFrame polyfill
According to https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#Browser_compatibility and https://caniuse.com/#feat=requestanimationframe, the browsers we intend to support with PDF.js version 2.0 should all have native `requestAnimationFrame` support.

Note that the reason for indiscriminately polyfilling `requestAnimationFrame` in iOS, see PR 4961, was apparently because of a bug in iOS 6.
However, according to [Wikipedia](https://en.wikipedia.org/wiki/IOS_version_history#iOS_8): "Support for iOS 8 ended in 2017.", hence the lowest version currently supported is iOS 9.
2017-11-15 16:08:48 +01:00
Jonas Jenwald
25d6bc9de9 Extract parsing of debugging hash parameters into its own method in PDFViewerApplication
In order to move viewer related options from the global `PDFJS` object and into the initialization of the relevant components, we'll need to parse the hash parameters *before* calling `PDFViewerApplication._initializeViewerComponents`.
2017-11-15 10:08:57 +01:00
Jonas Jenwald
f9a0515452
Merge pull request #9125 from Snuffleupagus/rm-viewer-PDFJS-options
Remove compatibility code for unsupported browsers for a couple of `PDFJS` options
2017-11-15 10:04:44 +01:00
Jani Pehkonen
4e8f7070da Filling and stroking empty paths in SVG backend 2017-11-14 18:35:39 +02:00
Jonas Jenwald
745cb73c65 Remove PDFJS.disableRange/PDFJS.disableStream code for now unsupported browsers in src/shared/compatibility.js
We're currently disabling range requests and streaming for a number of configurations. A couple of those will no longer be supported (with PDF.js version 2.0), hence we ought to be able to clean up the compatibility code slightly.
2017-11-14 15:28:50 +01:00
Jonas Jenwald
eb3a1f24a3 Remove the PDFJS.disableHistory code from src/shared/compatibility.js
This compatibility code is only relevant for browsers that will no longer be supported (with PDF.js version 2.0), hence we ought to be able to remove it.
2017-11-14 15:28:50 +01:00
Jonas Jenwald
2f936f88f4 Remove the ignoreCurrentPositionOnZoom viewer option
The only reason for adding this parameter in the first place, all the way back in PR 4074, was that the "maintain document position on zooming" feature was landed and backed out a couple of times before it finally stuck.
Hence it seemed, at the time, like a good idea to have a simple way to disable that behaviour. However, that was almost four years ago, and it's just not likely that we'd want/need to ever disable it now.

Furthermore I really cannot imagine why anyone would actually *want* to reset the position whenever zooming occurs, since it results in a quite annoying UX.

*So, to summarize:* Based on the above, I think that we should try to remove this parameter now. On the off chance that anyone complains, re-adding it shouldn't be difficult.
2017-11-14 15:28:50 +01:00
Jonas Jenwald
85e006720e
Merge pull request #9118 from wassupben/master
Added missing network stream for svgviewer example
2017-11-14 15:20:45 +01:00
Tim van der Meij
9686f6652c
Merge pull request #9089 from yurydelendik/rm-chunks
Extracts OperatorList class and prepares for streaming
2017-11-13 23:35:40 +01:00
Ben Holmes
ead83b7a72 Added missing network stream for svgviewer example 2017-11-13 19:43:30 +00:00
Tim van der Meij
36b83c14f9
Merge pull request #9124 from Snuffleupagus/scrollThumbnailIntoView-multi-cols
Fix incorrect behaviour in `PDFThumbnailViewer.scrollThumbnailIntoView` for multiple columns of thumbnails
2017-11-12 11:41:44 +01:00
Jonas Jenwald
614ab4ef2c Fix incorrect behaviour in PDFThumbnailViewer.scrollThumbnailIntoView for multiple columns of thumbnails
If the sidebar is resized such that the thumbnails are displayed in multiple columns, then scrolling the currently active thumbnail into view doesn't work correctly in some cases.
The reason is that the code in `PDFThumbnailViewer.scrollThumbnailIntoView` implicitly assumes that the thumbnails will be present in just *one* column. Since that may no longer be the case, it's not sufficient to simply check if the thumbnail is visible. Instead we must explicitly check that *all*, i.e. 100 percent, of the thumbnail is already visible, and otherwise scroll it into view.
2017-11-11 22:57:59 +01:00
Jonas Jenwald
23699cef1c Re-factor how parameters are passed to the network streams
*This patch is the result of me starting to look into moving parameters from `PDFJS` into `getDocument` and other API methods.*

When familiarizing myself with the code, the signatures of the various network streams seemed to be unnecessarily cumbersome since `disableRange` is currently handled separately from other parameters.
I'm assuming that the explanation for this is probably "for historical reasons", as is often the case. Hence I'd like to clean this up *before* we start the larger, and more invasive, `PDFJS` parameter re-factoring.
2017-11-11 11:23:29 +01:00
Jonas Jenwald
de5297b9ea Fix the interface of JpegStream/JpxStream/Jbig2Stream to agree with the other DecodeStreams
The interface of all of the "image" streams look kind of weird, and I'm actually a bit surprised that there hasn't been any errors because of it.
For example: None of them actually implement `readBlock` methods, and it seems more luck that anything else that we're not calling `getBytes()` (without providing a length) for those streams, since that would trigger a code-path in `getBytes` that assumes `readBlock` to exist.

To address this long-standing issue, the `ensureBuffer` methods are thus renamed to `readBlock`. Furthermore, the new `ensureBuffer` methods are now no-ops.
Finally, this patch also replaces `var` with `let` in a number of places.
2017-11-11 11:22:16 +01:00
Jonas Jenwald
36593d6bbc Move JpegStream and JpxStream to their own files 2017-11-11 11:22:16 +01:00
Yury Delendik
5fa56f6a9d For backwards compatibility: use addOp amount instead of queue size. 2017-11-09 18:46:48 -06:00
Yury Delendik
877c2d7743 Changing QueueOptimizer to be more iterative. 2017-11-09 18:46:48 -06:00
Brendan Dahl
0052dc2b0d
Merge pull request #9110 from brendandahl/chunk-collector
Accumulate streamed PDF data into array of buffers.
2017-11-09 11:25:30 -08:00
Brendan Dahl
61dd7d1c3a Accumulate streamed PDF data into array of buffers. 2017-11-08 20:32:29 -08:00
Tim van der Meij
012d075604
Merge pull request #9106 from Snuffleupagus/eslint_no-var
Enable the `no-var` ESLint rule in the `/web` folder
2017-11-06 22:20:43 +01:00
Tim van der Meij
04b93cf57e
Merge pull request #9026 from Snuffleupagus/sidebar-resize
Implement sidebar resizing for modern browsers, by utilizing CSS variables (issue 2072)
2017-11-06 22:14:41 +01:00
Jonas Jenwald
085e7a7a74 Implement sidebar resizing for modern browsers, by utilizing CSS variables (issue 2072)
By making use of modern CSS features, in this case [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables), implementing sidebar resizing is actually quite simple. Not only will the amount of added code be fairly small, but it should also be easy to maintain since there's no need for complicated JavaScript hacks in order to update the CSS. Another benefit is that the JavaScript code doesn't need to make detailed assumptions about the exact structure of the HTML/CSS code.

Obviously this will not work in older browsers, such as IE, that lack support for CSS variables. In those cases sidebar resizing is simply disabled (via feature detection), and the resizing DOM element hidden, and the behaviour is thus *identical* to the current (fixed-width) sidebar.
However, considering the simplicity of the implementation, I really don't see why limiting this feature to "modern" browsers is a problem.

Finally, note that a few edge-cases meant that the patch is a bit larger than what the basic functionality would dictate. Among those is first of all proper RTL support, and secondly (automatic) resizing of the sidebar when the width of the *entire* viewer changes. Another, pre-existing, issue fixed here is the incomplete interface of `NullL10n`.

*Please note:* This patch has been successfully tested in both LTR and RTL viewer locales, in recent versions of Firefox and Chrome.

Fixes 2072.
2017-11-06 15:58:24 +01:00
Jonas Jenwald
d70263ced8 Enable the no-var ESLint rule in the /web folder
https://eslint.org/docs/rules/no-var

Please note that two files were excluded:
 1. `web/debugger.js`, since there's code in other files that currently depend on the global availability of code in `web/debugger.js`. Furthermore, since that file isn't used in production, doing a ES6 conversion probably isn't a priority.

 2. `web/grab_to_pan.js`, since that file could be considered to be "external" code. We have made smaller changes to that file over the years, however doing a full ES6 `class` conversion might be a step too far!?
2017-11-05 16:53:47 +01:00
Jonas Jenwald
ad0c1fb2c0 Use ES6 notation, and replace var with let, in web/pdf_viewer.component.js and web/pdfjs.js 2017-11-05 16:53:47 +01:00
Tim van der Meij
2b70e68eba
Merge pull request #9104 from Snuffleupagus/es6-chromecom
ES6-ify the code in `web/chromecom.js`
2017-11-05 15:09:03 +01:00
Jonas Jenwald
730928a402 ES6-ify the code in web/chromecom.js
These changes consists mainly of replacing `var` with `let`.
2017-11-05 13:26:06 +01:00
Tim van der Meij
f87c16bcc4
Merge pull request #8993 from Snuffleupagus/sidebar-constant-position
Layout the sidebar in the same vertical position regardless of the viewer width (issue 4052, bug 850591)
2017-11-04 16:53:11 +01:00
Jonas Jenwald
99b62fe3d4
Merge pull request #9098 from xiemaisi/fix-lgtm-alerts
Fix issues found by lgtm
2017-11-04 13:03:19 +01:00
Max Schaefer
3ae37d1b06 Remove a few useless assignments. 2017-11-03 11:36:48 +00:00
Max Schaefer
bc8f673522 Remove spurious arguments to NullStream constructor. 2017-11-03 10:14:32 +00:00
Max Schaefer
3ab1a9922a Rearrange a few declarations so that they precede their uses. 2017-11-03 10:14:32 +00:00
Tim van der Meij
6521d2fd94
Merge pull request #9094 from Snuffleupagus/rm-TypedArray-polyfills
[api-major] Remove the TypedArray polyfills
2017-11-02 22:15:44 +01:00
Tim van der Meij
97f1152d1e
Merge pull request #9093 from Snuffleupagus/rm-web-compatibility
[api-major] Stop bundling, and also remove, the `web/compatibility.js` file in pdfjs-dist
2017-11-01 22:48:34 +01:00
Jonas Jenwald
2dbd3f2603 [api-major] Remove the TypedArray polyfills 2017-11-01 10:31:28 +01:00
Jonas Jenwald
f0c98a7ab0 [api-major] Stop bundling, and also remove, the web/compatibility.js file in pdfjs-dist
As suggested in PR 8102.
2017-10-31 22:32:43 +01:00
Brendan Dahl
b46443f0c1
Merge pull request #9077 from yurydelendik/v2
Version 2.0 merge
2017-10-31 14:24:20 -07:00
Tim van der Meij
7d0fce7317
Merge pull request #9088 from Snuffleupagus/issue-9084
For non-embedded fonts, map softhyphen (0x00AD) to regular hyphen (0x002D) (issue 9084)
2017-10-31 21:19:17 +01:00
Jonas Jenwald
83e8398ff2 For non-embedded fonts, map softhyphen (0x00AD) to regular hyphen (0x002D) (issue 9084)
In the PDF file, the `ToUnicode` data first maps the hyphen correctly, and then *overwrites* it to point to the softhyphen instead. That one cannot be rendered in browsers, and an empty space thus appear instead.

Fixes 9084.
2017-10-31 13:26:04 +01:00
Jonas Jenwald
92fcfce685
Merge pull request #9082 from brendandahl/issue7562
Overwrite glyphs contour count if it's less than -1.
2017-10-30 20:44:01 +01:00
Yury Delendik
85f544f55a Moves OperatorList and QueueOptimizer into separate file. 2017-10-30 13:29:58 -05:00
Brendan Dahl
17037b5e51 Overwrite glyphs contour count if it's less than -1.
The test pdf has a contour count of -70, but OTS doesn't
like values less than -1.

Fixes issue #7562.
2017-10-30 09:16:51 -07:00
Yury Delendik
7fbc9dbdc3 Version 2.0 2017-10-30 08:18:25 -05:00
Jonas Jenwald
4e66c69d30 Update l10n files 2017-10-30 11:46:54 +01:00
Tim van der Meij
1294247d1b
Merge pull request #9078 from Snuffleupagus/eslint-lines-between-class-members
Update ESLint and enable the `lines-between-class-members` rule
2017-10-29 13:19:55 +01:00