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

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

Issue 1495973002: [Views] If a sibling menu is selected, reset the MenuButton's PressedLock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fix Created 5 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
Index: ui/views/controls/button/menu_button.cc
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index 22a79ae12406380cd91ab0a68ea8d6184d0f64c0..46eaca426033c2d0cea3366749b3f2b8dd582d76 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -91,7 +91,6 @@ MenuButton::~MenuButton() {
////////////////////////////////////////////////////////////////////////////////
bool MenuButton::Activate() {
- PressedLock pressed_lock(this);
if (listener_) {
gfx::Rect lb = GetLocalBounds();
@@ -216,9 +215,12 @@ void MenuButton::OnMouseMoved(const ui::MouseEvent& event) {
void MenuButton::OnGestureEvent(ui::GestureEvent* event) {
if (state() != STATE_DISABLED) {
if (ShouldEnterPushedState(*event) && !Activate()) {
- // When |Activate()| returns |false|, it means that a menu is shown and
- // has handled the gesture event. So, there is no need to further process
- // the gesture event here.
+ // When |Activate()| returns |false|, it means the click was handled by
+ // a button listener and has handled the gesture event. So, there is no
+ // need to further process the gesture event here. However, if the
+ // listener didn't run menu code, we should make sure to reset our state.
+ if (state() == Button::STATE_HOVERED)
Devlin 2015/12/05 00:28:27 This is kind of awkward, but important since we en
+ SetState(Button::STATE_NORMAL);
return;
}
if (switches::IsTouchFeedbackEnabled()) {

Powered by Google App Engine
This is Rietveld 408576698