summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp7
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp5
-rw-r--r--xfa/fxfa/cxfa_ffnotify.h2
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp8
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp29
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h7
-rw-r--r--xfa/fxfa/parser/cxfa_calculatedata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_calculatedata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp23
-rw-r--r--xfa/fxfa/parser/cxfa_script.cpp18
-rw-r--r--xfa/fxfa/parser/cxfa_script.h11
-rw-r--r--xfa/fxfa/parser/cxfa_scriptdata.cpp29
-rw-r--r--xfa/fxfa/parser/cxfa_scriptdata.h32
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_validate.h4
18 files changed, 88 insertions, 114 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 25a357bc46..30ae7124de 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -417,7 +417,7 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- return pWidgetAcc->ExecuteScript(calcData.GetScriptData(), pParam);
+ return pWidgetAcc->ExecuteScript(calcData.GetScript(), pParam);
}
default:
break;
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index e377fe1d2d..2b4748771e 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -23,6 +23,7 @@
#include "xfa/fxfa/cxfa_fwltheme.h"
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxgraphics/cxfa_gecolor.h"
#include "xfa/fxgraphics/cxfa_gepath.h"
@@ -680,10 +681,10 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
}
case XFA_AttributeEnum::Warning: {
if (version <= XFA_VERSION_204) {
- CXFA_ScriptData scriptData = calcData.GetScriptData();
- if (!scriptData.HasValidNode())
+ CXFA_Script* script = calcData.GetScript();
+ if (!script)
return 1;
- if (scriptData.GetExpression().IsEmpty())
+ if (script->GetExpression().IsEmpty())
return 1;
}
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index ef0b971424..9da75bde23 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -202,7 +202,7 @@ bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem,
return pAcc && pAcc->FindSplitPos(iBlockIndex, fCalcHeightPos);
}
-bool CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
+bool CXFA_FFNotify::RunScript(CXFA_Script* pScript, CXFA_Node* pFormItem) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
if (!pDocView)
return false;
@@ -216,8 +216,7 @@ bool CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
int32_t iRet;
bool bRet;
- std::tie(iRet, bRet) =
- pWidgetAcc->ExecuteBoolScript(CXFA_ScriptData(pScript), &EventParam);
+ std::tie(iRet, bRet) = pWidgetAcc->ExecuteBoolScript(pScript, &EventParam);
return iRet == XFA_EVENTERROR_Success && bRet;
}
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index 248f633a3d..651e91f21b 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -49,7 +49,7 @@ class CXFA_FFNotify {
bool FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
float& fCalcHeightPos);
- bool RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem);
+ bool RunScript(CXFA_Script* pScript, CXFA_Node* pFormItem);
int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
bool bIsFormReady = false,
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 39919bc1e7..685e92d61a 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -191,11 +191,11 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
switch (eEventType) {
case XFA_EVENT_Calculate: {
CXFA_CalculateData calcData = pWidgetAcc->GetCalculateData();
- return calcData.HasValidNode() && calcData.GetScriptData().HasValidNode();
+ return calcData.HasValidNode() && calcData.GetScript();
}
case XFA_EVENT_Validate: {
CXFA_Validate* validate = pWidgetAcc->GetValidate(false);
- return validate && validate->GetScriptData().HasValidNode();
+ return validate && validate->GetScript();
}
default:
break;
@@ -226,9 +226,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
return XFA_EVENTERROR_NotExist;
if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
-
- CXFA_ScriptData script = calcData.GetScriptData();
- return pWidgetAcc->ExecuteScript(script, pParam);
+ return pWidgetAcc->ExecuteScript(calcData.GetScript(), pParam);
}
default:
break;
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 755821ef6b..29685b02e8 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -24,6 +24,7 @@
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -307,7 +308,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(const CXFA_EventData& eventData,
case XFA_Element::Execute:
break;
case XFA_Element::Script:
- return ExecuteScript(eventData.GetScriptData(), pEventParam);
+ return ExecuteScript(eventData.GetScript(), pEventParam);
case XFA_Element::SignData:
break;
case XFA_Element::Submit:
@@ -331,7 +332,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() {
CXFA_EventParam EventParam;
EventParam.m_eType = XFA_EVENT_Calculate;
- int32_t iRet = ExecuteScript(calcData.GetScriptData(), &EventParam);
+ int32_t iRet = ExecuteScript(calcData.GetScript(), &EventParam);
if (iRet != XFA_EVENTERROR_Success)
return iRet;
@@ -539,14 +540,14 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End;
int32_t iFormat = 0;
int32_t iRet = XFA_EVENTERROR_NotExist;
- CXFA_ScriptData scriptData = validate->GetScriptData();
+ CXFA_Script* script = validate->GetScript();
bool bRet = false;
bool hasBoolResult = (bInitDoc || bStatus) && GetRawValue().IsEmpty();
- if (scriptData.HasValidNode()) {
+ if (script) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Validate;
eParam.m_pTarget = this;
- std::tie(iRet, bRet) = ExecuteBoolScript(scriptData, &eParam);
+ std::tie(iRet, bRet) = ExecuteBoolScript(script, &eParam);
}
XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
@@ -570,39 +571,39 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
return iRet | iFormat;
}
-int32_t CXFA_WidgetAcc::ExecuteScript(const CXFA_ScriptData& scriptData,
+int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script* script,
CXFA_EventParam* pEventParam) {
bool bRet;
int32_t iRet;
- std::tie(iRet, bRet) = ExecuteBoolScript(scriptData, pEventParam);
+ std::tie(iRet, bRet) = ExecuteBoolScript(script, pEventParam);
return iRet;
}
std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript(
- CXFA_ScriptData scriptData,
+ CXFA_Script* script,
CXFA_EventParam* pEventParam) {
static const uint32_t MAX_RECURSION_DEPTH = 2;
if (m_nRecursionDepth > MAX_RECURSION_DEPTH)
return {XFA_EVENTERROR_Success, false};
ASSERT(pEventParam);
- if (!scriptData.HasValidNode())
+ if (!script)
return {XFA_EVENTERROR_NotExist, false};
- if (scriptData.GetRunAt() == XFA_AttributeEnum::Server)
+ if (script->GetRunAt() == XFA_AttributeEnum::Server)
return {XFA_EVENTERROR_Disabled, false};
- WideString wsExpression = scriptData.GetExpression();
+ WideString wsExpression = script->GetExpression();
if (wsExpression.IsEmpty())
return {XFA_EVENTERROR_NotExist, false};
- CXFA_ScriptData::Type eScriptType = scriptData.GetContentType();
- if (eScriptType == CXFA_ScriptData::Type::Unknown)
+ CXFA_Script::Type eScriptType = script->GetContentType();
+ if (eScriptType == CXFA_Script::Type::Unknown)
return {XFA_EVENTERROR_Success, false};
CXFA_FFDoc* pDoc = GetDoc();
CFXJSE_Engine* pContext = pDoc->GetXFADoc()->GetScriptContext();
pContext->SetEventParam(*pEventParam);
- pContext->SetRunAtType(scriptData.GetRunAt());
+ pContext->SetRunAtType(script->GetRunAt());
std::vector<CXFA_Node*> refNodes;
if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index 4a46a9d80b..e193bd2069 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -18,7 +18,6 @@
#include "xfa/fxfa/parser/cxfa_eventdata.h"
#include "xfa/fxfa/parser/cxfa_imagedata.h"
#include "xfa/fxfa/parser/cxfa_margindata.h"
-#include "xfa/fxfa/parser/cxfa_scriptdata.h"
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
class CFGAS_GEFont;
@@ -28,6 +27,7 @@ class CXFA_FFDoc;
class CXFA_FFDocView;
class CXFA_FFWidget;
class CXFA_Node;
+class CXFA_Script;
class CXFA_TextLayout;
class CXFA_WidgetLayoutData;
class IXFA_AppProvider;
@@ -49,9 +49,8 @@ class CXFA_WidgetAcc : public CXFA_WidgetData {
CXFA_EventParam* pEventParam);
int32_t ProcessCalculate();
int32_t ProcessValidate(int32_t iFlags);
- int32_t ExecuteScript(const CXFA_ScriptData& scriptData,
- CXFA_EventParam* pEventParam);
- std::pair<int32_t, bool> ExecuteBoolScript(CXFA_ScriptData scriptData,
+ int32_t ExecuteScript(CXFA_Script* script, CXFA_EventParam* pEventParam);
+ std::pair<int32_t, bool> ExecuteBoolScript(CXFA_Script* script,
CXFA_EventParam* pEventParam);
CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget);
diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp
index 32dc8ef5b7..3d7711d433 100644
--- a/xfa/fxfa/parser/cxfa_calculatedata.cpp
+++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_calculatedata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_text.h"
CXFA_CalculateData::CXFA_CalculateData(CXFA_Node* pNode)
@@ -18,8 +19,9 @@ XFA_AttributeEnum CXFA_CalculateData::GetOverride() const {
.value_or(XFA_AttributeEnum::Error);
}
-CXFA_ScriptData CXFA_CalculateData::GetScriptData() const {
- return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false));
+CXFA_Script* CXFA_CalculateData::GetScript() const {
+ return static_cast<CXFA_Script*>(
+ m_pNode->GetChild(0, XFA_Element::Script, false));
}
WideString CXFA_CalculateData::GetMessageText() const {
diff --git a/xfa/fxfa/parser/cxfa_calculatedata.h b/xfa/fxfa/parser/cxfa_calculatedata.h
index 833b1508a4..3e0802e6c4 100644
--- a/xfa/fxfa/parser/cxfa_calculatedata.h
+++ b/xfa/fxfa/parser/cxfa_calculatedata.h
@@ -9,16 +9,16 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_datadata.h"
-#include "xfa/fxfa/parser/cxfa_scriptdata.h"
class CXFA_Node;
+class CXFA_Script;
class CXFA_CalculateData : public CXFA_DataData {
public:
explicit CXFA_CalculateData(CXFA_Node* pNode);
XFA_AttributeEnum GetOverride() const;
- CXFA_ScriptData GetScriptData() const;
+ CXFA_Script* GetScript() const;
WideString GetMessageText() const;
};
diff --git a/xfa/fxfa/parser/cxfa_eventdata.cpp b/xfa/fxfa/parser/cxfa_eventdata.cpp
index 062d881cda..d5b170b734 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.cpp
+++ b/xfa/fxfa/parser/cxfa_eventdata.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_eventdata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_submit.h"
CXFA_EventData::CXFA_EventData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
@@ -31,8 +32,9 @@ WideString CXFA_EventData::GetRef() const {
return m_pNode->JSObject()->GetCData(XFA_Attribute::Ref);
}
-CXFA_ScriptData CXFA_EventData::GetScriptData() const {
- return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false));
+CXFA_Script* CXFA_EventData::GetScript() const {
+ return static_cast<CXFA_Script*>(
+ m_pNode->GetChild(0, XFA_Element::Script, false));
}
CXFA_Submit* CXFA_EventData::GetSubmit() const {
diff --git a/xfa/fxfa/parser/cxfa_eventdata.h b/xfa/fxfa/parser/cxfa_eventdata.h
index 63349690ab..8338767fe0 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.h
+++ b/xfa/fxfa/parser/cxfa_eventdata.h
@@ -11,9 +11,9 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_datadata.h"
-#include "xfa/fxfa/parser/cxfa_scriptdata.h"
class CXFA_Node;
+class CXFA_Script;
class CXFA_Submit;
class CXFA_EventData : public CXFA_DataData {
@@ -22,7 +22,7 @@ class CXFA_EventData : public CXFA_DataData {
XFA_AttributeEnum GetActivity();
XFA_Element GetEventType() const;
- CXFA_ScriptData GetScriptData() const;
+ CXFA_Script* GetScript() const;
CXFA_Submit* GetSubmit() const;
WideString GetRef() const;
};
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index f9040d6b4d..4d70d7d50f 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -229,6 +229,15 @@ void SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem,
}
}
+bool RunBreakTestScript(CXFA_Script* pTestScript) {
+ WideString wsExpression = pTestScript->JSObject()->GetContent(false);
+ if (wsExpression.IsEmpty())
+ return true;
+ return pTestScript->GetDocument()->GetNotify()->RunScript(
+ pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent,
+ XFA_ObjectType::ContainerNode));
+}
+
} // namespace
class CXFA_ContainerRecord {
@@ -481,15 +490,6 @@ float CXFA_LayoutPageMgr::GetAvailHeight() {
return FLT_MAX;
}
-bool XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) {
- WideString wsExpression = pTestScript->JSObject()->GetContent(false);
- if (wsExpression.IsEmpty())
- return true;
- return pTestScript->GetDocument()->GetNotify()->RunScript(
- pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent,
- XFA_ObjectType::ContainerNode));
-}
-
CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
CXFA_Node* pPageNode,
bool bCreateNew) {
@@ -816,8 +816,9 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
CXFA_Node* pContainer = pFormNode->GetTemplateNode();
bool bStartNew =
pCurNode->JSObject()->GetInteger(XFA_Attribute::StartNew) != 0;
- CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_Element::Script);
- if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript))
+ CXFA_Script* pScript = static_cast<CXFA_Script*>(
+ pCurNode->GetFirstChildByClass(XFA_Element::Script));
+ if (pScript && !RunBreakTestScript(pScript))
return false;
WideString wsTarget =
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp
index ab317f38e8..1b784b331b 100644
--- a/xfa/fxfa/parser/cxfa_script.cpp
+++ b/xfa/fxfa/parser/cxfa_script.cpp
@@ -46,3 +46,21 @@ CXFA_Script::CXFA_Script(CXFA_Document* doc, XFA_PacketType packet)
pdfium::MakeUnique<CJX_Script>(this)) {}
CXFA_Script::~CXFA_Script() {}
+
+CXFA_Script::Type CXFA_Script::GetContentType() {
+ pdfium::Optional<WideString> cData =
+ JSObject()->TryCData(XFA_Attribute::ContentType, false);
+ if (!cData || *cData == L"application/x-formcalc")
+ return Type::Formcalc;
+ if (*cData == L"application/x-javascript")
+ return Type::Javascript;
+ return Type::Unknown;
+}
+
+XFA_AttributeEnum CXFA_Script::GetRunAt() {
+ return JSObject()->GetEnum(XFA_Attribute::RunAt);
+}
+
+WideString CXFA_Script::GetExpression() {
+ return JSObject()->GetContent(false);
+}
diff --git a/xfa/fxfa/parser/cxfa_script.h b/xfa/fxfa/parser/cxfa_script.h
index d14f7c113b..8ea7aac60b 100644
--- a/xfa/fxfa/parser/cxfa_script.h
+++ b/xfa/fxfa/parser/cxfa_script.h
@@ -7,12 +7,23 @@
#ifndef XFA_FXFA_PARSER_CXFA_SCRIPT_H_
#define XFA_FXFA_PARSER_CXFA_SCRIPT_H_
+#include "core/fxcrt/widestring.h"
#include "xfa/fxfa/parser/cxfa_node.h"
class CXFA_Script : public CXFA_Node {
public:
+ enum class Type {
+ Formcalc = 0,
+ Javascript,
+ Unknown,
+ };
+
CXFA_Script(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Script() override;
+
+ Type GetContentType();
+ XFA_AttributeEnum GetRunAt();
+ WideString GetExpression();
};
#endif // XFA_FXFA_PARSER_CXFA_SCRIPT_H_
diff --git a/xfa/fxfa/parser/cxfa_scriptdata.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp
deleted file mode 100644
index 7e9f49066f..0000000000
--- a/xfa/fxfa/parser/cxfa_scriptdata.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fxfa/parser/cxfa_scriptdata.h"
-
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-CXFA_ScriptData::Type CXFA_ScriptData::GetContentType() const {
- pdfium::Optional<WideString> cData =
- m_pNode->JSObject()->TryCData(XFA_Attribute::ContentType, false);
- if (!cData || *cData == L"application/x-formcalc")
- return Type::Formcalc;
- if (*cData == L"application/x-javascript")
- return Type::Javascript;
- return Type::Unknown;
-}
-
-XFA_AttributeEnum CXFA_ScriptData::GetRunAt() const {
- return m_pNode->JSObject()->GetEnum(XFA_Attribute::RunAt);
-}
-
-WideString CXFA_ScriptData::GetExpression() const {
- return m_pNode->JSObject()->GetContent(false);
-}
diff --git a/xfa/fxfa/parser/cxfa_scriptdata.h b/xfa/fxfa/parser/cxfa_scriptdata.h
deleted file mode 100644
index 983addbd0c..0000000000
--- a/xfa/fxfa/parser/cxfa_scriptdata.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
-#define XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
-
-#include <stdint.h>
-
-#include "core/fxcrt/fx_string.h"
-#include "xfa/fxfa/parser/cxfa_datadata.h"
-
-class CXFA_Node;
-
-class CXFA_ScriptData : public CXFA_DataData {
- public:
- enum class Type {
- Formcalc = 0,
- Javascript,
- Unknown,
- };
-
- explicit CXFA_ScriptData(CXFA_Node* pNode);
-
- Type GetContentType() const;
- XFA_AttributeEnum GetRunAt() const;
- WideString GetExpression() const;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 9b31a17434..57cf5d4ecf 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -8,6 +8,7 @@
#include "fxjs/xfa/cjx_validate.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_script.h"
namespace {
@@ -144,6 +145,6 @@ WideString CXFA_Validate::GetPicture() {
return pNode ? pNode->JSObject()->GetContent(false) : L"";
}
-CXFA_ScriptData CXFA_Validate::GetScriptData() {
- return CXFA_ScriptData(GetChild(0, XFA_Element::Script, false));
+CXFA_Script* CXFA_Validate::GetScript() {
+ return static_cast<CXFA_Script*>(GetChild(0, XFA_Element::Script, false));
}
diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h
index 9e2be9c959..df08ea6d3d 100644
--- a/xfa/fxfa/parser/cxfa_validate.h
+++ b/xfa/fxfa/parser/cxfa_validate.h
@@ -9,6 +9,8 @@
#include "xfa/fxfa/parser/cxfa_node.h"
+class CXFA_Script;
+
class CXFA_Validate : public CXFA_Node {
public:
CXFA_Validate(CXFA_Document* doc, XFA_PacketType packet);
@@ -29,7 +31,7 @@ class CXFA_Validate : public CXFA_Node {
void SetScriptMessageText(const WideString& wsMessage);
WideString GetPicture();
- CXFA_ScriptData GetScriptData();
+ CXFA_Script* GetScript();
private:
WideString GetMessageText(const WideString& wsMessageType);