Commit Graph

7119 Commits

Author SHA1 Message Date
Jonas Jenwald
42e541a671 Add strict equalities in src/shared/fonts_utils.js 2014-08-01 12:18:35 +02:00
Nicholas Nethercote
adf58ed687 Represent cid chars using integers, not strings.
cid chars are 16-bit unsigned integers. Currently we convert them to
single-char strings when inserting them into the CMap, and then convert
them back to integers when extracting them from the CMap. This patch
changes CMap so that cid chars stay in integer format throughout, saving
both time and space.

When loading the PDF from issue #4580, this change reduces peak RSS from
~600 to ~370 MiB. It also improves overall speed on that PDF by ~26%,
going from 724 ms to 533 ms.
2014-08-01 02:35:17 -07:00
fkaelberer
c03cf20d37 Fix JBIG2 decoding issue #5026 2014-08-01 09:02:25 +02:00
Yury Delendik
ad2ea78280 Merge pull request #5101 from nnethercote/CMap-forEach
Avoid expensive for..in loops involving CMaps
2014-07-31 23:03:25 -05:00
Tim van der Meij
b0349cd184 Use strict equalities in test/unit/{function_spec, stream_spec, testreporter}.js 2014-07-31 23:08:55 +02:00
Tim van der Meij
e525902241 Use strict equalities in test/driver.js 2014-07-31 23:08:54 +02:00
Tim van der Meij
7ca6f0839f Use strict equalities in web/document_properties.js 2014-07-31 22:06:39 +02:00
Tim van der Meij
ea85a2f7a7 Use strict equalities in web/viewer.js 2014-07-31 22:06:38 +02:00
Tim van der Meij
24cf969422 Use strict equalities in web/ui_utils.js 2014-07-31 22:06:38 +02:00
Tim van der Meij
bdf1c513cf Merge pull request #5105 from Snuffleupagus/pr-4259-tests
Add a couple of reduced test-cases for PR 4259
2014-07-31 19:43:43 +02:00
Yury Delendik
97996230a0 Merge pull request #5106 from timvandermeij/travis-fix
Attempt to fix Travis
2014-07-31 08:16:52 -05:00
Tim van der Meij
eb8ce9f8da Attempt to fix Travis 2014-07-31 15:14:08 +02:00
Jonas Jenwald
26f5b1b2d3 Add a couple of reduced test-cases for PR 4259
PR 4259 fixed a large number of font bugs, but none of those where added as test-cases. This was, in my opinion, unfortunate since it increases the risk of regressions in the future when other font bugs are fixed.
This PR simply adds a few more test-cases, to improve our test coverage somewhat.
2014-07-31 13:46:11 +02:00
Tim van der Meij
bf3aad8a95 Merge pull request #5082 from Rob--W/chromium-managed-preferences
Managed preferences for Chrome administrators
2014-07-30 23:58:25 +02:00
Tim van der Meij
1911bb28bb Merge pull request #5104 from Rob--W/crx-contentscript-fix
Use CSS.supports instead of '..' in ....style
2014-07-30 23:43:45 +02:00
Tim van der Meij
281d68d6bd Merge pull request #5103 from Snuffleupagus/issue-4800-test
Add a reduced test-case for issue 4800
2014-07-30 23:26:44 +02:00
Rob Wu
8bb96db3a0 Use CSS.supports instead of '..' in ....style
document.documentElement.style is null in some XML documents.
The previous snippet caused the following error:

Uncaught TypeError: Cannot use 'in' operator to search for 'animation' in null

To fix this bug, `'animation' in document.documentElement.style` has been
replaced with `CSS.supports('animation', '9s')`. This method was introduced
in Chromium 28, but it is not necessary to detect whether this method is
supported because the required createShadowRoot method for embeds is not
available in Chromium 32 and earlier.
2014-07-30 23:11:02 +02:00
Rob Wu
00746011a3 Managed preferences for Chrome administrators
Implement support for managed preferences. This feature allows users
(administrators) to easily change the default settings of the PDF Viewer for
all Chrome or Chromium browsers within their organization.

External resources for end users (administrators)

- http://www.chromium.org/administrators/
- http://www.chromium.org/administrators/configuring-policy-for-extensions
- http://www.chromium.org/administrators/windows-quick-start
- http://www.chromium.org/administrators/mac-quick-start
- http://www.chromium.org/administrators/linux-quick-start
- http://www.chromium.org/administrators/policy-templates

Administrators can read one of the previous links to learn more about creating
policies. We want to auto-generate these templates, but there are no public
tools for doing that. It will be added in the future, see:
https://code.google.com/p/chromium/issues/detail?id=389061

Resources for PDF.js/extension developers

- http://cs.chromium.org/file:policy_templates.json
- https://developer.chrome.com/extensions/manifest/storage
2014-07-30 22:51:56 +02:00
Jonas Jenwald
50eeff2fab Add a reduced test-case for issue 4800 2014-07-30 22:15:06 +02:00
Tim van der Meij
5b9d78820b Merge pull request #5090 from Rob--W/crx-feature-detect-downgrade
Re-run feature detection after downgrading the Chromium browser.
2014-07-30 21:30:16 +02:00
Nicholas Nethercote
28687bca75 Optimize CMap.prototype.forEach().
This change avoids the element stringification caused by for..in for the
vast majority of CMaps.

When loading the PDF from issue #4580, this change reduces peak RSS from ~650
to ~600 MiB, and improves overall speed by ~20%, from 902 ms to 713 ms.  Other
CMap-heavy documents will also see improvements.
2014-07-30 06:28:47 -07:00
Nicholas Nethercote
b86daed29d Make CMap.map quasi-private.
This makes it easier for the representation to be improved.
2014-07-30 06:26:35 -07:00
Yury Delendik
7026543663 Merge pull request #5059 from timvandermeij/unused-code
Removing unused code and enforcing additional JSHint options
2014-07-29 15:04:43 -05:00
Tim van der Meij
dbe22475e1 Converting PDFFindBar and PDFFindController to classes 2014-07-29 21:59:01 +02:00
Yury Delendik
0e0ba4f874 Merge pull request #5099 from Snuffleupagus/bug-1027533-test
Add a reduced test-case for bug 1027533
2014-07-29 10:53:07 -05:00
Jonas Jenwald
e5f249605c Add a reduced test-case for bug 1027533 2014-07-29 16:48:01 +02:00
Jonas Jenwald
2264748109 Merge pull request #5096 from nnethercote/bidi-length
Right-size |chars.length| and |type.length| in bidi().
2014-07-29 12:19:22 +02:00
Nicholas Nethercote
f1d5ec407e Right-size |chars.length| and |type.length| in bidi().
This lets the JS engine resize the array elements buffer immediately,
thus avoiding some intermediate resizings. This can save multiple MiBs
of reallocation in text-heavy files.
2014-07-28 16:35:45 -07:00
Yury Delendik
6038ee7cff Merge pull request #5063 from Snuffleupagus/ps-parser-avoid-intermediate-string-creation
Avoid creating intermediate strings in the PostScriptLexer
2014-07-28 15:07:32 -05:00
Yury Delendik
2e47b58281 Merge pull request #5023 from Snuffleupagus/linearization-refactor
Re-factor parsing of the Linearization dictionary
2014-07-28 10:34:37 -05:00
Jonas Jenwald
4960af3a4c Avoid creating intermediate strings in the PostScriptLexer 2014-07-27 13:51:28 +02:00
Jonas Jenwald
a5c98aab36 Re-factor parsing of the Linearization dictionary 2014-07-27 12:56:09 +02:00
Yury Delendik
1e52c770d9 Merge pull request #5088 from Snuffleupagus/stop-including-cidmaps.js
Stop including cidmaps.js
2014-07-25 17:31:09 -05:00
Rob Wu
87dacba9a6 Feature detection after downgrading the browser.
If a user downgrades from Chromium 35+ to 34, then the PDF Viewer
extension will not work any more because the extension assumes
that certain features were available based on the cached feature
detection results.

To resolve this problem, all feature detection scripts run again
if the browser was downgraded.
2014-07-25 22:44:03 +02:00
Jonas Jenwald
86f9503876 Remove src/core/cidmaps.js 2014-07-25 21:53:17 +02:00
Jonas Jenwald
c3c72948b9 Stop including cidmaps.js
In b5b94a4af3, i.e. PR #4259, we stopped using cidmaps.js. Despite that, it's still included when PDF.js is built. At almost 0.5 MB (and approx. 7000 lines), this is currently the single largest file in the codebase.
Including such a large file in the builds, when it is not actually used, seems extremely wasteful; hence this patch.
2014-07-25 21:53:09 +02:00
Yury Delendik
1e21bac9d3 Merge pull request #5077 from Snuffleupagus/issue-5039
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
2014-07-25 14:34:51 -05:00
Tim van der Meij
62e6265fb3 Merge pull request #5074 from nnethercote/readPostScriptTable-join
Use Array.join to build up strings in readPostScriptTable().
2014-07-25 21:26:54 +02:00
Yury Delendik
5d4eebc6a7 Merge pull request #5034 from pramodhkp/fixupgstate2
[SVG] Adds clip operator, fixes setGState, fill, stroke operators
2014-07-25 13:52:29 -05:00
pramodhkp
6e4dd83a4d Added endPath, endText. fixes extra <g> elements 2014-07-25 23:30:29 +05:30
pramodhkp
2380b38b27 Fixed setGState, viewport transform 2014-07-25 23:21:23 +05:30
pramodhkp
a55c9856e9 Misc variable initialization 2014-07-25 23:21:23 +05:30
pramodhkp
0688fd3d70 Added fill, stroke, line-join & font attr 2014-07-25 23:20:55 +05:30
pramodhkp
03f1de3403 Added clip operator 2014-07-25 23:13:52 +05:30
Yury Delendik
604ee4500c Merge pull request #5083 from Rob--W/pdfview-url-property
Initialize PDFView.url = ''
2014-07-25 11:29:45 -05:00
Yury Delendik
2aea7d7047 Merge pull request #5078 from nnethercote/Ref-toString
Optimize Ref_toString().
2014-07-25 10:10:10 -05:00
Nicholas Nethercote
1039791472 Use Array.join to build up strings in readPostScriptTable().
This avoids about 5 MiB of string allocations on one test case.
2014-07-24 16:12:08 -07:00
Rob Wu
bb13fb939e Initialize PDFView.url = ''
The absence of this property caused the following error in PDFView.download:

   Cannot read property 'split' of undefined

This property was unset when the PDF was loaded through a typed array instead
of a URL. With the fix, the file name will default to "document.pdf", as
defined by getPDFFileNameFromURL in web/ui_utils.js
2014-07-24 23:37:31 +02:00
Yury Delendik
2642583e82 Merge pull request #5081 from timvandermeij/promises-typo
Fixes typo in promises implementation for legacy browsers
2014-07-24 12:32:59 -05:00
Tim van der Meij
41faa78368 Fixes typo in promises implementation for legacy browsers 2014-07-24 17:11:22 +02:00