summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-07 21:27:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 21:27:00 +0000
commit71335de2577ae27d00f03aeb007bf6b9c90d9391 (patch)
tree9b365fde1bc649e0f2f49556f908bdd165d4fbeb /xfa
parent2166e986c2aa0e73ae4f2f5af149fa234574094f (diff)
downloadpdfium-71335de2577ae27d00f03aeb007bf6b9c90d9391.tar.xz
Rename CXFA_Script to CXFA_ScriptData
This CL renames CXFA_Script to CXFA_ScriptData to show it is part of the data hierarchy. Change-Id: Idba3618af6a95eae2ff4541184e5a17f1457e1cb Reviewed-on: https://pdfium-review.googlesource.com/18012 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp4
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp6
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp27
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h7
-rw-r--r--xfa/fxfa/parser/cxfa_calculatedata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_calculatedata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_scriptdata.cpp (renamed from xfa/fxfa/parser/cxfa_script.cpp)10
-rw-r--r--xfa/fxfa/parser/cxfa_scriptdata.h (renamed from xfa/fxfa/parser/cxfa_script.h)10
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_validate.h4
14 files changed, 47 insertions, 49 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index ae277f05e4..d39f7f48be 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -417,9 +417,7 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
return XFA_EVENTERROR_NotExist;
if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
-
- CXFA_Script script = calcData.GetScript();
- return pWidgetAcc->ExecuteScript(script, pParam);
+ return pWidgetAcc->ExecuteScript(calcData.GetScriptData(), pParam);
}
default:
break;
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 010af86897..67a4cb1aca 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -682,12 +682,12 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
}
case XFA_ATTRIBUTEENUM_Warning: {
if (version <= XFA_VERSION_204) {
- CXFA_Script script = calcData.GetScript();
- if (!script)
+ CXFA_ScriptData scriptData = calcData.GetScriptData();
+ if (!scriptData)
return 1;
WideString wsExpression;
- script.GetExpression(wsExpression);
+ scriptData.GetExpression(wsExpression);
if (wsExpression.IsEmpty())
return 1;
}
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 3cad913d0a..9c2f475e51 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -221,7 +221,7 @@ bool CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
int32_t iRet;
bool bRet;
std::tie(iRet, bRet) =
- pWidgetAcc->ExecuteBoolScript(CXFA_Script(pScript), &EventParam);
+ pWidgetAcc->ExecuteBoolScript(CXFA_ScriptData(pScript), &EventParam);
return iRet == XFA_EVENTERROR_Success && bRet;
}
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 7de7d27748..9ab19623c2 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -190,11 +190,11 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
switch (eEventType) {
case XFA_EVENT_Calculate: {
CXFA_CalculateData calcData = pWidgetAcc->GetCalculateData();
- return calcData && calcData.GetScript();
+ return calcData && calcData.GetScriptData();
}
case XFA_EVENT_Validate: {
CXFA_Validate val = pWidgetAcc->GetValidate(false);
- return val && val.GetScript();
+ return val && val.GetScriptData();
}
default:
break;
@@ -226,7 +226,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
if (pWidgetAcc->GetNode()->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- CXFA_Script script = calcData.GetScript();
+ CXFA_ScriptData script = calcData.GetScriptData();
return pWidgetAcc->ExecuteScript(script, pParam);
}
default:
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 681ecbf0f8..59df6c9f4d 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -306,7 +306,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(const CXFA_EventData& eventData,
case XFA_Element::Execute:
break;
case XFA_Element::Script:
- return ExecuteScript(eventData.GetScript(), pEventParam);
+ return ExecuteScript(eventData.GetScriptData(), pEventParam);
case XFA_Element::SignData:
break;
case XFA_Element::Submit:
@@ -330,8 +330,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() {
CXFA_EventParam EventParam;
EventParam.m_eType = XFA_EVENT_Calculate;
- CXFA_Script script = calcData.GetScript();
- int32_t iRet = ExecuteScript(script, &EventParam);
+ int32_t iRet = ExecuteScript(calcData.GetScriptData(), &EventParam);
if (iRet != XFA_EVENTERROR_Success)
return iRet;
@@ -548,14 +547,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_Script script = validate.GetScript();
+ CXFA_ScriptData scriptData = validate.GetScriptData();
bool bRet = false;
bool hasBoolResult = (bInitDoc || bStatus) && GetRawValue().IsEmpty();
- if (script) {
+ if (scriptData) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Validate;
eParam.m_pTarget = this;
- std::tie(iRet, bRet) = ExecuteBoolScript(script, &eParam);
+ std::tie(iRet, bRet) = ExecuteBoolScript(scriptData, &eParam);
}
XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode();
@@ -579,40 +578,40 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
return iRet | iFormat;
}
-int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
+int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_ScriptData scriptData,
CXFA_EventParam* pEventParam) {
bool bRet;
int32_t iRet;
- std::tie(iRet, bRet) = ExecuteBoolScript(script, pEventParam);
+ std::tie(iRet, bRet) = ExecuteBoolScript(scriptData, pEventParam);
return iRet;
}
std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript(
- CXFA_Script script,
+ CXFA_ScriptData scriptData,
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 (!script)
+ if (!scriptData)
return {XFA_EVENTERROR_NotExist, false};
- if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server)
+ if (scriptData.GetRunAt() == XFA_ATTRIBUTEENUM_Server)
return {XFA_EVENTERROR_Disabled, false};
WideString wsExpression;
- script.GetExpression(wsExpression);
+ scriptData.GetExpression(wsExpression);
if (wsExpression.IsEmpty())
return {XFA_EVENTERROR_NotExist, false};
- XFA_SCRIPTTYPE eScriptType = script.GetContentType();
+ XFA_SCRIPTTYPE eScriptType = scriptData.GetContentType();
if (eScriptType == XFA_SCRIPTTYPE_Unkown)
return {XFA_EVENTERROR_Success, false};
CXFA_FFDoc* pDoc = GetDoc();
CFXJSE_Engine* pContext = pDoc->GetXFADoc()->GetScriptContext();
pContext->SetEventParam(*pEventParam);
- pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt());
+ pContext->SetRunAtType((XFA_ATTRIBUTEENUM)scriptData.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 8b750a2b9e..9191ac963c 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -18,7 +18,7 @@
#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_script.h"
+#include "xfa/fxfa/parser/cxfa_scriptdata.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
@@ -49,8 +49,9 @@ class CXFA_WidgetAcc : public CXFA_WidgetData {
CXFA_EventParam* pEventParam);
int32_t ProcessCalculate();
int32_t ProcessValidate(int32_t iFlags);
- int32_t ExecuteScript(CXFA_Script script, CXFA_EventParam* pEventParam);
- std::pair<int32_t, bool> ExecuteBoolScript(CXFA_Script script,
+ int32_t ExecuteScript(CXFA_ScriptData scriptData,
+ CXFA_EventParam* pEventParam);
+ std::pair<int32_t, bool> ExecuteBoolScript(CXFA_ScriptData scriptData,
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 1db5779486..599ffe3c8f 100644
--- a/xfa/fxfa/parser/cxfa_calculatedata.cpp
+++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp
@@ -17,8 +17,8 @@ int32_t CXFA_CalculateData::GetOverride() {
return eAtt;
}
-CXFA_Script CXFA_CalculateData::GetScript() {
- return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false));
+CXFA_ScriptData CXFA_CalculateData::GetScriptData() {
+ return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false));
}
void CXFA_CalculateData::GetMessageText(WideString& wsMessage) {
diff --git a/xfa/fxfa/parser/cxfa_calculatedata.h b/xfa/fxfa/parser/cxfa_calculatedata.h
index 0c1a8220c1..d610e1bbce 100644
--- a/xfa/fxfa/parser/cxfa_calculatedata.h
+++ b/xfa/fxfa/parser/cxfa_calculatedata.h
@@ -9,7 +9,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_data.h"
-#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_scriptdata.h"
class CXFA_Node;
@@ -18,7 +18,7 @@ class CXFA_CalculateData : public CXFA_Data {
explicit CXFA_CalculateData(CXFA_Node* pNode);
int32_t GetOverride();
- CXFA_Script GetScript();
+ CXFA_ScriptData GetScriptData();
void GetMessageText(WideString& wsMessage);
};
diff --git a/xfa/fxfa/parser/cxfa_eventdata.cpp b/xfa/fxfa/parser/cxfa_eventdata.cpp
index 5b48df6d88..22943216c4 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.cpp
+++ b/xfa/fxfa/parser/cxfa_eventdata.cpp
@@ -30,8 +30,8 @@ void CXFA_EventData::GetRef(WideStringView& wsRef) {
m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef, true);
}
-CXFA_Script CXFA_EventData::GetScript() const {
- return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false));
+CXFA_ScriptData CXFA_EventData::GetScriptData() const {
+ return CXFA_ScriptData(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 b6fdc48e99..e9a79f008f 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.h
+++ b/xfa/fxfa/parser/cxfa_eventdata.h
@@ -11,7 +11,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_data.h"
-#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_scriptdata.h"
#include "xfa/fxfa/parser/cxfa_submit.h"
class CXFA_Node;
@@ -22,7 +22,7 @@ class CXFA_EventData : public CXFA_Data {
int32_t GetActivity();
XFA_Element GetEventType() const;
- CXFA_Script GetScript() const;
+ CXFA_ScriptData GetScriptData() const;
CXFA_Submit GetSubmit() const;
void GetRef(WideStringView& wsRef);
void GetSignDataTarget(WideString& wsTarget);
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp
index fcb0f95af1..4f17a8394a 100644
--- a/xfa/fxfa/parser/cxfa_script.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptdata.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_scriptdata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
-CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-XFA_SCRIPTTYPE CXFA_Script::GetContentType() {
+XFA_SCRIPTTYPE CXFA_ScriptData::GetContentType() {
WideStringView cData;
if (m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ContentType, cData, false)) {
if (cData == L"application/x-javascript")
@@ -22,10 +22,10 @@ XFA_SCRIPTTYPE CXFA_Script::GetContentType() {
return XFA_SCRIPTTYPE_Formcalc;
}
-int32_t CXFA_Script::GetRunAt() {
+int32_t CXFA_ScriptData::GetRunAt() {
return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_RunAt);
}
-void CXFA_Script::GetExpression(WideString& wsExpression) {
+void CXFA_ScriptData::GetExpression(WideString& wsExpression) {
m_pNode->JSNode()->TryContent(wsExpression, false, true);
}
diff --git a/xfa/fxfa/parser/cxfa_script.h b/xfa/fxfa/parser/cxfa_scriptdata.h
index bb98f58abc..f7b8d741fc 100644
--- a/xfa/fxfa/parser/cxfa_script.h
+++ b/xfa/fxfa/parser/cxfa_scriptdata.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_CXFA_SCRIPT_H_
-#define XFA_FXFA_PARSER_CXFA_SCRIPT_H_
+#ifndef XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
+#define XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
#include <stdint.h>
@@ -20,13 +20,13 @@ enum XFA_SCRIPTTYPE {
class CXFA_Node;
-class CXFA_Script : public CXFA_Data {
+class CXFA_ScriptData : public CXFA_Data {
public:
- explicit CXFA_Script(CXFA_Node* pNode);
+ explicit CXFA_ScriptData(CXFA_Node* pNode);
XFA_SCRIPTTYPE GetContentType();
int32_t GetRunAt();
void GetExpression(WideString& wsExpression);
};
-#endif // XFA_FXFA_PARSER_CXFA_SCRIPT_H_
+#endif // XFA_FXFA_PARSER_CXFA_SCRIPTDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 2f97a02a51..2f38d82290 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -110,6 +110,6 @@ void CXFA_Validate::GetPicture(WideString& wsPicture) {
pNode->JSNode()->TryContent(wsPicture, false, true);
}
-CXFA_Script CXFA_Validate::GetScript() {
- return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false));
+CXFA_ScriptData CXFA_Validate::GetScriptData() {
+ return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false));
}
diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h
index ebe3eaee56..bf6b807b7e 100644
--- a/xfa/fxfa/parser/cxfa_validate.h
+++ b/xfa/fxfa/parser/cxfa_validate.h
@@ -10,7 +10,7 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxfa/parser/cxfa_data.h"
-#include "xfa/fxfa/parser/cxfa_script.h"
+#include "xfa/fxfa/parser/cxfa_scriptdata.h"
class CXFA_Node;
@@ -29,7 +29,7 @@ class CXFA_Validate : public CXFA_Data {
void GetScriptMessageText(WideString& wsMessage);
void SetScriptMessageText(WideString wsMessage);
void GetPicture(WideString& wsPicture);
- CXFA_Script GetScript();
+ CXFA_ScriptData GetScriptData();
private:
void GetMessageText(WideString& wsMessage, const WideString& wsMessageType);