diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-21 22:02:20 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-21 22:02:20 +0000 |
commit | 307dfb406422f9589fcdb09039b4c31a9c5f6269 (patch) | |
tree | 7d176d1f37af77877cfb2714e5ea415f344ba9db /fxjs | |
parent | 96d6f741b3c106ba0e48a05692910f64cf1e5e09 (diff) | |
download | pdfium-307dfb406422f9589fcdb09039b4c31a9c5f6269.tar.xz |
Cleanup CXFA_ScriptData
This CL cleans removes out params, makes methods const and moves the
XFA_ScriptDataType into CXFA_ScriptData.
Change-Id: I5a51a0eddc3608577a387472911000daa479af0f
Reviewed-on: https://pdfium-review.googlesource.com/19090
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 16 | ||||
-rw-r--r-- | fxjs/cfxjse_engine.h | 6 | ||||
-rw-r--r-- | fxjs/cfxjse_resolveprocessor.cpp | 6 | ||||
-rw-r--r-- | fxjs/cjx_hostpseudomodel.cpp | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index e5d6c0a0fe..c2dba2f311 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -130,7 +130,7 @@ CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument, v8::Isolate* pIsolate) pDocument->GetRoot())), m_pIsolate(pIsolate), m_pJsClass(nullptr), - m_eScriptType(XFA_ScriptDataType::Unknown), + m_eScriptType(CXFA_ScriptData::Type::Unknown), m_pScriptNodeArray(nullptr), m_ResolveProcessor(pdfium::MakeUnique<CFXJSE_ResolveProcessor>()), m_pThisObject(nullptr), @@ -150,14 +150,14 @@ CFXJSE_Engine::~CFXJSE_Engine() { delete ToThisProxy(pair.second->GetGlobalObject().get(), nullptr); } -bool CFXJSE_Engine::RunScript(XFA_ScriptDataType eScriptType, +bool CFXJSE_Engine::RunScript(CXFA_ScriptData::Type eScriptType, const WideStringView& wsScript, CFXJSE_Value* hRetValue, CXFA_Object* pThisObject) { ByteString btScript; - AutoRestorer<XFA_ScriptDataType> typeRestorer(&m_eScriptType); + AutoRestorer<CXFA_ScriptData::Type> typeRestorer(&m_eScriptType); m_eScriptType = eScriptType; - if (eScriptType == XFA_ScriptDataType::Formcalc) { + if (eScriptType == CXFA_ScriptData::Type::Formcalc) { if (!m_FM2JSContext) { m_FM2JSContext = pdfium::MakeUnique<CFXJSE_FormCalcContext>( m_pIsolate, m_JsContext.get(), m_pDocument.Get()); @@ -243,7 +243,7 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); WideString wsPropName = WideString::FromUTF8(szPropName); - if (lpScriptContext->GetType() == XFA_ScriptDataType::Formcalc) { + if (lpScriptContext->GetType() == CXFA_ScriptData::Type::Formcalc) { if (szPropName == kFormCalcRuntime) { lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue); return; @@ -319,7 +319,7 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, return; if (pObject == lpScriptContext->GetThisObject() || - (lpScriptContext->GetType() == XFA_ScriptDataType::Javascript && + (lpScriptContext->GetType() == CXFA_ScriptData::Type::Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), @@ -454,7 +454,7 @@ bool CFXJSE_Engine::IsStrictScopeInJavaScript() { return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping); } -XFA_ScriptDataType CFXJSE_Engine::GetType() { +CXFA_ScriptData::Type CFXJSE_Engine::GetType() { return m_eScriptType; } @@ -574,7 +574,7 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, if (wsExpression.IsEmpty()) return 0; - if (m_eScriptType != XFA_ScriptDataType::Formcalc || + if (m_eScriptType != CXFA_ScriptData::Type::Formcalc || (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { m_upObjectArray.clear(); } diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index b049eecf56..ae9156f1c4 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -28,7 +28,7 @@ class CFXJSE_Engine { void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } CXFA_EventParam* GetEventParam() { return &m_eventParam; } - bool RunScript(XFA_ScriptDataType eScriptType, + bool RunScript(CXFA_ScriptData::Type eScriptType, const WideStringView& wsScript, CFXJSE_Value* pRetValue, CXFA_Object* pThisObject); @@ -89,7 +89,7 @@ class CFXJSE_Engine { bool RunVariablesScript(CXFA_Node* pScriptNode); CXFA_Object* GetVariablesThis(CXFA_Object* pObject, bool bScriptNode = false); bool IsStrictScopeInJavaScript(); - XFA_ScriptDataType GetType(); + CXFA_ScriptData::Type GetType(); std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; } CXFA_Document* GetDocument() const { return m_pDocument.Get(); } @@ -104,7 +104,7 @@ class CFXJSE_Engine { std::unique_ptr<CFXJSE_Context> m_JsContext; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; - XFA_ScriptDataType m_eScriptType; + CXFA_ScriptData::Type m_eScriptType; std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Value>> m_mapObjectToValue; std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Context>> m_mapVariableToContext; diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp index ef7ddc10fb..3a6bc91d50 100644 --- a/fxjs/cfxjse_resolveprocessor.cpp +++ b/fxjs/cfxjse_resolveprocessor.cpp @@ -661,11 +661,11 @@ void CFXJSE_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, CFXJSE_ResolveNodeData& rnd) { ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects)); WideString wsExpression; - XFA_ScriptDataType eLangType = XFA_ScriptDataType::Unknown; + CXFA_ScriptData::Type eLangType = CXFA_ScriptData::Type::Unknown; if (wsCondition.Left(2) == L".[" && wsCondition.Last() == L']') { - eLangType = XFA_ScriptDataType::Formcalc; + eLangType = CXFA_ScriptData::Type::Formcalc; } else if (wsCondition.Left(2) == L".(" && wsCondition.Last() == L')') { - eLangType = XFA_ScriptDataType::Javascript; + eLangType = CXFA_ScriptData::Type::Javascript; } else { return; } diff --git a/fxjs/cjx_hostpseudomodel.cpp b/fxjs/cjx_hostpseudomodel.cpp index 35ab2f88c9..0e26a19048 100644 --- a/fxjs/cjx_hostpseudomodel.cpp +++ b/fxjs/cjx_hostpseudomodel.cpp @@ -528,7 +528,7 @@ bool CJX_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, bool bIsJsType = false; if (GetDocument()->GetScriptContext()->GetType() == - XFA_ScriptDataType::Javascript) { + CXFA_ScriptData::Type::Javascript) { bIsJsType = true; } |