Skip to content
  • mrobinson@webkit.org's avatar
    [GTK] Implement drag and drop support in WebKit2 · 3a1633fa
    mrobinson@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=63706
    
    Reviewed by Philippe Normand.
    
    Source/WebCore:
    
    * platform/DragData.h:
    * platform/gtk/DataObjectGtk.cpp:
    (WebCore::DataObjectGtk::text): Mark as const.
    (WebCore::DataObjectGtk::markup): Ditto.
    (WebCore::DataObjectGtk::urlLabel): Ditto.
    * platform/gtk/DataObjectGtk.h: Remove unused member
    m_dragContext.
    (WebCore::DataObjectGtk::url): Mark as const.
    (WebCore::DataObjectGtk::uriList): Ditto.
    (WebCore::DataObjectGtk::filenames): Ditto.
    (WebCore::DataObjectGtk::image): Ditto.
    (WebCore::DataObjectGtk::hasText): Ditto.
    (WebCore::DataObjectGtk::hasMarkup): Ditto.
    (WebCore::DataObjectGtk::hasURIList): Ditto.
    (WebCore::DataObjectGtk::hasURL): Ditto.
    (WebCore::DataObjectGtk::hasFilenames): Ditto.
    (WebCore::DataObjectGtk::hasImage): Ditto.
    * platform/gtk/DragIcon.cpp: Added. A helper which takes care of
    creating a transparent drag window for drags.
    * platform/gtk/DragIcon.h: Added.
    
    Source/WebKit2:
    
    * GNUmakefile.am: Add new files to compilation.
    * Shared/gtk/ArgumentCodersGtk.cpp: Added.
    (CoreIPC::encodeImage): Encode a GdkPixbuf.
    (CoreIPC::decodeImage): Decode a GdkPixbuf.
    (CoreIPC::encodeDataObject): Encode a DataObjectGtk.
    (CoreIPC::decodeDataObject): Decode a DataObjectGtk.
    (CoreIPC::::encode): Encode DragData.
    (CoreIPC::::decode): Decode DragData.
    * Shared/gtk/ArgumentCodersGtk.h:
    * UIProcess/API/gtk/PageClientImpl.cpp:
    (WebKit::PageClientImpl::startDrag):
    * UIProcess/API/gtk/PageClientImpl.h:
    * UIProcess/API/gtk/WebKitWebViewBase.cpp:
    (webkit_web_view_base_init): Set the view as a potential drop destination.
    (webkitWebViewBaseDragDataGet): Added, delegate to GtkDragAndDropHelper.
    (webkitWebViewBaseDragEnd): Ditto.
    (webkitWebViewBaseDragDataReceived): Ditto.
    (webkitWebViewBaseDragEnter): Ditto.
    (webkitWebViewBaseDragMotion): Ditto.
    (doDragLeaveLater): Ditto.
    (webkitWebViewBaseDragLeave): Ditto.
    (webkitWebViewBaseDragDrop): Ditto.
    (webkit_web_view_base_class_init): Override GtkWidget drag and drop methods.
    (webkitWebViewBaseStartDrag): Calls gtk_drag_begin() to start a drag operation.
    * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add webkitWebViewBaseStartDrag().
    * UIProcess/PageClient.h: Add startDrag().
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::performDragControllerAction): Share the Qt version.
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    * WebProcess/WebCoreSupport/WebDragClient.cpp:
    * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp: Added.
    * WebProcess/WebPage/WebPage.cpp: Add drag support for GTK+.
    * WebProcess/WebPage/WebPage.h: Ditto.
    * WebProcess/WebPage/WebPage.messages.in: Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97012 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    3a1633fa