Changeset 60010 in webkit


Ignore:
Timestamp:
May 22, 2010 12:12:32 PM (14 years ago)
Author:
Martin Robinson
Message:

2010-05-22 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
https://bugs.webkit.org/show_bug.cgi?id=39465

Added a helper function for converting a GDK action bitmask into a DragOperation bitmask.

No new tests as behavior has not changed.

  • platform/gtk/ClipboardUtilitiesGtk.cpp: (WebCore::gdkDragActionToDragOperation): Added.
  • platform/gtk/ClipboardUtilitiesGtk.h:

2010-05-22 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
https://bugs.webkit.org/show_bug.cgi?id=39465

Properly call EventHandler::dragSourceEndedAt so that dragEnd events are processed in the DOM.
dragSourceEndedAt is responsible for calling the dragEnd DOM event as well as cleaning up assets
(such as the Clipboard) associated with the drag source.

  • webkit/webkitwebview.cpp: (webkit_web_view_drag_end): Remember to call dragSourceEndedAt here.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r60009 r60010  
     12010-05-22  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
     6        https://bugs.webkit.org/show_bug.cgi?id=39465
     7
     8        Added a helper function for converting a GDK action bitmask into a DragOperation bitmask.
     9
     10        No new tests as behavior has not changed.
     11
     12        * platform/gtk/ClipboardUtilitiesGtk.cpp:
     13        (WebCore::gdkDragActionToDragOperation): Added.
     14        * platform/gtk/ClipboardUtilitiesGtk.h:
     15
    1162010-05-22  Patrick Gansterer  <paroga@paroga.com>
    217
  • trunk/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp

    r60008 r60010  
    3939    return gdkAction;
    4040}
     41
     42DragOperation gdkDragActionToDragOperation(GdkDragAction gdkAction)
     43{
     44    unsigned int action = DragOperationNone;
     45    if (gdkAction & GDK_ACTION_COPY)
     46        action |= DragOperationCopy;
     47    if (gdkAction & GDK_ACTION_MOVE)
     48        action |= DragOperationMove;
     49    if (gdkAction & GDK_ACTION_LINK)
     50        action |= DragOperationLink;
     51    if (gdkAction & GDK_ACTION_PRIVATE)
     52        action |= DragOperationPrivate;
     53    return static_cast<DragOperation>(action);
    4154}
     55
     56}
  • trunk/WebCore/platform/gtk/ClipboardUtilitiesGtk.h

    r60008 r60010  
    2626
    2727GdkDragAction dragOperationToGdkDragActions(DragOperation);
     28DragOperation gdkDragActionToDragOperation(GdkDragAction);
    2829
    2930}
  • trunk/WebKit/gtk/ChangeLog

    r60008 r60010  
     12010-05-22  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] webkit_web_view_drag_end should call EventHandler::dragSourceEndedAt
     6        https://bugs.webkit.org/show_bug.cgi?id=39465
     7
     8        Properly call EventHandler::dragSourceEndedAt so that dragEnd events are processed in the DOM.
     9        dragSourceEndedAt is responsible for calling the dragEnd DOM event as well as cleaning up assets
     10        (such as the Clipboard) associated with the drag source.
     11
     12        * webkit/webkitwebview.cpp:
     13        (webkit_web_view_drag_end): Remember to call dragSourceEndedAt here.
     14
    1152010-05-22  Martin Robinson  <mrobinson@igalia.com>
    216
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r59935 r60010  
    4545#include "Cache.h"
    4646#include "ChromeClientGtk.h"
     47#include "ClipboardUtilitiesGtk.h"
    4748#include "ContextMenuClientGtk.h"
    4849#include "ContextMenuController.h"
     
    12371238static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
    12381239{
    1239     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(WEBKIT_WEB_VIEW(widget));
     1240    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
     1241    WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
    12401242
    12411243    // This might happen if a drag is still in progress after a WebKitWebView
    1242     // is diposed and before it is finalized.
     1244    // is disposed and before it is finalized.
    12431245    if (!priv->draggingDataObjects.contains(context))
    12441246        return;
    12451247
    12461248    priv->draggingDataObjects.remove(context);
     1249
     1250    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     1251    if (!frame)
     1252        return;
     1253
     1254    GdkEvent* event = gdk_event_new(GDK_BUTTON_RELEASE);
     1255    int x, y, xRoot, yRoot;
     1256    GdkModifierType modifiers;
     1257    GdkDisplay* display = gdk_display_get_default();
     1258    gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers);
     1259
     1260    event->button.window = static_cast<GdkWindow*>(g_object_ref(gdk_display_get_window_at_pointer(display, &x, &y)));
     1261    event->button.x = x;
     1262    event->button.y = y;
     1263    event->button.x_root = xRoot;
     1264    event->button.y_root = yRoot;
     1265    event->button.state = modifiers;
     1266
     1267    PlatformMouseEvent platformEvent(&event->button);
     1268    frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(context->action));
     1269
     1270    gdk_event_free(event);
    12471271}
    12481272
Note: See TracChangeset for help on using the changeset viewer.