Commit a54ce78b authored by eric@webkit.org's avatar eric@webkit.org

2010-01-27 Kinuko Yasuda <kinuko@chromium.org>

        Reviewed by Eric Seidel.

        Remove fast/events/keydown-numpad-keys.html from gtk's Skipped list.
        https://bugs.webkit.org/show_bug.cgi?id=28247

        * platform/gtk/Skipped:
2010-01-27  Kinuko Yasuda  <kinuko@chromium.org>

        Reviewed by Eric Seidel.

        Add key event mappings for numpad keys for Gtk and Chromium/Gtk.
        http://bugs.webkit.org/show_bug.cgi?id=28247

        Test: fast/events/keydown-numpad-keys.html

        * platform/chromium/KeyCodeConversionGtk.cpp:
        (WebCore::windowsKeyCodeForKeyEvent):
        * platform/gtk/KeyEventGtk.cpp:
        (WebCore::windowsKeyCodeForKeyEvent):
2010-01-27  Kinuko Yasuda  <kinuko@chromium.org>

        Reviewed by Eric Seidel.

        Correctly handle the KeyLocation argument that has been introduced
        recently to test location-dependent key events in EventSender.keyDown.
        http://bugs.webkit.org/show_bug.cgi?id=28247

        Test: fast/events/keydown-numpad-keys.html

        * DumpRenderTree/gtk/EventSender.cpp:
        (keyDownCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 24112032
2010-01-27 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Eric Seidel.
Remove fast/events/keydown-numpad-keys.html from gtk's Skipped list.
https://bugs.webkit.org/show_bug.cgi?id=28247
* platform/gtk/Skipped:
2010-01-27 Tony Chang <tony@chromium.org>
Reviewed by Eric Seidel.
......@@ -2261,7 +2261,6 @@ fast/events/event-listener-on-link.html
fast/events/event-sender-mouse-moved.html
fast/events/focusingUnloadedFrame.html
fast/events/keydown-1.html
fast/events/keydown-numpad-keys.html
fast/events/label-focus.html
fast/events/mouseout-dead-node.html
fast/events/onload-re-entry.html
......
2010-01-27 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Eric Seidel.
Add key event mappings for numpad keys for Gtk and Chromium/Gtk.
http://bugs.webkit.org/show_bug.cgi?id=28247
Test: fast/events/keydown-numpad-keys.html
* platform/chromium/KeyCodeConversionGtk.cpp:
(WebCore::windowsKeyCodeForKeyEvent):
* platform/gtk/KeyEventGtk.cpp:
(WebCore::windowsKeyCodeForKeyEvent):
2010-01-27 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
......@@ -72,6 +72,23 @@ int windowsKeyCodeForKeyEvent(unsigned keycode)
case GDK_KP_Divide:
return VKEY_DIVIDE; // (6F) Divide key
case GDK_KP_Page_Up:
return VKEY_PRIOR; // (21) PAGE UP key
case GDK_KP_Page_Down:
return VKEY_NEXT; // (22) PAGE DOWN key
case GDK_KP_End:
return VKEY_END; // (23) END key
case GDK_KP_Home:
return VKEY_HOME; // (24) HOME key
case GDK_KP_Left:
return VKEY_LEFT; // (25) LEFT ARROW key
case GDK_KP_Up:
return VKEY_UP; // (26) UP ARROW key
case GDK_KP_Right:
return VKEY_RIGHT; // (27) RIGHT ARROW key
case GDK_KP_Down:
return VKEY_DOWN; // (28) DOWN ARROW key
case GDK_BackSpace:
return VKEY_BACK; // (08) BACKSPACE key
case GDK_ISO_Left_Tab:
......
......@@ -181,6 +181,23 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode)
case GDK_KP_Divide:
return VK_DIVIDE; // (6F) Divide key
case GDK_KP_Page_Up:
return VK_PRIOR; // (21) PAGE UP key
case GDK_KP_Page_Down:
return VK_NEXT; // (22) PAGE DOWN key
case GDK_KP_End:
return VK_END; // (23) END key
case GDK_KP_Home:
return VK_HOME; // (24) HOME key
case GDK_KP_Left:
return VK_LEFT; // (25) LEFT ARROW key
case GDK_KP_Up:
return VK_UP; // (26) UP ARROW key
case GDK_KP_Right:
return VK_RIGHT; // (27) RIGHT ARROW key
case GDK_KP_Down:
return VK_DOWN; // (28) DOWN ARROW key
case GDK_BackSpace:
return VK_BACK; // (08) BACKSPACE key
case GDK_ISO_Left_Tab:
......
2010-01-27 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Eric Seidel.
Correctly handle the KeyLocation argument that has been introduced
recently to test location-dependent key events in EventSender.keyDown.
http://bugs.webkit.org/show_bug.cgi?id=28247
Test: fast/events/keydown-numpad-keys.html
* DumpRenderTree/gtk/EventSender.cpp:
(keyDownCallback):
2010-01-27 Kenneth Rohde Christiansen <kenneth@webkit.org>
Rubberstamped by Simon Hausmann.
......
......@@ -76,6 +76,14 @@ static unsigned startOfQueue;
static const float zoomMultiplierRatio = 1.2f;
// Key event location code defined in DOM Level 3.
enum KeyLocationCode {
DOM_KEY_LOCATION_STANDARD = 0x00,
DOM_KEY_LOCATION_LEFT = 0x01,
DOM_KEY_LOCATION_RIGHT = 0x02,
DOM_KEY_LOCATION_NUMPAD = 0x03
};
static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
return JSValueMakeBoolean(context, dragMode);
......@@ -449,66 +457,93 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
}
}
// handle location argument.
int location = DOM_KEY_LOCATION_STANDARD;
if (argumentCount > 2)
location = (int)JSValueToNumber(context, arguments[2], exception);
JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
int gdkKeySym;
if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
gdkKeySym = GDK_Left;
else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
gdkKeySym = GDK_Right;
else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
gdkKeySym = GDK_Up;
else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
gdkKeySym = GDK_Down;
else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
gdkKeySym = GDK_Page_Up;
else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
gdkKeySym = GDK_Page_Down;
else if (JSStringIsEqualToUTF8CString(character, "home"))
gdkKeySym = GDK_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_End;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
gdkKeySym = GDK_BackSpace;
else if (JSStringIsEqualToUTF8CString(character, "F1"))
gdkKeySym = GDK_F1;
else if (JSStringIsEqualToUTF8CString(character, "F2"))
gdkKeySym = GDK_F2;
else if (JSStringIsEqualToUTF8CString(character, "F3"))
gdkKeySym = GDK_F3;
else if (JSStringIsEqualToUTF8CString(character, "F4"))
gdkKeySym = GDK_F4;
else if (JSStringIsEqualToUTF8CString(character, "F5"))
gdkKeySym = GDK_F5;
else if (JSStringIsEqualToUTF8CString(character, "F6"))
gdkKeySym = GDK_F6;
else if (JSStringIsEqualToUTF8CString(character, "F7"))
gdkKeySym = GDK_F7;
else if (JSStringIsEqualToUTF8CString(character, "F8"))
gdkKeySym = GDK_F8;
else if (JSStringIsEqualToUTF8CString(character, "F9"))
gdkKeySym = GDK_F9;
else if (JSStringIsEqualToUTF8CString(character, "F10"))
gdkKeySym = GDK_F10;
else if (JSStringIsEqualToUTF8CString(character, "F11"))
gdkKeySym = GDK_F11;
else if (JSStringIsEqualToUTF8CString(character, "F12"))
gdkKeySym = GDK_F12;
else {
int charCode = JSStringGetCharactersPtr(character)[0];
if (charCode == '\n' || charCode == '\r')
gdkKeySym = GDK_Return;
else if (charCode == '\t')
gdkKeySym = GDK_Tab;
else if (charCode == '\x8')
int gdkKeySym = GDK_VoidSymbol;
if (location == DOM_KEY_LOCATION_NUMPAD) {
if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
gdkKeySym = GDK_KP_Left;
else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
gdkKeySym = GDK_KP_Right;
else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
gdkKeySym = GDK_KP_Up;
else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
gdkKeySym = GDK_KP_Down;
else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
gdkKeySym = GDK_KP_Page_Up;
else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
gdkKeySym = GDK_KP_Page_Down;
else if (JSStringIsEqualToUTF8CString(character, "home"))
gdkKeySym = GDK_KP_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_KP_End;
else
// Assume we only get arrow/pgUp/pgDn/home/end keys with
// location=NUMPAD for now.
g_assert_not_reached();
} else {
if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
gdkKeySym = GDK_Left;
else if (JSStringIsEqualToUTF8CString(character, "rightArrow"))
gdkKeySym = GDK_Right;
else if (JSStringIsEqualToUTF8CString(character, "upArrow"))
gdkKeySym = GDK_Up;
else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
gdkKeySym = GDK_Down;
else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
gdkKeySym = GDK_Page_Up;
else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
gdkKeySym = GDK_Page_Down;
else if (JSStringIsEqualToUTF8CString(character, "home"))
gdkKeySym = GDK_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_End;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
gdkKeySym = GDK_BackSpace;
else if (JSStringIsEqualToUTF8CString(character, "F1"))
gdkKeySym = GDK_F1;
else if (JSStringIsEqualToUTF8CString(character, "F2"))
gdkKeySym = GDK_F2;
else if (JSStringIsEqualToUTF8CString(character, "F3"))
gdkKeySym = GDK_F3;
else if (JSStringIsEqualToUTF8CString(character, "F4"))
gdkKeySym = GDK_F4;
else if (JSStringIsEqualToUTF8CString(character, "F5"))
gdkKeySym = GDK_F5;
else if (JSStringIsEqualToUTF8CString(character, "F6"))
gdkKeySym = GDK_F6;
else if (JSStringIsEqualToUTF8CString(character, "F7"))
gdkKeySym = GDK_F7;
else if (JSStringIsEqualToUTF8CString(character, "F8"))
gdkKeySym = GDK_F8;
else if (JSStringIsEqualToUTF8CString(character, "F9"))
gdkKeySym = GDK_F9;
else if (JSStringIsEqualToUTF8CString(character, "F10"))
gdkKeySym = GDK_F10;
else if (JSStringIsEqualToUTF8CString(character, "F11"))
gdkKeySym = GDK_F11;
else if (JSStringIsEqualToUTF8CString(character, "F12"))
gdkKeySym = GDK_F12;
else {
gdkKeySym = gdk_unicode_to_keyval(charCode);
if (WTF::isASCIIUpper(charCode))
state |= GDK_SHIFT_MASK;
int charCode = JSStringGetCharactersPtr(character)[0];
if (charCode == '\n' || charCode == '\r')
gdkKeySym = GDK_Return;
else if (charCode == '\t')
gdkKeySym = GDK_Tab;
else if (charCode == '\x8')
gdkKeySym = GDK_BackSpace;
else {
gdkKeySym = gdk_unicode_to_keyval(charCode);
if (WTF::isASCIIUpper(charCode))
state |= GDK_SHIFT_MASK;
}
}
}
JSStringRelease(character);
WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment