From 16fea94c94006c25b878ef0acd0bb835397f62bb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Jul 2017 11:56:37 -0400 Subject: Remove in-out param from OnCharWithExit This CL splits the OnCharWithExit method into IsChar and OnCharNotify and changes the in-out parameter to a return. Change-Id: Ifd5aafc6facf7a4d9acfe56118331b3935691965 Reviewed-on: https://pdfium-review.googlesource.com/7335 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 19 ++++++++++--------- fpdfsdk/pdfwindow/cpwl_combo_box.h | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index acebfbe58b..20cbcd305c 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -89,17 +89,17 @@ bool CPWL_CBListBox::OnMovementKeyDown(uint16_t nChar, uint32_t nFlag) { return bExit; } -bool CPWL_CBListBox::OnCharWithExit(uint16_t nChar, - bool& bExit, - uint32_t nFlag) { - if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) - return false; +bool CPWL_CBListBox::IsChar(uint16_t nChar, uint32_t nFlag) const { + return m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); +} + +bool CPWL_CBListBox::OnCharNotify(uint16_t nChar, uint32_t nFlag) { if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) pComboBox->SetSelectText(); + bool bExit = false; OnNotifySelChanged(true, bExit, nFlag); - - return true; + return bExit; } void CPWL_CBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) { @@ -530,8 +530,9 @@ bool CPWL_ComboBox::OnChar(uint16_t nChar, uint32_t nFlag) { return false; } #endif // PDF_ENABLE_XFA - bool bExit = false; - return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : false; + if (!m_pList->IsChar(nChar, nFlag)) + return false; + return m_pList->OnCharNotify(nChar, nFlag); } void CPWL_ComboBox::NotifyLButtonDown(CPWL_Wnd* child, const CFX_PointF& pos) { diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h index e60e781656..37b3eb5a4e 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.h +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h @@ -24,7 +24,8 @@ class CPWL_CBListBox : public CPWL_ListBox { bool IsMovementKey(uint16_t nChar) const; bool OnMovementKeyDown(uint16_t nChar, uint32_t nFlag); - bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); + bool IsChar(uint16_t nChar, uint32_t nFlag) const; + bool OnCharNotify(uint16_t nChar, uint32_t nFlag); }; #define PWL_COMBOBOX_BUTTON_WIDTH 13 -- cgit v1.2.3