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 7bab3b69e4a007ea44ba4d15264ad40d641df674..0984915ce4d9c7032032e372bd8370e2975f9ce0 100644 |
--- a/ui/views/controls/button/custom_button.cc |
+++ b/ui/views/controls/button/custom_button.cc |
@@ -128,15 +128,19 @@ const char* CustomButton::GetClassName() const { |
} |
bool CustomButton::OnMousePressed(const ui::MouseEvent& event) { |
- if (state_ != STATE_DISABLED) { |
- if (ShouldEnterPushedState(event) && HitTestPoint(event.location())) |
- SetState(STATE_PRESSED); |
- if (request_focus_on_press_) |
- RequestFocus(); |
- if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_PRESS) { |
+ if (state_ == STATE_DISABLED) |
+ return true; |
+ if (ShouldEnterPushedState(event) && HitTestPoint(event.location())) |
+ SetState(STATE_PRESSED); |
+ if (request_focus_on_press_) |
+ RequestFocus(); |
+ if (notify_action_ == NOTIFY_ON_PRESS) { |
+ if (IsTriggerableEvent(event)) { |
NotifyClick(event); |
// NOTE: We may be deleted at this point (by the listener's notification |
// handler). |
+ } else { |
+ NotifyMouseReleasedWithoutClick(event); |
sadrul
2015/11/04 19:13:10
This looks odd. Why should we do this on mouse-pre
varkha
2015/11/04 20:18:23
I thought we would want this notification to be se
|
} |
} |
return true; |
@@ -155,18 +159,19 @@ bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { |
void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { |
if (state_ == STATE_DISABLED) |
return; |
- |
if (!HitTestPoint(event.location())) { |
SetState(STATE_NORMAL); |
- return; |
- } |
- |
- SetState(STATE_HOVERED); |
- if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_RELEASE) { |
- NotifyClick(event); |
- // NOTE: We may be deleted at this point (by the listener's notification |
- // handler). |
+ } else { |
+ SetState(STATE_HOVERED); |
+ if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_RELEASE) { |
+ NotifyClick(event); |
+ // NOTE: We may be deleted at this point (by the listener's notification |
+ // handler). |
+ return; |
+ } |
} |
+ if (notify_action_ == NOTIFY_ON_RELEASE) |
+ NotifyMouseReleasedWithoutClick(event); |
} |
void CustomButton::OnMouseCaptureLost() { |