summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 20:29:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 20:29:23 +0000
commit07c0a4952a9fe45e51c6ba5a2e19296e52ea6ec7 (patch)
tree818bfc4ae4832250add9f92037994832f22b8e89 /fxjs
parentc5e0f66f5f2e0645f2beab70b44690fe510a9f2d (diff)
downloadpdfium-07c0a4952a9fe45e51c6ba5a2e19296e52ea6ec7.tar.xz
Fold CXFA_ScriptData into CXFA_Script
This CL removes the CXFA_ScriptData wrapper and uses CXFA_Script directly. Change-Id: I1f1932ef96ee4a24407de7eb1d68b8631a5a67ea Reviewed-on: https://pdfium-review.googlesource.com/21173 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_engine.cpp16
-rw-r--r--fxjs/cfxjse_engine.h7
-rw-r--r--fxjs/cfxjse_resolveprocessor.cpp6
3 files changed, 15 insertions, 14 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 65aedddf4f..a1c70a7d16 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -98,7 +98,7 @@ CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument, v8::Isolate* pIsolate)
&GlobalClassDescriptor,
pDocument->GetRoot())),
m_pJsClass(nullptr),
- m_eScriptType(CXFA_ScriptData::Type::Unknown),
+ m_eScriptType(CXFA_Script::Type::Unknown),
m_pScriptNodeArray(nullptr),
m_ResolveProcessor(pdfium::MakeUnique<CFXJSE_ResolveProcessor>()),
m_pThisObject(nullptr),
@@ -117,14 +117,14 @@ CFXJSE_Engine::~CFXJSE_Engine() {
delete ToThisProxy(pair.second->GetGlobalObject().get(), nullptr);
}
-bool CFXJSE_Engine::RunScript(CXFA_ScriptData::Type eScriptType,
+bool CFXJSE_Engine::RunScript(CXFA_Script::Type eScriptType,
const WideStringView& wsScript,
CFXJSE_Value* hRetValue,
CXFA_Object* pThisObject) {
ByteString btScript;
- AutoRestorer<CXFA_ScriptData::Type> typeRestorer(&m_eScriptType);
+ AutoRestorer<CXFA_Script::Type> typeRestorer(&m_eScriptType);
m_eScriptType = eScriptType;
- if (eScriptType == CXFA_ScriptData::Type::Formcalc) {
+ if (eScriptType == CXFA_Script::Type::Formcalc) {
if (!m_FM2JSContext) {
m_FM2JSContext = pdfium::MakeUnique<CFXJSE_FormCalcContext>(
GetIsolate(), m_JsContext.get(), m_pDocument.Get());
@@ -210,7 +210,7 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject,
CXFA_Document* pDoc = pOriginalObject->GetDocument();
CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext();
WideString wsPropName = WideString::FromUTF8(szPropName);
- if (lpScriptContext->GetType() == CXFA_ScriptData::Type::Formcalc) {
+ if (lpScriptContext->GetType() == CXFA_Script::Type::Formcalc) {
if (szPropName == kFormCalcRuntime) {
lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue);
return;
@@ -305,7 +305,7 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
return;
if (pObject == lpScriptContext->GetThisObject() ||
- (lpScriptContext->GetType() == CXFA_ScriptData::Type::Javascript &&
+ (lpScriptContext->GetType() == CXFA_Script::Type::Javascript &&
!lpScriptContext->IsStrictScopeInJavaScript())) {
bRet = lpScriptContext->QueryNodeByFlag(
ToNode(pObject), wsPropName.AsStringView(), pReturnValue,
@@ -417,7 +417,7 @@ bool CFXJSE_Engine::IsStrictScopeInJavaScript() {
return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping);
}
-CXFA_ScriptData::Type CFXJSE_Engine::GetType() {
+CXFA_Script::Type CFXJSE_Engine::GetType() {
return m_eScriptType;
}
@@ -537,7 +537,7 @@ bool CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
if (wsExpression.IsEmpty())
return false;
- if (m_eScriptType != CXFA_ScriptData::Type::Formcalc ||
+ if (m_eScriptType != CXFA_Script::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 9541f7b26b..777921dfc4 100644
--- a/fxjs/cfxjse_engine.h
+++ b/fxjs/cfxjse_engine.h
@@ -15,6 +15,7 @@
#include "fxjs/cjs_v8.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
#define XFA_RESOLVENODE_TagName 0x0002
@@ -53,7 +54,7 @@ class CFXJSE_Engine : public CJS_V8 {
void SetEventParam(CXFA_EventParam param) { m_eventParam = param; }
CXFA_EventParam* GetEventParam() { return &m_eventParam; }
- bool RunScript(CXFA_ScriptData::Type eScriptType,
+ bool RunScript(CXFA_Script::Type eScriptType,
const WideStringView& wsScript,
CFXJSE_Value* pRetValue,
CXFA_Object* pThisObject);
@@ -78,7 +79,7 @@ class CFXJSE_Engine : public CJS_V8 {
void SetRunAtType(XFA_AttributeEnum eRunAt) { m_eRunAtType = eRunAt; }
bool IsRunAtClient() { return m_eRunAtType != XFA_AttributeEnum::Server; }
- CXFA_ScriptData::Type GetType();
+ CXFA_Script::Type GetType();
std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; }
CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
@@ -102,7 +103,7 @@ class CFXJSE_Engine : public CJS_V8 {
UnownedPtr<CXFA_Document> const m_pDocument;
std::unique_ptr<CFXJSE_Context> m_JsContext;
CFXJSE_Class* m_pJsClass;
- CXFA_ScriptData::Type m_eScriptType;
+ CXFA_Script::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 f3e4a21312..75c5eea6b5 100644
--- a/fxjs/cfxjse_resolveprocessor.cpp
+++ b/fxjs/cfxjse_resolveprocessor.cpp
@@ -624,11 +624,11 @@ void CFXJSE_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex,
CFXJSE_ResolveNodeData& rnd) {
ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects));
WideString wsExpression;
- CXFA_ScriptData::Type eLangType = CXFA_ScriptData::Type::Unknown;
+ CXFA_Script::Type eLangType = CXFA_Script::Type::Unknown;
if (wsCondition.Left(2) == L".[" && wsCondition.Last() == L']')
- eLangType = CXFA_ScriptData::Type::Formcalc;
+ eLangType = CXFA_Script::Type::Formcalc;
else if (wsCondition.Left(2) == L".(" && wsCondition.Last() == L')')
- eLangType = CXFA_ScriptData::Type::Javascript;
+ eLangType = CXFA_Script::Type::Javascript;
else
return;