summaryrefslogtreecommitdiff
path: root/xfa/fxfa
AgeCommit message (Collapse)Author
2018-04-17Implement FORM_GetFocusedText() API.Lei Zhang
If there is a focused form field, get its text. BUG=chromium:753216 Change-Id: I05294f14d05c1c86769055f6c9eaf9177787d9fd Reviewed-on: https://pdfium-review.googlesource.com/12072 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-16Merge CFX_XMLElement and CFX_XMLAttributeNodedan sinclair
CFX_XMLElement is the only subclass of CFX_XMLAttributeNode. This CL merges the two classes together. The {Set|Get}String method has been renamed to {Set|Get}Attribute to make it clearer what you're retrieving. Change-Id: I158c961d4d8c5f563d937a3e7a35321a33622562 Reviewed-on: https://pdfium-review.googlesource.com/30710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Revert "Return pdfium::span<wchar_t> from WideString::GetBuffer()."Tom Sepez
This reverts commit 154e18f9a862975abecebe77b8f5fb418418d14c. Reason for revert: Generate CL to merge to beta branch Original change's description: > Return pdfium::span<wchar_t> from WideString::GetBuffer(). > > 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> TBR=tsepez@chromium.org,dsinclair@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Ie1ec9434215584a024538ca8edeb59dea555af48 Reviewed-on: https://pdfium-review.googlesource.com/30830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Split GetNumbericSymbol into individual methodsdan sinclair
This CL removes the GetNumbericSymbol method and adds individual methods for each symbol we retrieve. Change-Id: Id14108e5ea43a76250e18a1aa13bdbb05e928cdc Reviewed-on: https://pdfium-review.googlesource.com/30695 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Convert CXFA_XMLLocale to CFX_XMLdan sinclair
This CL converts CXFA_XMLLocale to use CFX_XML instead of CXML. Change-Id: I1db617a658548ae5979f2f38d72c5b3000998663 Reviewed-on: https://pdfium-review.googlesource.com/30693 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
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-12Cleanup CXFA_FFDocDan Sinclair
This CL changes CXFA_FFDoc to no longer use the CXFA_FFApp to create the document, it does it directly. The stream data is not stored in the FFDoc anymore as it is only used once. Change-Id: I8247d2fb0324e554250ff0a03c67f067ef46e437 Reviewed-on: https://pdfium-review.googlesource.com/30270 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-11Remove use of GetBuffer()/ReleaseBuffer() when c_str() is sufficient.Tom Sepez
Greatly simplify the code which was neither changing allocations nor doing any actual work. Eventually GetBuffer() will return a span, and this makes fewer places to change. Comment AsFPDFWideString() as a place where we may want a redundant copy, and make available outside the .cpp file. Fix one "const" along the way. Change-Id: I187758b69a0ba3501b3622f6c06280793cd5d464 Reviewed-on: https://pdfium-review.googlesource.com/30011 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-11Make cxfa_fmlexer.cpp resilient to null stringsTom Sepez
As currently written, the calculation of m_end will underflow when passed a {nullptr, 0} pair as input, and m_end becomes essentially unbounded. Change-Id: Id3249b201c446555d9aa4fa04e6a3c94a357cd99 Reviewed-on: https://pdfium-review.googlesource.com/30230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-10Remove CFX_Rect.Lei Zhang
It is rarely used and FX_RECT is the more common integer rect type. Change-Id: I7c5b875321c2d587becedcd058bb3a57fd1f0b61 Reviewed-on: https://pdfium-review.googlesource.com/30053 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-10Break down CXFA_FFWidget::On{L|R}ButtonDown() into two steps.Henrique Nakashima
The first step, AcceptsFocusOnButtonDown(), returns whether the widget wants focus on a mouse click. The second step, On{L|R}ButtonDown(), handles the click after focus has been assigned. Bug: chromium:820256 Change-Id: I9da1f1a930f198fc17b24acb7f1e3e6ef7f12ae4 Reviewed-on: https://pdfium-review.googlesource.com/29951 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@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-09Merge CXFA_FFDoc::{Start|Do|Stop}Load methodsDan Sinclair
The StartLoad, DoLoad and StopLoad methods are called in sequence from the CPDFXFA_Context. This CL merges the three methods into a single Load method. Change-Id: I7135502354fb4c64784c89fa39b74fc58c76b683 Reviewed-on: https://pdfium-review.googlesource.com/29990 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 m_pOldFocusWidget from CXFA_FFDocView.Henrique Nakashima
It can be refactored to a local, then the local can be refactored out too. There should be no functional changes. Change-Id: I4b49cbf27736f856a567db5db952c03aba743818 Reviewed-on: https://pdfium-review.googlesource.com/29911 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@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-06Fix typos in CXFA_FMParser.chromium/3391Lei Zhang
Change-Id: I0059e2ec25e90162a241a49e5d7b327c80330a33 Reviewed-on: https://pdfium-review.googlesource.com/29890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: 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-05Remove spellchecking code from XFAchromium/3390Ryan Harrison
The existing code for spellchecking is non-functional and we are not planning on fixing/finishing it, so removing it, since it currently is marking everything as misspelt. BUG=pdfium:1054 Change-Id: I23aaa13c09aed483376d7d06f47fdf31d890786b Reviewed-on: https://pdfium-review.googlesource.com/29790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@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-28Smaller post expression setDan Sinclair
This CL decreases the kMaxPostExpressions to 256. This is the number of accessors you can attach to a single statement (e.g. foo.#A.#A.#A). Having a very large number can cause stack overflows. The accessor does not seem like it would expect hundreds of entries on a single element. Bug: chromium:820688 Change-Id: I19966b43c96f5d1d02a79af127a0c96609420811 Reviewed-on: https://pdfium-review.googlesource.com/29330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-27Simplify some XFA font manager creationchromium/3382Dan Sinclair
For the cases where we always initialize the font managers, do it in the constructor instead of as a secondary call. Change-Id: Ic59b331d1eb357878cd5786b187b5b79bace4498 Reviewed-on: https://pdfium-review.googlesource.com/29291 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-27Remove CXFA_FFNotify proxy methodsDan Sinclair
This CL removes proxy methods from CXFA_FFNotify and calls them directly. Change-Id: I1fecc625e0b81b659baeffc9ca567c5c20e12c23 Reviewed-on: https://pdfium-review.googlesource.com/29252 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-03-27Remove unused CXFA_FFNotify methodDan Sinclair
Change-Id: I2f7f152f229371704e1a9a5496908059a6e11c0e Reviewed-on: https://pdfium-review.googlesource.com/29251 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@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-12Remove all usages of FXSYS_iswASCIIalphaRyan Harrison
Instances are either replaced with FXSYS_iswalpha, which calls out to the ICU library to do the proper Unicode operations, or have been converted to a isascii && isalpha pair, if ASCII alpha is actually what was wanted. BUG=pdfium:1035 Change-Id: I971ff639ee1ff818ad08793a1900a8bcbb0a3e04 Reviewed-on: https://pdfium-review.googlesource.com/28450 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-07[formcalc] Consider width along with depth of treeDan Sinclair
When building the formcalc parser trees we need to limit on width along with depth. It's possible to generate a tree of a single depth but is more then 20k nodes wide. This will eventuall cause stack overflow issues. This CL re-uses the depth check for the grammar expressions in which we're extending the width of the tree we count that against our depth check. Bug: chromium:813346 Change-Id: I01f6567a75776a75374465eacc1ff546db46cac1 Reviewed-on: https://pdfium-review.googlesource.com/28170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-07[formcalc] Handle bad elseif conditionalschromium/3365Dan Sinclair
This Cl adds checking for the conditionals of if and elseif expressions. If the conditional fails to parse we should return nullptr. This already happens by accident in the if() case, but with elseif() conditions we'll fail the ASSERT in the CXFA_FMIfExpression constructor and crash. This CL explicitly checks for the expressions and early exists if they failed to parse. Bug: chromium:819509 Change-Id: I9a90182c7709c8c4c0d3ae17d6be67cb668c0c6a Reviewed-on: https://pdfium-review.googlesource.com/28131 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>