summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
AgeCommit message (Collapse)Author
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>
2018-01-10Rename GetPara to GetParaIfExistschromium/3318Dan Sinclair
This CL renames GetPara to make it explicit it can return nullptr. Change-Id: I7c6529c15646b9947964e25a8d28938b38f091d6 Reviewed-on: https://pdfium-review.googlesource.com/22680 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetTemplateNode to GetTemplateNodeIfExistsDan Sinclair
This CL makes it explicit that GetTemplateNodeIfExists can return nullptr. Various call sites are updated as needed. Change-Id: If6edd5962b59e7e4ce3dbe9bbdc957783cf76abe Reviewed-on: https://pdfium-review.googlesource.com/22678 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetOccur to GetOccurIfExistsDan Sinclair
This CL makes it explicit that GetOccurIfExists can return nullptr and fixes up the call sites. Change-Id: I542d0098aa316632239df7f1a5796b4ffe6ba202 Reviewed-on: https://pdfium-review.googlesource.com/22676 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetMargin to GetMarginIfExistsDan Sinclair
This CL makes it explicit that GetMargin may return a nullptr. Change-Id: I46780e8df9e966accc38baf56f8aa5149533db87 Reviewed-on: https://pdfium-review.googlesource.com/22675 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetOrCreateFont to GetOrCreateFontIfPossibleDan Sinclair
This CL makes it explicit that GetOrCreateFontIfPossible can return nullptr. Change-Id: Ib5be6995e4225ad596dfb78a94f0bc56802716cc Reviewed-on: https://pdfium-review.googlesource.com/22674 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetFont to GetFontIfExistsDan Sinclair
This CL makes it explicit that GetFont may return nullptr. Change-Id: Icb7ec5ad4ed6c5f7a728230d1237898b8f2fd778 Reviewed-on: https://pdfium-review.googlesource.com/22673 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetOrCreateBorder to GetOrCreateBorderIfPossibleDan Sinclair
This CL makes it explicit that GetOrCreateBorderIfPossible can return a nullptr. Change-Id: I41d5e7ee506e95d95349e1e06198e40e8afa073c Reviewed-on: https://pdfium-review.googlesource.com/22672 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename GetCaption to GetCaptionIfExistsDan Sinclair
This CL renames GetCaption to GetCaptionIfExists to make it clear the value returned can be a nullptr. The various callsites have been fixed which used the caption without validating. Change-Id: I9b600ac9ab5b9e04dfa6e8cee95ef3e9d629688d Reviewed-on: https://pdfium-review.googlesource.com/22670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Rename CXFA_Node::GetBorder to GetBorderIfExistsDan Sinclair
Renaming GetBorder makes it clear that the method may return a nullptr. Change-Id: I50a8b511e273552e3a4a226ba72a7c0e2ae74ea3 Reviewed-on: https://pdfium-review.googlesource.com/22653 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Remove 2 param CXFA_Node::GetNodeItemDan Sinclair
This CL removes the CXFA_Node::GetNodeItem(kind, object_type) method in favour of explicit methods. All of the callers passed in a XFA_ObjectType::ContainerNode. Change-Id: I713184d3fa188a122284f50ac2a6b0fd3d7aed26 Reviewed-on: https://pdfium-review.googlesource.com/22651 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Remove CXFA_Node::GetNodeItemDan Sinclair
This CL removes the generic CXFA_Node::GetNodeItem(type) method for specific calls to get the parent, child or siblings. Change-Id: Ief68284ac7b954aaa4ed7120dd82a39f8b52656a Reviewed-on: https://pdfium-review.googlesource.com/22650 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-10Make methods which create nodes more obviousDan Sinclair
This CL converts the various methods Get methods which take a boolean value to explicit Get* and GetOrCreate* methods to make the usage clearer. Change-Id: I2af68448b1b69b95713e739bf7fe14a4336d2b65 Reviewed-on: https://pdfium-review.googlesource.com/22590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-09Move barcode code from WidgetAcc to NodeDan Sinclair
This CL moves the barcode related code from CXFA_WidgetAcc to CXFA_Node. Change-Id: Id3f5f30222535a69a0bf4d59416e57d452c7d8e8 Reviewed-on: https://pdfium-review.googlesource.com/22551 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-09More Execute* methods to CXFA_Nodechromium/3317Dan Sinclair
This Cl moves the two Execute* methods from CXFA_WidgetAcc to CXFA_Node. Change-Id: I4e1d6cd2159028800b855558273ca80aad365570 Reviewed-on: https://pdfium-review.googlesource.com/22550 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-09Move Process* methods to CXFA_NodeDan Sinclair
This CL moves the CXFA_WidgetAcc::Process* methods to CXFA_Node. Change-Id: Ic01b62e3786a6666a698f8877a8b7b295714bf79 Reviewed-on: https://pdfium-review.googlesource.com/22472 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-08Move CXFA_WidgetAcc from CJX_Object to CXFA_ObjectDan Sinclair
This CL change the CJX code to not store the pointer to the CXFA_WidgetAcc. If needed the CJX object gets the Acc from the Node itself. Change-Id: I5a5a500b8fbc1749d362346d72678acd5250d112 Reviewed-on: https://pdfium-review.googlesource.com/22411 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-08Move proxy methods from CXFA_WidgetAcc to CXFA_NodeDan Sinclair
This CL moves methods from WidgetAcc which just proxy to CXFA_Node. Change-Id: Icf1006b4be3f91077de411ed1a571b1507117602 Reviewed-on: https://pdfium-review.googlesource.com/22391 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-05Convert CXFA_Node::GetLocaleName out param to returnchromium/3315chromium/3314chromium/3313Ryan Harrison
Change-Id: Ia135db144c7037795fc1a1964b4f3eee57250caa Reviewed-on: https://pdfium-review.googlesource.com/22350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-04Convert CXFA_Node::GetChild to take a size_t for the indexchromium/3312Ryan Harrison
Change-Id: I99ab62f03a42bb1dc5f4d228cd60c0e254a8c70b Reviewed-on: https://pdfium-review.googlesource.com/22259 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-04Convert usages of pdfium::Optional to OptionalRyan Harrison
Change-Id: I29769f78eaad10c6a8b79e27524336c4f330377e Reviewed-on: https://pdfium-review.googlesource.com/22258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-04Make CXFA_List::GetLength return a size_tRyan Harrison
This requires a number of other minor cleanups to get sizes and signedness agreeing everywhere. Change-Id: Ie25318a23d458be5a8a2a91927c3b37eb198f5ce Reviewed-on: https://pdfium-review.googlesource.com/22256 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-04Merge CXFA_WidgetData into CXFA_WidgetAccDan Sinclair
This CL merges the CXFA_WidgetData class into the only subclass, CXFA_WidgetAcc. Code has been updated as needed. Change-Id: I3f5bc83b1422bcbe065276b16bfb91e656f5c174 Reviewed-on: https://pdfium-review.googlesource.com/22252 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-04Make CXFA_WidgetData constructor protectedDan Sinclair
This CL removes all the direct creation of CXFA_WidgetData elements and makes the constructor protected. Change-Id: I2e9aa11cab8c1e26f7cfa9fd32329f0841fab010 Reviewed-on: https://pdfium-review.googlesource.com/22251 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-03Fold CXFA_OccurData into CXFA_OccurDan Sinclair
This CL folds the CXFA_OccurData wrapper into CXFA_Occur. Change-Id: I52e237e4f6b76f6915c397e924037562fd9eda6a Reviewed-on: https://pdfium-review.googlesource.com/22130 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-14Add types to the CXFA_Node::Get*{Child|Sibling}* methodsDan Sinclair
This CL templates the various Get methods in CXFA_Node in order to return the correct node type. Change-Id: I4f50df6dd9213873deb8f8f262eaf579c6c4ca7d Reviewed-on: https://pdfium-review.googlesource.com/21230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-14Change CXFA_Node::GetChild to return proper typesDan Sinclair
Currently CXFA_Node::GetChild always returns a CXFA_Node* object. We know the type we want when we call GetChild, so this CL changes the code to add a template parameter to GetChild and return the correct CXFA_Node subtype for the desired element. Change-Id: I5aecf2e840504235dc246483abee48e0564841fe Reviewed-on: https://pdfium-review.googlesource.com/21210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-13Methods are on CJX_Object not CJX_Node nowDan Sinclair
This CL converts all of the JSNode() to JSObject() calls as all of the original CJX_Node methods have been moved to CJX_Object. This fixes potential bad casts from things like CJX_Content which do not inhert from CJX_Node. Bug: pdfium:793372 Change-Id: I6c7f63a78f3d47bb6bad74faed3fd8c535bf095e Reviewed-on: https://pdfium-review.googlesource.com/21090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-07[xfa] Move JS method information to files.chromium/3288Dan Sinclair
This CL moves the XFA SOM JS Method information out of the c-array and into individual CJX class files. Change-Id: I401046a06aacaf1f04e5a51eb899e479de012e15 Reviewed-on: https://pdfium-review.googlesource.com/20450 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-07Fix nits from previous CL.Dan Sinclair
This CL fixs up some nits from previous CL. Change-Id: I3d24d149d91b1290258291f5b79894496b195459 Reviewed-on: https://pdfium-review.googlesource.com/20290 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30Rename XFA_ATTRIBUTEENUM to XFA_AttributeEnum enum classDan Sinclair
This CL changes the enum XFA_ATTRIBUTEENUM to an enum class XFA_AttributeEnum. Methods expecting an int32 have been updated to take or return the XFA_AttrbuteEnum type. Change-Id: I268453949545fe2dd3eae707be4d9cc7edeff763 Reviewed-on: https://pdfium-review.googlesource.com/20070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Make parsers work off XFA_PacketType enumDan Sinclair
This CL changes the various parsers to use XFA_PacketType instead of XFA_XDPPACKET. This just leaves XFA_XDPPACKET for determining if a given node can be created in a given packet. Change-Id: I6fd23480c0c780a131d23b64b7c7e9d8684b0220 Reviewed-on: https://pdfium-review.googlesource.com/20013 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30A CXFA_Node can only be in one packetDan Sinclair
When a CXFA_Node is created it's created as part of a specific packet. Previously the code would accept an XFA_XDPPACKET which was stored internally. This had the potential to allow a node to exist in multiple packets. This CL changes the XFA_XDPPacket to the XFA_PacketType enum class and cleans up a lot of uses to use the more specific packet type. Change-Id: I7fc8c843bfa6bd32295ae58a26bcec311e43c4b0 Reviewed-on: https://pdfium-review.googlesource.com/20012 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Cleanup XFA packet codeDan Sinclair
Remove GetPacketByID, move GetPacketByName to the xfa_utils file. Cleanup CreateNode to accept the XFA_XDPPACKET instead of the packet info. Change-Id: I0f246c84f61b6b4175ca307bdcd125d9bc24bb1e Reviewed-on: https://pdfium-review.googlesource.com/20010 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Create CXFA_Node::NameToAttributeEnumDan Sinclair
This CL removes XFA_GetAttributeEnumByName and moves the functionality into CXFA_Node::NameToAttriuteEnum. Change-Id: Id1484103c62bf7728d5406c22fb9d83fc0e032e1 Reviewed-on: https://pdfium-review.googlesource.com/19791 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>