OLD | NEW |
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/cxfa_scriptcontext.h" | 7 #include "xfa/fxfa/parser/cxfa_scriptcontext.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "core/fxcrt/fx_ext.h" | 11 #include "core/fxcrt/fx_ext.h" |
| 12 #include "third_party/base/ptr_util.h" |
12 #include "fxjs/cfxjse_arguments.h" | 13 #include "fxjs/cfxjse_arguments.h" |
13 #include "fxjs/cfxjse_class.h" | 14 #include "fxjs/cfxjse_class.h" |
14 #include "fxjs/cfxjse_value.h" | 15 #include "fxjs/cfxjse_value.h" |
15 #include "xfa/fxfa/app/xfa_ffnotify.h" | 16 #include "xfa/fxfa/app/xfa_ffnotify.h" |
16 #include "xfa/fxfa/cxfa_eventparam.h" | 17 #include "xfa/fxfa/cxfa_eventparam.h" |
17 #include "xfa/fxfa/parser/cxfa_document.h" | 18 #include "xfa/fxfa/parser/cxfa_document.h" |
18 #include "xfa/fxfa/parser/cxfa_nodehelper.h" | 19 #include "xfa/fxfa/parser/cxfa_nodehelper.h" |
19 #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" | 20 #include "xfa/fxfa/parser/cxfa_resolveprocessor.h" |
20 #include "xfa/fxfa/parser/xfa_basic_data.h" | 21 #include "xfa/fxfa/parser/xfa_basic_data.h" |
21 #include "xfa/fxfa/parser/xfa_localemgr.h" | 22 #include "xfa/fxfa/parser/xfa_localemgr.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 136 } |
136 m_mapVariableToContext.RemoveAll(); | 137 m_mapVariableToContext.RemoveAll(); |
137 | 138 |
138 m_upObjectArray.RemoveAll(); | 139 m_upObjectArray.RemoveAll(); |
139 } | 140 } |
140 | 141 |
141 void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { | 142 void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { |
142 m_pIsolate = pIsolate; | 143 m_pIsolate = pIsolate; |
143 DefineJsContext(); | 144 DefineJsContext(); |
144 DefineJsClass(); | 145 DefineJsClass(); |
145 m_ResolveProcessor.reset(new CXFA_ResolveProcessor); | 146 m_ResolveProcessor = pdfium::MakeUnique<CXFA_ResolveProcessor>(); |
146 } | 147 } |
| 148 |
147 bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, | 149 bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, |
148 const CFX_WideStringC& wsScript, | 150 const CFX_WideStringC& wsScript, |
149 CFXJSE_Value* hRetValue, | 151 CFXJSE_Value* hRetValue, |
150 CXFA_Object* pThisObject) { | 152 CXFA_Object* pThisObject) { |
151 CFX_ByteString btScript; | 153 CFX_ByteString btScript; |
152 XFA_SCRIPTLANGTYPE eSaveType = m_eScriptType; | 154 XFA_SCRIPTLANGTYPE eSaveType = m_eScriptType; |
153 m_eScriptType = eScriptType; | 155 m_eScriptType = eScriptType; |
154 if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { | 156 if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { |
155 if (!m_FM2JSContext) { | 157 if (!m_FM2JSContext) { |
156 m_FM2JSContext.reset( | 158 m_FM2JSContext.reset( |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 return; | 765 return; |
764 if (nodes.GetSize() > 0) | 766 if (nodes.GetSize() > 0) |
765 m_pScriptNodeArray->Copy(nodes); | 767 m_pScriptNodeArray->Copy(nodes); |
766 } | 768 } |
767 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { | 769 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { |
768 if (!m_pScriptNodeArray) | 770 if (!m_pScriptNodeArray) |
769 return; | 771 return; |
770 if (m_pScriptNodeArray->Find(pNode) == -1) | 772 if (m_pScriptNodeArray->Find(pNode) == -1) |
771 m_pScriptNodeArray->Add(pNode); | 773 m_pScriptNodeArray->Add(pNode); |
772 } | 774 } |
OLD | NEW |