summaryrefslogtreecommitdiff
path: root/fxjs/cjx_node.cpp
AgeCommit message (Collapse)Author
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-04Remove SetResultCreateNodeDan Sinclair
This CL removes the SetResultCreateNode method and inlines into the one caller. The XFA_RESOLVENODE_RSTYPE enum is also renamed XFA_ResolveNode_RSType to make it easier to find XFA_RESOLVENODE_RS objects. Change-Id: I937b612be062c5b7b05fd8d2822cd12cb882ba06 Reviewed-on: https://pdfium-review.googlesource.com/20370 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Remove CXFA_ValueArrayDan Sinclair
This CL removes the CXFA_ValueArray. Some of the code in XFA_RESOLVENODE_RS is duplicated, but the duplication makes the code clearer. Change-Id: I7495bb8c614a3d8919bfca858866932774f13fd8 Reviewed-on: https://pdfium-review.googlesource.com/20350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Cleanup ResolveObjects params and returnDan Sinclair
The return value of ResolveObjects is always used as a boolean, so change from int32_t. The XFA_RESOLVENODE_RS object was made a pointer from a ref. Change-Id: I030036c01101680e36f4ddf524b468354a2e6850 Reviewed-on: https://pdfium-review.googlesource.com/20331 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Cleanup CFXJSE engine and resolve processorDan Sinclair
Change-Id: Ibb7411a7c90f723a19fd5d41552988bc8943e4ea Reviewed-on: https://pdfium-review.googlesource.com/20330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-04Make CXFA_SimpleParser members const or Unowned.Lei Zhang
Fix ownership issues, and simplify CXFA_SimpleParser ctors. Change-Id: Ie083080297c5c2586ae3e6a8355839fcb86ee9ea Reviewed-on: https://pdfium-review.googlesource.com/20130 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: 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-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>
2017-11-30Move setting of XML content back to specific set methodsDan Sinclair
This removes the need for the casting as we know the type in the caller. Change-Id: I9fe30d9f8e6110356549c283980e2f4f37f43d02 Reviewed-on: https://pdfium-review.googlesource.com/19870 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-30Rename GetAttributeEnumById to CXFA_Node::AttributeEnumToNameDan Sinclair
This is more consistent with the attribute and element to name methods. Change-Id: I3a7f9246d6fbaffa27a0068d8f93e717f5801d2a Reviewed-on: https://pdfium-review.googlesource.com/19851 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Generate XFA node attribute informationDan Sinclair
This CL moves the attribute information out of the xfa basic data array and stores in the generated nodes. Change-Id: Id8e280324bf0f75a1da9c937c2734d161324242d Reviewed-on: https://pdfium-review.googlesource.com/19271 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-27Add helpers to get attribute informationDan Sinclair
This CL adds helpers to CXFA_Node to get the type of an attribute and the default value for a given attribute. Change-Id: I8bf41f568fe1da650fb3df4232b63d2e48038e07 Reviewed-on: https://pdfium-review.googlesource.com/19330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Add some helpers for attribute lookupDan Sinclair
This CL adds helpers to CXFA_Node to convert from strings to attributes and from attributes to their string names. A static_assert was added to make sure the list of attributes is the same size as the attribute data so the checks can be removed. Change-Id: Idebc65021d71f604bcf498e4cf42252af00d802b Reviewed-on: https://pdfium-review.googlesource.com/19270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Generate XFA node classesDan Sinclair
This CL adds concrete classes for each of the XFA Node types. Change-Id: Ieac8e2fcd5d13c61daa27fc63e3d80abb7aa7a29 Reviewed-on: https://pdfium-review.googlesource.com/18271 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-23Cleanup CXFA_WidgetDatachromium/3277Dan Sinclair
This CL cleans up return values, out-params and changes simple methods to boolean checks where possible in CXFA_WidgetData. Change-Id: I29daa67993730f3e9d61cb6fdf918a886cc9120e Reviewed-on: https://pdfium-review.googlesource.com/19230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-22Cleanup CXFA_ValidateDataDan Sinclair
This CL removes out-params in favour of returns; Makes params const; Cleans up return types. Change-Id: I2b7c237130a99859b08af0486a95b4c6f6974f62 Reviewed-on: https://pdfium-review.googlesource.com/19130 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_FillDataDan Sinclair
This CL makes the CXFA_FillData methods const and splits them into retrieving fill information and fill colour methods. Change-Id: Ie407be87c631ea68efa0934d9a98e412ed1eb922 Reviewed-on: https://pdfium-review.googlesource.com/18950 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-20Remove CXFA_DataData operator bool overrideDan Sinclair
This CL removes CXFA_DataData::operator bool in favour of an explicit HasValidNode method. This makes the call sites a lot clearer. Change-Id: I6fae14fdeec4674ca7916e21b9e5703070fc3069 Reviewed-on: https://pdfium-review.googlesource.com/18830 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-20Convert picture methods to return the stringDan Sinclair
This CL converts CXFA_BindData::GetPicture and CXFA_WidgetData::GetPictureContent to return the WideString instead of taking an out param. The original bool result was never checked. Change-Id: I4503d53ac7276edea811a28c34c7d8cc4cb50572 Reviewed-on: https://pdfium-review.googlesource.com/18810 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-20Remove return value from SetAttributeValueDan Sinclair
The CJX_Node::SetAttributeValue method always returns |true| and we never check the value. This CL changes the method to return |void| instead. Change-Id: Ia3162627dee926d602e7ffe74f9dca2c1fd81ca8 Reviewed-on: https://pdfium-review.googlesource.com/18770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-20Convert calc data and layout item to store in CJX_NodeDan Sinclair
This CL moves the XFA_CalcData and XFA_LayoutItem out of the map'd data for a CJX_Node and stores directly on the node. This makes the object a bit bigger but makes the code a lot more understandable. Change-Id: I8897a52d61d37595181960c23928984aa5d67efc Reviewed-on: https://pdfium-review.googlesource.com/18590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-20Remove {Set|Get|Try}Object methodsDan Sinclair
The CJX_Node::{Set|Get|Try}Object methods are used to set CXFA_WidgetData and CXFA_Node objects into the CJX_Node. This is stored in the node as void* data and custom delete methods are passed when needed. Instead, this CL just stores the two types of things we need on the CJX_Node and returns the correct types. This uses a bit more space on the CJX_Node, but it makes the code a lot clearer and simpler. Change-Id: I8546ea6456a1c1f5f8b602a6a420a0e85f3fac29 Reviewed-on: https://pdfium-review.googlesource.com/18570 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Make WideString::{Format|FormatV} staticDan Sinclair
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Convert TryNamespace to optionalDan Sinclair
This CL changes CJX_Node::TryNamespace to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: I50ccb3544179108d156d763c25e03abab4306c19 Reviewed-on: https://pdfium-review.googlesource.com/18551 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert CJX_Node::TryMeasure to pdfium::OptionalDan Sinclair
This CL converts TryMeasure to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: I6e92e53aa0eaa7a6b855253061acca8a59db49fd Reviewed-on: https://pdfium-review.googlesource.com/18550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert TryBoolean to return a pdfium::OptionalDan Sinclair
This CL changes CJX_Node::TryBoolean to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: Iceeaaaa5bda62f34e66161834e0209c2169f7f15 Reviewed-on: https://pdfium-review.googlesource.com/18530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Cleanup CJX_Node::GetAttributeDan Sinclair
This CL renames GetAttribute to TryAttribute and changes to return a pdfium::Optional instead of a boolean with an out parameter. GetAttribute is then added to call TryAttribute to mirror the other methods in the file. Change-Id: I875dac120776af7c53fe069e4dd36e5486838447 Reviewed-on: https://pdfium-review.googlesource.com/18514 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert TryEnum to return an optionalDan Sinclair
This CL converts CJX_Node::TryEnum to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: Icc1b063ce51656cc5e467aba358eb9e7d6754fea Reviewed-on: https://pdfium-review.googlesource.com/18512 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert TryInteger to return an optionalDan Sinclair
This Cl changes CJX_Node::TryInteger to return a pdfium::Optional<int32_t> instead of a boolean with an out param. Change-Id: I4675e08d3b132041f7d87e4639efa1d555089dc2 Reviewed-on: https://pdfium-review.googlesource.com/18511 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Convert TryCData and TryContent to optionalsDan Sinclair
This CL changes the TryCData and TryContent to return pdfium::Optional<WideString> values instead of returning a bool and taking an out WideString. Change-Id: I9c9d877803f9f1977191e12d6a907c29784c10b2 Reviewed-on: https://pdfium-review.googlesource.com/18510 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-14Cleanup XFA default value codeDan Sinclair
This CL adds helper methods to CXFA_Node to retrieve the default values for attributes with the correct data types. Change-Id: I644435b4b430819f1060a95fa4fffe4ba2826cfe Reviewed-on: https://pdfium-review.googlesource.com/18450 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-14Fixing nits in CJX_NodeDan Sinclair
Change-Id: I3c894f0e7038d4b12b0363d8931dab50687b5495 Reviewed-on: https://pdfium-review.googlesource.com/18150 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-08Convert XFA_SCRIPT_TYPE to an enum classDan Sinclair
This CL converts the XFA_SCRIPT_TYPE enum to the XFA_ScriptType enum class. Change-Id: If30ccd7128aaec63a3d1cb9b1c6f72d3048e4529 Reviewed-on: https://pdfium-review.googlesource.com/18031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-08Convert XFA_ATTRIBUTETYPE to an enum classDan Sinclair
This CL converts XFA_ATTRIBUTETYPE to an enum class XFA_AttributeType. Change-Id: I76185da08fcc8a7a4026ce430238db1b2cecf192 Reviewed-on: https://pdfium-review.googlesource.com/18051 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-08Convert XFA_ATTRIBUTE to an enum classDan Sinclair
This CL converts the XFA_ATTRIBUTE enum to an enum class and fixes up various usages. Change-Id: I3dd17cc412d97eb212a65ce63bb9fa19605e1e91 Reviewed-on: https://pdfium-review.googlesource.com/18050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-08Fix XFA_SCRIPTATTRIBUTEINFO attribute typeDan Sinclair
This CL changes XFA_SCRIPTATTRIBUTEINFO attribute field to be a XFA_ATTRIBUTE from an in32_t. This necessitated adding an XFA_ATTRIBUTE_Unknown and updating the various -1 values in the script data description. Change-Id: I837602e38b3785d7c8515830fae8dc427d449e9f Reviewed-on: https://pdfium-review.googlesource.com/18030 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-07Rename CXFA_Value to CXFA_ValueDatachromium/3262Dan Sinclair
This CL renames CXFA_Value to CXFA_ValueData to show it's part of the data hierarchy. Change-Id: I4693234f503903a2c11d76a56dbbb6de5f0c3718 Reviewed-on: https://pdfium-review.googlesource.com/18018 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-07Rename CXFA_Validate to CXFA_ValidateDataDan Sinclair
This CL renames CXFA_Validate to CXFA_ValidateData to signify it is part of the data hierarchy. Change-Id: Ib6f743513160990b6d64c4b10618f16554dc5c08 Reviewed-on: https://pdfium-review.googlesource.com/18017 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-07Rename CXFA_Stroke to CXFA_StrokeDataDan Sinclair
This CL renames CXFA_Stroke to CXFA_StrokeData to show it is part of the data hierarchy. Change-Id: If0041c410630c61129ed1ff0879c68244ad01aa5 Reviewed-on: https://pdfium-review.googlesource.com/18013 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-07Rename CXFA_Occur to CXFA_OccurDataDan Sinclair
This CL renames CXFA_Occur to CXFA_OccurData to show it is part of the data hierarchy. Change-Id: I55096747338a9ff83ab24f528f6715a6f4302ba7 Reviewed-on: https://pdfium-review.googlesource.com/17988 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-07Rename CXFA_Font to CXFA_FontDataDan Sinclair
This CL renames CXFA_Font to CXFA_FontData to make it clear this is part of the data hierarchy. The GetFontNode methods were renamed to GetFontData to match the return type. Change-Id: I5d5b9200eedc9c8c1bd8929a5a0df3d2663d7e3d Reviewed-on: https://pdfium-review.googlesource.com/17983 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-07Rename CXFA_Fill to CXFA_FillDataDan Sinclair
This CL renames CXFA_Fill to CXFA_FillData to show it is part of the data hierarchy. Change-Id: I4f1f3e83621dee4f9ccddb3b3d04785d094315b8 Reviewed-on: https://pdfium-review.googlesource.com/17981 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-07Rename CXFA_Edge to CXFA_EdgeDataDan Sinclair
This CL renames CXFA_Edge to CXFA_EdgeData to make it clear it's part of the data hierarchy. Change-Id: Id67526cafe1927803c36159b106656c32e770d6b Reviewed-on: https://pdfium-review.googlesource.com/17979 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-07Rename CXFA_Border to CXFA_BorderDataDan Sinclair
This CL renames CXFA_Border to CXFA_BorderData to make it clear it's part of the Data hierarchy. Change-Id: Icfe8dc07d527ba54413f073f5a444fb7b2a71271 Reviewed-on: https://pdfium-review.googlesource.com/17974 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Call CJX methods directly instead of proxyingDan Sinclair
This CL updates the XFA JS code to call the methods on the CJX objects directly instead of proxying through the CXFA objects. The script methods have been removed from the CXFA objects. Change-Id: I2d7b502473a8e88a7af88b10aa0da602d4998394 Reviewed-on: https://pdfium-review.googlesource.com/17851 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Make XFA_MAPMODULESDATA a unique_ptrDan Sinclair
Change-Id: Icd72ee8d098fa0140119519f7079745bd5280a84 Reviewed-on: https://pdfium-review.googlesource.com/17592 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-06Remove recursive paramter from CJX_Node::MoveBufferMapDataDan Sinclair
The recursive paramter is always true, so remove it and fixup code as needed. Change-Id: I18395c1bca415d8a5d85c1eee6a32870c5d7f7e3 Reviewed-on: https://pdfium-review.googlesource.com/17591 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>