diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 23:38:39 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 23:38:39 +0000 |
commit | 3b2792bf4a12e151ed83d272b3eb4729496ee130 (patch) | |
tree | 2b16032a261cb06d35bbbe30f76220b67fdcffd6 | |
parent | ff34e3e9184dc76abfeec7fc7783336950cfdb8b (diff) | |
download | chromium_src-3b2792bf4a12e151ed83d272b3eb4729496ee130.zip chromium_src-3b2792bf4a12e151ed83d272b3eb4729496ee130.tar.gz chromium_src-3b2792bf4a12e151ed83d272b3eb4729496ee130.tar.bz2 |
Correctly construct platform keyboard event in event sending controller.
Same as issue 12981 with but now with change to test_shell.vsprops. This change makes it actually compile on windows! It also makes it clear that test shell is looking in webkit directories for include files. Apparently this was already the case on linux and mac, but it is new for windows.
Review URL: http://codereview.chromium.org/13678
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6657 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 2 | ||||
-rw-r--r-- | webkit/glue/event_conversion.cc | 11 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 8 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 13 | ||||
-rw-r--r-- | webkit/tools/test_shell/event_sending_controller.cc | 53 | ||||
-rw-r--r-- | webkit/tools/test_shell/event_sending_controller.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.vsprops | 2 |
8 files changed, 31 insertions, 62 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index abf2ecf..d2eb18c 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -603,7 +603,7 @@ void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) { } void EditorClientImpl::handleInputMethodKeydown(WebCore::KeyboardEvent* keyEvent) { - NOTIMPLEMENTED(); + // We handle IME within chrome. } 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 2381d5a..554653e 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -850,11 +850,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 @@ -867,8 +866,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 49ce718..b73ad2f 100644 --- a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj +++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj @@ -1762,6 +1762,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, @@ -1800,6 +1801,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, diff --git a/webkit/tools/test_shell/test_shell.vsprops b/webkit/tools/test_shell/test_shell.vsprops index f2f0b9a..bbdbab4 100644 --- a/webkit/tools/test_shell/test_shell.vsprops +++ b/webkit/tools/test_shell/test_shell.vsprops @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="8.00" Name="test_shell" - InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops" + InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\webkit\build\webkit_common_includes.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops" > <Tool Name="VCCLCompilerTool" |