From 6fae8e0c8b1f8e17223b01debdfc8818dbbac250 Mon Sep 17 00:00:00 2001 From: "hbono@chromium.org" Date: Fri, 10 Jul 2009 08:32:52 +0000 Subject: A quick fix for Issue 15971. This is another my stupid mistake that my r19238 sends a Char event even when its text[] member does not contains any characters. I mis-understoold I needed to send a Char event every time when gtk_keyval_to_unicode() returns 0 to avoid Issue 15024. But this is wrong. (Page Down, Page Up, Arrow Keys work without Char events. Only return keys need Char events.) BUG=15971 "drop down list moves 2 positions when using the keyboard". TEST=Open the attached test-case Review URL: http://codereview.chromium.org/155207 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20370 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/render_widget_host_view_gtk.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 4fb20ba..e8ce708 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -135,15 +135,16 @@ class RenderWidgetHostViewGtkWidget { // 2. The given key event is not a control-key event but printable // characters aren't assigned to the event, (e.g. alt+d, etc.) // Create a Char event manually from this key event and send it to the - // renderer only when this event is a control-key event because - // control-key events should be processed by WebKit. + // renderer when this Char event contains a printable character which + // should be processed by WebKit. // TODO(hbono): Windows Chrome sends a Char event with its isSystemKey // value true for the above case 2. We should emulate this behavior? if (event->type == GDK_KEY_PRESS && !gdk_keyval_to_unicode(event->keyval)) { NativeWebKeyboardEvent wke(event); wke.type = WebKit::WebInputEvent::Char; - host_view->GetRenderWidgetHost()->ForwardKeyboardEvent(wke); + if (wke.text[0]) + host_view->GetRenderWidgetHost()->ForwardKeyboardEvent(wke); } } -- cgit v1.1