summaryrefslogtreecommitdiff
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
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
-rw-r--r--BUILD.gn2
-rw-r--r--xfa.gyp2
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jsapi.cpp61
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jsapi.h35
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp32
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.h4
-rw-r--r--xfa/fxfa/parser/xfa_basic_data.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_basic_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_document_datadescription_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_document_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_document_layout_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_layout_appadapter.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_locale.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_localemgr.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_localevalue.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_parser_imp.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_datawindow.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp20
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.h4
-rw-r--r--xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_logpseudomodel.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_nodehelper.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_resolveprocessor.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp1
-rw-r--r--xfa/fxfa/parser/xfa_utils_imp.cpp1
32 files changed, 46 insertions, 138 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 63ac287cef..c85af4a612 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1413,8 +1413,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/fm2js/xfa_error.h",
"xfa/fxfa/fm2js/xfa_expression.cpp",
"xfa/fxfa/fm2js/xfa_expression.h",
- "xfa/fxfa/fm2js/xfa_fm2jsapi.cpp",
- "xfa/fxfa/fm2js/xfa_fm2jsapi.h",
"xfa/fxfa/fm2js/xfa_fm2jscontext.cpp",
"xfa/fxfa/fm2js/xfa_fm2jscontext.h",
"xfa/fxfa/fm2js/xfa_fmparse.cpp",
diff --git a/xfa.gyp b/xfa.gyp
index 82b88c9591..8926c31c22 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -561,8 +561,6 @@
"xfa/fxfa/fm2js/xfa_error.h",
"xfa/fxfa/fm2js/xfa_expression.cpp",
"xfa/fxfa/fm2js/xfa_expression.h",
- "xfa/fxfa/fm2js/xfa_fm2jsapi.cpp",
- "xfa/fxfa/fm2js/xfa_fm2jsapi.h",
"xfa/fxfa/fm2js/xfa_fm2jscontext.cpp",
"xfa/fxfa/fm2js/xfa_fm2jscontext.h",
"xfa/fxfa/fm2js/xfa_fmparse.cpp",
diff --git a/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp b/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp
deleted file mode 100644
index 826739a9e7..0000000000
--- a/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
-#include "xfa/fxfa/fm2js/xfa_program.h"
-#include "xfa/fxfa/parser/xfa_document.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int32_t XFA_FM2JS_Translate(const CFX_WideStringC& wsFormcalc,
- CFX_WideTextBuf& wsJavascript,
- CFX_WideString& wsError) {
- if (wsFormcalc.IsEmpty()) {
- wsJavascript.Clear();
- wsError.clear();
- return 0;
- }
- int32_t status = 0;
- CXFA_FMProgram program;
- status = program.Init(wsFormcalc);
- if (status) {
- wsError = program.GetError().message;
- return status;
- }
- status = program.ParseProgram();
- if (status) {
- wsError = program.GetError().message;
- return status;
- }
- program.TranslateProgram(wsJavascript);
- return 0;
-}
-
-XFA_HFM2JSCONTEXT XFA_FM2JS_ContextCreate(v8::Isolate* pScriptIsolate,
- CFXJSE_Context* pScriptContext,
- CXFA_Document* pDocument) {
- return reinterpret_cast<XFA_HFM2JSCONTEXT>(
- new CXFA_FM2JSContext(pScriptIsolate, pScriptContext, pDocument));
-}
-
-void XFA_FM2JS_GlobalPropertyGetter(XFA_HFM2JSCONTEXT hFM2JSContext,
- CFXJSE_Value* pValue) {
- CXFA_FM2JSContext* pContext =
- reinterpret_cast<CXFA_FM2JSContext*>(hFM2JSContext);
- pContext->GlobalPropertyGetter(pValue);
-}
-
-void XFA_FM2JS_ContextRelease(XFA_HFM2JSCONTEXT hFM2JSContext) {
- delete reinterpret_cast<CXFA_FM2JSContext*>(hFM2JSContext);
-}
-#ifdef __cplusplus
-}
-#endif
diff --git a/xfa/fxfa/fm2js/xfa_fm2jsapi.h b/xfa/fxfa/fm2js/xfa_fm2jsapi.h
deleted file mode 100644
index e48591dbc0..0000000000
--- a/xfa/fxfa/fm2js/xfa_fm2jsapi.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_FM2JS_XFA_FM2JSAPI_H_
-#define XFA_FXFA_FM2JS_XFA_FM2JSAPI_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxfa/parser/xfa_document.h"
-#include "xfa/fxjse/include/fxjse.h"
-
-#define FOXIT_XFA_FM2JS_FORMCALC_RUNTIME "foxit_xfa_formcalc_runtime"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct XFA_HFM2JSCONTEXT_ { void** pData; } * XFA_HFM2JSCONTEXT;
-int32_t XFA_FM2JS_Translate(const CFX_WideStringC& wsFormcalc,
- CFX_WideTextBuf& wsJavascript,
- CFX_WideString& wsError);
-XFA_HFM2JSCONTEXT XFA_FM2JS_ContextCreate(v8::Isolate* pScriptIsolate,
- CFXJSE_Context* pScriptContext,
- CXFA_Document* pDocument);
-void XFA_FM2JS_GlobalPropertyGetter(XFA_HFM2JSCONTEXT hFM2JSContext,
- CFXJSE_Value* pValue);
-void XFA_FM2JS_ContextRelease(XFA_HFM2JSCONTEXT hFM2JSContext);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // XFA_FXFA_FM2JS_XFA_FM2JSAPI_H_
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index e778d42994..6eb8249cc1 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -11,7 +11,7 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fgas/localization/fgas_locale.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/fxfa/fm2js/xfa_program.h"
#include "xfa/fxfa/parser/xfa_document.h"
#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_parser.h"
@@ -3404,7 +3404,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis,
CFX_WideTextBuf wsJavaScriptBuf;
CFX_WideString javaScript;
CFX_WideString wsError;
- XFA_FM2JS_Translate(
+ CXFA_FM2JSContext::Translate(
CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(),
wsJavaScriptBuf, wsError);
CFXJSE_Context* pContext =
@@ -6417,7 +6417,8 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis,
CFX_WideString::FromUTF8(argString.AsStringC());
CFX_WideTextBuf wsJavaScriptBuf;
CFX_WideString wsError;
- XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError);
+ CXFA_FM2JSContext::Translate(scriptString.AsStringC(), wsJavaScriptBuf,
+ wsError);
if (wsError.IsEmpty()) {
CFX_WideString javaScript = wsJavaScriptBuf.MakeString();
FXJSE_Value_SetUTF8String(
@@ -7122,6 +7123,31 @@ void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg,
}
}
+// static.
+int32_t CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc,
+ CFX_WideTextBuf& wsJavascript,
+ CFX_WideString& wsError) {
+ if (wsFormcalc.IsEmpty()) {
+ wsJavascript.Clear();
+ wsError.clear();
+ return 0;
+ }
+ int32_t status = 0;
+ CXFA_FMProgram program;
+ status = program.Init(wsFormcalc);
+ if (status) {
+ wsError = program.GetError().message;
+ return status;
+ }
+ status = program.ParseProgram();
+ if (status) {
+ wsError = program.GetError().message;
+ return status;
+ }
+ program.TranslateProgram(wsJavascript);
+ return 0;
+}
+
CXFA_FM2JSContext::CXFA_FM2JSContext(v8::Isolate* pScriptIsolate,
CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc)
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h
index 2af67f62cf..a5270092e8 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h
@@ -432,6 +432,10 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
static void ValueToUTF8String(CFXJSE_Value* pValue,
CFX_ByteString& outputValue);
+ static int32_t Translate(const CFX_WideStringC& wsFormcalc,
+ CFX_WideTextBuf& wsJavascript,
+ CFX_WideString& wsError);
+
CXFA_FM2JSContext(v8::Isolate* pScriptIsolate,
CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc);
diff --git a/xfa/fxfa/parser/xfa_basic_data.cpp b/xfa/fxfa/parser/xfa_basic_data.cpp
index 822b23f5e6..a2ffe4c6c1 100644
--- a/xfa/fxfa/parser/xfa_basic_data.cpp
+++ b/xfa/fxfa/parser/xfa_basic_data.cpp
@@ -6,7 +6,6 @@
#include "xfa/fxfa/parser/xfa_basic_data.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index 8f53b57467..86a96bbd63 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -9,7 +9,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/crt/fgas_system.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
index 27d89b4146..f52c1053e8 100644
--- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
@@ -4,7 +4,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#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"
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index d3d5c7f27b..03643cd988 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp
index e7b6a128d9..ffc7ed6729 100644
--- a/xfa/fxfa/parser/xfa_document_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_imp.cpp
@@ -6,7 +6,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_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp
index 44d053b8c2..854e773c9e 100644
--- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp
@@ -6,7 +6,6 @@
#include "xfa/fxfa/parser/xfa_document_layout_imp.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index 96c70cb3fc..497c8216dd 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -8,7 +8,6 @@
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.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"
diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
index dca11da80f..0d74a577b4 100644
--- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp
+++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_layout_appadapter.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_document_layout_imp.h"
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 860de2d82c..7b7ecf4ba7 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -10,7 +10,6 @@
#include <memory>
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 374d1dc44e..02bc0a8469 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_layout_pagemgr_new.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_document_datamerger_imp.h"
diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp
index 7883856b67..bebb3ba6c5 100644
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ b/xfa/fxfa/parser/xfa_locale.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_locale.h"
#include "core/fxcrt/include/fx_xml.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"
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp
index 83c7cf025d..8f779d191c 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -9,7 +9,6 @@
#include "core/fxcodec/include/fx_codec.h"
#include "core/fxcrt/include/fx_xml.h"
#include "core/fxge/include/fx_ge.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_locale.h"
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index 7530d80f5a..f9c86b0961 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fgas/localization/fgas_localeimp.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"
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 0b1209734f..6f0cff3196 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -14,7 +14,6 @@
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/crt/fgas_system.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index 9cadcc6d1c..748cca5cad 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -10,7 +10,6 @@
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/include/xfa_checksum.h"
#include "xfa/fxfa/parser/xfa_basic_imp.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
diff --git a/xfa/fxfa/parser/xfa_script_datawindow.cpp b/xfa/fxfa/parser/xfa_script_datawindow.cpp
index f06c3110b9..e28049cb82 100644
--- a/xfa/fxfa/parser/xfa_script_datawindow.cpp
+++ b/xfa/fxfa/parser/xfa_script_datawindow.cpp
@@ -6,7 +6,6 @@
#include "xfa/fxfa/parser/xfa_script_datawindow.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"
diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
index c5d25bc246..c7f1318cda 100644
--- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
#include "xfa/fxfa/include/xfa_ffwidgethandler.h"
#include "xfa/fxfa/parser/xfa_doclayout.h"
#include "xfa/fxfa/parser/xfa_document.h"
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
index 2aa1de7580..128620c9f8 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_script_hostpseudomodel.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_document_layout_imp.h"
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>(
diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h
index 934df809ca..91f5f0ab80 100644
--- a/xfa/fxfa/parser/xfa_script_imp.h
+++ b/xfa/fxfa/parser/xfa_script_imp.h
@@ -9,7 +9,7 @@
#include <map>
-#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
+#include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
#include "xfa/fxfa/parser/xfa_document.h"
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxjse/cfxjse_arguments.h"
@@ -112,7 +112,7 @@ class CXFA_ScriptContext {
CFX_ArrayTemplate<CXFA_NodeList*> m_CacheListArray;
CXFA_NodeArray* m_pScriptNodeArray;
CXFA_ResolveProcessor* m_pResolveProcessor;
- XFA_HFM2JSCONTEXT m_hFM2JSContext;
+ CXFA_FM2JSContext* m_hFM2JSContext;
CXFA_Object* m_pThisObject;
uint32_t m_dwBuiltInInFlags;
XFA_ATTRIBUTEENUM m_eRunAtType;
diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
index 1720d7350a..60db201d69 100644
--- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
@@ -10,7 +10,6 @@
#include "third_party/base/stl_util.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_document_layout_imp.h"
diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
index 86d3803a46..977fe406d5 100644
--- a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
@@ -6,7 +6,6 @@
#include "xfa/fxfa/parser/xfa_script_logpseudomodel.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"
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
index 93bf40e324..9d699757f9 100644
--- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp
+++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_script_nodehelper.h"
#include "core/fxcrt/include/fx_ext.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"
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
index 8471b802cc..6be5bd03e6 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_script_resolveprocessor.h"
#include "core/fxcrt/include/fx_ext.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"
diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
index 2a397541da..6acd67cc7e 100644
--- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
@@ -7,7 +7,6 @@
#include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.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"
diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp
index d576b4de06..d644880c4c 100644
--- a/xfa/fxfa/parser/xfa_utils_imp.cpp
+++ b/xfa/fxfa/parser/xfa_utils_imp.cpp
@@ -8,7 +8,6 @@
#include "core/fxcrt/include/fx_ext.h"
#include "xfa/fde/xml/fde_xml_imp.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"