Home | History | Annotate | Download | only in xfa
      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/cfxjse_engine.h"
     12 #include "fxjs/cfxjse_value.h"
     13 #include "xfa/fxfa/parser/cxfa_arraynodelist.h"
     14 #include "xfa/fxfa/parser/cxfa_document.h"
     15 #include "xfa/fxfa/parser/cxfa_field.h"
     16 
     17 const CJX_MethodSpec CJX_Container::MethodSpecs[] = {
     18     {"getDelta", getDelta_static},
     19     {"getDeltas", getDeltas_static}};
     20 
     21 CJX_Container::CJX_Container(CXFA_Node* node) : CJX_Node(node) {
     22   DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
     23 }
     24 
     25 CJX_Container::~CJX_Container() {}
     26 
     27 CJS_Return CJX_Container::getDelta(
     28     CJS_V8* runtime,
     29     const std::vector<v8::Local<v8::Value>>& params) {
     30   return CJS_Return(true);
     31 }
     32 
     33 CJS_Return CJX_Container::getDeltas(
     34     CJS_V8* runtime,
     35     const std::vector<v8::Local<v8::Value>>& params) {
     36   CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(GetDocument());
     37   return CJS_Return(runtime->NewXFAObject(
     38       pFormNodes,
     39       GetDocument()->GetScriptContext()->GetJseNormalClass()->GetTemplate()));
     40 }
     41