summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-10-18Change CXFA_LoaderContext::dwFlags to bFilterSpace.Lei Zhang
Only 1 bit in the flag is ever used, so simplify it. Change-Id: I75fb7d89c18cbb2538a1c8702bb85b4f3c10d420 Reviewed-on: https://pdfium-review.googlesource.com/c/44256 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Avoid pass by value in FPDFPage_Flatten()'s GetMatrix() helper.Lei Zhang
Change-Id: I281ca39655d593264d9b0ae074d4faec2f36d01c Reviewed-on: https://pdfium-review.googlesource.com/c/44253 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Push/pop the graphics state stack when flattening.Lei Zhang
When FPDFPage_Flatten() manipulates a content stream, it replaces the content stream with a content stream array. The first element in the array is the original content stream and the second element in the array is the flattened annotations content. To make sure the original content stream's graphics state stack does not affect the flattened annotations, FPDFPage_Flatten() rewrites the original content stream to be: q $contents Q When FPDFPage_Flatten() manipulates a content stream array, it just appends the flattened annotations as a new element in the array. This may result in graphics state stack leaking out. To fix this, wrap the content stream array to be: ["q", $content1, ..., $contentN, "Q"] And then append the flattened annotations. BUG=chromium:896366 Change-Id: Ic6499e39eb4c9f1fe45d037622bf02be724b6cae Reviewed-on: https://pdfium-review.googlesource.com/c/44252 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Convert CXFA_LoaderContext to a struct.Lei Zhang
It only has members and they are all public. Initialize them in the header, remove an unused one, and remove the "m_" prefix. Change-Id: Ia4a0b673794f82afddfc6c1bd3a73700cb968259 Reviewed-on: https://pdfium-review.googlesource.com/c/44255 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Clean up CXFA_TextLayout.Lei Zhang
- Forward declare more. - Initialize members in the header. - Move code into anonymous function and fix nits. Change-Id: I5fda66266ead631ae63461b6455d516dbec629fc Reviewed-on: https://pdfium-review.googlesource.com/c/44254 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Add JavaScript tests for event API.Tom Sepez
Change-Id: Ic62fd1c6e55e6db5864e124fe3ba50e05b0020e1 Reviewed-on: https://pdfium-review.googlesource.com/c/44210 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Cache CFGAS_FontMgr::GetFontByUnicode() failures on Windows.Lei Zhang
Non-Windows does this already, which is why it can handle fuzzers that throws the same invalid unicode character at it efficiently. Whereas Windows tries to do the same failing font load repeatedly. BUG=chromium:895469 Change-Id: I6780d1ec0881222348e05a5a63e7b2238f39a3a6 Reviewed-on: https://pdfium-review.googlesource.com/c/44251 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Shuffle platform-specifc code in CFGAS_FontMgr::GetFontByUnicode().Lei Zhang
Move most of it into GetFontByUnicodeImpl(). Change-Id: Ibbfe458589d0d1aea8f52179110690ed83e40fac Reviewed-on: https://pdfium-review.googlesource.com/c/44250 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18De-dup some static string tables in cjs_publicmethods.cppTom Sepez
Change-Id: I1002c4075381f8104630036fc7e54df238fe35f5 Reviewed-on: https://pdfium-review.googlesource.com/c/44110 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Add JavaScript public methods tests.Tom Sepez
Still very preliminary. Alphabetize table in .cpp file to match test. Bug: pdfium:1028 Change-Id: Ia3b646507e1a2ec384bf59893cd1d74c2a4b2456 Reviewed-on: https://pdfium-review.googlesource.com/c/43980 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Repack CPDFSDK_FieldAction.Tom Sepez
Save a few bytes. Initialize members in header. Change-Id: Ie203771f0eee7fb8807a0e652013237679c47481 Reviewed-on: https://pdfium-review.googlesource.com/c/44230 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-17Remove CPDFSDK_Annot::GetMinWidth() and GetMinHeight().Tom Sepez
These are a pair of virtual functions that are never overriden and are only used once in an ASSERT(). Change-Id: I6df9d20cc3e4c0679514fa5c0c15a4d797862b5d Reviewed-on: https://pdfium-review.googlesource.com/c/44213 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-17Nest CJS_GlobalData_Element in CJS_GlobalData.Tom Sepez
Why settle for _ when you can have :: ? No functional change. Move some ctors/initializers out of line and avoid assignment in some ifs. Change-Id: I792bca35f38aa8c4ff41d776a789c5525c5d5113 Reviewed-on: https://pdfium-review.googlesource.com/c/44212 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-17Optimize appends in CFX_XMLNode::InsertChildNode().Lei Zhang
Skip to the end of the linked list instead of traversing it. BUG=chromium:895234 Change-Id: I56d6bee3cd099a1a7343eb2b067d522ec69c261a Reviewed-on: https://pdfium-review.googlesource.com/c/44172 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-17Add FORM_OnLButtonDoubleClick().Lei Zhang
The code for this already exists, but is not hooked up to a public API. Hook it up and add a test case. Change-Id: I2ebc8492d8b7347849ff06f664155c6d72ecf76f Reviewed-on: https://pdfium-review.googlesource.com/c/44130 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-10-17Add CPDF_{Array,Dictionary}Locker to catch illegal iteration patterns.Tom Sepez
Move begin/end methods onto locker object which tracks whether iterators are in existence. Change-Id: Ia869f313fce48d10a0d0180d0cc083eed6ea1584 Reviewed-on: https://pdfium-review.googlesource.com/c/44070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-17Do not do null pointer arithmeticchromium/3584Takuto Ikuta
Let me introduce builtin function instead. This is a preparation CL to remove -Wno-null-pointer-arithmetic warning suppression. Bug: chromium:766891 Change-Id: I05434ba0c525fd2fddf916c042d1443b1f25d7d7 Reviewed-on: https://pdfium-review.googlesource.com/c/44191 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-17Fix typo in coverage_report.py.Lei Zhang
BUG=pdfium:1174 Change-Id: I4ade5c52f505690d14683cb094cc13c6fd9441f4 Reviewed-on: https://pdfium-review.googlesource.com/c/44173 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-17Fix the static initialization order problem for PartitionAlloc.Lei Zhang
Inside fx_memory.cpp, the PartitionAllocatorGeneric objects are globals, so their initialization order is not well defined. BUG=chromium:896117 Change-Id: If4a345d6d7549b0e99a055859eaa67d5ec32c788 Reviewed-on: https://pdfium-review.googlesource.com/c/44170 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-17Remove unused lambda captureTakuto Ikuta
This is a preparation CL to remove -Wno-unused-lambda-capture warning suppression. Bug: chromium:681136 Change-Id: I0fccfd33e10757b282b45079f29b511951decc41 Reviewed-on: https://pdfium-review.googlesource.com/c/44190 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-17Do more selection checks in form fill embedder testsLei Zhang
Make sure there is no text selection before doing an action that triggers a text selection, so we can be more certain the action actually did something. Change-Id: Ibd733bbdbde64dd228a3c66b6de62418560f74e5 Reviewed-on: https://pdfium-review.googlesource.com/c/44112 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-10-17Fix assert failure in CPDF_InteractiveForm::GetControlsForField().Lei Zhang
|CPDF_InteractiveForm::m_ControlLists| replaced |CPDF_FormField::m_ControlList| for all CPDF_FormFields. So when any CPDF_FormFields wants to know about its control list, it has to ask CPDF_InteractiveForm. Every CPDF_FormField started out with an empty control list, so CPDF_InteractiveForm should keep that behavior. BUG=chromium:895983 TBR=tsepez@chromium.org Change-Id: Ibae5f6f54a21b9576b253e230c346bfd6705ca5d Reviewed-on: https://pdfium-review.googlesource.com/c/44150 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Pass gn check on Windows.Lei Zhang
Change-Id: Id10795c880f400bd9f2770b052f77643ec9849f7 Reviewed-on: https://pdfium-review.googlesource.com/c/44111 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Add FxFileCloser for scoped FILE* closing.Lei Zhang
Change-Id: Ic3791e1ddbdc9d30407c8f747fd11e0e338e83d4 Reviewed-on: https://pdfium-review.googlesource.com/c/44090 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-16Use PartitionAllocZeroFill in FX_SafeAlloc().Lei Zhang
Avoid a manual memset(). BUG=pdfium:1171 Change-Id: I4f7708d8ad75ca7fa697f69a24fa0de55286b5fa Reviewed-on: https://pdfium-review.googlesource.com/c/44075 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make some third_party targets pass gn check.Lei Zhang
Change-Id: I2b4b011a242db8ab43634c4e057d6d2b6d4f8c24 Reviewed-on: https://pdfium-review.googlesource.com/c/44079 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make skia/ pass gn check.Lei Zhang
Change-Id: If4ecef883da6abd654ea271c67e17a981e8aa1f5 Reviewed-on: https://pdfium-review.googlesource.com/c/44078 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Use PartitionAllocZeroFill in CFX_V8ArrayBufferAllocator::Allocate().Lei Zhang
Avoid a manual memset(). BUG=pdfium:1171 Change-Id: Ib624906c6852966bce90b8c877ce45079bc6810e Reviewed-on: https://pdfium-review.googlesource.com/c/44074 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Update PartitionAlloc from Chromium at r599712.Lei Zhang
BUG=pdfium:1170 Change-Id: I0f8dfb3d517beaa682a9ca7ad4831c5a7a10dc3b Reviewed-on: https://pdfium-review.googlesource.com/c/44073 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make constants/ pass gn check.Lei Zhang
Change-Id: I1104d5c3c63dbf9f2f286797db842d30c75e2718 Reviewed-on: https://pdfium-review.googlesource.com/c/44077 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Use unique_ptr in CFX_FolderFontInfo::ScanFile().chromium/3583Lei Zhang
Change-Id: If98589e8daffdc74a72281cec6726fb54878e185 Reviewed-on: https://pdfium-review.googlesource.com/c/44076 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Add pdfium_test --show-pageinfo to dump page bounding boxes.Lei Zhang
The bounding boxes are LBRT coordinates. e.g. Page 0: MediaBox: 0.00 0.00 595.00 842.00 Page 0: No CropBox. Page 0: BleedBox: 0.04 0.00 842.04 594.96 Page 0: TrimBox: 0.04 0.00 842.04 594.96 Page 0: ArtBox: 0.00 0.02 594.96 594.96 Change-Id: I2809aab69f3c51bde9a443d6c92f3167ee10b3c9 Reviewed-on: https://pdfium-review.googlesource.com/c/43976 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-10-16Use more unique_ptrs in cfx_psrenderer.cpp for FaxCompressData().Lei Zhang
Change-Id: I2a1f03b7336f2b03ef1d4bbbd396e7a2c5bdea50 Reviewed-on: https://pdfium-review.googlesource.com/c/43999 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make {A85,RunLength}Encode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I3f06ea7ed39c8a8fff57e07f14ff6c21bedbc028 Reviewed-on: https://pdfium-review.googlesource.com/c/43998 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-16Use unique_ptr and span in CPDF_Image::SetImage().Lei Zhang
Fix lint errors as well. Change-Id: I139528b8e76383f878915f9ec940b0af29e155f0 Reviewed-on: https://pdfium-review.googlesource.com/c/44071 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-15Split pdfium_embeddertests sources.chromium/3582Lei Zhang
Move foo_embeddertest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_embeddertests pass gn check. Change-Id: If1fe67c261960c35c344c1047950cd7fdb32c4a1 Reviewed-on: https://pdfium-review.googlesource.com/c/43997 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Move fx_skia_device_unittest.cpp to pdfium_embeddertests.Lei Zhang
It uses fpdfsdk/ and public/ code from core/. Also sort some conditionals in BUILD.gn. Change-Id: I4da9dc1f1833fa6644be3da1a935beba1d57cb2f Reviewed-on: https://pdfium-review.googlesource.com/c/43996 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_unittests sources.Lei Zhang
Move foo_unittest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_unittests pass gn check. Change-Id: Id9f649d5d0c76fe4254f3887778516abb75fcbce Reviewed-on: https://pdfium-review.googlesource.com/c/43995 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split public/ headers into their own source_set.Lei Zhang
This removes some allow_circular_includes_from entries. Change-Id: I276d211a0f45f460b4814560533f0cb83d681613 Reviewed-on: https://pdfium-review.googlesource.com/c/43994 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Restrict fxcrt's visibility to third_party.Lei Zhang
Change-Id: I4b4b1a8e78e2405791aca915e4d48a88e79444d5 Reviewed-on: https://pdfium-review.googlesource.com/c/43993 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Clone dict before iteration in CJS_Document::get_infoTom Sepez
Bug: 895152 Change-Id: I678350841892f88a5d580b58a33a639a1b6ec305 Reviewed-on: https://pdfium-review.googlesource.com/c/44050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-15Use CropBox instead of ArtBox or TrimBoxxlou
FPDFPage_Flatten() used ArtBox as the BBbox of the newly created XObject, which in some situation, some content of the generated PDF are not visible. FPDF_ImportNPagesToOne() uses TrimBox as the BBbox of the newly created XObject, which in some cases, MediaBox and CropBox are scaled up, however TrimBox is not, which caused some content of the newly generated N-upped PDF not visible. Hence for the above two situations, we have chosen to use mostly commonly used CropBox. Bug:409670 Change-Id: Ifb82a6f881d7ce1802cf23c7e8e6f11cc76bf3e9 Reviewed-on: https://pdfium-review.googlesource.com/c/43987 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Shirleen Lou <xlou@chromium.org>
2018-10-15Convert %s -> %ls for wide string error format.Tom Sepez
Make JavaScript tests results correct across platforms. Change-Id: I32e5621f9f37ebb67e45c30ef7b22ea88a3a40af Reviewed-on: https://pdfium-review.googlesource.com/c/44030 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-15Make core/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: Ia7a29a268e67b1fe21bed5cdd629e06fb5cc7bfb Reviewed-on: https://pdfium-review.googlesource.com/c/43992 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Use more UnownedPtr in CPDF_FormControl.Lei Zhang
To make this work, remove an UnownedPtr vector in CPDF_FormField and make CPDF_InteractiveForm manage it instead. Also simplify some code within CPDF_FormControl and CPDF_InteractiveForm. Change-Id: Ifc3a979dcdb992376a48db7a40840d2e76078500 Reviewed-on: https://pdfium-review.googlesource.com/c/43938 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Move CPDF_ModuleMgr methods into cpdf_modulemgr.cpp.Lei Zhang
Some of them were implemented in core/fpdfapi/cmaps. Reorder CPDF_ModuleMgr private methods as well. Change-Id: I88b7c48049de83591c961dd9a74e01fefb211c0c Reviewed-on: https://pdfium-review.googlesource.com/c/43991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make ":pdfium" pass gn check.Lei Zhang
Change-Id: I41861ae949f44475a13f67e7cb8fb6e186cd6732 Reviewed-on: https://pdfium-review.googlesource.com/c/43990 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Stop shadowing codec memory size with CCodec_ProgressiveDecoder::m_SrcSizeTom Sepez
This is a remnant from the old implementation which can get out of sync with the actual value, esp. in the fuzzers where buffers are shorter-lived. Bug: 895009 Change-Id: Ibf16dad58dd750c961e3b446f12cb2197004dbb4 Reviewed-on: https://pdfium-review.googlesource.com/c/44010 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-15Make fxjs/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: I8c53bafd864048506a77354f57e27cac50369005 Reviewed-on: https://pdfium-review.googlesource.com/c/43989 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make fpdfsdk/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: I58e90da4b71a22dd54fd59e8d644b6eef740d4cd Reviewed-on: https://pdfium-review.googlesource.com/c/43988 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>