From 93bb725b62f9779534c9444c1e1319fe8c28912e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 7 Dec 2017 22:33:43 +0000 Subject: [xfa] Move JS method information to files. This CL moves the XFA SOM JS Method information out of the c-array and into individual CJX class files. Change-Id: I401046a06aacaf1f04e5a51eb899e479de012e15 Reviewed-on: https://pdfium-review.googlesource.com/20450 Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_object.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_object.cpp') diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 7823015695..93d31244f6 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -9,11 +9,12 @@ #include #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_nodelist.h" +#include "xfa/fxfa/parser/cxfa_treelist.h" CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, @@ -30,20 +31,28 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, CXFA_Object::~CXFA_Object() {} +void CXFA_Object::GetSOMExpression(WideString& wsSOMExpression) { + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); + if (!pScriptContext) + return; + + pScriptContext->GetSomExpression(ToNode(this), wsSOMExpression); +} + CXFA_Node* CXFA_Object::AsNode() { return IsNode() ? static_cast(this) : nullptr; } -CXFA_NodeList* CXFA_Object::AsNodeList() { - return IsNodeList() ? static_cast(this) : nullptr; +CXFA_TreeList* CXFA_Object::AsTreeList() { + return IsTreeList() ? static_cast(this) : nullptr; } const CXFA_Node* CXFA_Object::AsNode() const { return IsNode() ? static_cast(this) : nullptr; } -const CXFA_NodeList* CXFA_Object::AsNodeList() const { - return IsNodeList() ? static_cast(this) : nullptr; +const CXFA_TreeList* CXFA_Object::AsTreeList() const { + return IsTreeList() ? static_cast(this) : nullptr; } CXFA_Node* ToNode(CXFA_Object* pObj) { -- cgit v1.2.3