pdfium.git
3 years agoAdd type cast definitions for CPDF_Boolean.
Dan Sinclair [Tue, 20 Oct 2015 20:38:12 +0000]
Add type cast definitions for CPDF_Boolean.

This CL adds ToBoolean, CPDF_Object::AsBoolean and CPDF_Object::IsBoolean and
updates the src to use them as needed.

BUG=pdfium:201
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1417623005 .

3 years agoRoll DEPS for v8 to 2607e2b. Regular weekly roll.
Lei Zhang [Tue, 20 Oct 2015 19:19:55 +0000]
Roll DEPS for v8 to 2607e2b. Regular weekly roll.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1415953003 .

3 years agoRevert "Revert "Add type cast definitions for CPDF_Dictionary.""
Dan Sinclair [Tue, 20 Oct 2015 18:57:56 +0000]
Revert "Revert "Add type cast definitions for CPDF_Dictionary.""

This reverts commit 937840e1722d1f2b77d80575d6e710d760662c9c.

Add type cast definitions for CPDF_Dictionary.

This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1420583003 .

3 years agoMinor documentation updates for fpdfview.h.
Dan Sinclair [Tue, 20 Oct 2015 18:13:02 +0000]
Minor documentation updates for fpdfview.h.

This does some minor copy editing and formatting of the documentation in the
fpdfview.h header.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411863004 .

3 years agoRevert "Make CFX_FontMgr member variables private."
Lei Zhang [Tue, 20 Oct 2015 17:43:15 +0000]
Revert "Make CFX_FontMgr member variables private."

This reverts commit c29bee029cd5fe3f8a4ceb580235ac2d0e5ce8fd.

because it broke corpus tests.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410733005 .

3 years agoRevert "Add type cast definitions for CPDF_Dictionary."
Dan Sinclair [Tue, 20 Oct 2015 17:30:34 +0000]
Revert "Add type cast definitions for CPDF_Dictionary."

This reverts commit 4816432671eef6467354aa252f22bb80acc315b7.

Reason, broke the javascript_test Rendering PDF file
/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf.
Non-linearized path...
FAILURE: document_methods.in; Command
'['/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/pdfium_test',
'/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf']'
returned non-zero exit status -11

BUG=pdfium:201
TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412413002 .

3 years agoMake CFX_FontMgr member variables private.
Lei Zhang [Tue, 20 Oct 2015 17:22:56 +0000]
Make CFX_FontMgr member variables private.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405213003 .

3 years agoAdd type cast definitions for CPDF_Dictionary.
Dan Sinclair [Tue, 20 Oct 2015 17:19:19 +0000]
Add type cast definitions for CPDF_Dictionary.

This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.

BUG=pdfium:201
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1399233003 .

3 years agoRemove unused CFFL_Notify.
Lei Zhang [Tue, 20 Oct 2015 00:10:15 +0000]
Remove unused CFFL_Notify.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1411963002 .

3 years agoFix some override warnings in fpdfview.cpp.
Lei Zhang [Tue, 20 Oct 2015 00:08:16 +0000]
Fix some override warnings in fpdfview.cpp.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410733004 .

3 years agoRemove duplicate core/include/thirdparties headers.
Tom Sepez [Mon, 19 Oct 2015 21:45:06 +0000]
Remove duplicate core/include/thirdparties headers.

These are unused in favor of the ones under the top-level
third_party/ directory.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1417483004 .

3 years agoRemove dead code that was reactivated when fixing overrides.
Lei Zhang [Mon, 19 Oct 2015 21:14:48 +0000]
Remove dead code that was reactivated when fixing overrides.

BUG=pdfium:205
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1409743004 .

3 years agoConsolidate test support code.
Tom Sepez [Mon, 19 Oct 2015 21:03:31 +0000]
Consolidate test support code.

Removes duplication between pdfium_test and pdfium_embeddertest

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1416713002 .

3 years agoSanity check the values of TRUE and FALSE.
Lei Zhang [Mon, 19 Oct 2015 19:00:05 +0000]
Sanity check the values of TRUE and FALSE.

Get rid of cond ? TRUE : FALSE.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405723003 .

3 years agoRemove some checks for object creation failures. They cannot fail.
Lei Zhang [Mon, 19 Oct 2015 18:52:28 +0000]
Remove some checks for object creation failures. They cannot fail.

Also reduce nesting in if statements, remove CFX_SmartPointer, and
use more unique_ptrs.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1393303004 .

3 years agoAdd FPDFAPIJPEG_ prefix to more libjpeg functions
Tom Sepez [Mon, 19 Oct 2015 18:49:57 +0000]
Add FPDFAPIJPEG_ prefix to more libjpeg functions

Original patch by Evangelos Foutras.

Chromium built with use_system_libjpeg=1 can mistakenly try to use
symbols exported by the libjpeg library that's bundled with pdfium.

These name conflicts result in failure to encode the contents of a
canvas element using toDataURL('image/jpeg').

BUG=505226
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1409243004 .

3 years agoUnrevert commit a398ca6 and apply the proper fix.
Lei Zhang [Mon, 19 Oct 2015 18:46:02 +0000]
Unrevert commit a398ca6 and apply the proper fix.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1401493002 .

3 years agoRevert "Switch builds to clang by default for Linux and OS X."
Oliver Chang [Mon, 19 Oct 2015 18:23:52 +0000]
Revert "Switch builds to clang by default for Linux and OS X."

This reverts commit 5478df43a8970257e9644ae6f57a6fe7513029c6.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413193002 .

3 years agoSwitch builds to clang by default for Linux and OS X.
Oliver Chang [Mon, 19 Oct 2015 18:19:22 +0000]
Switch builds to clang by default for Linux and OS X.

Also adds support for ASan and sanitizer coverage.

BUG=pdfium:1,pdfium:171
R=thakis@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1406843002 .

3 years agoDon't bother passing -1 as the length to the CFX_ByteString ctor.
Lei Zhang [Fri, 16 Oct 2015 23:21:58 +0000]
Don't bother passing -1 as the length to the CFX_ByteString ctor.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1406363002 .

3 years agoDeclare PDF_GetStandardFontName() in the header.
Lei Zhang [Fri, 16 Oct 2015 21:35:18 +0000]
Declare PDF_GetStandardFontName() in the header.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1410043003 .

3 years agofxcrt convergence - master side
Tom Sepez [Fri, 16 Oct 2015 21:11:48 +0000]
fxcrt convergence - master side

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1410933002 .

3 years agoFix stray backslashes in README.md
Tom Sepez [Fri, 16 Oct 2015 19:26:17 +0000]
Fix stray backslashes in README.md

TBR=dsinclair@chromium.org

Review URL: https://codereview.chromium.org/1414463002 .

3 years agoUpdate link to chromium src.
dan sinclair [Fri, 16 Oct 2015 17:08:12 +0000]
Update link to chromium src.

This CL updates the documentation link to the Chromium PDF plugin to
point to Gitiles instead of the SVN repo.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1407313002 .

3 years agoDEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.
Tom Sepez [Fri, 16 Oct 2015 16:38:32 +0000]
DEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.

Adds the following new violations:
ERROR in core/include/fpdfapi/fpdf_parser.h
  Illegal include: "public/fpdfview.h"
ERROR in core/include/fpdfapi/fpdf_render.h
  Illegal include: "public/fpdf_progressive.h"
ERROR in core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp
  Illegal include: "public/fpdfview.h"

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1411493002 .

3 years agoLoosen checking on the bytes following 'stream'
Jun Fang [Fri, 16 Oct 2015 02:45:01 +0000]
Loosen checking on the bytes following 'stream'

PDF specs say that end of line markers shall follow the
keyword "stream". But a white space before end of line
markers follows this keyword in the test pdf files.

BUG=543018
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1401923005 .

3 years agoMove conditionals inside target_defaults.
dan sinclair [Fri, 16 Oct 2015 01:44:11 +0000]
Move conditionals inside target_defaults.

This CL moves the conditionals inside the target_defaults configuration. This
causes the -fPIC to get picked up and allows component=shared_library to build
correctly.

BUG=pdfium:218
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407903002 .

3 years agoAdd some community and testing info to README.md.
dan sinclair [Fri, 16 Oct 2015 00:43:02 +0000]
Add some community and testing info to README.md.

This CL adds some more context to the README on the various test suites and
community mailing lists which are available.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412453004 .

3 years agoPlug a leak in CPDF_StreamParser::ReadInlineStream
Oliver Chang [Thu, 15 Oct 2015 23:55:21 +0000]
Plug a leak in CPDF_StreamParser::ReadInlineStream

R=thestig@chromium.org, tsepez@chromium.org
BUG=pdfium:212

Review URL: https://codereview.chromium.org/1405203002 .

3 years agoIntroduce CPDFPageFromFPFDPage()
Tom Sepez [Thu, 15 Oct 2015 23:34:32 +0000]
Introduce CPDFPageFromFPFDPage()

Abstracts the way that pages are passed to the embedder
between XFA and master.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1406543004 .

3 years agoReturn result of GetRBG instead of TRUE
dan sinclair [Thu, 15 Oct 2015 23:26:15 +0000]
Return result of GetRBG instead of TRUE

Propagate the return value of GetRBG to the callers instead of forcing the
return of TRUE.

BUG=pdfium:44
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1398633008 .

3 years agoAdd steps for Contributing Code to README.md
Tom Sepez [Thu, 15 Oct 2015 22:54:16 +0000]
Add steps for Contributing Code to README.md

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413493002 .

3 years agoFix layering violation in CPDF_Document::FromFPDFDocument().
Tom Sepez [Thu, 15 Oct 2015 21:51:42 +0000]
Fix layering violation in CPDF_Document::FromFPDFDocument().

Make this a function in the fpdfsdk/ layer, rather than a method
in the core/ layer. Nothing in core should know about public FPDF
types.

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1396283006 .

3 years agoIntroduce CPDF_Document::FromFPDFDocument().
Tom Sepez [Wed, 14 Oct 2015 23:34:46 +0000]
Introduce CPDF_Document::FromFPDFDocument().

This will be used to abstract one major difference between master
and XFA, namely that the CPDF_Document is not a direct cast in XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1395493007 .

3 years agoNext round of master changes to match XFA
Tom Sepez [Wed, 14 Oct 2015 20:54:22 +0000]
Next round of master changes to match XFA

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1401423004 .

3 years agoLand temporary workaround for clang-cl not yet understanding __emul
Nico Weber [Wed, 14 Oct 2015 16:37:50 +0000]
Land temporary workaround for clang-cl not yet understanding __emul

BUG=543182
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405553003 .

3 years agoAdd unit test for top-level bookmarks.
Tom Sepez [Wed, 14 Oct 2015 16:17:02 +0000]
Add unit test for top-level bookmarks.

Null FPDF_BOOKMARK represents the "root" bookmark, and must
not segv when asking about titles or children.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1404723002 .

3 years agoRoll DEPS for v8 to d3f97a9. Regular weekly roll.
Lei Zhang [Tue, 13 Oct 2015 23:04:01 +0000]
Roll DEPS for v8 to d3f97a9. Regular weekly roll.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1407643002 .

3 years agoRevert "Remove IPDFSDK_AnnotHandler interface."
Tom Sepez [Tue, 13 Oct 2015 22:22:20 +0000]
Revert "Remove IPDFSDK_AnnotHandler interface."

This reverts commit 633f1e436e1cced874a44a797f02c452eb3cf958.
This restores IPDFSDK_AnnotHandler, which is pointless on master
but useful on XFA. The small gain on master isn't worth the noise
when diffing to XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1408513002 .

3 years agoChanges to master to more closely match XFA.
Tom Sepez [Tue, 13 Oct 2015 22:17:46 +0000]
Changes to master to more closely match XFA.

These files should change in master in order to reduce the number of
"noise diffs" between master and XFA as seen in
    https://codereview.chromium.org/1399273003/

This includes: whitespace, matching header ordering, and implementing
a GetPageFromFPDFPage() from XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407583004 .

3 years agowstring allocations waste up to 7 wasted bytes.
Tom Sepez [Tue, 13 Oct 2015 19:02:11 +0000]
wstring allocations waste up to 7 wasted bytes.

Consequence of having the same code in two places;
fx_basic_bstring.cpp is correct, but fx_basic_wstring.cpp
is missing one small change.

Noticed while working on 542403, but this will not fix that
issue. It is just a space savings.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1399983003 .

3 years agoupgrade openjpeg to commit# cf352af
Jun Fang [Tue, 13 Oct 2015 07:28:55 +0000]
upgrade openjpeg to commit# cf352af

BUG=457480,497355
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1338973005 .

3 years agoSanitize CJBig2_SymbolDict's memory usage.
Lei Zhang [Fri, 9 Oct 2015 20:51:05 +0000]
Sanitize CJBig2_SymbolDict's memory usage.

- Use std::vector<JBig2ArithCtx> instead of storing pointers to arrays.
- Make CJBig2_SymbolDict's members private with accessors.
- Use std::vector<JBig2ArithCtx> in related places.
- Steal Chromium's vector_as_array() and use it as an adaptor as needed.

BUG=514891
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1388203003 .

3 years agoParallelize run_corpus_tests.py.
Lei Zhang [Fri, 9 Oct 2015 20:42:58 +0000]
Parallelize run_corpus_tests.py.

- Use the number of cores as the default -j value
- Fall back to old code for -j 1

R=nparker@chromium.org

Review URL: https://codereview.chromium.org/1398793003 .

3 years agoPass IJS_Runtime, not IJS_Context, to native object constructors.
Tom Sepez [Fri, 9 Oct 2015 20:14:47 +0000]
Pass IJS_Runtime, not IJS_Context, to native object constructors.

This better separates the two IJS_ classes, with the IJS_Context
taking on its proper role of describing an event. There's no need
for the event details for object creation, so this gets much
cleaner.

Move some JS error reporting code from CJS_Context to CJS_Runtime.
Make InitInstance() and ExitInstance() voids, they always return
TRUE and we never check the result anyways.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389163007 .

3 years agoAllow compiling PDFium without V8.
Tom Sepez [Fri, 9 Oct 2015 19:45:15 +0000]
Allow compiling PDFium without V8.

Original patch from issue 1391843004 at patchset 1
(http://crrev.com/1391843004#ps1)

Introduce a pdf_enable_v8 GYP variable, which controls a
corresponding PDF_ENABLE_V8 #define, and bring in the real
JS library when set. Otherwise, link against a stub JS
runtime.

BUG=pdfium:211
R=dml@google.com, jochen@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1395733006 .

3 years agoFix a bad refactoring error from commit 8a9ce57.
Lei Zhang [Fri, 9 Oct 2015 17:04:37 +0000]
Fix a bad refactoring error from commit 8a9ce57.

BUG=541323
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1400773002 .

3 years agoFix a compiling error on Mac
Jun Fang [Fri, 9 Oct 2015 05:40:38 +0000]
Fix a compiling error on Mac

BUG=497357

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1395493003 .

3 years agoFix heap-buffer-overflow in color_sycc_to_rgb
Jun Fang [Fri, 9 Oct 2015 05:14:54 +0000]
Fix heap-buffer-overflow in color_sycc_to_rgb

It's a bug existing in the conversion from YUV420 to RGB.
For YUV 420 format, four pixels have 4 Y but only one U and
one V. In some cases, there are odd columns or lines in
some images. The pixels on last line or column may have Y
but no U or V data. For this case, We shall extend U or V
using the data on previous column or line.

BUG=497357
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1342683002 .

3 years agoMinimal revert from commit d03ba8d.
Lei Zhang [Thu, 8 Oct 2015 23:45:13 +0000]
Minimal revert from commit d03ba8d.

The values that were changed to size_t can go negative.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1400723002 .

3 years agoFix a bunch of sign mismatch warnings.
Lei Zhang [Thu, 8 Oct 2015 22:51:29 +0000]
Fix a bunch of sign mismatch warnings.

Also remove some gotos and move code into an anonymous namespace.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1356373003 .

3 years agoFix a malloc/delete mismatch introduced in commit 8a9ce57.
Lei Zhang [Thu, 8 Oct 2015 22:27:28 +0000]
Fix a malloc/delete mismatch introduced in commit 8a9ce57.

Just get rid of the malloc altogether and use CJBig2_List instead.

BUG=540873
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1394933002 .

3 years agoVarious changes to JBig2 cache:
David Lattimore [Thu, 8 Oct 2015 21:18:20 +0000]
Various changes to JBig2 cache:
- Makes the cache be per-document
- Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits).
- Makes it so the cache is only used for the globals stream.
- Reenable the cache.

R=thestig@chromium.org

BUG=pdfium:207

Review URL: https://codereview.chromium.org/1380243004 .

3 years agoPut CJBig2_SymbolDict's images in a CJBig2_List container.
Lei Zhang [Thu, 8 Oct 2015 19:13:10 +0000]
Put CJBig2_SymbolDict's images in a CJBig2_List container.

Also mark it private.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1395613003 .

3 years agoWean CJS_Value off of v8::Isolate.
Tom Sepez [Thu, 8 Oct 2015 19:04:40 +0000]
Wean CJS_Value off of v8::Isolate.

CJS_Values should belong to CJS_Runtimes so that we may
eventually cram much of the v8 dependencies down into fxjs.

This is a first step; the remaining split in this code between
isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime
object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't
happen until this is resolved.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1394103002 .

3 years agoRelax the check on 0 length streams.
Lei Zhang [Thu, 8 Oct 2015 17:34:28 +0000]
Relax the check on 0 length streams.

CPDF_SyntaxParser::ReadStream() originally created stream objects when
the length is 0. Commit 2526930 tightened the constraint and returned
NULL. This has some adverse affects, as seen in Chromium's print
preview of PDFs.

Instead, relax the constraint a little so when the length is 0, return a
CPDF_Stream with NULL data and size 0.

BUG=531835

Review URL: https://codereview.chromium.org/1394743002 .

3 years agoRemove some dead code from CCodec_Jbig2Module. Variable was only ever set to false.
David Lattimore [Wed, 7 Oct 2015 23:13:44 +0000]
Remove some dead code from CCodec_Jbig2Module. Variable was only ever set to false.

R=thestig@chromium.org

BUG=

Review URL: https://codereview.chromium.org/1393153002 .

3 years agoRename IFXJS_Runtime and IFXJS_Context to IJS_.
Tom Sepez [Wed, 7 Oct 2015 19:52:13 +0000]
Rename IFXJS_Runtime and IFXJS_Context to IJS_.

Nothing but sed.

FXJS is a layer that makes it easier to define objects in V8, but has
no knowledge of PDF-specific native objects.  It could in theory be used
to implement other sets of native objects.

JS is the layer that implements PDF-specific native objects on top of
FXJS.

Therefore, the classes used to interface to JS should be named using
IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1386173002 .

3 years agoUpdate README.md to reflect added .png support
Tom Sepez [Wed, 7 Oct 2015 19:33:31 +0000]
Update README.md to reflect added .png support

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1391023004 .

3 years agoStop inlining CJBig2_BitStream.
Lei Zhang [Wed, 7 Oct 2015 18:12:06 +0000]
Stop inlining CJBig2_BitStream.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1393823002 .

3 years agoFix the Windows build after commit 8a9ce57.
Lei Zhang [Wed, 7 Oct 2015 17:44:43 +0000]
Fix the Windows build after commit 8a9ce57.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1396533002 .

3 years agoRemove gotos in JBig2 code.
Lei Zhang [Wed, 7 Oct 2015 17:37:07 +0000]
Remove gotos in JBig2 code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1382613003 .

3 years agoMove build instructions to README.md
Jochen Eisinger [Wed, 7 Oct 2015 09:20:58 +0000]
Move build instructions to README.md

That way, they'll be automatically displayed on gitiles

BUG=
R=andybons@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1378073003 .

3 years agoRoll DEPS for v8 to 9081ee1.
Lei Zhang [Tue, 6 Oct 2015 22:44:31 +0000]
Roll DEPS for v8 to 9081ee1.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1391733002 .

3 years agoFix include paths for fx_system.h
David Lattimore [Tue, 6 Oct 2015 22:20:13 +0000]
Fix include paths for fx_system.h

R=thestig@chromium.org

BUG=

Review URL: https://codereview.chromium.org/1390863002 .

3 years agoRemove unused global argument from FXJS_CONSTRUCTOR.
Tom Sepez [Tue, 6 Oct 2015 18:47:51 +0000]
Remove unused global argument from FXJS_CONSTRUCTOR.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389003003 .

3 years agoStore object definition ID in each js_class.
Tom Sepez [Tue, 6 Oct 2015 18:10:52 +0000]
Store object definition ID in each js_class.

Avoids doing a lookup via FXJS_V8 for something already
known in CJS layer.

Also:
Consolidate repeated code in JS macros.
Remove knowledge that Document is global from FXJS layer

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1382263002 .

3 years agoRun FXJS_V8 embedder tests against a shared isolate.
Tom Sepez [Tue, 6 Oct 2015 15:53:13 +0000]
Run FXJS_V8 embedder tests against a shared isolate.

Start to back-fill some tests for the recent isolate work.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1377293004 .

3 years agoMake the vast majority of JS headers private to src/javascript.
Tom Sepez [Tue, 6 Oct 2015 14:50:47 +0000]
Make the vast majority of JS headers private to src/javascript.

The fpdfsdk/include/javascript/IJavascript.h is the sole API.
This required moving a creaton method to it from JS_Runtime.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389783002 .

3 years agoFix regression in JBIG2 decoding from commit ce37d73.
Lei Zhang [Tue, 6 Oct 2015 06:02:25 +0000]
Fix regression in JBIG2 decoding from commit ce37d73.

many callers can tolerate CJBig2_ArithIntDecoder::decode() OOB failure.

BUG=539749, pdfium:209
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1384663007 .

3 years agoRemove JavaScript.h
Tom Sepez [Mon, 5 Oct 2015 23:18:28 +0000]
Remove JavaScript.h

It merely includes a bunch of other .h files which are handled
better since we fixed IWYU.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1385983002 .

3 years agoOriginal patch by forshaw.
Tom Sepez [Mon, 5 Oct 2015 19:57:17 +0000]
Original patch by forshaw.

Added a fallback Win32 font information class for win32k lockdown.
This is to support running PDFIUM within the Win32k lockdown by
removing dependancies on USER32/GDI for the font information code.
It falls back to using a freetype/directory enumeration implementation
if it detects the win32k system calls have been disabled by policy.

BUG=523278
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1306883002 .

3 years agoDisable JBIG2 cache; prevent data corruption - try 2.
Lei Zhang [Mon, 5 Oct 2015 17:16:20 +0000]
Disable JBIG2 cache; prevent data corruption - try 2.

Also change CJBig2_SymbolDict::DeepCopy() to return a unique_ptr to
prevent a potential leak if the cache size was 0.

BUG=pdfium:207
R=tsepez@chromium.org, jbreiden@google.com

Review URL: https://codereview.chromium.org/1374633004 .

3 years agoFix a leak with g_DefaultGlobalObjectTemplate.
Lei Zhang [Mon, 5 Oct 2015 03:42:33 +0000]
Fix a leak with g_DefaultGlobalObjectTemplate.

As seen when running FXJSV8Embeddertest.Getters.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1380993003 .

3 years agoRemove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.
Lei Zhang [Mon, 5 Oct 2015 03:41:53 +0000]
Remove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1374723004 .

3 years agoOnly call DefineJSObjects() once for the global V8 isolate.
Lei Zhang [Mon, 5 Oct 2015 03:40:15 +0000]
Only call DefineJSObjects() once for the global V8 isolate.

BUG=539106
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1386823002 .

3 years agoCJS_Timer should observe CJS_Runtime destruction.
Lei Zhang [Sun, 4 Oct 2015 23:01:52 +0000]
CJS_Timer should observe CJS_Runtime destruction.

Also remove dead CJS_EmbedObj::{Begin,End}Timer code.

BUG=539107
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1384883002 .

3 years agoFix NULL pointer dereference in CPDF_InterForm.
Lei Zhang [Sat, 3 Oct 2015 17:06:25 +0000]
Fix NULL pointer dereference in CPDF_InterForm.

BUG=537772
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1387703002 .

3 years agoRefcount external V8 isolate initialization / release.
Lei Zhang [Sat, 3 Oct 2015 17:00:24 +0000]
Refcount external V8 isolate initialization / release.

BUG=531339
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377463005 .

3 years agoPass v8::Isolate to PDFium at init time.
Tom Sepez [Fri, 2 Oct 2015 23:43:15 +0000]
Pass v8::Isolate to PDFium at init time.

Move the external isolate and embedder slot from the
IPDF_JSPlatforms struct supplied at the
FPDFDOC_InitFormFillEnvironment() call time to arguments to
the FPDF_InitLibraryWithConfig() call.

This has several benefits:
-- Avoids the crash that could happen if multiple
FPDFDOC_InitFormFillEnvironmen() calls should happen to be
made by an embedder with different slot values.
-- Down the road, for XFA, there may be XFA but no FormFill
environment.

We support both forms for the time being, until the chrome
side catches up, at which point we will deprecate the old
way.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1367033002 .

3 years agoDo not call into formfiller code with a NULL PageView.
Lei Zhang [Fri, 2 Oct 2015 21:01:37 +0000]
Do not call into formfiller code with a NULL PageView.

BUG=537173
R=jun_fang@foxitsoftware.com, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1376093002 .

3 years agoGet rid of gotos in CPDF_SyntaxParser and FlateUncompress().
Lei Zhang [Fri, 2 Oct 2015 18:26:58 +0000]
Get rid of gotos in CPDF_SyntaxParser and FlateUncompress().

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1360103002 .

3 years agoPrevent divide by zeros in CJBig2_GSIDProc::decode_MMR().
Lei Zhang [Fri, 2 Oct 2015 17:58:42 +0000]
Prevent divide by zeros in CJBig2_GSIDProc::decode_MMR().

Check the image size before attempting to decode.

BUG=538103
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377493005 .

3 years agoFix a leak in PDF_DataDecode() on failure.
Lei Zhang [Fri, 2 Oct 2015 17:56:30 +0000]
Fix a leak in PDF_DataDecode() on failure.

Found using the test examples from https://crbug.com/537780

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1376413003 .

3 years agoTurn a couple functions that always return true to return void.
Lei Zhang [Fri, 2 Oct 2015 17:29:50 +0000]
Turn a couple functions that always return true to return void.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1386463003 .

3 years agoFix PNG decoding divide by zero error due to zero row count.
Lei Zhang [Fri, 2 Oct 2015 17:27:44 +0000]
Fix PNG decoding divide by zero error due to zero row count.

BUG=537790
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1379243002 .

3 years agoCorrect mistakes in test case for 507316
Tom Sepez [Fri, 2 Oct 2015 16:05:53 +0000]
Correct mistakes in test case for 507316

Original patch by chamalsl.

Trailer size in bug_507316 was wrong.

embedder_test.cpp's GetPageTrampoline passed null parameter.
It will affect future test cases even if it does not affect
this.

BUG=507316
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377403003 .

3 years agoFix static initializer in fxjs_v8.cpp
Tom Sepez [Fri, 2 Oct 2015 00:40:14 +0000]
Fix static initializer in fxjs_v8.cpp

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1372103004 .

3 years agoDisable JBIG2 cache; prevent data corruption
Lei Zhang [Thu, 1 Oct 2015 22:12:49 +0000]
Disable JBIG2 cache; prevent data corruption

BUG=pdfium:207

Original author: jbreiden@google.com
Original CL: http://codereview.chromium.org/1362133003/

R=jbreiden@google.com

Review URL: https://codereview.chromium.org/1382073002 .

3 years agoClean up some image decoder classes:
Lei Zhang [Thu, 1 Oct 2015 20:49:28 +0000]
Clean up some image decoder classes:

- Use std::vector<uint8_t> instead of raw uint8_t*
- Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t*
- Add FxFreeDeleter, use it in CCodec_ImageDataCache.
- Make CCodec_ImageDataCache encapsulate its data members.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1361053002 .

3 years agoCleanup JBig2_ArithIntDecoder.
Lei Zhang [Thu, 1 Oct 2015 20:16:29 +0000]
Cleanup JBig2_ArithIntDecoder.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1359013003 .

3 years agoRevert "Leak per-isolate data in pdfium"
Raymes Khoury [Thu, 1 Oct 2015 05:12:08 +0000]
Revert "Leak per-isolate data in pdfium"

This reverts commit 3e144b8c23d7c52ed36329e87f0cb01f38ec1ed7.

This may be causing the failures seen in crbug.com/537799.

BUG=537799

Review URL: https://codereview.chromium.org/1382433003 .

3 years agoAdd signatures to FXJS_V8.
Tom Sepez [Wed, 30 Sep 2015 22:39:57 +0000]
Add signatures to FXJS_V8.

BUG=chromium:529012
R=jochen@chromium.org, krasin@google.com

Review URL: https://codereview.chromium.org/1353193004 .

3 years agoLeak per-isolate data in pdfium
Raymes Khoury [Wed, 30 Sep 2015 09:46:41 +0000]
Leak per-isolate data in pdfium

Right now we're freeing per-isolate data everytime a document is destroyed even
though it may be in use by other documents. For now we leak the per-isolate
data until crbug.com/531339 is fixed.

BUG=531339
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/1372353002 .

Patch from Raymes Khoury <raymes@chromium.org>.

3 years agoCleanup CJBig2_ArithDecoder.
Lei Zhang [Wed, 30 Sep 2015 04:14:58 +0000]
Cleanup CJBig2_ArithDecoder.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1368153003 .

3 years agoRoll DEPS for v8 to d7f813b.
Lei Zhang [Tue, 29 Sep 2015 22:28:43 +0000]
Roll DEPS for v8 to d7f813b.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1380663003 .

3 years agoRefactor some common code for bounding boxes.
Lei Zhang [Tue, 29 Sep 2015 21:34:22 +0000]
Refactor some common code for bounding boxes.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1373333002 .

3 years agoFix blank page issue caused by too strict correction on bpc
Jun Fang [Tue, 29 Sep 2015 02:24:54 +0000]
Fix blank page issue caused by too strict correction on bpc

For bit per component (bpc), PDF spec mentions that a RunLengthDecode or DCTDecode filter shall always deliver 8-bit samples. However, some PDF files don't follow this rule. We can find that filter is RunLengthDecode but bpc is 1 in the provided test file. In this case, pdfium will correct bpc to 8 but the actual bpc is 1. It causes a failure because the data is much more than the expected. To handle this case, pdfium doesn't correct bpc to 8 when the original bpc is 1.

BUG=512557
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1328213002 .

3 years agoCleanup some fx_codec_fax.cpp code.
Lei Zhang [Mon, 28 Sep 2015 18:52:19 +0000]
Cleanup some fx_codec_fax.cpp code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1367633005 .

3 years agoFix test diff caused by v8 version update
Tom Sepez [Mon, 28 Sep 2015 17:20:16 +0000]
Fix test diff caused by v8 version update

Also changes DEPS to specify a specific v8 version, this will
require us to manually update this version from time to time,
but also solves a longstanding problem where going back to an
older version (say for bisecting) wouldn't always work.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1372963003 .