Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index eaa0a81d4d0b77144623d83da7bce485c7da1ac6..aad0b802bee8acd98fdb4432334c6ff9e1f10edc 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -207,9 +207,11 @@ bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) {
return true;
}
-ui::EventResult CustomButton::OnGestureEvent(ui::GestureEvent* event) {
- if (state_ == STATE_DISABLED)
- return Button::OnGestureEvent(event);
+void CustomButton::OnGestureEvent(ui::GestureEvent* event) {
+ if (state_ == STATE_DISABLED) {
+ Button::OnGestureEvent(event);
+ return;
+ }
if (event->type() == ui::ET_GESTURE_TAP && IsTriggerableEvent(*event)) {
// Set the button state to hot and start the animation fully faded in. The
@@ -218,17 +220,18 @@ ui::EventResult CustomButton::OnGestureEvent(ui::GestureEvent* event) {
SetState(STATE_HOVERED);
hover_animation_->Reset(1.0);
NotifyClick(*event);
- return ui::ER_CONSUMED;
+ event->StopPropagation();
} else if (event->type() == ui::ET_GESTURE_TAP_DOWN &&
ShouldEnterPushedState(*event)) {
SetState(STATE_PRESSED);
if (request_focus_on_press_)
RequestFocus();
- return ui::ER_CONSUMED;
+ event->StopPropagation();
} else {
SetState(STATE_NORMAL);
}
- return Button::OnGestureEvent(event);
+ if (!event->handled())
+ Button::OnGestureEvent(event);
}
bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) {
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/controls/button/menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698