<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174959] releases/WebKitGTK/webkit-2.6/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174959">174959</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-21 07:27:49 -0700 (Tue, 21 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/174868">r174868</a> - [GTK] Move GtkDragAndDropHelper from Platform to WebKit2
https://bugs.webkit.org/show_bug.cgi?id=137422

Reviewed by Martin Robinson.

Source/WebCore:

Remove ClipboardUtilitiesGtk and GtkDragAndDropHelper.

* PlatformGTK.cmake:
* platform/gtk/ClipboardUtilitiesGtk.cpp: Removed.
* platform/gtk/ClipboardUtilitiesGtk.h: Removed.
* platform/gtk/GtkDragAndDropHelper.cpp: Removed.
* platform/gtk/GtkDragAndDropHelper.h: Removed.

Source/WebKit2:

WebKitWebViewBase is currently the only user of
GtkDragAndDropHelper, that was added to share the code with
WebKit1. Move all the drag and drop logic to a new class
DragAndDropHandler.

* PlatformGTK.cmake: Add new files to compilation.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::startDrag):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseConstructed):
(webkitWebViewBaseDragDataGet):
(webkitWebViewBaseDragEnd):
(webkitWebViewBaseDragDataReceived):
(webkitWebViewBaseDragMotion):
(webkitWebViewBaseDragLeave):
(webkitWebViewBaseDragDrop):
(webkitWebViewBaseDragAndDropHandler):
(dragExitedCallback): Deleted.
(webkitWebViewBaseStartDrag): Deleted.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/gtk/DragAndDropHandler.cpp: Added.
(WebKit::DragAndDropHandler::create):
(WebKit::DragAndDropHandler::DragAndDropHandler):
(WebKit::DragAndDropHandler::DroppingContext::DroppingContext):
(WebKit::dragOperationToGdkDragActions):
(WebKit::dragOperationToSingleGdkDragAction):
(WebKit::gdkDragActionToDragOperation):
(WebKit::DragAndDropHandler::startDrag):
(WebKit::DragAndDropHandler::fillDragData):
(WebKit::DragAndDropHandler::finishDrag):
(WebKit::DragAndDropHandler::dataObjectForDropData):
(WebKit::DragAndDropHandler::dragEntered):
(WebKit::DragAndDropHandler::requestDragData):
(WebKit::DragAndDropHandler::dragMotion):
(WebKit::DragAndDropHandler::dragLeave):
(WebKit::DragAndDropHandler::drop):
* UIProcess/gtk/DragAndDropHandler.h: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorePlatformGTKcmake">releases/WebKitGTK/webkit-2.6/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2PlatformGTKcmake">releases/WebKitGTK/webkit-2.6/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkPageClientImplcpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessgtkDragAndDropHandlercpp">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebKit2UIProcessgtkDragAndDropHandlerh">releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreplatformgtkClipboardUtilitiesGtkcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreplatformgtkClipboardUtilitiesGtkh">releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreplatformgtkGtkDragAndDropHelpercpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreplatformgtkGtkDragAndDropHelperh">releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit26SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-10-19  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Move GtkDragAndDropHelper from Platform to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=137422
+
+        Reviewed by Martin Robinson.
+
+        Remove ClipboardUtilitiesGtk and GtkDragAndDropHelper.
+
+        * PlatformGTK.cmake:
+        * platform/gtk/ClipboardUtilitiesGtk.cpp: Removed.
+        * platform/gtk/ClipboardUtilitiesGtk.h: Removed.
+        * platform/gtk/GtkDragAndDropHelper.cpp: Removed.
+        * platform/gtk/GtkDragAndDropHelper.h: Removed.
+
</ins><span class="cx"> 2014-10-05  Lorenzo Tilve  &lt;ltilve@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Fix build when DRAG_SUPPORT is disabled
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/PlatformGTK.cmake (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/PlatformGTK.cmake        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/PlatformGTK.cmake        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -213,7 +213,6 @@
</span><span class="cx">     platform/graphics/gtk/ImageBufferGtk.cpp
</span><span class="cx">     platform/graphics/gtk/ImageGtk.cpp
</span><span class="cx"> 
</span><del>-    platform/gtk/ClipboardUtilitiesGtk.cpp
</del><span class="cx">     platform/gtk/ContextMenuGtk.cpp
</span><span class="cx">     platform/gtk/ContextMenuItemGtk.cpp
</span><span class="cx">     platform/gtk/CursorGtk.cpp
</span><span class="lines">@@ -223,7 +222,6 @@
</span><span class="cx">     platform/gtk/DragImageGtk.cpp
</span><span class="cx">     platform/gtk/GRefPtrGtk.cpp
</span><span class="cx">     platform/gtk/GtkClickCounter.cpp
</span><del>-    platform/gtk/GtkDragAndDropHelper.cpp
</del><span class="cx">     platform/gtk/GtkInputMethodFilter.cpp
</span><span class="cx">     platform/gtk/GtkTouchContextHelper.cpp
</span><span class="cx">     platform/gtk/GtkUtilities.cpp
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreplatformgtkClipboardUtilitiesGtkcpp"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.cpp        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,75 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, Igalia S.L.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include &quot;config.h&quot;
-#include &quot;ClipboardUtilitiesGtk.h&quot;
-
-namespace WebCore {
-
-GdkDragAction dragOperationToGdkDragActions(DragOperation coreAction)
-{
-    GdkDragAction gdkAction = static_cast&lt;GdkDragAction&gt;(0);
-    if (coreAction == DragOperationNone)
-        return gdkAction;
-
-    if (coreAction &amp; DragOperationCopy)
-        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_COPY | gdkAction);
-    if (coreAction &amp; DragOperationMove)
-        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_MOVE | gdkAction);
-    if (coreAction &amp; DragOperationLink)
-        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_LINK | gdkAction);
-    if (coreAction &amp; DragOperationPrivate)
-        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_PRIVATE | gdkAction);
-
-    return gdkAction;
-}
-
-GdkDragAction dragOperationToSingleGdkDragAction(DragOperation coreAction)
-{
-    if (coreAction == DragOperationEvery || coreAction &amp; DragOperationCopy)
-        return GDK_ACTION_COPY;
-    if (coreAction &amp; DragOperationMove)
-        return GDK_ACTION_MOVE;
-    if (coreAction &amp; DragOperationLink)
-        return GDK_ACTION_LINK;
-    if (coreAction &amp; DragOperationPrivate)
-        return GDK_ACTION_PRIVATE;
-    return static_cast&lt;GdkDragAction&gt;(0);
-}
-
-DragOperation gdkDragActionToDragOperation(GdkDragAction gdkAction)
-{
-    // We have no good way to detect DragOperationEvery other than
-    // to use it when all applicable flags are on.
-    if (gdkAction &amp; GDK_ACTION_COPY &amp;&amp; gdkAction &amp; GDK_ACTION_MOVE
-        &amp;&amp; gdkAction &amp; GDK_ACTION_LINK &amp;&amp; gdkAction &amp; GDK_ACTION_PRIVATE)
-        return DragOperationEvery;
-
-    unsigned int action = DragOperationNone;
-    if (gdkAction &amp; GDK_ACTION_COPY)
-        action |= DragOperationCopy;
-    if (gdkAction &amp; GDK_ACTION_MOVE)
-        action |= DragOperationMove;
-    if (gdkAction &amp; GDK_ACTION_LINK)
-        action |= DragOperationLink;
-    if (gdkAction &amp; GDK_ACTION_PRIVATE)
-        action |= DragOperationPrivate;
-    return static_cast&lt;DragOperation&gt;(action);
-}
-
-}
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreplatformgtkClipboardUtilitiesGtkh"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.h (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.h        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/ClipboardUtilitiesGtk.h        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,33 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, Igalia S.L.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef ClipboardUtilitiesGtk_h
-#define ClipboardUtilitiesGtk_h
-
-#include &quot;DragActions.h&quot;
-#include &lt;gdk/gdk.h&gt;
-
-namespace WebCore {
-
-GdkDragAction dragOperationToGdkDragActions(DragOperation);
-GdkDragAction dragOperationToSingleGdkDragAction(DragOperation);
-DragOperation gdkDragActionToDragOperation(GdkDragAction);
-
-}
-
-#endif // ClipboardUtilitiesGtk_h
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreplatformgtkGtkDragAndDropHelpercpp"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,172 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011, Igalia S.L.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include &quot;config.h&quot;
-#include &quot;GtkDragAndDropHelper.h&quot;
-
-#if ENABLE(DRAG_SUPPORT)
-
-#include &quot;ClipboardUtilitiesGtk.h&quot;
-#include &quot;DragData.h&quot;
-#include &quot;GtkUtilities.h&quot;
-#include &quot;GtkVersioning.h&quot;
-#include &quot;PasteboardHelper.h&quot;
-#include &lt;gtk/gtk.h&gt;
-#include &lt;wtf/gobject/GMainLoopSource.h&gt;
-
-namespace WebCore {
-
-struct DroppingContext {
-    DroppingContext(GdkDragContext* gdkContext, const IntPoint&amp; position)
-        : gdkContext(gdkContext)
-        , dataObject(DataObjectGtk::create())
-        , lastMotionPosition(position)
-        , dropHappened(false)
-        , exitedCallback(0)
-    {
-    }
-
-    GdkDragContext* gdkContext;
-    RefPtr&lt;DataObjectGtk&gt; dataObject;
-    WebCore::IntPoint lastMotionPosition;
-    int pendingDataRequests;
-    bool dropHappened;
-    DragExitedCallback exitedCallback;
-};
-
-GtkDragAndDropHelper::GtkDragAndDropHelper()
-    : m_widget(nullptr)
-{
-}
-
-GtkDragAndDropHelper::~GtkDragAndDropHelper()
-{
-}
-
-bool GtkDragAndDropHelper::handleDragEnd(GdkDragContext* dragContext)
-{
-    return m_draggingDataObjects.remove(dragContext);
-}
-
-void GtkDragAndDropHelper::handleGetDragData(GdkDragContext* context, GtkSelectionData* selectionData, guint info)
-{
-    DataObjectGtk* dataObject = m_draggingDataObjects.get(context);
-    if (!dataObject)
-        return;
-    PasteboardHelper::defaultPasteboardHelper()-&gt;fillSelectionData(selectionData, info, dataObject);
-}
-
-void GtkDragAndDropHelper::handleDragLeaveLater(DroppingContext* context)
-{
-    auto iterator = m_droppingContexts.find(context-&gt;gdkContext);
-    if (iterator == m_droppingContexts.end())
-        return;
-
-    // If the view doesn't know about the drag yet (there are still pending data)
-    // requests, don't update it with information about the drag.
-    if (context-&gt;pendingDataRequests)
-        return;
-
-    const IntPoint&amp; position = context-&gt;lastMotionPosition;
-    DragData dragData(context-&gt;dataObject.get(), position,
-                      convertWidgetPointToScreenPoint(m_widget, position),
-                      DragOperationNone);
-    context-&gt;exitedCallback(m_widget, dragData, context-&gt;dropHappened);
-
-    m_droppingContexts.remove(iterator);
-}
-
-void GtkDragAndDropHelper::handleDragLeave(GdkDragContext* gdkContext, DragExitedCallback exitedCallback)
-{
-    DroppingContext* context = m_droppingContexts.get(gdkContext);
-    if (!context)
-        return;
-
-    // During a drop GTK+ will fire a drag-leave signal right before firing
-    // the drag-drop signal. We want the actions for drag-leave to happen after
-    // those for drag-drop, so schedule them to happen asynchronously here.
-    context-&gt;exitedCallback = exitedCallback;
-    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] handleDragLeaveLater&quot;, std::function&lt;void()&gt;(std::bind(&amp;GtkDragAndDropHelper::handleDragLeaveLater, this, context)));
-}
-
-static void queryNewDropContextData(DroppingContext* dropContext, GtkWidget* widget, guint time)
-{
-    GdkDragContext* gdkContext = dropContext-&gt;gdkContext;
-    Vector&lt;GdkAtom&gt; acceptableTargets(PasteboardHelper::defaultPasteboardHelper()-&gt;dropAtomsForContext(widget, gdkContext));
-    dropContext-&gt;pendingDataRequests = acceptableTargets.size();
-    for (size_t i = 0; i &lt; acceptableTargets.size(); i++)
-        gtk_drag_get_data(widget, gdkContext, acceptableTargets.at(i), time);
-}
-
-DataObjectGtk* GtkDragAndDropHelper::handleDragMotion(GdkDragContext* context, const IntPoint&amp; position, unsigned time)
-{
-    std::unique_ptr&lt;DroppingContext&gt;&amp; droppingContext = m_droppingContexts.add(context, nullptr).iterator-&gt;value;
-    if (!droppingContext) {
-        droppingContext = std::make_unique&lt;DroppingContext&gt;(context, position);
-        queryNewDropContextData(droppingContext.get(), m_widget, time);
-    } else
-        droppingContext-&gt;lastMotionPosition = position;
-
-    // Don't send any drag information to WebCore until we've retrieved all
-    // the data for this drag operation. Otherwise we'd have to block to wait
-    // for the drag's data.
-    if (droppingContext-&gt;pendingDataRequests &gt; 0)
-        return nullptr;
-
-    return droppingContext-&gt;dataObject.get();
-}
-
-DataObjectGtk* GtkDragAndDropHelper::handleDragDataReceived(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info, IntPoint&amp; position)
-{
-    DroppingContext* droppingContext = m_droppingContexts.get(context);
-    if (!droppingContext)
-        return nullptr;
-
-    droppingContext-&gt;pendingDataRequests--;
-    PasteboardHelper::defaultPasteboardHelper()-&gt;fillDataObjectFromDropData(selectionData, info, droppingContext-&gt;dataObject.get());
-
-    if (droppingContext-&gt;pendingDataRequests)
-        return nullptr;
-
-    // The coordinates passed to drag-data-received signal are sometimes
-    // inaccurate in DRT, so use the coordinates of the last motion event.
-    position = droppingContext-&gt;lastMotionPosition;
-
-    // If there are no more pending requests, start sending dragging data to WebCore.
-    return droppingContext-&gt;dataObject.get();
-}
-
-DataObjectGtk* GtkDragAndDropHelper::handleDragDrop(GdkDragContext* context)
-{
-    DroppingContext* droppingContext = m_droppingContexts.get(context);
-    if (!droppingContext)
-        return nullptr;
-
-    droppingContext-&gt;dropHappened = true;
-
-    return droppingContext-&gt;dataObject.get();
-}
-
-void GtkDragAndDropHelper::startedDrag(GdkDragContext* context, DataObjectGtk* dataObject)
-{
-    m_draggingDataObjects.set(context, dataObject);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DRAG_SUPPORT)
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreplatformgtkGtkDragAndDropHelperh"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011, Igalia S.L.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef GtkDragAndDropHelper_h
-#define GtkDragAndDropHelper_h
-
-#if ENABLE(DRAG_SUPPORT)
-
-#include &quot;DataObjectGtk.h&quot;
-#include &lt;wtf/FastMalloc.h&gt;
-#include &lt;wtf/Noncopyable.h&gt;
-
-namespace WebCore {
-
-struct DroppingContext;
-class DragData;
-class IntPoint;
-
-typedef void (*DragExitedCallback)(GtkWidget*, DragData&amp;, bool dropHappened);
-
-class GtkDragAndDropHelper {
-    WTF_MAKE_NONCOPYABLE(GtkDragAndDropHelper);
-    WTF_MAKE_FAST_ALLOCATED;
-
-public:
-    GtkDragAndDropHelper();
-    ~GtkDragAndDropHelper();
-
-    void setWidget(GtkWidget* widget) { m_widget = widget; }
-    bool handleDragEnd(GdkDragContext*);
-    void handleGetDragData(GdkDragContext*, GtkSelectionData*, guint info);
-    void handleDragLeave(GdkDragContext*, DragExitedCallback);
-    void handleDragLeaveLater(DroppingContext*);
-    DataObjectGtk* handleDragMotion(GdkDragContext*, const IntPoint&amp;, unsigned time);
-    DataObjectGtk* handleDragDataReceived(GdkDragContext*, GtkSelectionData*, unsigned info, IntPoint&amp;);
-    DataObjectGtk* handleDragDrop(GdkDragContext*);
-    void startedDrag(GdkDragContext*, DataObjectGtk*);
-
-private:
-    GtkWidget* m_widget;
-    HashMap&lt;GdkDragContext*, std::unique_ptr&lt;DroppingContext&gt;&gt; m_droppingContexts;
-    HashMap&lt;GdkDragContext*, RefPtr&lt;DataObjectGtk&gt;&gt; m_draggingDataObjects;
-};
-
-}
-
-#endif // ENABLE(DRAG_SUPPORT)
-
-#endif // DataObjectGtk_h
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/ChangeLog        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2014-10-20  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Remove the factory method from DragAndDropHandler
+        https://bugs.webkit.org/show_bug.cgi?id=137872
+
+        Reviewed by Sergio Villar Senin.
+
+        Make the constructor public and use std::make_unique instead.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseDragAndDropHandler):
+        * UIProcess/gtk/DragAndDropHandler.cpp:
+        (WebKit::DragAndDropHandler::create): Deleted.
+        * UIProcess/gtk/DragAndDropHandler.h:
+
+2014-10-19  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Move GtkDragAndDropHelper from Platform to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=137422
+
+        Reviewed by Martin Robinson.
+
+        WebKitWebViewBase is currently the only user of
+        GtkDragAndDropHelper, that was added to share the code with
+        WebKit1. Move all the drag and drop logic to a new class
+        DragAndDropHandler.
+
+        * PlatformGTK.cmake: Add new files to compilation.
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::startDrag):
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseConstructed):
+        (webkitWebViewBaseDragDataGet):
+        (webkitWebViewBaseDragEnd):
+        (webkitWebViewBaseDragDataReceived):
+        (webkitWebViewBaseDragMotion):
+        (webkitWebViewBaseDragLeave):
+        (webkitWebViewBaseDragDrop):
+        (webkitWebViewBaseDragAndDropHandler):
+        (dragExitedCallback): Deleted.
+        (webkitWebViewBaseStartDrag): Deleted.
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+        * UIProcess/gtk/DragAndDropHandler.cpp: Added.
+        (WebKit::DragAndDropHandler::create):
+        (WebKit::DragAndDropHandler::DragAndDropHandler):
+        (WebKit::DragAndDropHandler::DroppingContext::DroppingContext):
+        (WebKit::dragOperationToGdkDragActions):
+        (WebKit::dragOperationToSingleGdkDragAction):
+        (WebKit::gdkDragActionToDragOperation):
+        (WebKit::DragAndDropHandler::startDrag):
+        (WebKit::DragAndDropHandler::fillDragData):
+        (WebKit::DragAndDropHandler::finishDrag):
+        (WebKit::DragAndDropHandler::dataObjectForDropData):
+        (WebKit::DragAndDropHandler::dragEntered):
+        (WebKit::DragAndDropHandler::requestDragData):
+        (WebKit::DragAndDropHandler::dragMotion):
+        (WebKit::DragAndDropHandler::dragLeave):
+        (WebKit::DragAndDropHandler::drop):
+        * UIProcess/gtk/DragAndDropHandler.h: Added.
+
</ins><span class="cx"> 2014-10-05  Lorenzo Tilve  &lt;ltilve@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Fix build when DRAG_SUPPORT is disabled
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/PlatformGTK.cmake (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/PlatformGTK.cmake        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/PlatformGTK.cmake        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -251,6 +251,7 @@
</span><span class="cx"> 
</span><span class="cx">     UIProcess/cairo/BackingStoreCairo.cpp
</span><span class="cx"> 
</span><ins>+    UIProcess/gtk/DragAndDropHandler.cpp
</ins><span class="cx">     UIProcess/gtk/ExperimentalFeatures.cpp
</span><span class="cx">     UIProcess/gtk/TextCheckerGtk.cpp
</span><span class="cx">     UIProcess/gtk/WebContextGtk.cpp
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkPageClientImplcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -271,7 +271,12 @@
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> void PageClientImpl::startDrag(const WebCore::DragData&amp; dragData, PassRefPtr&lt;ShareableBitmap&gt; dragImage)
</span><span class="cx"> {
</span><del>-    webkitWebViewBaseStartDrag(WEBKIT_WEB_VIEW_BASE(m_viewWidget), dragData, dragImage);
</del><ins>+    WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
+    webkitWebViewBaseDragAndDropHandler(webView).startDrag(dragData, dragImage);
+
+    // A drag starting should prevent a double-click from happening. This might
+    // happen if a drag is followed very quickly by another click (like in the WTR).
+    webkitWebViewBaseResetClickCounter(webView);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -48,13 +48,8 @@
</span><span class="cx"> #include &quot;WebUserContentControllerProxy.h&quot;
</span><span class="cx"> #include &quot;WebViewBaseInputMethodFilter.h&quot;
</span><span class="cx"> #include &lt;WebCore/CairoUtilities.h&gt;
</span><del>-#include &lt;WebCore/ClipboardUtilitiesGtk.h&gt;
-#include &lt;WebCore/DataObjectGtk.h&gt;
-#include &lt;WebCore/DragData.h&gt;
-#include &lt;WebCore/DragIcon.h&gt;
</del><span class="cx"> #include &lt;WebCore/GUniquePtrGtk.h&gt;
</span><span class="cx"> #include &lt;WebCore/GtkClickCounter.h&gt;
</span><del>-#include &lt;WebCore/GtkDragAndDropHelper.h&gt;
</del><span class="cx"> #include &lt;WebCore/GtkTouchContextHelper.h&gt;
</span><span class="cx"> #include &lt;WebCore/GtkUtilities.h&gt;
</span><span class="cx"> #include &lt;WebCore/GtkVersioning.h&gt;
</span><span class="lines">@@ -101,10 +96,6 @@
</span><span class="cx">     GtkClickCounter clickCounter;
</span><span class="cx">     CString tooltipText;
</span><span class="cx">     IntRect tooltipArea;
</span><del>-#if ENABLE(DRAG_SUPPORT)
-    GtkDragAndDropHelper dragAndDropHelper;
-#endif
-    DragIcon dragIcon;
</del><span class="cx"> #if !GTK_CHECK_VERSION(3, 13, 4)
</span><span class="cx">     IntSize resizerSize;
</span><span class="cx"> #endif
</span><span class="lines">@@ -143,6 +134,10 @@
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL) &amp;&amp; PLATFORM(X11)
</span><span class="cx">     OwnPtr&lt;RedirectedXCompositeWindow&gt; redirectedWindow;
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(DRAG_SUPPORT)
+    std::unique_ptr&lt;DragAndDropHandler&gt; dragAndDropHandler;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER)
</span><span class="lines">@@ -419,15 +414,12 @@
</span><span class="cx"> 
</span><span class="cx">     GtkWidget* viewWidget = GTK_WIDGET(object);
</span><span class="cx">     gtk_widget_set_can_focus(viewWidget, TRUE);
</span><del>-    gtk_drag_dest_set(viewWidget, static_cast&lt;GtkDestDefaults&gt;(0), 0, 0,
-                      static_cast&lt;GdkDragAction&gt;(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
</del><ins>+    gtk_drag_dest_set(viewWidget, static_cast&lt;GtkDestDefaults&gt;(0), nullptr, 0,
+        static_cast&lt;GdkDragAction&gt;(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
</ins><span class="cx">     gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::defaultPasteboardHelper()-&gt;targetList());
</span><span class="cx"> 
</span><span class="cx">     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)-&gt;priv;
</span><span class="cx">     priv-&gt;pageClient = PageClientImpl::create(viewWidget);
</span><del>-#if ENABLE(DRAG_SUPPORT)
-    priv-&gt;dragAndDropHelper.setWidget(viewWidget);
-#endif
</del><span class="cx"> 
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL) &amp;&amp; PLATFORM(X11)
</span><span class="cx">     GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
</span><span class="lines">@@ -780,37 +772,21 @@
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> static void webkitWebViewBaseDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint /* time */)
</span><span class="cx"> {
</span><del>-    WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv-&gt;dragAndDropHelper.handleGetDragData(context, selectionData, info);
</del><ins>+    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
+    ASSERT(priv-&gt;dragAndDropHandler);
+    priv-&gt;dragAndDropHandler-&gt;fillDragData(context, selectionData, info);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseDragEnd(GtkWidget* widget, GdkDragContext* context)
</span><span class="cx"> {
</span><del>-    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    if (!webViewBase-&gt;priv-&gt;dragAndDropHelper.handleDragEnd(context))
-        return;
-
-    GdkDevice* device = gdk_drag_context_get_device(context);
-    int x = 0, y = 0;
-    gdk_device_get_window_at_position(device, &amp;x, &amp;y);
-    int xRoot = 0, yRoot = 0;
-    gdk_device_get_position(device, 0, &amp;xRoot, &amp;yRoot);
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;dragEnded(IntPoint(x, y), IntPoint(xRoot, yRoot),
-                                            gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
</del><ins>+    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
+    ASSERT(priv-&gt;dragAndDropHandler);
+    priv-&gt;dragAndDropHandler-&gt;finishDrag(context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext* context, gint /* x */, gint /* y */, GtkSelectionData* selectionData, guint info, guint time)
</span><span class="cx"> {
</span><del>-    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    IntPoint position;
-    DataObjectGtk* dataObject = webViewBase-&gt;priv-&gt;dragAndDropHelper.handleDragDataReceived(context, selectionData, info, position);
-    if (!dataObject)
-        return;
-
-    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;resetCurrentDragInformation();
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;dragEntered(dragData);
-    DragOperation operation = webViewBase-&gt;priv-&gt;pageProxy-&gt;currentDragOperation();
-    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
</del><ins>+    webkitWebViewBaseDragAndDropHandler(WEBKIT_WEB_VIEW_BASE(widget)).dragEntered(context, selectionData, info, time);
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span><span class="lines">@@ -845,50 +821,22 @@
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> static gboolean webkitWebViewBaseDragMotion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
</span><span class="cx"> {
</span><del>-    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    IntPoint position(x, y);
-    DataObjectGtk* dataObject = webViewBase-&gt;priv-&gt;dragAndDropHelper.handleDragMotion(context, position, time);
-    if (!dataObject)
-        return TRUE;
-
-    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;dragUpdated(dragData);
-    DragOperation operation = webViewBase-&gt;priv-&gt;pageProxy-&gt;currentDragOperation();
-    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
</del><ins>+    webkitWebViewBaseDragAndDropHandler(WEBKIT_WEB_VIEW_BASE(widget)).dragMotion(context, IntPoint(x, y), time);
</ins><span class="cx">     return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void dragExitedCallback(GtkWidget* widget, DragData&amp; dragData, bool dropHappened)
-{
-    // Don't call dragExited if we have just received a drag-drop signal. This
-    // happens in the case of a successful drop onto the view.
-    if (dropHappened)
-        return;
-
-    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;dragExited(dragData);
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;resetCurrentDragInformation();
-}
-
</del><span class="cx"> static void webkitWebViewBaseDragLeave(GtkWidget* widget, GdkDragContext* context, guint /* time */)
</span><span class="cx"> {
</span><del>-    WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv-&gt;dragAndDropHelper.handleDragLeave(context, dragExitedCallback);
</del><ins>+    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
+    ASSERT(priv-&gt;dragAndDropHandler);
+    priv-&gt;dragAndDropHandler-&gt;dragLeave(context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
</span><span class="cx"> {
</span><del>-    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
-    DataObjectGtk* dataObject = webViewBase-&gt;priv-&gt;dragAndDropHelper.handleDragDrop(context);
-    if (!dataObject)
-        return FALSE;
-
-    IntPoint position(x, y);
-    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
-    SandboxExtension::Handle handle;
-    SandboxExtension::HandleArray sandboxExtensionForUpload;
-    webViewBase-&gt;priv-&gt;pageProxy-&gt;performDragOperation(dragData, String(), handle, sandboxExtensionForUpload);
-    gtk_drag_finish(context, TRUE, FALSE, time);
-    return TRUE;
</del><ins>+    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
+    ASSERT(priv-&gt;dragAndDropHandler);
+    return priv-&gt;dragAndDropHandler-&gt;drop(context, IntPoint(x, y), time);
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span><span class="lines">@@ -1048,31 +996,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><del>-void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData&amp; dragData, PassRefPtr&lt;ShareableBitmap&gt; dragImage)
</del><ins>+DragAndDropHandler&amp; webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase* webViewBase)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><del>-
-    RefPtr&lt;DataObjectGtk&gt; dataObject = adoptRef(dragData.platformData());
-    GRefPtr&lt;GtkTargetList&gt; targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()-&gt;targetListForDataObject(dataObject.get()));
-    GUniquePtr&lt;GdkEvent&gt; currentEvent(gtk_get_current_event());
-    GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(webViewBase),
-                                             targetList.get(),
-                                             dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
-                                             1, /* button */
-                                             currentEvent.get());
-    priv-&gt;dragAndDropHelper.startedDrag(context, dataObject.get());
-
-
-    // A drag starting should prevent a double-click from happening. This might
-    // happen if a drag is followed very quickly by another click (like in the DRT).
-    priv-&gt;clickCounter.reset();
-
-    if (dragImage) {
-        RefPtr&lt;cairo_surface_t&gt; image(dragImage-&gt;createCairoSurface());
-        priv-&gt;dragIcon.setImage(image.get());
-        priv-&gt;dragIcon.useForDrag(context);
-    } else
-        gtk_drag_set_icon_default(context);
</del><ins>+    if (!priv-&gt;dragAndDropHandler)
+        priv-&gt;dragAndDropHandler = std::make_unique&lt;DragAndDropHandler&gt;(*priv-&gt;pageProxy);
+    return *priv-&gt;dragAndDropHandler;
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessAPIgtkWebKitWebViewBasePrivateh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (174958 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-10-21 14:22:52 UTC (rev 174958)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #ifndef WebKitWebViewBasePrivate_h
</span><span class="cx"> #define WebKitWebViewBasePrivate_h
</span><span class="cx"> 
</span><ins>+#include &quot;DragAndDropHandler.h&quot;
</ins><span class="cx"> #include &quot;WebContextMenuProxyGtk.h&quot;
</span><span class="cx"> #include &quot;WebInspectorProxy.h&quot;
</span><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="lines">@@ -41,7 +42,6 @@
</span><span class="cx"> void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
</span><span class="cx"> void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&amp;);
</span><span class="cx"> void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
</span><del>-void webkitWebViewBaseStartDrag(WebKitWebViewBase*, const WebCore::DragData&amp;, PassRefPtr&lt;WebKit::ShareableBitmap&gt; dragImage);
</del><span class="cx"> void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&amp;);
</span><span class="cx"> void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
</span><span class="cx"> void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*);
</span><span class="lines">@@ -74,4 +74,8 @@
</span><span class="cx"> void webkitWebViewBaseAddWebInspector(WebKitWebViewBase*, GtkWidget* inspector, WebKit::AttachmentSide);
</span><span class="cx"> void webkitWebViewBaseResetClickCounter(WebKitWebViewBase*);
</span><span class="cx"> 
</span><ins>+#if ENABLE(DRAG_SUPPORT)
+WebKit::DragAndDropHandler&amp; webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase*);
+#endif
+
</ins><span class="cx"> #endif // WebKitWebViewBasePrivate_h
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessgtkDragAndDropHandlercpp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp (0 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -0,0 +1,269 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;DragAndDropHandler.h&quot;
+
+#if ENABLE(DRAG_SUPPORT)
+
+#include &quot;WebPageProxy.h&quot;
+#include &lt;WebCore/DataObjectGtk.h&gt;
+#include &lt;WebCore/DragData.h&gt;
+#include &lt;WebCore/DragIcon.h&gt;
+#include &lt;WebCore/GRefPtrGtk.h&gt;
+#include &lt;WebCore/GtkUtilities.h&gt;
+#include &lt;WebCore/PasteboardHelper.h&gt;
+#include &lt;gtk/gtk.h&gt;
+#include &lt;wtf/gobject/GMainLoopSource.h&gt;
+#include &lt;wtf/gobject/GUniquePtr.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+DragAndDropHandler::DragAndDropHandler(WebPageProxy&amp; page)
+    : m_page(page)
+{
+}
+
+DragAndDropHandler::DroppingContext::DroppingContext(GdkDragContext* gdkContext, const IntPoint&amp; position)
+    : gdkContext(gdkContext)
+    , dataObject(DataObjectGtk::create())
+    , lastMotionPosition(position)
+    , dropHappened(false)
+{
+}
+
+static inline GdkDragAction dragOperationToGdkDragActions(DragOperation coreAction)
+{
+    GdkDragAction gdkAction = static_cast&lt;GdkDragAction&gt;(0);
+    if (coreAction == DragOperationNone)
+        return gdkAction;
+
+    if (coreAction &amp; DragOperationCopy)
+        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_COPY | gdkAction);
+    if (coreAction &amp; DragOperationMove)
+        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_MOVE | gdkAction);
+    if (coreAction &amp; DragOperationLink)
+        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_LINK | gdkAction);
+    if (coreAction &amp; DragOperationPrivate)
+        gdkAction = static_cast&lt;GdkDragAction&gt;(GDK_ACTION_PRIVATE | gdkAction);
+
+    return gdkAction;
+}
+
+static inline GdkDragAction dragOperationToSingleGdkDragAction(DragOperation coreAction)
+{
+    if (coreAction == DragOperationEvery || coreAction &amp; DragOperationCopy)
+        return GDK_ACTION_COPY;
+    if (coreAction &amp; DragOperationMove)
+        return GDK_ACTION_MOVE;
+    if (coreAction &amp; DragOperationLink)
+        return GDK_ACTION_LINK;
+    if (coreAction &amp; DragOperationPrivate)
+        return GDK_ACTION_PRIVATE;
+    return static_cast&lt;GdkDragAction&gt;(0);
+}
+
+static inline DragOperation gdkDragActionToDragOperation(GdkDragAction gdkAction)
+{
+    // We have no good way to detect DragOperationEvery other than
+    // to use it when all applicable flags are on.
+    if (gdkAction &amp; GDK_ACTION_COPY
+        &amp;&amp; gdkAction &amp; GDK_ACTION_MOVE
+        &amp;&amp; gdkAction &amp; GDK_ACTION_LINK
+        &amp;&amp; gdkAction &amp; GDK_ACTION_PRIVATE)
+        return DragOperationEvery;
+
+    unsigned action = DragOperationNone;
+    if (gdkAction &amp; GDK_ACTION_COPY)
+        action |= DragOperationCopy;
+    if (gdkAction &amp; GDK_ACTION_MOVE)
+        action |= DragOperationMove;
+    if (gdkAction &amp; GDK_ACTION_LINK)
+        action |= DragOperationLink;
+    if (gdkAction &amp; GDK_ACTION_PRIVATE)
+        action |= DragOperationPrivate;
+    return static_cast&lt;DragOperation&gt;(action);
+}
+
+void DragAndDropHandler::startDrag(const DragData&amp; dragData, PassRefPtr&lt;ShareableBitmap&gt; dragImage)
+{
+    RefPtr&lt;DataObjectGtk&gt; dataObject = adoptRef(dragData.platformData());
+    GRefPtr&lt;GtkTargetList&gt; targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()-&gt;targetListForDataObject(dataObject.get()));
+    GUniquePtr&lt;GdkEvent&gt; currentEvent(gtk_get_current_event());
+
+    GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
+        GDK_BUTTON_PRIMARY, currentEvent.get());
+    m_draggingDataObjects.set(context, dataObject.get());
+
+    if (dragImage) {
+        RefPtr&lt;cairo_surface_t&gt; image(dragImage-&gt;createCairoSurface());
+        m_dragIcon.setImage(image.get());
+        m_dragIcon.useForDrag(context);
+    } else
+        gtk_drag_set_icon_default(context);
+}
+
+void DragAndDropHandler::fillDragData(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info)
+{
+    if (DataObjectGtk* dataObject = m_draggingDataObjects.get(context))
+        PasteboardHelper::defaultPasteboardHelper()-&gt;fillSelectionData(selectionData, info, dataObject);
+}
+
+void DragAndDropHandler::finishDrag(GdkDragContext* context)
+{
+    if (!m_draggingDataObjects.remove(context))
+        return;
+
+    GdkDevice* device = gdk_drag_context_get_device(context);
+    int x = 0, y = 0;
+    gdk_device_get_window_at_position(device, &amp;x, &amp;y);
+    int xRoot = 0, yRoot = 0;
+    gdk_device_get_position(device, nullptr, &amp;xRoot, &amp;yRoot);
+    m_page.dragEnded(IntPoint(x, y), IntPoint(xRoot, yRoot), gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
+}
+
+DataObjectGtk* DragAndDropHandler::dataObjectForDropData(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info, IntPoint&amp; position)
+{
+    DroppingContext* droppingContext = m_droppingContexts.get(context);
+    if (!droppingContext)
+        return nullptr;
+
+    droppingContext-&gt;pendingDataRequests--;
+    PasteboardHelper::defaultPasteboardHelper()-&gt;fillDataObjectFromDropData(selectionData, info, droppingContext-&gt;dataObject.get());
+    if (droppingContext-&gt;pendingDataRequests)
+        return nullptr;
+
+    // The coordinates passed to drag-data-received signal are sometimes
+    // inaccurate in WTR, so use the coordinates of the last motion event.
+    position = droppingContext-&gt;lastMotionPosition;
+
+    // If there are no more pending requests, start sending dragging data to WebCore.
+    return droppingContext-&gt;dataObject.get();
+}
+
+void DragAndDropHandler::dragEntered(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info, unsigned time)
+{
+    IntPoint position;
+    DataObjectGtk* dataObject = dataObjectForDropData(context, selectionData, info, position);
+    if (!dataObject)
+        return;
+
+    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+    m_page.resetCurrentDragInformation();
+    m_page.dragEntered(dragData);
+    DragOperation operation = m_page.currentDragOperation();
+    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
+}
+
+DataObjectGtk* DragAndDropHandler::requestDragData(GdkDragContext* context, const IntPoint&amp; position, unsigned time)
+{
+    std::unique_ptr&lt;DroppingContext&gt;&amp; droppingContext = m_droppingContexts.add(context, nullptr).iterator-&gt;value;
+    if (!droppingContext) {
+        GtkWidget* widget = m_page.viewWidget();
+        droppingContext = std::make_unique&lt;DroppingContext&gt;(context, position);
+        Vector&lt;GdkAtom&gt; acceptableTargets(PasteboardHelper::defaultPasteboardHelper()-&gt;dropAtomsForContext(widget, droppingContext-&gt;gdkContext));
+        droppingContext-&gt;pendingDataRequests = acceptableTargets.size();
+        for (auto&amp; target : acceptableTargets)
+            gtk_drag_get_data(widget, droppingContext-&gt;gdkContext, target, time);
+    } else
+        droppingContext-&gt;lastMotionPosition = position;
+
+    // Don't send any drag information to WebCore until we've retrieved all the data for this drag operation.
+    // Otherwise we'd have to block to wait for the drag's data.
+    if (droppingContext-&gt;pendingDataRequests &gt; 0)
+        return nullptr;
+
+    return droppingContext-&gt;dataObject.get();
+}
+
+void DragAndDropHandler::dragMotion(GdkDragContext* context, const IntPoint&amp; position, unsigned time)
+{
+    DataObjectGtk* dataObject = requestDragData(context, position, time);
+    if (!dataObject)
+        return;
+
+    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+    m_page.dragUpdated(dragData);
+    DragOperation operation = m_page.currentDragOperation();
+    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
+}
+
+void DragAndDropHandler::dragLeave(GdkDragContext* context)
+{
+    DroppingContext* droppingContext = m_droppingContexts.get(context);
+    if (!droppingContext)
+        return;
+
+    // During a drop GTK+ will fire a drag-leave signal right before firing
+    // the drag-drop signal. We want the actions for drag-leave to happen after
+    // those for drag-drop, so schedule them to happen asynchronously here.
+    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] handleDragLeaveLater&quot;, [this, droppingContext]() {
+        auto it = m_droppingContexts.find(droppingContext-&gt;gdkContext);
+        if (it == m_droppingContexts.end())
+            return;
+
+        // If the view doesn't know about the drag yet (there are still pending data requests),
+        // don't update it with information about the drag.
+        if (droppingContext-&gt;pendingDataRequests)
+            return;
+
+        if (!droppingContext-&gt;dropHappened) {
+            // Don't call dragExited if we have just received a drag-drop signal. This
+            // happens in the case of a successful drop onto the view.
+            const IntPoint&amp; position = droppingContext-&gt;lastMotionPosition;
+            DragData dragData(droppingContext-&gt;dataObject.get(), position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), DragOperationNone);
+            m_page.dragExited(dragData);
+            m_page.resetCurrentDragInformation();
+        }
+
+        m_droppingContexts.remove(it);
+    });
+}
+
+bool DragAndDropHandler::drop(GdkDragContext* context, const IntPoint&amp; position, unsigned time)
+{
+    DroppingContext* droppingContext = m_droppingContexts.get(context);
+    if (!droppingContext)
+        return false;
+
+    droppingContext-&gt;dropHappened = true;
+
+    DataObjectGtk* dataObject = droppingContext-&gt;dataObject.get();
+    if (!dataObject)
+        return false;
+
+    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+    SandboxExtension::Handle handle;
+    SandboxExtension::HandleArray sandboxExtensionForUpload;
+    m_page.performDragOperation(dragData, String(), handle, sandboxExtensionForUpload);
+    gtk_drag_finish(context, TRUE, FALSE, time);
+    return true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DRAG_SUPPORT)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebKit2UIProcessgtkDragAndDropHandlerh"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h (0 => 174959)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h                                (rev 0)
+++ releases/WebKitGTK/webkit-2.6/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h        2014-10-21 14:27:49 UTC (rev 174959)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DragAndDropHandler_h
+#define DragAndDropHandler_h
+
+#if ENABLE(DRAG_SUPPORT)
+
+#include &lt;WebCore/DataObjectGtk.h&gt;
+#include &lt;WebCore/DragIcon.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GtkSelectionData GtkSelectionData;
+
+namespace WebCore {
+class DragData;
+class IntPoint;
+}
+
+namespace WebKit {
+
+class ShareableBitmap;
+class WebPageProxy;
+
+class DragAndDropHandler {
+    WTF_MAKE_NONCOPYABLE(DragAndDropHandler);
+public:
+    DragAndDropHandler(WebPageProxy&amp;);
+
+    void startDrag(const WebCore::DragData&amp;, PassRefPtr&lt;ShareableBitmap&gt; dragImage);
+    void fillDragData(GdkDragContext*, GtkSelectionData*, unsigned info);
+    void finishDrag(GdkDragContext*);
+
+    void dragEntered(GdkDragContext*, GtkSelectionData*, unsigned info, unsigned time);
+    void dragMotion(GdkDragContext*, const WebCore::IntPoint&amp; position, unsigned time);
+    void dragLeave(GdkDragContext*);
+    bool drop(GdkDragContext*, const WebCore::IntPoint&amp; position, unsigned time);
+
+private:
+    struct DroppingContext {
+        DroppingContext(GdkDragContext*, const WebCore::IntPoint&amp; position);
+
+        GdkDragContext* gdkContext;
+        RefPtr&lt;WebCore::DataObjectGtk&gt; dataObject;
+        WebCore::IntPoint lastMotionPosition;
+        unsigned pendingDataRequests;
+        bool dropHappened;
+    };
+
+    WebCore::DataObjectGtk* dataObjectForDropData(GdkDragContext*, GtkSelectionData*, unsigned info, WebCore::IntPoint&amp; position);
+    WebCore::DataObjectGtk* requestDragData(GdkDragContext*, const WebCore::IntPoint&amp; position, unsigned time);
+
+    WebPageProxy&amp; m_page;
+    WebCore::DragIcon m_dragIcon;
+    HashMap&lt;GdkDragContext*, std::unique_ptr&lt;DroppingContext&gt;&gt; m_droppingContexts;
+    HashMap&lt;GdkDragContext*, RefPtr&lt;WebCore::DataObjectGtk&gt;&gt; m_draggingDataObjects;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DRAG_SUPPORT)
+
+#endif // DragAndDropHandler_h
</ins></span></pre>
</div>
</div>

</body>
</html>