summaryrefslogtreecommitdiff
path: root/fpdfsdk
AgeCommit message (Collapse)Author
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-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-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-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-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-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-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-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-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>
2018-10-12Add setters/getters for BleedBox and TrimBox.xlou
Since BleedBox and TrimBox are supported according to PDF specification, hence added setters and getters to get the value if exists. Bug:894655 Change-Id: I3c2600450f07665241a4724457a7cbc4282941ed Reviewed-on: https://pdfium-review.googlesource.com/c/43977 Commit-Queue: Shirleen Lou <xlou@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-12Split core/fxcrt build rules into core/fxcrt/BUILD.gn.Lei Zhang
Change-Id: I9b3608bd76ec4911a4bb820fcda62c5d9533fb4f Reviewed-on: https://pdfium-review.googlesource.com/c/43947 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Remove more unnecessary includes and do IWYU as needed.Lei Zhang
Also move some implementations out of headers. Change-Id: I321fc26970c440d874b135bd28e8bc8156b9afee Reviewed-on: https://pdfium-review.googlesource.com/c/43890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Move core/fdrm/crypto/* to core/fdrm/.Lei Zhang
core/fdrm/ currently only contains the crypto directory. Change-Id: I68f4a38e7098f8a3bdc19764bc1ec78c28a386c9 Reviewed-on: https://pdfium-review.googlesource.com/c/43945 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split fpdfsdk build rules into various BUILD.gn files in fpdfsdk.Lei Zhang
Change-Id: I3500ab9a9bbf0ec983e02dd4b739c9b199d71e21 Reviewed-on: https://pdfium-review.googlesource.com/c/43943 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-12Rename CPDF_{Array,Dictionary}::GetCount() to size().Lei Zhang
Make them compatible with pdfium::CollectionSize(). Change-Id: Ibef3b182e35a7eca7c656cf590462782de0cc157 Reviewed-on: https://pdfium-review.googlesource.com/c/43937 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-11Add functions to get/set ArtBox.chromium/3578xlou
There are PDFs that use ArtBox. In some use cases, user may scale a page, scale up/down MediaBox and CropBox. So if ArtBox exists, it needs to be scaled as well. Bug:409670 Change-Id: I78ac7afa66942352277f856514bdd9b15dda270b Reviewed-on: https://pdfium-review.googlesource.com/c/43931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Shirleen Lou <xlou@chromium.org>
2018-10-11Rename InterForm classes to InteractiveForm.Lei Zhang
Shorten some names to try to avoid CPDF_InteractiveForm* pInteractiveForm = GetInteractiveForm(); Change-Id: I77fafd6c4cce20aa46908830afde12f87784680e Reviewed-on: https://pdfium-review.googlesource.com/c/43815 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-11Rename interform files to interactiveform.Lei Zhang
Just rename the files in this CL. Change-Id: I39f7fefa885977fffab6c909762b05484a1c923d Reviewed-on: https://pdfium-review.googlesource.com/c/43814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-10Rename CPDF_ContentMark to CPDF_ContentMarks.Henrique Nakashima
Also change variable names and member names of this type. This better reflects the fact that this class contains all the marks in a page objects, not just one mark. Change-Id: I4fe3d2620e78cbe423f18634f19fa82530d7efe1 Reviewed-on: https://pdfium-review.googlesource.com/c/43813 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-10-10Create embeddertests for other kinds of actions.Tom Sepez
Change-Id: Ia4619be65e2ab8ee4bf19ba9608c1cc94594ba89 Reviewed-on: https://pdfium-review.googlesource.com/c/43812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-10Remove more impossible checks in form filler code.Lei Zhang
Also fix some nits and inline some calls. Change-Id: Ie962f416b8ecd51ce05341e5511129ea0602fa8e Reviewed-on: https://pdfium-review.googlesource.com/c/43604 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Get rid of useless form of CPDFSDK_Widget::GetFormControl().Lei Zhang
Just call CPDF_InterForm::GetControlByDict() directly instead. Change-Id: I3fce2330ab81324d62477530b2617feeb0a49749 Reviewed-on: https://pdfium-review.googlesource.com/c/43606 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Add Observable::ObservedPtr::HasObservable().Lei Zhang
if (pObserved->HasObservable()) is more readable than if (*pObserved). Change-Id: I61ad3deb8e9f30cdc120a05555c2558f34489681 Reviewed-on: https://pdfium-review.googlesource.com/c/43811 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Get rid of non-const ref parameter in CPDFSDK_InterForm::OnFormat().Lei Zhang
Return Optional<WideString> instead. Change the call stack to accept Optional<WideString>. Change-Id: I020589fac8a1de4974070268a19b4acad64c4092 Reviewed-on: https://pdfium-review.googlesource.com/c/43601 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Use pdfium::Optional in CPDFSDK_Widget.Lei Zhang
Also make some methods const. Change-Id: Ie2d0f7e691ad9448b4e77227ce3c0b2b065e0da0 Reviewed-on: https://pdfium-review.googlesource.com/c/43602 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Remove impossible nullptr checks in CPDFSDK_InterForm.Lei Zhang
Also remove dead code and move initialization to headers in CPDFSDK_InterForm. Change-Id: Ib75864ccfd3f1d0d255d9c7942cc610edce822a3 Reviewed-on: https://pdfium-review.googlesource.com/c/43599 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-10Better test FPDFAction_* public functions.Tom Sepez
Update public documentation. Make implementation match documentation for bad argument types. Change-Id: I70aa3ccaf2580f81d6eb14c6fb4198374010a695 Reviewed-on: https://pdfium-review.googlesource.com/c/43690 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-09Do IWYU for retain_ptr.h and unowned_ptr.hLei Zhang
Change-Id: I2897feee27f80c85f0328f0b220ae5be93686170 Reviewed-on: https://pdfium-review.googlesource.com/c/43610 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Beef up FPDFTransformEmbedderTest.Tom Sepez
Change-Id: I53b7c24c2b8f126cb2d2c676a02ccade76966fe8 Reviewed-on: https://pdfium-review.googlesource.com/c/43753 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-09Add two NULL argument FPDFDest_* test casesTom Sepez
Change-Id: I4b811bb28f9af5fd4a907a9a9eb29b05a8dc4b6a Reviewed-on: https://pdfium-review.googlesource.com/c/43731 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Add more FPDFLink_* public API coverageTom Sepez
Change-Id: Ica4c9859b1b4b7f1b4d44a75497becdd956f2600 Reviewed-on: https://pdfium-review.googlesource.com/c/43752 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-09Do IWYU for cpdf_dictionary.h.Lei Zhang
Move some method implementations out of headers in the process. Change-Id: I8701e360d4addd9aec39fe887d932209985d2443 Reviewed-on: https://pdfium-review.googlesource.com/c/43608 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Cover some more NULL-arg FPDFBookmark_* test casesTom Sepez
Change-Id: I0a3db5368852eeed68bac317f8adaac4f54d023b Reviewed-on: https://pdfium-review.googlesource.com/c/43751 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-09Remove small unreachable path in GetLinkList().Tom Sepez
Both callers have already checked for null and returned errors. Change-Id: I48a7333dae36b74aed059ef5bba8bfe10ef2c2aa Reviewed-on: https://pdfium-review.googlesource.com/c/43750 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-09Mark more bits const in CPDFSDK_XFAWidget.Lei Zhang
Change-Id: Ib262eafc73751890a95fb60a5c8d880e9c6792af Reviewed-on: https://pdfium-review.googlesource.com/c/43615 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Use CPDFSDK_BAAnnot::GetAnnotDict() in more places.Lei Zhang
Also initialize CPDFSDK_Widget members in the header. Change-Id: I55cfad3b0393b7d8e897c6ea1b91952b9c5a68d1 Reviewed-on: https://pdfium-review.googlesource.com/c/43598 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Pass CFX_Matrix by const-ref in various OnDraw() methods.Lei Zhang
Change-Id: I6e953206520c024b2fc23b9b60c5c43112d04896 Reviewed-on: https://pdfium-review.googlesource.com/c/43603 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Make more CPDFSDK_AnnotIterator members const.Lei Zhang
Change-Id: I1c387ad9f6e1e4e87ebd7b778789617f93cf2c76 Reviewed-on: https://pdfium-review.googlesource.com/c/43614 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Fix a C-style cast in FPDFPage_TransFormWithClip().Lei Zhang
There is no guarantee that CFX_Matrix and FS_MATRIX are the same. Also change the code to do some early returns. Change-Id: I6b5b42cafe370cd43ec1dd5885bba8e37c4a1341 Reviewed-on: https://pdfium-review.googlesource.com/c/43611 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-06Encapsulate CPDF_PageObject's rect member.Lei Zhang
At the same time, change it from 4 floats to a CFX_FloatRect. Change-Id: I00ded941723d6a264b7a17c73fd337e66b449308 Reviewed-on: https://pdfium-review.googlesource.com/c/43570 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Tidy CPVT_WordRangeTom Sepez
Change-Id: I6fea894fbf6d4865f8ca6bd70452c5730414f378 Reviewed-on: https://pdfium-review.googlesource.com/c/43551 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-05Remove SetSaveCalled APIRyan Harrison
This was meant to be part of a mechanism to alert users that entered data into a PDF form was not going to actually be saved how they would expect. The UI for this is blocked on a bug in V8, and is now being superseded by work to correctly implement saving. BUG=pdfium:953 Change-Id: Id9c85c109a3f6a6b4ee69d35f366006be4dc9c32 Reviewed-on: https://pdfium-review.googlesource.com/c/43552 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-05Tidy PWL_FLOATRANGETom Sepez
Remove unused form of constructor. Initialize in header and default constructor (POD). Use std::min/max Change-Id: Ib2a37333d9f57ff2e2139a2cc1dea61416a8614b Reviewed-on: https://pdfium-review.googlesource.com/c/43476 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>