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

Unified Diff: ui/views/controls/menu/menu_runner.cc

Issue 2450903002: MacViews: Clear mouse handler when showing context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test on both Mac and Windows. Created 4 years, 1 month 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/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_runner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_runner.cc
diff --git a/ui/views/controls/menu/menu_runner.cc b/ui/views/controls/menu/menu_runner.cc
index 3d6f7097c4df1fc1f591f30f113a5f1a1118c7af..935df8de976873e7ef0f5206f33b6006ac80b08d 100644
--- a/ui/views/controls/menu/menu_runner.cc
+++ b/ui/views/controls/menu/menu_runner.cc
@@ -8,6 +8,7 @@
#include "ui/views/controls/menu/menu_runner_handler.h"
#include "ui/views/controls/menu/menu_runner_impl.h"
+#include "ui/views/widget/widget.h"
namespace views {
@@ -32,6 +33,12 @@ MenuRunner::RunResult MenuRunner::RunMenuAt(Widget* parent,
const gfx::Rect& bounds,
MenuAnchorPosition anchor,
ui::MenuSourceType source_type) {
+ // If we are shown on mouse press, we will eat the subsequent mouse down and
+ // the parent widget will not be able to reset its state (it might have mouse
+ // capture from the mouse down). So we clear its state here.
+ if (parent && parent->GetRootView())
+ parent->GetRootView()->SetMouseHandler(nullptr);
+
if (runner_handler_.get()) {
return runner_handler_->RunMenuAt(
parent, button, bounds, anchor, source_type, run_types_);
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698