diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp index 697dd8fe6..0398dca2e 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp @@ -32,8 +32,8 @@ #include "ShareableBitmap.h" #include "WebPage.h" #include "WebPageProxyMessages.h" -#include <WebCore/Clipboard.h> -#include <WebCore/DataObjectGtk.h> +#include "WebSelectionData.h" +#include <WebCore/DataTransfer.h> #include <WebCore/DragData.h> #include <WebCore/GraphicsContext.h> #include <WebCore/Pasteboard.h> @@ -43,31 +43,32 @@ using namespace WebCore; namespace WebKit { -static PassRefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface) +static RefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface) { if (!surface) - return 0; + return nullptr; IntSize imageSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface)); RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, ShareableBitmap::SupportsAlpha); auto graphicsContext = bitmap->createGraphicsContext(); - graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), graphicsContext.get()); - return bitmap.release(); + graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), *graphicsContext); + return bitmap; } -void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, Clipboard& clipboard, Frame&, bool) +void WebDragClient::startDrag(DragImage dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, const FloatPoint&, DataTransfer& dataTransfer, Frame&, DragSourceAction) { - RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage); + RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage.get().get()); ShareableBitmap::Handle handle; // If we have a bitmap, but cannot create a handle to it, we fail early. if (bitmap && !bitmap->createHandle(handle)) return; - RefPtr<DataObjectGtk> dataObject = clipboard.pasteboard().dataObject(); - DragData dragData(dataObject.get(), clientPosition, globalPosition, clipboard.sourceOperation()); - m_page->send(Messages::WebPageProxy::StartDrag(dragData, handle)); + m_page->willStartDrag(); + + WebSelectionData selection(dataTransfer.pasteboard().selectionData()); + m_page->send(Messages::WebPageProxy::StartDrag(selection, dataTransfer.sourceOperation(), handle)); } }; // namespace WebKit. |