diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:22:47 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:22:47 +0000 |
commit | 51383375ef135f7f2f3b87ab58b28272e7e9d807 (patch) | |
tree | 4d56cfbbba7152174d86af77cce89381b88b8c0a | |
parent | 2a681f99868403385ef4115051507966448807e8 (diff) | |
download | chromium_src-51383375ef135f7f2f3b87ab58b28272e7e9d807.zip chromium_src-51383375ef135f7f2f3b87ab58b28272e7e9d807.tar.gz chromium_src-51383375ef135f7f2f3b87ab58b28272e7e9d807.tar.bz2 |
Make sure to fire menu items only once per key. Also, crash less.
Followup to http://codereview.chromium.org/293019 .
BUG=none
TEST=Open 2 tabs, go to first tab, go to google.com, make sure that web has focus, hit cmd-w. Chrome shouldn't crash.
Review URL: http://codereview.chromium.org/372034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31320 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_mac.mm | 7 |
1 files changed, 6 insertions, 1 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 6e14cbaf..82720be 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -670,10 +670,15 @@ void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { // windows and linux versions of chrome (however, see http://crbug.com/13891 // ), but it makes us similar to how Safari behaves. if ([theEvent modifierFlags] & (NSControlKeyMask | NSCommandKeyMask) && - lastKeyPressedEvent_.get() != theEvent) { + lastKeyPressedEvent_.get() != theEvent && + [[theEvent characters] length] > 0 && + renderWidgetHostView_->render_widget_host_) { NativeWebKeyboardEvent event([[theEvent characters] characterAtIndex:0], ToWebKitModifiers([theEvent modifierFlags]), base::Time::Now().ToDoubleT()); + // We fire menu items on keydown, we don't want to activate menu items + // twice. + event.skip_in_browser = true; renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); } } |