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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2834763002: Mac: Never dispatch keyEquivalents to the web contents if the window is not Key. (Closed)
Patch Set: Add a bespoke test Created 3 years, 8 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 | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 37903daefeb08dc26ac166cfff2dba100c84da39..17b6c971faaa3eb60b17c8601c86da093e77b9c4 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2017,8 +2017,10 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
// |performKeyEquivalent:| is sent to all views of a window, not only down the
// responder chain (cf. "Handling Key Equivalents" in
// http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html
- // ). We only want to handle key equivalents if we're first responder.
- if ([[self window] firstResponder] != self)
+ // ). A |performKeyEquivalent:| may also bubble up from a dialog child window
+ // to perform browser commands such as switching tabs. We only want to handle
+ // key equivalents if we're first responder in the keyWindow.
+ if (![[self window] isKeyWindow] || [[self window] firstResponder] != self)
return NO;
// If the event is reserved by the system, then do not pass it to web content.
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698