From 070fcdfeafb17a9d3ada1418f48fd7f19aa4cf83 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 22 Jun 2016 22:04:54 -0700 Subject: 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 --- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'xfa/fxfa/parser/xfa_script_resolveprocessor.cpp') diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 1f24176a84..a78ad7bb6b 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -57,7 +57,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { if (rnd.m_uHashName == XFA_HASHCODE_This && rnd.m_nLevel == 0) { rnd.m_Nodes.Add(rnd.m_pSC->GetThisObject()); return 1; - } else if (rnd.m_CurNode->GetClassID() == XFA_Element::Xfa) { + } else if (rnd.m_CurNode->GetElementType() == XFA_Element::Xfa) { CXFA_Object* pObjNode = rnd.m_pSC->GetDocument()->GetXFAObject(rnd.m_uHashName); if (pObjNode) { @@ -194,7 +194,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_ForAttributeRs( CXFA_ResolveNodesData& rnd, const CFX_WideStringC& strAttr) { const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute = - XFA_GetScriptAttributeByName(curNode->GetClassID(), strAttr); + XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr); if (lpScriptAttribute) { rnd.m_pScriptAttribute = lpScriptAttribute; rnd.m_Nodes.Add(curNode); @@ -230,17 +230,18 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( CXFA_Node* pPageSetNode = NULL; CXFA_Node* pChild = curNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { - if (pChild->GetClassID() == XFA_Element::Variables) { + if (pChild->GetElementType() == XFA_Element::Variables) { pVariablesNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; - } else if (pChild->GetClassID() == XFA_Element::PageSet) { + } else if (pChild->GetElementType() == XFA_Element::PageSet) { pPageSetNode = pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } else { const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( - curNode->GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); + curNode->GetElementType(), pChild->GetElementType(), + XFA_XDPPACKET_UNKNOWN); if (pPropert) { properties.Add(pChild); } else { @@ -288,7 +289,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(child); } if (m_pNodeHelper->XFA_NodeIsTransparent(child) && - child->GetClassID() != XFA_Element::PageSet) { + child->GetElementType() != XFA_Element::PageSet) { if (!bSetFlag) { XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); bSetFlag = TRUE; @@ -340,8 +341,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(childProperty); } } else if (childProperty->GetNameHash() == uNameHash && - childProperty->GetClassID() != XFA_Element::Extras && - childProperty->GetClassID() != XFA_Element::Items) { + childProperty->GetElementType() != XFA_Element::Extras && + childProperty->GetElementType() != XFA_Element::Items) { nodes.Add(childProperty); } } @@ -353,7 +354,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( return 0; } CXFA_Node* pProp = NULL; - if (XFA_Element::Subform == curNode->GetClassID() && + if (XFA_Element::Subform == curNode->GetElementType() && XFA_HASHCODE_Occur == uNameHash) { CXFA_Node* pInstanceManager = curNode->AsNode()->GetInstanceMgrOfSubform(); @@ -424,11 +425,12 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(child); } const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( - parentNode->GetClassID(), child->GetClassID(), XFA_XDPPACKET_UNKNOWN); + parentNode->GetElementType(), child->GetElementType(), + XFA_XDPPACKET_UNKNOWN); FX_BOOL bInnerSearch = FALSE; if (pPropert) { - if ((child->GetClassID() == XFA_Element::Variables || - child->GetClassID() == XFA_Element::PageSet)) { + if ((child->GetElementType() == XFA_Element::Variables || + child->GetElementType() == XFA_Element::PageSet)) { bInnerSearch = TRUE; } } else { @@ -728,7 +730,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( CXFA_Node* curNode = array[iSize - 1]; FX_BOOL bIsProperty = m_pNodeHelper->XFA_NodeIsProperty(curNode); if (curNode->IsUnnamed() || - (bIsProperty && curNode->GetClassID() != XFA_Element::PageSet)) { + (bIsProperty && curNode->GetElementType() != XFA_Element::PageSet)) { iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, bIsProperty, TRUE); } else { -- cgit v1.2.3