1 // Copyright 2017 The PDFium Authors 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/fxv8.h" 10 #include "fxjs/xfa/cfxjse_engine.h" 11 #include "v8/include/v8-object.h" 12 #include "xfa/fxfa/parser/cxfa_document.h" 13 #include "xfa/fxfa/parser/cxfa_xfa.h" 14 CJX_Xfa(CXFA_Xfa * node)15CJX_Xfa::CJX_Xfa(CXFA_Xfa* node) : CJX_Model(node) {} 16 17 CJX_Xfa::~CJX_Xfa() = default; 18 DynamicTypeIs(TypeTag eType) const19bool CJX_Xfa::DynamicTypeIs(TypeTag eType) const { 20 return eType == static_type__ || ParentType__::DynamicTypeIs(eType); 21 } 22 thisValue(v8::Isolate * pIsolate,v8::Local<v8::Value> * pValue,bool bSetting,XFA_Attribute eAttribute)23void CJX_Xfa::thisValue(v8::Isolate* pIsolate, 24 v8::Local<v8::Value>* pValue, 25 bool bSetting, 26 XFA_Attribute eAttribute) { 27 if (bSetting) 28 return; 29 30 auto* pScriptContext = GetDocument()->GetScriptContext(); 31 CXFA_Object* pThis = pScriptContext->GetThisObject(); 32 *pValue = 33 pThis ? pScriptContext->GetOrCreateJSBindingFromMap(pThis).As<v8::Value>() 34 : fxv8::NewNullHelper(pIsolate); 35 } 36