From 33beb4e4d34547a4de43f4dee4b2b0483c526b5e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 4 Dec 2017 19:12:16 +0000 Subject: Remove SetResultCreateNode 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 Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffdocview.cpp | 4 ++-- xfa/fxfa/parser/cxfa_nodehelper.cpp | 8 ++++---- xfa/fxfa/parser/cxfa_nodehelper.h | 2 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 8 ++++---- xfa/fxfa/parser/xfa_resolvenode_rs.h | 18 +++++++++--------- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index f7704509f6..f1ae2af3c0 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -506,7 +506,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( return nullptr; } - if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { + if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) { CXFA_Node* pNode = resolveNodeRS.objects.front()->AsNode(); if (pNode) return static_cast(pNode->GetWidgetData()); @@ -719,7 +719,7 @@ void CXFA_FFDocView::RunBindItems() { pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), &rs, dwStyle, nullptr); pAcc->DeleteItem(-1, false, false); - if (rs.dwFlags != XFA_RESOLVENODE_RSTYPE_Nodes || rs.objects.empty()) + if (rs.dwFlags != XFA_ResolveNode_RSType_Nodes || rs.objects.empty()) continue; WideString wsValueRef = bindItemsData.GetValueRef(); diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index f11472a112..e3d6aa0bb5 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -18,7 +18,7 @@ CXFA_NodeHelper::CXFA_NodeHelper() : m_eLastCreateType(XFA_Element::DataValue), m_pCreateParent(nullptr), m_iCreateCount(0), - m_iCreateFlag(XFA_RESOLVENODE_RSTYPE_CreateNodeOne), + m_iCreateFlag(XFA_ResolveNode_RSType_CreateNodeOne), m_iCurAllStart(-1), m_pAllStartParent(nullptr) {} @@ -281,7 +281,7 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) { WideString wsIndex(L"0"); bool bAll = false; if (iLen == 0) { - m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne; + m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeOne; return false; } if (wsCondition[0] != '[') @@ -299,9 +299,9 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) { } if (bAll) { wsIndex = L"1"; - m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeAll; + m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeAll; } else { - m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne; + m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeOne; wsIndex = wsCondition.Mid(i, iLen - 1 - i); } int32_t iIndex = wsIndex.GetInteger(); diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h index e2f46f4508..394259e53d 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -64,7 +64,7 @@ class CXFA_NodeHelper { XFA_Element m_eLastCreateType; CXFA_Node* m_pCreateParent; int32_t m_iCreateCount; - XFA_RESOLVENODE_RSTYPE m_iCreateFlag; + XFA_ResolveNode_RSType m_iCreateFlag; int32_t m_iCurAllStart; CXFA_Node* m_pAllStartParent; }; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 4f2b2fb41d..868361e336 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -469,13 +469,13 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument, XFA_RESOLVENODE_RS rs; pDocument->GetScriptContext()->ResolveObjects( pDataScope, wsRef.AsStringView(), &rs, dFlags, pTemplateNode); - if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll || - rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll || + if (rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeAll || + rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeMidAll || rs.objects.size() > 1) { return pDocument->GetNotBindNode(rs.objects); } - if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) { + if (rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeOne) { CXFA_Object* pObject = !rs.objects.empty() ? rs.objects.front() : nullptr; CXFA_Node* pNode = ToNode(pObject); return (bForceBind || !pNode || !pNode->HasBindItem()) ? pNode : nullptr; @@ -1169,7 +1169,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, pDataNode = ToNode(pObject); if (pDataNode) { CreateDataBinding(pFormNode, pDataNode, - rs.dwFlags == XFA_RESOLVENODE_RSTYPE_ExistNodes); + rs.dwFlags == XFA_ResolveNode_RSType_ExistNodes); } else { FormValueNode_MatchNoneCreateChild(pFormNode); } diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h index 2eaab5dff4..86960abecc 100644 --- a/xfa/fxfa/parser/xfa_resolvenode_rs.h +++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h @@ -27,13 +27,13 @@ #define XFA_RESOLVENODE_Bind 0x0800 #define XFA_RESOLVENODE_BindNew 0x1000 -enum XFA_RESOLVENODE_RSTYPE { - XFA_RESOLVENODE_RSTYPE_Nodes, - XFA_RESOLVENODE_RSTYPE_Attribute, - XFA_RESOLVENODE_RSTYPE_CreateNodeOne, - XFA_RESOLVENODE_RSTYPE_CreateNodeAll, - XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll, - XFA_RESOLVENODE_RSTYPE_ExistNodes, +enum XFA_ResolveNode_RSType { + XFA_ResolveNode_RSType_Nodes, + XFA_ResolveNode_RSType_Attribute, + XFA_ResolveNode_RSType_CreateNodeOne, + XFA_ResolveNode_RSType_CreateNodeAll, + XFA_ResolveNode_RSType_CreateNodeMidAll, + XFA_ResolveNode_RSType_ExistNodes, }; struct XFA_RESOLVENODE_RS { @@ -41,12 +41,12 @@ struct XFA_RESOLVENODE_RS { ~XFA_RESOLVENODE_RS(); std::vector objects; // Not owned. - XFA_RESOLVENODE_RSTYPE dwFlags; + XFA_ResolveNode_RSType dwFlags; const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; }; inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() - : dwFlags(XFA_RESOLVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {} + : dwFlags(XFA_ResolveNode_RSType_Nodes), pScriptAttribute(nullptr) {} inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() {} -- cgit v1.2.3