[Attachment Support] Remove current macOS support for dragging file-backed attachments
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Dec 2017 19:30:40 +0000 (19:30 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Dec 2017 19:30:40 +0000 (19:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181188

Reviewed by Dan Bernstein.

Source/WebCore:

Support for dragging attachments out as files on the NSPasteboard was introduced in r181760. However, this is
(1) a macOS-specific implementation, and (2) does not support attachments whose files are backed by inline data
rather than a filepath. As part of adding further WebKit attachment element support, subsequent patches will
reimplement support for dragging attachment elements in a cross-Cocoa-platform way that also allows for either
data- or file-backed blobs to be written to the pasteboard.

No new functionality; no new tests. All existing layout and API tests still pass.

* page/DragClient.h:
(WebCore::DragClient::declareAndWriteDragImage):
(WebCore::DragClient::declareAndWriteAttachment): Deleted.
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/DragController.h:
(WebCore::DragController::draggingImageURL const):
(WebCore::DragController::draggingAttachmentURL const): Deleted.
* page/gtk/DragControllerGtk.cpp:
(WebCore::DragController::declareAndWriteAttachment): Deleted.
* page/mac/DragControllerMac.mm:
(WebCore::DragController::declareAndWriteAttachment): Deleted.
* page/win/DragControllerWin.cpp:
(WebCore::DragController::declareAndWriteAttachment): Deleted.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::absoluteAttachmentURL const): Deleted.
* rendering/HitTestResult.h:

Source/WebKit:

See WebCore/ChangeLog for more detail.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setPromisedDataForAttachment): Deleted.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setPromisedDataForAttachment): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::setPromisedDataForAttachment): Deleted.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setPromisedDataForAttachment): Deleted.
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::declareAndWriteAttachment): Deleted.

Source/WebKitLegacy/mac:

See WebCore/ChangeLog for more detail.

* WebCoreSupport/WebDragClient.h:
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::declareAndWriteAttachment): Deleted.
* WebView/WebHTMLView.mm:
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226312 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/DragClient.h
Source/WebCore/page/DragController.cpp
Source/WebCore/page/DragController.h
Source/WebCore/page/gtk/DragControllerGtk.cpp
Source/WebCore/page/mac/DragControllerMac.mm
Source/WebCore/page/win/DragControllerWin.cpp
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/HitTestResult.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/mac/PageClientImplMac.h
Source/WebKit/UIProcess/mac/PageClientImplMac.mm
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h
Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm

index d8bf5f0..31fb5d7 100644 (file)
@@ -1,3 +1,36 @@
+2017-12-30  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove current macOS support for dragging file-backed attachments
+        https://bugs.webkit.org/show_bug.cgi?id=181188
+
+        Reviewed by Dan Bernstein.
+
+        Support for dragging attachments out as files on the NSPasteboard was introduced in r181760. However, this is
+        (1) a macOS-specific implementation, and (2) does not support attachments whose files are backed by inline data
+        rather than a filepath. As part of adding further WebKit attachment element support, subsequent patches will
+        reimplement support for dragging attachment elements in a cross-Cocoa-platform way that also allows for either
+        data- or file-backed blobs to be written to the pasteboard.
+
+        No new functionality; no new tests. All existing layout and API tests still pass.
+
+        * page/DragClient.h:
+        (WebCore::DragClient::declareAndWriteDragImage):
+        (WebCore::DragClient::declareAndWriteAttachment): Deleted.
+        * page/DragController.cpp:
+        (WebCore::DragController::startDrag):
+        * page/DragController.h:
+        (WebCore::DragController::draggingImageURL const):
+        (WebCore::DragController::draggingAttachmentURL const): Deleted.
+        * page/gtk/DragControllerGtk.cpp:
+        (WebCore::DragController::declareAndWriteAttachment): Deleted.
+        * page/mac/DragControllerMac.mm:
+        (WebCore::DragController::declareAndWriteAttachment): Deleted.
+        * page/win/DragControllerWin.cpp:
+        (WebCore::DragController::declareAndWriteAttachment): Deleted.
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::absoluteAttachmentURL const): Deleted.
+        * rendering/HitTestResult.h:
+
 2017-12-28  Zalan Bujtas  <zalan@apple.com>
 
         RenderTreeUpdater::GeneratedContent should hold a weak reference to RenderQuote.
index 9538717..7cd6253 100644 (file)
@@ -58,9 +58,6 @@ public:
     // Mac-specific helper function to allow access to web archives and NSPasteboard extras in WebKit.
     // This is not abstract as that would require another #if PLATFORM(COCOA) for the SVGImage client empty implentation.
     virtual void declareAndWriteDragImage(const String&, Element&, const URL&, const String&, Frame*) { }
-#if ENABLE(ATTACHMENT_ELEMENT)
-    virtual void declareAndWriteAttachment(const String&, Element&, const URL&, const String&, Frame*) { }
-#endif
 #endif
 
     virtual ~DragClient() = default;
index e08e417..b7e4643 100644 (file)
@@ -870,10 +870,6 @@ bool DragController::startDrag(Frame& src, const DragState& state, DragOperation
 
     URL linkURL = hitTestResult.absoluteLinkURL();
     URL imageURL = hitTestResult.absoluteImageURL();
-#if ENABLE(ATTACHMENT_ELEMENT)
-    URL attachmentURL = hitTestResult.absoluteAttachmentURL();
-    m_draggingAttachmentURL = URL();
-#endif
 
     IntPoint mouseDraggedPoint = src.view()->windowToContents(dragEvent.position());
 
@@ -1079,11 +1075,7 @@ bool DragController::startDrag(Frame& src, const DragState& state, DragOperation
         auto previousSelection = src.selection().selection();
         if (hasData == HasNonDefaultPasteboardData::No) {
             selectElement(element);
-            if (!attachmentURL.isEmpty()) {
-                // Use the attachment URL specified by the file attribute to populate the pasteboard.
-                m_draggingAttachmentURL = attachmentURL;
-                declareAndWriteAttachment(dataTransfer, element, attachmentURL);
-            } else if (src.editor().client()) {
+            if (src.editor().client()) {
 #if PLATFORM(COCOA)
                 // Otherwise, if no file URL is specified, call out to the injected bundle to populate the pasteboard with data.
                 auto& editor = src.editor();
index 05b8487..32ce338 100644 (file)
@@ -74,9 +74,6 @@ struct DragState;
         bool didInitiateDrag() const { return m_didInitiateDrag; }
         DragOperation sourceDragOperation() const { return m_sourceDragOperation; }
         const URL& draggingImageURL() const { return m_draggingImageURL; }
-#if ENABLE(ATTACHMENT_ELEMENT)
-        const URL& draggingAttachmentURL() const { return m_draggingAttachmentURL; }
-#endif
         void setDragOffset(const IntPoint& offset) { m_dragOffset = offset; }
         const IntPoint& dragOffset() const { return m_dragOffset; }
         DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
@@ -132,9 +129,6 @@ struct DragState;
 
         void cleanupAfterSystemDrag();
         void declareAndWriteDragImage(DataTransfer&, Element&, const URL&, const String& label);
-#if ENABLE(ATTACHMENT_ELEMENT)
-        void declareAndWriteAttachment(DataTransfer&, Element&, const URL&);
-#endif
         Page& m_page;
         DragClient& m_client;
 
@@ -151,9 +145,6 @@ struct DragState;
         IntPoint m_dragOffset;
         URL m_draggingImageURL;
         bool m_isPerformingDrop { false };
-#if ENABLE(ATTACHMENT_ELEMENT)
-        URL m_draggingAttachmentURL;
-#endif
     };
 
     WEBCORE_EXPORT bool isDraggableLink(const Element&);
index 9b256cb..7d052cf 100644 (file)
@@ -76,10 +76,4 @@ void DragController::declareAndWriteDragImage(DataTransfer& dataTransfer, Elemen
     frame->editor().writeImageToPasteboard(dataTransfer.pasteboard(), element, url, label);
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void DragController::declareAndWriteAttachment(DataTransfer&, Element&, const URL&)
-{
-}
-#endif
-
 }
index add8b70..5e872c4 100644 (file)
@@ -138,14 +138,6 @@ void DragController::updateSupportedTypeIdentifiersForDragHandlingMethod(DragHan
 
 #endif
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void DragController::declareAndWriteAttachment(DataTransfer& dataTransfer, Element& element, const URL& url)
-{
-    const HTMLAttachmentElement& attachment = downcast<HTMLAttachmentElement>(element);
-    m_client.declareAndWriteAttachment(dataTransfer.pasteboard().name(), element, url, attachment.file()->path(), element.document().frame());
-}
-#endif
-    
 void DragController::declareAndWriteDragImage(DataTransfer& dataTransfer, Element& element, const URL& url, const String& label)
 {
     m_client.declareAndWriteDragImage(dataTransfer.pasteboard().name(), element, url, label, element.document().frame());
index 644ecc6..42f6d6b 100644 (file)
@@ -67,12 +67,6 @@ void DragController::cleanupAfterSystemDrag()
 {
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void DragController::declareAndWriteAttachment(DataTransfer&, Element&, const URL&)
-{
-}
-#endif
-
 void DragController::declareAndWriteDragImage(DataTransfer& dataTransfer, Element& element, const URL& url, const String& label)
 {
     Pasteboard& pasteboard = dataTransfer.pasteboard();
index 4245a3c..00e1b13 100644 (file)
@@ -341,30 +341,6 @@ IntRect HitTestResult::imageRect() const
     return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBoundingBox();
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-URL HitTestResult::absoluteAttachmentURL() const
-{
-    if (!m_innerNonSharedNode)
-        return URL();
-    
-    if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isAttachment()))
-        return URL();
-    
-    if (!is<HTMLAttachmentElement>(*m_innerNonSharedNode))
-        return URL();
-    File* attachmentFile = downcast<HTMLAttachmentElement>(*m_innerNonSharedNode).file();
-    if (!attachmentFile)
-        return URL();
-    
-    auto filepath = attachmentFile->path();
-    if (!filepath.isEmpty())
-        return URL::fileURLWithFileSystemPath(filepath);
-
-    ASSERT(attachmentFile->url().protocolIsBlob());
-    return attachmentFile->url();
-}
-#endif
-
 URL HitTestResult::absoluteImageURL() const
 {
     if (!m_innerNonSharedNode)
index 04b3882..a6c7b61 100644 (file)
@@ -105,9 +105,6 @@ public:
     WEBCORE_EXPORT URL absolutePDFURL() const;
     WEBCORE_EXPORT URL absoluteMediaURL() const;
     WEBCORE_EXPORT URL absoluteLinkURL() const;
-#if ENABLE(ATTACHMENT_ELEMENT)
-    WEBCORE_EXPORT URL absoluteAttachmentURL() const;
-#endif
     WEBCORE_EXPORT String textContent() const;
     bool isOverLink() const;
     WEBCORE_EXPORT bool isContentEditable() const;
index 4e9d210..c664042 100644 (file)
@@ -1,3 +1,29 @@
+2017-12-30  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove current macOS support for dragging file-backed attachments
+        https://bugs.webkit.org/show_bug.cgi?id=181188
+
+        Reviewed by Dan Bernstein.
+
+        See WebCore/ChangeLog for more detail.
+
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::setPromisedDataForAttachment): Deleted.
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::setPromisedDataForAttachment): Deleted.
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/mac/PageClientImplMac.h:
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::setPromisedDataForAttachment): Deleted.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setPromisedDataForAttachment): Deleted.
+        * WebProcess/WebCoreSupport/WebDragClient.h:
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::WebDragClient::declareAndWriteAttachment): Deleted.
+
 2017-12-28  Brady Eidson  <beidson@apple.com>
 
         Add a ProcessIdentifier, vended from the UI process, to each child process
index 261e851..f053a81 100644 (file)
@@ -115,15 +115,6 @@ void WebPageProxy::setPromisedDataForImage(const String&, const SharedMemory::Ha
     notImplemented();
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-
-void WebPageProxy::setPromisedDataForAttachment(const String&, const String&, const String&, const String&, const String&, const String&)
-{
-    notImplemented();
-}
-
-#endif
-
 void WebPageProxy::setDragCaretRect(const IntRect& dragCaretRect)
 {
     if (m_currentDragCaretRect == dragCaretRect)
index 787ba52..a5472bb 100644 (file)
@@ -415,9 +415,6 @@ public:
     void dragImageForView(NSView *, NSImage *, CGPoint clientPoint, bool linkDrag);
     void setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *);
     void setPromisedDataForImage(WebCore::Image*, NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, WebCore::SharedBuffer* archiveBuffer, NSString *pasteboardName);
-#if ENABLE(ATTACHMENT_ELEMENT)
-    void setPromisedDataForAttachment(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSString *pasteboardName);
-#endif
     void pasteboardChangedOwner(NSPasteboard *);
     void provideDataForPasteboard(NSPasteboard *, NSString *type);
     NSArray *namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination);
index 242686b..68d6d0a 100644 (file)
@@ -3835,20 +3835,6 @@ void WebViewImpl::setPromisedDataForImage(WebCore::Image* image, NSString *filen
     m_promisedImage = image;
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebViewImpl::setPromisedDataForAttachment(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSString *pasteboardName)
-{
-    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName];
-    RetainPtr<NSMutableArray> types = adoptNS([[NSMutableArray alloc] initWithObjects:WebCore::legacyFilesPromisePasteboardType(), nil]);
-    [types addObjectsFromArray:PasteboardTypes::forURL()];
-    [pasteboard declareTypes:types.get() owner:m_view.getAutoreleased()];
-    setFileAndURLTypes(filename, extension, title, url, visibleURL, pasteboard);
-    [pasteboard setPropertyList:@[title] forType:WebCore::legacyFilenamesPasteboardType()];
-
-    m_promisedImage = nullptr;
-}
-#endif
-
 void WebViewImpl::pasteboardChangedOwner(NSPasteboard *pasteboard)
 {
     m_promisedImage = nullptr;
index 261b0db..0c509da 100644 (file)
@@ -191,9 +191,6 @@ public:
 
 #if USE(APPKIT)
     virtual void setPromisedDataForImage(const String& pasteboardName, Ref<WebCore::SharedBuffer>&& imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, RefPtr<WebCore::SharedBuffer>&& archiveBuffer) = 0;
-#if ENABLE(ATTACHMENT_ELEMENT)
-    virtual void setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl) = 0;
-#endif
 #endif
 
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
index d653e8d..9e6400b 100644 (file)
@@ -870,9 +870,6 @@ public:
     void startDrag(const WebCore::DragItem&, const ShareableBitmap::Handle& dragImageHandle);
     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)
-    void setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL);
-#endif
 #endif
 #if PLATFORM(GTK)
     void startDrag(WebSelectionData&&, uint64_t dragOperation, const ShareableBitmap::Handle& dragImage);
index 60485ae..dceede3 100644 (file)
@@ -309,9 +309,6 @@ messages -> WebPageProxy {
 #if PLATFORM(COCOA) && ENABLE(DRAG_SUPPORT)
     StartDrag(struct WebCore::DragItem dragItem, WebKit::ShareableBitmap::Handle dragImage)
     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)
-#endif
 #endif
 #if PLATFORM(GTK) && ENABLE(DRAG_SUPPORT)
     StartDrag(struct WebKit::WebSelectionData selection, uint64_t dragOperation, WebKit::ShareableBitmap::Handle dragImage)
index b31395a..5568357 100644 (file)
@@ -97,9 +97,6 @@ private:
     void setDragImage(const WebCore::IntPoint& clientPosition, Ref<ShareableBitmap>&& dragImage, WebCore::DragSourceAction) override;
     void setPromisedDataForImage(const String& pasteboardName, Ref<WebCore::SharedBuffer>&& imageBuffer, const String& filename, const String& extension, const String& title,
         const String& url, const String& visibleUrl, RefPtr<WebCore::SharedBuffer>&& archiveBuffer) override;
-#if ENABLE(ATTACHMENT_ELEMENT)
-    void setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl) override;
-#endif
     void updateSecureInputState() override;
     void resetSecureInputState() override;
     void notifyInputContextAboutDiscardedComposition() override;
index f16d90d..7f7773d 100644 (file)
@@ -364,13 +364,6 @@ void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, Ref<S
     m_impl->setPromisedDataForImage(image.get(), filename, extension, title, url, visibleURL, archiveBuffer.get(), pasteboardName);
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void PageClientImpl::setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL)
-{
-    m_impl->setPromisedDataForAttachment(filename, extension, title, url, visibleURL, pasteboardName);
-}
-#endif
-
 void PageClientImpl::updateSecureInputState()
 {
     m_impl->updateSecureInputState();
index 34c365a..20f9b42 100644 (file)
@@ -290,14 +290,6 @@ void WebPageProxy::setPromisedDataForImage(const String& pasteboardName, const S
     m_pageClient.setPromisedDataForImage(pasteboardName, WTFMove(imageBuffer), filename, extension, title, url, visibleURL, WTFMove(archiveBuffer));
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebPageProxy::setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL)
-{
-    MESSAGE_CHECK_URL(url);
-    MESSAGE_CHECK_URL(visibleURL);
-    m_pageClient.setPromisedDataForAttachment(pasteboardName, filename, extension, title, url, visibleURL);
-}
-#endif
 #endif
 
 void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
index d3ff534..9f7d7fc 100644 (file)
@@ -51,9 +51,6 @@ private:
 
 #if PLATFORM(COCOA)
     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;
-#endif
 #endif
 
     void dragControllerDestroyed() override;
index 7f29660..ac2ca4c 100644 (file)
@@ -115,19 +115,6 @@ static WebCore::CachedImage* cachedImage(Element& element)
     return image;
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebDragClient::declareAndWriteAttachment(const String& pasteboardName, Element& element, const URL& url, const String& path, WebCore::Frame* frame)
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    ASSERT(pasteboardName == String(NSDragPboard));
-#pragma clang diagnostic pop
-    
-    NSURL* nsURL = (NSURL *)url;
-    m_page->send(Messages::WebPageProxy::SetPromisedDataForAttachment(pasteboardName, String(nsURL.lastPathComponent), String(nsURL.pathExtension), path, String(nsURL.absoluteString), userVisibleString(nsURL)));
-}
-#endif
-
 void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, Element& element, const URL& url, const String& label, Frame*)
 {
 #pragma clang diagnostic push
@@ -232,15 +219,6 @@ void WebDragClient::didConcludeEditDrag()
     m_page->didConcludeEditDataInteraction();
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-
-void WebDragClient::declareAndWriteAttachment(const String&, Element&, const URL&, const String&, Frame*)
-{
-    notImplemented();
-}
-
-#endif
-
 #endif // PLATFORM(IOS)
 
 } // namespace WebKit
index 063a80a..044c74f 100644 (file)
@@ -1,3 +1,18 @@
+2017-12-30  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove current macOS support for dragging file-backed attachments
+        https://bugs.webkit.org/show_bug.cgi?id=181188
+
+        Reviewed by Dan Bernstein.
+
+        See WebCore/ChangeLog for more detail.
+
+        * WebCoreSupport/WebDragClient.h:
+        * WebCoreSupport/WebDragClient.mm:
+        (WebDragClient::declareAndWriteAttachment): Deleted.
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
+
 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, continue to fix build failures due to AppKit API deprecation
index 17bc69a..3e9a07e 100644 (file)
@@ -44,9 +44,6 @@ public:
     void beginDrag(WebCore::DragItem, WebCore::Frame&, const WebCore::IntPoint& mouseDownPosition, const WebCore::IntPoint& mouseDraggedPosition, WebCore::DataTransfer&, 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;
-#endif
     void didConcludeEditDrag() override;
 private:
     WebView* m_webView;
index 58a4cf3..f4cf380 100644 (file)
@@ -169,15 +169,6 @@ void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, Eleme
     [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&element) URL:url title:title archive:[kit(&element) webArchive] source:getTopHTMLView(frame)];
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebDragClient::declareAndWriteAttachment(const String& pasteboardName, Element& element, const URL& url, const String& path, WebCore::Frame* frame)
-{
-    ASSERT(pasteboardName);
-    
-    [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&element) URL:url title:path archive:nil source:getTopHTMLView(frame)];
-}
-#endif
-
 #elif !ENABLE(DATA_INTERACTION)
 
 bool WebDragClient::useLegacyDragClient()
@@ -214,12 +205,6 @@ void WebDragClient::declareAndWriteDragImage(const String&, Element&, const URL&
 {
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebDragClient::declareAndWriteAttachment(const String&, Element&, const URL&, const String&, WebCore::Frame*)
-{
-}
-#endif
-
 #endif
 
 #if PLATFORM(IOS)
@@ -258,12 +243,6 @@ void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, Eleme
         frame->editor().writeImageToPasteboard(*Pasteboard::createForDragAndDrop(), element, url, label);
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-void WebDragClient::declareAndWriteAttachment(const String&, Element&, const URL&, const String&, Frame*)
-{
-}
-#endif
-
 void WebDragClient::didConcludeEditDrag()
 {
     [m_webView _didConcludeEditDataInteraction];
index ca29271..2fef647 100644 (file)
@@ -4365,10 +4365,6 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension
         const URL& imageURL = page->dragController().draggingImageURL();
         if (!imageURL.isEmpty())
             draggingElementURL = imageURL;
-#if ENABLE(ATTACHMENT_ELEMENT)
-        else
-            draggingElementURL = page->dragController().draggingAttachmentURL();
-#endif
 
         wrapper = [[self _dataSource] _fileWrapperForURL:draggingElementURL];
     }