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

Unified Diff: ui/views/controls/menu/menu_runner_impl_cocoa.mm

Issue 2450903002: MacViews: Clear mouse handler when showing context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_runner_impl_cocoa.mm
diff --git a/ui/views/controls/menu/menu_runner_impl_cocoa.mm b/ui/views/controls/menu/menu_runner_impl_cocoa.mm
index f04c2eb2137fe934a57d7680a1c38a9fc721d607..7c79676262b974e09ab5dd378d5bca3173423c6c 100644
--- a/ui/views/controls/menu/menu_runner_impl_cocoa.mm
+++ b/ui/views/controls/menu/menu_runner_impl_cocoa.mm
@@ -128,6 +128,12 @@ MenuRunner::RunResult MenuRunnerImplCocoa::RunMenuAt(Widget* parent,
closing_event_time_ = base::TimeTicks();
running_ = true;
+ // 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())
tapted 2016/10/26 02:15:31 above there's a DCHECK(parent), so there's no need
+ parent->GetRootView()->SetMouseHandler(nullptr);
tapted 2016/10/26 02:15:31 This is just copied from menu_controller.cc - can
themblsha 2016/10/26 15:49:14 The fragment in browser.cc is from 2016, and it's
+
if (run_types & MenuRunner::CONTEXT_MENU) {
[NSMenu popUpContextMenu:[menu_controller_ menu]
withEvent:[NSApp currentEvent]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698