summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 10:40:26 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 10:40:26 +0000
commitd491569f1ed601044d187fabd3dada1375d3fad4 (patch)
treea273310b40cfffdb4b70b028518d4fe09cde1120 /chrome/browser/renderer_host
parent115c990dfbc44fc2ee034388b7c902b0b5d29139 (diff)
downloadchromium_src-d491569f1ed601044d187fabd3dada1375d3fad4.zip
chromium_src-d491569f1ed601044d187fabd3dada1375d3fad4.tar.gz
chromium_src-d491569f1ed601044d187fabd3dada1375d3fad4.tar.bz2
A quick fix for Issue 32024.
This change just prevents sending keyboard events when we type a 'Fn' key or a 'NumLock' key. This code is mostly copied from -[WebHTMLView flagsChanged:] of Safari. BUG=32024 TEST=Open <http://www.danilatos.com/event-test/ExperimentTest.html> on Mac Chrome, press a 'Fn' key, and verify that Chrome doesn't send any events. Review URL: http://codereview.chromium.org/1622006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 236b2ba..7c3f5d1 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -850,6 +850,14 @@ bool RenderWidgetHostViewMac::ContainsNativeView(
DCHECK([theEvent type] != NSKeyDown ||
!equiv == !([theEvent modifierFlags] & NSCommandKeyMask));
+ if ([theEvent type] == NSFlagsChanged) {
+ // Ignore NSFlagsChanged events from the NumLock and Fn keys as
+ // Safari does in -[WebHTMLView flagsChanged:] (of "WebHTMLView.mm").
+ int keyCode = [theEvent keyCode];
+ if (!keyCode || keyCode == 10 || keyCode == 63)
+ return;
+ }
+
scoped_nsobject<RenderWidgetHostViewCocoa> keepSelfAlive([self retain]);
// Don't cancel child popups; the key events are probably what's triggering