Commit Graph

1748 Commits

Author SHA1 Message Date
Thorben Bochenek
0fa44d7233 refactor src/core/pdf_manager.js: rename pdfModel to pdfDocument
Rename pdfModel to pdfDocument to let the name closer resemble what the
variable actually holds
2014-03-19 09:43:16 +01:00
Yury Delendik
329d0ec30b Merge pull request #4464 from bthorben/issue#4461
Fixes pages without Resources in their dictionary
2014-03-18 13:00:21 -05:00
Thorben Bochenek
8edebc797b Refactor and fix style of core.js 2014-03-18 14:10:44 +01:00
Thorben Bochenek
1ddb019449 Fix Issue #4461: Pages without \Resources in their dictionary fail to load
When no "\Resource" entry could be found return an empty dictionary
2014-03-18 14:10:44 +01:00
Nicholas Nethercote
292b96a0bf Make fnArray always be a plain array.
This makes the code much simpler, and the extra memory use is tiny -- a vanilla
1000 element array is only 4000 bytes larger than a Uint32Array of the same
size.
2014-03-17 17:48:53 -07:00
Nicholas Nethercote
42d175efd4 Fix some indenting within OperatorList. 2014-03-17 17:11:40 -07:00
Brendan Dahl
1802ffffb8 Merge pull request #4447 from nnethercote/object-reduction
Allocate fewer objects
2014-03-17 12:50:23 -07:00
Brendan Dahl
68be273c69 Merge pull request #4470 from yurydelendik/packcmap
CMaps binary packing
2014-03-17 12:27:35 -07:00
Brendan Dahl
ad4be03a08 Merge pull request #4440 from bthorben/refactor/pdf_manager.js
refactor src/core/pdf_manager.js: rename pdfModel to pdfDocument
2014-03-17 10:41:17 -07:00
Jonas Jenwald
5f021b067c Prevent infinite loop in CFFParser_parseHeader 2014-03-17 11:47:14 +01:00
Brendan Dahl
1a6e103c35 Merge pull request #4463 from sukop/patch-1
Fix copy-paste typo
2014-03-14 15:24:16 -07:00
Yury Delendik
69efd9cb96 CMaps binary packing 2014-03-14 16:46:35 -05:00
Tim van der Meij
67c686027c Merge pull request #4465 from Snuffleupagus/src-display-braces
Fix coding style in src/display
2014-03-14 21:11:15 +01:00
Yury Delendik
8266225b73 Merge pull request #4434 from p01/jbig2Optimizations
Jbig2 optimizations
2014-03-14 10:39:41 -05:00
Juraj Sukop
4c2a462a76 Fix copy-paste typo
The Compact Font Format Specification defines the Standard String of SID 237 as "twodotenleader", and not "266 ff".
2014-03-14 14:11:16 +01:00
Jonas Jenwald
a1ee567d60 Fix coding style in src/display/api.js 2014-03-14 13:24:04 +01:00
Jonas Jenwald
bc986a3029 Fix coding style in src/display/canvas.js 2014-03-14 13:11:11 +01:00
Nicholas Nethercote
6c698519cd Avoid allocations in executeCommand(). 2014-03-13 22:15:09 -07:00
Nicholas Nethercote
3759c11f42 Avoid more allocations in bidi(). 2014-03-13 22:15:09 -07:00
Nicholas Nethercote
2e93a0cc98 Avoid allocations in bidi(). 2014-03-13 22:15:09 -07:00
Nicholas Nethercote
6a75e45309 Allocate fewer objects when parsing 2 and 4 byte chunks.
This is achieved by adding getBytes2() and getBytes4() to streams, and by
changing int16() and int32() to take multiple scalar args instead of an array
arg.
2014-03-13 22:15:05 -07:00
Nicholas Nethercote
0866ad5bff Add a cache for glyphs.
This reduces memory consumption for text heavy documents. I tested five
documents and saw hit rates ranging from 97.4% to 99.8% (most of the misses are
due to |width| varying even when |fontChar| matches). On two of those documents
I saw improvements of 40 and 50 MiB.

The patch also introduces the Glyph constructor, and renames the |unicodeChars|
local variable as |unicode| for consistency with the corresponding Glyph
property.
2014-03-13 19:51:48 -07:00
p01
bd9419f1ef Micro optimization of ArithmeticDecoder_readBit 2014-03-13 17:38:12 +01:00
p01
2b6cb317db Optmized decodeRefinement, moving the prediction error outside the inner loop
There is no need to slow down the inner loop with a test for ltp as it can only
change if prediction is true in which case it only changes in the outer loop.
2014-03-13 17:38:12 +01:00
p01
840d9d40b6 Reuse the row Uint8Array in JBIG2's decodeBitmap 2014-03-13 17:38:11 +01:00
p01
b2b3836683 Process only once the offset and starting mask JBIG2's drawBitmap 2014-03-13 17:38:11 +01:00
p01
0bca56cbb2 Use changingTemplateX, Y and Bit in JBIG2's decodeBitmap 2014-03-13 17:38:01 +01:00
p01
e2a4328ff2 Optimized bounding box tests in JBIG2's decodeBitmap 2014-03-13 17:38:00 +01:00
p01
2a9fe573c0 Nest JBIG2 prediction if statements together
ltp can only become truthy if predition is true.
2014-03-13 17:37:59 +01:00
p01
02a5f9435a More bit friendly decodeIAID and decodeInteger 2014-03-13 17:37:55 +01:00
p01
e862c64bb8 JBIG2 20% faster SimpleSegmentVisitor_drawBitmap
Moved the switch(combinationOperator) outside the width and height loops
Check bitmap[i][j] before applying the switch(combinationOperator)
2014-03-13 17:37:53 +01:00
Yury Delendik
1aaeec8020 Heuristic to optimize chunking 2014-03-13 11:01:34 -05:00
Yury Delendik
257898b359 Caching inlined mask images 2014-03-13 11:01:34 -05:00
Yury Delendik
f48f57e30a Caches last parsed resource image, recornizes image repeats 2014-03-13 11:00:10 -05:00
Yury Delendik
2c23be369b Optimizing pdf when text printed char-by-char 2014-03-13 11:00:10 -05:00
Yury Delendik
dbb3d17d8f Refactors optimization list 2014-03-13 11:00:10 -05:00
Yury Delendik
1c0e1cc591 Merge pull request #4444 from nnethercote/min-length
Estimate the size of decoded streams in advance.
2014-03-13 10:58:31 -05:00
Yury Delendik
2778d75d2c Merge pull request #4437 from yurydelendik/issue4398
Fixes corrupted by Aspose fonts
2014-03-13 10:44:02 -05:00
Yury Delendik
03bedaa316 Merge branch 'master' of github.com:mozilla/pdf.js into issue-4370 2014-03-13 10:38:11 -05:00
Jonas Jenwald
b0824e1626 Prevent circular reference when checking for blend modes (issue 4370) 2014-03-13 10:36:49 -05:00
Yury Delendik
7963f22545 Merge pull request #4259 from brendandahl/built-in-cmaps-squash
Adds built in CMaps and unifies the glyph mapping.
2014-03-13 10:27:48 -05:00
Yury Delendik
31ea4e0f4d Merge pull request #4420 from prometheansacrifice/RemovingCheckSetPresence
Removing set-presence-in-ImageData check from canvas.js
2014-03-13 08:31:53 -05:00
Yury Delendik
5c20d17c87 Merge pull request #4431 from fkaelberer/ExtractArithmeticDecoder
Extract arithmetic decoder to own file
2014-03-13 08:19:11 -05:00
Nicholas Nethercote
b3024db677 Estimate the size of decoded streams in advance.
When decoding a stream, the decode buffer is often grown multiple times, its
byte size increasing like so: 512, 1024, 2048, etc. This patch estimates the
minimum size in advance (using the length of the encoded stream), often
allowing the smaller sizes to be skipped. It also renames numerous |length|
variables as |maybeLength| to make it clear that they can be |null|.

I measured this change on eight documents. This change reduces the cumulative
size of decode buffer allocations by 0--32%, with 10--20% being typical. This
reduces peak RSS by 10 or 20 MiB for several of them.
2014-03-13 02:06:58 -07:00
Ben Browitt
8b6aeee35c Follow JMPR op only if outside of FDEF and IF 2014-03-13 03:19:04 +02:00
Thorben Bochenek
baccf3d160 refactor src/core/pdf_manager.js: rename pdfModel to pdfDocument
Rename pdfModel to pdfDocument to let the name closer resemble what the
variable actually holds
2014-03-12 09:54:29 +01:00
Nicholas Nethercote
ea17749b93 Don't get bytes eagerly when creating FlateStream objects. 2014-03-11 16:03:15 -07:00
Nicholas Nethercote
d0253c8291 Don't get bytes eagerly when creating {Jpeg,Jpx,Jbig2}Stream objects.
This avoids lots of unnecessary work when such streams are referred to via
fetch(), and so their bytes aren't subsequently read. This is a large
performance win on some files.
2014-03-11 16:03:15 -07:00
Nicholas Nethercote
f12d588258 Add an ensureRange() call to ChunkedStream_makeSubStream().
By checking if the data is all present before making a substream, we avoid
cases where we parse part of a stream and then throw a MissingDataException
part-way through, which forces us to later re-read the stream -- possibly
multiple times. This is a sizeable performance win for some cases when file
loading is slow (e.g. over the web).
2014-03-11 16:03:06 -07:00
Yury Delendik
7dbd088728 Fixes corrupted by Aspose fonts. 2014-03-11 14:16:27 -05:00
fkaelberer
2c8b776687 update comments 2014-03-11 09:14:59 +01:00
Manas (prometheansacrifice)
30e00bc573 Removing set-presence-in-ImageData check from canvas.js 2014-03-11 08:48:37 +05:30
Brendan Dahl
57e896d29e Merge pull request #4406 from nnethercote/fix-and-transfer-masks
Improve image mask handling again
2014-03-10 16:26:22 -07:00
Brendan Dahl
72a9c7810b Merge pull request #4246 from pnml/hiresmask
Support for the image mask in higher resolution than the image itself
2014-03-10 10:34:49 -07:00
fkaelberer
7b5b5178ef Extract duplicate arithmetic decoder to own class 2014-03-10 16:56:00 +01:00
Jonas Jenwald
b05f05589b Merge pull request #4425 from timvandermeij/jpx-syntax
Making src/core/jpx.js adhere to the style guide
2014-03-10 15:28:05 +01:00
Jonas Jenwald
7480ba4cb1 Merge pull request #4422 from timvandermeij/jbig2-syntax
Making src/core/jbig2.js adhere to the style guide
2014-03-10 11:33:39 +01:00
Tim van der Meij
d5fcfe14d2 Making src/core/jpx.js adhere to the style guide 2014-03-09 22:31:55 +01:00
Tim van der Meij
2712a5a45a Making src/core/jbig2.js adhere to the style guide 2014-03-09 13:03:45 +01:00
Tim van der Meij
f1249bd49e Making src/display/font_loader.js adhere to the style guide 2014-03-09 12:45:51 +01:00
Tim van der Meij
7d86fa859f Making src/display/metadat.js adhere to the style guide 2014-03-09 12:41:01 +01:00
Jonas Jenwald
46487e3931 Merge pull request #4418 from timvandermeij/crypto-syntax
Making src/core/crypto.js adhere to the style guide
2014-03-09 12:34:44 +01:00
Jonas Jenwald
fe99743844 Merge pull request #4413 from timvandermeij/ps-parser-syntax
Making src/core/ps_parser.js adhere to the style guide
2014-03-09 11:39:28 +01:00
Tim van der Meij
3330f0417f Making src/core/crypto.js adhere to the style guide 2014-03-08 23:25:47 +01:00
Tim van der Meij
99b0231343 Fixes typo in function.js 2014-03-08 22:40:19 +01:00
Tim van der Meij
df2248d5b9 Merge pull request #4414 from Snuffleupagus/src-shared-braces
Add braces to single line statements in src/shared
2014-03-08 22:37:16 +01:00
Tim van der Meij
a615ccdd20 Making src/core/bidi.js adhere to the style guide 2014-03-08 21:49:53 +01:00
Jonas Jenwald
4840c2ccdc Add braces to single line statements in src/shared/annotation.js 2014-03-08 20:50:38 +01:00
Jonas Jenwald
15a63e48bd Add braces to single line statements in src/shared/colorspace.js 2014-03-08 20:50:37 +01:00
Jonas Jenwald
00f6d07a21 Add braces to single line statements in src/shared/fonts_util.js 2014-03-08 20:50:37 +01:00
Jonas Jenwald
e8a68f12df Add braces to single line statements in src/shared/function.js 2014-03-08 20:50:36 +01:00
Jonas Jenwald
635466fcd2 Add braces to single line statements in src/shared/util.js 2014-03-08 20:50:36 +01:00
Tim van der Meij
2adcaf4f64 Making src/core/ps_parser.js adhere to the style guide 2014-03-08 20:45:25 +01:00
Nicholas Nethercote
00c1cff405 Transfer image masks when when possible, instead of copying. 2014-03-08 04:25:00 -08:00
Samuel Chantaraud
076b3433b4 Improved annotations' display/behavior.
Added an "InteractiveAnnotation" class to homogenize the annotations' structure (highlighting) and user interactions (for now, used for text and link annotations).

Text annotations:
The appearance (AP) has priority over the icon (Name).
The popup extends horizontally (up to a limit) as well as vertically.
Reduced the title's font size.
The annotation's color (C) is used to color the popup's background.
On top of the mouseover show/hide behavior, a click on the icon will lock the annotation open (for mobile purposes). It can be closed with another click on either the icon or the popup.

An annotation printing is conditioned by its "print" bit
Unsupported annotations are not displayed at all.
2014-03-07 10:48:42 -04:00
Nicholas Nethercote
cb5bb0cec7 Fix mask handling when some bytes are missing. 2014-03-06 21:11:21 -08:00
Tim van der Meij
3df8f89bd4 Fixes off-by-one error when finding missing endstream 2014-03-06 23:57:27 +01:00
Basil A. Zabairatsky
555d33ffc7 Support for the image mask in higher resolution than the image itself 2014-03-07 02:16:39 +06:00
Yury Delendik
1857ced63f Merge pull request #4397 from fkaelberer/FixJPXcolors
Fix JPX colors
2014-03-06 08:57:17 -06:00
fkaelberer
6755ea70b0 Fix infinite loop in DecodeStream_ensureBuffer() 2014-03-06 10:31:18 +01:00
fkaelberer
9457095c9c Fix JPX colors 2014-03-06 09:05:24 +01:00
Yury Delendik
ff5ccdeb07 Merge pull request #4383 from nnethercote/more-rgb24
Use RGB_24BPP form for all images lacking alpha data.
2014-03-05 07:03:16 -06:00
Yury Delendik
f04ebed579 Merge pull request #4366 from yurydelendik/max-fdefs
Rejects invalid fpgm table when too many functions
2014-03-05 06:16:44 -06:00
fkaelberer
eef5ed5c11 Optimizations for 1bpc images 2014-03-05 09:42:16 +01:00
Yury Delendik
f46942758f Merge pull request #4382 from nnethercote/off-by-one
Avoid extra allocations in ensureBuffer() caused by an off-by-one error.
2014-03-04 22:27:33 -06:00
Yury Delendik
32fe818af6 Merge pull request #4391 from nnethercote/rm-FakeStream
Remove FakeStream.
2014-03-04 21:36:44 -06:00
Yury Delendik
881c7f48f3 Merge pull request #4388 from timvandermeij/fix-corrupt-pdf-offset
Start counting from actual beginning of PDF file
2014-03-04 21:28:12 -06:00
Yury Delendik
fd6a152935 Merge pull request #4375 from yurydelendik/reset-annot
Reset annotation stream; reset page annotation promise
2014-03-04 21:23:13 -06:00
Yury Delendik
d809901083 Merge pull request #4381 from nnethercote/transfer
Transfer GRAYSCALE_1BPP and RGB_24BPP arrays when possible.
2014-03-04 21:04:02 -06:00
Nicholas Nethercote
fe8b6b0950 Remove FakeStream. 2014-03-04 18:07:15 -08:00
Tim van der Meij
026c45e5d1 Start counting from actual beginning of PDF file 2014-03-04 22:16:54 +01:00
Nicholas Nethercote
a2fe30ff38 Use RGB_24BPP form for all images lacking alpha data. 2014-03-03 20:58:35 -08:00
Nicholas Nethercote
f30babde58 Transfer GRAYSCALE_1BPP and RGB_24BPP arrays when possible. 2014-03-03 18:17:17 -08:00
Nicholas Nethercote
64431a9909 Avoid extra allocations in ensureBuffer() caused by an off-by-one error. 2014-03-03 18:03:48 -08:00
Yury Delendik
10af056f8f Reset annotation stream; reset page annotation promise 2014-03-03 16:46:05 -06:00
Yury Delendik
6fbbcf5c93 Merge pull request #4362 from Snuffleupagus/bug-925985
Add 'registered' and 'trademark' to mapPrivateUseChars (bug 925985)
2014-03-03 09:02:32 -06:00
Nicholas Nethercote
6e4283fc45 Remove unneeded |oldtypes| variable from bidi.js. 2014-03-03 05:09:04 -08:00
Yury Delendik
ba95e0b07b Merge pull request #4353 from nnethercote/more-Array-joins
Use Array.join() to build up strings in more places.
2014-03-02 23:26:22 -06:00
Nicholas Nethercote
ab7568c0ff Use Array.join() to build up strings in more places. 2014-03-02 17:54:16 -08:00
Yury Delendik
9a918572dd Merge pull request #4336 from nnethercote/rgb24
Special-case 24-bit RGB image-handling
2014-03-02 19:53:42 -06:00
Yury Delendik
ad4eb9a21d Merge pull request #4354 from nnethercote/Name-cache
Use a cache to minimize the number of Name objects.
2014-03-02 18:44:29 -06:00
Yury Delendik
f8c11634d8 Merge pull request #4355 from nnethercote/sliced-masks
Put mask data to the canvas in small slices.
2014-03-02 18:40:38 -06:00
Yury Delendik
adca8d4291 Rejects invalid fpgm table when too many functions 2014-03-02 15:40:48 -06:00
fkaelberer
583ca3b162 Fix parsing of JP2 images 2014-03-02 22:15:40 +01:00
Mitar
2c82e720b8 Updated to current latest stable version of jshint. 2014-03-01 13:31:25 -08:00
Jonas Jenwald
08687ee9f1 Add 'registered' and 'trademark' to mapPrivateUseChars (bug 925985) 2014-03-01 21:01:33 +01:00
Yury Delendik
5c40d686d4 Merge pull request #4357 from d3x7r0/master
Allow a url to omit the protocol
2014-02-28 14:32:19 -06:00
Yury Delendik
a9caf97f85 Merge pull request #4348 from bthorben/refactor/obj.js/2
Refactor XRef in obj.js
2014-02-28 13:19:33 -06:00
Yury Delendik
b01301c7ba Merge pull request #4324 from fkaelberer/FasterJBIG2decoding
Faster JBIG2 decoding
2014-02-28 12:54:36 -06:00
Brendan Dahl
a77efa0587 Remove unused calculation from bad merge. 2014-02-28 09:58:07 -08:00
Luís Nabais
220a8e4f0e Fix the combineUrl function
* Allow a url to omit the protocol and use the same protocol as the
* current page
2014-02-28 17:25:46 +00:00
Thorben Bochenek
f2f713bf15 Refactor XRef in obj.js
- remove unused "if (e instanceof Stream)" in XRef_fetch
- split XRef_fetch into XRef_fetchUncompressed and XRef_fetchCompressed
This explains the actual code flow better
- add line breaks after functions
- change the document to conform to current StyleGuide
2014-02-28 14:00:54 +01:00
fkaelberer
abcc72a173 Faster JBIG2 decoding 2014-02-28 10:53:09 +01:00
Nicholas Nethercote
1ec3c341cc Put mask data to the canvas in small slices. 2014-02-27 21:48:55 -08:00
Nicholas Nethercote
fdb7c218da Use a cache to minimize the number of Name objects. 2014-02-27 20:41:03 -08:00
Brendan Dahl
ce9e9e6ff7 Remove embeddedFontsUsed from API. 2014-02-27 14:06:03 -08:00
Yury Delendik
4763e3fe51 Merge pull request #4346 from p01/patch-2
Fill the initial JBIG2 buffer with 0xFF only if defaultPixelValue is set
2014-02-27 12:01:20 -06:00
Mathieu 'p01' Henri
e786649d2a Skip the Math.sqrt for clamped values in convertToRgb
No need to compute the square root of clamped values.
Only the values in the range ]0,1[ need to be processed.
2014-02-27 17:44:40 +01:00
Mathieu 'p01' Henri
135660c8ba Fill the initial JBIG2 buffer with 0xFF only if defaultPixelValue is set
Per the TypedArray specification, ArrayBuffers are initialized with zeros.

http://www.khronos.org/registry/typedarray/specs/latest/#5
2014-02-27 17:43:21 +01:00
Brendan Dahl
d0f87457d7 Merge pull request #4331 from nnethercote/cleanups
Minor clean-ups
2014-02-26 12:06:13 -08:00
Brendan Dahl
0af0c6c99d Merge pull request #4229 from Rob--W/crx-stream-progress
Get progress bar for PDF streams in Chromium by passing the expected content length to the page
2014-02-26 11:12:34 -08:00
Yury Delendik
4f0dccb15d Merge pull request #4340 from nnethercote/getRgb
Share ColorSpace.getRgb() between all sub-classes.
2014-02-26 09:20:18 -06:00
Nicholas Nethercote
c4fab2f234 Share ColorSpace.getRgb() between all sub-classes. 2014-02-26 05:51:29 -08:00
Nicholas Nethercote
42cbb5b440 Introduce ImageKind constants. 2014-02-25 15:18:04 -08:00
Nicholas Nethercote
4e1f92a893 Clean up putBinaryImageData(). 2014-02-25 15:14:11 -08:00
Nicholas Nethercote
f62c1c469f Special-case 24-bit RGB image-handling. 2014-02-25 15:14:04 -08:00
Brendan Dahl
b187326022 Use default encoding for standard fonts without a file. 2014-02-25 11:28:17 -08:00
Nicholas Nethercote
d4e8b41639 Remove some unnecessary local variables. 2014-02-24 18:25:59 -08:00
Brendan Dahl
f7fea015a9 Remove isFixedPitch check for now. 2014-02-24 17:39:51 -08:00
Nicholas Nethercote
33dd1b0c3c Remove the unnecessary this.buf in CCITTFaxStream. 2014-02-24 16:45:18 -08:00
fkaelberer
5f8546c120 Faster JPX decoding 2014-02-24 18:43:12 +01:00
Manas (prometheansacrifice)
5a038b17a2 Trying to fix #4166 2014-02-23 23:46:14 +05:30
Yury Delendik
4c22afa380 Merge pull request #4300 from Snuffleupagus/issue-4296
Handle undefined url in LinkAnnotation
2014-02-18 09:00:55 -06:00
Yury Delendik
7e1c6a6aa3 Merge pull request #4306 from peerlibrary/warnings
Info function does not interpolate strings
2014-02-18 07:48:24 -06:00
Mitar
958a49d655 Info function does not interpolate strings. 2014-02-17 21:25:28 -08:00
Jonas Jenwald
054f1e7e57 Handle undefined url in LinkAnnotation 2014-02-15 13:49:24 +01:00
Brendan Dahl
f1c73edac4 Fix symbol fonts with no file. 2014-02-11 13:37:12 -08:00
Brendan Dahl
b5b94a4af3 Use built in CMaps and unify the glyph mapping. 2014-02-11 10:27:09 -08:00
Rob Wu
2a19dc86e7 Do not switch to a range request for small PDFs 2014-02-09 23:03:52 +01:00
Ophir LOJKINE
4a66eccedc Rewrite Lexer_getNumber.
Now, it computes the numbers with only basic arithmetic operations, without first creating a string and then calling parseFloat.
The new function doesn't behave exactly the same as the old one.
In particular, the old behaviour was that when there was a number immediatly followed by an 'E', the 'E' was consumed. Now it's not. It allows for "glued" numbers and operators.
Also, the new function is faster and consumes less memory.
2014-02-01 21:46:09 +01:00
Brendan Dahl
54f6291cc9 Merge pull request #4207 from yurydelendik/function-split
Basic function.js split
2014-01-31 09:37:59 -08:00
Rob Wu
eaf7daf7db [CRX] Pass expected length of stream to viewer
To get a progress bar for POST/FTP requests in Chromium.
2014-01-30 23:03:15 +01:00
Brendan Dahl
1e4d35c3a0 Merge pull request #4192 from yurydelendik/shading-r
Implements shading types 4-7
2014-01-30 13:36:01 -08:00
Brendan Dahl
7be0924ac4 Merge pull request #4212 from yurydelendik/jank4181
Removes scrolling jank after bw image optimization
2014-01-30 10:14:27 -08:00
Yury Delendik
acb33b3e7d Merge pull request #4213 from nnethercote/strings
Create less garbage while parsing
2014-01-30 04:41:53 -08:00
Nicholas Nethercote
164d7a6e15 Don't create a string when lexing all-digit integers. 2014-01-29 18:22:09 -08:00
Nicholas Nethercote
b64cca0bef When lexing numbers, look for digits first. 2014-01-29 18:20:53 -08:00
Nicholas Nethercote
c1ef7e4d63 Use Array.join instead of += to build up strings in the Lexer. 2014-01-29 18:19:58 -08:00
Yury Delendik
99bbad3219 Removes scolling jank after bw image optimization 2014-01-29 13:10:34 -06:00
Brendan Dahl
cda181f061 Merge pull request #4187 from Rob--W/issue-4183
Use forEach instead of for-in (was: Replace [] with {} in core/cmap)
2014-01-29 10:54:49 -08:00
Yury Delendik
3595c2c360 Respects current ctx scale for mesh pattern 2014-01-29 10:39:06 -06:00
Yury Delendik
561683d2e9 Dynamically determines how to split patch into triangles 2014-01-29 10:39:06 -06:00
Yury Delendik
c5a804c43a Merge pull request #4181 from nnethercote/compact-images
Reduce memory consumption of simple black and white images.
2014-01-28 15:53:46 -08:00
Nicholas Nethercote
a966909754 Reduce memory consumption of simple black and white images. 2014-01-28 14:36:47 -08:00
Brendan Dahl
c2e31cd1ef Merge pull request #4205 from yurydelendik/blob-open-file
Using blob URL for open file
2014-01-28 14:15:35 -08:00
Brendan Dahl
0e000392ae Merge pull request #4179 from yurydelendik/dataLoaded
Fixes PDFDocumentProxy.getDataLoaded API name (and refactoring)
2014-01-28 13:56:01 -08:00
Yury Delendik
e5e9c6e243 Fixes PDFDocumentProxy.getDownloadInfo API name (and refactoring) 2014-01-28 15:13:47 -06:00
Yury Delendik
a583c319a1 Implements shading types 4-7 2014-01-27 20:35:51 -06:00
Yury Delendik
e9327050c3 Basic function.js split 2014-01-27 20:29:47 -06:00
Brendan Dahl
59526a7cf1 Merge pull request #4189 from yurydelendik/split-pattern
Refactors shared/pattern.js into core/ and display/
2014-01-27 17:40:22 -08:00
Yury Delendik
18515b8668 Using blob URL for open file 2014-01-27 13:11:02 -06:00
Yury Delendik
48436b6a0f Fixes smask backdrop 2014-01-26 22:35:56 -06:00
Yury Delendik
bf432a37bb Refactors shared/pattern.js into core/ and display/ 2014-01-25 12:18:22 -06:00
Rob Wu
2779bab03e Use [].forEach instead of for-..-in in evaluator
To prevent errors whenever the array's prototype is extended.
 (cmap is an array)
2014-01-25 18:04:33 +01:00
Yury Delendik
ffe42f580a Merge pull request #4178 from peerlibrary/worker-loader
Allow fake worker loader with namespaced bundling of PDF.js
2014-01-23 15:14:07 -08:00
Mitar
9e8c75a7ff Allow fake worker loader with namespaced bundling of PDF.js. 2014-01-23 14:33:17 -08:00
Tim van der Meij
3c6ac0dad5 Merge pull request #4161 from yurydelendik/smask
SMask emulation
2014-01-23 11:49:19 -08:00
Yury Delendik
4054b0c385 SMask emulation 2014-01-23 11:13:32 -06:00
Yury Delendik
5a6862decc Merge pull request #4164 from Snuffleupagus/bug-957034-followup
Only check for line dash pattern when annotation has a visible border (bug 957034 followup)
2014-01-22 08:27:47 -08:00
Rob Wu
b35ced8c9e RFC 3986-compliant isValidUrl (protocol parsing)
To avoid misinterpreting URLs like "/File:wikipedia.png" as a
non-relative URLs.
2014-01-22 15:10:06 +01:00
Rob Wu
3c0b8073be Try to recover from bad URI value
See https://github.com/mozilla/pdf.js/issues/4159

BAD (http://cms.di.unipi.it/files/bbec7791fac20e98127c77531e4031912392156c/testo.pdf)
<< /S /URI /URI /v#2findex.php#2fFile:Logo.png >>

GOOD (http://www.ioi2012.org/wp-content/uploads/2011/12/practice.pdf):
<< /S /URI /URI (http://127.0.0.1/v/index.php/File:Logo.png >>

The URL should be wrapped in parentheses, but sometimes it isn't.
Consequently, the value is interpreted as a Name (because of the leading "/"),
and the resulting object is `{name: "v/index.php/File:Logo.png" }`. Obviously,
this is not a string, so `url.indexOf` throws an error here.
2014-01-22 15:09:29 +01:00
Jonas Jenwald
46ba8d10b0 Only check for line dash pattern when annotation has a visible border (bug 957034 followup) 2014-01-22 14:04:55 +01:00
Yury Delendik
2c34807fa3 Merge pull request #4149 from timvandermeij/document-properties
Document properties
2014-01-21 15:13:16 -08:00
Tim van der Meij
5f7ded4ff6 Document properties 2014-01-22 00:07:07 +01:00
Tim van der Meij
e612da2c3d Fixes this.reject regression 2014-01-22 00:01:43 +01:00
Brendan Dahl
f18e3e9e0f Merge pull request #4144 from yurydelendik/api-doc
Misc fixes for the API docs
2014-01-21 11:31:16 -08:00
Brendan Dahl
f7e354dfe5 Merge pull request #4139 from nnethercote/RGBA
Write color and opacity values directly to the final RGBA array when possible, so as to avoid allocating unnecessary memory.
2014-01-21 11:28:52 -08:00
Yury Delendik
27573ddbad Minor fixes for the jsdocs and removing unused members. 2014-01-21 13:28:18 -06:00
Jonas Jenwald
575bdd8863 Fix loading of fonts with invalid encoding name entry (bug 859204 and 878112) 2014-01-21 02:03:28 +01:00
Nicholas Nethercote
0685214a77 Don't create the RGB buffer for images that don't need resizing. 2014-01-19 14:21:36 -08:00
Yury Delendik
96fff4cc74 Refactors getTextContent return value 2014-01-17 13:26:00 -06:00
Brendan Dahl
ac91047f6d Merge pull request #4072 from yurydelendik/check-aa
Checks if subpixel-aa enabled before scaling the fonts
2014-01-17 10:45:17 -08:00
Yury Delendik
e7d16ba1a2 Merge pull request #4138 from nnethercote/chunk-ImageData
Do createImageData/putImageData in chunks, to save memory.
2014-01-17 08:55:24 -08:00
Yury Delendik
09f8f951c8 Extracts evaluator preprocessor and refactor text extraction 2014-01-17 07:16:52 -06:00
Nicholas Nethercote
c044652320 Remove unneeded srcOffset arguments from createRgbBuffer. 2014-01-16 20:15:37 -08:00
Nicholas Nethercote
3de5d6ad0c Don't create the opacity buffer for images that lack a mask. 2014-01-16 20:15:37 -08:00
Nicholas Nethercote
4332c2fabe Do createImageData/putImageData in chunks, to save memory. 2014-01-16 17:20:20 -08:00
Brendan Dahl
455265474a Merge pull request #4093 from yurydelendik/issue4068
Fixes fips regression from #4068
2014-01-16 13:45:10 -08:00
Brendan Dahl
ff66c23e6e Merge pull request #4089 from yurydelendik/issue3725
Takes ascent/descent in account in the text layer
2014-01-16 13:12:04 -08:00
Brendan Dahl
c57fdcceed Merge pull request #4125 from yurydelendik/issue4111
Fixes and refactors log functionality
2014-01-16 10:54:09 -08:00
Brendan Dahl
3b829f4a45 Merge pull request #4103 from yurydelendik/issue3977
Introduces disableObjectCreateURL
2014-01-16 10:51:22 -08:00
Yury Delendik
754e000907 Fixes and refactors log functionality 2014-01-15 15:28:31 -06:00
Yury Delendik
ab4f27b272 Merge pull request #4124 from tkristiansen/with-credentials
Allow setting xhr.withCredentials
2014-01-15 11:42:41 -08:00
terje.kristiansen
08737375f8 Added withCredentials parameter and passing it to xhr requests 2014-01-15 10:12:40 +01:00
Yury Delendik
7e75a665d2 Checks if subpixel-aa enabled before scaling the fonts 2014-01-14 17:31:23 -06:00
Yury Delendik
1991efe4f0 Fixes type3 glyph compilation for bitpacked mask 2014-01-13 21:21:03 -06:00
Nicholas Nethercote
3f533a1cb0 Use a more compact typed array to pass the image mask from the worker to the main thread. 2014-01-13 20:09:05 -06:00
Yury Delendik
a8c11ad1e5 Introduces disableObjectCreateURL 2014-01-10 16:30:41 -06:00
Jonas Jenwald
7c616502c2 Fix annotation border issue (bug 957034) 2014-01-09 13:44:21 +01:00
Yury Delendik
96eaa15578 Fixes fips regression from #4068 2014-01-08 16:33:22 -06:00
Brendan Dahl
508b00a34f Merge pull request #4071 from yurydelendik/bug921760
Adds glyph mapping for standard fonts
2014-01-08 12:36:54 -08:00
Yury Delendik
0131101275 Takes ascent/descent in account in the text layer 2014-01-08 13:50:52 -06:00
Brendan Dahl
bac4133f21 Merge pull request #4068 from yurydelendik/bug864847
Adjusts heuristic for disabling Symbol encoding
2014-01-08 10:48:18 -08:00
Yury Delendik
4d01ff4079 Merge pull request #4062 from kkujala/calgray
calgray: fix getRgbBuffer problem
2014-01-07 10:54:09 -08:00
Brendan Dahl
2e7c71c75e Merge pull request #4011 from Rob--W/issue-3885
Set eof to true at the end of a FlateStream
2014-01-07 10:52:37 -08:00
Yury Delendik
5bf3e44e30 Introduces LegacyPromise; polyfills DOM Promise 2014-01-03 18:17:05 -06:00
Yury Delendik
51b958dc2b Adds glyph mapping for standard fonts 2014-01-03 14:17:50 -06:00
Brendan Dahl
2228343f77 Only trigger warning bar on certain unsupported features. 2014-01-03 09:34:13 -08:00
Yury Delendik
5973d40afe Adjusts heuristic for disabling Symbol encoding 2014-01-02 18:44:11 -06:00
Yury Delendik
c389451a5b Merge pull request #4045 from brendandahl/verbosity
Add verbosity as an api setting.
2014-01-02 12:25:00 -08:00
Kalervo Kujala
4c040dd955 calgray: fix getRgbBuffer problem
This fixes issue 3903.
2014-01-01 23:49:03 +02:00
Yury Delendik
cfb4e95521 Merge pull request #4025 from gjuggler/singlefile
Add singlefile build target
2013-12-20 05:44:40 -08:00
Jonas Jenwald
e6c805490b [JBIG2] Fix getting decodeParms when it's an array 2013-12-19 20:23:58 +01:00
Rob Wu
43847d7ff8 Set eof to true at the end of a FlateStream
At the initialization of `Lexer_getObj` (in `parser.js`), there's a loop
that skips whitespace and breaks out whenever EOF is encountered.
(https://github.com/mozilla/pdf.js/blob/88ec2bd1a/src/core/parser.js#L586-L599)

Whenever the current character is not a whitespace character,
`ch = this.nextChar();` is used to find the next character
(using `return this.currentChar = this.stream.getByte())`).

The aforementioned `getByte` method retrieves the next byte using
(https://github.com/mozilla/pdf.js/blob/88ec2bd1a/src/core/stream.js#L122-L128)

      var pos = this.pos;
      while (this.bufferLength <= pos) {
        if (this.eof)
          return -1;
        this.readBlock();
      }
      return this.buffer[this.pos++];

This piece of code relies on this.eof to detect whether the last character
has been read. When the stream is a `FlateStream`, and the end of the stream
has been reached, then **`this.eof` is not set to `true`**, because this check
is done inside a loop that does not occur when the read block size is zero:
(https://github.com/mozilla/pdf.js/blob/88ec2bd1ac/src/core/stream.js#L511-L517)

      for (var n = bufferLength; n < end; ++n) {
        if (typeof (b = bytes[bytesPos++]) == 'undefined') {
          this.eof = true;
          break;
        }
        buffer[n] = b;
      }

This commit fixes the issue by setting this.eof to true whenever the loop is not
going to run (i.e. when bufferLength === end, i.e. blockLen === 0).
2013-12-19 18:37:39 +01:00
Gregory Jordan
1838ec0427 Add a singlefile target to build one concatenated file 2013-12-19 08:18:47 -07:00
Brendan Dahl
53549411b4 Add verbosity as an api setting. 2013-12-18 13:39:03 -08:00
Brendan Dahl
81cb24bff5 Merge pull request #3997 from Snuffleupagus/bug-946506
Fix loading of fonts that are not referenced by an object identifier
2013-12-18 09:49:14 -08:00
Jonas Jenwald
b1c5ef9ccc Fix loading of fonts that are not referenced by an object identifier 2013-12-17 00:19:31 +01:00
Michał Gołębiowski
ba2bbf0677 Correct a typo in getJavaScript function expression name. 2013-12-16 21:40:43 +01:00
Hengjie
b96811df25 Fix Blob creation in Safari 7.0.
It should be !== ‘undefined’ to avoid matching everything that Blob can be a type of
2013-12-06 02:10:41 +13:00
Brendan Dahl
2af3e25651 Merge pull request #3954 from yurydelendik/invalid-start
Index objects if Prev xref was not found
2013-11-25 10:12:43 -08:00
Brendan Dahl
1c0ed17d8f Merge pull request #3964 from yurydelendik/issue-3962
Fixes chunks grouping
2013-11-25 09:28:25 -08:00
Yury Delendik
90956ce3e0 Takes chunk id == 0 into account during grouping 2013-11-23 12:04:22 -06:00
Yury Delendik
98ebf57144 Index objects if Prev xref was not found 2013-11-22 08:49:36 -06:00
Yury Delendik
419e2e15e5 Merge pull request #3940 from brendandahl/operator-cleanup
Combine if/else block with switch for getOperatorList.
2013-11-22 06:14:57 -08:00
Yury Delendik
4966bf3fc8 Limits U and O entries size 2013-11-21 14:49:39 -06:00
Yury Delendik
124eb30e8d Merge pull request #3936 from brendandahl/initial-data
Leave initial request open until the viewer is ready to switch to range requests.
2013-11-21 06:22:24 -08:00
Brendan Dahl
a4f329aa38 Combine if/else block with switch for getOperatorList. 2013-11-18 16:50:58 -08:00
Brendan Dahl
7563a9dfa0 Update docs on the workerSrc setting. 2013-11-18 14:37:01 -08:00
Brendan Dahl
29ee96cc67 Merge pull request #3927 from Snuffleupagus/issue-3925
Prevent updating the current transformation matrix when the stateStack is empty
2013-11-18 14:04:56 -08:00
Brendan Dahl
ff64b50582 Merge pull request #3931 from yurydelendik/bug900822
Allocates bigger hashData buffer
2013-11-18 13:09:40 -08:00
Brendan Dahl
3132c9e7e9 Merge pull request #3911 from yurydelendik/mem-redux2
Cleaning up fonts when viewer is idle for some time
2013-11-18 13:01:23 -08:00
Brendan Dahl
0385131a9a Leave initial request open until the viewer is ready to switch to range requests. 2013-11-18 11:17:26 -08:00
Yury Delendik
e712c4136a Cleaning up fonts when viewer is idle for some time 2013-11-18 13:01:54 -06:00
Yury Delendik
2b63cd7e62 Allocates bigger hashData buffer 2013-11-18 07:48:06 -06:00
Benjamin Flesch
d0ae79c994 Fixed Typo 2013-11-18 11:58:38 +01:00
Jonas Jenwald
564ae6e4f7 Prevent updating the current transformation matrix when the stateStack is empty 2013-11-17 01:54:14 +01:00
Brendan Dahl
1f7bfc8cc7 Merge pull request #3904 from yurydelendik/mem-redux
Reduces amount of memory allocated during worker operations
2013-11-15 11:44:40 -08:00
Yury Delendik
d72c94f4a3 Comment fix: shedule -> schedule 2013-11-14 15:45:02 -08:00
Yury Delendik
b70def015f Merge pull request #3916 from brendandahl/remove-slow-commands
Remove slow commands check.
2013-11-14 15:43:09 -08:00
Yury Delendik
c8af2565f1 Uses blob URL instead of data when possible 2013-11-14 15:21:42 -08:00
Yury Delendik
4ce6cb8b0f Uses postMessage transfers 2013-11-14 15:21:42 -08:00
Yury Delendik
011ed72383 Merge pull request #3917 from yurydelendik/issue-3857
Fixes gidStart for CID fonts
2013-11-14 10:45:32 -08:00
Brendan Dahl
7bdee4069c Merge pull request #3848 from brendandahl/page-refs
Don't traverse all pages to get a single page.
2013-11-13 17:02:11 -08:00
Yury Delendik
9a633f26a0 Fixes gidStart for CID fonts 2013-11-13 18:27:52 -06:00
Brendan Dahl
c2d65fc4ab Don't traverse all pages to get a single page. 2013-11-13 15:27:46 -08:00
Tim van der Meij
c320a0c2a5 Merge pull request #3887 from yurydelendik/bug903856
Fixing glyphs with invalid flags
2013-11-13 14:11:24 -08:00
Brendan Dahl
3ac89aacd2 Remove slow commands check. 2013-11-13 13:41:25 -08:00
Yury Delendik
82a9a13e5f Fixes glyphs with invalid flags 2013-11-13 13:45:59 -06:00
Brendan Dahl
f4942b11f8 Reduce the memory usage of the operator list. 2013-11-13 11:43:38 -08:00