summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-16Get rid of some loose allocs/free in CPDF_Document.chromium/3494Tom Sepez
Use std::vector<> as a manager for contiguous buffers. Change-Id: Icaacbd4b7010b928237aa71485411ade7539412a Reviewed-on: https://pdfium-review.googlesource.com/37012 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-14Use more ternary operators in content mark code.chromium/3493chromium/3492Lei Zhang
Change-Id: Ibf09905523ae2d80ce48bfe7337733d8dc718669 Reviewed-on: https://pdfium-review.googlesource.com/37850 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-13Create API to remove a parameter from a content mark.chromium/3491Henrique Nakashima
- FPDFPageObjMark_RemoveParam() Bug: pdfium:1037 Change-Id: I3ec25128795c36ba7f2f72a9d288a7855ecc3180 Reviewed-on: https://pdfium-review.googlesource.com/37770 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-13Create API to remove a content mark from a page object.Henrique Nakashima
- FPDFPageObj_RemoveMark() Bug: pdfium:1037 Change-Id: I7ff320261d64e3ead45375ccc72301e7c64dd6e3 Reviewed-on: https://pdfium-review.googlesource.com/37710 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-13Fix mark parameters not saved if nothing changed.Henrique Nakashima
Bug: pdfium:1037 Change-Id: Ia2cd0d6ef99495dda3289988123489e3a2ad6e82 Reviewed-on: https://pdfium-review.googlesource.com/37750 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-13Validate out-parameters in FPDF_GetPageSizeByIndex().Lei Zhang
Change-Id: I2927ebdf0aff31193ad69dcd5542f3858ffdd6ee Reviewed-on: https://pdfium-review.googlesource.com/37790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-13Fix FPDF_ImportNPagesToOne() documentation.Lei Zhang
FPDF_ImportNPagesToOne() has width/height parameters to indicate the dimensions of pages in the returned PDF. PDF is not a raster-based format, so pixels are not the right unit for page dimensions. Change-Id: Iff5b373a5a020b5822aaa29d2b44f1dbf7a75b13 Reviewed-on: https://pdfium-review.googlesource.com/37810 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-12Fix mark not saved if there are no other changes in the same object.Henrique Nakashima
Bug: pdfium:1037 Change-Id: Ifcb0a4330d077895c5f02395588150f29a5466aa Reviewed-on: https://pdfium-review.googlesource.com/37731 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-12Move CJS_Field private methods into an anonymous namespace.Lei Zhang
Change-Id: Ib758cfc97a4e2bb94f58afa999608f77c0972336 Reviewed-on: https://pdfium-review.googlesource.com/37730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-12Remove parameter to CJS_Field::GetFormFields().Lei Zhang
It is always the same value. Also mark ValueIsOccur() as const. Change-Id: Ifdfc33f8213ed272e7d36e1e4c2de1d2070fbcbd Reviewed-on: https://pdfium-review.googlesource.com/37712 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-12Add CJS_Field::GetFirstFormField().Lei Zhang
Its what many CJS_Field methods really want to do. Change-Id: I18cf61a15be7b783b795c61a5c26c42ef5d82127 Reviewed-on: https://pdfium-review.googlesource.com/37711 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-12Create API to set and get blob values from a mark dict.Henrique Nakashima
The new functions are: - FPDFPageObjMark_GetParamBlobValue - FPDFPageObjMark_SetBlobParam Bug: pdfium:1037 Change-Id: Ie04df04c64c6cf517a8cde182d7e9a38c3c78d1b Reviewed-on: https://pdfium-review.googlesource.com/37570 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-12Add more helper functions to check field types in CJS_Field.Lei Zhang
These types are commonly checked together. - IsComboBoxOrListBox() - IsComboBoxOrTextField() Change-Id: Ia363bd9822f8dfe61e11cf552ec516f9403a8fcc Reviewed-on: https://pdfium-review.googlesource.com/37673 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-12Add a IsCheckBoxOrRadioButton() helper for CJS_Field.Lei Zhang
Change-Id: I0e06d641d482cbcd2cf33f327d9504e55a772157 Reviewed-on: https://pdfium-review.googlesource.com/37672 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-12Use pdfium::Optional in CJS_Return.Lei Zhang
Change-Id: Idfe70f86fbaf341ba6b197689a65ac722e671f39 Reviewed-on: https://pdfium-review.googlesource.com/37674 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-12Rename 'ori' to 'backdrop' in rendering code.Lei Zhang
Change-Id: I6fa3fd93638bc3aeaaef854676fe31476888433b Reviewed-on: https://pdfium-review.googlesource.com/37671 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-12Use JSGetObject() in even more places.Lei Zhang
BUG=chromium:862059 Change-Id: Id354a5e6dbc037dbb76f901de8311a4f4a4d8940 Reviewed-on: https://pdfium-review.googlesource.com/37670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-12Remove CPDF_HintTables::GetItemLength()Artem Strygin
Commit {Insert later} removed the last caller to this method. Change-Id: I1689b33486396cc3a41139f984f819b39ab02b2a Reviewed-on: https://pdfium-review.googlesource.com/35130 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-12Implement CPDF_HintsTable::SharedObjGroupInfo.Artem Strygin
Merge shared objects related data into CPDF_HintsTable::SharedObjGroupInfo. Change-Id: I53bb7fc42ea6bcd26b3ebf91b8c6aa402108d086 Reviewed-on: https://pdfium-review.googlesource.com/15830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-12Reland "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Artem Strygin
This is a reland of 77f15f7883638a4ced131d74c053af10a5970ce9 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> Change-Id: I4c4d5dcf42ff44784468ac7a7c302df509fc804d Reviewed-on: https://pdfium-review.googlesource.com/37313 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-11Inline GetMarkParamPairAtIndex into FPDFPageObjMark_GetParamKey.Henrique Nakashima
Bug: pdfium:1037 Change-Id: Iddc0d51874cf22d24ddf634ff767cd08807a4904 Reviewed-on: https://pdfium-review.googlesource.com/37630 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Roll third_party/yasm/source/patched-yasm/ b98114e18..720b70524 (1 commit)Lei Zhang
https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm.git/+log/b98114e18d8b..720b70524a44 Created with: roll-dep third_party/yasm/source/patched-yasm TBR=dsinclair@chromium.org Change-Id: Ie8893bfafcb26d8fe88a9c3efa11548043675513 Reviewed-on: https://pdfium-review.googlesource.com/37270 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Rename content mark parameter value getters.Henrique Nakashima
The functions: - FPDFPageObjMark_GetParamValueTypeByKey() - FPDFPageObjMark_GetParamIntValueByKey() - FPDFPageObjMark_GetParamStringValueByKey() are renamed, respectively, to: - FPDFPageObjMark_GetParamValueType() - FPDFPageObjMark_GetParamIntValue() - FPDFPageObjMark_GetParamStringValue() Bug: pdfium:1037 Change-Id: Iac9cc8c0a9ccaea101bbaaab9063cd2c755c9d47 Reviewed-on: https://pdfium-review.googlesource.com/37611 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Remove clunky mark property value getters by index.Henrique Nakashima
The key getters are necessary to list the properties, but after getting those keys, the *ByKey functions can be called. These functions are therefore unnecessary. In a follow-up CL, I will remove the "ByKey" suffix from the other versions. Bug: pdfium:1037 Change-Id: I02760025470a295971c4900fce1b6a8bbc7a5820 Reviewed-on: https://pdfium-review.googlesource.com/37590 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Write marked content operators when generating a stream.Henrique Nakashima
The marked content operators are BMC, BDC and EMC. In the case of BDC, it is preceded by a direct dict or a property name. Bug: pdfium:1118 Change-Id: I3ee736ff7be3e7d7dde55ef581af3444a325e887 Reviewed-on: https://pdfium-review.googlesource.com/37470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-11Store property name for marked content with an indirect dict.Henrique Nakashima
The name of the property is now stored in the CPDF_ContentMarkItem, which will be needed to properly write back these content marks after a change in the stream. Bug: pdfium:1118 Change-Id: I1296f488b35ee0684efa33d17400ed22a88383a2 Reviewed-on: https://pdfium-review.googlesource.com/37370 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Cleanup CPDF_ContentMark.Henrique Nakashima
Bug: pdfium:1118 Change-Id: I457a52196ee177a09d33d9e025a094888be3fb60 Reviewed-on: https://pdfium-review.googlesource.com/37610 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-11Split CPDF_ContentMark::AddMark() into three versions.Henrique Nakashima
One version is for a mark without a dictionary. The second is for a mark with a direct dictionary. The third is for a mark with indirect properties. Bug: pdfium:1118 Change-Id: Ice0ff11d5ba4eaf2ccdf57be49b9140ba5c9b159 Reviewed-on: https://pdfium-review.googlesource.com/37550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-11Use JSGetObject() in more places.chromium/3489Lei Zhang
Change-Id: I7f26709bdad56cc2712f21e8e644be7c53ec5ec4 Reviewed-on: https://pdfium-review.googlesource.com/37513 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-11Fix crash and memory leak.Artem Strygin
Do not return size within CPDF_StreamAcc in case when read data failed. Also free buffers in this case. Bug: chromium:860210 Change-Id: Ifb2a061d7c8427409b68c33f213c5c55343fb946 Reviewed-on: https://pdfium-review.googlesource.com/37310 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-11Do not store cross ref v5 obj within document.Artem Strygin
Currently, not necessary to store the cross ref v5 obj within CPDF_IndirectObjectHolder(CPDF_Document), because all necessary data from the cross ref are parsed or cloned, and owned by CPDF_Parser seperately from CPDF_IndirectObjectHolder. Also this fix regression from commit 4ea4459e. BUG=chromium:810768 Change-Id: I0d1a11ff027210f4f15804a69d12416838ec9815 Reviewed-on: https://pdfium-review.googlesource.com/37110 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-11Add FPDFFormObj_CountObjects() APIMiklos Vajna
To find out the number of sub-objects a form object has, similar to how FPDFPage_CountObjects() does it for page objects. Change-Id: I7e5775dece42b74fd5b71b1d9622a1aa37bf64ac Reviewed-on: https://pdfium-review.googlesource.com/37316 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
2018-07-11Check GetObjDefnID() in various JS functions.Lei Zhang
Consolidate all the checks into JSGetObject(), and add GetObjDefnID() methods for classes that are missing it. BUG=chromium:862059 Change-Id: I2c2b725a01dcd259ef712d2513fcf740cc410b15 Reviewed-on: https://pdfium-review.googlesource.com/37510 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-11Fix some nits in fxjs code.Lei Zhang
Change-Id: I533a702947ba371cbc7971d88a3b7dabbc81a298 Reviewed-on: https://pdfium-review.googlesource.com/37511 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-07-10Add test for reading marked content with an indirect dict.Henrique Nakashima
Bug: pdfium:1118 Change-Id: I2e9adaae64cba5b3915c19f3c99743cddbe58736 Reviewed-on: https://pdfium-review.googlesource.com/37371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-10Create API for adding content marks and setting their params.chromium/3488Henrique Nakashima
This CL creates the following new functions in the public API: - FPDFPageObj_AddMark - FPDFPageObjMark_SetIntParam - FPDFPageObjMark_SetStringParam Bug: pdfium:1037 Change-Id: Icabf3fdd8e8153b9156bab807a3708d38a9365d8 Reviewed-on: https://pdfium-review.googlesource.com/37330 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-10Make CPDF_StreamContentParser::m_pResources a const pointer.Lei Zhang
Move the code to select what it points at to a separate function, so the CPDF_StreamContentParser constructor only sets it once. Change-Id: I60013e77c8f37246282f94227a4aeb17270ee23c Reviewed-on: https://pdfium-review.googlesource.com/37450 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-10Fix m_ExtGID usage in CPDF_CharPosListNicolás Peña
This CL allows Apple to use m_GlyphIndex as a replacement for m_ExtGID when it is invalid. Bug: pdfium:1121 Change-Id: I49e7936201815bae5a2c8a26680fc1e542a60c43 Reviewed-on: https://pdfium-review.googlesource.com/37390 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-07-10Fix duplicate symbols in Chromium builds.Lei Zhang
Commit 43f6bc80 copied over Chromium's base/debug/alias.cc, but that confuses Windows builds and Linux jumbo builds in Chromium. To fix this, wrap PDFium's copy in the pdfium namespace. BUG=chromium:860850 TBR=dsinclair@chromium.org Change-Id: I1ceec28b9ce6c2893bf030a5b6564dce6d6ec376 Reviewed-on: https://pdfium-review.googlesource.com/37430 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-09Prevent FX_OutOfMemoryTerminate() from being folded by the linker.Lei Zhang
Copy base::debug::Alias() from Chromium. Use it to prevent ICF from combining FX_OutOfMemoryTerminate() with similar functions. BUG=chromium:860850 Change-Id: Ifccb05c0218f86e44b9bb235847e01383ec36b3f Reviewed-on: https://pdfium-review.googlesource.com/37290 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-09Roll third_party/freetype/src/ 125b84800..b532d7ce7 (64 commits)chromium/3487Lei Zhang
https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/125b84800a32..b532d7ce708c Created with: roll-dep third_party/freetype/src BUG=pdfium:1116 Change-Id: Iff8a96107a8269a9ff653fa24436df5a2d38f19b Reviewed-on: https://pdfium-review.googlesource.com/36830 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-06Fix regression in CJBig2_TRDProc.chromium/3486chromium/3485chromium/3484Lei Zhang
Commit 7695dd0f mistakenly changed a signed integer to unsigned. This is incorrect because right shifts for negative integers behave differently. BUG=chromium:859284 Change-Id: Id9c54848b15ace1de080c174f261dd2c064018e0 Reviewed-on: https://pdfium-review.googlesource.com/37230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-06Maintain a stack of CPDF_ContentMark while parsing a stream.Henrique Nakashima
This avoids copying the CPDF_ContentMark every time a mark is closed. Another benefit is that the same CPDF_ContentMarkItem vector will be shared by page objects before and after a nested mark. Bug: pdfium:1037 Change-Id: I6197f0b9a4693ef84da9269f86a2629aa50d8685 Reviewed-on: https://pdfium-review.googlesource.com/37190 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-06Make MarkData::mMarks a vector of RetainPtr<CPDF_ContentMarkItem>Henrique Nakashima
It is currently a vector of CPDF_ContentMarkItem. Copying MarkData whenever a content mark is opened or closed is inefficient since each MarkData will have copies of the same CPDF_ContentMarkItems. This CL changes the vector inside MarkData to contains only pointers to the CPDF_ContentMarkItems rather than copies of those items. More importantly, this unifies the dictionaries of each content mark. Previously, there were as many copies of those dictionaries as content marks scope changes inside the mark with parameters. Bug: pdfium:1037 Change-Id: Ia6f79b401d4e14ac07dbba81bbd97df965b77c94 Reviewed-on: https://pdfium-review.googlesource.com/37135 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-06Revert "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Henrique Nakashima
This reverts commit 77f15f7883638a4ced131d74c053af10a5970ce9. Reason for revert: Causes crbug.com/860210 Bug: chromium:860210 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I947fca17052765935a952a4f25ca48f6599c4af9 Reviewed-on: https://pdfium-review.googlesource.com/37210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-05Fix integer overflow in CPDF_Type3Cachechromium/3483Nicolas Pena
Bug: chromium:845800 Change-Id: Ib878dd991e435a76b63b662ef3d9d33c2cc61a19 Reviewed-on: https://pdfium-review.googlesource.com/37191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-05Create content mark APIs to get values by key.Henrique Nakashima
Bug: pdfium:1037 Change-Id: Ie887c0bbf3e543676adec6d8411b0b3254677d3c Reviewed-on: https://pdfium-review.googlesource.com/37170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-05Rename CPDF_ContentMark::m_Ref to ::m_pMarkData.Henrique Nakashima
Bug: pdfium:1037 Change-Id: I94efc14ce5f8d0d407853cce025f0184b3866cc4 Reviewed-on: https://pdfium-review.googlesource.com/37134 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-05Delete CPDF_ContentMark::HasRef()Henrique Nakashima
This is called by many client to make sure CountItems() does not crash. Moving the check to CountItems() makes HasRef() unnecessary. Bug: pdfium:1037 Change-Id: I4f21f33a88c9aad54f0dae18a38b370c6ceaec80 Reviewed-on: https://pdfium-review.googlesource.com/37133 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-05Clean up ProcessFormatTestValidateRyan Harrison
The existing implementation was overly complex and hard to understand, so this simplifies the logic. As part of this a number of issues, such as the lack of a failure path, have been resolved. The spec implies that a picture clause of "" should only accept the empty string, but existing implementation returns that validation does exist. This is due to the GetPicture() method returning a string, instead of a pointer or an Optional, so there is no mechanism to differentiate between a clause with an empty string and the clause not being present. This CL maintains the existing behaviour, because there may be code elsewhere that depends on it. The existing implementation returns validation not existing if the node under test is non-interactive. Though this seems intuitively correct, it is problematic, because this logic isn't just called via an interaction with the node. The validity check could be initiated by a call from JS attached to an event or a different node. Thus it is possible for a node under test to be non-interactive, but the result of the test is still important. The caller may make the node interactive if it isn't valid, for example. The spec doesn't state anything about interactivity controlling if validity checks run. This CL removes the related logic, since it was causing issues with an example PDF from the wild. BUG=pdfium:1065 Change-Id: Icb5b97e0d90f6fbc7ad6b87d81e256803c757eb0 Reviewed-on: https://pdfium-review.googlesource.com/37131 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>