1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "fxjs/xfa/cjx_container.h" 8 9 #include <vector> 10 11 #include "fxjs/xfa/cfxjse_class.h" 12 #include "fxjs/xfa/cfxjse_engine.h" 13 #include "fxjs/xfa/cfxjse_value.h" 14 #include "xfa/fxfa/parser/cxfa_arraynodelist.h" 15 #include "xfa/fxfa/parser/cxfa_document.h" 16 #include "xfa/fxfa/parser/cxfa_field.h" 17 18 const CJX_MethodSpec CJX_Container::MethodSpecs[] = { 19 {"getDelta", getDelta_static}, 20 {"getDeltas", getDeltas_static}}; 21 CJX_Container(CXFA_Node * node)22CJX_Container::CJX_Container(CXFA_Node* node) : CJX_Node(node) { 23 DefineMethods(MethodSpecs); 24 } 25 ~CJX_Container()26CJX_Container::~CJX_Container() {} 27 DynamicTypeIs(TypeTag eType) const28bool CJX_Container::DynamicTypeIs(TypeTag eType) const { 29 return eType == static_type__ || ParentType__::DynamicTypeIs(eType); 30 } 31 getDelta(CFX_V8 * runtime,const std::vector<v8::Local<v8::Value>> & params)32CJS_Result CJX_Container::getDelta( 33 CFX_V8* runtime, 34 const std::vector<v8::Local<v8::Value>>& params) { 35 return CJS_Result::Success(); 36 } 37 getDeltas(CFX_V8 * runtime,const std::vector<v8::Local<v8::Value>> & params)38CJS_Result CJX_Container::getDeltas( 39 CFX_V8* runtime, 40 const std::vector<v8::Local<v8::Value>>& params) { 41 auto* pEngine = static_cast<CFXJSE_Engine*>(runtime); 42 return CJS_Result::Success(pEngine->NewXFAObject( 43 new CXFA_ArrayNodeList(GetDocument()), 44 GetDocument()->GetScriptContext()->GetJseNormalClass()->GetTemplate())); 45 } 46