From 1ca42167e5913eddf57f137fd7b4cc2110b6cd1f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 22 Jan 2018 22:01:57 +0000 Subject: 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 Reviewed-by: Henrique Nakashima --- xfa/fxfa/cxfa_ffwidgethandler.cpp | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'xfa/fxfa/cxfa_ffwidgethandler.cpp') 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; } -- cgit v1.2.3