From fecd7506f715e7d6908445d4913015ce81c9b23d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Jul 2017 11:35:04 -0400 Subject: Convert OnButtonUp to not have in-out params This CL removes the in-out param from OnButtonUp in favour of a single bool return. Change-Id: I2d91466677adcb366ed1c2d0721ce5e2949ed074 Reviewed-on: https://pdfium-review.googlesource.com/7333 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/formfiller/cffl_checkbox.cpp | 12 ++++++------ fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 24 ++++++++--------------- fpdfsdk/formfiller/cffl_interactiveformfiller.h | 4 +--- fpdfsdk/formfiller/cffl_radiobutton.cpp | 9 ++++----- 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index a89e76ac0d..4bab95a54e 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -45,17 +45,17 @@ bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView); - bool bReset = false; - bool bExit = false; CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); - m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( - &pObserved, pPageView, bReset, bExit, nFlags); + if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( + &pObserved, pPageView, nFlags)) { + if (!pObserved) + m_pWidget = nullptr; + return true; + } if (!pObserved) { m_pWidget = nullptr; return true; } - if (bReset || bExit) - return true; CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); CPWL_CheckBox* pWnd = GetCheckBox(pPageView, true); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index f5931d5a59..d318111ee6 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -244,11 +244,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); if (m_pFormFillEnv->GetFocusAnnot() != pAnnot->Get()) return bRet; - - bool bExit = false; - bool bReset = false; - OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); - if (!pAnnot || bExit) + if (OnButtonUp(pAnnot, pPageView, nFlags) || !pAnnot) return true; #ifdef PDF_ENABLE_XFA if (OnClick(pAnnot, pPageView, nFlags) || !pAnnot) @@ -257,17 +253,15 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, return bRet; } -void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) - return; + return false; m_bNotifying = true; @@ -280,17 +274,15 @@ void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false); if (pFormFiller) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - bReset = true; + return true; } bool CFFL_InteractiveFormFiller::OnLButtonDblClk( diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index de5aafd7e1..05fdf0d6c7 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -101,10 +101,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { void OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, uint32_t nFlag); - void OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); #ifdef PDF_ENABLE_XFA bool OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index 9ffdf494ca..e36e1f7554 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -48,13 +48,12 @@ bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView); - bool bReset = false; - bool bExit = false; CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); - m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( - &pObserved, pPageView, bReset, bExit, nFlags); - if (!pObserved || bReset || bExit) + if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( + &pObserved, pPageView, nFlags) || + !pObserved) { return true; + } CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); CPWL_RadioButton* pWnd = GetRadioButton(pPageView, true); -- cgit v1.2.3