From 3617751cea45fd636d58f535a662337fcea40c4a Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 19 Jul 2016 10:16:10 -0700 Subject: Remove m_pList conditionals from CPWL_ListBox We create |m_pList| in the constructor and it is never reset during the lifetime of the class or subclasses. Remove the conditional checks on the existence of |m_pList|. Review-Url: https://codereview.chromium.org/2162873003 --- fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 43 ++++++++++++++------------------------ 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'fpdfsdk/pdfwindow/PWL_ComboBox.cpp') diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index 5184cfe70a..dd899beba9 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -26,35 +26,27 @@ FX_BOOL CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); - if (m_bMouseDown) { - ReleaseCapture(); - m_bMouseDown = FALSE; - - if (ClientHitTest(point)) { - if (CPWL_Wnd* pParent = GetParentWindow()) { - pParent->OnNotify(this, PNM_LBUTTONUP, 0, - PWL_MAKEDWORD(point.x, point.y)); - } + if (!m_bMouseDown) + return TRUE; - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); - if (bExit) - return FALSE; - } - } + ReleaseCapture(); + m_bMouseDown = FALSE; - return TRUE; + if (!ClientHitTest(point)) + return TRUE; + if (CPWL_Wnd* pParent = GetParentWindow()) + pParent->OnNotify(this, PNM_LBUTTONUP, 0, PWL_MAKEDWORD(point.x, point.y)); + + FX_BOOL bExit = FALSE; + OnNotifySelChanged(FALSE, bExit, nFlag); + + return !bExit; } FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag) { - if (!m_pList) - return FALSE; - switch (nChar) { - default: - return FALSE; case FWL_VKEY_Up: case FWL_VKEY_Down: case FWL_VKEY_Home: @@ -62,6 +54,8 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, case FWL_VKEY_End: case FWL_VKEY_Right: break; + default: + return FALSE; } switch (nChar) { @@ -95,15 +89,10 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, FX_BOOL CPWL_CBListBox::OnCharWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag) { - if (!m_pList) - return FALSE; - if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) return FALSE; - - if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) { + if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) pComboBox->SetSelectText(); - } OnNotifySelChanged(TRUE, bExit, nFlag); -- cgit v1.2.3