Changeset 66829 in webkit


Ignore:
Timestamp:
Sep 6, 2010 7:44:42 AM (14 years ago)
Author:
Martin Robinson
Message:

2010-09-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] EventSender should support modifier keys with mouseDown and mouseUp events
https://bugs.webkit.org/show_bug.cgi?id=45235

  • platform/gtk/Skipped: Unskip a test which is now passing.

2010-09-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] EventSender should support modifier keys with mouseDown and mouseUp events
https://bugs.webkit.org/show_bug.cgi?id=45235

Add support for interpreting the modifier key arguments to the mouseDown and mouseUp
methods of the EventSender.

  • DumpRenderTree/gtk/EventSender.cpp: (prepareMouseButtonEvent): Allow passing in a modifier bitmask, which will be OR'd with the current modifiers. (contextClickCallback): Always send no modifiers when preparing the mouse event. (gdkModifersFromJSValue): Added, converts a JSValue array into a GDK modifier bitmask. (mouseDownCallback): Send in the requested modifiers to prepareMouseButtonEvent. (mouseUpCallback): Ditto.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66828 r66829  
     12010-09-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] EventSender should support modifier keys with mouseDown and mouseUp events
     6        https://bugs.webkit.org/show_bug.cgi?id=45235
     7
     8        * platform/gtk/Skipped: Unskip a test which is now passing.
     9
    1102010-09-06  Martin Robinson  <mrobinson@igalia.com>
    211
  • trunk/LayoutTests/platform/gtk/Skipped

    r66827 r66829  
    55635563http/tests/workers/text-encoding.html
    55645564
    5565 # https://bugs.webkit.org/show_bug.cgi?id=38656
    5566 editing/selection/shift-click.html
    5567 
    55685565# https://bugs.webkit.org/show_bug.cgi?id=31302
    55695566fast/css/font-face-woff.html
  • trunk/WebKitTools/ChangeLog

    r66812 r66829  
     12010-09-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] EventSender should support modifier keys with mouseDown and mouseUp events
     6        https://bugs.webkit.org/show_bug.cgi?id=45235
     7
     8        Add support for interpreting the modifier key arguments to the mouseDown and mouseUp
     9        methods of the EventSender.
     10
     11        * DumpRenderTree/gtk/EventSender.cpp:
     12        (prepareMouseButtonEvent): Allow passing in a modifier bitmask, which will be OR'd
     13        with the current modifiers.
     14        (contextClickCallback): Always send no modifiers when preparing the mouse event.
     15        (gdkModifersFromJSValue): Added, converts a JSValue array into a GDK modifier bitmask.
     16        (mouseDownCallback): Send in the requested modifiers to prepareMouseButtonEvent.
     17        (mouseUpCallback): Ditto.
     18
    1192010-09-05  Peter Kasting  <pkasting@google.com>
    220
  • trunk/WebKitTools/DumpRenderTree/gtk/EventSender.cpp

    r66666 r66829  
    111111}
    112112
    113 bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber)
     113bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber, guint modifiers)
    114114{
    115115    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
     
    134134    g_object_ref(event->button.window);
    135135    event->button.device = getDefaultGDKPointerDevice(event->button.window);
    136     event->button.state = getStateFlags();
     136    event->button.state = modifiers | getStateFlags();
    137137    event->button.time = GDK_CURRENT_TIME;
    138138    event->button.axes = 0;
     
    149149{
    150150    GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS);
    151     if (!prepareMouseButtonEvent(pressEvent, 2))
     151    if (!prepareMouseButtonEvent(pressEvent, 2, 0))
    152152        return JSValueMakeUndefined(context);
    153153
     
    171171}
    172172
     173static guint gdkModifersFromJSValue(JSContextRef context, const JSValueRef modifiers)
     174{
     175    JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0);
     176    if (!modifiersArray)
     177        return 0;
     178
     179    guint gdkModifiers = 0;
     180    int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, JSStringCreateWithUTF8CString("length"), 0), 0);
     181    for (int i = 0; i < modifiersCount; ++i) {
     182        JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0);
     183        JSStringRef string = JSValueToStringCopy(context, value, 0);
     184        if (JSStringIsEqualToUTF8CString(string, "ctrlKey")
     185            || JSStringIsEqualToUTF8CString(string, "addSelectionKey"))
     186            gdkModifiers |= GDK_CONTROL_MASK;
     187        else if (JSStringIsEqualToUTF8CString(string, "shiftKey")
     188                 || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey"))
     189            gdkModifiers |= GDK_SHIFT_MASK;
     190        else if (JSStringIsEqualToUTF8CString(string, "altKey"))
     191            gdkModifiers |= GDK_MOD1_MASK;
     192
     193        // Currently the metaKey as defined in WebCore/platform/gtk/MouseEventGtk.cpp
     194        // is GDK_MOD2_MASK. This code must be kept in sync with that file.
     195        else if (JSStringIsEqualToUTF8CString(string, "metaKey"))
     196            gdkModifiers |= GDK_MOD2_MASK;
     197
     198        JSStringRelease(string);
     199    }
     200    return gdkModifiers;
     201}
     202
    173203static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    174204{
     
    178208        g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
    179209    }
     210    guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0;
    180211
    181212    GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
    182     if (!prepareMouseButtonEvent(event, button))
     213    if (!prepareMouseButtonEvent(event, button, modifiers))
    183214        return JSValueMakeUndefined(context);
    184215
     
    221252        g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
    222253    }
     254    guint modifiers = argumentCount >= 2 ? gdkModifersFromJSValue(context, arguments[1]) : 0;
    223255
    224256    GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE);
    225     if (!prepareMouseButtonEvent(event, button))
     257    if (!prepareMouseButtonEvent(event, button, modifiers))
    226258        return JSValueMakeUndefined(context);
    227259
Note: See TracChangeset for help on using the changeset viewer.