summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_object.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-01 16:06:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-01 16:06:07 +0000
commita85e5ca5f2dfadcf9f3812a8ef039d1f206833a4 (patch)
tree5d44e797d038158cdc19b14ac6951435eb85c912 /xfa/fxfa/parser/cxfa_object.h
parente5434b5531f2c081c1d69f67125b6665070ea969 (diff)
downloadpdfium-a85e5ca5f2dfadcf9f3812a8ef039d1f206833a4.tar.xz
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 <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_object.h')
-rw-r--r--xfa/fxfa/parser/cxfa_object.h23
1 files changed, 13 insertions, 10 deletions
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 <memory>
+
#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<CJX_Object> jsObject);
UnownedPtr<CXFA_Document> 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<CJX_Object> m_pJSObject;
};
CXFA_Node* ToNode(CXFA_Object* pObj);