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

Side by Side Diff: ui/views/controls/button/menu_button.cc

Issue 2880623002: [ash-md] Fixed MenuButton focus appearing after dismissing menus. (Closed)
Patch Set: Added check for null Widget. Created 3 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/menu_button.h" 5 #include "ui/views/controls/button/menu_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/base/dragdrop/drag_drop_types.h" 9 #include "ui/base/dragdrop/drag_drop_types.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 desired_state = STATE_DISABLED; 394 desired_state = STATE_DISABLED;
395 should_disable_after_press_ = false; 395 should_disable_after_press_ = false;
396 } else if (ShouldEnterHoveredState()) { 396 } else if (ShouldEnterHoveredState()) {
397 desired_state = STATE_HOVERED; 397 desired_state = STATE_HOVERED;
398 } 398 }
399 SetState(desired_state); 399 SetState(desired_state);
400 // The widget may be null during shutdown. If so, it doesn't make sense to 400 // The widget may be null during shutdown. If so, it doesn't make sense to
401 // try to add an ink drop effect. 401 // try to add an ink drop effect.
402 if (GetWidget() && state() != STATE_PRESSED) 402 if (GetWidget() && state() != STATE_PRESSED)
403 AnimateInkDrop(InkDropState::DEACTIVATED, nullptr /* event */); 403 AnimateInkDrop(InkDropState::DEACTIVATED, nullptr /* event */);
404
405 // The Widget can be null in tests.
406 if (GetWidget()) {
sky 2017/05/14 15:52:25 What about dispatching the event at the time the m
407 // Force MOUSE_ENTER/EXIT events so button hover states are updated.
408 GetWidget()->SynthesizeMouseMoveEvent(true);
409 }
404 } 410 }
405 } 411 }
406 412
407 int MenuButton::GetMaximumScreenXCoordinate() { 413 int MenuButton::GetMaximumScreenXCoordinate() {
408 if (!GetWidget()) { 414 if (!GetWidget()) {
409 NOTREACHED(); 415 NOTREACHED();
410 return 0; 416 return 0;
411 } 417 }
412 418
413 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 419 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
414 return monitor_bounds.right() - 1; 420 return monitor_bounds.right() - 1;
415 } 421 }
416 422
417 } // namespace views 423 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698