Title: [212669] trunk/Source
Revision
212669
Author
wenson_hs...@apple.com
Date
2017-02-20 13:21:18 -0800 (Mon, 20 Feb 2017)

Log Message

Add plumbing to the UI process for TextIndicatorData when computing the drag image
https://bugs.webkit.org/show_bug.cgi?id=168583
Work towards <rdar://problem/30313681>

Source/WebCore:

Reviewed by Tim Horton.

Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
propagated to the UI process via SetDragImage in the WebDragClient.

Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.

No new tests, since there is no behavior change.

* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/Page.cpp:
(WebCore::Page::hasSelectionAtPosition):
(WebCore::Page::hasDataInteractionAtPosition): Deleted.
* page/Page.h:
* platform/DragImage.cpp:
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForLink):
(WebCore::DragImage::operator=):
* platform/DragImage.h:
* platform/gtk/DragImageGtk.cpp:
(WebCore::createDragImageForLink):
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageForLink):
* platform/win/DragImageWin.cpp:
(WebCore::createDragImageForLink):

Source/WebKit/mac:

Accounts for changes in WebCore -- see Source/WebCore/ChangeLog for more details.

Reviewed by Tim Horton.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _selectionDraggingImage]):
(-[WebHTMLView selectionImageForcingBlackText:selectionImageForcingBlackText:]):

Source/WebKit2:

Reviewed by Tim Horton.

Changes the SetDragImage IPC message to send TextIndicatorData over to the UI process. Also changes the boolean
isLink parameter to be a DragSourceAction instead, leaving it up to the receiving end (in the UI process) to
special case links.

Additionally, renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.

These changes are only infrastructural should not alter any behaviors.

* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateDataInteractionGestureRecognized]):
(-[WKWebView _simulateDataInteractionEntered:]):
(-[WKWebView _simulateDataInteractionUpdated:]):
(-[WKWebView _simulateDataInteractionPerformOperation:]):
(-[WKWebView _simulateDataInteractionEnded:]):
(-[WKWebView _simulateDataInteractionSessionDidEnd:withOperation:]):
(-[WKWebView _simulateFailedDataInteractionWithIndex:]):
(-[WKWebView _simulateWillBeginDataInteractionWithIndex:withSession:]):
(-[WKWebView _simulatedItemsForDataInteractionWithIndex:]):
* UIProcess/API/Cocoa/_WKTestingDelegate.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::setDragImage):
(WebKit::PageClientImpl::startDataInteractionWithImage):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView hasSelectablePositionAtPoint:]):
(-[WKContentView pointIsInDataInteractionContent:]):
(-[WKContentView _dataInteractionGestureRecognizer]):
(-[WKContentView pointIsInAssistedNode:]):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setDragImage):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setDragImage):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (212668 => 212669)


--- trunk/Source/WebCore/ChangeLog	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/ChangeLog	2017-02-20 21:21:18 UTC (rev 212669)
@@ -1,3 +1,37 @@
+2017-02-20  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Add plumbing to the UI process for TextIndicatorData when computing the drag image
+        https://bugs.webkit.org/show_bug.cgi?id=168583
+        Work towards <rdar://problem/30313681>
+
+        Reviewed by Tim Horton.
+
+        Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
+        for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
+        propagated to the UI process via SetDragImage in the WebDragClient.
+
+        Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
+
+        No new tests, since there is no behavior change.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::startDrag):
+        * page/Page.cpp:
+        (WebCore::Page::hasSelectionAtPosition):
+        (WebCore::Page::hasDataInteractionAtPosition): Deleted.
+        * page/Page.h:
+        * platform/DragImage.cpp:
+        (WebCore::createDragImageForSelection):
+        (WebCore::createDragImageForLink):
+        (WebCore::DragImage::operator=):
+        * platform/DragImage.h:
+        * platform/gtk/DragImageGtk.cpp:
+        (WebCore::createDragImageForLink):
+        * platform/mac/DragImageMac.mm:
+        (WebCore::createDragImageForLink):
+        * platform/win/DragImageWin.cpp:
+        (WebCore::createDragImageForLink):
+
 2017-02-20  Brent Fulgham  <bfulg...@apple.com>
 
         Nullptr dereferences when stopping a load

Modified: trunk/Source/WebCore/page/DragController.cpp (212668 => 212669)


--- trunk/Source/WebCore/page/DragController.cpp	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/page/DragController.cpp	2017-02-20 21:21:18 UTC (rev 212669)
@@ -875,7 +875,10 @@
         }
         m_client.willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, dataTransfer);
         if (!dragImage) {
-            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha) };
+            TextIndicatorData textIndicator;
+            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
+            if (textIndicator.contentImage)
+                dragImage.setIndicatorData(textIndicator);
             dragLoc = dragLocForSelectionDrag(src);
             dragImageAnchorPoint = dragImageAnchorPointForSelectionDrag(src, mouseDraggedPoint);
             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
@@ -956,11 +959,14 @@
 
         m_client.willPerformDragSourceAction(DragSourceActionLink, dragOrigin, dataTransfer);
         if (!dragImage) {
-            dragImage = DragImage { createDragImageForLink(linkURL, hitTestResult.textContent(), src.settings().fontRenderingMode()) };
+            TextIndicatorData textIndicator;
+            dragImage = DragImage { createDragImageForLink(element, linkURL, hitTestResult.textContent(), textIndicator, src.settings().fontRenderingMode(), m_page.deviceScaleFactor()) };
             IntSize size = dragImageSize(dragImage.get());
             m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset);
             dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDraggedPoint.y() + m_dragOffset.y());
             dragImage = DragImage { platformAdjustDragImageForDeviceScaleFactor(dragImage.get(), m_page.deviceScaleFactor()) };
+            if (textIndicator.contentImage)
+                dragImage.setIndicatorData(textIndicator);
         }
         doSystemDrag(WTFMove(dragImage), dragLoc, mouseDraggedPoint, { }, dataTransfer, src, DragSourceActionLink);
 
@@ -978,7 +984,10 @@
         m_client.willPerformDragSourceAction(DragSourceActionAttachment, dragOrigin, dataTransfer);
         
         if (!dragImage) {
-            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha) };
+            TextIndicatorData textIndicator;
+            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
+            if (textIndicator.contentImage)
+                dragImage.setIndicatorData(textIndicator);
             dragLoc = dragLocForSelectionDrag(src);
             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
         }

Modified: trunk/Source/WebCore/page/Page.cpp (212668 => 212669)


--- trunk/Source/WebCore/page/Page.cpp	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/page/Page.cpp	2017-02-20 21:21:18 UTC (rev 212669)
@@ -2191,7 +2191,7 @@
 
 #if ENABLE(DATA_INTERACTION)
 
-bool Page::hasDataInteractionAtPosition(const FloatPoint& position) const
+bool Page::hasSelectionAtPosition(const FloatPoint& position) const
 {
     auto currentSelection = m_mainFrame->selection().selection();
     if (!currentSelection.isRange())

Modified: trunk/Source/WebCore/page/Page.h (212668 => 212669)


--- trunk/Source/WebCore/page/Page.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/page/Page.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -571,7 +571,7 @@
     bool isUtilityPage() const { return m_isUtilityPage; }
 
 #if ENABLE(DATA_INTERACTION)
-    WEBCORE_EXPORT bool hasDataInteractionAtPosition(const FloatPoint&) const;
+    WEBCORE_EXPORT bool hasSelectionAtPosition(const FloatPoint&) const;
 #endif
 
 private:

Modified: trunk/Source/WebCore/platform/DragImage.cpp (212668 => 212669)


--- trunk/Source/WebCore/platform/DragImage.cpp	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/platform/DragImage.cpp	2017-02-20 21:21:18 UTC (rev 212669)
@@ -34,6 +34,7 @@
 #include "RenderElement.h"
 #include "RenderObject.h"
 #include "RenderView.h"
+#include "TextIndicator.h"
 
 namespace WebCore {
 
@@ -122,7 +123,7 @@
 
 #if !ENABLE(DATA_INTERACTION)
 
-DragImageRef createDragImageForSelection(Frame& frame, bool forceBlackText)
+DragImageRef createDragImageForSelection(Frame& frame, TextIndicatorData&, bool forceBlackText)
 {
     SnapshotOptions options = forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone;
     return createDragImageFromSnapshot(snapshotSelection(frame, options), nullptr);
@@ -219,7 +220,7 @@
 #endif
 
 #if !PLATFORM(COCOA) && !PLATFORM(WIN)
-DragImageRef createDragImageForLink(URL&, const String&, FontRenderingMode)
+DragImageRef createDragImageForLink(Element&, URL&, const String&, FontRenderingMode, float)
 {
     return nullptr;
 }
@@ -238,6 +239,7 @@
 DragImage::DragImage(DragImage&& other)
     : m_dragImageRef { std::exchange(other.m_dragImageRef, nullptr) }
 {
+    m_indicatorData = other.m_indicatorData;
 }
 
 DragImage& DragImage::operator=(DragImage&& other)
@@ -246,6 +248,7 @@
         deleteDragImage(m_dragImageRef);
 
     m_dragImageRef = std::exchange(other.m_dragImageRef, nullptr);
+    m_indicatorData = other.m_indicatorData;
 
     return *this;
 }

Modified: trunk/Source/WebCore/platform/DragImage.h (212668 => 212669)


--- trunk/Source/WebCore/platform/DragImage.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/platform/DragImage.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -29,7 +29,9 @@
 #include "ImageOrientation.h"
 #include "IntSize.h"
 #include "TextFlags.h"
+#include "TextIndicator.h"
 #include <wtf/Forward.h>
+#include <wtf/Optional.h>
 
 #if PLATFORM(IOS)
 #include <wtf/RetainPtr.h>
@@ -48,6 +50,7 @@
 
 namespace WebCore {
 
+class Element;
 class Frame;
 class Image;
 class IntRect;
@@ -83,10 +86,10 @@
 DragImageRef createDragImageIconForCachedImageFilename(const String&);
 
 WEBCORE_EXPORT DragImageRef createDragImageForNode(Frame&, Node&);
-WEBCORE_EXPORT DragImageRef createDragImageForSelection(Frame&, bool forceBlackText = false);
+WEBCORE_EXPORT DragImageRef createDragImageForSelection(Frame&, TextIndicatorData&, bool forceBlackText = false);
 WEBCORE_EXPORT DragImageRef createDragImageForRange(Frame&, Range&, bool forceBlackText = false);
 DragImageRef createDragImageForImage(Frame&, Node&, IntRect& imageRect, IntRect& elementRect);
-DragImageRef createDragImageForLink(URL&, const String& label, FontRenderingMode);
+DragImageRef createDragImageForLink(Element&, URL&, const String& label, TextIndicatorData&, FontRenderingMode, float deviceScaleFactor);
 void deleteDragImage(DragImageRef);
 
 class DragImage final {
@@ -98,11 +101,16 @@
 
     DragImage& operator=(DragImage&&);
 
+    void setIndicatorData(const TextIndicatorData& data) { m_indicatorData = data; }
+    bool hasIndicatorData() const { return !!m_indicatorData; }
+    std::optional<TextIndicatorData> indicatorData() const { return m_indicatorData; }
+
     explicit operator bool() const { return !!m_dragImageRef; }
     DragImageRef get() const { return m_dragImageRef; }
 
 private:
     DragImageRef m_dragImageRef;
+    std::optional<TextIndicatorData> m_indicatorData;
 };
 
 }

Modified: trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp (212668 => 212669)


--- trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp	2017-02-20 21:21:18 UTC (rev 212669)
@@ -19,7 +19,11 @@
 #include "config.h"
 #include "DragImage.h"
 
+#include "Element.h"
 #include "Image.h"
+#include "TextFlags.h"
+#include "TextIndicator.h"
+#include "URL.h"
 #include <cairo.h>
 #include <gdk/gdk.h>
 
@@ -88,4 +92,9 @@
     return nullptr;
 }
 
+DragImageRef createDragImageForLink(Element&, URL&, const String&, TextIndicatorData&, FontRenderingMode, float)
+{
+    return nullptr;
 }
+
+}

Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (212668 => 212669)


--- trunk/Source/WebCore/platform/mac/DragImageMac.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -30,6 +30,7 @@
 
 #import "BitmapImage.h"
 #import "CoreGraphicsSPI.h"
+#import "Element.h"
 #import "FontCascade.h"
 #import "FontDescription.h"
 #import "FontSelector.h"
@@ -37,6 +38,7 @@
 #import "Image.h"
 #import "URL.h"
 #import "StringTruncator.h"
+#import "TextIndicator.h"
 #import "TextRun.h"
 #import <wtf/NeverDestroyed.h>
 
@@ -265,7 +267,7 @@
         drawAtPoint(string, textPoint, font, topColor);
 }
 
-DragImageRef createDragImageForLink(URL& url, const String& title, FontRenderingMode)
+DragImageRef createDragImageForLink(Element&, URL& url, const String& title, TextIndicatorData&, FontRenderingMode, float)
 {
     NSString *label = nsStringNilIfEmpty(title);
     NSURL *cocoaURL = url;

Modified: trunk/Source/WebCore/platform/win/DragImageWin.cpp (212668 => 212669)


--- trunk/Source/WebCore/platform/win/DragImageWin.cpp	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebCore/platform/win/DragImageWin.cpp	2017-02-20 21:21:18 UTC (rev 212669)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "DragImage.h"
 
+#include "Element.h"
 #include "FloatRoundedRect.h"
 #include "FontCascade.h"
 #include "FontDescription.h"
@@ -35,6 +36,7 @@
 #include "Image.h"
 #include "URL.h"
 #include "StringTruncator.h"
+#include "TextIndicator.h"
 #include "TextRun.h"
 #include "WebCoreTextRenderer.h"
 #include <wtf/RetainPtr.h>
@@ -119,7 +121,7 @@
     return result;
 }
 
-DragImageRef createDragImageForLink(URL& url, const String& inLabel, FontRenderingMode fontRenderingMode)
+DragImageRef createDragImageForLink(Element&, URL& url, const String& inLabel, TextIndicatorData&, FontRenderingMode fontRenderingMode, float)
 {
     // This is more or less an exact match for the Mac OS X code.
 

Modified: trunk/Source/WebKit/mac/ChangeLog (212668 => 212669)


--- trunk/Source/WebKit/mac/ChangeLog	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-02-20 21:21:18 UTC (rev 212669)
@@ -1,3 +1,17 @@
+2017-02-20  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Add plumbing to the UI process for TextIndicatorData when computing the drag image
+        https://bugs.webkit.org/show_bug.cgi?id=168583
+        Work towards <rdar://problem/30313681>
+
+        Accounts for changes in WebCore -- see Source/WebCore/ChangeLog for more details.
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _selectionDraggingImage]):
+        (-[WebHTMLView selectionImageForcingBlackText:selectionImageForcingBlackText:]):
+
 2017-02-17  Anders Carlsson  <ander...@apple.com>
 
         Add a new drag code path and use it for dragging plain text

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (212668 => 212669)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -2389,7 +2389,8 @@
     if (!coreFrame)
         return nil;
 
-    auto dragImage = createDragImageForSelection(*coreFrame);
+    TextIndicatorData textIndicator;
+    auto dragImage = createDragImageForSelection(*coreFrame, textIndicator);
     [dragImage _web_dissolveToFraction:WebDragImageAlpha];
 
     return dragImage.autorelease();
@@ -7373,7 +7374,8 @@
 #if PLATFORM(IOS)
     return selectionImage(coreFrame, forceBlackText);
 #else
-    return createDragImageForSelection(*coreFrame, forceBlackText).autorelease();
+    TextIndicatorData textIndicator;
+    return createDragImageForSelection(*coreFrame, textIndicator, forceBlackText).autorelease();
 #endif
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (212668 => 212669)


--- trunk/Source/WebKit2/ChangeLog	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-20 21:21:18 UTC (rev 212669)
@@ -1,3 +1,57 @@
+2017-02-20  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Add plumbing to the UI process for TextIndicatorData when computing the drag image
+        https://bugs.webkit.org/show_bug.cgi?id=168583
+        Work towards <rdar://problem/30313681>
+
+        Reviewed by Tim Horton.
+
+        Changes the SetDragImage IPC message to send TextIndicatorData over to the UI process. Also changes the boolean
+        isLink parameter to be a DragSourceAction instead, leaving it up to the receiving end (in the UI process) to
+        special case links.
+
+        Additionally, renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
+
+        These changes are only infrastructural should not alter any behaviors.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode):
+        (WebKit::InteractionInformationAtPosition::decode):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _simulateDataInteractionGestureRecognized]):
+        (-[WKWebView _simulateDataInteractionEntered:]):
+        (-[WKWebView _simulateDataInteractionUpdated:]):
+        (-[WKWebView _simulateDataInteractionPerformOperation:]):
+        (-[WKWebView _simulateDataInteractionEnded:]):
+        (-[WKWebView _simulateDataInteractionSessionDidEnd:withOperation:]):
+        (-[WKWebView _simulateFailedDataInteractionWithIndex:]):
+        (-[WKWebView _simulateWillBeginDataInteractionWithIndex:withSession:]):
+        (-[WKWebView _simulatedItemsForDataInteractionWithIndex:]):
+        * UIProcess/API/Cocoa/_WKTestingDelegate.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::setDragImage):
+        (WebKit::PageClientImpl::startDataInteractionWithImage):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView hasSelectablePositionAtPoint:]):
+        (-[WKContentView pointIsInDataInteractionContent:]):
+        (-[WKContentView _dataInteractionGestureRecognizer]):
+        (-[WKContentView pointIsInAssistedNode:]):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setDragImage):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setDragImage):
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::WebDragClient::startDrag):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getPositionInformation):
+
 2017-02-20  David Quesada  <david_ques...@apple.com>
 
         Don’t set NSURLSessionConfiguration’s _sourceApplicationAuditTokenData if _sourceApplicationBundleIdentifier is also set.

Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h (212668 => 212669)


--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -42,7 +42,7 @@
 
     bool nodeAtPositionIsAssistedNode { false };
 #if ENABLE(DATA_INTERACTION)
-    bool hasDataInteractionAtPosition { false };
+    bool hasSelectionAtPosition { false };
 #endif
     bool isSelectable { false };
     bool isNearMarkedText { false };

Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm (212668 => 212669)


--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -44,7 +44,7 @@
 
     encoder << nodeAtPositionIsAssistedNode;
 #if ENABLE(DATA_INTERACTION)
-    encoder << hasDataInteractionAtPosition;
+    encoder << hasSelectionAtPosition;
 #endif
     encoder << isSelectable;
     encoder << isNearMarkedText;
@@ -92,7 +92,7 @@
         return false;
 
 #if ENABLE(DATA_INTERACTION)
-    if (!decoder.decode(result.hasDataInteractionAtPosition))
+    if (!decoder.decode(result.hasSelectionAtPosition))
         return false;
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -5174,67 +5174,39 @@
 
 - (void)_simulateDataInteractionGestureRecognized
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionGestureRecognized:_testingDelegate.dataInteractionGestureRecognizer];
-#endif
 }
 
 - (void)_simulateDataInteractionEntered:(id)info
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionEntered:info];
-#endif
 }
 
 - (void)_simulateDataInteractionUpdated:(id)info
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionUpdated:info];
-#endif
 }
 
 - (void)_simulateDataInteractionPerformOperation:(id)info
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionPerformOperation:info];
-#endif
 }
 
 - (void)_simulateDataInteractionEnded:(id)info
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionEnded:info];
-#endif
 }
 
 - (void)_simulateDataInteractionSessionDidEnd:(id)session withOperation:(NSUInteger)operation
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateDataInteractionSessionDidEnd:session withOperation:operation];
-#endif
 }
 
 - (void)_simulateFailedDataInteractionWithIndex:(NSInteger)sourceIndex
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateFailedDataInteractionWithIndex:sourceIndex];
-#endif
 }
 
 - (void)_simulateWillBeginDataInteractionWithIndex:(NSInteger)sourceIndex withSession:(id)session
 {
-#if ENABLE(DATA_INTERACTION)
-    [_contentView _simulateWillBeginDataInteractionWithIndex:sourceIndex withSession:session];
-#endif
 }
 
 - (NSArray *)_simulatedItemsForDataInteractionWithIndex:(NSInteger)sourceIndex
 {
-#if ENABLE(DATA_INTERACTION)
-    return [_contentView _simulatedItemsForDataInteractionWithIndex:sourceIndex];
-#else
     return @[ ];
-#endif
 }
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKTestingDelegate.h (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKTestingDelegate.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKTestingDelegate.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -31,11 +31,6 @@
 
 @class WKWebView;
 
-#if TARGET_OS_IPHONE
-@class UIGestureRecognizer;
-@class UILongPressGestureRecognizer;
-#endif
-
 NS_ASSUME_NONNULL_BEGIN
 
 @protocol _WKTestingDelegate <NSObject>
@@ -42,11 +37,7 @@
 @optional
 
 #if TARGET_OS_IPHONE
-@property (nonatomic, readonly) UILongPressGestureRecognizer *dataInteractionGestureRecognizer;
-- (void)webViewDidSendDataInteractionStartRequest:(WKWebView *)webView;
-- (void)webView:(WKWebView *)webView didReceiveDataInteractionStartResponse:(BOOL)started;
 - (void)webViewDidPerformDataInteractionControllerOperation:(WKWebView *)webView;
-- (void)webView:(WKWebView *)webView beginDataInteractionWithSourceIndex:(NSInteger)sourceIndex gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
 #endif // TARGET_OS_PHONE
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -170,7 +170,7 @@
 #if PLATFORM(COCOA)
     virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) = 0;
     virtual bool executeSavedCommandBySelector(const String& selector) = 0;
-    virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
+    virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) = 0;
     virtual void updateSecureInputState() = 0;
     virtual void resetSecureInputState() = 0;
     virtual void notifyInputContextAboutDiscardedComposition() = 0;
@@ -380,7 +380,7 @@
 #if ENABLE(DATA_INTERACTION)
     virtual void didPerformDataInteractionControllerOperation() = 0;
     virtual void didHandleStartDataInteractionRequest(bool started) = 0;
-    virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) = 0;
+    virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) = 0;
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -832,7 +832,7 @@
     void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
     void dragCancelled();
 #if PLATFORM(COCOA)
-    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const WebCore::FloatPoint& dragImageAnchor, bool isLinkDrag);
+    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& dragImageAnchor, uint64_t action);
     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 (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2017-02-20 21:21:18 UTC (rev 212669)
@@ -302,7 +302,7 @@
     DidPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted)
 #endif
 #if PLATFORM(COCOA) && ENABLE(DRAG_SUPPORT)
-    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, WebCore::FloatPoint dragImageAnchor, bool linkDrag)
+    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, std::optional<WebCore::TextIndicatorData> textIndicator, WebCore::FloatPoint dragImageAnchor, uint64_t action)
     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 (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -78,7 +78,7 @@
     void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
     void accessibilityWebProcessTokenReceived(const IPC::DataReference&) override;
     bool executeSavedCommandBySelector(const String& selector) override;
-    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) override;
+    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) override;
     void updateSecureInputState() override;
     void resetSecureInputState() override;
     void notifyInputContextAboutDiscardedComposition() override;
@@ -204,7 +204,7 @@
 #if ENABLE(DATA_INTERACTION)
     void didPerformDataInteractionControllerOperation() override;
     void didHandleStartDataInteractionRequest(bool started) override;
-    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) override;
+    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) override;
 #endif
 
     WKContentView *m_contentView;

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -353,7 +353,7 @@
     return false;
 }
 
-void PageClientImpl::setDragImage(const IntPoint&, PassRefPtr<ShareableBitmap>, bool)
+void PageClientImpl::setDragImage(const IntPoint&, PassRefPtr<ShareableBitmap>, DragSourceAction)
 {
     notImplemented();
 }
@@ -773,9 +773,9 @@
     [m_contentView _didHandleStartDataInteractionRequest:started];
 }
 
-void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, const FloatPoint& anchorPoint, bool isLink)
+void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData> indicatorData, const FloatPoint& anchorPoint, uint64_t action)
 {
-    [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) anchorPoint:anchorPoint isLink:isLink];
+    [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() withIndicatorData:indicatorData atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) anchorPoint:anchorPoint action:action];
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -270,7 +270,7 @@
 #if ENABLE(DATA_INTERACTION)
 - (void)_didPerformDataInteractionControllerOperation;
 - (void)_didHandleStartDataInteractionRequest:(BOOL)started;
-- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint isLink:(BOOL)isLink;
+- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image withIndicatorData:(std::optional<WebCore::TextIndicatorData>)indicatorData atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
 - (void)_simulateDataInteractionGestureRecognized:(UILongPressGestureRecognizer *)gestureRecognizer WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)_simulateDataInteractionEntered:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)_simulateDataInteractionUpdated:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -1441,7 +1441,7 @@
     [self ensurePositionInformationIsUpToDate:request];
 
 #if ENABLE(DATA_INTERACTION)
-    if (_positionInformation.hasDataInteractionAtPosition) {
+    if (_positionInformation.hasSelectionAtPosition) {
         // If the position might initiate a data interaction, we don't want to consider the content at this position to be selectable.
         // FIXME: This should be renamed to something more precise, such as textSelectionShouldRecognizeGestureAtPoint:
         return NO;
@@ -1461,14 +1461,11 @@
     if (_positionInformation.isImage || _positionInformation.isLink)
         return YES;
 
-    return _positionInformation.hasDataInteractionAtPosition;
+    return _positionInformation.hasSelectionAtPosition;
 }
 
 - (UILongPressGestureRecognizer *)_dataInteractionGestureRecognizer
 {
-    if ([_webView._testingDelegate respondsToSelector:@selector(dataInteractionGestureRecognizer)])
-        return _webView._testingDelegate.dataInteractionGestureRecognizer;
-
     return _dataInteractionGestureRecognizer.get();
 }
 
@@ -1487,7 +1484,7 @@
     [self ensurePositionInformationIsUpToDate:request];
 
 #if ENABLE(DATA_INTERACTION)
-    if (_positionInformation.hasDataInteractionAtPosition) {
+    if (_positionInformation.hasSelectionAtPosition) {
         // If the position might initiate data interaction, we don't want to change the selection.
         // FIXME: This should be renamed to something more precise, such as textInteractionShouldRecognizeGestureAtPoint:
         return NO;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2017-02-20 21:21:18 UTC (rev 212669)
@@ -95,7 +95,7 @@
     bool canUndoRedo(WebPageProxy::UndoOrRedo) override;
     void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
     bool executeSavedCommandBySelector(const String& selector) override;
-    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) override;
+    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) override;
     void setPromisedDataForImage(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
         const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) override;
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -337,7 +337,7 @@
     return (undoOrRedo == WebPageProxy::Undo) ? [[m_view undoManager] undo] : [[m_view undoManager] redo];
 }
 
-void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
+void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, DragSourceAction action)
 {
     RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
     RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
@@ -345,7 +345,7 @@
     size.scale(1.0 / m_impl->page().deviceScaleFactor());
     [dragNSImage setSize:size];
 
-    m_impl->dragImageForView(m_view, dragNSImage.get(), clientPosition, isLinkDrag);
+    m_impl->dragImageForView(m_view, dragNSImage.get(), clientPosition, action == DragSourceActionLink);
 }
 
 void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL, PassRefPtr<SharedBuffer> archiveBuffer)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (212668 => 212669)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -269,10 +269,10 @@
 #endif
 
 #if ENABLE(DRAG_SUPPORT)
-void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const FloatPoint&, bool isLinkDrag)
+void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, std::optional<TextIndicatorData>, const FloatPoint&, uint64_t action)
 {
     if (auto dragImage = ShareableBitmap::create(dragImageHandle))
-        m_pageClient.setDragImage(clientPosition, WTFMove(dragImage), isLinkDrag);
+        m_pageClient.setDragImage(clientPosition, WTFMove(dragImage), static_cast<DragSourceAction>(action));
 
     process().send(Messages::WebPage::DidStartDrag(), m_pageID);
 }

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


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -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, { }, dragSourceAction == DragSourceActionLink));
+    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, std::nullopt, { }, dragSourceAction));
 }
 
 static WebCore::CachedImage* cachedImage(Element& element)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (212668 => 212669)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-02-20 21:10:57 UTC (rev 212668)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-02-20 21:21:18 UTC (rev 212669)
@@ -2549,7 +2549,7 @@
     }
 
 #if ENABLE(DATA_INTERACTION)
-    info.hasDataInteractionAtPosition = m_page->hasDataInteractionAtPosition(adjustedPoint);
+    info.hasSelectionAtPosition = m_page->hasSelectionAtPosition(adjustedPoint);
 #endif
     info.adjustedPointForNodeRespondingToClickEvents = adjustedPoint;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to