summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
AgeCommit message (Collapse)Author
2018-04-16Add CXFA_XMLLocale unittestsdan sinclair
This CL adds unittests for the CXFA_XMLLocale class. Change-Id: I1a610754933e5f33e87cb4c13b9bf540e366e6ed Reviewed-on: https://pdfium-review.googlesource.com/30692 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-13Hide XML parsing inside CXFA_XMLLocaledan sinclair
This CL moves the parsing of the XML document into a static method of CXFA_XMLLocale. This removes the need for CXFA_LocaleMgr to care about the XML parser used. Change-Id: I04d14d78f458bfb37f0370fac2eb752e9840bfd6 Reviewed-on: https://pdfium-review.googlesource.com/30390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-13Move SharedForm check to CPDF_Metadata classdan sinclair
This CL moves code related to shared form detection into the CPDF_Metadata class. This allows us to hide the usage of CXML inside CPDF_Metadata. Change-Id: I547471a2bcc119221565c415a58211c1500cbb3c Reviewed-on: https://pdfium-review.googlesource.com/30370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Make CFX_XMLInstruction a subclass of CFX_XMLNodedan sinclair
The CFX_XMLInstruction handles the <?blah?> blocks at the top of an XML file. It was inheriting from CFX_XMLAttributeNode in order to store the tag name. This CL moves the tag name into CFX_XMLInstruction and subclasses from CFX_XMLNode. Change-Id: I8f7ff0dde19ed43b46d095b0d45df4bf06875af5 Reviewed-on: https://pdfium-review.googlesource.com/30490 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12Return pdfium::span<wchar_t> from WideString::GetBuffer().Tom Sepez
Adds bounds checking "for free", but beware of span outliving a ReleaseBuffer() call. Scoping as such avoids the possibility of using an invalid span (and it is flagged as a lifetime issue). Change-Id: Ica63f4b1429823d0254ec6951aeaeb08160cb93c Reviewed-on: https://pdfium-review.googlesource.com/30310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-12Remove CXFA_DocumentParser::m_bDocumentParser flagDan Sinclair
This CL removes the import data behaviour as it was never called and cleans up the m_bDocumentParser flag as it will always be used in the true case. Change-Id: If90a0a55cc76f406e9987aa71580e90edeaa01ba Reviewed-on: https://pdfium-review.googlesource.com/30292 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Remove CFX_XMLDoc and call the parser directlyDan Sinclair
This CL removes the CFX_XMLDoc and calls the CFX_XMLParser directly from CXFA_DocumentParser. Change-Id: I4d715cca90cd15b5e1d79827e0bb2781e873e371 Reviewed-on: https://pdfium-review.googlesource.com/30251 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Rename CXFA_SimpleParser to CXFA_DocumentParserDan Sinclair
The CXFA_SimpleParser is handling the XFA document parsing. This CL renames the class to make it clearer that this is the XFA document parser. Change-Id: Ia290df2671fba9efa221ae997156ee4846749b02 Reviewed-on: https://pdfium-review.googlesource.com/30231 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Fold CXFA_DocumentParser into CXFA_FFDocDan Sinclair
The CXFA_DocumentParser is a thin wrapper around CXFA_SimpleParser. This CL folds CXFA_DocumentParser into a ParseDoc method of CXFA_FFDoc. Change-Id: I7e7073899436f0435c4ebfd548241ae842a2a276 Reviewed-on: https://pdfium-review.googlesource.com/30213 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Retrieve the XML tree in the DocumentParserDan Sinclair
This CL changes the document parser to store the parsed XML tree. That way we no longer need to store the pointer to the CXFA_SimpleParser in the CXFA_DocumentParser. Change-Id: I9272150e73613411cb1bb59c3cf77c7af6cc799d Reviewed-on: https://pdfium-review.googlesource.com/30211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Allow retrieving the XML tree from the CFX_XMLDocDan Sinclair
This CL allows the CXFA_SimpleParser to retrieve the XML tree from the CFX_XMLDoc. This way, we don't have to keep the doc around and can store the pointer to the tree in the CXFA_SimpleParser. Change-Id: I5b478acbe61e6f1ca5fa04d03133a2b327a0cb1c Reviewed-on: https://pdfium-review.googlesource.com/30210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Cleanup some CFX_XMLParser codeDan Sinclair
This CL cleans up minor nits in the CFX_XMLParser code. Change-Id: Ie19d12d3dcce16c9ce6088160ecdec3d9855c11f Reviewed-on: https://pdfium-review.googlesource.com/30170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12[xfa] Remove form checksum abilitiesDan Sinclair
This CL removes the code for verifying and creating checksums associated with form elements in XFA documents. This was the only code requiring the SAXReader which has also been removed. According to the XFA spec and application can decide which parts of the signatures are supported. This feature is being removed until we determine if/when it is needed. Bug: pdfium:1063 Change-Id: Iec2261282340f8fc72a1225d2e0d3e6ddf05edcb Reviewed-on: https://pdfium-review.googlesource.com/30150 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-10Merge CXFA_SimpleParser::{Start|Do}Parsechromium/3394Dan Sinclair
The StartParse and DoParse methods have been merged into a single Parse method. Change-Id: I1310bda90b853c11af8b8d1794de6b5c19e931cf Reviewed-on: https://pdfium-review.googlesource.com/30010 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-09Merge CXFA_DocumentParser::{Start|Do}Parse methodsDan Sinclair
This CL combines the StartParse and DoParse methods of CXFA_DocumentParser into a single Parse method since they are always called together. Change-Id: I45f38b2730f47c4719ca4f54c32ee8db6f11470d Reviewed-on: https://pdfium-review.googlesource.com/29991 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-09Revert "Remove CXFA nodes instead of CFX_XML nodes"dsinclair
This reverts commit 2b4ad9ff5bf1727d12ef2bcce7e3fa925bbe8978. Reason for revert: Causing crashes on windows: Rendering PDF file E:\b\build\slave\windows_xfa\build\pdfium\out\debug_xfa_v8\gen\pdfium\testing\pixel\static_list_box_caption.pdf. ==== C stack trace =============================== diff: 0.00% passed std::tuple<CXFA_Node * __ptr64 const & __ptr64>::tuple<CXFA_Node * __ptr64 const & __ptr64> [0x0000000141785700+48] ??@875fbed02c72fe689afc0ad24a247bf8@ [0x000000013F7BB443+131] ??$_Buynode@AEBUpiecewise_construct_t@std@@V?$tuple@AEBQEAVCXFA_Node@@@2@V?$tuple@$$V@2@@?$_Tree_comp_alloc@V?$_Tmap_traits@PEAVCXFA_Node@@V?$unique_ptr@V?$map@IV?$unique_ptr@U?$pair@V?$set@PEAVCXFA_Node@@U?$less@PEAVCXFA_Node@@@std@@V?$allocator@PEAVCXFA [0x0000000141785309+169] ??@2b14910fe4cc3866ca68e10bfed05253@ [0x000000013F7CCB09+185] CJX_Object::SetAttributeValue [0x000000013FAE0F7E+302] v8::internal::compiler::Int64Lowering::LowerNode [0x000000013FBB04C0+31920] CXFA_Document::DataMerge_CopyContainer [0x00000001417A43A3+9603] CXFA_Document::DataMerge_CopyContainer [0x00000001417A2048+552] CXFA_Document::DataMerge_CopyContainer [0x00000001417A3436+5654] CXFA_Document::DataMerge_CopyContainer [0x00000001417A1FEE+462] CXFA_Document::DoDataMerge [0x00000001417A5F96+3142] CXFA_FFDocView::StartLayout [0x00000001416BECCD+93] CPDFXFA_Context::LoadXFADoc [0x000000014169162D+669] FPDF_LoadXFA [0x0000000140AC5A2A+42] std::_Compressed_pair<std::default_delete<CFWL_WidgetProperties>,CFWL_WidgetProperties * __ptr64,1>::_Get_first [0x000000013F72A648+1432] main [0x000000013F727C05+1685] invoke_main [0x0000000141CDB924+52] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:79) __scrt_common_main_seh [0x0000000141CDB817+295] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283) __scrt_common_main [0x0000000141CDB6DE+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:326) mainCRTStartup [0x0000000141CDB9B9+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17) BaseThreadInitThunk [0x0000000077415A4D+13] RtlUserThreadStart [0x000000007764B831+33] Rendering PDF file E:\b\build\slave\windows_xfa\build\pdfium\out\debug_xfa_v8\gen\pdfium\testing\pixel\resolve_nodes.pdf. ==== C stack trace =============================== std::tuple<CXFA_Node * __ptr64 const & __ptr64>::tuple<CXFA_Node * __ptr64 const & __ptr64> [0x0000000141785700+48] ??@875fbed02c72fe689afc0ad24a247bf8@ [0x000000013F7BB443+131] ??$_Buynode@AEBUpiecewise_construct_t@std@@V?$tuple@AEBQEAVCXFA_Node@@@2@V?$tuple@$$V@2@@?$_Tree_comp_alloc@V?$_Tmap_traits@PEAVCXFA_Node@@V?$unique_ptr@V?$map@IV?$unique_ptr@U?$pair@V?$set@PEAVCXFA_Node@@U?$less@PEAVCXFA_Node@@@std@@V?$allocator@PEAVCXFA [0x0000000141785309+169] ??@2b14910fe4cc3866ca68e10bfed05253@ [0x000000013F7CCB09+185] CJX_Object::SetAttributeValue [0x000000013FAE0F7E+302] v8::internal::compiler::Int64Lowering::LowerNode [0x000000013FBB03F6+31718] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A48DA+1066] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A4ED8+2600] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A4ED8+2600] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A4ED8+2600] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A4ED8+2600] CXFA_Document::DataMerge_UpdateBindingRelations [0x00000001417A4512+98] CXFA_Document::DoDataMerge [0x00000001417A5FF8+3240] CXFA_FFDocView::StartLayout [0x00000001416BECCD+93] CPDFXFA_Context::LoadXFADoc [0x000000014169162D+669] FPDF_LoadXFA [0x0000000140AC5A2A+42] std::_Compressed_pair<std::default_delete<CFWL_WidgetProperties>,CFWL_WidgetProperties * __ptr64,1>::_Get_first [0x000000013F72A648+1432] main [0x000000013F727C05+1685] invoke_main [0x0000000141CDB924+52] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:79) __scrt_common_main_seh [0x0000000141CDB817+295] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283) __scrt_common_main [0x0000000141CDB6DE+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:326) mainCRTStartup [0x0000000141CDB9B9+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17) BaseThreadInitThunk [0x0000000077415A4D+13] RtlUserThreadStart [0x000000007764B831+33] FAILURE: static_list_box_caption.pdf; Command '['E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\pdfium_test.exe', '--send-events', '--png', '--md5', 'E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\gen\\pdfium\\testing\\pixel\\static_list_box_caption.pdf']' returned non-zero exit status -1073741819 Rendering PDF file E:\b\build\slave\windows_xfa\build\pdfium\out\debug_xfa_v8\gen\pdfium\testing\pixel\standard_symbols.pdf. ==== C stack trace =============================== std::tuple<CXFA_Node * __ptr64 const & __ptr64>::tuple<CXFA_Node * __ptr64 const & __ptr64> [0x0000000141785700+48] FAILURE: resolve_nodes.pdf; Command '['E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\pdfium_test.exe', '--send-events', '--png', '--md5', 'E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\gen\\pdfium\\testing\\pixel\\resolve_nodes.pdf']' returned non-zero exit status -1073741819 ??@875fbed02c72fe689afc0ad24a247bf8@ [0x000000013F7BB443+131] ??$_Buynode@AEBUpiecewise_construct_t@std@@V?$tuple@AEBQEAVCXFA_Node@@@2@V?$tuple@$$V@2@@?$_Tree_comp_alloc@V?$_Tmap_traits@PEAVCXFA_Node@@V?$unique_ptr@V?$map@IV?$unique_ptr@U?$pair@V?$set@PEAVCXFA_Node@@U?$less@PEAVCXFA_Node@@@std@@V?$allocator@PEAVCXFA [0x0000000141785309+169] ??@2b14910fe4cc3866ca68e10bfed05253@ [0x000000013F7CCB09+185] CJX_Object::SetAttributeValue [0x000000013FAE0F7E+302] v8::internal::compiler::Int64Lowering::LowerNode [0x000000013FBB04C0+31920] CXFA_Document::DataMerge_CopyContainer [0x00000001417A43A3+9603] CXFA_Document::DataMerge_CopyContainer [0x00000001417A2048+552] CXFA_Document::DataMerge_CopyContainer [0x00000001417A3436+5654] CXFA_Document::DataMerge_CopyContainer [0x00000001417A1FEE+462] CXFA_Document::DoDataMerge [0x00000001417A5F96+3142] CXFA_FFDocView::StartLayout [0x00000001416BECCD+93] CPDFXFA_Context::LoadXFADoc [0x000000014169162D+669] FPDF_LoadXFA [0x0000000140AC5A2A+42] std::_Compressed_pair<std::default_delete<CFWL_WidgetProperties>,CFWL_WidgetProperties * __ptr64,1>::_Get_first [0x000000013F72A648+1432] main [0x000000013F727C05+1685] invoke_main [0x0000000141CDB924+52] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:79) __scrt_common_main_seh [0x0000000141CDB817+295] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283) __scrt_common_main [0x0000000141CDB6DE+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:326) mainCRTStartup [0x0000000141CDB9B9+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17) BaseThreadInitThunk [0x0000000077415A4D+13] RtlUserThreadStart [0x000000007764B831+33] FAILURE: standard_symbols.pdf; Command '['E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\pdfium_test.exe', '--send-events', '--png', '--md5', 'E:\\b\\build\\slave\\windows_xfa\\build\\pdfium\\out\\debug_xfa_v8\\gen\\pdfium\\testing\\pixel\\standard_symbols.pdf']' returned non-zero exit status -1073741819 Original change's description: > Remove CXFA nodes instead of CFX_XML nodes > > When we set data into the CJX nodes, we need to update the backing store > of the XFA nodes, which are the XML nodes. When we update the backing > store, there are cases where we need to remove the children (setting > CData on a node or setting the value of an Attribute which is backed by > a real node). > > Currently we call DeleteChildren on the XML node. This causes issues > when we cleanup the tree as XFA nodes may point to these deleted XML > nodes. > > Instead, this CL cleans up the XFA nodes which will in turn clean up the > XML nodes. This seems like the right thing to do as we no longer have > the backing nodes, so we should no longer have the XFA nodes on top of > them. > > Bug: chromium:813155 > Change-Id: I63d53fd56999ec9d3b3af2ab5952b374663f040c > Reviewed-on: https://pdfium-review.googlesource.com/29950 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> TBR=thestig@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: Ic6b2fbeb9f8217292da0a722e143d96f9972056a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:813155 Reviewed-on: https://pdfium-review.googlesource.com/29974 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-09Move the CFX_XMLParser out of CXFA_SimpleParserDan Sinclair
This CL removes the CFX_XMLParser from CXFA_SimpleParser and constructs it in the CFX_XMLDoc. Change-Id: Id69b396f091892170a4c4654ac1d0fd65d1efbb6 Reviewed-on: https://pdfium-review.googlesource.com/29970 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-09Remove CXFA nodes instead of CFX_XML nodesDan Sinclair
When we set data into the CJX nodes, we need to update the backing store of the XFA nodes, which are the XML nodes. When we update the backing store, there are cases where we need to remove the children (setting CData on a node or setting the value of an Attribute which is backed by a real node). Currently we call DeleteChildren on the XML node. This causes issues when we cleanup the tree as XFA nodes may point to these deleted XML nodes. Instead, this CL cleans up the XFA nodes which will in turn clean up the XML nodes. This seems like the right thing to do as we no longer have the backing nodes, so we should no longer have the XFA nodes on top of them. Bug: chromium:813155 Change-Id: I63d53fd56999ec9d3b3af2ab5952b374663f040c Reviewed-on: https://pdfium-review.googlesource.com/29950 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-09Move code to set XML value to CXFA_NodeDan Sinclair
This CL moves the code to set the XML node data from CJX_Node to CXFA_Node. The XML node is owned by the XFA node, not the CJX node so it makes more sense to have the modifications happen there. This combines the duplicate code in CJX_Node into a single SetToXML method. Bug: chromium:813155 Change-Id: I493725d1412688cb1a0d04bd9ae9fa5a36caebf3 Reviewed-on: https://pdfium-review.googlesource.com/29858 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-05Make CXFA_Document::m_rgGlobalBinding privateDan Sinclair
This CL moves the two accessor functions from being in an anonymous namespace to being public and makes the member itself private. Change-Id: Idd5dd1e6cc617d0be0fdd57ceace2dbc684a8b00 Reviewed-on: https://pdfium-review.googlesource.com/29856 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-05Remove unused param.Dan Sinclair
This CL removes the unused CXFA_Document param from various anonymous namespace methods in CXFA_Document. Change-Id: Ic10b4d2830936091da4db0919b33c16875cbd427 Reviewed-on: https://pdfium-review.googlesource.com/29853 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-05Move document data merge code into CXFA_Document fileDan Sinclair
This CL moves the CXFA_Document methods from xfa_document_datamerger_imp into the cxfa_document.cpp file. Change-Id: Idcb0696d2488bff5a4882675b3b876e0ec9e38bb Reviewed-on: https://pdfium-review.googlesource.com/29851 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-04Fix XFA caret blinking only while mouse moves.chromium/3389Henrique Nakashima
Currently rect invalidations in XFA are only sent to the embedder only when RunInvalidate() is executed. For things which redraw on a timer, such as the caret, there was no user event to call RunInvalidate() so the page would not redraw. This CL changes the XFA code to send the invalidations to the embedder immediately and expects the embedder to combine the invalidations to limit overdraw. Bug: chromium:828561 Change-Id: I298052fd7d0c373b029eec191cc6c74c63978348 Reviewed-on: https://pdfium-review.googlesource.com/29670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-27Cleanup CXFA_LocaleMgrDan Sinclair
This CL cleans up code for the CXFA_LocaleMgr class. Change-Id: I4a3c9394be021d6605dadd8003c7619b19bb9fc0 Reviewed-on: https://pdfium-review.googlesource.com/29250 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-21Rename one ArgbEncode() variant to AlphaAndColorRefToArgb().Lei Zhang
Mark the other ArgbEncode() variant as constexpr. Change-Id: I84207d805766e5efc669638bd8a15cfead356a41 Reviewed-on: https://pdfium-review.googlesource.com/28577 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-20Change ArgbToColorRef() to ArgbToAlphaAndColorRef().chromium/3377Lei Zhang
Since that is what it really returns. Add a replacement ArgbToColorRef() that only returns a FX_COLORREF, and remove a duplicate implementation. Then update callers and only use ArgbToAlphaAndColorRef() where appropriate. Also update comments to explain what FX_COLORREF is. Change-Id: I5ed3d71683898dc2b3a66395dea0ec2562c14a68 Reviewed-on: https://pdfium-review.googlesource.com/28575 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-15Rename FX_COLORREF variables from "rgb" to "bgr".Lei Zhang
FX_COLORREF should work like win32 COLORREF, which is BGR. Change-Id: I9f8bb3e2d30a64dc822ac6b8c46130358a03678a Reviewed-on: https://pdfium-review.googlesource.com/28574 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-12Remove all usages of FXSYS_iswASCIIspacechromium/3369Ryan Harrison
This replaces it with FXSYS_iswspace, which uses ICU to perform correct Unicode space checking. BUG=pdfium:1035 Change-Id: I7a4ed01a6b50f56a6f9d1434a7f0b01596fe42db Reviewed-on: https://pdfium-review.googlesource.com/28510 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-03-09Explicitly mark helper methods that only operate on ASCII rangesRyan Harrison
A number of our character helper methods take in wide character types, but only do tests/operations on the ASCII range of characters. As a very quick first pass I am renaming all of the foot-gun methods to explictly call out this behaviour, while I do a bigger cleanup/refactor. BUG=pdfium:1035 Change-Id: Ia035dfa1cb6812fa6d45155c4565475032c4c165 Reviewed-on: https://pdfium-review.googlesource.com/28330 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-06Rename core/fxcrt IFX files to IfaceDan Sinclair
This CL renames the 3 IFX files in core/fxcrt to Iface instead. Change-Id: I7cee6836650b71bc5c5729a8147fda62f0910fe3 Reviewed-on: https://pdfium-review.googlesource.com/27970 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-26Shrink some tables and kill dead code in xfa.Tom Sepez
Change-Id: Ic1260417e7d1475dd518655b2ab08f0184955d88 Reviewed-on: https://pdfium-review.googlesource.com/27170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-26Add some more missing consts.chromium/3356Tom Sepez
Get things out of the .data section. Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683 Reviewed-on: https://pdfium-review.googlesource.com/27130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-16Fix fallthroughs in XFA code.chromium/3350Henrique Nakashima
Change-Id: I1fd4bf85cd709de1c14ed2895d045018f79bc61f Reviewed-on: https://pdfium-review.googlesource.com/26950 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-15Make the CFX_XMLNode a MaybeOwned pointerDan Sinclair
This CL removes the HasOwnXML flag from the CXFA_Node objects and instead uses a MaybeOwned pointer to keep track of the XML nodes. Change-Id: Ie678258247ec21ecb15c639647b189e140586d25 Reviewed-on: https://pdfium-review.googlesource.com/26811 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Set node to owning elementDan Sinclair
When the document creates anew data root element it assigns it into the CXFA_Node but fails to set that node as owing the XML node. The XML node is never inserted into another XML tree so it ends up being leaked. This CL sets the CXFA_Node to own the XML data tree node so it will be cleaned up properly. Bug: chromium:807863 Change-Id: I72a1b8f7b1f1a50bf7139d8bd0ecc8e504ccfc91 Reviewed-on: https://pdfium-review.googlesource.com/26790 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup some CXFA_Node flags and methods.Dan Sinclair
This CL removes one unused flag and inlines the check for if the node has an owned XML node. Change-Id: Id750192b37f09901a81e2faaa929a81d2262d4c7 Reviewed-on: https://pdfium-review.googlesource.com/26770 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup CXFA_Node::SetFlagDan Sinclair
The SetFlag method has a signature of (flag, bool) which, looking at the callsites makes you think it will set the flag to the boolean. This isn't what happens, the flag is always set to true and the boolean decides if we execute some notification code. This CL splits SetFlag into SetFlag(flag) and SetFlagAndNotify(flag) to make it a lot clearer what is happening. Change-Id: I3e067c87532cce10b94bda10cc88feb62b948eb0 Reviewed-on: https://pdfium-review.googlesource.com/26750 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-14Cleanup CXFA_Document const-nessDan Sinclair
This CL marks methods const where possible and removes redundant methods from CXFA_Document. Change-Id: I34804425469dfd52469daba68f64a4b511e5d4d0 Reviewed-on: https://pdfium-review.googlesource.com/26730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-13Add last_child to CFX_XMLNodeDan Sinclair
This CL adds the list_child_ member into CFX_XMLNode to keep it consistent with other tree's in the system. Change-Id: I2e64f11fb9c7df40dd3467edcce177fc492d2cd2 Reviewed-on: https://pdfium-review.googlesource.com/26670 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Split CFX_XMLNode::SaveXMLNode apartDan Sinclair
This CL removes the switch from SaveXMLNode and moves the required code into override methods in the child classes. The method is renamed from SaveXMLNode to just Save. Change-Id: I2011b80525e99635c573b4e0cf977e94f6b7cea6 Reviewed-on: https://pdfium-review.googlesource.com/26590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Cleanup CFX_XMLNode pointersDan Sinclair
This CL cleans up hte CFX_XMLNode pointers. Each pointer has been renamed to make the usage clearer, the NodeItems method has been removed in favour of distinct accessors and the node pointers have been made private. Change-Id: I5459a77a0ae93b08741a0cd59266ef9c81ddad75 Reviewed-on: https://pdfium-review.googlesource.com/26550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CFX_XMLDoc::SaveXMLNodeDan Sinclair
The CFX_XMLDoc::SaveXMLNode method is almost an exact copy of the CFX_XMLNode::SaveXMLNode. This CL removes the XMLDoc variant and calls the XMLNode method directly. This Removes the need to pass the CXFA_DocumentParser into CXFA_Document and we can instead pass in the CXFA_FFNotify object directly. Change-Id: Ic3c8c66375483fe73b44dd84064a1b71b039d61c Reviewed-on: https://pdfium-review.googlesource.com/26530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CFX_XMLNode and friendschromium/3347Dan Sinclair
This CL removes unused methods from CFX_XMLNode, adds an AppendChild to handle the case of a -1 index to InsertChildNode, removes the InsertChildNode return value which is unused and cleans up various other things. Change-Id: I3a022e4dc2afffa6893ad11014034dd7ed301f13 Reviewed-on: https://pdfium-review.googlesource.com/26510 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Cleanup CXFA_Node ownershipDan Sinclair
Currently a CXFA_Node can be owned by the CXFA_Document root pointer, the CXFA_Document Purge list or as a child of another CXFA_Node. This makes it hard to know who currently owns what. This CL moves all ownership of nodes into a CXFA_NodeOwner class which CXFA_Document subclasses. The node owner always owns all nodes and is responsible for cleaning them up upon destruction. The destruction order is not guarenteed to be in tree order as nodes can be inserted and moved around the tree. Change-Id: I6b202b8e844999ba835093dcdd1a808938b6d9a8 Reviewed-on: https://pdfium-review.googlesource.com/26434 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-13Convert ASSERT to PDFIUM_IMMEDIATE_CRASHDan Sinclair
This CL changes the ASSERTs used in CXFA_Node::InsertChild and RemoveChild to PDFIUM_IMMEDIATE_CRASH. The ASSERTs are compiled out in Release mode, we want to make sure we don't accidentally build invalid node trees in Release. Change-Id: Ic96c8ab457631d1f32d36d7d12bd5888f1cf4b0a Reviewed-on: https://pdfium-review.googlesource.com/26431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Add previous sibling pointer to CXFA_NodeDan Sinclair
This CL adds a prev_sibling_ pointer into CXFA_Node and updates the code as needed. Change-Id: I3125f59780da34dc26a176c7264a31335be528fe Reviewed-on: https://pdfium-review.googlesource.com/26410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-13Add tests for CXFA_Node child manipulationDan Sinclair
This CL adds tests for CXFA_Node::InsertChild and CXFA_Node::RemoveChild methods. Change-Id: I6ef9e76dfbfa8a9b8246620ecf80c88812b332fc Reviewed-on: https://pdfium-review.googlesource.com/26371 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-12Cleanup CXFA_Node tree pointerschromium/3346Dan Sinclair
This CL changes the CXFA_Node parent pointer back to a raw pointer from an UnownedPtr. The other tree pointers have been renamed for clarity. Change-Id: I366a0b5b41d49d87b11bec0eea9890fbc79c1c62 Reviewed-on: https://pdfium-review.googlesource.com/26370 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-08Revert "Convert CXFA_Node to store a vector of children"dsinclair
This reverts commit f0e386de64e030f6d692acfa27e2bc0a50018710. Reason for revert: After chatting with tsepez@, we've got a better direction to take these changes. Original change's description: > Convert CXFA_Node to store a vector of children > > This CL changes CXFA_Node to use a vector of nodes as children instead > of a singly linked list of siblings and child pointers. > > Change-Id: Ica8219f63d783a07d90b9541ae62a35c49166e44 > Reviewed-on: https://pdfium-review.googlesource.com/26030 > Reviewed-by: Ryan Harrison <rharrison@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> TBR=dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I115779a292d39694ad5faf0b748a617c491b40f0 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/26070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-08Convert CXFA_Node to store a vector of childrenDan Sinclair
This CL changes CXFA_Node to use a vector of nodes as children instead of a singly linked list of siblings and child pointers. Change-Id: Ica8219f63d783a07d90b9541ae62a35c49166e44 Reviewed-on: https://pdfium-review.googlesource.com/26030 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>