summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidgethandler.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-22 22:01:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-22 22:01:57 +0000
commit1ca42167e5913eddf57f137fd7b4cc2110b6cd1f (patch)
tree33f018384bc7b974270cfcb19065815beb54a126 /xfa/fxfa/cxfa_ffwidgethandler.cpp
parent9ccf4047a6f36e9c0863541437af7734a04ca676 (diff)
downloadpdfium-1ca42167e5913eddf57f137fd7b4cc2110b6cd1f.tar.xz
Convert CXFA_FFWidgetHandler to use CXFA_Node
This CL removes CXFA_WidgetAcc from CXFA_FFWidgetHandler and uses CXFA_Node directly. Change-Id: I88cf1edc53f4489aeac018a95e9d5936d85106db Reviewed-on: https://pdfium-review.googlesource.com/23450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffwidgethandler.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 74ded4b5ae..66885e02b2 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -14,7 +14,6 @@
#include "xfa/fxfa/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
-#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_calculate.h"
#include "xfa/fxfa/parser/cxfa_checkbutton.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
@@ -183,66 +182,59 @@ void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
bHighlight ? XFA_WidgetStatus_Highlight : 0);
}
-bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
+bool CXFA_FFWidgetHandler::HasEvent(CXFA_Node* pNode,
XFA_EVENTTYPE eEventType) {
if (eEventType == XFA_EVENT_Unknown)
return false;
- if (!pWidgetAcc)
- return false;
-
- CXFA_Node* node = pWidgetAcc->GetNode();
- if (!node || node->GetElementType() == XFA_Element::Draw)
+ if (!pNode || pNode->GetElementType() == XFA_Element::Draw)
return false;
switch (eEventType) {
case XFA_EVENT_Calculate: {
- CXFA_Calculate* calc = node->GetCalculateIfExists();
+ CXFA_Calculate* calc = pNode->GetCalculateIfExists();
return calc && calc->GetScriptIfExists();
}
case XFA_EVENT_Validate: {
- CXFA_Validate* validate = node->GetValidateIfExists();
+ CXFA_Validate* validate = pNode->GetValidateIfExists();
return validate && validate->GetScriptIfExists();
}
default:
break;
}
- return !pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType], false)
+ return !pNode->GetEventByActivity(gs_EventActivity[eEventType], false)
.empty();
}
-int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
+int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_Node* pNode,
CXFA_EventParam* pParam) {
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc)
- return XFA_EVENTERROR_NotExist;
-
- CXFA_Node* node = pWidgetAcc->GetNode();
- if (!node || node->GetElementType() == XFA_Element::Draw)
+ if (!pNode || pNode->GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
switch (pParam->m_eType) {
case XFA_EVENT_Calculate:
- return node->ProcessCalculate(m_pDocView);
+ return pNode->ProcessCalculate(m_pDocView);
case XFA_EVENT_Validate:
if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled(
m_pDocView->GetDoc())) {
- return node->ProcessValidate(m_pDocView, 0);
+ return pNode->ProcessValidate(m_pDocView, 0);
}
return XFA_EVENTERROR_Disabled;
case XFA_EVENT_InitCalculate: {
- CXFA_Calculate* calc = node->GetCalculateIfExists();
+ CXFA_Calculate* calc = pNode->GetCalculateIfExists();
if (!calc)
return XFA_EVENTERROR_NotExist;
- if (node->IsUserInteractive())
+ if (pNode->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- return node->ExecuteScript(m_pDocView, calc->GetScriptIfExists(), pParam);
+ return pNode->ExecuteScript(m_pDocView, calc->GetScriptIfExists(),
+ pParam);
}
default:
break;
}
- int32_t iRet =
- node->ProcessEvent(m_pDocView, gs_EventActivity[pParam->m_eType], pParam);
+ int32_t iRet = pNode->ProcessEvent(m_pDocView,
+ gs_EventActivity[pParam->m_eType], pParam);
return iRet;
}