Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1926)

Unified Diff: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp

Issue 2024833003: Remove XFA_HFM2JSCONTEXT. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.h ('k') | xfa/fxfa/parser/xfa_basic_data.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index e778d429948df19ebcaa50d4e3e25203666f74fe..6eb8249cc1f2b57b9acd65bdadb0974f075def07 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)
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.h ('k') | xfa/fxfa/parser/xfa_basic_data.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698