summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
AgeCommit message (Collapse)Author
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 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>
2018-02-07Remove unused return values from CXFA_NodeDan Sinclair
This CL removes the unused return values from InsertChild and RemoveChild methods in CXFA_Node. Bug: chromium:807863 Change-Id: Iac468afc5c48f51e7df3ea12d11b128a0ac124ea Reviewed-on: https://pdfium-review.googlesource.com/25670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-02-06Make the CXFA_Node parent pointer UnownedDan Sinclair
This CL converts the CXFA_Node parent pointer to be an Unowned pointer instead of a raw pointer. Bug: chromium:807863 Change-Id: I266c9216cfe8153e234bf66b88fbac6c8d96ebb4 Reviewed-on: https://pdfium-review.googlesource.com/25650 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-31Create CXFA_Node::PresenceRequiresSpaceDan Sinclair
This CL replaces XFA_ItemLayoutProcessor_IsTakingSpace with a PresenceRequiresSpace call on CXFA_Node. Change-Id: Ibf570f25eeb3404d72e87cb62e06a7ad70f0916f Reviewed-on: https://pdfium-review.googlesource.com/24850 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-31Remove NumericLimit params which are always the sameDan Sinclair
This CL removes the two params from NumericLmits which are always set to the same value and retrieves the values in the method itself. Change-Id: Ibeabdc7187faa58e93ffbe00063171fec0842256 Reviewed-on: https://pdfium-review.googlesource.com/24717 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-30Shuffle more code out of CXFA_NodeDan Sinclair
This CL moves more code out of the CXFA_Node class and into specific subclasses. Change-Id: Idca36f251431bf7efd4da045aeabf097ab23f0ce Reviewed-on: https://pdfium-review.googlesource.com/24714 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-30Move CheckButton code from CXFA_Node to CXFA_CheckButtonDan Sinclair
This CL moves some of the code specific to CheckButtons out of CXFA_Node and into the CXFA_CheckButton class. The CheckButton is passed as a parameter to the CXFA_FFCheckButton class. Change-Id: I3344c484d90e3b8d1024024a2851685044113a23 Reviewed-on: https://pdfium-review.googlesource.com/24711 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Cleanup CXFA_Node visibilityDan Sinclair
Make methods private or remove if not needed. Change-Id: I2f9f718ba08a4b49332c896d2385ec60cf9cf01b Reviewed-on: https://pdfium-review.googlesource.com/24490 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Fold single caller methods into callsiteDan Sinclair
This CL folds the GetNodeSameClassIndex, GetNodeSameNameIndex from CXFA_Node into the CJX_Tree callsites. Change-Id: Ia4f7750543e786ddd82abb4b6b4bde1bf1710f19 Reviewed-on: https://pdfium-review.googlesource.com/24471 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Move barcode code to CXFA_BarcodeDan Sinclair
This CL moves the barcode specific code out of CXFA_Node and into CXFA_Barcode. The CXFA_FFBarcode widget was modified to take the barcode as a parameter. Change-Id: I8ff91cb58402665f4ba63f2eeced45feeaa9ff50 Reviewed-on: https://pdfium-review.googlesource.com/24450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-29Cleanup the FFWidget determination code.Dan Sinclair
This CL converts the UIType to an XFA_FFWidgetType instead of reusing the XFA_Element type. The creation code is cleaned up to make it clearer what's happening. Change-Id: I5d3e4967d5c8b8a50dbb25e574b0d31fe0cf407a Reviewed-on: https://pdfium-review.googlesource.com/24390 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Move retrieval of UIChild earlier in CreateUIChildDan Sinclair
This CL shifts the retrieval of the UI child earlier in the method so we can group all of the code which sets the widget type. Change-Id: Iabdbd7ae2e6d3f648ce78e93c263be66f62946ba Reviewed-on: https://pdfium-review.googlesource.com/23790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Rename eUIType for clarityDan Sinclair
This CL renames eUIType to make it clear it's the type for the value node we need to create, not the UI node we're creating. Change-Id: I7ffe86b07a2ccf81114e7d1a6a41f520b864a61f Reviewed-on: https://pdfium-review.googlesource.com/23771 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-24Cleanup CreateUIChild node creationDan Sinclair
This CL cleans up some of the code around creating the XML nodes related to the UI widgets. Change-Id: Ib91364439ab039f46e44690e92cc0cb93a8da203 Reviewed-on: https://pdfium-review.googlesource.com/23770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Cleanup CreateUIChild pUI usageDan Sinclair
This CL cleans up the usage of pUI in CreateUIChild. The node can't be null per spec so ASSERT that's true. Cleanup the search for children to make it clearer what is happening. Change-Id: I856de8ebf89fe0bc61942e7ad2a1131a7878c511 Reviewed-on: https://pdfium-review.googlesource.com/23730 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Update code to assume a Value node exists.Dan Sinclair
When we retrieve the first Value node from a Field or a Draw element it either must exist, or must be created. If that doesn't happen something has gone very wrong. Change-Id: I818aaf9d361336c898035fe542e5b37a33fef0ea Reviewed-on: https://pdfium-review.googlesource.com/23710 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Make CreateUIChild a method of CXFA_NodeDan Sinclair
This CL changes CreateUIChild to be a method on node instead of accepting the node as a parameter. Change-Id: I5bf84cee010c1c02966def987a3bc2bcc7db0324 Reviewed-on: https://pdfium-review.googlesource.com/23690 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-24Clarify CreateUIChild is only for Field or Draw elementsDan Sinclair
This CL changes the code to only call CreateUIChild for Field and Draw elements. Other types are handled all the callsite. Change-Id: I2dd2553c14ebc1f0849b3bfd311e75ad8922aa0d Reviewed-on: https://pdfium-review.googlesource.com/23670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Remove CXFA_Node::GetNode and m_pNodeDan Sinclair
This CL removes the node scaffolding added when merging CXFA_WidgetAcc into CXFA_Node. Change-Id: I02a6b80d2c910816b1aec613078d4871c29369b3 Reviewed-on: https://pdfium-review.googlesource.com/23650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-23Remove GetWidgetAcc callsDan Sinclair
This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Merge CXFA_WidgetAcc into CXFA_Nodechromium/3330Dan Sinclair
This CL merges CXFA_WidgetAcc into CXFA_Node. Change-Id: Iab52ca7f98c9dcd4ab089c61b8f1324a565bf647 Reviewed-on: https://pdfium-review.googlesource.com/23610 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Remove CXFA_WidgetAcc from CXFA_FFDocView methodsDan Sinclair
This CL updates CXFA_FFDocView methods and members to use CXFA_Node objects instead of CXFA_WidgetAcc objects. Change-Id: Ic79af39ef49152a6d50ed5acfc153063db39353d Reviewed-on: https://pdfium-review.googlesource.com/23590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Convert CXFA_EventParam to store a CXFA_NodeDan Sinclair
This CL changes the CXFA_EventParam code to store a CXFA_Node instead of a CXFA_WidgetAcc. Change-Id: I21510674b0b6435ca9b87bfbf97914f54e5e3464 Reviewed-on: https://pdfium-review.googlesource.com/23451 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-22Convert CXFA_FFWidgetHandler to use CXFA_NodeDan Sinclair
This CL removes CXFA_WidgetAcc from CXFA_FFWidgetHandler and uses CXFA_Node directly. Change-Id: I88cf1edc53f4489aeac018a95e9d5936d85106db Reviewed-on: https://pdfium-review.googlesource.com/23450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-22Change GetContainerWidgetAcc to GetContainerNodeDan Sinclair
This Cl converts the code which retrieved the containers WidgetAcc to retrieve the container itself and then get the WidgetAcc from the container. Change-Id: Ib279a150500d1204e3d18f11f6a638c1f6c368ec Reviewed-on: https://pdfium-review.googlesource.com/23350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Move WidgetAcc and IsWidgetReady to CXFA_NodeDan Sinclair
This CL moves the widget_acc storage and the is_widget_ready flag from CXFA_Object to CXFA_Node. Change-Id: I96aeb38a854f227985a5549dc67f1b84d924abb8 Reviewed-on: https://pdfium-review.googlesource.com/23330 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-22Move IsNull and PreNull to CXFA_NodeDan Sinclair
This CL moves the m_bIsNull and m_bPreNull flags from CXFA_WidgetAcc to CXFA_Node. Change-Id: Ibdcdb8611699d6d908ab3c6ed05cbce7bba872ae Reviewed-on: https://pdfium-review.googlesource.com/23310 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Move the UI elements from CXFA_WidgetAcc to CXFA_NodeDan Sinclair
This CL moves the methods and members related to the UI nodes from the CXFA_WidgetAcc class to the CXFA_Node class. Change-Id: I1fdc5173787141065f1e607bbfefa3b22af738b4 Reviewed-on: https://pdfium-review.googlesource.com/23290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Add flag to notify if a node widget is readyDan Sinclair
This CL updates CXFA_Object to have a flag which annotates if the node is ready. Ready means that we've gone through the OnNodeReady call in CXFA_FFNotify. Previously we'd check if the WidgetAcc exists on the node which is created in OnNodeReady. This CL replaces all the points where we check for a WidgetAcc existing with a IsWidgetReady() call. Change-Id: I54e8160269c3104cdae7a516c1814c13bee15130 Reviewed-on: https://pdfium-review.googlesource.com/23190 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-17Do more forward declarations in cxfa_node.h.Lei Zhang
Including cjx_node.h pulls in v8 headers for many XFA files. Change-Id: I80a32d0a56b8de5787db5275db48c568da6d0144 Reviewed-on: https://pdfium-review.googlesource.com/22890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-16Rename CXFA_Value methods for clarityDan Sinclair
This CL marks the methods in CXFA_Value to make it clear which can return nullptr and updates callsites as needed. Change-Id: If1f794bcbbddaa57a1efdd67195df58a77b4373a Reviewed-on: https://pdfium-review.googlesource.com/22773 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-16Rename CXFA_Validate methods for clarityDan Sinclair
This CL updates GetScript to make clearer it can return nullptr. Change-Id: Ic0cf74b3f592dd413ce6fb7a38b29f70487a8dd5 Reviewed-on: https://pdfium-review.googlesource.com/22772 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-11Rename CXFA_Event methodsDan Sinclair
This CL renames CXFA_Event methods for clarity and fixes callers where needed. Change-Id: I902a35f36ee91c1b4aadd10382d93988ef26dc1c Reviewed-on: https://pdfium-review.googlesource.com/22750 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename CXFA_Caption methods for clarityDan Sinclair
This CL renames the CXFA_Caption methods to make it clearer they can return nullptr. Change-Id: I1b4945fcd2615f16a128709b7fe07e1236a5461a Reviewed-on: https://pdfium-review.googlesource.com/22743 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename CXFA_Calculate methods to make return clearerDan Sinclair
This CL renames CXFA_Calculate::GetScript to make it clearer it can return nullptr. Change-Id: I1f5c19c16ea6cb1b3e7016ddac3f7f7fd6aa0320 Reviewed-on: https://pdfium-review.googlesource.com/22741 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetExclGroup to GetExclGroupIfExistsDan Sinclair
This CL makes it clearer that GetExclGroup can return nullptr. Change-Id: Ica9bdfb05be36b3b6ede20f8b54daac1154506fd Reviewed-on: https://pdfium-review.googlesource.com/22739 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetItem to GetItemIfExistsDan Sinclair
Rename GetItem to make it clearer it can return nullptr. Change-Id: I0e09a79c3e2244b08212d3b51d3ad0e6a86edfd9 Reviewed-on: https://pdfium-review.googlesource.com/22713 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename CreateInstance to CreateInstanceIfPossibleDan Sinclair
This CL makes it clear that CreateInstance may return nullptr. Change-Id: I82f172a671761eae9055b0e9e55ab0e5a7d599aa Reviewed-on: https://pdfium-review.googlesource.com/22712 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetBind to GetBindIfExistsDan Sinclair
This CL updates the name to make it clearer the item an return nullptr. Change-Id: Icc5dbbf5ec3b9a8c73c6aaec585fdd61e2351c75 Reviewed-on: https://pdfium-review.googlesource.com/22710 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetFormValue to GetFormValueIfExistsDan Sinclair
This CL makes it clear that GetFormValue can return nullptr and fixes up a few callsites as needed. Change-Id: Id2e85b0956a678b5b338b9e2a4d32731fe6c4729 Reviewed-on: https://pdfium-review.googlesource.com/22690 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetDefaultValue to GetDefaultValueIfExistsDan Sinclair
This CL makes it explicit that GetDefaultValue can return nullptr. Change-Id: I871704e291358bc85a554e4f6410953f7223c61d Reviewed-on: https://pdfium-review.googlesource.com/22683 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename Getvalidate and GetOrCreateValidateDan Sinclair
This CL renames the validation methods to make it clear they can return nullptr. Change-Id: I60d0c41cdfe9902049d99cd790f851517b11a6d9 Reviewed-on: https://pdfium-review.googlesource.com/22682 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetCalculate to GetCalculateIfExistsDan Sinclair
This CL makes it explicit that GetCalculate can return nullptr. Change-Id: I587e3bb442df3661f083f7058ff02a8d62478ed5 Reviewed-on: https://pdfium-review.googlesource.com/22681 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>