diff options
author | dsinclair <dsinclair@chromium.org> | 2016-06-22 22:04:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-22 22:04:54 -0700 |
commit | 070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83 (patch) | |
tree | 2e9d0daaf76b0d2ac13f8b6d0b10dec11d1c6264 /xfa/fxfa/parser/xfa_script_nodehelper.cpp | |
parent | a5ab26b8aa9ed12af8bdf323cb297f61cbfeb1fa (diff) | |
download | pdfium-070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83.tar.xz |
Update GetClassID to GetElementType
The GetClassID method actually returns the XFA_Element, change the name of the
method to be more suggestive of the return value.
The GetClassID was sort-of polymorphich and would call down to subclasses. This
CL changes the data to be stored on the CXFA_Object class and just returns what
is set. The values are set in the constructor as needed.
Review-Url: https://codereview.chromium.org/2082573007
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_nodehelper.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_nodehelper.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 1bf8a12ff1..5c3944371d 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -53,7 +53,7 @@ int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode, if (!parent) return 0; const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - parent->GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); + parent->GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (!pProperty && eLogicType == XFA_LOGIC_Transparent) { parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); if (parent == NULL) { @@ -154,15 +154,16 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, } } else { if (child->GetNameHash() == dNameHash) { - if (child->GetClassID() != XFA_Element::PageSet && - child->GetClassID() != XFA_Element::Extras && - child->GetClassID() != XFA_Element::Items) { + if (child->GetElementType() != XFA_Element::PageSet && + child->GetElementType() != XFA_Element::Extras && + child->GetElementType() != XFA_Element::Items) { pSiblings->Add(child); nCount++; } } } - if (child->IsUnnamed() && child->GetClassID() == XFA_Element::PageSet) { + if (child->IsUnnamed() && + child->GetElementType() == XFA_Element::PageSet) { nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, eLogicType, bIsClassName, FALSE); } @@ -176,7 +177,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, int32_t nChildren = children.GetSize(); for (i = 0; i < nChildren; i++) { CXFA_Node* child = children[i]; - if (child->GetClassID() == XFA_Element::Variables) { + if (child->GetElementType() == XFA_Element::Variables) { continue; } if (bIsClassName) { @@ -198,7 +199,7 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, continue; } if (XFA_NodeIsTransparent(child) && - child->GetClassID() != XFA_Element::PageSet) { + child->GetElementType() != XFA_Element::PageSet) { nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, eLogicType, bIsClassName, FALSE); } @@ -222,7 +223,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( if (parent == NULL) { break; } - XFA_Element parentElement = parent->GetClassID(); + XFA_Element parentElement = parent->GetElementType(); if ((!parent->IsUnnamed() && parentElement != XFA_Element::SubformSet) || parentElement == XFA_Element::Variables) { break; @@ -287,7 +288,7 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, CFX_WideString ws; FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode); if (refNode->IsUnnamed() || - (bIsProperty && refNode->GetClassID() != XFA_Element::PageSet)) { + (bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) { refNode->GetClassName(wsTagName); ws = wsTagName; wsName.Format(L"#%s[%d]", ws.c_str(), @@ -304,7 +305,7 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { if (refNode == NULL) { return FALSE; } - XFA_Element eRefNode = refNode->GetClassID(); + XFA_Element eRefNode = refNode->GetElementType(); if ((refNode->IsUnnamed() && refNode->IsContainerNode()) || eRefNode == XFA_Element::SubformSet || eRefNode == XFA_Element::Area || eRefNode == XFA_Element::Proto) { @@ -418,13 +419,13 @@ void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { if (refNode == NULL) { return; } - if (refNode->GetClassID() == XFA_Element::Subform) { + if (refNode->GetElementType() == XFA_Element::Subform) { m_eLastCreateType = XFA_Element::DataGroup; - } else if (refNode->GetClassID() == XFA_Element::Field) { + } else if (refNode->GetElementType() == XFA_Element::Field) { m_eLastCreateType = XFA_FieldIsMultiListBox(refNode) ? XFA_Element::DataGroup : XFA_Element::DataValue; - } else if (refNode->GetClassID() == XFA_Element::ExclGroup) { + } else if (refNode->GetElementType() == XFA_Element::ExclGroup) { m_eLastCreateType = XFA_Element::DataValue; } } @@ -433,6 +434,7 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { CXFA_Node* parent = XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); return parent && refNode && - XFA_GetPropertyOfElement(parent->GetClassID(), refNode->GetClassID(), + XFA_GetPropertyOfElement(parent->GetElementType(), + refNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); } |