• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_manifest.h"
8 
9 #include <vector>
10 
11 #include "fxjs/cfxjse_value.h"
12 #include "fxjs/js_resources.h"
13 #include "xfa/fxfa/parser/cxfa_manifest.h"
14 
15 const CJX_MethodSpec CJX_Manifest::MethodSpecs[] = {
16     {"evaluate", evaluate_static}};
17 
CJX_Manifest(CXFA_Manifest * manifest)18 CJX_Manifest::CJX_Manifest(CXFA_Manifest* manifest) : CJX_Node(manifest) {
19   DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
20 }
21 
~CJX_Manifest()22 CJX_Manifest::~CJX_Manifest() {}
23 
evaluate(CJS_V8 * runtime,const std::vector<v8::Local<v8::Value>> & params)24 CJS_Return CJX_Manifest::evaluate(
25     CJS_V8* runtime,
26     const std::vector<v8::Local<v8::Value>>& params) {
27   if (!params.empty())
28     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
29 
30   return CJS_Return(
31       runtime->NewBoolean(!!ToNode(GetXFAObject())->GetWidgetAcc()));
32 }
33 
defaultValue(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)34 void CJX_Manifest::defaultValue(CFXJSE_Value* pValue,
35                                 bool bSetting,
36                                 XFA_Attribute eAttribute) {
37   Script_Som_DefaultValue(pValue, bSetting, eAttribute);
38 }
39 
action(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)40 void CJX_Manifest::action(CFXJSE_Value* pValue,
41                           bool bSetting,
42                           XFA_Attribute eAttribute) {
43   Script_Attribute_String(pValue, bSetting, eAttribute);
44 }
45 
use(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)46 void CJX_Manifest::use(CFXJSE_Value* pValue,
47                        bool bSetting,
48                        XFA_Attribute eAttribute) {
49   Script_Attribute_String(pValue, bSetting, eAttribute);
50 }
51 
usehref(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)52 void CJX_Manifest::usehref(CFXJSE_Value* pValue,
53                            bool bSetting,
54                            XFA_Attribute eAttribute) {
55   Script_Attribute_String(pValue, bSetting, eAttribute);
56 }
57