diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 19:22:17 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 19:22:17 +0000 |
commit | 48d33655b38f1d170f93557996a53b64d64f3a4e (patch) | |
tree | 1abbac5f28a5978850e3773880c442db3826eaed /webkit/tools/test_shell/event_sending_controller.cc | |
parent | 1ff45871a02cb6d42535c0f9ec317fd88d876248 (diff) | |
download | chromium_src-48d33655b38f1d170f93557996a53b64d64f3a4e.zip chromium_src-48d33655b38f1d170f93557996a53b64d64f3a4e.tar.gz chromium_src-48d33655b38f1d170f93557996a53b64d64f3a4e.tar.bz2 |
Linux: the WebKeyboardEvent key_code field is the windows key code, not the native key code.
Also match windows behavior for setting m_text field of platform event equal to key_code.
update: fixes at least 7 layout tests.
Review URL: http://codereview.chromium.org/12981
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/event_sending_controller.cc')
-rw-r--r-- | webkit/tools/test_shell/event_sending_controller.cc | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index 24aff94..b027c94 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -18,6 +18,8 @@ #include <queue> +#include "KeyboardCodes.h" + #include "base/logging.h" #include "base/ref_counted.h" #include "base/string_util.h" @@ -25,41 +27,6 @@ #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell.h" -#if defined(OS_LINUX) -#include <gdk/gdkkeysyms.h> -#endif - -namespace { -#if defined(OS_WIN) -const wchar_t kKeyCodeReturn = VK_RETURN; -const wchar_t kKeyCodeRight = VK_RIGHT; -const wchar_t kKeyCodeDown = VK_DOWN; -const wchar_t kKeyCodeLeft = VK_LEFT; -const wchar_t kKeyCodeUp = VK_UP; -const wchar_t kKeyCodeDelete = VK_BACK; -#elif defined(OS_MACOSX) -// I don't quite understand this code enough to change the way it works. As -// for the keycodes, they were documented once in Inside Macintosh and -// haven't been documented since, either on paper or in a header. The -// reference I'm going by is http://www.meandmark.com/keycodes.html . -// TODO(avi): Find someone who knows keyboard handling in WebCore and have -// them take a look at this. -const wchar_t kKeyCodeReturn = 0x24; -const wchar_t kKeyCodeRight = 0x7C; -const wchar_t kKeyCodeDown = 0x7D; -const wchar_t kKeyCodeLeft = 0x7B; -const wchar_t kKeyCodeUp = 0x7E; -const wchar_t kKeyCodeDelete = 0x33; -#elif defined(OS_LINUX) -const wchar_t kKeyCodeReturn = GDK_Return; -const wchar_t kKeyCodeRight = GDK_Right; -const wchar_t kKeyCodeDown = GDK_Down; -const wchar_t kKeyCodeLeft = GDK_Left; -const wchar_t kKeyCodeUp = GDK_Up; -const wchar_t kKeyCodeDelete = GDK_Delete; -#endif -} - // TODO(mpcomplete): layout before each event? // TODO(mpcomplete): do we need modifiers for mouse events? @@ -362,21 +329,21 @@ int EventSendingController::GetButtonNumberFromSingleArg( // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when // Windows uses \r for "Enter". - wchar_t code; + int code; bool needs_shift_key_modifier = false; if (L"\n" == code_str) { generate_char = true; - code = kKeyCodeReturn; + code = WebCore::VKEY_RETURN; } else if (L"rightArrow" == code_str) { - code = kKeyCodeRight; + code = WebCore::VKEY_RIGHT; } else if (L"downArrow" == code_str) { - code = kKeyCodeDown; + code = WebCore::VKEY_DOWN; } else if (L"leftArrow" == code_str) { - code = kKeyCodeLeft; + code = WebCore::VKEY_LEFT; } else if (L"upArrow" == code_str) { - code = kKeyCodeUp; + code = WebCore::VKEY_UP; } else if (L"delete" == code_str) { - code = kKeyCodeDelete; + code = WebCore::VKEY_BACK; } else { DCHECK(code_str.length() == 1); code = code_str[0]; @@ -460,7 +427,7 @@ int EventSendingController::GetButtonNumberFromSingleArg( } } - bool EventSendingController::NeedsShiftModifer(wchar_t key_code) { + bool EventSendingController::NeedsShiftModifer(int key_code) { // If code is an uppercase letter, assign a SHIFT key to // event_down.modifier, this logic comes from // WebKit/WebKitTools/DumpRenderTree/Win/EventSender.cpp |