From a85e5ca5f2dfadcf9f3812a8ef039d1f206833a4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 1 Nov 2017 16:06:07 +0000 Subject: Split JS methods out of CXFA_Object This CL moves the javascript code from CXFA_Object to CJX_Object. The Script_* methods are proxied to CJX_Object. The ownership of the CJX_ object was removed from CXFA_Node and moved up to CXFA_Object. Change-Id: I58d286e6bb0151aa88d4f673bc7729987417bde6 Reviewed-on: https://pdfium-review.googlesource.com/17310 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_object.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_object.h') diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 3e305008b7..cec3346e8b 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -7,6 +7,8 @@ #ifndef XFA_FXFA_PARSER_CXFA_OBJECT_H_ #define XFA_FXFA_PARSER_CXFA_OBJECT_H_ +#include + #include "core/fxcrt/fx_string.h" #include "fxjs/fxjse.h" #include "xfa/fxfa/fxfa_basic.h" @@ -26,16 +28,13 @@ enum class XFA_ObjectType { }; class CFXJSE_Value; +class CJX_Object; class CXFA_Document; class CXFA_Node; class CXFA_NodeList; class CXFA_Object : public CFXJSE_HostObject { public: - CXFA_Object(CXFA_Document* pDocument, - XFA_ObjectType objectType, - XFA_Element eType, - const WideStringView& elementName); ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument.Get(); } @@ -70,6 +69,9 @@ class CXFA_Object : public CFXJSE_HostObject { const CXFA_Node* AsNode() const; const CXFA_NodeList* AsNodeList() const; + CJX_Object* JSObject() { return m_pJSObject.get(); } + const CJX_Object* JSObject() const { return m_pJSObject.get(); } + XFA_Element GetElementType() const { return m_elementType; } WideStringView GetClassName() const { return m_elementName; } uint32_t GetClassHashCode() const { return m_elementNameHash; } @@ -78,13 +80,12 @@ class CXFA_Object : public CFXJSE_HostObject { bool bSetting, XFA_ATTRIBUTE eAttribute); - void ThrowInvalidPropertyException() const; - void ThrowArgumentMismatchException() const; - void ThrowIndexOutOfBoundsException() const; - void ThrowParamCountMismatchException(const WideString& method) const; - protected: - void ThrowException(const wchar_t* str, ...) const; + CXFA_Object(CXFA_Document* pDocument, + XFA_ObjectType objectType, + XFA_Element eType, + const WideStringView& elementName, + std::unique_ptr jsObject); UnownedPtr const m_pDocument; const XFA_ObjectType m_objectType; @@ -92,6 +93,8 @@ class CXFA_Object : public CFXJSE_HostObject { const uint32_t m_elementNameHash; const WideStringView m_elementName; + + std::unique_ptr m_pJSObject; }; CXFA_Node* ToNode(CXFA_Object* pObj); -- cgit v1.2.3