Diff
Modified: trunk/Source/WebCore/ChangeLog (212378 => 212379)
--- trunk/Source/WebCore/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebCore/ChangeLog 2017-02-15 18:31:00 UTC (rev 212379)
@@ -1,3 +1,21 @@
+2017-02-15 Anders Carlsson <ander...@apple.com>
+
+ Modernize DragClient::startDrag somewhat
+ https://bugs.webkit.org/show_bug.cgi?id=168379
+
+ Reviewed by Tim Horton.
+
+ Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
+ instead of whether it's a link or not.
+
+ * loader/EmptyClients.cpp:
+ * page/DragClient.h:
+ * page/DragController.cpp:
+ (WebCore::DragController::startDrag):
+ (WebCore::DragController::doImageDrag):
+ (WebCore::DragController::doSystemDrag):
+ * page/DragController.h:
+
2017-02-15 Chris Dumez <cdu...@apple.com>
Expose Symbol.toPrimitive / valueOf on Location instances
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (212378 => 212379)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2017-02-15 18:31:00 UTC (rev 212379)
@@ -131,7 +131,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&, const FloatPoint&, DataTransfer&, Frame&, bool) final { }
+ void startDrag(DragImage, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, DragSourceAction) final { }
void dragControllerDestroyed() final { }
};
Modified: trunk/Source/WebCore/page/DragClient.h (212378 => 212379)
--- trunk/Source/WebCore/page/DragClient.h 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebCore/page/DragClient.h 2017-02-15 18:31:00 UTC (rev 212379)
@@ -47,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, const FloatPoint& dragImageAnchor, DataTransfer&, Frame&, bool linkDrag = false) = 0;
+ virtual void startDrag(DragImage, const IntPoint& dragImageOrigin, const IntPoint& eventPos, const FloatPoint& dragImageAnchor, DataTransfer&, Frame&, DragSourceAction) = 0;
virtual void dragEnded() { }
#if PLATFORM(COCOA)
Modified: trunk/Source/WebCore/page/DragController.cpp (212378 => 212379)
--- trunk/Source/WebCore/page/DragController.cpp 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-02-15 18:31:00 UTC (rev 212379)
@@ -857,7 +857,7 @@
if (!dragImage)
return false;
- doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, dragImageBounds, dataTransfer, src, false);
+ doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, dragImageBounds, dataTransfer, src, DragSourceActionSelection);
return true;
}
@@ -885,8 +885,9 @@
doImageDrag(element, dragOrigin, hitTestResult.imageRect(), dataTransfer, src, m_dragOffset);
} else {
// DHTML defined drag image
- doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, false);
+ doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionImage);
}
+
return true;
}
@@ -923,7 +924,7 @@
dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDraggedPoint.y() + m_dragOffset.y());
dragImage = DragImage { platformAdjustDragImageForDeviceScaleFactor(dragImage.get(), m_page.deviceScaleFactor()) };
}
- doSystemDrag(WTFMove(dragImage), dragLoc, mouseDraggedPoint, { }, dataTransfer, src, true);
+ doSystemDrag(WTFMove(dragImage), dragLoc, mouseDraggedPoint, { }, dataTransfer, src, DragSourceActionLink);
return true;
}
@@ -943,7 +944,7 @@
dragLoc = dragLocForSelectionDrag(src);
m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
}
- doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, false);
+ doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionAttachment);
return true;
}
#endif
@@ -951,7 +952,7 @@
if (state.type == DragSourceActionDHTML && dragImage) {
ASSERT(m_dragSourceAction & DragSourceActionDHTML);
m_client.willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, dataTransfer);
- doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, false);
+ doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionDHTML);
return true;
}
@@ -1001,10 +1002,10 @@
return;
dragImageOffset = mouseDownPoint + scaledOrigin;
- doSystemDrag(WTFMove(dragImage), dragImageOffset, dragOrigin, element.boundsInRootViewSpace(), dataTransfer, frame, false);
+ doSystemDrag(WTFMove(dragImage), dragImageOffset, dragOrigin, element.boundsInRootViewSpace(), dataTransfer, frame, DragSourceActionImage);
}
-void DragController::doSystemDrag(DragImage image, const IntPoint& dragLoc, const IntPoint& eventPos, const IntRect& dragImageBounds, DataTransfer& dataTransfer, Frame& frame, bool forLink)
+void DragController::doSystemDrag(DragImage image, const IntPoint& dragLoc, const IntPoint& eventPos, const IntRect& dragImageBounds, DataTransfer& dataTransfer, Frame& frame, DragSourceAction dragSourceAction)
{
FloatPoint dragImageAnchor = { 0.5, 0.5 };
if (forLink)
@@ -1019,7 +1020,7 @@
// 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.get(), viewProtector->rootViewToContents(frame.view()->contentsToRootView(dragLoc)), viewProtector->rootViewToContents(frame.view()->contentsToRootView(eventPos)), dragImageAnchor, dataTransfer, frameProtector.get(), forLink);
+ m_client.startDrag(WTFMove(image), viewProtector->rootViewToContents(frame.view()->contentsToRootView(dragLoc)), viewProtector->rootViewToContents(frame.view()->contentsToRootView(eventPos)), dragImageAnchor, dataTransfer, frameProtector.get(), dragSourceAction);
// DragClient::startDrag can cause our Page to dispear, deallocating |this|.
if (!frameProtector->page())
return;
Modified: trunk/Source/WebCore/page/DragController.h (212378 => 212379)
--- trunk/Source/WebCore/page/DragController.h 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebCore/page/DragController.h 2017-02-15 18:31:00 UTC (rev 212379)
@@ -112,7 +112,7 @@
void mouseMovedIntoDocument(Document*);
void doImageDrag(Element&, const IntPoint&, const IntRect&, DataTransfer&, Frame&, IntPoint&);
- void doSystemDrag(DragImage, const IntPoint&, const IntPoint&, const IntRect& dragImageBounds, DataTransfer&, Frame&, bool forLink);
+ void doSystemDrag(DragImage, const IntPoint&, const IntPoint&, const IntRect& dragImageBounds, DataTransfer&, Frame&, DragSourceAction);
void cleanupAfterSystemDrag();
void declareAndWriteDragImage(DataTransfer&, Element&, const URL&, const String& label);
#if ENABLE(ATTACHMENT_ELEMENT)
Modified: trunk/Source/WebKit/mac/ChangeLog (212378 => 212379)
--- trunk/Source/WebKit/mac/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-02-15 18:31:00 UTC (rev 212379)
@@ -1,3 +1,16 @@
+2017-02-15 Anders Carlsson <ander...@apple.com>
+
+ Modernize DragClient::startDrag somewhat
+ https://bugs.webkit.org/show_bug.cgi?id=168379
+
+ Reviewed by Tim Horton.
+
+ Update for WebCore changes.
+
+ * WebCoreSupport/WebDragClient.h:
+ * WebCoreSupport/WebDragClient.mm:
+ (WebDragClient::startDrag):
+
2017-02-14 Dean Jackson <d...@apple.com>
Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h (212378 => 212379)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h 2017-02-15 18:31:00 UTC (rev 212379)
@@ -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, const WebCore::FloatPoint&, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag) override;
+ void startDrag(WebCore::DragImage, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, const WebCore::FloatPoint&, WebCore::DataTransfer&, WebCore::Frame&, WebCore::DragSourceAction) 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 (212378 => 212379)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm 2017-02-15 18:31:00 UTC (rev 212379)
@@ -95,13 +95,13 @@
[[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, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, bool linkDrag)
+void WebDragClient::startDrag(DragImage dragImage, const IntPoint& at, const IntPoint& eventPos, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, DragSourceAction dragSourceAction)
{
RetainPtr<WebHTMLView> htmlView = (WebHTMLView*)[[kit(&frame) frameView] documentView];
if (![htmlView.get() isKindOfClass:[WebHTMLView class]])
return;
- NSEvent *event = linkDrag ? frame.eventHandler().currentNSEvent() : [htmlView.get() _mouseDownEvent];
+ NSEvent *event = dragSourceAction == DragSourceActionLink ? frame.eventHandler().currentNSEvent() : [htmlView.get() _mouseDownEvent];
WebHTMLView* topHTMLView = getTopHTMLView(&frame);
RetainPtr<WebHTMLView> topViewProtector = topHTMLView;
@@ -108,7 +108,7 @@
[topHTMLView _stopAutoscrollTimer];
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:dataTransfer.pasteboard().name()];
- NSImage *dragNSImage = dragImage.get();
+ NSImage *dragNSImage = dragImage.get().get();
WebHTMLView *sourceHTMLView = htmlView.get();
IntSize size([dragNSImage size]);
Modified: trunk/Source/WebKit/win/ChangeLog (212378 => 212379)
--- trunk/Source/WebKit/win/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit/win/ChangeLog 2017-02-15 18:31:00 UTC (rev 212379)
@@ -1,3 +1,15 @@
+2017-02-15 Anders Carlsson <ander...@apple.com>
+
+ Modernize DragClient::startDrag somewhat
+ https://bugs.webkit.org/show_bug.cgi?id=168379
+
+ Reviewed by Tim Horton.
+
+ Update for WebCore changes.
+
+ * WebCoreSupport/WebDragClient.cpp:
+ (WebDragClient::startDrag):
+
2017-02-10 Daniel Bates <daba...@apple.com>
Attempt to fix the WinCairo 64-Bit Release build following <https://trac.webkit.org/changeset/212173>
Modified: trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp (212378 => 212379)
--- trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp 2017-02-15 18:31:00 UTC (rev 212379)
@@ -110,7 +110,7 @@
const_cast<Pasteboard&>(dataTransfer.pasteboard()).setExternalDataObject(newDataObject.get());
}
-void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, bool isLink)
+void WebDragClient::startDrag(DragImage image, const IntPoint& imageOrigin, const IntPoint& dragPoint, const FloatPoint&, DataTransfer& dataTransfer, Frame& frame, DragSourceAction dragSourceAction)
{
//FIXME: Allow UIDelegate to override behaviour <rdar://problem/5015953>
@@ -129,7 +129,7 @@
if(SUCCEEDED(CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
IID_IDragSourceHelper,(LPVOID*)&helper))) {
BITMAP b;
- GetObject(image, sizeof(BITMAP), &b);
+ GetObject(image.get(), sizeof(BITMAP), &b);
SHDRAGIMAGE sdi;
sdi.sizeDragImage.cx = b.bmWidth;
sdi.sizeDragImage.cy = b.bmHeight;
@@ -137,7 +137,7 @@
sdi.hbmpDragImage = image;
sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
- if (isLink)
+ if (dragSourceAction == DragSourceActionLink)
sdi.ptOffset.y = b.bmHeight - sdi.ptOffset.y;
helper->InitializeFromBitmap(&sdi, dataObject.get());
Modified: trunk/Source/WebKit2/ChangeLog (212378 => 212379)
--- trunk/Source/WebKit2/ChangeLog 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit2/ChangeLog 2017-02-15 18:31:00 UTC (rev 212379)
@@ -1,3 +1,18 @@
+2017-02-15 Anders Carlsson <ander...@apple.com>
+
+ Modernize DragClient::startDrag somewhat
+ https://bugs.webkit.org/show_bug.cgi?id=168379
+
+ Reviewed by Tim Horton.
+
+ Update for WebCore changes.
+
+ * WebProcess/WebCoreSupport/WebDragClient.cpp:
+ (WebKit::WebDragClient::startDrag):
+ * WebProcess/WebCoreSupport/WebDragClient.h:
+ * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+ (WebKit::WebDragClient::startDrag):
+
2017-02-15 Aakash Jain <aakash_j...@apple.com>
Remove WebIOSEvent interface
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp (212378 => 212379)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp 2017-02-15 18:31:00 UTC (rev 212379)
@@ -57,7 +57,7 @@
}
#if !PLATFORM(COCOA) && !PLATFORM(GTK)
-void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, bool)
+void WebDragClient::startDrag(DragImage, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, DragSourceAction)
{
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h (212378 => 212379)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h 2017-02-15 18:31:00 UTC (rev 212379)
@@ -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, const WebCore::FloatPoint& dragImageAnchor, WebCore::DataTransfer&, WebCore::Frame&, bool linkDrag = false) override;
+ void startDrag(WebCore::DragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, const WebCore::FloatPoint& dragImageAnchor, WebCore::DataTransfer&, WebCore::Frame&, WebCore::DragSourceAction) 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/mac/WebDragClientMac.mm (212378 => 212379)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2017-02-15 18:23:33 UTC (rev 212378)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2017-02-15 18:31:00 UTC (rev 212379)
@@ -82,10 +82,10 @@
return WTFMove(bitmap);
}
-void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, const FloatPoint&, DataTransfer&, Frame& frame, bool linkDrag)
+void WebDragClient::startDrag(DragImage image, const IntPoint& point, const IntPoint&, const FloatPoint&, DataTransfer&, Frame& frame, DragSourceAction dragSourceAction)
{
- IntSize bitmapSize([image size]);
- RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get(), bitmapSize, frame);
+ IntSize bitmapSize([image.get() size]);
+ RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get().get(), bitmapSize, frame);
ShareableBitmap::Handle handle;
if (!bitmap || !bitmap->createHandle(handle))
return;
@@ -93,7 +93,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, { }, dragSourceAction == DragSourceActionLink));
}
static WebCore::CachedImage* cachedImage(Element& element)