pdfium.git
4 years agoSupress the two noisiest warnings on linux standalone builds.
Tom Sepez [Thu, 16 Apr 2015 20:58:51 +0000]
Supress the two noisiest warnings on linux standalone builds.

Code might someday be made clean for -Wmissing-field-initializers
and -Wsign-compare, but for now this produces too much noise to be
useful.

The -Wmissing-field-initializers warning is misguided in a high
percentage of cases, and actually leads to bad fixes.

R=brucedawson@chromium.org

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

4 years agoFix pdfium standalone to compile with VS 2015.
Bruce Dawson [Thu, 16 Apr 2015 20:45:33 +0000]
Fix pdfium standalone to compile with VS 2015.

This change disables several warnings that fire frequently
in pdfium and are not practical to fix at this time.

R=tsepez@chromium.org
BUG=440500

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

4 years agoRemove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0
Tom Sepez [Thu, 16 Apr 2015 16:13:02 +0000]
Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0

R=thestig@chromium.org

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

4 years agoRemove checks in fxge/ge now that FX_NEW can't return 0.
Tom Sepez [Thu, 16 Apr 2015 15:31:30 +0000]
Remove checks in fxge/ge now that FX_NEW can't return 0.

R=thestig@chromium.org

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

4 years agoRemove checks in fxcrt now that FX_NEW can't return 0.
Tom Sepez [Wed, 15 Apr 2015 21:17:33 +0000]
Remove checks in fxcrt now that FX_NEW can't return 0.

Replace them with |new| so that we can tell by the presence of FX_NEW
the places that still need to be audited.

R=thestig@google.com, thestig@chromium.org

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

4 years agoFix offset outside bounds of constant string warnings
JUN FANG [Wed, 15 Apr 2015 19:00:53 +0000]
Fix offset outside bounds of constant string warnings

BUG=380476
R=tsepez@chromium.org

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

4 years agoDon't use NEON optimized code in lpng_v163
Sam Clegg [Wed, 15 Apr 2015 17:53:07 +0000]
Don't use NEON optimized code in lpng_v163

The source files required to use the NEON function are not
included so we should not try to reference those symbols.

BUG=477162
TEST=ninja -C out_arm/Release/ pdfium_diff
R=tsepez@chromium.org

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

4 years agoMake FX_NEW throw on OOM.
Tom Sepez [Wed, 15 Apr 2015 17:11:12 +0000]
Make FX_NEW throw on OOM.

Restores default behavior of new.

R=thestig@chromium.org

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

4 years agoLand on Master: Fix two new / free mismatches
Tom Sepez [Tue, 14 Apr 2015 23:00:03 +0000]
Land on Master: Fix two new / free mismatches

Note: Landed on XFA first by mistake.

Original review: https://codereview.chromium.org/1085963002/
TBR=brucedawson@chromium.org

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

4 years agoKill CFX_Object.
Tom Sepez [Tue, 14 Apr 2015 19:54:38 +0000]
Kill CFX_Object.

CFX_Object is a type that implements its own new operators that return
NULL on error. There's no need for this given the |new (std::nothrow)|
syntax; in fact, the current code can only work if there is no activity
in the constructors.  This may explain the pervasive lack of
constructors and reliance on Init() methods throughout the codebase.

The activity takes place in fx_memory.h, where FX_NEW is mapped onto
the std::nothrow syntax.  The rest is just cleanup.

Down the road, we will simply throw and remove all the error-checking
paths for new objects. Landing this patch first will at least show a
simple path back to the old behaviour without having to re-introduce
CFX_Object should someone want to do so in their own fork.

R=thestig@chromium.org

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

4 years agoFix a heap overflow in CJBig2_Context::parseSymbolDict
JUN FANG [Mon, 13 Apr 2015 17:34:10 +0000]
Fix a heap overflow in CJBig2_Context::parseSymbolDict

BUG=476107
R=tsepez@chromium.org

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

4 years agoFix compiling warnings on Windows
Jun Fang [Sat, 11 Apr 2015 18:34:43 +0000]
Fix compiling warnings on Windows

TBR=tsepez@chromium.org

BUG=N/A

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

4 years agoFix a heap buffer overflow issue in CPDF_CMap::GetNextChar
JUN FANG [Sat, 11 Apr 2015 16:33:23 +0000]
Fix a heap buffer overflow issue in CPDF_CMap::GetNextChar

Add a check to make sure offset is less than the size of string in the function of GetNextChar().

BUG=471651
R=tsepez@chromium.org

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

4 years agoFix the noisiest variable shadowing warnings in pdfium.
Bruce Dawson [Fri, 10 Apr 2015 21:49:35 +0000]
Fix the noisiest variable shadowing warnings in pdfium.

Three functions in fx_coordinates.h account for 60% of the warnings
when building with VS 2015, due to variable shadowing. Renaming the
function parameters is safe, resolves the warnings, and reduces
confusion.

R=tsepez@chromium.org
BUG=440500

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

4 years agoBetter fix for snprintf non-termination on windows.
Tom Sepez [Fri, 10 Apr 2015 21:43:15 +0000]
Better fix for snprintf non-termination on windows.

Replaces https://codereview.chromium.org/1062983002/
BUG=469244
R=brucedawson@chromium.org

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

4 years agoFix a stack overflow in CPDF_Parser::LoadCrossRefV5
JUN FANG [Fri, 10 Apr 2015 20:45:43 +0000]
Fix a stack overflow in CPDF_Parser::LoadCrossRefV5

A stack overflow was triggered by checked_cast due to
invalid index in pdf files like 'Index[45 -1661]'.

BUG=473400
R=tsepez@chromium.org

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

4 years agoDon't call FPDF_InitLibrary() in individual unit_tests.
Tom Sepez [Fri, 10 Apr 2015 17:29:21 +0000]
Don't call FPDF_InitLibrary() in individual unit_tests.

The initialization sequence becomes more complicated as v8 evolves
and when we move to XFA (where pdfium_unittests are currently broken).
Centralize this initialization in a few places, like the embedder_test
framework and the pdfium_test binary, and convert tests that require
it into embedder_tests rather than unit_tests.

Change on master first before moving to XFA.

R=thestig@chromium.org

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

4 years agoUpdate DEPS to pull V8 from the new repository.
Tom Sepez [Thu, 9 Apr 2015 21:05:37 +0000]
Update DEPS to pull V8 from the new repository.

Also update build files to deal with the new revision.  The main issue
is the external startup files for v8.  The default is not to use them
(simpler for standalone users to deploy), but can be built either way.

R=thestig@chromium.org

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

4 years agoInclude windows.h instead of the MFC header afxres.h
Bruce Dawson [Thu, 9 Apr 2015 20:44:54 +0000]
Include windows.h instead of the MFC header afxres.h

VS 2015 RC ships without afxres.h, so fpdfsdkdll.rc fails to
compile. afxres.h is really intended for MFC apps so depending on
it is a bad idea anyway, so I changed both references to
windows.h. See http://stackoverflow.com/questions/1575559 for
some other perspective on this.

R=tsepez@chromium.org
BUG=440500

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

4 years agoConsider platform-specific expected .png files.
Tom Sepez [Thu, 9 Apr 2015 19:35:01 +0000]
Consider platform-specific expected .png files.

Rolls DEPS to pull in the first windows-specific .png files, and
unsupresses the corresponding tests.

R=thestig@chromium.org

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

4 years agoFix a global buffer overflow in GCPDF_CIDFont::_CharCodeFromUnicode
Jun Fang [Thu, 9 Apr 2015 16:59:41 +0000]
Fix a global buffer overflow in GCPDF_CIDFont::_CharCodeFromUnicode

There is not a code page (CP) used for converting unicode to mutli-bytes
if the coding scheme is CID coding. Only return 0 if CID can't be retrieved.
The difference on Windows and other platforms should be the function used
for converting rather than others.

BUG=466790
R=tsepez@chromium.org

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

4 years agoFix reference to timezone variable - removed in VS 2015
Bruce Dawson [Thu, 9 Apr 2015 16:36:34 +0000]
Fix reference to timezone variable - removed in VS 2015

It turns out that 'timezone' has been deprecated for a while. If
deprecation messages are enabled then VS 2013 says this when 'timezone'
is referenced:

warning C4996: 'timezone': This function or variable may be unsafe.
Consider using _get_timezone instead.

Sometimes features stay deprecated for decades, but in this case
'timezone' is now gone.

R=tsepez@chromium.org
BUG=440500

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

4 years agoFix IWYU in formfiller/ directory.
Tom Sepez [Wed, 8 Apr 2015 23:08:00 +0000]
Fix IWYU in formfiller/ directory.

R=thestig@chromium.org

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

4 years agoUse pdfium-specific tree closer for gating landings
Tom Sepez [Wed, 8 Apr 2015 16:01:00 +0000]
Use pdfium-specific tree closer for gating landings

R=jam@chromium.org

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

4 years agoFix a stack overflow issue caused by an invalid usage of snprintf
Jun Fang [Tue, 7 Apr 2015 23:59:05 +0000]
Fix a stack overflow issue caused by an invalid usage of snprintf

BUG=469244
R=tsepez@chromium.org

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

4 years agoLand on master: FFL_MIN and FFL_MAX are pointless and stupid.
Tom Sepez [Tue, 7 Apr 2015 23:58:02 +0000]
Land on master: FFL_MIN and FFL_MAX are pointless and stupid.

Original CL was accidentally based off of XFA.  This CL is
off of master.

TBR=thestig@chromium.org

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

4 years agoFix windows compile class vs. struct confusion in e300c8c32d73
Tom Sepez [Tue, 7 Apr 2015 23:05:12 +0000]
Fix windows compile class vs. struct confusion in e300c8c32d73

TBR=thestig@chromium.org

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

4 years agoFix IWYU in pdfwindow/ directory.
Tom Sepez [Tue, 7 Apr 2015 22:53:50 +0000]
Fix IWYU in pdfwindow/ directory.

This also fixes some IWYU in dependent files.
BUG=https://code.google.com/p/pdfium/issues/detail?id=66
R=thestig@chromium.org

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

4 years agoFix (nearly all) IWYU in fpdfskd/include/javascript/ headers.
Tom Sepez [Tue, 7 Apr 2015 22:26:59 +0000]
Fix (nearly all) IWYU in fpdfskd/include/javascript/ headers.

Move some typedefs for v8 types into fxjs_v8.h wrapper to
avoid circular inclusions. Also delete JS_Module.h, as no
other file includes it.

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

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

4 years agofix missing semicolons
JUN FANG [Mon, 6 Apr 2015 20:10:59 +0000]
fix missing semicolons

TBR=tsepez@chromium.org

BUG=N/A

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

4 years agoFix a fatal error due to cloning a global document object
JUN FANG [Mon, 6 Apr 2015 19:39:51 +0000]
Fix a fatal error due to cloning a global document object

BUG=454595
R=tsepez@chromium.org

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

4 years agoFix IWYU in fxcrt headers.
Tom Sepez [Mon, 6 Apr 2015 19:28:23 +0000]
Fix IWYU in fxcrt headers.

Confirmed manually that:
  g++ --std=c++0x -o /dev/null -I. ... -c fx_xxxxx.h
is now error-free for the files in this directory. Also kill
some ifndef's around inclusion since we know this doesn't
provide benefit with modern compilers.

R=thestig@chromium.org

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

4 years agoUpdate the path of header file to avoid a compiling error in chrome
JUN FANG [Fri, 3 Apr 2015 21:39:18 +0000]
Update the path of header file to avoid a compiling error in chrome

BUG=N/A
R=tsepez@chromium.org

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

4 years agoRefactor PDFium python test utilities.
Tom Sepez [Fri, 3 Apr 2015 20:21:53 +0000]
Refactor PDFium python test utilities.

Extract a common portions for determining suppressions and comparing pngs.

R=thestig@chromium.org

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

4 years agoNo-op change to poke the bots after being out of sequence.
Tom Sepez [Fri, 3 Apr 2015 19:59:41 +0000]
No-op change to poke the bots after being out of sequence.

Adds a comment and changes some whitespace.
TBR=jun_fang@foxitsoftware.com

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

4 years agoFix a compiling error in fpdf_parser_parser_embeddertest.cpp
Jun Fang [Fri, 3 Apr 2015 11:31:02 +0000]
Fix a compiling error in fpdf_parser_parser_embeddertest.cpp

BUG=N/A
R=tsepez@chromium.org

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

4 years agoAdd embedder test comparing with the last patch.
JUN FANG [Fri, 3 Apr 2015 18:35:50 +0000]
Add embedder test comparing with the last patch.

When there is a wrong keyword like '??ze' in the dictionary
of the trailer, PDFium can't recognize it and aborts further
parsing. After this change, PDFium continues even it can't
get the right size at this moment. It will rebuild the cross
reference table later since the size of the table is missing.

BUG=459580
R=tsepez@chromium.org

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

4 years agoFix uninitialized face in fx_ge_font.cpp
JUN FANG [Thu, 2 Apr 2015 17:05:06 +0000]
Fix uninitialized face in fx_ge_font.cpp

MSAN reported this issue when I tried to reproduce 460936 in the last version of freetype on Linux.

BUG=N/A
R=thestig@chromium.org

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

4 years agoUpdate windows suppressions and unify across platforms
Tom Sepez [Wed, 1 Apr 2015 18:42:34 +0000]
Update windows suppressions and unify across platforms

R=thestig@chromium.org

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

4 years agodoc.external - Check direction of property access before blindly getting.
Tom Sepez [Wed, 1 Apr 2015 16:49:59 +0000]
doc.external - Check direction of property access before blindly getting.

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

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

4 years agoRoll DEPS to pick up new test expectations after commit e3dd159.
Lei Zhang [Tue, 31 Mar 2015 23:29:49 +0000]
Roll DEPS to pick up new test expectations after commit e3dd159.

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

4 years agoFix no text displayed issue when font embedded and font subsetting enabled
JUN FANG [Mon, 30 Mar 2015 23:24:09 +0000]
Fix no text displayed issue when font embedded and font subsetting enabled

BUG=465322
R=thestig@chromium.org

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

4 years agoReplace linux-specific code in test scripts.
Tom Sepez [Thu, 26 Mar 2015 23:29:05 +0000]
Replace linux-specific code in test scripts.

Now that there's a win bot, this needs to be more careful.

R=thestig@chromium.org

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

4 years agoUse correctly-typed error codes for fx_codec_jpx_unittest
Tom Sepez [Thu, 26 Mar 2015 16:36:42 +0000]
Use correctly-typed error codes for fx_codec_jpx_unittest

Needed to fix the failed pdfium_unittests on windows.  Ironically,
I created these constants so I wouldn't mix up size_t's and off_t's
in these tests, but I didn't apply them consistently.

R=thestig@chromium.org

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

4 years agoSuppress many failing mac tests.
Tom Sepez [Wed, 25 Mar 2015 21:49:15 +0000]
Suppress many failing mac tests.

There's investigation required to see why there are such
platform differences, but for now, a perpetually red bot
isn't useful.

TBR=thestig@chromium.org

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

4 years agoSuppress our "pixel" test on mac since it diffs.
Tom Sepez [Wed, 25 Mar 2015 21:30:49 +0000]
Suppress our "pixel" test on mac since it diffs.

This involves bringing some of the suppressions file
mechanism into run_pixel_tests.py (making a common
module would be a nice follow-up)

R=thestig@chromium.org

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

4 years agoCreate per-platform pdfium test suppression files.
Tom Sepez [Wed, 25 Mar 2015 20:56:20 +0000]
Create per-platform pdfium test suppression files.

This is required now that we have win/mac bots, which may produce
different outputs.

R=thestig@chromium.org

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

4 years agoAdd testing/corpus to .gitignore
Tom Sepez [Wed, 25 Mar 2015 17:47:49 +0000]
Add testing/corpus to .gitignore

TBR=halyavin@chromium.org

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

4 years agoAdd comments to suppressions file
Tom Sepez [Tue, 24 Mar 2015 19:44:55 +0000]
Add comments to suppressions file

No-op CL intended to trigger a rebuild.

TBR=thestig@chromium.org

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

4 years agoSupport comments and blank lines in SUPPRESSIONS file
Tom Sepez [Mon, 23 Mar 2015 21:24:13 +0000]
Support comments and blank lines in SUPPRESSIONS file

The comment character is #.

R=thestig@chromium.org

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

4 years agoCreate simple suppressions file in PDFium repository.
Tom Sepez [Mon, 23 Mar 2015 19:27:20 +0000]
Create simple suppressions file in PDFium repository.

This is needed to green the tree without continually reverting the
pdfium_tests (corpus) repository.

We will need to make this more sophisticated at some point, but for
now, let's try to green the buildbot.

R=thestig@chromium.org

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

4 years agoFlush stdout before launching sub-processes.
Tom Sepez [Mon, 23 Mar 2015 18:31:24 +0000]
Flush stdout before launching sub-processes.

This should make the test logs more readable.

Also give failure summary at end of tests, since searching
through the log is tedious.

R=thestig@chromium.org

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

4 years agoTry to make a NOTREACHED definition suitable for win8.
Tom Sepez [Mon, 23 Mar 2015 16:34:00 +0000]
Try to make a NOTREACHED definition suitable for win8.

See http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_gn_rel/builds/5674

Testing this is a two-step process: land CL to pdfium, then try DEPS roll
in chromium against this version on the win8 trybots.

TBR=thestig@chromium.org

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

4 years agoRoll DEPS to pull in full, regenerated corpus of tests
Tom Sepez [Sat, 21 Mar 2015 00:15:33 +0000]
Roll DEPS to pull in full, regenerated corpus of tests

R=thestig@chromium.org

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

4 years agoTurn down warning level for GN build of image_diff utility
Tom Sepez [Sat, 21 Mar 2015 00:09:28 +0000]
Turn down warning level for GN build of image_diff utility

Next attempt to get GN build to work.  Once this lands, doing a DEPS
roll against the win8_chromium_gn_dbg trybot seems to catch the issue.

Restore image_diff_png.cc to its previous state.

R=thestig@chromium.org

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

4 years agoFix missing include for std::min
Tom Sepez [Fri, 20 Mar 2015 17:53:02 +0000]
Fix missing include for std::min

Build broken on trybot at
http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/66012/steps/compile%20%28with%20patch%29/logs/stdio

R=thestig@chromium.org
TBR=thestig@chromium.org

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

4 years agoRevert corpus to last known working version.
Tom Sepez [Fri, 20 Mar 2015 00:35:02 +0000]
Revert corpus to last known working version.

Failures from last roll need diagnosis.
TBR=thestig@chromium.org

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

4 years agoFix corpus roll broken in the previous commit.
Tom Sepez [Fri, 20 Mar 2015 00:23:56 +0000]
Fix corpus roll broken in the previous commit.

R=thestig@chromium.org
TBR=thestig@chromium.org

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

4 years agoBring in entire corpus for testing.
Tom Sepez [Fri, 20 Mar 2015 00:12:18 +0000]
Bring in entire corpus for testing.

TBR=thestig@chromium.org

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

4 years agoPull in specific revision of PDF corpus via DEPS.
Tom Sepez [Thu, 19 Mar 2015 21:35:22 +0000]
Pull in specific revision of PDF corpus via DEPS.

There are two reasons for doing this. The first is that adding files
to this repository doesn't trigger a rebuild on the bot, so the next
unrelated pdfium change will be the one to hit any issues with the
unversioned corpus.

The second is that we may need a specific version of the expected output
files (.pngs) to go with a specific pdfium build.

R=thestig@chromium.org

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

4 years agoFix subtle issues in opj_skip_from_memory and add unit tests.
Tom Sepez [Thu, 19 Mar 2015 19:51:04 +0000]
Fix subtle issues in opj_skip_from_memory and add unit tests.

Follow on to https://codereview.chromium.org/990683002/.
This more closely mimics what fseek() actually does, so as
to avoid subtle bugs down the road.

Move the DecodeData struct into a header so the test can
use it, and provide a constructor for it.

Along the way, I added include guards, removed the p_
prefix from some non-pointer vars, fixed some IWYU, and
resolved some signed/unsigned comparison warnings with
careful casting.

BUG=452671
R=jun_fang@foxitsoftware.com, thestig@chromium.org

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

4 years agoRevert "TEST that the tree goes RED when pixel/javascript tests fail."
Tom Sepez [Tue, 17 Mar 2015 20:40:43 +0000]
Revert "TEST that the tree goes RED when pixel/javascript tests fail."
This reverts commit de00893874a9d5ecae497e00511e2395fc2f02e8.

TBR=thestig@chromium.org

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

4 years agoTEST that the tree goes RED when pixel/javascript tests fail.
Tom Sepez [Tue, 17 Mar 2015 20:35:50 +0000]
TEST that the tree goes RED when pixel/javascript tests fail.

This will be immediately reverted, but I need to be sure that the
previous change actually detects failures.

TBR=thestig@chromium.org

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

4 years agoReturn OS status code from python test driver scripts.
Tom Sepez [Tue, 17 Mar 2015 20:25:09 +0000]
Return OS status code from python test driver scripts.

Consequently, some of the tests may diff but the waterfall remains green.

R=thestig@chromium.org

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

4 years agoRevert "Fix a problem that JP2 image is not displayed because index color space is...
Tom Sepez [Tue, 17 Mar 2015 18:48:22 +0000]
Revert "Fix a problem that JP2 image is not displayed because index color space is used"

This reverts commit 5a0e504d53195892458d819e52c62bea0c710bd5.

Original review URL https://codereview.chromium.org/1009513003

Reason for revert: New "corpus" tests show that this is no longer rendering some images.  See, e.g. http://chromegw/i/client.pdfium/builders/linux/builds/144/steps/corpus%20tests/logs/stdio for those that diff'd.

TBR=jun_fang@foxitsoftware.com

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

4 years agoPull our new test case repository via deps.
Tom Sepez [Mon, 16 Mar 2015 22:21:52 +0000]
Pull our new test case repository via deps.

Add a run_corpus_tests.py script to run pdfium_test against
the corpus tree.

Note that this differs from the run_pixel_tests.py script,
since pre-processing is not required.  I'll work on unifying
these in a subsequent CL.

R=thestig@chromium.org

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

4 years agoSpeculative fix for breakage in pdfum DEPS roll
Tom Sepez [Mon, 16 Mar 2015 21:51:35 +0000]
Speculative fix for breakage in pdfum DEPS roll

Speculative because we still don't have pdfium buildbots for mac/win
on the pdfium waterfall.  Nonetheless, the two build errors reported
in https://codereview.chromium.org/989213003/ seem to be a default
statement in a switch fully covering all of an enum constant, and
the use of <cstdint> instead of <stdint.h> on mac.

R=thestig@chromium.org

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

4 years agoFix a problem that JP2 image is not displayed because index color space is used
JUN FANG [Mon, 16 Mar 2015 19:10:04 +0000]
Fix a problem that JP2 image is not displayed because index color space is used

There are two issues in this bug.

One is that JP2 image is not displayed because it aborts loading Jpx bitmap when the number of components in color space is different with that one in JPX images. I found that the number of components in color space isn't updated after it's initialized. For index color space, the component shall inherit from its base color space.

The second issue is that displayed color is not correct after I fixed the first issue. The root cause is that sRGB is used in JPX image, it doesn't need to map from index to RGB again.

BUG=464215
R=tsepez@chromium.org

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

4 years agoFix a bug that JPX images can't be shown
JUN FANG [Mon, 16 Mar 2015 18:22:52 +0000]
Fix a bug that JPX images can't be shown

In the process of opj_end_decompress, it will return fail when the end of coding stream is reached. However it returns true in the same scenario implemented in openJPEG. So the final solution is from openJPEG. Return true when the end of coding stream is reached.

BUG=452671
R=tsepez@chromium.org

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

4 years agoFix potential integer overflow in fpdf_render_image.cpp
JUN FANG [Mon, 16 Mar 2015 17:56:16 +0000]
Fix potential integer overflow in fpdf_render_image.cpp

BUG=382661
R=tsepez@chromium.org

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

4 years agoRevert "Kill CFX_GrowOnlyPool."
Tom Sepez [Thu, 12 Mar 2015 20:46:38 +0000]
Revert "Kill CFX_GrowOnlyPool."

This reverts commit 090d683489bfa3f36f1e2624c310ff9ca5836038.

Symbol appears in files that are not compiled anywhere, it would seem.
Reverting to remove these first.

TBR=thestig@chromium.org

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

4 years agoKill CFX_GrowOnlyPool.
Tom Sepez [Thu, 12 Mar 2015 20:33:31 +0000]
Kill CFX_GrowOnlyPool.

It's unused, and when the time comes, we'll want to put
pdfium onto a hardened allocator like partitionAlloc anyways.

Along the way, merge adjacent #ifdef __cplusplus blocks,
remove a pointless check for __cplusplus inside a .cpp file,
and remove a redundant cast.

R=thestig@chromium.org

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

4 years agoKill remaining sprintfs
Tom Sepez [Tue, 10 Mar 2015 22:23:02 +0000]
Kill remaining sprintfs

I thought I had done this already, apart from the third-party
libraries, but there were a couple remaining (the third-party
libraries will still call this, they should be tweaked
upstream as needed).

R=thestig@chromium.org

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

4 years agoFix multiply defined macro in zlib.h on linux_chromium_clobber_rel_ng builder.
Tom Sepez [Fri, 6 Mar 2015 22:34:20 +0000]
Fix multiply defined macro in zlib.h on linux_chromium_clobber_rel_ng builder.

Speculative fix since the issue doesn't reproduce locally.

TBR=brettw@chromium.org

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

4 years agoMake conversions for CPDF_Link explicit.
Tom Sepez [Fri, 6 Mar 2015 20:28:34 +0000]
Make conversions for CPDF_Link explicit.

Precursor to taking a second shot at cleaning up the FPDF_*
APIs.  A FPDF_LINK is a CPDF_Dictionary, and a CPDF_Link
is a structure holding a FPDF_LINK.  This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed.

R=thestig@chromium.org

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

4 years agoFix the pdfium component build.
Brett Wilson [Fri, 6 Mar 2015 19:06:38 +0000]
Fix the pdfium component build.

It has a component with no object files in it. When compiled as a shared library, this fails.

This changes the target to a source set which can handle empty sources. It also changes the other static libraries in pdfium to source_sets (it should be very rare to need real static libraries).

Runs "gn format" over the BUILD files.

Renames the arg bundle_freetype to pdfium_bundle_freetype which makes more sense in the context of a larger build like Chrome.

R=jam@chromium.org

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

4 years agoMake conversion between CPDF_Dest and its object explicit.
Tom Sepez [Fri, 6 Mar 2015 18:34:48 +0000]
Make conversion between CPDF_Dest and its object explicit.

Precursor to taking a second shot at cleaning up the FPDF_*
APIs.  A FPDF_Dest is a CPDF_Array, and a CPDF_Dest
is a structure holding a FPDF_Dest.  This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed,
etc.

R=thestig@chromium.org

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

4 years agoAdd gmock to .gitignore
Tom Sepez [Fri, 6 Mar 2015 17:38:36 +0000]
Add gmock to .gitignore

This is an attempt to fix git rebase-update, which complains
about uncommitted changes.

TBR=halyavin@chromium.org

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

4 years agoMake conversion between CPDF_Action and its dictionary explicit.
Tom Sepez [Fri, 6 Mar 2015 00:30:09 +0000]
Make conversion between CPDF_Action and its dictionary explicit.

Precursor to taking a second shot at cleaning up the FPDF_*
APIs.  A FPDF_Action is a CPDF_Dictionary, and a CPDF_Action
is a structure holding a FPDF_Action.  This goes against the
convention that FPDF_ types get cast to CPDF_* types, so we
want to make it clear where objects are getting constructed,
etc.

Also tidy fpdf_actionhandler.cpp because it bugs me.

R=thestig@chromium.org

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

4 years agoMerge to Master: Fix a compiling error in fxjs_v8.h
Tom Sepez [Wed, 4 Mar 2015 19:40:10 +0000]
Merge to Master: Fix a compiling error in fxjs_v8.h

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

TBR=thestig@chromium.org
TBR=jun_fang@foxitsoftware.com

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

4 years agoKill off JS_ErrorString type.
Tom Sepez [Mon, 2 Mar 2015 22:20:10 +0000]
Kill off JS_ErrorString type.

This provides no benefit, and reduces transparency.

Along the way:
Kill off some unused/commented-out code.
Return void where a bool return doesn't make sense.
Remove a pointless template type.
Remove now unused constants and types.

R=thestig@chromium.org

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

4 years agoReturn error information from pdfium to JS.
Tom Sepez [Mon, 2 Mar 2015 20:18:50 +0000]
Return error information from pdfium to JS.

This implements the previously unimplemented JS_Error() function.

Along the way:
- fix some IWYU when the include order in global.cpp was perturbed.
- remove some uses of JS_ErrorString, to increase transparency.
- use vp.IsSetting() in place of !vp.IsGetting() for clarity.
- specify an error string on several error return paths.
- add an error string for writing readonly properties.
- rename an error string constant to reflect the actual message.
- replace calls to variadic Format() with a function doing string appends.
- remove unused JS_GetClassName()

R=thestig@chromium.org

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

4 years agoDo hit tests against Annots in reverse order.
Lei Zhang [Sat, 28 Feb 2015 00:29:50 +0000]
Do hit tests against Annots in reverse order.

BUG=chromium:445408
R=jun_fang@foxitsoftware.com

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

4 years agoRemove unused IDS_ constants from pdfium.
Tom Sepez [Fri, 27 Feb 2015 21:48:38 +0000]
Remove unused IDS_ constants from pdfium.

Along the way, I noticed that one of these is used in a header file
that isn't included anywhere and describes no actual code (JS_Console.h).

Also add missing header guards, and IWYU to resources.h

Also move a static function from a header to the new resources.cpp file.

Also fix the grammar on some of the error messages. Most of these
appear to be JS error messages destined for a JS error handler or (someday)
a console (which can remain in english), and oddly, some appear to be about
failed form validation, which smells user-facing.

Also check that the message makes sense for the point the C++ code
wants to use it, and reword accordingly.

As it turns out, these currently don't make it back to JS due to the
unimplemented JS_Error() function; this is an enabling step towards
implementing it.

R=thestig@chromium.org

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

4 years agoPull in gmock for standalone pdfium builds.
Tom Sepez [Fri, 27 Feb 2015 20:56:25 +0000]
Pull in gmock for standalone pdfium builds.

For chromium checkouts, the top-level gmock is used instead.
Verify build with a simple test that ensures neither mock
method is fired.

R=thestig@chromium.org

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

4 years agoUpgrade openjpeg to revision 2997.
JUN FANG [Fri, 27 Feb 2015 18:00:00 +0000]
Upgrade openjpeg to revision 2997.

BUG=457493
R=tsepez@chromium.org

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

4 years agoImplement a delegate for EmbedderTests.
Tom Sepez [Thu, 26 Feb 2015 00:00:06 +0000]
Implement a delegate for EmbedderTests.

This is the first step in allowing an embedder test to
someday gMock its callbacks, so that it can check that they
fired as expected. gMock wants a class, not a C-style
function-based API, and EmbedderTest is made to bridge
between the two.

The EmbedderTest class itself is modified to inherit from
the C JS API classes themselves, to make finding the
delegate easier.

For example, a future embedder test might send a keystroke
to a page, which would then trigger JS, which would then
trigger an Alert().  Mocking the Alert() callback would
allow the test to check that the alert happened as
expected.

R=thestig@chromium.org

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

4 years agoKill off unused IFXJS interface methods.
Tom Sepez [Wed, 25 Feb 2015 22:38:06 +0000]
Kill off unused IFXJS interface methods.

Re-work of original CL at:
https://codereview.chromium.org/933043002/

Much of the IFXJS interface appears completely unused, so
Kill off unused IFXJS interface methods.  The code itself
appears incomplete against all of the objects present
in the paths that actually do register objects with JS.

R=thestig@chromium.org

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

4 years agoFix compilation error on Windows.
John Abd-El-Malek [Wed, 25 Feb 2015 19:05:30 +0000]
Fix compilation error on Windows.

The build fails due to implicit double to integer conversion warning on width *= scale line
and warnings being treated as errors.

TEST= ninja
BUG= none
R=jam@chromium.org

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

4 years agoAdd small flate decode unit test.
Tom Sepez [Tue, 24 Feb 2015 22:59:35 +0000]
Add small flate decode unit test.

As we remove flate encoded sections from test cases (to
promote clarity), we should first have a simple unit test
for the underlying functionality.

R=thestig@chromium.org

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

4 years agoKill multi-byte comments in fxet_list.h
Tom Sepez [Tue, 24 Feb 2015 22:27:00 +0000]
Kill multi-byte comments in fxet_list.h

No functional changes, just tidying some stray characters,
plus kill trailing whitespace while we're at it.

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

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

4 years agoConvert pdfium expected test results to PNG format.
Tom Sepez [Tue, 24 Feb 2015 20:31:29 +0000]
Convert pdfium expected test results to PNG format.

Required to save space vs. raw bitmap.  Land prior to adding
substantial number of tests.

R=thestig@chromium.org

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

4 years agoFix GN build after PNG support backport
Tom Sepez [Tue, 24 Feb 2015 01:55:58 +0000]
Fix GN build after PNG support backport

Follow-on from https://codereview.chromium.org/950113002.
This would block a pdfium roll until corrected.

TBR=jam@chromium.org

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

4 years agoBackport PNG output format to origin/master branch.
Tom Sepez [Mon, 23 Feb 2015 23:59:57 +0000]
Backport PNG output format to origin/master branch.

The pdfium library itself does not support the format, but the test utility
can convert to this output format.

GN build can't be tested standalone, so push this out to the next CL.

R=jam@chromium.org

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

4 years agoReplace second set of #defines with templates in JS_Define.h
Tom Sepez [Mon, 23 Feb 2015 18:03:12 +0000]
Replace second set of #defines with templates in JS_Define.h

Continuation of effort now that a test case is present on origin/master.

R=brucedawson@chromium.org

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

4 years agoUpdate GN build files w/ cpu_arch -> current_cpu changes.
Dirk Pranke [Fri, 20 Feb 2015 21:46:34 +0000]
Update GN build files w/ cpu_arch -> current_cpu changes.

R=jam@chromium.org
BUG=344767

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

4 years agoAdd test for PDF's JS "global".
Tom Sepez [Thu, 19 Feb 2015 23:58:19 +0000]
Add test for PDF's JS "global".

Exercises a separate code path that stores some JS objects
outside of JS.  Needed before re-writing some other portions
of the JS_Defines.h code.

R=jam@chromium.org

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

4 years agoReplace ugly JS_Define macros with templates.
Tom Sepez [Wed, 18 Feb 2015 20:42:45 +0000]
Replace ugly JS_Define macros with templates.

This allows us to step through the JS bindings code with the
debugger, which I could not do (but wanted to) the other day.

In the process, get rid of some else after returns, and one
unreachable code path.

I also get rid of some tracing macros that we would never
use for the sake of clarity, and some plain unused
definitions.

R=brucedawson@chromium.org

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

4 years agoTidy up JS_Defines.h
Tom Sepez [Tue, 17 Feb 2015 21:21:34 +0000]
Tidy up JS_Defines.h

This is a purely mechanical change, no new functionality.

- Expand some macros which were merely a short-cut to save
  typing but reduced transparency.

- Put GET_VALUE_TYPE() implementation into a .cpp file.

This is a portion of the patch from issue 908033002 at
patchset 40001 (http://crrev.com/908033002#ps40001)

R=brucedawson@chromium.org

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

4 years agoRun pixel tests via automated script.
Tom Sepez [Sat, 14 Feb 2015 00:47:22 +0000]
Run pixel tests via automated script.

On origin/master, we only have .ppm format support, so the
expected output files would take up a lot of space. Hence,
this may not get going until XFA hits with its .png
support.

Nor is there a good way to diff these; XFA provides this
for .png as well.

But this will provide at least one automated test to ensure
that we've got non-blank output, at least for one trivially
simple case.

R=thestig@chromium.org

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