diff options
author | dsinclair <dsinclair@chromium.org> | 2016-07-19 10:16:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-19 10:16:10 -0700 |
commit | 3617751cea45fd636d58f535a662337fcea40c4a (patch) | |
tree | c6d153324a15b4e2ecd9a77a1b1307294ae8f75b /fpdfsdk/pdfwindow/PWL_ComboBox.cpp | |
parent | e6a6561b80e73347dd3a7bf660196455f154b573 (diff) | |
download | pdfium-3617751cea45fd636d58f535a662337fcea40c4a.tar.xz |
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
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_ComboBox.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
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); |