summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-09 19:22:17 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-09 19:22:17 +0000
commit48d33655b38f1d170f93557996a53b64d64f3a4e (patch)
tree1abbac5f28a5978850e3773880c442db3826eaed
parent1ff45871a02cb6d42535c0f9ec317fd88d876248 (diff)
downloadchromium_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
-rw-r--r--webkit/glue/editor_client_impl.cc1
-rw-r--r--webkit/glue/event_conversion.cc11
-rw-r--r--webkit/glue/webview_impl.cc8
-rw-r--r--webkit/tools/layout_tests/test_lists/tests_fixable.txt13
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc53
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h2
-rw-r--r--webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj2
7 files changed, 29 insertions, 61 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index abf2ecf..7fe4a52 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -603,7 +603,6 @@ void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) {
}
void EditorClientImpl::handleInputMethodKeydown(WebCore::KeyboardEvent* keyEvent) {
- NOTIMPLEMENTED();
}
void EditorClientImpl::textFieldDidBeginEditing(WebCore::Element*) {
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc
index 5de8271..881cdae 100644
--- a/webkit/glue/event_conversion.cc
+++ b/webkit/glue/event_conversion.cc
@@ -283,10 +283,8 @@ MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e)
m_text = "\x9";
m_unmodifiedText = "\x9";
}
-#elif defined(OS_WIN)
+#elif defined(OS_WIN) || defined(OS_LINUX)
m_text = m_unmodifiedText = ToSingleCharacterString(e.key_code);
-#elif defined(OS_LINUX)
- m_text = m_unmodifiedText = ToSingleCharacterString(e.text);
#endif
}
#if defined(OS_WIN) || defined(OS_LINUX)
@@ -307,10 +305,13 @@ MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e)
m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0;
#if defined(OS_WIN)
m_isSystemKey = e.system_key;
+// TODO(port): set this field properly for linux and mac.
+#elif defined(OS_LINUX)
+ m_isSystemKey = m_altKey;
#else
- m_isSystemKey = false; // TODO(port): make this proper.
+ m_isSystemKey = false;
#endif
-}
+}
void MakePlatformKeyboardEvent::SetKeyType(Type type) {
// According to the behavior of Webkit in Windows platform,
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 67285ff..c07825c 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -513,12 +513,12 @@ bool WebViewImpl::CharEvent(const WebKeyboardEvent& event) {
if (!evt.IsCharacterKey())
return true;
-#if defined(OS_WIN)
- // Safari 3.1 does not pass off WM_SYSCHAR messages to the
- // eventHandler::keyEvent. We mimic this behavior.
+ // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to
+ // the eventHandler::keyEvent. We mimic this behavior on all platforms since
+ // for now we are converting other platform's key events to windows key
+ // events.
if (evt.isSystemKey())
return handler->handleAccessKey(evt);
-#endif
if (!handler->keyEvent(evt))
return KeyEventDefault(event);
diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
index 9930068..7adf29c 100644
--- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt
+++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
@@ -847,11 +847,10 @@ LINUX MAC : LayoutTests/fast/dom/object-embed-plugin-scripting.html = FAIL
LINUX MAC : LayoutTests/fast/dynamic/flash-replacement-test.html = FAIL
LINUX : LayoutTests/fast/encoding/denormalised-voiced-japanese-chars.html = FAIL
LINUX MAC : LayoutTests/fast/events/access-key-self-destruct.html = FAIL
-LINUX MAC : LayoutTests/fast/events/arrow-keys-on-body.html = FAIL
-LINUX MAC : LayoutTests/fast/events/arrow-navigation.html = FAIL
-LINUX MAC : LayoutTests/fast/events/key-events-in-input-text.html = FAIL
-LINUX MAC : LayoutTests/fast/events/keypress-focus-change.html = FAIL
-LINUX MAC : LayoutTests/fast/events/keypress-insert-tab.html = FAIL
+MAC : LayoutTests/fast/events/arrow-keys-on-body.html = FAIL
+MAC : LayoutTests/fast/events/key-events-in-input-text.html = FAIL
+MAC : LayoutTests/fast/events/keypress-focus-change.html = FAIL
+MAC : LayoutTests/fast/events/keypress-insert-tab.html = FAIL
LINUX MAC : LayoutTests/fast/events/onchange-passwordfield.html = FAIL
LINUX MAC : LayoutTests/fast/events/onchange-searchfield.html = FAIL
LINUX MAC : LayoutTests/fast/events/onchange-select-popup.html = FAIL
@@ -864,8 +863,8 @@ LINUX MAC : LayoutTests/fast/forms/access-key.html = FAIL
LINUX MAC : LayoutTests/fast/forms/button-enter-click.html = FAIL
LINUX MAC : LayoutTests/fast/forms/check-box-enter-key.html = FAIL
LINUX MAC : LayoutTests/fast/forms/enter-clicks-buttons.html = FAIL
-LINUX MAC : LayoutTests/fast/forms/focus-selection-input.html = FAIL
-LINUX MAC : LayoutTests/fast/forms/focus-selection-textarea.html = FAIL
+MAC : LayoutTests/fast/forms/focus-selection-input.html = FAIL
+MAC : LayoutTests/fast/forms/focus-selection-textarea.html = FAIL
LINUX MAC : LayoutTests/fast/forms/hidden-listbox.html = FAIL
LINUX MAC : LayoutTests/fast/forms/input-appearance-height.html = FAIL
LINUX MAC : LayoutTests/fast/forms/input-baseline.html = FAIL
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
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index 004cc82..e5602935 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -75,7 +75,7 @@ class EventSendingController : public CppBoundClass {
// Returns true if the key_code passed in needs a shift key modifier to
// be passed into the generated event.
- bool NeedsShiftModifer(wchar_t key_code);
+ bool NeedsShiftModifer(int key_code);
// Non-owning pointer. The LayoutTestController is owned by the host.
static TestShell* shell_;
diff --git a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
index 3ec6d8e..3124720 100644
--- a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
+++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
@@ -1758,6 +1758,7 @@
../../../../third_party/icu38/public/i18n,
../../../../third_party/npapi,
../../../pending,
+ ../../../port/platform/chromium,
../../../../third_party/WebKit/WebCore,
../../../../third_party/WebKit/WebKit/mac/WebCoreSupport,
../../../../third_party/WebKit/JavaScriptCore,
@@ -1796,6 +1797,7 @@
../../../../third_party/icu38/public/i18n,
../../../../third_party/npapi,
../../../pending,
+ ../../../port/platform/chromium,
../../../../third_party/WebKit/WebCore,
../../../../third_party/WebKit/WebKit/mac/WebCoreSupport,
../../../../third_party/WebKit/JavaScriptCore,