summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-05-24Improve constness for more CPDF_Objects pointers.Lei Zhang
Most of them can be marked const. A couple are marked non-const because eventually something inside gets modified. Change-Id: I5415ca8d1efdac451cde340272436cd1e6ec433f Reviewed-on: https://pdfium-review.googlesource.com/32184 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-23Remove GetBits32().Lei Zhang
Replace it with CFX_BitStream. Change-Id: Ib74657f888b8dec8b6fdad7b49e28d250991c590 Reviewed-on: https://pdfium-review.googlesource.com/32852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-23Avoid repeated calculations in CFX_BitStream::GetBits().Lei Zhang
Change-Id: Icfb7c6933625436b9fcf6a9fdfd0e5f655108eca Reviewed-on: https://pdfium-review.googlesource.com/32851 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-23Add unit test for CFX_BitStream.Lei Zhang
Change-Id: I764196b9cc1d437313aac18ee9d5dbed642c7119 Reviewed-on: https://pdfium-review.googlesource.com/32850 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-23[xfa] Skip text length check for empty text fieldschromium/3439Dan Sinclair
This CL sets the text edit engine to skip the length check when doing an insert if the engine is currently empty. This allows handling inserting the formatted version of strings if they have a length longer then the maximium length. Bug: 1066 Change-Id: If9799334f889b8ae0f568f1f9d5457e2b504aa1d Reviewed-on: https://pdfium-review.googlesource.com/32898 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-23Fix linking errors in fuzzer targets.Lei Zhang
Commit 86688dea moved some code out of a header, so now build targets that used to only include the header need proper dependencies. BUG=chromium:845771 Change-Id: I28603eea721b0ee19c2539ecf93fc3c22c3a8298 Reviewed-on: https://pdfium-review.googlesource.com/32895 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-23Move SkFloatToDecimal pow10 inside anonymous namespaceDan Sinclair
This CL moves the pow10 definition inside the pdfium::skia namespace in order to fix conflicts with the skia version of the same file. This comes up due to the code coverage tools. Bug: chromium:845505 Change-Id: Ief53a2bbd15cb9828be23417ff3442461347d146 Reviewed-on: https://pdfium-review.googlesource.com/32893 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-22Make friend RetainPtr<T> statements consistently public.Lei Zhang
Also make destructors private for RetainPtr sub-classes, and add missing destructors. Change-Id: I451bf0aae2dae943b1f450d0aa4ca5124dc578fd Reviewed-on: https://pdfium-review.googlesource.com/32853 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-22Fix nits in fxjs.Lei Zhang
- Make parameter checking more consistent in a several places. - Remove unnecessary parameter size checks. - Get rid of new statements / FX_Free() calls. Change-Id: I7bac8e678f590815a398a318cd62a2947e1dd973 Reviewed-on: https://pdfium-review.googlesource.com/32836 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-22Simplify CPDF_ShadingPattern::Validate().Lei Zhang
Fix some nits in CPDF_ShadingPattern as well. Change-Id: I6b4b73f99031733a113fe2ad1bdc1d1e565b7a7d Reviewed-on: https://pdfium-review.googlesource.com/32738 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-22Remove useless CPDFSDK_Widget::SetDefaultValue().chromium/3438Lei Zhang
Change-Id: I5fda9b68309a8b1f0b1768c26a25c95d7dda8d3d Reviewed-on: https://pdfium-review.googlesource.com/32745 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-22Fix a regression with missing text.Lei Zhang
Commit 10e1f05a incorrectly removed a font weight sanitizing step in the font substitution code. BUG=chromium:820345 Change-Id: I876f65a5649270648616f561eaad17ee333b9a9e Reviewed-on: https://pdfium-review.googlesource.com/32832 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-22Add test case for a font substitution regression.Lei Zhang
BUG=chromium:820345 Change-Id: Ia3adb6a7565e12f3d5e129e2babb4b8628028269 Reviewed-on: https://pdfium-review.googlesource.com/32810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-22Order CHKs in alphabetical order within each fileNicolas Pena
This CL orders the CHKs in fpdf_view_c_api_test.c in alphabetical order within each file because it is more convenient for these reasons: * Easier to find existing APIs for which exact name is not known. * Easier to verify that the ordering is being followed when adding APIs. Change-Id: Ie9f56dd97e64b288927a14927c90ad8ec4cb8539 Reviewed-on: https://pdfium-review.googlesource.com/32713 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-22Remove JBIG2_memcpy() and JBIG2_memset().Lei Zhang
Just use memcpy() and memset(). Change-Id: Id6c6fab4e65a5524786ae318270c5981313825f2 Reviewed-on: https://pdfium-review.googlesource.com/32743 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-22Remove return value from CJBig2_Image::SetPixel().Lei Zhang
Nobody reads it. Change-Id: I76c0f5881e5432d2086cb8eaec7fc70fa5b71536 Reviewed-on: https://pdfium-review.googlesource.com/32741 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-22Fix method style in JBig2_Image.Lei Zhang
Rename fooBar() to FooBar(). Change-Id: I87775fa14ce7e4f4a5897780d0d02fb61c7693ff Reviewed-on: https://pdfium-review.googlesource.com/32739 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-22Add FPDFPageObj_GetStrokeWidth() APIMiklos Vajna
It was already possible to set the stroke width of a page object, this is the other direction. Change-Id: I5c4681b232768fc928bc7a169f223877284d4812 Reviewed-on: https://pdfium-review.googlesource.com/32770 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-22Remove useless CPWL_ListBox::KillFocus().Lei Zhang
This override method just calls its parent class's method. Change-Id: I4b22f55267a651a0eef0bf4e77d1231a7721fd6c Reviewed-on: https://pdfium-review.googlesource.com/32747 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-22Fix spaces too wide in XFA Dropdown.Henrique Nakashima
CFGAS_PDFFontMgr::GetCharWidth() is only used for spaces, for no good reason I could find. It's broken in this case too, returning a default value of 600 for any character. This CL removes this method and its only usage that led to finding this issue. Bug: pdfium:1083 Change-Id: I954de45101715b5af05169612fb5eca1b1a170b4 Reviewed-on: https://pdfium-review.googlesource.com/32740 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-22Declare some variables closer to when used in CFX_FontMapper.Lei Zhang
Change-Id: I06ca9eb7e8bb19f75ee75937a44e4ae548a7a92c Reviewed-on: https://pdfium-review.googlesource.com/32791 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-21Avoid indexing into std::vector inside a tight loop.chromium/3437Lei Zhang
In CCodec_FaxDecoder::v_GetNextLine(), a fixed size vector often needs to be inverted. Doing so without checking bounds on every access makes a big difference in non-optimized builds. BUG=chromium:843899 Change-Id: Iecc0a3da22631a289745245563dab7a7c3c458d0 Reviewed-on: https://pdfium-review.googlesource.com/32744 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-18Fix small typo in common.pychromium/3436chromium/3435Ryan Harrison
This causes a crash if running verbose mode Change-Id: Ib5fe3dada8c81874aae110e21252edad05668a36 Reviewed-on: https://pdfium-review.googlesource.com/32737 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-18Fix issues with XFA font loadingRyan Harrison
This fixes two partially interrelated bugs with font loading in XFA documents. First, it adds falling back to the builtin fonts if there are no viable embedded or installed font for the top-level XFA font manager. Additionally it changes the load font code path in CXFA_FWLTheme to use the top level XFA font manager, instead of the one that just handles the system installed fonts. The main visible issue that this patch fixes is that currently using --font-dir with pdfium_test on a XFA PDF can cause text to not be displayed in widgets and/or NOTREACHED asserts. This occurs if there isn't a needed fonts embedded in the document or in the font directory, since currently PDFium will not correctly fall back to the builtins. BUG=pdfium:1008,pdfium:1020 Change-Id: I451a8aede63d639e401c0cc076443e61d8b7a2f8 Reviewed-on: https://pdfium-review.googlesource.com/32730 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-17Add check that --font-dir is actually a directorychromium/3434Ryan Harrison
Hoisted myself on this today when I was actually passing the path to the font file I wanted to use, not the directory. BUG=pdfium:1008,pdfium:1020 Change-Id: I4a68a7d96633e951a92125d83397ff457288b1e0 Reviewed-on: https://pdfium-review.googlesource.com/32636 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-17More overflow checks in bidi codeDan Sinclair
There are several more places where the width is added to a characters valid width in the bidi code. This CL changes all occurances to used a check numeric. Bug: chromium:844046 Change-Id: Idd8be3a4a576af626b5afa6f7cd04cc160b929d5 Reviewed-on: https://pdfium-review.googlesource.com/32714 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-17Deprecate several Path/Text APIs.Nicolas Pena
This CL deprecates the following APIs in favor of the more general versions: FPDFPath_SetStrokeColor FPDFPath_GetStrokeColor FPDFPath_SetStrokeWidth FPDFPath_SetLineJoin FPDFPath_SetLineCap FPDFPath_SetFillColor FPDFPath_GetFillColor FPDFText_SetFillColor Change-Id: Iccaa2ce26025e51366bc50e058e39650f3698836 Reviewed-on: https://pdfium-review.googlesource.com/32711 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-17Make CXFA_LayoutProcessor an UnownedPtr in CXFA_FFDocViewDan Sinclair
The LayoutProcessor is owned by the CXFA_Document. Make the ownership explicit with an UnownedPtr. Change-Id: I100af9e2e029e0a5db4ee365e11977016ffdcd70 Reviewed-on: https://pdfium-review.googlesource.com/32670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-17Roll third_party/freetype/src/ 2157d8fa6..9e345c911 (9 commits)Lei Zhang
https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/2157d8fa6f7e..9e345c911714 $ git log 2157d8fa6..9e345c911 --date=short --no-merges --format='%ad %ae %s' 2018-05-10 alan.coopersmith Further fix to visibility flag testing with Solaris Studio compilers. 2018-05-08 wl [autofit] Avoid potential SEGV if running out of memory. 2018-05-07 madigens CMake: Allow using project as subfolder in other project 2018-05-07 wl [build] Suppress configure's `nothing to be done' message. 2018-05-04 mpsuzuki Support symbol visibility features of Sun / Oracle C compilers. 2018-05-02 madigens Unbreak CMake Windows installation 2018-05-02 wl Remove FT_CONFIG_OPTION_PIC and related code. 2018-05-01 wl * Version 2.9.1 released. ========================= 2018-04-26 wl Another fix for handling invalid format 2 cmaps. Created with: roll-dep third_party/freetype/src BUG=pdfium:1084 TBR=npm@chromium.org Change-Id: I282e6c9c3cde6b3068f92461b08e14f86f033768 Reviewed-on: https://pdfium-review.googlesource.com/32712 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-17Annotate CFX_ImageTransformer with LIKELY().Lei Zhang
Doing this in the inner loops gets us another small performance improvement. Change-Id: I61fdf4bf8363a66123b3be3bc7ca9b5370f451fc Reviewed-on: https://pdfium-review.googlesource.com/32710 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-17Add comment about cleaning binding nodesDan Sinclair
The reason for calling ReleaseBindingNodes() has changed but the code comment hadn't. This CL updates the code comment to make it clearer why this release has to happen. Change-Id: I0c08c7580ef7c8508cd4db7b8930d5f2cd595b1b Reviewed-on: https://pdfium-review.googlesource.com/32690 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-17Expose CJBig2_Image::ComposeTo() as a public method.Lei Zhang
CJBig2_Image::ComposeFrom() wraps a call to ComposeTo() and does an extra validity check. In tight loops where the validity check will always succeed, this is wasteful. Change existing callers of ComposeFrom() to ComposeTo() when the validity check has already been done. BUG=chromium:840728 Change-Id: I39fb42eea49b92b7804cbd42c3d8a0329edeb58d Reviewed-on: https://pdfium-review.googlesource.com/32637 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-17Avoid fmodf() in CFX_BilinearMatrix.Lei Zhang
This class is used heavily by CFX_ImageTransformer and fmodf() calculations are expensive. Change-Id: If2b9037eb2e90ae377ffb490483a7e7e4faf63b2 Reviewed-on: https://pdfium-review.googlesource.com/23176 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-17Consolidate identical code in CJBig2_TRDProc.Lei Zhang
Change-Id: Ib44a6b7bd19625a4081322d2471551bec894abd8 Reviewed-on: https://pdfium-review.googlesource.com/32638 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-17Convert JS execute methods to return Optional<IJS_Runtime::JS_Error>Dan Sinclair
This CL changes several of the JS execution methods to to return an Optional<IJS_Runtime::JS_Error> instead of a bool with a WideString out param. The IJS_Runtime::JS_Error will contain the line, column and exception message if an error occurs during execution. Change-Id: I37785ae6cd133a4c94ad8d25289473600b8a5d19 Reviewed-on: https://pdfium-review.googlesource.com/32614 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-05-17Update third_party/base/compiler_specific.h.Lei Zhang
Import Chromium's base/compiler_specific.h from r537069. Now that FALLTHROUGH is available via compiler_specific.h, remove FX_FALLTHROUGH. Change-Id: I8b9631a4f007673e10e0c26951dfd61e9dcada30 Reviewed-on: https://pdfium-review.googlesource.com/32639 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Move JBig2 HuffmanTables into JBig2_HuffmanTable.cppNicolas Pena
This CL changes the table information so it can be indexed, and allows moving all of the information to the CJBig2_HuffmanTable implementation, which is the only real user of the data. Change-Id: I88780bee32c8509198518fd3b1e82d68ae7ff707 Reviewed-on: https://pdfium-review.googlesource.com/32635 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-16Add support for PartionRealloc to return nullptrRyan Harrison
Currently the PartitionRealloc code path will only exit, with no option to return nullptr on failure, unlike PartitionAlloc code path. This CL refactors the realloc code path to be similar to alloc code path, following the upstream patch: https://chromium-review.googlesource.com/c/chromium/src/+/1044971 This also changes the version of realloc exposed to third party C libs to have the nullptr behaviour, like the exposed version of alloc. This CL is a redo of https://pdfium-review.googlesource.com/c/pdfium/+/31990 BUG=chromium:783022 Change-Id: Ib1b659079585dfd0423d683b8a2c7b6758a22a01 Reviewed-on: https://pdfium-review.googlesource.com/32613 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org>
2018-05-16Update third_party/base/bits.h.Lei Zhang
Pick up https://crrev.com/515947 and https://crrev.com/542972 Change-Id: Idccd388ee2f9cc71ace7ed5f598c820754e87b6e Reviewed-on: https://pdfium-review.googlesource.com/32631 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-16Remove some more unused #definesTom Sepez
Bug: pdfium:1085 Change-Id: I62c526ae865f0cadfddd2e75a616bce73de0f88d Reviewed-on: https://pdfium-review.googlesource.com/32632 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-16Move FX_LBUN shorthand codes from .h to .cpp fileTom Sepez
They are not used outside of it. Change-Id: I0baa84c5a015621bc0ba211c2ddb01608997dc7d Reviewed-on: https://pdfium-review.googlesource.com/32633 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-16Do more optimizations to make FindBit() faster.chromium/3433Lei Zhang
Change-Id: Ibbc020393e38405f9d1cb0d483ef875777d4e721 Reviewed-on: https://pdfium-review.googlesource.com/32650 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Use pdfium::span<> in cpdf_crypto_handler.hTom Sepez
Remove some unused args along the way. Change-Id: I234a674d4d6cc79b33087bc850f5df36bae25870 Reviewed-on: https://pdfium-review.googlesource.com/32596 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-16Avoid a memset() in FindBit() in the fax codec.Lei Zhang
FindBit() is called frequently by other fax codec code. Use 16 more bytes of space to store the two possible values memset() can set. Change-Id: Ibeb549c44928bbb468ac4eb4cef2d9339cf6490d Reviewed-on: https://pdfium-review.googlesource.com/32630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Remove two unused #defines in cjs_globaldata.cpp.Tom Sepez
Bug: pdfium:1085 Change-Id: I121152527333e143d23e7cb852c8c1a745026453 Reviewed-on: https://pdfium-review.googlesource.com/32618 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-16Convert CJX_Object::Set* methods to return voidDan Sinclair
We never use the return values of these methods, switch to void from bool. Change-Id: I8b0d96e5be90ac08281bbb82d2c7205d94abea2b Reviewed-on: https://pdfium-review.googlesource.com/32616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-16Use pdfium::span<> in cpdf_creator.Tom Sepez
Change-Id: I959fe5dc30fcfe2176c7e5a64b07d082313a22b4 Reviewed-on: https://pdfium-review.googlesource.com/32595 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-16core: allow building against system icu-ucMiklos Vajna
Use the system ICU header when USE_SYSTEM_ICUUC is defined. Change-Id: Ieeb0e4a11ae86da871644dd0fd84de07e9917fde Reviewed-on: https://pdfium-review.googlesource.com/32490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Cleanup CPDF_ContentParserDan Sinclair
This CL cleans up the CPDF_ContentParser code. The m_bIsDone flag has been removed and a kComplete stage added. Each of the processing methods returns the next stage instead of setting the internal flag automatically. The infinite loop is removed for simpler straight line code. Change-Id: Id817a5fa054e28c331c68c63ec2c12b369cb0233 Reviewed-on: https://pdfium-review.googlesource.com/32611 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-16Use pdfium::span<> in CPDF_EncryptorTom Sepez
Provides more lifetime/bounds checking "for free". Change-Id: Ifaf7a95c0f6f288777cd6ef35996e01b3dc4bc63 Reviewed-on: https://pdfium-review.googlesource.com/32594 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>