From 1f7db295b1deeecb562d6213b3ea17b9168405eb Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 25 Jul 2018 16:59:38 +0000 Subject: Move CXFA_ThisProxy helper to CXFA_Object. Because the other helpers are declared here. Rename VariablesThis to ThisProxy in a few places; VariablesThis is a slightly different concept (see GetVariablesThis()). Then introduce helper for CXFA_List subclass as well. Remove unused const version of some helpers. Change-Id: Ia328d8cd170a8b97015e98c1c770fa8a44810455 Reviewed-on: https://pdfium-review.googlesource.com/38670 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- fxjs/cfxjse_engine.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'fxjs/cfxjse_engine.cpp') diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index e297ed16e2..cc584a3fa3 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -67,9 +67,7 @@ const char kFormCalcRuntime[] = "pfm_rt"; CXFA_ThisProxy* ToThisProxy(CFXJSE_Value* pValue) { CFXJSE_HostObject* pHostObject = pValue->ToHostObject(); - if (!pHostObject) - return nullptr; - return CXFA_ThisProxy::FromCXFAObject(pHostObject->AsCXFAObject()); + return pHostObject ? ToThisProxy(pHostObject->AsCXFAObject()) : nullptr; } } // namespace @@ -181,7 +179,7 @@ void CFXJSE_Engine::GlobalPropertySetter(CFXJSE_Value* pObject, CXFA_Document* pDoc = lpOrginalNode->GetDocument(); CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); - if (lpOrginalNode->IsVariablesThis()) + if (lpOrginalNode->IsThisProxy()) pRefNode = ToNode(lpScriptContext->GetVariablesThis(lpOrginalNode)); WideString wsPropName = WideString::FromUTF8(szPropName); @@ -193,7 +191,7 @@ void CFXJSE_Engine::GlobalPropertySetter(CFXJSE_Value* pObject, true)) { return; } - if (lpOrginalNode->IsVariablesThis()) { + if (lpOrginalNode->IsThisProxy()) { if (pValue && pValue->IsUndefined()) { pObject->SetObjectOwnProperty(szPropName, pValue); return; @@ -234,7 +232,7 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, } CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); - if (pOriginalObject->IsVariablesThis()) + if (pOriginalObject->IsThisProxy()) pRefNode = ToNode(lpScriptContext->GetVariablesThis(pOriginalObject)); if (lpScriptContext->QueryNodeByFlag( @@ -473,7 +471,7 @@ CFXJSE_Context* CFXJSE_Engine::CreateVariablesContext(CXFA_Node* pScriptNode, CXFA_Object* CFXJSE_Engine::GetVariablesThis(CXFA_Object* pObject, bool bScriptNode) { - CXFA_ThisProxy* pProxy = CXFA_ThisProxy::FromCXFAObject(pObject); + CXFA_ThisProxy* pProxy = ToThisProxy(pObject); if (!pProxy) return pObject; -- cgit v1.2.3