Commit Graph

9470 Commits

Author SHA1 Message Date
Yury Delendik
bc288141be Allows to pull pdf.js from pdf_viewer using require(). 2017-02-20 08:49:55 -06:00
Tim van der Meij
cf73f4bc2d Merge pull request #8024 from Rob--W/issue-6643-pdf-attachment-in-pdfjs
Open PDF attachments in the viewer instead of an unconditional download
2017-02-18 21:52:29 +01:00
Tim van der Meij
f99e4e46bc Merge pull request #8080 from Snuffleupagus/cmap-unit-test-travis
Enable running the `cmap` unit-tests on Travis by utilizing a `NodeCMapReaderFactory`
2017-02-18 21:27:15 +01:00
Jonas Jenwald
9082f08e37 Enable running the cmap unit-tests on Travis by utilizing a NodeCMapReaderFactory 2017-02-17 23:15:36 +01:00
Yury Delendik
cfaa621a05 Merge pull request #8064 from Snuffleupagus/fetchBuiltInCMap
[api-minor] Refactor fetching of built-in CMaps to utilize a factory on the `display` side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)
2017-02-17 15:30:31 -06:00
Brendan Dahl
425ad30912 Merge pull request #8071 from Snuffleupagus/bug-1337429
Always choose a (3, 1) cmap table for TrueType fonts that have an encoding specified, regardless of the Symbolic font flag (bug 1337429)
2017-02-16 15:13:46 -08:00
Brendan Dahl
63c472cec8 Remove mailing list information.
The mailing list has become a burden to maintain with all the spam it gets. We have IRC and github for discussion.
2017-02-16 13:36:12 -08:00
Jonas Jenwald
111419a64a Cache built-in binary CMap files in the worker (issue 4794) 2017-02-16 10:55:39 +01:00
Jonas Jenwald
769c1450b7 [api-minor] Refactor fetching of built-in CMaps to utilize a factory on the display side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)
Currently the built-in CMap files are loaded in `src/core/cmap.js` using `XMLHttpRequest` directly. For some environments that might be a problem, hence this patch refactors that to instead use a factory to load built-in CMaps on the main thread and message the data to the worker thread.

This is inspired by other recent work, e.g. the addition of the `CanvasFactory`, and to a large extent on the IRC discussion starting at http://logs.glob.uno/?c=mozilla%23pdfjs&s=12+Oct+2016&e=12+Oct+2016#c53010.
2017-02-16 10:55:35 +01:00
Tim van der Meij
8aad33e8a3 Merge pull request #8065 from timvandermeij/annotation-appearances
Annotations: refactor setting the normal appearance stream
2017-02-15 23:27:40 +01:00
Tim van der Meij
26fc79d51d
Annotations: refactor setting the normal appearance stream
Previously, we had a function called `getDefaultAppearance`. This name,
however, is misleading as the method gets the normal appearance (in the
`N` entry) and not the default appearance (in the `DA` entry). Moreover,
it was not entirely clear how it works just from reading the code. It
primarily lacks comments and explicit error case handling.

This patch improves the situation by fixing the issues mentioned above
and making this function a proper method of the `Annotation` class, just
like e.g., `setColor` and `setBorderStyle`.
2017-02-15 22:42:17 +01:00
Jonas Jenwald
ce072022c1 Always choose a (3, 1) cmap table for TrueType fonts that have an encoding specified, regardless of the Symbolic font flag (bug 1337429)
This patch basically reverts one aspect of TrueType (3, 1) cmap parsing to the state prior to PR 4259. After that PR, a number of regressions occurred in this particular code-path, which necessitated a number of follow-ups such as PRs 5703, 5743, and 6425.
The empirical data suggests, at least to me, that we should always prefer a (3, 1) cmap for TrueType fonts when they have an encoding, regardless of the Symbolic font flag.

Obviously this patch passes all unit/font/reference tests locally, and I made sure that all the PRs mentioned above landed with test-cases included.
However, in my opinion, there's still a very real possibility that this patch could potentially cause new regressions.

Given that the PDF file in bug 1337429 has been broken for almost *three* years before anyone noticed, and considering that the code-path in question has been the source of numerous regressions, I do *not* intend to request uplift of this patch to previous Firefox versions (assuming that it's even accepted).

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1337429.
2017-02-15 17:38:08 +01:00
Jonas Jenwald
fde609e810 Merge pull request #8070 from yurydelendik/new-node-js-check
New node.js check to protect from webpack.
2017-02-15 17:15:18 +01:00
Yury Delendik
fa0e559fe2 New node.js check to protect from webpack. 2017-02-14 15:00:52 -06:00
Yury Delendik
b509a3f83c Merge pull request #8067 from Snuffleupagus/gulp-mozcentral-pdfjschildbootstrap.js
Include the `pdfjschildbootstrap.js` file in the output for `gulp mozcentral` builds (PR 8023 follow-up)
2017-02-13 16:44:53 -06:00
Jonas Jenwald
2aaeb17037 Include the pdfjschildbootstrap.js file in the output for gulp mozcentral builds (PR 8023 follow-up)
*Yet another thing that I unfortunately missed during review of PR 8023.*

Note that previously, in `make.js` this file was being preprocessed, however as far as I can tell that wasn't actually necessary. Hence this patch just copies the file to the proper output directory.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c8.
2017-02-13 23:25:54 +01:00
Yury Delendik
41041c1576 Merge pull request #8063 from Snuffleupagus/issue-8061
Consume the current character when encountering illegal characters in `Lexer.getObject`, in order to prevent infinite loops during reading of streams (issue 8061)
2017-02-11 13:04:18 -06:00
Jonas Jenwald
23c62cc321 Consume the current character when encountering illegal characters in Lexer.getObject, in order to prevent infinite loops during reading of streams (issue 8061)
*Please note:* The rendering of the PDF file in issue 8061 first regressed in PR 7039, and then PR 7493 exacerbated the problem even further by causing an infinite loop.

In this particular case, when errors were encountered inside of the `Lexer.getObject` method *itself*, we didn't advance the stream position. This thus caused an inifinite loop in `parseCMap`, since the exact same character was then parsed over and over again.

Fixes 8061.
2017-02-11 19:32:48 +01:00
Tim van der Meij
da08b801a5 Merge pull request #8062 from timvandermeij/readme
Improve the README by removing outdated information
2017-02-11 16:33:46 +01:00
Tim van der Meij
fd21ee59a6 Improve the README by removing outdated information 2017-02-11 16:27:34 +01:00
Jonas Jenwald
7be8bd9f96 Merge pull request #8060 from a0preetham/font_ascent_fix
Font ascent descent calculation fix
2017-02-11 13:32:04 +01:00
pmysore1
af8292058f Font ascent descent calculation fix 2017-02-11 01:25:05 -05:00
Tim van der Meij
466760efca Merge pull request #8056 from Snuffleupagus/ChildNode.remove
Use `ChildNode.remove` instead of `ChildNode.ParentNode.removeChild` in a couple of places (bug 1334831, issue 8008)
2017-02-10 23:17:17 +01:00
Yury Delendik
1549a46e3d Merge pull request #8058 from yurydelendik/fix-webpack-combined
Fixes pdf.combined.js for webpack
2017-02-10 13:40:53 -06:00
Yury Delendik
7d9941d870 Fixes pdf.combined.js for webpack. 2017-02-10 11:24:35 -06:00
Yury Delendik
f8879d984c Merge pull request #8054 from Snuffleupagus/gulp-mozcentral-locale-dest
Write the l10n files to the correct destination for `gulp mozcentral` builds (PR 8023 follow-up)
2017-02-10 09:46:34 -06:00
Jonas Jenwald
63f13773e7 Use ChildNode.remove instead of ChildNode.ParentNode.removeChild in a couple of places (bug 1334831, issue 8008)
Re: [bug 1334831](https://bugzilla.mozilla.org/show_bug.cgi?id=1334831) and issue 8008.

Note that according to the specification, see https://dom.spec.whatwg.org/#interface-childnode, the `remove` method shouldn't throw.
This is also consistent with e.g. the Firefox implementation, see http://searchfox.org/mozilla-central/rev/d3307f19d5dac31d7d36fc206b00b686de82eee4/dom/base/nsINode.cpp#1852.

Obviously this isn't supported in IE (because that would be too easy), however we can easily polyfill it to avoid having to WONTFIX the bug/issue.
2017-02-10 14:39:50 +01:00
Rob Wu
ba81b37b43 Merge pull request #8053 from Snuffleupagus/DEFAULT_URL-chromecom
[Chromium addon] Prevent errors that break the addon, caused by the `DEFAULT_URL` constant being replaced by a `defaultUrl` viewer configuration parameter (PR 8046 follow-up)
2017-02-10 12:47:50 +01:00
Jonas Jenwald
991c7c196d Write the l10n files to the correct destination for gulp mozcentral builds (PR 8023 follow-up)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c2.
2017-02-10 11:46:14 +01:00
Jonas Jenwald
190c8398ba [Chromium addon] Prevent errors that break the addon, caused by the DEFAULT_URL constant being replaced by a defaultUrl viewer configuration parameter (PR 8046 follow-up)
I missed this during review, sorry about that!

Fixes 8051.
2017-02-10 10:46:44 +01:00
Yury Delendik
32856f0adb Merge pull request #8046 from yurydelendik/webpack
Replacing custom bundling with webpack 2
2017-02-09 16:04:54 -06:00
Tim van der Meij
573236e3ad Merge pull request #8043 from Rob--W/issue6696-auto-rotate-page
Allow automatic print rotation via the enablePrintAutoRotate preference
2017-02-08 23:57:28 +01:00
Yury Delendik
0759066be0 Saving old-style JS module name of dist libraries. 2017-02-08 16:48:37 -06:00
Yury Delendik
a048519fa1 Replace copyright headers; changes UMD to CommonJS. 2017-02-08 16:35:58 -06:00
Yury Delendik
eb4c88cd44 Replacing custom bundling with webpack2. 2017-02-08 16:32:15 -06:00
Rob Wu
ece44d36e8 Allow automatic print rotation via enablePrintAutoRotate 2017-02-08 12:39:24 +01:00
Rob Wu
f6548e463f Open PDF attachments in the viewer instead of download
If users want to download, they can quickly click on the Download button
in the newly opened viewer.

The blobUrl logic for Firefox relies on `disableCreateObjectURL` is
never false in Firefox. If the assumption is invalid, then PDF
attachments at the attachment view will not correctly be displayed,
because a data-URL will be generated and `?<filename>` is treated as
part of the data:-URL.
2017-02-08 11:21:34 +01:00
Tim van der Meij
35102c025a Merge pull request #8041 from timvandermeij/radio-button-value
Interactive forms: set the `buttonValue` for radio buttons that do not have a `fieldValue`
2017-02-08 00:35:48 +01:00
Tim van der Meij
9f05a5a211 Interactive forms: unit test for radio buttons without a field value 2017-02-07 23:44:31 +01:00
vkuryakov
4e181e59ef Interactive forms: values for radio buttons (issue #6995) 2017-02-07 23:42:40 +01:00
Rob Wu
775441b7c6 Refactor: configurable page rotation in print job
Determine the page rotation at the same place as where the page size is
determined. This allows us to implement custom print page rotation logic
in one place, in the future.
2017-02-07 23:42:36 +01:00
Tim van der Meij
1a2f3f95ca Merge pull request #8040 from timvandermeij/l10n-update
Update localization files
2017-02-07 23:30:26 +01:00
Tim van der Meij
dae71559da Update localization files 2017-02-07 23:14:06 +01:00
Yury Delendik
d7a113e766 Merge pull request #8039 from yurydelendik/examples
Moving interactive examples to jsfiddle.net
2017-02-07 13:16:39 -06:00
Yury Delendik
fd4428136b Moving interactive examples to jsfiddle.net 2017-02-07 13:11:18 -06:00
Jonas Jenwald
d7cb46dafc Merge pull request #8038 from yurydelendik/rm-sed
Moves sed processing into the preprocessing tasks and merging tasks.
2017-02-07 17:24:29 +01:00
Yury Delendik
a5ad2b166b Moves sed processing into the preprocessing tasks and merging tasks. 2017-02-07 08:53:33 -06:00
Yury Delendik
9b0e0954fb Merge pull request #8036 from mukulmishra18/node-canvas
[api-minor] Fixes behaviour of DOMCanvasFactory to return {canvas, context}.
2017-02-07 07:39:12 -06:00
Tim van der Meij
d3ae5b38ce Merge pull request #8035 from Snuffleupagus/api-disableNativeImageDecoder
[api-minor] Add a `getDocument` parameter that allows disabling of the `NativeImageDecoder` (e.g. for use with Node.js)
2017-02-06 23:37:02 +01:00
Mukul Mishra
41d092d04b Fixes behaviour of DOMCanvasFactory to return {canvas, context}. 2017-02-07 03:47:13 +05:30