summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-06 11:47:26 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-06 19:18:23 +0000
commit07dbf43d0c4655b76b44b9adbed2ab401b5bb08e (patch)
treef6468d6d3d41a1b320ddf78aa930b437d52ea8e5 /fpdfsdk/pdfwindow/cpwl_combo_box.cpp
parentfecd7506f715e7d6908445d4913015ce81c9b23d (diff)
downloadpdfium-07dbf43d0c4655b76b44b9adbed2ab401b5bb08e.tar.xz
Remove in-out param from OnKeyDownWithExit
This CL splits OnKeyDownWithExit into IsMovementKey and OnMovementKeyDown and removes the in-out param in favour of returning a bool. Change-Id: If8a83acec2d424ebd338d93445f366428940fbca Reviewed-on: https://pdfium-review.googlesource.com/7334 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_combo_box.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_combo_box.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
index 4427440bb8..acebfbe58b 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
@@ -46,9 +46,7 @@ bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
return !bExit;
}
-bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
- bool& bExit,
- uint32_t nFlag) {
+bool CPWL_CBListBox::IsMovementKey(uint16_t nChar) const {
switch (nChar) {
case FWL_VKEY_Up:
case FWL_VKEY_Down:
@@ -56,10 +54,14 @@ bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
case FWL_VKEY_Left:
case FWL_VKEY_End:
case FWL_VKEY_Right:
- break;
+ return true;
default:
return false;
}
+}
+
+bool CPWL_CBListBox::OnMovementKeyDown(uint16_t nChar, uint32_t nFlag) {
+ ASSERT(IsMovementKey(nChar));
switch (nChar) {
case FWL_VKEY_Up:
@@ -80,13 +82,11 @@ bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
case FWL_VKEY_Right:
m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
break;
- case FWL_VKEY_Delete:
- break;
}
+ bool bExit = false;
OnNotifySelChanged(true, bExit, nFlag);
-
- return true;
+ return bExit;
}
bool CPWL_CBListBox::OnCharWithExit(uint16_t nChar,
@@ -479,9 +479,8 @@ bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
return false;
}
#endif // PDF_ENABLE_XFA
- bool bExit = false;
- if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
- if (bExit)
+ if (m_pList->IsMovementKey(nChar)) {
+ if (m_pList->OnMovementKeyDown(nChar, nFlag))
return false;
SetSelectText();
}
@@ -497,9 +496,8 @@ bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
return false;
}
#endif // PDF_ENABLE_XFA
- bool bExit = false;
- if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
- if (bExit)
+ if (m_pList->IsMovementKey(nChar)) {
+ if (m_pList->OnMovementKeyDown(nChar, nFlag))
return false;
SetSelectText();
}