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_xfa.h"
8 
9 #include "fxjs/cfxjse_engine.h"
10 #include "fxjs/cfxjse_value.h"
11 #include "xfa/fxfa/parser/cxfa_document.h"
12 #include "xfa/fxfa/parser/cxfa_xfa.h"
13 
CJX_Xfa(CXFA_Xfa * node)14 CJX_Xfa::CJX_Xfa(CXFA_Xfa* node) : CJX_Model(node) {}
15 
16 CJX_Xfa::~CJX_Xfa() = default;
17 
thisValue(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)18 void CJX_Xfa::thisValue(CFXJSE_Value* pValue,
19                         bool bSetting,
20                         XFA_Attribute eAttribute) {
21   if (bSetting)
22     return;
23 
24   CXFA_Object* pThis = GetDocument()->GetScriptContext()->GetThisObject();
25   ASSERT(pThis);
26   pValue->Assign(GetDocument()->GetScriptContext()->GetJSValueFromMap(pThis));
27 }
28 
timeStamp(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)29 void CJX_Xfa::timeStamp(CFXJSE_Value* pValue,
30                         bool bSetting,
31                         XFA_Attribute eAttribute) {
32   Script_Attribute_String(pValue, bSetting, eAttribute);
33 }
34 
uuid(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)35 void CJX_Xfa::uuid(CFXJSE_Value* pValue,
36                    bool bSetting,
37                    XFA_Attribute eAttribute) {
38   Script_Attribute_String(pValue, bSetting, eAttribute);
39 }
40