From 5fda35f2b0a658e310f778c2dc40ef24e6d05975 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 20:21:00 +0000 Subject: Generate XFA node attribute information 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 Reviewed-by: Lei Zhang --- xfa/fxfa/parser/cxfa_node.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_node.h') diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 7465f31106..238bb12b06 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -53,8 +53,19 @@ class CXFA_Node : public CXFA_Object { uint8_t flags; }; - static WideString AttributeToName(XFA_Attribute attr); + struct AttributeData { + XFA_Attribute attribute; + XFA_AttributeType type; + uint32_t packets; + void* default_value; + }; + +#ifndef NDEBUG + static WideString ElementToName(XFA_Element elem); +#endif // NDEBUG + static XFA_Attribute NameToAttribute(const WideStringView& name); + static WideString AttributeToName(XFA_Attribute attr); static XFA_Element NameToElement(const WideString& name); static std::unique_ptr Create(CXFA_Document* doc, XFA_Element element, @@ -175,20 +186,21 @@ class CXFA_Node : public CXFA_Object { XFA_ObjectType oType, XFA_Element eType, const PropertyData* properties, - const XFA_Attribute* attributes, + const AttributeData* attributes, const WideStringView& elementName); private: bool HasFlag(XFA_NodeFlag dwFlag) const; CXFA_Node* Deprecated_GetPrevSibling(); const PropertyData* GetPropertyData(XFA_Element property) const; + const AttributeData* GetAttributeData(XFA_Attribute attr) const; pdfium::Optional GetFirstPropertyWithFlag(uint8_t flag); void OnRemoved(bool bNotify); pdfium::Optional GetDefaultValue(XFA_Attribute attr, XFA_AttributeType eType) const; const PropertyData* m_Properties; - const XFA_Attribute* m_Attributes; + const AttributeData* m_Attributes; uint32_t m_ValidPackets; CXFA_Node* m_pNext; CXFA_Node* m_pChild; -- cgit v1.2.3