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

Side by Side Diff: xfa/fxfa/parser/xfa_script_imp.cpp

Issue 2025723002: xfa_fm2jscontext formatting and cleanup - pt I (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@value_helpers
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_script_imp.h" 7 #include "xfa/fxfa/parser/xfa_script_imp.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fxfa/app/xfa_ffnotify.h" 10 #include "xfa/fxfa/app/xfa_ffnotify.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, 112 FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
113 const CFX_WideStringC& wsScript, 113 const CFX_WideStringC& wsScript,
114 CFXJSE_Value* hRetValue, 114 CFXJSE_Value* hRetValue,
115 CXFA_Object* pThisObject) { 115 CXFA_Object* pThisObject) {
116 CFX_ByteString btScript; 116 CFX_ByteString btScript;
117 XFA_SCRIPTLANGTYPE eSaveType = m_eScriptType; 117 XFA_SCRIPTLANGTYPE eSaveType = m_eScriptType;
118 m_eScriptType = eScriptType; 118 m_eScriptType = eScriptType;
119 if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { 119 if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) {
120 if (!m_hFM2JSContext) { 120 if (!m_hFM2JSContext) {
121 m_hFM2JSContext = XFA_FM2JS_ContextCreate(); 121 m_hFM2JSContext =
122 XFA_FM2JS_ContextInitialize(m_hFM2JSContext, m_pIsolate, m_pJsContext, 122 XFA_FM2JS_ContextCreate(m_pIsolate, m_pJsContext, m_pDocument);
123 m_pDocument);
124 } 123 }
125 CFX_WideTextBuf wsJavaScript; 124 CFX_WideTextBuf wsJavaScript;
126 CFX_WideString wsErrorInfo; 125 CFX_WideString wsErrorInfo;
127 int32_t iFlags = XFA_FM2JS_Translate(wsScript, wsJavaScript, wsErrorInfo); 126 int32_t iFlags = XFA_FM2JS_Translate(wsScript, wsJavaScript, wsErrorInfo);
128 if (iFlags) { 127 if (iFlags) {
129 FXJSE_Value_SetUndefined(hRetValue); 128 FXJSE_Value_SetUndefined(hRetValue);
130 return FALSE; 129 return FALSE;
131 } 130 }
132 btScript = 131 btScript =
133 FX_UTF8Encode(wsJavaScript.GetBuffer(), wsJavaScript.GetLength()); 132 FX_UTF8Encode(wsJavaScript.GetBuffer(), wsJavaScript.GetLength());
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 } 761 }
763 } 762 }
764 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { 763 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) {
765 if (!m_pScriptNodeArray) { 764 if (!m_pScriptNodeArray) {
766 return; 765 return;
767 } 766 }
768 if (m_pScriptNodeArray->Find(pNode) == -1) { 767 if (m_pScriptNodeArray->Find(pNode) == -1) {
769 m_pScriptNodeArray->Add(pNode); 768 m_pScriptNodeArray->Add(pNode);
770 } 769 }
771 } 770 }
OLDNEW
« xfa/fxfa/fm2js/xfa_fm2jscontext.cpp ('K') | « xfa/fxfa/fm2js/xfa_fm2jscontext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698