pdfium.git
4 years agoMerge to XFA: Use IPDF_DataAvail interface to hide CPDF_DataAvail.
Tom Sepez [Fri, 23 Jan 2015 01:00:12 +0000]
Merge to XFA: Use IPDF_DataAvail interface to hide CPDF_DataAvail.

Original CL at https://codereview.chromium.org/873523002/

TBR=thestig@chromium.org

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

4 years agoMerge to XFA: Add embeddertests.
Tom Sepez [Thu, 22 Jan 2015 19:20:06 +0000]
Merge to XFA: Add embeddertests.

This brings in:
83f96a0 Add API tests: NamedDestsByName, DestGetPageIndex.
9dcd7b8 Add tests for GetNamedDests() API.

TBR=bo_xu@foxitsoftware.com

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

4 years agoMerge to XFA: Use signed long for FPDF_GetNamedDest buffer length.
Bo Xu [Wed, 21 Jan 2015 22:20:28 +0000]
Merge to XFA: Use signed long for FPDF_GetNamedDest buffer length.

Need to have return value -1 indicating insufficient buffer.

R=tsepez@chromium.org

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

4 years agoMerge to XFA: Simplify UTF16LE_Encode and add unittest.
Bo Xu [Wed, 21 Jan 2015 20:17:23 +0000]
Merge to XFA: Simplify UTF16LE_Encode and add unittest.

Previously, UTF16LE_Encode take an optional flag to indicate
if the returned byte string has trailing zeros. In fact, no where
needs the flag to be false. So just get rid of it so callers won't
misuse.

The bug is found by https://codereview.chromium.org/837723009

R=tsepez@chromium.org

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

4 years agoMerge to XFA: PDFium embeddertests.
Tom Sepez [Fri, 16 Jan 2015 22:59:26 +0000]
Merge to XFA: PDFium embeddertests.

This consists of two origin/master CLs:
Review URL: https://codereview.chromium.org/857483005
Review URL: https://codereview.chromium.org/827733006

It also fixes a couple of segv's in XFA when the library is initialized and destroyed multiple times in the same process.

R=jam@chromium.org
TBR=jam@chromium.org

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

4 years agoFix a PDF417 encoding bug for 45 digits numeric data.
Bo Xu [Fri, 16 Jan 2015 19:46:03 +0000]
Fix a PDF417 encoding bug for 45 digits numeric data.

This bug is fixed in https://github.com/zxing/zxing/commit/71d83953bdb2aa83a5c70e7e005adcbc523647dc

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 834703002, add APIs for getting bookmarks and named destinat...
Bo Xu [Sun, 11 Jan 2015 06:52:59 +0000]
XFA: merge patch from CL 834703002, add APIs for getting bookmarks and named destinations.

Also uses "((CPDFXFA_Document*)document)->GetPDFDoc();" in a various places

Add APIs for getting bookmarks and named destinations.

R=tsepez@chromium.org

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

4 years agoMerge to XFA: Ensure unittests are built when building all.
Tom Sepez [Thu, 15 Jan 2015 20:12:10 +0000]
Merge to XFA: Ensure unittests are built when building all.

Original Review URL: https://codereview.chromium.org/849113002

TBR=scottmg@chromium.org
TBR=jam@chromium.org

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

4 years agoMerge to XFA: Land patch from issue 854603005 at patchset 1 (http://crrev.com/8546030...
Tom Sepez [Thu, 15 Jan 2015 17:34:34 +0000]
Merge to XFA: Land patch from issue 854603005 at patchset 1 (crrev.com/854603005#ps1) on behalf of qsr@

TBR=qsr@chromium.org

Original CL at Review URL: https://codereview.chromium.org/852983003

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

4 years agoFix a NULL dereference introduced from https://pdfium.googlesource.com/pdfium/+/5d9ac...
Bo Xu [Wed, 14 Jan 2015 01:02:12 +0000]
Fix a NULL dereference introduced from https://pdfium.googlesource.com/pdfium/+/5d9acf8ee5dbbaad838f14f1fa173d892c4300ab%5E%21

The test file is test/barcode_test.pdf

R=tsepez@chromium.org

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

4 years agoFix include paths for pdfium_unittests under chromium checkout.
Tom Sepez [Mon, 12 Jan 2015 22:52:35 +0000]
Fix include paths for pdfium_unittests under chromium checkout.

Here, testing/gtest and testing/some-pdfium-stuff will be different
directories, since we will use the gtest at top-level.  For standalone,
they happen to be the same.

TBR=bo_xu@foxitsoftware.com

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

4 years agoOrganize barcode codes into modules.
Bo Xu [Sat, 10 Jan 2015 01:27:21 +0000]
Organize barcode codes into modules.

Previously all the files in barcode are lumped together.
The naming of some files are inconsistent,
leading to difficult understanding of the structure.
Now files are grouped based on different barcode type like in zxing.
This also matches what it looks like in other xfa folders.
The file names in each folder could be further modified to be consistent.

R=tsepez@chromium.org

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

4 years agoUnit test for 417HighLevelEncoder
Tom Sepez [Sat, 10 Jan 2015 00:25:08 +0000]
Unit test for 417HighLevelEncoder

R=bo_xu@foxitsoftware.com

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

4 years agoFix GN build under chromium checkout.
Tom Sepez [Fri, 9 Jan 2015 22:49:47 +0000]
Fix GN build under chromium checkout.

Original patch at https://codereview.chromium.org/817813004
This suppresses the fatal compilation warnings introduced by
https://pdfium.googlesource.com/pdfium/+/e4fc5ced45c8fcfbe2487ec64eab036bc7d57602

TBR=thestig@chromium.org

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

4 years agoMerge to XFA: Add pdfium_unittests to BUILD.gn
Tom Sepez [Fri, 9 Jan 2015 21:59:19 +0000]
Merge to XFA: Add pdfium_unittests to BUILD.gn

Original at URL: https://codereview.chromium.org/840343005

TBR=thestig@chromium.org

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

4 years agoXFA: merge patch from CL 839163002 to only request C++ 11 for C++
Bruce Dawson [Fri, 9 Jan 2015 19:54:49 +0000]
XFA: merge patch from CL 839163002 to only request C++ 11 for C++

Only request C++11 when compiling C++ code.

Linux pdfium builds have 215 warnings of this form:
command line option -std=gnu++11 is valid for C++/ObjC++ but not for C

The obvious fix is to not request C++11 for C compilations. The only
complication was the the switch we are using is actually gnu++0x, not
gnu++11.

BUG=https://code.google.com/p/pdfium/issues/detail?id=102
TBR=tsepez@chromium.org

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

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

4 years agomerge to XFA: Fix -Wnon-virtual-dtor compiler warnings.
Tom Sepez [Fri, 9 Jan 2015 19:46:17 +0000]
merge to XFA: Fix -Wnon-virtual-dtor compiler warnings.

Original at URL: https://codereview.chromium.org/810883005

Note that the new code in XFA introduces many more of these, to be handled
separately.

TBR=brucedawson@chromium.org
TBR=thestig@chromium.org

BUG=https://code.google.com/p/pdfium/issues/detail?id=102

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

4 years agoMerge to XFA: Land: Protect against a seg fault in CPDF_StructElementImpl constructor
Tom Sepez [Fri, 9 Jan 2015 00:40:19 +0000]
Merge to XFA: Land: Protect against a seg fault in CPDF_StructElementImpl constructor

Original CL at https://codereview.chromium.org/841943003/

TBR=jam@chromium.org

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

4 years agoDo not convert from string literal to wchar_t*
Bo Xu [Fri, 9 Jan 2015 00:29:03 +0000]
Do not convert from string literal to wchar_t*

R=brucedawson@chromium.org

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

4 years agoAdd original copyright notice for barcode module.
Bo Xu [Thu, 8 Jan 2015 19:50:51 +0000]
Add original copyright notice for barcode module.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 792953005, fix most warnings
Bruce Dawson [Thu, 8 Jan 2015 19:47:49 +0000]
XFA: merge patch from CL 792953005, fix most warnings

Includes fixes to XFA specific warnings -- benign truncations.
Bug https://code.google.com/p/pdfium/issues/detail?id=104
was filed to track changing types to avoid some truncations.

Resolve all but two VC++ build warnings in pdfium.

pdfium builds on Win32 have about 85 warnings (250 in the XFA
branch, totaling over 480 lines!), mostly from four lines in
a header file and a warning that should be disabled. This
change resolves all but two of them and turns on
warning-as-errors. Bugs have been filed for the two
remaining warnings:
https://code.google.com/p/pdfium/issues/detail?id=100
the 64-bit warnings:
https://code.google.com/p/pdfium/issues/detail?id=101
and the Linux warnings:
https://code.google.com/p/pdfium/issues/detail?id=102

The fix to the double->float truncation bugs will also
improve code-generation.

R=bo_xu@foxitsoftware.com, tsepez@chromium.org

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

BUG= https://code.google.com/p/pdfium/issues/detail?id=100

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

4 years agoMerge to XFA: Finish unit test for CFX_ByteStringC class.
Tom Sepez [Wed, 7 Jan 2015 20:35:20 +0000]
Merge to XFA: Finish unit test for CFX_ByteStringC class.

Original CL at https://codereview.chromium.org/808553013

TBR=brucedawson@chromium.org

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

4 years agoMerge to XFA: Add ostream helpers for FX String classes.
Tom Sepez [Wed, 7 Jan 2015 20:28:56 +0000]
Merge to XFA: Add ostream helpers for FX String classes.

Original CL at https://codereview.chromium.org/837843002

TBR=brucedawson@chromium.org

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

4 years agoMerge to XFA: Re-enable pdfium_unittests.
Tom Sepez [Wed, 7 Jan 2015 18:04:16 +0000]
Merge to XFA: Re-enable pdfium_unittests.

Original CL at https://codereview.chromium.org/835233002

R=brucedawson@chromium.org

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

4 years agoXFA: merge patch from CL 832703003, remove g_timeMap global
Bruce Dawson [Mon, 5 Jan 2015 23:31:49 +0000]
XFA: merge patch from CL 832703003, remove g_timeMap global

Get rid of g_timeMap global object.

g_timeMap is a global variable with a constructor and destructor so it
must be removed.

BUG=441899
TBR=tsepez@chromium.org

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

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

4 years agoXFA: merge patch from CL 792043005, run-time hashing.
Bruce Dawson [Mon, 5 Jan 2015 23:18:21 +0000]
XFA: merge patch from CL 792043005, run-time hashing.

Remove run-time calculation of hash constants in pdfium.

PDFium static initializers must go. Static initializers are prohibited
by the style guide. They have negative consequences including increased
startup time (from pulling in additional code pages) and reduced sharing
of data pages (since the variables can't go in the read-only data
segment).

This change uses a template struct and typed enums to reproduce
JS_CalcHash at run-time. An unsigned long long constant and masking with
0xFFFFFFFF are used to avoid compile errors due to integer overflow of
compile-time constants.

The HashVerify class is used to check the results, necessary since none
of the functions in global.cpp are called when pdfium_test.exe runs.

const_expr would be a much cleaner way to implement this change but it
is not yet widely supported.

On the Windows release build this reduces the code size (.text
virtual size) by 0x240 (576) bytes, the .data section by 0x20 bytes
(for eight unsigned globals), and the .rdata section by 0x20 bytes
(the unneeded string savings, minus the eight unsigned globals now
being there).

BUG=441899
TBR=tsepez@chromium.org

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

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

4 years agoFix XFA specific use of m_sTimeMap. This fixes a build break.
Bruce Dawson [Mon, 5 Jan 2015 22:35:07 +0000]
Fix XFA specific use of m_sTimeMap. This fixes a build break.

R=bo_xu@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 831903002, m_sTimeMap fixes
Bruce Dawson [Mon, 5 Jan 2015 21:26:17 +0000]
XFA: merge patch from CL 831903002, m_sTimeMap fixes

Get rid of fifteen copies of m_sTimeMap and their initializers.

m_sTimeMap is a global variable with a constructor and destructor, which
is not allowed. This change moves it to a function with a static pointer
so that it is constructed on demand and then leaked, thus avoiding
having startup and shutdown code.

This also fixes a worrisome bug caused by having m_sTimeMap defined in
a header file. Because m_sTimeMap was defined (and marked as static) in
a header file there were fifteen separate copies of it, one for each
source file which included the header file. This could easily lead to
bugs because a timer that was added from one source file would be
invisible to other source files.

Each instance of m_sTimeMap added four entries to the
dump-static-initializers.py report, for a total of sixty, so this fix
significantly cleans up that report.

BUG=441899
TBR=tsepez@chromium.org

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

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

4 years agoXFA: merge patch from CL 828203002, clean up bookmark codes
Bo Xu [Mon, 5 Jan 2015 20:39:36 +0000]
XFA: merge patch from CL 828203002, clean up bookmark codes

Clean up bookmark related codes.

Remove CPDF_Dictionary*() operator in CPDF_Bookmark class.
Unify naming conventions and coding styles.
Change some functions to const.

Change the name of function argument to |pDict| for FPDF_xxx type variable.
This makes the code more clear and gives better variable naming

R=tsepez@chromium.org

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

Conflicts:
fpdfsdk/src/fpdfdoc.cpp

4 years agoXFA: merge patch from CL 729293003, use FX_ArraySize for safety
Bruce Dawson [Mon, 5 Jan 2015 19:53:18 +0000]
XFA: merge patch from CL 729293003, use FX_ArraySize for safety

Note that the merge of this fix to XFA found six bugs. Five
were fixed in https://codereview.chromium.org/826573003 and
one was fixed in https://codereview.chromium.org/831293002.
These bugs are now impossible to compile.

Replace manual/error-prone/hard-to-verify arraysize calculations with
safe FX_ArraySize macro.

pdfium has numerous places where the number of elements in an array is
calculated with expressions like:

    sizeof(cFormats)/sizeof(FX_LPCWSTR)

This is suboptimal because it is verbose, it is easy to get wrong, and
it cannot be determined through casual inspection whether the code is
correct. It will give incorrect results if cFormats is a pointer instead
of an array and it will give incorrect results if FX_LPCWSTR is not the
type of the array elements.

The FX_WSTRC macro in fx_string.h which I fixed was particularly scary
because it would silently misbehave if passed a pointer.

The FX_ArraySize macro which I have added and started using (taken from
arraysize in v8's macros.h) is easier to use and will always give correct
results. If passed a pointer it will fail to compile.

For this change I only fixed instances of sizeof(FX_LPCWSTR). There
appear to be about 150 other places in the pdfium code that could
benefit from using FX_ArraySize.

TBR=bo_xu@foxitsoftware.com, tsepez@chromium.org

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

4 years agoFix one remaining misuse of FX_WSTRC on FX_WCHAR* vars.
Bruce Dawson [Mon, 5 Jan 2015 19:45:45 +0000]
Fix one remaining misuse of FX_WSTRC on FX_WCHAR* vars.

FX_WSTRC is only valid on arrays, not pointers. In this code it was
being passed a pointer to a URL. This was found when integrating a
change to FX_WSTRC that disallows pointer arguments.

The consequence of this bug is that the URL will end up with incorrect
lengths. It will be one character long in 32-bit builds, and three
characters long in 64-bit builds (sizeof(WCHAR*)-1).

R=bo_xu@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 828183002, remove static declared SymbolDictCache
Bo Xu [Mon, 5 Jan 2015 18:48:34 +0000]
XFA: merge patch from CL 828183002, remove static declared SymbolDictCache

Remove static declared SymbolDictCache.

This is a follow up CL on https://codereview.chromium.org/761313004/

BUG=https://code.google.com/p/pdfium/issues/detail?id=93
R=brucedawson@chromium.org, tsepez@chromium.org

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

4 years agoXFA: revert bb1405d - Create pdfium_unittests binary.
Tom Sepez [Mon, 5 Jan 2015 18:42:56 +0000]
XFA: revert bb1405d -  Create pdfium_unittests binary.

Previous CL at https://codereview.chromium.org/830553002/ broke the standalone build.

TBR=brucedawson@chromium.org

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

4 years agoXFA: merge patch from CL 826633002, fix windows printing black rectangle issue
Bo Xu [Mon, 5 Jan 2015 18:11:47 +0000]
XFA: merge patch from CL 826633002, fix windows printing black rectangle issue

In windows printing, convert src bitmap to dest bitmap using CompositeBitmap.

When dealing with transparency, the printing procedure will generate a bitmap first,
then draw this bitmap in windows DC.
The format of source bitmap is argb, but the destination bitmap is rgb.
Simply doing memcpy will lose the alpha channel information, so CompositeBitmap function is needed.

BUG=412908
R=vitalybuka@chromium.org

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

4 years agoFixed incorrect use of FX_WSTRC on FX_WCHAR* vars.
Bruce Dawson [Mon, 5 Jan 2015 18:06:47 +0000]
Fixed incorrect use of FX_WSTRC on FX_WCHAR* vars.

FX_WSTRC is only valid on arrays, not pointers. In five places it was
being passed a pointer, which leads to incorrect string objects being
created. This was found when integrating a change to FX_WSTRC that
disallows pointer arguments.

The consequence of this bug is that five XML strings (quot, amp,
apos, lt, and gt) will all end up with incorrect lengths. They
will all be one character long in 32-bit builds, and three characters
long in 64-bit builds (sizeof(WCHAR*)-1).

Also removed some unneeded casts and marked some arrays as const.

Fixing this is necessary in order to allow landing of
https://codereview.chromium.org/818193004/

Testing this was attempted by using the xfa branch of pdfium in
Chrome:
cd  third_party\pdfium
git checkout xfa

However even without these changes this caused a CHECK failure in
V8::InitializePlatform due to double initialization, so the fix
has not been tested, but is clearly an improvement.

BUG= https://code.google.com/p/pdfium/issues/detail?id=96
R=bo_xu@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 788143009, remove g_NaN var and constructor
Bruce Dawson [Fri, 2 Jan 2015 20:05:17 +0000]
XFA: merge patch from CL 788143009, remove g_NaN var and constructor

Doing the type conversion on demand is just as efficient as doing it at
startup time, and makes for more efficient startup.

Also mark g_nan as const, to reduce .data section size and enforce
desired semantics.

BUG=441899
TBR=bo_xu@foxitsoftware.com

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

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

4 years agoUpdate MyriadPro fontmap.
Bo Xu [Wed, 31 Dec 2014 01:53:01 +0000]
Update MyriadPro fontmap.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 733693003, get rid of FX_LPCSTR cast
Bo Xu [Wed, 31 Dec 2014 00:56:12 +0000]
XFA: merge patch from CL 733693003, get rid of FX_LPCSTR cast

Get rid of FX_LPCSTR cast.

Follow up on https://codereview.chromium.org/733693003

R=brucedawson@chromium.org, tsepez@chromium.org

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

4 years agoMerge: Create pdfium_unittests binary. [XFA]
Tom Sepez [Mon, 29 Dec 2014 22:02:18 +0000]
Merge: Create pdfium_unittests binary. [XFA]

Original CL at https://codereview.chromium.org/831653002/

TBR=palmer@chromium.org, brucedawson@chromium.org

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

4 years agoFix compilation breakage at d70b545.
Tom Sepez [Mon, 29 Dec 2014 21:20:02 +0000]
Fix compilation breakage at d70b545.

TBR=bo_xu@foxitsoftware.com

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

4 years agoFix the big integer bug in PDF417.
Bo Xu [Mon, 29 Dec 2014 19:25:01 +0000]
Fix the big integer bug in PDF417.

Previously no big integer support in Pdfium and XFA.

The PDF417 barcode functionality could not work properly.

BUG=https://code.google.com/p/pdfium/issues/detail?id=98
R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 733693003, getting rid of more casts
Bruce Dawson [Tue, 23 Dec 2014 20:21:02 +0000]
XFA: merge patch from CL 733693003, getting rid of more casts

Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this.

Since casts to FX_LPCWSTR have been shown to hide bugs I tried removing
more of them, targeting those places where a cast was used to force a
conversion from CFX_WideString to FX_LPCWSTR, replacing these casts with
calls to the newly added .c_str() function. This revealed two places
where the cast was hiding a bug -- where ->c_str() was required instead!

This removes ~33 FX_LPCWSTR casts and there are ~31 left, many of which
will go away in some future change.

Also includes this change:

Removing unnecessary casts from wchar_t* to wchar_t*, by various names.

Original patch from Bruce Dawson(brucedawson@chromium.org)

TBR=bo_xu@foxitsoftware.com, tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 731673003, fix incorrect operator
Bruce Dawson [Tue, 23 Dec 2014 20:00:44 +0000]
XFA: merge patch from CL 731673003, fix incorrect operator

Fixing operator so that bCheckRight isn't always true. Unknown effect!

VC++'s /analyze points out that this expression:
    FX_BOOL bCheckRight = type != 'D' || type != 'W';"
is always true. This means that the tests for the right edge of a word

Original patch from Bruce Dawson(brucedawson@chromium.org)

BUG=427616
TBR=jun_fang@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 727083002, zero local variables.
Bruce Dawson [Tue, 23 Dec 2014 19:43:16 +0000]
XFA: merge patch from CL 727083002, zero local variables.

Zero initialize ch to avoid possible bug - conditions are very subtle.

Whether ch and iRet are read without being initialized depends on complex
preconditions and cannot be determined by looking at these function.
Therefore it seems prudent to zero initialize them to avoid any risk.

BUG=427616
TBR=bo_xu@foxitsoftware.com

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

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

4 years agoXFA: merge patch from CL 789163008 and 815333002
Lei Zhang [Sat, 20 Dec 2014 02:26:28 +0000]
XFA: merge patch from CL 789163008 and 815333002

Add the license back to ftmodule.h after the freetype 2.5.4 upgrade.

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

Set the freetype options missing in the recent update.

Turn on the FT_CONFIG_OPTION_SUBPIXEL_RENDERING to enable sub-pixel rendering.

Also undef some other options to match what they look like before.

BUG=444243
R=thestig@chromium.org

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

4 years agoXFA: merge patch from CL 816153002
Bo Xu [Fri, 19 Dec 2014 16:56:16 +0000]
XFA: merge patch from CL 816153002

Transform font size to user space for valid text size comparison.

BUG=438441
R=thestig@chromium.org

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

4 years agoAdjust xfa.gyp to match freetype update.
Bo Xu [Fri, 19 Dec 2014 23:42:10 +0000]
Adjust xfa.gyp to match freetype update.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 815103002
Bo Xu [Fri, 19 Dec 2014 22:29:17 +0000]
XFA: merge patch from CL 815103002

Update freetype to 2.5.4.

Put freetype into third_party directory, cleaning up header files.

Previously freetype header files are in core/src/fxge/freetype and core/include/thirdparties. There were also multiple fx_freetype.h.

This patch removes the additional Foxit wrapper to make further update easier.

Notice, for original freetype source code, the following files are modified and need to be updated accordingly in future update:

third_party/freetype/include/config/ftmodule.h
third_party/freetype/include/config/ftoption.h

BUG=407341
R=thestig@chromium.org

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

4 years agoXFA: merge patch from CL 817753002
Bo Xu [Fri, 19 Dec 2014 10:27:25 +0000]
XFA: merge patch from CL 817753002

Fix a few windows compile warnings

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 810223003
Lei Zhang [Thu, 18 Dec 2014 22:03:45 +0000]
XFA: merge patch from CL 810223003

Cleanup: Refactor some code into its own function in fpdf_text_int.cpp.

Also use stdlib algorithms in a few places.

R=tsepez@chromium.org

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

Conflicts:
core/src/fpdftext/fpdf_text_int.cpp

4 years agoXFA: merge patch from CL 816593002
Lei Zhang [Thu, 18 Dec 2014 04:10:00 +0000]
XFA: merge patch from CL 816593002

Cleanup: Remove a shadow variable in CPDF_TextPage::CloseTempLine().

R=bo_xu@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 761313004
Bo Xu [Thu, 18 Dec 2014 01:51:00 +0000]
XFA: merge patch from CL 761313004

Add a small LRU cache for the JBIG2 symbol dictionary.

This reduces rendering time on my test document by over
10 seconds. It is super common for a JBIG2 dictionary to
span multiple pages, so we don't want to decode the same
dictionary over and over again.

Original patch from Jeff Breidenbach (breidenbach@gmail.com)

BUG=https://code.google.com/p/pdfium/issues/detail?id=85
R=bo_xu@foxitsoftware.com, thestig@chromium.org

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

4 years agoXFA: merge patch from CL 790213005
Lei Zhang [Thu, 18 Dec 2014 00:54:04 +0000]
XFA: merge patch from CL 790213005

Cleanup: Pass by const reference in fpdftext.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 441988
Bruce Dawson [Sat, 13 Dec 2014 05:30:37 +0000]
XFA: merge patch from CL 441988

Avoid duplicate definitions of JSCONST_n*Hash and QeTable variables.

QeTable is a 752 byte array that was defined in a header file. This
caused it to be instantiated by the VC++ compiler 12 times, wasting
8,272 bytes of space in the data segment. Because 'const' implies
'static' this did not cause any duplicate symbol errors.

JSCONST_n*HASH are a set of eight variables that are defined in a header
file. This causes them to be replicated 15 times. The variables
themselves are tiny but they are dynamically initialized and this
dynamic initialization code is replicated 15 times.

When tested on pdfium_test.exe the effect of this change is to:
Reduce the .text (code) segment by 3,616 bytes.
Reduce the .rdata section by 8,656 bytes.
Reduce the total binary file size by 13312 bytes.

These are the worst offenders for pdf.dll as shown in:
https://drive.google.com/open?id=1BvubxoA2SU_2e4T5cq7jHTjc1TlT0qOndpIfX3DMeA8&authuser=0

This will also drastically simplify the list of work to be done
for bug 441899 (getting rid of initializers).

BUG=441988
R=bo_xu@foxitsoftware.com

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

4 years agoRemove spurious XFA unsupported warning on XFA branch
Tom Sepez [Thu, 18 Dec 2014 23:13:46 +0000]
Remove spurious XFA unsupported warning on XFA branch

R=bo_xu@foxitsoftware.com

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

4 years agoFix obvious compilation breakage on win32 in previous version.
Tom Sepez [Thu, 18 Dec 2014 19:14:19 +0000]
Fix obvious compilation breakage on win32 in previous version.

TBR=thestig@chromium.org

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

4 years agoInitialize V8 external data (XFA version).
Tom Sepez [Thu, 18 Dec 2014 00:24:01 +0000]
Initialize V8 external data (XFA version).

This is a quick patch to fix the segv which occurs in pdfium_test when
the v8 external data is not provided.  Fixing the full-up initialization
is left as a follow-on exercise.

Path manipulations remain a nuisance since we don't want to depend on a
particular /base library.

BUG=439793
R=thestig@chromium.org

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

4 years agoXFA: merge patch from issue 803103002
JUN FANG [Wed, 17 Dec 2014 21:58:56 +0000]
XFA: merge patch from issue 803103002

Before this fix, the root will be released when an indirect object has the
same object number with the root. However, the root object is loaded when
the trailer is parsed. It shall not be updated or replaced anymore.

BUG=425040
R=tsepez@chromium.org

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

4 years agoRemove more defines in XFA branch that aren't used for PDFium.
John Abd-El-Malek [Mon, 15 Dec 2014 21:35:58 +0000]
Remove more defines in XFA branch that aren't used for PDFium.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from issue 801913002 and 804463003
John Abd-El-Malek [Mon, 15 Dec 2014 20:13:45 +0000]
XFA: merge patch from issue 801913002 and 804463003

Simplify PDFium by removing code that's not used in the open source repo.

-remove parameter from FPDF_InitLibrary
-remove a bunch of ifdefs that are unused

Fix build after previous commit.

TBR=tsepez@chromium.org
BUG=

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

4 years agoMerge to XFA: patch from CL 792113003
Bo Xu [Thu, 11 Dec 2014 22:24:35 +0000]
Merge to XFA: patch from CL 792113003

m_pColorSpace can not be NULL for image object with DCTDecode filter

BUG=411842
R=tsepez@chromium.org

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

4 years agoMerge to XFA: patch from CL 790363002
Bo Xu [Thu, 11 Dec 2014 00:45:46 +0000]
Merge to XFA: patch from CL 790363002

Do not do strict check of BitsPerComponent for RunLengthDecode filter

BUG=438421
R=tsepez@chromium.org

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

4 years agoMerge to XFA: patch from CL 791223002
Bo Xu [Thu, 11 Dec 2014 00:00:29 +0000]
Merge to XFA: patch from CL 791223002

Lab colorspace needs to be 3 component

BUG=429134
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 787753002
Bo Xu [Tue, 9 Dec 2014 18:13:59 +0000]
Merge to XFA: patch from CL 787753002

Trailer should be a dictionary object

BUG=https://code.google.com/p/pdfium/issues/detail?id=86

a "<<" token should follow "trailer" but "<" will trick the parser to make trailer a hex string object.

R=tsepez@chromium.org

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

5 years agoMake app.alert() actually print its message under pdfium_test.
Tom Sepez [Mon, 8 Dec 2014 17:55:11 +0000]
Make app.alert() actually print its message under pdfium_test.

This is needed as an aid to testing.

R=thestig@chromium.org

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

5 years agocheck NULL of pTemplateRoot in DoDataMerge
Bo Xu [Sat, 6 Dec 2014 01:20:03 +0000]
check NULL of pTemplateRoot in DoDataMerge

BUG= https://code.google.com/p/pdfium/issues/detail?id=89
R=tsepez@chromium.org

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

5 years agoLog message when XFA load fails
Tom Sepez [Fri, 5 Dec 2014 21:30:51 +0000]
Log message when XFA load fails

A minor change to make it obvious when generated/test XFA files are not
being fully processed.

R=bo_xu@foxitsoftware.com

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

5 years agoRemove needless casts of (narrow) string literals.
Tom Sepez [Thu, 4 Dec 2014 18:10:34 +0000]
Remove needless casts of (narrow) string literals.

Follow-up to work on (wide) string literals.

R=bo_xu@foxitsoftware.com

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

5 years agoReplace void* pointers with CFX_BaseMassArrayImp* pointers.
Tom Sepez [Thu, 4 Dec 2014 17:54:14 +0000]
Replace void* pointers with CFX_BaseMassArrayImp* pointers.

Using an incomplete type here avoids casting later on, and allows the
debugger to more easily dig through these data structures.

R=bo_xu@foxitsoftware.com

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

5 years agoMerge "Add big integer library""
Bo Xu [Tue, 2 Dec 2014 21:06:22 +0000]
Merge "Add big integer library""

This patch merges the 3 commits in master branch into one

5 years agoMass remove dangerous and needless LPCWSTR casts.
Tom Sepez [Mon, 24 Nov 2014 23:55:20 +0000]
Mass remove dangerous and needless LPCWSTR casts.

One table is also reformatted to put one entry per line for readability.

R=bo_xu@foxitsoftware.com

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

5 years agoMerge to XFA: patch from CL 758593002
Bo Xu [Mon, 24 Nov 2014 21:58:10 +0000]
Merge to XFA: patch from CL 758593002

Update to openjpeg r2944

BUG=429139,430566,431288
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 743263002
Jun Fang [Thu, 20 Nov 2014 02:58:01 +0000]
Merge to XFA: patch from CL 743263002

Fix blank page issues caused by too strict check

Before this fix, PDF parser aborts the parsering process when detecting an error.
For this case, PDF parser just gives up parsering when it detects that the length of
image stream is incorrect. The solution to this case is to find the tag "endstream"
and "endobj" to calculate the length rather than aborting the parsering process.

BUG=433339
R=tsepez@chromium.org

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

5 years agoAdd XFA test files
Bo Xu [Wed, 19 Nov 2014 00:57:44 +0000]
Add XFA test files

R=tsepez@chromium.org

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

5 years agoUpdate form fill version to 2 for pdfium_test.cc on XFA branch (only).
Tom Sepez [Tue, 18 Nov 2014 22:10:25 +0000]
Update form fill version to 2 for pdfium_test.cc on XFA branch (only).

BUG=https://code.google.com/p/pdfium/issues/detail?id=82
R=bo_xu@foxitsoftware.com

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

5 years agoMerge to XFA: patch from CL 738433003
Bruce Dawson [Tue, 18 Nov 2014 21:42:28 +0000]
Merge to XFA: patch from CL 738433003

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

R=tsepez@chromium.org
TBR=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 730993002
Bo Xu [Mon, 17 Nov 2014 18:46:25 +0000]
Merge to XFA: patch from CL 730993002

5 years agoMerge to XFA: patch from CL 700373006 and 727243002
Bo Xu [Sat, 15 Nov 2014 01:40:50 +0000]
Merge to XFA: patch from CL 700373006 and 727243002

5 years agoMerge to XFA: Patch from CL 726143002
Bo Xu [Sat, 15 Nov 2014 01:03:50 +0000]
Merge to XFA: Patch from CL 726143002

BUG=https://code.google.com/p/pdfium/issues/detail?id=78
R=tsepez@chromium.org

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

5 years agoCheck NULL pointer dereferencing from GetDirect
Bo Xu [Sat, 15 Nov 2014 01:22:13 +0000]
Check NULL pointer dereferencing from GetDirect

BUG=431770
R=tsepez@chromium.org

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

5 years agoMerge to XFA: Patch from CL 705503004
Bo Xu [Fri, 14 Nov 2014 22:18:05 +0000]
Merge to XFA: Patch from CL 705503004

Change from 'this' to L'this' and remove the cast that was hiding this mismatch.

Found by VC++'s /analyze. Warning was:

fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276:
Cast between semantically different string types:  char * to wchar_t *.
Use of invalid string can lead to undefined behavior.

This mismatch has been there as far back as the history goes (to May of this year).

It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time.

The code has been this way as far back as the git history goes, but that is only to May 2014.

Original patch from Bruce Dawson(brucedawson@chromium.org)

BUG=427616
R=bo_xu@foxitsoftware.com

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

5 years agoAdd XFA files to GN build.
Tom Sepez [Fri, 14 Nov 2014 21:39:20 +0000]
Add XFA files to GN build.

This mirrors the changes made to .gyp files on the XFA branch. Chrome is
still building against the master branch, so the only meaningful way
to test this is locally.

R=dpranke@chromium.org

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

5 years agoXFA: merge patch from issue 726033002
Tom Sepez [Fri, 14 Nov 2014 19:56:27 +0000]
XFA: merge patch from issue 726033002

Fixes android build error under stricter compilation modes.

TBR=bo_xu@foxitsoftware.com

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

5 years agoMerge patch from issue 720193004 to XFA.
Tom Sepez [Fri, 14 Nov 2014 01:04:15 +0000]
Merge patch from issue 720193004 to XFA.

Adds GN build capability for pdfium_test.
TBR=dpranke@chromium.org

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

5 years agoMerge to XFA: patch from CL 618073003
Bo Xu [Mon, 10 Nov 2014 21:34:05 +0000]
Merge to XFA: patch from CL 618073003

BUG=401988
R=vitalybuka@chromium.org

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

5 years agoCorrect the forminfo version check in pdfium
Bo Xu [Sat, 8 Nov 2014 01:09:07 +0000]
Correct the forminfo version check in pdfium

5 years agoChange version of FPDF_FORMFILLINFO to 2; Add #define PDF_USE_XFA
Bo Xu [Fri, 7 Nov 2014 00:13:33 +0000]
Change version of FPDF_FORMFILLINFO to 2; Add #define PDF_USE_XFA

5 years agoMerge to XFA: patch from CL 703213004
Tom Sepez [Thu, 6 Nov 2014 23:03:46 +0000]
Merge to XFA: patch from CL 703213004

Fix bug with reading from uninitialized variable found by VC++'s /analyze.

The flag variable is conditionally initialized but unconditionally read.

Warning was:
src\fpdfapi\fpdf_page\fpdf_page_pattern.cpp(274) : warning C6001:
Using uninitialized memory 'flag'.

BUG=427616
R=tsepez@chromium.org

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

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

5 years agoMerge to XFA: patch from issue 692533005
Tom Sepez [Thu, 6 Nov 2014 22:45:35 +0000]
Merge to XFA: patch from issue 692533005

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

5 years agoRemove xfa_test for delivery
Bo Xu [Tue, 4 Nov 2014 02:38:41 +0000]
Remove xfa_test for delivery

5 years agomodify google bug 61311 for messageBox;
linlin_miao [Fri, 31 Oct 2014 02:10:33 +0000]
modify google bug 61311 for messageBox;
61750 for dateField input "aaa" not dislpay;
update font map;

5 years agoUpdate CloseDocument and ExitForm
xiaoxia_yu [Thu, 30 Oct 2014 02:36:45 +0000]
Update CloseDocument and ExitForm

5 years agoDo not Initialize v8 in fpdfsdk, since this has been done in xfa
Bo Xu [Wed, 29 Oct 2014 23:12:02 +0000]
Do not Initialize v8 in fpdfsdk, since this has been done in xfa

5 years agoLock page in LoadFXAnnot to prevent unintended page closing
unknown [Wed, 29 Oct 2014 11:37:24 +0000]
Lock page in LoadFXAnnot to prevent unintended page closing

5 years agoRemove unused variable in pdfium_engine.cc
Bo Xu [Wed, 29 Oct 2014 06:24:51 +0000]
Remove unused variable in pdfium_engine.cc

5 years agoMerge XFA to PDFium master at 4dc95e7 on 10/28/2014
Bo Xu [Wed, 29 Oct 2014 06:03:33 +0000]
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014

5 years agoUndo an old change in freetype to account for size of USHORT
Bo Xu [Thu, 30 Oct 2014 23:02:56 +0000]
Undo an old change in freetype to account for size of USHORT

BUG=418582
R=tsepez@chromium.org

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

5 years agoFor v8 Global Object, do not copy in CJS_Value constructor.
Tom Sepez [Thu, 30 Oct 2014 20:23:42 +0000]
For v8 Global Object, do not copy in CJS_Value constructor.

BUG=425129
R=bo_xu@foxitsoftware.com

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

5 years agoUpdate openjpeg to r2920
Bo Xu [Thu, 30 Oct 2014 20:10:50 +0000]
Update openjpeg to r2920

BUG=414036, 425151
R=tsepez@chromium.org

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

5 years agoResolve compilation error with G++ 4.9.
Tom Sepez [Wed, 29 Oct 2014 22:31:20 +0000]
Resolve compilation error with G++ 4.9.

Add a check for zero-length keys to avoid hitting the equivalent of |""[1]|.
BUG=https://code.google.com/p/pdfium/issues/detail?id=58
R=jun_fang@foxitsoftware.com

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