summaryrefslogtreecommitdiff
path: root/fpdfsdk
AgeCommit message (Collapse)Author
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>
2018-10-04Change |virtual ~Foo(){}| to |virtual ~Foo()=default;|chromium/3571Tom Sepez
Otherwise code coverage flags the empty body as unreachable. Change-Id: Iee1d9a876d68276529c70d9b8c7a28276f271767 Reviewed-on: https://pdfium-review.googlesource.com/c/43514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove unreachable code in CPDFXFA_Page.Lei Zhang
Also disambiguate LoadPDFPage() and do some cleanups. Change-Id: I591295cd5e742a14e41149b63e9d11d8c3d5b7fd Reviewed-on: https://pdfium-review.googlesource.com/c/43460 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove null m_page checks from CPDFSDK_PageView.Tom Sepez
The constructor asserts that it isn't null. Change-Id: I1812068916e8a55693387077ba3faac539172534 Reviewed-on: https://pdfium-review.googlesource.com/c/43510 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Make some CPWL_FontMap methods pure virtual.Tom Sepez
We never instantiate this class by itself, and these don't get called. Change-Id: Ibff1e57c93c346d038c5f9f508b601ef919a6895 Reviewed-on: https://pdfium-review.googlesource.com/c/43475 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove CPDFSDK_DateTime entirely.Tom Sepez
A previous CL has made it completely unused. Change-Id: I54d178f69ac8ea3884c89526e4d2fb81cccc0f20 Reviewed-on: https://pdfium-review.googlesource.com/c/43511 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04CPDF_VariableText::m_nHorzScale is always 100Tom Sepez
Remove the member and simplify logic in all the places this is passed. Change-Id: I39b979793fe84f0dc460261223655dd7f50555cc Reviewed-on: https://pdfium-review.googlesource.com/c/43474 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-04CPDFSDK_AnnotHandlerMgr::Annot_OnCreate() is not called.Tom Sepez
Also Annot_OnLButtonDblClk() and Annot_OnKeyUp(). Change-Id: I0a5984fc89f73f507af520c5cf5afb115b1886ce Reviewed-on: https://pdfium-review.googlesource.com/c/43490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove CPWL_Wnd::GetClassName() and overrides.Tom Sepez
It's only used in two tests, and there it is not essential, so save some strings and vtable space. Change-Id: If8c68e5e2580dbe588bccb942f9008efb66fe490 Reviewed-on: https://pdfium-review.googlesource.com/c/43472 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove CPWL_EditCtrl::m_pEdit null checks.Tom Sepez
It is always non-null. Move initializers to header while we're at it. Change-Id: I64f59ab1d5ffee9256f87e4712e46fb71f14ef08 Reviewed-on: https://pdfium-review.googlesource.com/c/43473 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Reland "Make potentially dangerous Actions require a user click."Henrique Nakashima
This is a reland of 9d784c291714b703b16185e69860a3797de85b6c https://chromium-review.googlesource.com/c/chromium/src/+/1244367 was submitted changing the test that broke with this CL to not depend on PDF OpenActions anymore. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> Bug: 851821 Change-Id: Iaf9c399059590f0f1a050ac450e08ee60a8d5a38 Reviewed-on: https://pdfium-review.googlesource.com/43410 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-02Remove dead code in CPDF_PageRenderCache::ResetBitmap().Lei Zhang
Callers only ever pass in nullptr for the bitmap parameter. Change-Id: Iefeb72a1268521a38b3d5ab4b03163b67bf35796 Reviewed-on: https://pdfium-review.googlesource.com/43210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-02Normalize widget bounding boxes when flattening.Lei Zhang
BUG=chromium:890322 Change-Id: I11050b84cf440f8d6bb00c661360de4e389dc031 Reviewed-on: https://pdfium-review.googlesource.com/c/43290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-01Remove checks for impossible situation in CPDFXFA_Context.Lei Zhang
CPDFXFA_Context should always have a valid doc. Change-Id: Ifb547281f1e4f2741e2d741438b9a3ece71f9e99 Reviewed-on: https://pdfium-review.googlesource.com/43212 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-01Fix #include ordering / formatting.Lei Zhang
Change-Id: I996c9b32d767960a5388e44e13180e1f6577ce38 Reviewed-on: https://pdfium-review.googlesource.com/43190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-24Give CFX_GraphStateData a work-over.chromium/3561Tom Sepez
Use std::vector<float> for dash array. Use compiler-generated default operations. Squeeze some enums. Fix obvious logic botch in DashChanged(). Change-Id: If1d809cc46a3cf2db98a09a3f5a49d22138c0640 Reviewed-on: https://pdfium-review.googlesource.com/42613 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-24Revert "Make potentially dangerous Actions require a user click."Henrique Nakashima
This reverts commit 9d784c291714b703b16185e69860a3797de85b6c. Reason for revert: Roll into chromium is stuck, this is a potential culprit. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 851821 Change-Id: I6f1bc0a02f65a24fbd49d53526b985f8a4ea0b4f Reviewed-on: https://pdfium-review.googlesource.com/42990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-21Fix destruction order with CPDF_StreamAcc.Lei Zhang
Commit d39389f6 changed CPDF_StreamAcc to use MaybeOwned, so now callers have to destroy it more carefully, so CPDF_StreamAcc does not end up with a dangling pointer. BUG=chromium:887626 Change-Id: Id5e7af96aad6270c444485c1574182da5dbd9ebf Reviewed-on: https://pdfium-review.googlesource.com/42893 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Make potentially dangerous Actions require a user click.Henrique Nakashima
URI and SubmitForm actions are only handled if the event was ButtonUp or ButtonDown. Bug: 851821 Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d Reviewed-on: https://pdfium-review.googlesource.com/42731 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Use pdfium::Optional with FPDF_Doc_Save().Lei Zhang
Also rename it to DoDocSave(), since it is not a public API. Change-Id: I88992d12d1b7826c621de0b88692ab33f6d83a06 Reviewed-on: https://pdfium-review.googlesource.com/42815 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Fix misc lint errors and other cleanups.Lei Zhang
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-09-20Remove more unneeded STL #includes from headers.Lei Zhang
Remove some variables named "string" to avoid false positives from the linter. Change-Id: I00a53e6970451fd0cea8ab2f8178183650ca00d2 Reviewed-on: https://pdfium-review.googlesource.com/42810 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Remove many unneeded STL #includes from headers.Lei Zhang
Change-Id: I7010cedee8d17d05b2c37a94d767e6f3a9c48f7d Reviewed-on: https://pdfium-review.googlesource.com/42790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-19Use MaybeOwned in CPDF_StreamAcc.chromium/3557Lei Zhang
Change-Id: Iba886e51cf34ea01ed0d93afc93c8ec0ffed4f52 Reviewed-on: https://pdfium-review.googlesource.com/42594 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-18Change signature of FPDFPageObjMark_Get(Name|ParamKey).chromium/3556Henrique Nakashima
These methods used to return the size of the buffer to contain the value to be returned. Now they will return an FPDF_BOOL to make it consistent with the other mark APIs and more intuitive to differentiate a success from a failure. The size will be returned through an out param. This CL also adds more focused testing for these API methods and similar ones. Change-Id: I6f9837f99d955aaba2c49a259ed7805a286e091d Reviewed-on: https://pdfium-review.googlesource.com/42411 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-18Encode mark names when writing to file.Henrique Nakashima
Bug: pdfium:1150 Change-Id: I7e589fb3d164dfc9b39a7a3f6e782c09331cc32d Reviewed-on: https://pdfium-review.googlesource.com/42630 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-17Fix final/protected conflicts.Tom Sepez
Classes marked |final| should not have |protected| members. In turn, "private field m_dwEncryptObjNum is not used" warning is produced. Change-Id: I51a96aca5a5f499381a6764d892962f7f2dc0327 Reviewed-on: https://pdfium-review.googlesource.com/42611 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-17Remove deprecated FPDFPage_CountObject().Lei Zhang
FPDFPage_CountObjects() is the straight-forward replacement that has been available for a year. Change-Id: I64cd379f81234d8295bfcaf9b6effe3467f100d6 Reviewed-on: https://pdfium-review.googlesource.com/42451 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-15Use ScopedFPDFStructTree in tests.Lei Zhang
Change-Id: Ia457942238ca2a9f48210c080a93412c09ae932c Reviewed-on: https://pdfium-review.googlesource.com/42570 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-14Use MakeUnique() in CFFL_InteractiveFormFiller.Tom Sepez
Remove more bare |new|s. Change-Id: Ia26bb8150d5bb0004c6a8e6ff89b4694b9ef2865 Reviewed-on: https://pdfium-review.googlesource.com/42552 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-14Revert "Disable FPDFEditEmbeddertest.AddCIDFontText"Tom Sepez
This reverts commit 725f544776a6ee96a514a91dffd39aa32ecca3e6. Reason for revert: <INSERT REASONING HERE> Original change's description: > Disable FPDFEditEmbeddertest.AddCIDFontText > > Bug: pdfium:1151 > Change-Id: Ib8b0f8165389ce1a1aa96652685dab14eac6bdfd > Reviewed-on: https://pdfium-review.googlesource.com/42412 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I8a27fe9c5d678f6a041542f3be3a3bade857753a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: pdfium:1151 Reviewed-on: https://pdfium-review.googlesource.com/42530 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-14Change two memcpys to iterator form of vector constructor.Tom Sepez
Because bytestring supports standard iterators. Change-Id: Iaa33d79dbbf07d660eee1dd95d9f5f15547fb57c Reviewed-on: https://pdfium-review.googlesource.com/42511 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-14Rename FPDF_RenderPage_Retail() to RenderPageWithContext()chromium/3553Tom Sepez
Removing the FPDF_ prefix also makes it more obvious that this is not a public/ entry point. No functional changes. Bug: pdfium:1149 Change-Id: I6d68d7951cbfc65128339e237017e7b4bc965635 Reviewed-on: https://pdfium-review.googlesource.com/42490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-14Add basic tests for some annotation APIs.Lei Zhang
Make sure they can handle obviously bad input. These cases lack test coverage. Change-Id: I32d3345faebe566e5346750f622f6be9409f30e4 Reviewed-on: https://pdfium-review.googlesource.com/42450 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-13Disable FPDFEditEmbeddertest.AddCIDFontTextTom Sepez
Bug: pdfium:1151 Change-Id: Ib8b0f8165389ce1a1aa96652685dab14eac6bdfd Reviewed-on: https://pdfium-review.googlesource.com/42412 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-12Set correct stream index when parsing is done in several steps.Henrique Nakashima
When parsing happens in several steps (in pages with > 100 page objects), the position is reset to 0 and the start pointer is advanced. This breaks the calculation of which stream an object belongs to. Passing in the base pointer separately from the start offset allows the correct position to be calculated and the correct stream to be identified. Change-Id: Ic0d5f59f437609158aa97b3c8a18dbd48cd3b0d4 Reviewed-on: https://pdfium-review.googlesource.com/42270 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-11Make HexDecode()'s buffer out parameter a unique_ptr.Lei Zhang
Do the same for A85Decode(). Change-Id: Ic6a0e5e8a63defa104e35e97eb9ce4223aac23a7 Reviewed-on: https://pdfium-review.googlesource.com/41851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-10Save and reload document in RemoveMarkedObjectsPrime test.Henrique Nakashima
Change-Id: I3a09188e5d63906c92718ae7568659d2f3ec75a5 Reviewed-on: https://pdfium-review.googlesource.com/42210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-04Remove unneeded fpdf_parser_decode.h #includes.Lei Zhang
Change-Id: I2c52828c25b4941669503328517c12a0a1dd770e Reviewed-on: https://pdfium-review.googlesource.com/41850 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-29Use pdfium::span<>/UnownedPtr in CFX_Font.Tom Sepez
Move some platform-specific ifdefs so the come last in each section as it is easier to read, perhaps. Change-Id: Ic1c2652c46ecebc63b66213735ed6d94737a7f32 Reviewed-on: https://pdfium-review.googlesource.com/41630 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Remove FPDFDOC_ prefix from non-public functionsTom Sepez
Second CL for naming consistency. Bug: pdfium:1141 Change-Id: Idf0a0da52abd68648ab709997e0523ee3240c247 Reviewed-on: https://pdfium-review.googlesource.com/41531 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-29Use pdfium::span<> in fpdf_parser_decode.h helper functions.Tom Sepez
Change-Id: Ib0a2bd21fe4304163cf9c080e07475e7c033c299 Reviewed-on: https://pdfium-review.googlesource.com/41570 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Handle non-printing characters at beginning of extraction regionRyan Harrison
Currently if a text extraction region begins on a non-printing character then "" will be returned. This is the incorrect behaviour, instead the call should scan ahead until a printing character is found and start extracting from there. Also proactively adds a similar check and scan for the end of the extraction region. BUG=pdfium:1139 Change-Id: Ia2001ac89740f3d31d2bb69e8000773f8b01091b Reviewed-on: https://pdfium-review.googlesource.com/41532 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27Remove unnecessary ToArray() calls and locals in CPDF_Dest.chromium/3535Lei Zhang
Rename GetObject() to GetArray() and remove more ToArray() calls. Change-Id: I754ca72b32c085e1801d3cedcd291ce4d2682359 Reviewed-on: https://pdfium-review.googlesource.com/41353 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>