diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-22 22:08:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-22 22:08:57 +0000 |
commit | 7f2d01a2dc223aca5522efaeed0eba9fc145fc51 (patch) | |
tree | f643e741b145ce7e67a391cc8a40696a6a9298f8 /xfa/fxfa | |
parent | 1ca42167e5913eddf57f137fd7b4cc2110b6cd1f (diff) | |
download | pdfium-7f2d01a2dc223aca5522efaeed0eba9fc145fc51.tar.xz |
Convert CXFA_EventParam to store a CXFA_Node
This CL changes the CXFA_EventParam code to store a CXFA_Node instead of
a CXFA_WidgetAcc.
Change-Id: I21510674b0b6435ca9b87bfbf97914f54e5e3464
Reviewed-on: https://pdfium-review.googlesource.com/23451
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/cxfa_eventparam.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdatetimeedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 34 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fflistbox.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 2 |
11 files changed, 36 insertions, 41 deletions
diff --git a/xfa/fxfa/cxfa_eventparam.h b/xfa/fxfa/cxfa_eventparam.h index eafd76c6af..210eeb515a 100644 --- a/xfa/fxfa/cxfa_eventparam.h +++ b/xfa/fxfa/cxfa_eventparam.h @@ -9,7 +9,7 @@ #include "xfa/fxfa/fxfa_basic.h" -class CXFA_WidgetAcc; +class CXFA_Node; enum XFA_EVENTTYPE { XFA_EVENT_Click, @@ -53,7 +53,7 @@ class CXFA_EventParam { void Reset(); - CXFA_WidgetAcc* m_pTarget; + CXFA_Node* m_pTarget; XFA_EVENTTYPE m_eType; WideString m_wsResult; bool m_bCancelAction; diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index 858cbf4a5e..4f9f402fff 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -312,23 +312,23 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists(); if (ProcessCommittedData()) { - eParam.m_pTarget = exclNode ? exclNode->GetWidgetAcc() : nullptr; + eParam.m_pTarget = exclNode; if (exclNode) { m_pDocView->AddValidateWidget(exclNode->GetWidgetAcc()); m_pDocView->AddCalculateWidgetAcc(exclNode->GetWidgetAcc()); exclNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } else { SetFWLCheckState(m_pNode->GetWidgetAcc()->GetCheckState()); } if (exclNode) { - eParam.m_pTarget = exclNode->GetWidgetAcc(); + eParam.m_pTarget = exclNode; exclNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); } - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); break; } diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index f29fd68773..3f3cfe3d36 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -138,7 +138,7 @@ bool CXFA_FFComboBox::IsDataChanged() { void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { pParam->m_eType = XFA_EVENT_Change; - pParam->m_pTarget = m_pNode->GetWidgetAcc(); + pParam->m_pTarget = m_pNode.Get(); pParam->m_wsNewText = ToComboBox(m_pNormalWidget.get())->GetEditText(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, pParam); } @@ -313,14 +313,14 @@ void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) { void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PreOpen; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::PreOpen, &eParam); } void CXFA_FFComboBox::OnPostOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PostOpen; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::PostOpen, &eParam); } diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index d6bd096e54..8576e3938f 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -200,7 +200,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); eParam.m_wsNewText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Change, &eParam); } diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index f55733fe94..f7dbb98ce0 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -402,41 +402,37 @@ void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) { } static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, - CXFA_WidgetAcc* pWidgetAcc, + 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(pDocView); + return pNode->ProcessCalculate(pDocView); case XFA_EVENT_Validate: if (pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled( pDocView->GetDoc())) { - return node->ProcessValidate(pDocView, 0x01); + return pNode->ProcessValidate(pDocView, 0x01); } 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(pDocView, calc->GetScriptIfExists(), pParam); + return pNode->ExecuteScript(pDocView, calc->GetScriptIfExists(), pParam); } default: break; } - return node->ProcessEvent(pDocView, gs_EventActivity[pParam->m_eType], - pParam); + return pNode->ProcessEvent(pDocView, gs_EventActivity[pParam->m_eType], + pParam); } int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, @@ -454,12 +450,11 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, if (!pFormNode->IsWidgetReady()) return XFA_EVENTERROR_NotExist; - CXFA_WidgetAcc* pWidgetAcc = pFormNode->GetWidgetAcc(); CXFA_EventParam eParam; eParam.m_eType = eEventType; - eParam.m_pTarget = pWidgetAcc; + eParam.m_pTarget = pFormNode; eParam.m_bIsFormReady = bIsFormReady; - return XFA_ProcessEvent(this, pWidgetAcc, &eParam); + return XFA_ProcessEvent(this, pFormNode, &eParam); } int32_t iRet = XFA_EVENTERROR_NotExist; @@ -477,12 +472,11 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, if (!pFormNode->IsWidgetReady()) return iRet; - CXFA_WidgetAcc* pWidgetAcc = pFormNode->GetWidgetAcc(); CXFA_EventParam eParam; eParam.m_eType = eEventType; - eParam.m_pTarget = pWidgetAcc; + eParam.m_pTarget = pFormNode; eParam.m_bIsFormReady = bIsFormReady; - iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam); + iRet |= XFA_ProcessEvent(this, pFormNode, &eParam); return iRet; } @@ -588,7 +582,7 @@ void CXFA_FFDocView::RunSubformIndexChange() { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_IndexChange; - eParam.m_pTarget = pSubformNode->GetWidgetAcc(); + eParam.m_pTarget = pSubformNode; pSubformNode->ProcessEvent(this, XFA_AttributeEnum::IndexChange, &eParam); } m_IndexChangedSubforms.clear(); diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h index e80a0acdca..8d472ee0bc 100644 --- a/xfa/fxfa/cxfa_ffdocview.h +++ b/xfa/fxfa/cxfa_ffdocview.h @@ -20,6 +20,7 @@ class CXFA_FFWidgetHandler; class CXFA_FFDoc; class CXFA_FFWidget; class CXFA_Subform; +class CXFA_WidgetAcc; class CXFA_WidgetAccIterator; extern const XFA_AttributeEnum gs_EventActivity[]; diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 8758e41ac5..e9f3101068 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -740,25 +740,25 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { if (event->m_dwCmd == FWL_MouseCommand::Enter) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseEnter; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseEnter, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::Leave) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseExit; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseExit, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseDown; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseDown, &eParam); } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseUp; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::MouseUp, &eParam); } @@ -767,7 +767,7 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_Event::Type::Click: { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Click; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Click, &eParam); break; } diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index aec9ed6c26..12a2c8a8c9 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -152,7 +152,7 @@ bool CXFA_FFListBox::UpdateFWLData() { void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); eParam.m_wsPrevText = m_pNode->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw); auto* pListBox = ToListBox(m_pNormalWidget.get()); diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 42efbffcd6..8464aa97e7 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -299,7 +299,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; eParam.m_wsChange = wsChanged; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); eParam.m_wsPrevText = wsPrevText; CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get()); if (m_pNode->GetUIType() == XFA_Element::DateTimeEdit) { @@ -321,7 +321,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Full; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Full, &eParam); } diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 00bbc0833f..fa3136ca77 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -403,7 +403,7 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_dwStatus |= XFA_WidgetStatus_Focused; CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Enter; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Enter, &eParam); return true; } @@ -619,7 +619,7 @@ void CXFA_FFWidget::EventKillFocus() { } CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Exit; - eParam.m_pTarget = m_pNode->GetWidgetAcc(); + eParam.m_pTarget = m_pNode.Get(); m_pNode->ProcessEvent(GetDocView(), XFA_AttributeEnum::Exit, &eParam); } diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 6d670c462d..fb2f012e0c 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -2078,7 +2078,7 @@ int32_t CXFA_Node::ProcessValidate(CXFA_FFDocView* docView, int32_t iFlags) { if (script) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Validate; - eParam.m_pTarget = GetWidgetAcc(); + eParam.m_pTarget = this; std::tie(iRet, bRet) = ExecuteBoolScript(docView, script, &eParam); } |