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
Esse commit está contido em:
hbono@chromium.org
2009-07-10 08:32:52 +00:00
commit f5eac1bab2
@@ -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);
}
}