summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_script_imp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-01 06:10:04 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-01 06:10:04 -0700
commite80e9f8fc221a7639b6a38bd46bc44bca26481d0 (patch)
tree44be9482610b3320e9606b336a2053d03b07258e /xfa/fxfa/parser/xfa_script_imp.cpp
parent8f3a31157843d6e3b2ba55acf3aaa5aa81db09e2 (diff)
downloadpdfium-e80e9f8fc221a7639b6a38bd46bc44bca26481d0.tar.xz
Remove XFA_HFM2JSCONTEXT.
This CL removes XFA_HFM2JSCONTEXT and the supporting code. XFA_HFM2JSCONTEXT was replaced by CXFA_FM2JSContext. The translate method was moved to CXFA_FM2JSContext. Review-Url: https://codereview.chromium.org/2024833003
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index eb71097cdf..8f579b5f26 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
#include "xfa/fxfa/parser/xfa_localemgr.h"
@@ -65,6 +64,8 @@ const FXJSE_CLASS_DESCRIPTOR VariablesClassDescriptor = {
CXFA_ScriptContext::NormalMethodCall,
};
+const char kFormCalcRuntime[] = "foxit_xfa_formcalc_runtime";
+
} // namespace
CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
@@ -80,6 +81,7 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
m_dwBuiltInInFlags(0),
m_eRunAtType(XFA_ATTRIBUTEENUM_Client) {
}
+
CXFA_ScriptContext::~CXFA_ScriptContext() {
FX_POSITION ps = m_mapXFAToValue.GetStartPosition();
while (ps) {
@@ -90,10 +92,9 @@ CXFA_ScriptContext::~CXFA_ScriptContext() {
}
m_mapXFAToValue.RemoveAll();
ReleaseVariablesMap();
- if (m_hFM2JSContext) {
- XFA_FM2JS_ContextRelease(m_hFM2JSContext);
- m_hFM2JSContext = NULL;
- }
+
+ delete m_hFM2JSContext;
+
if (m_pJsContext) {
FXJSE_Context_Release(m_pJsContext);
m_pJsContext = NULL;
@@ -119,11 +120,12 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) {
if (!m_hFM2JSContext) {
m_hFM2JSContext =
- XFA_FM2JS_ContextCreate(m_pIsolate, m_pJsContext, m_pDocument);
+ new CXFA_FM2JSContext(m_pIsolate, m_pJsContext, m_pDocument);
}
CFX_WideTextBuf wsJavaScript;
CFX_WideString wsErrorInfo;
- int32_t iFlags = XFA_FM2JS_Translate(wsScript, wsJavaScript, wsErrorInfo);
+ int32_t iFlags =
+ CXFA_FM2JSContext::Translate(wsScript, wsJavaScript, wsErrorInfo);
if (iFlags) {
FXJSE_Value_SetUndefined(hRetValue);
return FALSE;
@@ -210,8 +212,8 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject,
CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject);
CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName);
if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) {
- if (szPropName == FOXIT_XFA_FM2JS_FORMCALC_RUNTIME) {
- XFA_FM2JS_GlobalPropertyGetter(lpScriptContext->m_hFM2JSContext, pValue);
+ if (szPropName == kFormCalcRuntime) {
+ lpScriptContext->m_hFM2JSContext->GlobalPropertyGetter(pValue);
return;
}
XFA_HashCode uHashCode = static_cast<XFA_HashCode>(