Title: [211597] trunk/Source
Revision
211597
Author
wenson_hs...@apple.com
Date
2017-02-02 15:03:38 -0800 (Thu, 02 Feb 2017)

Log Message

Drag images should be anchored to the mouse location
https://bugs.webkit.org/show_bug.cgi?id=167690
<rdar://problem/30295261>

Reviewed by Enrica Casucci.

Source/WebCore:

Adds logic to compute the mouse anchor point. This is a point in the unit square indicating where the drag
origin is relative to the bounds of the drag image. There is no behavior change, since this anchor point is not
used by any client yet; this patch only computes and vends this information from WebCore.

* loader/EmptyClients.cpp:
* page/DragClient.h:
* page/DragController.cpp:
(WebCore::DragController::startDrag):
(WebCore::DragController::doImageDrag):
(WebCore::DragController::doSystemDrag):
* page/DragController.h:
* platform/DragImage.h:

Source/WebKit/mac:

Adds some plumbing for the anchor point in the WK1 client layer.

* WebCoreSupport/WebDragClient.h:
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::startDrag):

Source/WebKit/win:

Adds some plumbing for the anchor point in the WK1 client layer.

* WebCoreSupport/WebDragClient.cpp:
(WebDragClient::startDrag):
* WebCoreSupport/WebDragClient.h:

Source/WebKit2:

Adds some plumbing for the mouse anchor point in the UI process. Additionally, refactors some unrelated code
for handling data interaction.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::startDataInteractionWithImage):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::startDataInteractionWithImage):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setDragImage):
* WebProcess/WebCoreSupport/WebDragClient.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::startDrag):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211596 => 211597)


--- trunk/Source/WebCore/ChangeLog	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/ChangeLog	2017-02-02 23:03:38 UTC (rev 211597)
@@ -1,3 +1,24 @@
+2017-02-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Drag images should be anchored to the mouse location
+        https://bugs.webkit.org/show_bug.cgi?id=167690
+        <rdar://problem/30295261>
+
+        Reviewed by Enrica Casucci.
+
+        Adds logic to compute the mouse anchor point. This is a point in the unit square indicating where the drag
+        origin is relative to the bounds of the drag image. There is no behavior change, since this anchor point is not
+        used by any client yet; this patch only computes and vends this information from WebCore.
+
+        * loader/EmptyClients.cpp:
+        * page/DragClient.h:
+        * page/DragController.cpp:
+        (WebCore::DragController::startDrag):
+        (WebCore::DragController::doImageDrag):
+        (WebCore::DragController::doSystemDrag):
+        * page/DragController.h:
+        * platform/DragImage.h:
+
 2017-02-02  Eric Carlson  <eric.carl...@apple.com>
 
         [Mac] Add classes to manage audio samples

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (211596 => 211597)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2017-02-02 23:03:38 UTC (rev 211597)
@@ -130,7 +130,7 @@
     void willPerformDragSourceAction(DragSourceAction, const IntPoint&, DataTransfer&) final { }
     DragDestinationAction actionMaskForDrag(const DragData&) final { return DragDestinationActionNone; }
     DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) final { return DragSourceActionNone; }
-    void startDrag(DragImageRef, const IntPoint&, const IntPoint&, DataTransfer&, Frame&, bool) final { }
+    void startDrag(DragImageRef, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, bool) final { }
     void dragControllerDestroyed() final { }
 };
 

Modified: trunk/Source/WebCore/page/DragClient.h (211596 => 211597)


--- trunk/Source/WebCore/page/DragClient.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/page/DragClient.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -27,6 +27,7 @@
 
 #include "DragActions.h"
 #include "DragImage.h"
+#include "FloatPoint.h"
 #include "IntPoint.h"
 
 namespace WebCore {
@@ -46,7 +47,7 @@
     virtual DragDestinationAction actionMaskForDrag(const DragData&) = 0;
     virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint& rootViewPoint) = 0;
     
-    virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, DataTransfer&, Frame&, bool linkDrag = false) = 0;
+    virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, const FloatPoint& dragImageAnchor, DataTransfer&, Frame&, bool linkDrag = false) = 0;
     virtual void dragEnded() { }
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebCore/page/DragController.cpp (211596 => 211597)


--- trunk/Source/WebCore/page/DragController.cpp	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/page/DragController.cpp	2017-02-02 23:03:38 UTC (rev 211597)
@@ -32,6 +32,7 @@
 #if ENABLE(DRAG_SUPPORT)
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
+#include "ClientRect.h"
 #include "DataTransfer.h"
 #include "Document.h"
 #include "DocumentFragment.h"
@@ -76,6 +77,11 @@
 #include "TextEvent.h"
 #include "htmlediting.h"
 #include "markup.h"
+
+#if ENABLE(DATA_INTERACTION)
+#include "SelectionRect.h"
+#endif
+
 #include <wtf/CurrentTime.h>
 #include <wtf/RefPtr.h>
 #endif
@@ -810,6 +816,7 @@
     ASSERT(state.source);
     Element& element = *state.source;
 
+    IntRect dragImageBounds;
     Image* image = getImage(element);
     if (state.type == DragSourceActionSelection) {
         if (!dataTransfer.pasteboard().hasData()) {
@@ -818,6 +825,14 @@
             RefPtr<Range> selectionRange = src.selection().toNormalizedRange();
             ASSERT(selectionRange);
 
+#if ENABLE(DATA_INTERACTION)
+            Vector<SelectionRect> selectionRects;
+            selectionRange->collectSelectionRects(selectionRects);
+            for (auto selectionRect : selectionRects)
+                dragImageBounds.unite(selectionRect.rect());
+            dragImageBounds.inflate(SelectionDragImagePadding);
+#endif
+
             src.editor().willWriteSelectionToPasteboard(selectionRange.get());
 
             if (enclosingTextFormControl(src.selection().selection().start()))
@@ -843,7 +858,7 @@
         if (!dragImage)
             return false;
 
-        doSystemDrag(dragImage, dragLoc, dragOrigin, dataTransfer, src, false);
+        doSystemDrag(dragImage, dragLoc, dragOrigin, dragImageBounds, dataTransfer, src, false);
     } else if (!src.document()->securityOrigin().canDisplay(linkURL)) {
         src.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to drag local resource: " + linkURL.stringCenterEllipsizedToLength());
         startedDrag = false;
@@ -866,7 +881,7 @@
             doImageDrag(element, dragOrigin, hitTestResult.imageRect(), dataTransfer, src, m_dragOffset);
         } else {
             // DHTML defined drag image
-            doSystemDrag(dragImage, dragLoc, dragOrigin, dataTransfer, src, false);
+            doSystemDrag(dragImage, dragLoc, dragOrigin, { }, dataTransfer, src, false);
         }
     } else if (!linkURL.isEmpty() && (m_dragSourceAction & DragSourceActionLink)) {
         if (!dataTransfer.pasteboard().hasData()) {
@@ -902,7 +917,7 @@
             // Later code expects the drag image to be scaled by device's scale factor.
             dragImage = scaleDragImage(dragImage, FloatSize(m_page.deviceScaleFactor(), m_page.deviceScaleFactor()));
         }
-        doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, dataTransfer, src, true);
+        doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, { }, dataTransfer, src, true);
 #if ENABLE(ATTACHMENT_ELEMENT)
     } else if (!attachmentURL.isEmpty() && (m_dragSourceAction & DragSourceActionAttachment)) {
         if (!dataTransfer.pasteboard().hasData()) {
@@ -918,13 +933,13 @@
             dragLoc = dragLocForSelectionDrag(src);
             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
         }
-        doSystemDrag(dragImage, dragLoc, dragOrigin, dataTransfer, src, false);
+        doSystemDrag(dragImage, dragLoc, dragOrigin, { }, dataTransfer, src, false);
 #endif
     } else if (state.type == DragSourceActionDHTML) {
         if (dragImage) {
             ASSERT(m_dragSourceAction & DragSourceActionDHTML);
             m_client.willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, dataTransfer);
-            doSystemDrag(dragImage, dragLoc, dragOrigin, dataTransfer, src, false);
+            doSystemDrag(dragImage, dragLoc, dragOrigin, { }, dataTransfer, src, false);
         } else
             startedDrag = false;
     } else {
@@ -981,20 +996,25 @@
         return;
 
     dragImageOffset = mouseDownPoint + scaledOrigin;
-    doSystemDrag(dragImage, dragImageOffset, dragOrigin, dataTransfer, frame, false);
+    doSystemDrag(dragImage, dragImageOffset, dragOrigin, element.boundsInRootViewSpace(), dataTransfer, frame, false);
 
     deleteDragImage(dragImage);
 }
 
-void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, const IntPoint& eventPos, DataTransfer& dataTransfer, Frame& frame, bool forLink)
+void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, const IntPoint& eventPos, const IntRect& dragImageBounds, DataTransfer& dataTransfer, Frame& frame, bool forLink)
 {
+    FloatPoint dragImageAnchor = { 0.5, 0.5 };
+    if (!dragImageBounds.isEmpty()) {
+        dragImageAnchor.setX((eventPos.x() - dragImageBounds.x()) / (float)dragImageBounds.width());
+        dragImageAnchor.setY((eventPos.y() - dragImageBounds.y()) / (float)dragImageBounds.height());
+    }
+
     m_didInitiateDrag = true;
     m_dragInitiator = frame.document();
     // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame
     Ref<MainFrame> frameProtector(m_page.mainFrame());
     RefPtr<FrameView> viewProtector = frameProtector->view();
-    m_client.startDrag(image, viewProtector->rootViewToContents(frame.view()->contentsToRootView(dragLoc)),
-        viewProtector->rootViewToContents(frame.view()->contentsToRootView(eventPos)), dataTransfer, frameProtector.get(), forLink);
+    m_client.startDrag(image, viewProtector->rootViewToContents(frame.view()->contentsToRootView(dragLoc)), viewProtector->rootViewToContents(frame.view()->contentsToRootView(eventPos)), dragImageAnchor, dataTransfer, frameProtector.get(), forLink);
     // DragClient::startDrag can cause our Page to dispear, deallocating |this|.
     if (!frameProtector->page())
         return;

Modified: trunk/Source/WebCore/page/DragController.h (211596 => 211597)


--- trunk/Source/WebCore/page/DragController.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/page/DragController.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -28,6 +28,7 @@
 #include "DragActions.h"
 #include "DragImage.h"
 #include "IntPoint.h"
+#include "IntRect.h"
 #include "URL.h"
 
 namespace WebCore {
@@ -111,7 +112,7 @@
         void mouseMovedIntoDocument(Document*);
 
         void doImageDrag(Element&, const IntPoint&, const IntRect&, DataTransfer&, Frame&, IntPoint&);
-        void doSystemDrag(DragImageRef, const IntPoint&, const IntPoint&, DataTransfer&, Frame&, bool forLink);
+        void doSystemDrag(DragImageRef, const IntPoint&, const IntPoint&, const IntRect& dragImageBounds, DataTransfer&, Frame&, bool forLink);
         void cleanupAfterSystemDrag();
         void declareAndWriteDragImage(DataTransfer&, Element&, const URL&, const String& label);
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebCore/platform/DragImage.h (211596 => 211597)


--- trunk/Source/WebCore/platform/DragImage.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebCore/platform/DragImage.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -67,6 +67,10 @@
 typedef void* DragImageRef;
 #endif
 
+#if PLATFORM(COCOA)
+static const float SelectionDragImagePadding = 15;
+#endif
+
 IntSize dragImageSize(DragImageRef);
 
 // These functions should be memory neutral, eg. if they return a newly allocated image,

Modified: trunk/Source/WebKit/mac/ChangeLog (211596 => 211597)


--- trunk/Source/WebKit/mac/ChangeLog	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-02-02 23:03:38 UTC (rev 211597)
@@ -1,3 +1,17 @@
+2017-02-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Drag images should be anchored to the mouse location
+        https://bugs.webkit.org/show_bug.cgi?id=167690
+        <rdar://problem/30295261>
+
+        Reviewed by Enrica Casucci.
+
+        Adds some plumbing for the anchor point in the WK1 client layer.
+
+        * WebCoreSupport/WebDragClient.h:
+        * WebCoreSupport/WebDragClient.mm:
+        (WebDragClient::startDrag):
+
 2017-02-02  Chris Dumez  <cdu...@apple.com>
 
         Rename Node::inDocument() to isConnected()

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h (211596 => 211597)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -37,7 +37,7 @@
     WebCore::DragDestinationAction actionMaskForDrag(const WebCore::DragData&) override;
     void dragControllerDestroyed() override;
     WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) override;
-    void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag) override;
+    void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, const WebCore::FloatPoint&, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag) override;
     void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) override;
 #if ENABLE(ATTACHMENT_ELEMENT)
     void declareAndWriteAttachment(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String& path, WebCore::Frame*) override;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm (211596 => 211597)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm	2017-02-02 23:03:38 UTC (rev 211597)
@@ -95,7 +95,7 @@
     [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:[NSPasteboard pasteboardWithName:dataTransfer.pasteboard().name()]];
 }
 
-void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, DataTransfer& dataTransfer, Frame& frame, bool linkDrag)
+void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, bool linkDrag)
 {
     RetainPtr<WebHTMLView> htmlView = (WebHTMLView*)[[kit(&frame) frameView] documentView];
     if (![htmlView.get() isKindOfClass:[WebHTMLView class]])
@@ -165,7 +165,7 @@
 {
 }
 
-void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, DataTransfer&, Frame&, bool)
+void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, bool)
 {
 }
 

Modified: trunk/Source/WebKit/win/ChangeLog (211596 => 211597)


--- trunk/Source/WebKit/win/ChangeLog	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/win/ChangeLog	2017-02-02 23:03:38 UTC (rev 211597)
@@ -1,3 +1,17 @@
+2017-02-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Drag images should be anchored to the mouse location
+        https://bugs.webkit.org/show_bug.cgi?id=167690
+        <rdar://problem/30295261>
+
+        Reviewed by Enrica Casucci.
+
+        Adds some plumbing for the anchor point in the WK1 client layer.
+
+        * WebCoreSupport/WebDragClient.cpp:
+        (WebDragClient::startDrag):
+        * WebCoreSupport/WebDragClient.h:
+
 2017-02-02  Per Arne Vollan  <pvol...@apple.com>
 
         [Win][HiDPI] Scale factor is applied twice in accelerated compositing mode.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp (211596 => 211597)


--- trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp	2017-02-02 23:03:38 UTC (rev 211597)
@@ -110,7 +110,7 @@
         const_cast<Pasteboard&>(dataTransfer.pasteboard()).setExternalDataObject(newDataObject.get());
 }
 
-void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, DataTransfer& dataTransfer, Frame& frame, bool isLink)
+void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, bool isLink)
 {
     //FIXME: Allow UIDelegate to override behaviour <rdar://problem/5015953>
 

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.h (211596 => 211597)


--- trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -39,7 +39,7 @@
     virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
     virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, const WebCore::DragData&);
     virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::DataTransfer&);
-    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, WebCore::DataTransfer&, WebCore::Frame&, bool);
+    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, const WebCore::FloatPoint&, WebCore::DataTransfer&, WebCore::Frame&, bool);
 
 private:
     WebView* m_webView;

Modified: trunk/Source/WebKit2/ChangeLog (211596 => 211597)


--- trunk/Source/WebKit2/ChangeLog	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-02 23:03:38 UTC (rev 211597)
@@ -1,3 +1,32 @@
+2017-02-02  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Drag images should be anchored to the mouse location
+        https://bugs.webkit.org/show_bug.cgi?id=167690
+        <rdar://problem/30295261>
+
+        Reviewed by Enrica Casucci.
+
+        Adds some plumbing for the mouse anchor point in the UI process. Additionally, refactors some unrelated code
+        for handling data interaction.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::startDataInteractionWithImage):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::startDataInteractionWithImage):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setDragImage):
+        * WebProcess/WebCoreSupport/WebDragClient.cpp:
+        (WebKit::WebDragClient::startDrag):
+        * WebProcess/WebCoreSupport/WebDragClient.h:
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::WebDragClient::startDrag):
+
 2017-02-02  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r211571 and r211582.

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -383,7 +383,7 @@
 
 #if ENABLE(DATA_INTERACTION)
     virtual void didPerformDataInteractionControllerOperation() = 0;
-    virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, bool isLink) = 0;
+    virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) = 0;
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -835,7 +835,7 @@
     void didPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted);
     void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
 #if PLATFORM(COCOA)
-    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag);
+    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const WebCore::FloatPoint& dragImageAnchor, bool isLinkDrag);
     void setPromisedDataForImage(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
                          const String& title, const String& url, const String& visibleURL, const SharedMemory::Handle& archiveHandle, uint64_t archiveSize);
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-02-02 23:03:38 UTC (rev 211597)
@@ -307,7 +307,7 @@
     DidPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted)
 #endif
 #if PLATFORM(COCOA) && ENABLE(DRAG_SUPPORT)
-    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag)
+    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, WebCore::FloatPoint dragImageAnchor, bool linkDrag)
     SetPromisedDataForImage(String pasteboardName, WebKit::SharedMemory::Handle imageHandle, uint64_t imageSize, String filename, String extension, String title, String url, String visibleURL, WebKit::SharedMemory::Handle archiveHandle, uint64_t archiveSize)
 #if ENABLE(ATTACHMENT_ELEMENT)
     SetPromisedDataForAttachment(String pasteboardName, String filename, String extension, String title, String url, String visibleURL)

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -203,7 +203,7 @@
 
 #if ENABLE(DATA_INTERACTION)
     void didPerformDataInteractionControllerOperation() override;
-    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, bool isLink) override;
+    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) override;
 #endif
 
     WKContentView *m_contentView;

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-02 23:03:38 UTC (rev 211597)
@@ -768,9 +768,9 @@
     [m_contentView _didPerformDataInteractionControllerOperation];
 }
 
-void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, bool isLink)
+void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, const FloatPoint& anchorPoint, bool isLink)
 {
-    [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) isLink:isLink];
+    [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) anchorPoint:anchorPoint isLink:isLink];
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -252,7 +252,7 @@
 
 #if ENABLE(DATA_INTERACTION)
 - (void)_didPerformDataInteractionControllerOperation;
-- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image atClientPosition:(CGPoint)clientPosition isLink:(BOOL)isLink;
+- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint isLink:(BOOL)isLink;
 #endif
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -234,7 +234,7 @@
 
 #if ENABLE(DATA_INTERACTION)
     void didPerformDataInteractionControllerOperation() override;
-    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, bool isLink) override;
+    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) override;
 #endif
 
     NSView *m_view;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-02 23:03:38 UTC (rev 211597)
@@ -881,7 +881,7 @@
     // FIXME: Implement me.
 }
 
-void PageClientImpl::startDataInteractionWithImage(const IntPoint&, const ShareableBitmap::Handle&, bool)
+void PageClientImpl::startDataInteractionWithImage(const IntPoint&, const ShareableBitmap::Handle&, const FloatPoint&, bool)
 {
     // FIXME: Implement me.
 }

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (211596 => 211597)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-02 23:03:38 UTC (rev 211597)
@@ -269,7 +269,7 @@
 #endif
 
 #if ENABLE(DRAG_SUPPORT)
-void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag)
+void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const FloatPoint&, bool isLinkDrag)
 {
     if (auto dragImage = ShareableBitmap::create(dragImageHandle))
         m_pageClient.setDragImage(clientPosition, WTFMove(dragImage), isLinkDrag);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp (211596 => 211597)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp	2017-02-02 23:03:38 UTC (rev 211597)
@@ -57,7 +57,7 @@
 }
 
 #if !PLATFORM(COCOA) && !PLATFORM(GTK)
-void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, DataTransfer&, Frame&, bool)
+void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, bool)
 {
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h (211596 => 211597)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h	2017-02-02 23:03:38 UTC (rev 211597)
@@ -47,7 +47,7 @@
     WebCore::DragDestinationAction actionMaskForDrag(const WebCore::DragData&) override;
     WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) override;
 
-    void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag = false) override;
+    void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, const WebCore::FloatPoint& dragImageAnchor, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag = false) override;
 
 #if PLATFORM(COCOA)
     void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) override;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp (211596 => 211597)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2017-02-02 23:03:38 UTC (rev 211597)
@@ -56,7 +56,7 @@
     return bitmap;
 }
 
-void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, DataTransfer& dataTransfer, Frame&, bool)
+void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, const FloatPoint&, DataTransfer& dataTransfer, Frame&, bool)
 {
     RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage);
     ShareableBitmap::Handle handle;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (211596 => 211597)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2017-02-02 23:01:54 UTC (rev 211596)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2017-02-02 23:03:38 UTC (rev 211597)
@@ -80,7 +80,7 @@
     return WTFMove(bitmap);
 }
 
-void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, DataTransfer&, Frame& frame, bool linkDrag)
+void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, const FloatPoint&, DataTransfer&, Frame& frame, bool linkDrag)
 {
     IntSize bitmapSize([image size]);
     RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get(), bitmapSize, frame);
@@ -91,7 +91,7 @@
     m_page->willStartDrag();
 
     // FIXME: Seems this message should be named StartDrag, not SetDragImage.
-    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, linkDrag));
+    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, { }, linkDrag));
 }
 
 static WebCore::CachedImage* cachedImage(Element& element)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to