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

Unified Diff: webkit/glue/webinputevent_linux.cc

Issue 28186: Reverting key change (again); this breaks every keyboard layout test there is... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | « webkit/glue/webinputevent.h ('k') | webkit/glue/webinputevent_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webinputevent_linux.cc
===================================================================
--- webkit/glue/webinputevent_linux.cc (revision 10468)
+++ webkit/glue/webinputevent_linux.cc (working copy)
@@ -9,9 +9,12 @@
#include "KeyboardCodes.h"
#include "KeyCodeConversion.h"
+#include "webkit/glue/event_conversion.h"
+
+// This header is out of alphabetical order, but event_conversion.h pulls
+// in more webkit headers that redefine LOG so I need to undef afterwards.
+#undef LOG
#include "base/logging.h"
-#include "base/string_util.h"
-#include "webkit/glue/webinputevent_utils.h"
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
@@ -63,7 +66,7 @@
break;
default:
- NOTREACHED();
+ ASSERT_NOT_REACHED();
};
button = BUTTON_NONE;
@@ -89,7 +92,7 @@
type = MOUSE_MOVE;
break;
default:
- NOTREACHED();
+ ASSERT_NOT_REACHED();
}
button = BUTTON_NONE;
@@ -146,9 +149,13 @@
}
WebKeyboardEvent::WebKeyboardEvent(const GdkEventKey* event) {
- system_key = false;
modifiers = GdkStateToWebEventModifiers(event->state);
+ // GDK only exposes key press and release events. By contrast,
+ // WebKeyboardEvent matches Windows and wants key down/up events along with a
+ // separate CHAR event.
+ // We require the caller to simulate the CHAR event manually. See
+ // test_shell's webwidget_host for an example.
switch (event->type) {
case GDK_KEY_RELEASE:
type = KEY_UP;
@@ -164,33 +171,21 @@
// The key code tells us which physical key was pressed (for example, the
// A key went down or up). It does not determine whether A should be lower
// or upper case. This is what text does, which should be the keyval.
- windows_key_code = WebCore::windowsKeyCodeForKeyEvent(event->keyval);
- native_key_code = event->hardware_keycode;
+ key_code = WebCore::windowsKeyCodeForKeyEvent(event->keyval);
- memset(&text, 0, sizeof(text));
- memset(&unmodified_text, 0, sizeof(unmodified_text));
- memset(&key_identifier, 0, sizeof(key_identifier));
-
switch (event->keyval) {
// We need to treat the enter key as a key press of character \r. This
// is apparently just how webkit handles it and what it expects.
case GDK_ISO_Enter:
case GDK_KP_Enter:
case GDK_Return:
- unmodified_text[0] = text[0] = static_cast<char16>('\r');
+ text = '\r';
break;
default:
// This should set text to 0 when it's not a real character.
- // TODO(avi): fix for non BMP chars
- unmodified_text[0] = text[0] =
- static_cast<char16>(gdk_keyval_to_unicode(event->keyval));
+ text = gdk_keyval_to_unicode(event->keyval);
break;
}
- std::string key_identifier_str =
- GetKeyIdentifierForWindowsKeyCode(windows_key_code);
- base::strlcpy(key_identifier, key_identifier_str.c_str(),
- kIdentifierLengthCap);
-
// TODO(tc): Do we need to set IS_AUTO_REPEAT or IS_KEYPAD?
}
« no previous file with comments | « webkit/glue/webinputevent.h ('k') | webkit/glue/webinputevent_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698