summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-05-08Add several FPDFPageObj_* APIschromium/3425Nicolas Pena
This CL adds the following APIs: FPDFPageObj_SetStrokeColor FPDFPageObj_GetStrokeColor FPDFPageObj_SetStrokeWidth FPDFPageObj_SetLineJoin FPDFPageObj_SetLineCap FPDFPageObj_SetFillColor FPDFPageObj_GetFillColor Bug: pdfium:980 Change-Id: I19f9abb6756314ba8bd2f66a6c38e2e722cd8473 Reviewed-on: https://pdfium-review.googlesource.com/32192 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-08Revert "Ensure that XFA Pages always have a corresponding PDF page"Henrique Nakashima
This reverts commit e7207f33f8024b59fc85abb1b4594b0fbab5361b. Reason for revert: Causes crash in some XFA forms - crbug.com/840922 This is a merge, not a clean revert. Original change's description: > Ensure that XFA Pages always have a corresponding PDF page > > The PDF page may be blank, un-numbered, or untracked by CPDF, but > this provides a place for all XFA pages to "extend" from down the > road. > > Change-Id: If1003be0f261154e61e9793ccba7e1f43cd73104 > Reviewed-on: https://pdfium-review.googlesource.com/31771 > Commit-Queue: Tom Sepez <tsepez@chromium.org> > Reviewed-by: dsinclair <dsinclair@chromium.org> Change-Id: Ia7f286321552b225a95f461aa8a6aef979f5c991 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:840922 Reviewed-on: https://pdfium-review.googlesource.com/32210 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-08Mark CPDF_Object pointers as const in CPDF_ViewerPreferences.Lei Zhang
Work up the short call stack and mark FPDF_PAGERANGE as an opaque const pointer. Also fix CPDF_ViewerPreferences::GenericName() to return an optional string. Change-Id: I2356d38888fcff8d4da37dd3efc17b284ff90485 Reviewed-on: https://pdfium-review.googlesource.com/32174 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-08Add APIs to work with a FPDF_PAGERANGE.Lei Zhang
After getting a FPDF_PAGERANGE from FPDF_VIEWERREF_GetPrintPageRange(), one can now use FPDF_VIEWERREF_GetPrintPageRangeCount() to get the number of elements in the FPDF_PAGERANGE. One can then use FPDF_VIEWERREF_GetPrintPageRangeElement() to read the elements. Change-Id: I33eeff9026d01991ae1424e05b67f163245a35f9 Reviewed-on: https://pdfium-review.googlesource.com/32173 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-08Remove almost all usages of CFX_FixedBufGrow with std::vectorNicolas Pena
Tested by running safetynet_compare.py on this patch vs master. The results were 0 regressions and 0 improvements. The two remaining usages cannot be replaced because they would cause a regression. Bug: pdfium:177 Change-Id: I43eddf4ffaac2eb063f2004d6606bc3cd6e627ac Reviewed-on: https://pdfium-review.googlesource.com/32159 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-08Remove PDFTRANS_KNOCKOUT.Lei Zhang
No code actually checks to see if it is set. Change-Id: I37631713d568f116df1c0495ffd7d7d64ddce69a Reviewed-on: https://pdfium-review.googlesource.com/32186 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-08Add constants for PDF 1.7 spec, table 7.2 and 7.3.Lei Zhang
Add constants/transparency.h. The header lists constants from chapter 7 of the PDF spec. BUG=pdfium:1049 Change-Id: I66bd6fceb24807eec9c308e2e47cec3f2f836ffb Reviewed-on: https://pdfium-review.googlesource.com/32177 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-08Add some basic tests for FPDF_VIEWERREF_GetPrintPageRange().Lei Zhang
Hand edit viewer_ref.pdf to have a page range and more pages. Fix an invalid stream length in the file as well. Fix tests that depended on viewer_ref.pdf having only 1 page. Change-Id: I95d5cbf1f592d1c51f11d9ab5b26abf2f23ed598 Reviewed-on: https://pdfium-review.googlesource.com/32172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-08Split CCodec_FlateScanlineDecoder in two.Lei Zhang
Move the predictor code into the CCodec_FlatePredictorScanlineDecoder sub-class. Change-Id: I5a56ba5e051cf55e8fdd039bd38089684ed257be Reviewed-on: https://pdfium-review.googlesource.com/31272 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08Simplify more code in CPDF_TextObject.Lei Zhang
- Move code into a GenerateSpace() function. - Break apart some font size conversions. Change-Id: I4d5ea112fc004a31ac38b7c19ff77fcbfe764d38 Reviewed-on: https://pdfium-review.googlesource.com/32157 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08[fm2js] Create fewer CFX_WideTextBuf classesDan Sinclair
This CL modifies the formcalc transpiler to create less CFX_WideTextBuf classes as we convert to JavaScript. This can take some pathalogical formcal from 20sec to convert to .5sec. Bug: chromium:834575 Change-Id: I428883297bbc3a6a325a4ab0ad51834f2f02ab82 Reviewed-on: https://pdfium-review.googlesource.com/32154 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08[fm2js] Fail transpiling if lexer has left over dataDan Sinclair
If there is remaining data after the lexer has said it's complete then something has gone wrong while lexing the formcalc data. This CL changes the transpiler to return an error in the case of the lexer havign extra data. Bug: chromium:834575 Change-Id: I8a1288a7f01cc69faf2033829d68246d815258de Reviewed-on: https://pdfium-review.googlesource.com/32130 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-08Move CalculatePitch8() to core/fxcodec.Lei Zhang
Use it in more places there. Change-Id: I477670a5946ec9033ad5f2bef0fbcddb52682066 Reviewed-on: https://pdfium-review.googlesource.com/31271 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08Rename CPDF_Document::GetPage() to GetPageDictionary().Tom Sepez
Avoids a conflict should we wish to have the document actually track pages, with a GetPage() that returns CPDF_Page. Do the same thing to CPDF_DataAvail along the way. Add some missing consts as well. Change-Id: I2cb2213cc4c0649662fceab80407ee4a3f4cf30e Reviewed-on: https://pdfium-review.googlesource.com/32158 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-08Make one more CPDF_PageObjectHolder member protected.Lei Zhang
Change-Id: Id9288d504f063759f69632ab59b0a21569ff76d8 Reviewed-on: https://pdfium-review.googlesource.com/32113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Make more CPDF_PageObjectHolder members protected.Lei Zhang
Change-Id: Id31b9f6ac33971c47cdb378ff7f9ca7d33f899b9 Reviewed-on: https://pdfium-review.googlesource.com/32112 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Make CPDF_PageObjectHolder::m_iTransparency protected.Lei Zhang
Also initialize members in the header. Change-Id: Id814c4c5042c9d4989fa92b78f68c17f4949f09d Reviewed-on: https://pdfium-review.googlesource.com/32111 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Add some getters for CPDF_PageObjectHolder.Lei Zhang
Change-Id: I3fe99ecb17d37f893ce5d0d59219c82ee31fe7ea Reviewed-on: https://pdfium-review.googlesource.com/32110 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Restore logic of CreateChildUIAndValueNodesIfNeeded().Henrique Nakashima
CreateUIChild() was changed and renamed to CreateChildUIAndValueNodesIfNeeded() in: https://pdfium-review.googlesource.com/c/pdfium/+/24390 This caused some bugs but it's too far back for a rollback. This cl restores the logic of CreateUIChild() keeping the new signature. Bug: chromium:838994 Change-Id: I44ce741fdb90f8b0fd11379b5e881e376c307f0c Reviewed-on: https://pdfium-review.googlesource.com/32090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-07Move codepage tables from cpdf_document.cpp to fx_codepage.cppTom Sepez
Avoids scrolling past this noise when looking at document code. No functional changes. Change-Id: I4684a8cf4d8894c699cd1c980bc5fc41b2179ad1 Reviewed-on: https://pdfium-review.googlesource.com/32156 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Use unowned ptr for CPDF_Page::m_pView.Tom Sepez
Change-Id: I9d87cefc18a3a468e1bec797bc7711194f6444c7 Reviewed-on: https://pdfium-review.googlesource.com/32155 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-07Move some CPDF_TextPage methods into an anonymous namespace.Lei Zhang
Change-Id: I959d687d7d46fa61e1fe097b0b876ad02d2b123c Reviewed-on: https://pdfium-review.googlesource.com/32153 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-07Initialize CPDF_RenderStatus members in the header.Lei Zhang
Also move static private members into the .cpp file. Change-Id: Idbbdc7c78ac4199968888466caa20c58a5653dfd Reviewed-on: https://pdfium-review.googlesource.com/32151 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-07Initialize CPDF_TextPage members in the header.Lei Zhang
Change-Id: I667a3cd696d44692fa3d73bdee7c2f48d3039255 Reviewed-on: https://pdfium-review.googlesource.com/32152 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-07Ensure that XFA Pages always have a corresponding PDF pageTom Sepez
The PDF page may be blank, un-numbered, or untracked by CPDF, but this provides a place for all XFA pages to "extend" from down the road. Change-Id: If1003be0f261154e61e9793ccba7e1f43cd73104 Reviewed-on: https://pdfium-review.googlesource.com/31771 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07Add test for mutltiple copies of same PDF page.Tom Sepez
Shows that under non-XFA, we hand out a new FPDF_PAGE on each call, but under XFA we hand out the same FPDF_PAGE and ref-count it under the covers. Change-Id: I47cd28c65faed90cf425bbc920e1b56b1e4676a8 Reviewed-on: https://pdfium-review.googlesource.com/32057 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-07Use checked large integer in ContinueQuickStretchchromium/3424Ryan Harrison
This existing code has the potential for an integer overflow in it. When overflow occurs in this function scaling may partially succeed. This is due to how out of range values are being clamped, which implicitly swallows the overflow. This CL changes the calculation to be performed in a 64-bit space and then attempts to down cast it back to 32-bit space at the end. Because there are multiple steps it is possible for an intermediate value to cause an overflow in 32 bit space, but the final value to be valid. If the downcast is not possible then the stretch operation is failed. An existing test case has been updated, since it encoded an incorrect result. BUG=chromium:839245 Change-Id: I637cc1e2d6c6c2d5394599104f76352c20ead021 Reviewed-on: https://pdfium-review.googlesource.com/32056 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-07Mark parts of CJS_EventHandler as private.Lei Zhang
Also change Initial() to Initialize(). Change-Id: Ic63ee1cace0012ad570db25447ced752bddd7f86 Reviewed-on: https://pdfium-review.googlesource.com/28150 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-07[xml] Move members to method variables in CFX_XMLParserDan Sinclair
This CL moves several of the member variables to CFX_XMLParser::DoSyntaxParse as they are only used in that method. The names of the members have been updated to make their usage clearer. Change-Id: I460f2bad0181ece278752bd8d93d6bf63dc6d70a Reviewed-on: https://pdfium-review.googlesource.com/32050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-04Check CJBig2_Image is valid before filling.chromium/3423chromium/3422chromium/3421Lei Zhang
Skip a lot of work that will all fail anyway. BUG=chromium:838347 Change-Id: Iba45120e436b5547e106feb27dadea92cc948258 Reviewed-on: https://pdfium-review.googlesource.com/32053 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-03Invalidate GIF input buffer when moving file cursor backwardschromium/3420chromium/3419Ryan Harrison
The current implementation of the GIF codec does not handle the file cursor moving backwards correctly. Specifically the input buffer that the data is being read into is not invalidated, so if the entirity of the buffer hasn't been consumed, a chunk of it will be moved to the front before reading in more data, which is just incorrect. Additionally, depending on the specific series of operations, it is possible that the buffer was allocated for more space then had been read into it and the uninitialized portion at the end is being copied to the beginning. The file cursor may move backwards when dealing with an animated gif or other image with multiple frames, since all of the control data is read in on load, and future calls specify what frame to fetch. The code has been changed to treat the input buffer as invalid when moving the cursor to a frame location, which will bypass any of the problematic unused saving behaviour. A call to std::min has been added to prevent allocation of an input buffer larger then the file size. Additionally this CL refactors GifReadMoreData to be clearer about what calculations are occuring, since the existing code reuses a number of vaguely named variables, making it difficult to follow. BUG=chromium:839348, chromium:839361 Change-Id: I2865658187bdf30bcad13ef4cac4f51a8966db11 Reviewed-on: https://pdfium-review.googlesource.com/32054 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-03Prove that the memory was good at FPDFBitmap_CreateEx() create time.Tom Sepez
Diagnostic for the associated bug, not a bugfix. Helps rule out one possible scenario. Bug: chromium:838886 Change-Id: Ia56fda779407daf8e52a8b754800154fd7491ae7 Reviewed-on: https://pdfium-review.googlesource.com/32055 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-03Use pointers instead of refs in CXFA_TextLayout params.Henrique Nakashima
Change-Id: Iaca5983f080d8a05d2d4e9f79c335c4ebcdc6899 Reviewed-on: https://pdfium-review.googlesource.com/31994 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-03[xfa] Verify we can get a font manager before setting up XFADan Sinclair
When setting up an XFA document we need to create a font manager. That font manager requires the CFGAS_FontMgr to be provided, and ASSERTs to that fact. It's possible for the CFGAS_FontMgr to be nullptr if we fail to enumerate the system fonts. This CL verifys we can get the needed manager and fails out of the XFA OpenDoc method if we have no font manager. Bug: chromium:835693 Change-Id: I806f265075dcc355e0a7aeb4b3ae8eb950aa5eee Reviewed-on: https://pdfium-review.googlesource.com/32052 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-03[xfa] Verify field count before accessingDan Sinclair
When processing items for layout it's possible for the iBlockIndex*3 value could be larger then the field split count. If this is the case we'll walk off the end of the split array. This CL verifys that we have enough data before attempting to walk the splits and returns early if we don't have enough data. Bug: chromium:837585 Change-Id: I534298b4ee354ce079442d893202f811431155a0 Reviewed-on: https://pdfium-review.googlesource.com/32051 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-03Use strict types in FPDF API, try #3Tom Sepez
Rather than messing with actual inheritence, add type-checking wrappers and just blatantly cast to incomplete types. Along the way, this points out places where we would downcast without checking, which I fix. Change-Id: Ieb303eb46ad8522dfe082454f1f10f247ffd52d5 Reviewed-on: https://pdfium-review.googlesource.com/32030 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-03Add CPDF_Page::Extension::GetDocExtension()Tom Sepez
In turn, add CPDF_Document::Extension::GetPDFDoc() so that we can use the abstract return type in more places. Mark an internal-only cpdfxfa_context method as private while we're at it. Change-Id: I08e64f4b9438bf2f731c3a37cf2a41152bbbd8fa Reviewed-on: https://pdfium-review.googlesource.com/31916 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-03Make GetPDFDocument return a CPDF_Docment*, not void*.Tom Sepez
Small oversight. Gets type safety. Change-Id: I669c2c990fdf9013f4bc4835738132ed76e734b8 Reviewed-on: https://pdfium-review.googlesource.com/31991 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-02Use pointer instead of ref for XFA_RectWithoutMargin param.chromium/3418Henrique Nakashima
Removed many null checks since XFA_RectWithoutMargin already checks if the margin is null internally. Change-Id: I21f5101fe38559eb02f4c3aaf081ff29ce293e47 Reviewed-on: https://pdfium-review.googlesource.com/31993 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Use pointer instead of ref for CXFA_Box::GetPathArcOrRounded param.Henrique Nakashima
Change-Id: I1bfada610b8bf2e1f8e0f79a9421db9ebedc7311 Reviewed-on: https://pdfium-review.googlesource.com/32010 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Use pointers instead of refs for GetPopupPos() params.Henrique Nakashima
Change-Id: Ic19b91f91f08b1867437b22de04a2c54045ce8ae Reviewed-on: https://pdfium-review.googlesource.com/31992 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Convert hand rolled buffer reader in CFX_MemoryStreamRyan Harrison
BUG=pdfium:1007 Change-Id: Ib8aecf2e4833f22a4288f6e1381edc11d114c865 Reviewed-on: https://pdfium-review.googlesource.com/31952 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-02Transform in/out params from ref to pointer in CFX_(Txt|RTF)Break.Henrique Nakashima
Remove some default parameters while we're at it. Change-Id: Ifa51f580d9773ca9cf8d08016361a0283b2d4794 Reviewed-on: https://pdfium-review.googlesource.com/31953 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Transform in/out params from reference to pointer in CFDE_TextOut.Henrique Nakashima
Change-Id: I192f2d0f5e0d61ff09d2e32bafa4e7518573e14e Reviewed-on: https://pdfium-review.googlesource.com/31951 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-02[xml] Simplify the CFX_XMLParser parse methodsDan Sinclair
This CL moves the switch from CFX_XMLParse::Parse into CFX_XMLParser::DoSyntaxParse. This means all the work to build the tree is now done in one place instead of spread between the two methods. Change-Id: Ie9c6cd67795c3fcbd3e305187a06cd727d386a7c Reviewed-on: https://pdfium-review.googlesource.com/31950 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-02[xml] Rename CFX_XMLParser::ParseTextCharDan Sinclair
This CL renames ParseTextChar to ProcessTextChar to make the usage clearer. The method does not do any parsing, it just decides if the char is part of an entity or not. Change-Id: I9b70a82a421b02e2352cd07bd88b1e581d8578b7 Reviewed-on: https://pdfium-review.googlesource.com/31930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-02CFWL_MonthCalendar::GetTodayText() includes "Today" string.Henrique Nakashima
All usages were prepending the "Today" string, so move it inside GetTodayText(). Change-Id: I454fb683c9507e76b61bf69ca29a0ee9b49f1a58 Reviewed-on: https://pdfium-review.googlesource.com/31970 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Pass DPI as CFX_Size in XFA_DrawImage.Henrique Nakashima
Change-Id: Ifbcb727402c1c28a6e8abe02511d6da6828c02f7 Reviewed-on: https://pdfium-review.googlesource.com/31915 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Cleanup XFA document properly on failed loadDan Sinclair
When we fail to parse an XFA document we would free the XML document that is created immediately. This causes issues because the XML nodes may have been set into the CXFA_Document already. This CL changes ParseDoc to always save the XMLDocument and then triggers the CloseDoc() logic if the ParseDoc method fails. This should properly cleanup any resources on a failed document load. Bug: chromium:837578 Change-Id: I8af7e6e34e3b756455c58ea50b22af414ffa6cbf Reviewed-on: https://pdfium-review.googlesource.com/31710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Add a CFX_XMLDocument class.Dan Sinclair
This CL adds a CFX_XMLDocument to act as the XML node container. All nodes are now owned by the document and the document is returned by the CFX_XMLParser. Classes which parse XML files now store the document instead of the root node. BUG: chromium:835636 Change-Id: I1e07d6115cf14714911d6fd4c3fa920c94fd5faf Reviewed-on: https://pdfium-review.googlesource.com/31313 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>