From 5a552539e1382443eb18b046ad3ab9c4e673b5b1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 5 Apr 2018 19:05:11 +0000 Subject: Make CXFA_Document::m_rgGlobalBinding private This CL moves the two accessor functions from being in an anonymous namespace to being public and makes the member itself private. Change-Id: Idd5dd1e6cc617d0be0fdd57ceace2dbc684a8b00 Reviewed-on: https://pdfium-review.googlesource.com/29856 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- xfa/fxfa/parser/cxfa_document.cpp | 31 +++++++++++++++---------------- xfa/fxfa/parser/cxfa_document.h | 5 ++++- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 2750157717..d23e2bc2ce 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -131,11 +131,6 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, return true; } -CXFA_Node* GetGlobalBinding(CXFA_Document* pDocument, uint32_t dwNameHash) { - auto it = pDocument->m_rgGlobalBinding.find(dwNameHash); - return it != pDocument->m_rgGlobalBinding.end() ? it->second : nullptr; -} - void MergeNodeRecurse(CXFA_Node* pDestNodeParent, CXFA_Node* pProtoNode) { CXFA_Node* pExistingNode = nullptr; for (CXFA_Node* pFormChild = pDestNodeParent->GetFirstChild(); pFormChild; @@ -298,12 +293,6 @@ CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope, return nullptr; } -void RegisterGlobalBinding(CXFA_Document* pDocument, - uint32_t dwNameHash, - CXFA_Node* pDataNode) { - pDocument->m_rgGlobalBinding[dwNameHash] = pDataNode; -} - CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument, const WideString& wsName, CXFA_Node* pDataScope, @@ -312,12 +301,12 @@ CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument, return nullptr; uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false); - CXFA_Node* pBounded = GetGlobalBinding(pDocument, dwNameHash); + CXFA_Node* pBounded = pDocument->GetGlobalBinding(dwNameHash); if (!pBounded) { pBounded = ScopeMatchGlobalBinding(pDataScope, dwNameHash, eMatchNodeType, true); if (pBounded) - RegisterGlobalBinding(pDocument, dwNameHash, pBounded); + pDocument->RegisterGlobalBinding(dwNameHash, pBounded); } return pBounded; } @@ -1175,7 +1164,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, if (!bDataRef || bParentDataRef) { uint32_t dwNameHash = pFormNode->GetNameHash(); if (dwNameHash != 0 && !pDataNode) { - pDataNode = GetGlobalBinding(pDocument, dwNameHash); + pDataNode = pDocument->GetGlobalBinding(dwNameHash); if (!pDataNode) { XFA_Element eDataNodeType = (eType == XFA_Element::Subform || XFA_FieldIsMultiListBox(pFormNode)) @@ -1189,8 +1178,8 @@ void UpdateBindingRelations(CXFA_Document* pDocument, pFormNode->JSObject()->GetCData(XFA_Attribute::Name))); if (pDataNode) { CreateDataBinding(pFormNode, pDataNode, false); - RegisterGlobalBinding(pDocument, pFormNode->GetNameHash(), - pDataNode); + pDocument->RegisterGlobalBinding(pFormNode->GetNameHash(), + pDataNode); } } else { CreateDataBinding(pFormNode, pDataNode, true); @@ -1810,3 +1799,13 @@ void CXFA_Document::DoDataRemerge(bool bDoDataMerge) { CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); pLayoutProcessor->SetForceReLayout(true); } + +CXFA_Node* CXFA_Document::GetGlobalBinding(uint32_t dwNameHash) { + auto it = m_rgGlobalBinding.find(dwNameHash); + return it != m_rgGlobalBinding.end() ? it->second : nullptr; +} + +void CXFA_Document::RegisterGlobalBinding(uint32_t dwNameHash, + CXFA_Node* pDataNode) { + m_rgGlobalBinding[dwNameHash] = pDataNode; +} diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index c04c31cfce..f924abb989 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -95,12 +95,15 @@ class CXFA_Document : public CXFA_NodeOwner { void ClearLayoutData(); - std::map m_rgGlobalBinding; + CXFA_Node* GetGlobalBinding(uint32_t dwNameHash); + void RegisterGlobalBinding(uint32_t dwNameHash, CXFA_Node* pDataNode); + std::vector m_pPendingPageSet; private: UnownedPtr notify_; CXFA_Node* m_pRootNode; + std::map m_rgGlobalBinding; std::unique_ptr m_pScriptContext; std::unique_ptr m_pLayoutProcessor; std::unique_ptr m_pLocalMgr; -- cgit v1.2.3