Changeset 212669 in webkit


Ignore:
Timestamp:
Feb 20, 2017 1:21:18 PM (7 years ago)
Author:
Wenson Hsieh
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):

Location:
trunk/Source
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r212667 r212669  
     12017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add plumbing to the UI process for TextIndicatorData when computing the drag image
     4        https://bugs.webkit.org/show_bug.cgi?id=168583
     5        Work towards <rdar://problem/30313681>
     6
     7        Reviewed by Tim Horton.
     8
     9        Adds some additional arguments to drag image creation functions to allow platforms to specify TextIndicatorData
     10        for a link or selection-based DragImage. This TextIndicatorData is an optional member of the DragImage, and is
     11        propagated to the UI process via SetDragImage in the WebDragClient.
     12
     13        Additionally renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
     14
     15        No new tests, since there is no behavior change.
     16
     17        * page/DragController.cpp:
     18        (WebCore::DragController::startDrag):
     19        * page/Page.cpp:
     20        (WebCore::Page::hasSelectionAtPosition):
     21        (WebCore::Page::hasDataInteractionAtPosition): Deleted.
     22        * page/Page.h:
     23        * platform/DragImage.cpp:
     24        (WebCore::createDragImageForSelection):
     25        (WebCore::createDragImageForLink):
     26        (WebCore::DragImage::operator=):
     27        * platform/DragImage.h:
     28        * platform/gtk/DragImageGtk.cpp:
     29        (WebCore::createDragImageForLink):
     30        * platform/mac/DragImageMac.mm:
     31        (WebCore::createDragImageForLink):
     32        * platform/win/DragImageWin.cpp:
     33        (WebCore::createDragImageForLink):
     34
    1352017-02-20  Brent Fulgham  <bfulgham@apple.com>
    236
  • trunk/Source/WebCore/page/DragController.cpp

    r212663 r212669  
    876876        m_client.willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, dataTransfer);
    877877        if (!dragImage) {
    878             dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha) };
     878            TextIndicatorData textIndicator;
     879            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
     880            if (textIndicator.contentImage)
     881                dragImage.setIndicatorData(textIndicator);
    879882            dragLoc = dragLocForSelectionDrag(src);
    880883            dragImageAnchorPoint = dragImageAnchorPointForSelectionDrag(src, mouseDraggedPoint);
     
    957960        m_client.willPerformDragSourceAction(DragSourceActionLink, dragOrigin, dataTransfer);
    958961        if (!dragImage) {
    959             dragImage = DragImage { createDragImageForLink(linkURL, hitTestResult.textContent(), src.settings().fontRenderingMode()) };
     962            TextIndicatorData textIndicator;
     963            dragImage = DragImage { createDragImageForLink(element, linkURL, hitTestResult.textContent(), textIndicator, src.settings().fontRenderingMode(), m_page.deviceScaleFactor()) };
    960964            IntSize size = dragImageSize(dragImage.get());
    961965            m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset);
    962966            dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDraggedPoint.y() + m_dragOffset.y());
    963967            dragImage = DragImage { platformAdjustDragImageForDeviceScaleFactor(dragImage.get(), m_page.deviceScaleFactor()) };
     968            if (textIndicator.contentImage)
     969                dragImage.setIndicatorData(textIndicator);
    964970        }
    965971        doSystemDrag(WTFMove(dragImage), dragLoc, mouseDraggedPoint, { }, dataTransfer, src, DragSourceActionLink);
     
    979985       
    980986        if (!dragImage) {
    981             dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha) };
     987            TextIndicatorData textIndicator;
     988            dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
     989            if (textIndicator.contentImage)
     990                dragImage.setIndicatorData(textIndicator);
    982991            dragLoc = dragLocForSelectionDrag(src);
    983992            m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
  • trunk/Source/WebCore/page/Page.cpp

    r212173 r212669  
    21922192#if ENABLE(DATA_INTERACTION)
    21932193
    2194 bool Page::hasDataInteractionAtPosition(const FloatPoint& position) const
     2194bool Page::hasSelectionAtPosition(const FloatPoint& position) const
    21952195{
    21962196    auto currentSelection = m_mainFrame->selection().selection();
  • trunk/Source/WebCore/page/Page.h

    r212173 r212669  
    572572
    573573#if ENABLE(DATA_INTERACTION)
    574     WEBCORE_EXPORT bool hasDataInteractionAtPosition(const FloatPoint&) const;
     574    WEBCORE_EXPORT bool hasSelectionAtPosition(const FloatPoint&) const;
    575575#endif
    576576
  • trunk/Source/WebCore/platform/DragImage.cpp

    r212342 r212669  
    3535#include "RenderObject.h"
    3636#include "RenderView.h"
     37#include "TextIndicator.h"
    3738
    3839namespace WebCore {
     
    123124#if !ENABLE(DATA_INTERACTION)
    124125
    125 DragImageRef createDragImageForSelection(Frame& frame, bool forceBlackText)
     126DragImageRef createDragImageForSelection(Frame& frame, TextIndicatorData&, bool forceBlackText)
    126127{
    127128    SnapshotOptions options = forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone;
     
    220221
    221222#if !PLATFORM(COCOA) && !PLATFORM(WIN)
    222 DragImageRef createDragImageForLink(URL&, const String&, FontRenderingMode)
     223DragImageRef createDragImageForLink(Element&, URL&, const String&, FontRenderingMode, float)
    223224{
    224225    return nullptr;
     
    239240    : m_dragImageRef { std::exchange(other.m_dragImageRef, nullptr) }
    240241{
     242    m_indicatorData = other.m_indicatorData;
    241243}
    242244
     
    247249
    248250    m_dragImageRef = std::exchange(other.m_dragImageRef, nullptr);
     251    m_indicatorData = other.m_indicatorData;
    249252
    250253    return *this;
  • trunk/Source/WebCore/platform/DragImage.h

    r212484 r212669  
    3030#include "IntSize.h"
    3131#include "TextFlags.h"
     32#include "TextIndicator.h"
    3233#include <wtf/Forward.h>
     34#include <wtf/Optional.h>
    3335
    3436#if PLATFORM(IOS)
     
    4951namespace WebCore {
    5052
     53class Element;
    5154class Frame;
    5255class Image;
     
    8487
    8588WEBCORE_EXPORT DragImageRef createDragImageForNode(Frame&, Node&);
    86 WEBCORE_EXPORT DragImageRef createDragImageForSelection(Frame&, bool forceBlackText = false);
     89WEBCORE_EXPORT DragImageRef createDragImageForSelection(Frame&, TextIndicatorData&, bool forceBlackText = false);
    8790WEBCORE_EXPORT DragImageRef createDragImageForRange(Frame&, Range&, bool forceBlackText = false);
    8891DragImageRef createDragImageForImage(Frame&, Node&, IntRect& imageRect, IntRect& elementRect);
    89 DragImageRef createDragImageForLink(URL&, const String& label, FontRenderingMode);
     92DragImageRef createDragImageForLink(Element&, URL&, const String& label, TextIndicatorData&, FontRenderingMode, float deviceScaleFactor);
    9093void deleteDragImage(DragImageRef);
    9194
     
    99102    DragImage& operator=(DragImage&&);
    100103
     104    void setIndicatorData(const TextIndicatorData& data) { m_indicatorData = data; }
     105    bool hasIndicatorData() const { return !!m_indicatorData; }
     106    std::optional<TextIndicatorData> indicatorData() const { return m_indicatorData; }
     107
    101108    explicit operator bool() const { return !!m_dragImageRef; }
    102109    DragImageRef get() const { return m_dragImageRef; }
     
    104111private:
    105112    DragImageRef m_dragImageRef;
     113    std::optional<TextIndicatorData> m_indicatorData;
    106114};
    107115
  • trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp

    r212287 r212669  
    2020#include "DragImage.h"
    2121
     22#include "Element.h"
    2223#include "Image.h"
     24#include "TextFlags.h"
     25#include "TextIndicator.h"
     26#include "URL.h"
    2327#include <cairo.h>
    2428#include <gdk/gdk.h>
     
    8993}
    9094
     95DragImageRef createDragImageForLink(Element&, URL&, const String&, TextIndicatorData&, FontRenderingMode, float)
     96{
     97    return nullptr;
    9198}
     99
     100}
  • trunk/Source/WebCore/platform/mac/DragImageMac.mm

    r211192 r212669  
    3131#import "BitmapImage.h"
    3232#import "CoreGraphicsSPI.h"
     33#import "Element.h"
    3334#import "FontCascade.h"
    3435#import "FontDescription.h"
     
    3839#import "URL.h"
    3940#import "StringTruncator.h"
     41#import "TextIndicator.h"
    4042#import "TextRun.h"
    4143#import <wtf/NeverDestroyed.h>
     
    266268}
    267269
    268 DragImageRef createDragImageForLink(URL& url, const String& title, FontRenderingMode)
     270DragImageRef createDragImageForLink(Element&, URL& url, const String& title, TextIndicatorData&, FontRenderingMode, float)
    269271{
    270272    NSString *label = nsStringNilIfEmpty(title);
  • trunk/Source/WebCore/platform/win/DragImageWin.cpp

    r195180 r212669  
    2727#include "DragImage.h"
    2828
     29#include "Element.h"
    2930#include "FloatRoundedRect.h"
    3031#include "FontCascade.h"
     
    3637#include "URL.h"
    3738#include "StringTruncator.h"
     39#include "TextIndicator.h"
    3840#include "TextRun.h"
    3941#include "WebCoreTextRenderer.h"
     
    120122}
    121123
    122 DragImageRef createDragImageForLink(URL& url, const String& inLabel, FontRenderingMode fontRenderingMode)
     124DragImageRef createDragImageForLink(Element&, URL& url, const String& inLabel, TextIndicatorData&, FontRenderingMode fontRenderingMode, float)
    123125{
    124126    // This is more or less an exact match for the Mac OS X code.
  • trunk/Source/WebKit/mac/ChangeLog

    r212663 r212669  
     12017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add plumbing to the UI process for TextIndicatorData when computing the drag image
     4        https://bugs.webkit.org/show_bug.cgi?id=168583
     5        Work towards <rdar://problem/30313681>
     6
     7        Accounts for changes in WebCore -- see Source/WebCore/ChangeLog for more details.
     8
     9        Reviewed by Tim Horton.
     10
     11        * WebView/WebHTMLView.mm:
     12        (-[WebHTMLView _selectionDraggingImage]):
     13        (-[WebHTMLView selectionImageForcingBlackText:selectionImageForcingBlackText:]):
     14
    1152017-02-17  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r212663 r212669  
    23902390        return nil;
    23912391
    2392     auto dragImage = createDragImageForSelection(*coreFrame);
     2392    TextIndicatorData textIndicator;
     2393    auto dragImage = createDragImageForSelection(*coreFrame, textIndicator);
    23932394    [dragImage _web_dissolveToFraction:WebDragImageAlpha];
    23942395
     
    73747375    return selectionImage(coreFrame, forceBlackText);
    73757376#else
    7376     return createDragImageForSelection(*coreFrame, forceBlackText).autorelease();
     7377    TextIndicatorData textIndicator;
     7378    return createDragImageForSelection(*coreFrame, textIndicator, forceBlackText).autorelease();
    73777379#endif
    73787380}
  • trunk/Source/WebKit2/ChangeLog

    r212666 r212669  
     12017-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add plumbing to the UI process for TextIndicatorData when computing the drag image
     4        https://bugs.webkit.org/show_bug.cgi?id=168583
     5        Work towards <rdar://problem/30313681>
     6
     7        Reviewed by Tim Horton.
     8
     9        Changes the SetDragImage IPC message to send TextIndicatorData over to the UI process. Also changes the boolean
     10        isLink parameter to be a DragSourceAction instead, leaving it up to the receiving end (in the UI process) to
     11        special case links.
     12
     13        Additionally, renames hasDataInteractionAtPosition to hasSelectionAtPosition to better reflect its purpose.
     14
     15        These changes are only infrastructural should not alter any behaviors.
     16
     17        * Shared/ios/InteractionInformationAtPosition.h:
     18        * Shared/ios/InteractionInformationAtPosition.mm:
     19        (WebKit::InteractionInformationAtPosition::encode):
     20        (WebKit::InteractionInformationAtPosition::decode):
     21        * UIProcess/API/Cocoa/WKWebView.mm:
     22        (-[WKWebView _simulateDataInteractionGestureRecognized]):
     23        (-[WKWebView _simulateDataInteractionEntered:]):
     24        (-[WKWebView _simulateDataInteractionUpdated:]):
     25        (-[WKWebView _simulateDataInteractionPerformOperation:]):
     26        (-[WKWebView _simulateDataInteractionEnded:]):
     27        (-[WKWebView _simulateDataInteractionSessionDidEnd:withOperation:]):
     28        (-[WKWebView _simulateFailedDataInteractionWithIndex:]):
     29        (-[WKWebView _simulateWillBeginDataInteractionWithIndex:withSession:]):
     30        (-[WKWebView _simulatedItemsForDataInteractionWithIndex:]):
     31        * UIProcess/API/Cocoa/_WKTestingDelegate.h:
     32        * UIProcess/PageClient.h:
     33        * UIProcess/WebPageProxy.h:
     34        * UIProcess/WebPageProxy.messages.in:
     35        * UIProcess/ios/PageClientImplIOS.h:
     36        * UIProcess/ios/PageClientImplIOS.mm:
     37        (WebKit::PageClientImpl::setDragImage):
     38        (WebKit::PageClientImpl::startDataInteractionWithImage):
     39        * UIProcess/ios/WKContentViewInteraction.h:
     40        * UIProcess/ios/WKContentViewInteraction.mm:
     41        (-[WKContentView hasSelectablePositionAtPoint:]):
     42        (-[WKContentView pointIsInDataInteractionContent:]):
     43        (-[WKContentView _dataInteractionGestureRecognizer]):
     44        (-[WKContentView pointIsInAssistedNode:]):
     45        * UIProcess/mac/PageClientImpl.h:
     46        * UIProcess/mac/PageClientImpl.mm:
     47        (WebKit::PageClientImpl::setDragImage):
     48        * UIProcess/mac/WebPageProxyMac.mm:
     49        (WebKit::WebPageProxy::setDragImage):
     50        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
     51        (WebKit::WebDragClient::startDrag):
     52        * WebProcess/WebPage/ios/WebPageIOS.mm:
     53        (WebKit::WebPage::getPositionInformation):
     54
    1552017-02-20  David Quesada  <david_quesada@apple.com>
    256
  • trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h

    r212342 r212669  
    4343    bool nodeAtPositionIsAssistedNode { false };
    4444#if ENABLE(DATA_INTERACTION)
    45     bool hasDataInteractionAtPosition { false };
     45    bool hasSelectionAtPosition { false };
    4646#endif
    4747    bool isSelectable { false };
  • trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm

    r212342 r212669  
    4545    encoder << nodeAtPositionIsAssistedNode;
    4646#if ENABLE(DATA_INTERACTION)
    47     encoder << hasDataInteractionAtPosition;
     47    encoder << hasSelectionAtPosition;
    4848#endif
    4949    encoder << isSelectable;
     
    9393
    9494#if ENABLE(DATA_INTERACTION)
    95     if (!decoder.decode(result.hasDataInteractionAtPosition))
     95    if (!decoder.decode(result.hasSelectionAtPosition))
    9696        return false;
    9797#endif
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r212459 r212669  
    51755175- (void)_simulateDataInteractionGestureRecognized
    51765176{
    5177 #if ENABLE(DATA_INTERACTION)
    5178     [_contentView _simulateDataInteractionGestureRecognized:_testingDelegate.dataInteractionGestureRecognizer];
    5179 #endif
    51805177}
    51815178
    51825179- (void)_simulateDataInteractionEntered:(id)info
    51835180{
    5184 #if ENABLE(DATA_INTERACTION)
    5185     [_contentView _simulateDataInteractionEntered:info];
    5186 #endif
    51875181}
    51885182
    51895183- (void)_simulateDataInteractionUpdated:(id)info
    51905184{
    5191 #if ENABLE(DATA_INTERACTION)
    5192     [_contentView _simulateDataInteractionUpdated:info];
    5193 #endif
    51945185}
    51955186
    51965187- (void)_simulateDataInteractionPerformOperation:(id)info
    51975188{
    5198 #if ENABLE(DATA_INTERACTION)
    5199     [_contentView _simulateDataInteractionPerformOperation:info];
    5200 #endif
    52015189}
    52025190
    52035191- (void)_simulateDataInteractionEnded:(id)info
    52045192{
    5205 #if ENABLE(DATA_INTERACTION)
    5206     [_contentView _simulateDataInteractionEnded:info];
    5207 #endif
    52085193}
    52095194
    52105195- (void)_simulateDataInteractionSessionDidEnd:(id)session withOperation:(NSUInteger)operation
    52115196{
    5212 #if ENABLE(DATA_INTERACTION)
    5213     [_contentView _simulateDataInteractionSessionDidEnd:session withOperation:operation];
    5214 #endif
    52155197}
    52165198
    52175199- (void)_simulateFailedDataInteractionWithIndex:(NSInteger)sourceIndex
    52185200{
    5219 #if ENABLE(DATA_INTERACTION)
    5220     [_contentView _simulateFailedDataInteractionWithIndex:sourceIndex];
    5221 #endif
    52225201}
    52235202
    52245203- (void)_simulateWillBeginDataInteractionWithIndex:(NSInteger)sourceIndex withSession:(id)session
    52255204{
    5226 #if ENABLE(DATA_INTERACTION)
    5227     [_contentView _simulateWillBeginDataInteractionWithIndex:sourceIndex withSession:session];
    5228 #endif
    52295205}
    52305206
    52315207- (NSArray *)_simulatedItemsForDataInteractionWithIndex:(NSInteger)sourceIndex
    52325208{
    5233 #if ENABLE(DATA_INTERACTION)
    5234     return [_contentView _simulatedItemsForDataInteractionWithIndex:sourceIndex];
    5235 #else
    52365209    return @[ ];
    5237 #endif
    52385210}
    52395211
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKTestingDelegate.h

    r212507 r212669  
    3232@class WKWebView;
    3333
    34 #if TARGET_OS_IPHONE
    35 @class UIGestureRecognizer;
    36 @class UILongPressGestureRecognizer;
    37 #endif
    38 
    3934NS_ASSUME_NONNULL_BEGIN
    4035
     
    4338
    4439#if TARGET_OS_IPHONE
    45 @property (nonatomic, readonly) UILongPressGestureRecognizer *dataInteractionGestureRecognizer;
    46 - (void)webViewDidSendDataInteractionStartRequest:(WKWebView *)webView;
    47 - (void)webView:(WKWebView *)webView didReceiveDataInteractionStartResponse:(BOOL)started;
    4840- (void)webViewDidPerformDataInteractionControllerOperation:(WKWebView *)webView;
    49 - (void)webView:(WKWebView *)webView beginDataInteractionWithSourceIndex:(NSInteger)sourceIndex gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
    5041#endif // TARGET_OS_PHONE
    5142
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r212557 r212669  
    171171    virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) = 0;
    172172    virtual bool executeSavedCommandBySelector(const String& selector) = 0;
    173     virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
     173    virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) = 0;
    174174    virtual void updateSecureInputState() = 0;
    175175    virtual void resetSecureInputState() = 0;
     
    381381    virtual void didPerformDataInteractionControllerOperation() = 0;
    382382    virtual void didHandleStartDataInteractionRequest(bool started) = 0;
    383     virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) = 0;
     383    virtual void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) = 0;
    384384#endif
    385385};
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r212619 r212669  
    833833    void dragCancelled();
    834834#if PLATFORM(COCOA)
    835     void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const WebCore::FloatPoint& dragImageAnchor, bool isLinkDrag);
     835    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& dragImageAnchor, uint64_t action);
    836836    void setPromisedDataForImage(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
    837837                         const String& title, const String& url, const String& visibleURL, const SharedMemory::Handle& archiveHandle, uint64_t archiveSize);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r212608 r212669  
    303303#endif
    304304#if PLATFORM(COCOA) && ENABLE(DRAG_SUPPORT)
    305     SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, WebCore::FloatPoint dragImageAnchor, bool linkDrag)
     305    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, std::optional<WebCore::TextIndicatorData> textIndicator, WebCore::FloatPoint dragImageAnchor, uint64_t action)
    306306    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)
    307307#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h

    r212325 r212669  
    7979    void accessibilityWebProcessTokenReceived(const IPC::DataReference&) override;
    8080    bool executeSavedCommandBySelector(const String& selector) override;
    81     void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) override;
     81    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) override;
    8282    void updateSecureInputState() override;
    8383    void resetSecureInputState() override;
     
    205205    void didPerformDataInteractionControllerOperation() override;
    206206    void didHandleStartDataInteractionRequest(bool started) override;
    207     void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, const WebCore::FloatPoint& anchorPoint, bool isLink) override;
     207    void startDataInteractionWithImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData>, const WebCore::FloatPoint& anchorPoint, uint64_t action) override;
    208208#endif
    209209
  • trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm

    r212325 r212669  
    354354}
    355355
    356 void PageClientImpl::setDragImage(const IntPoint&, PassRefPtr<ShareableBitmap>, bool)
     356void PageClientImpl::setDragImage(const IntPoint&, PassRefPtr<ShareableBitmap>, DragSourceAction)
    357357{
    358358    notImplemented();
     
    774774}
    775775
    776 void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, const FloatPoint& anchorPoint, bool isLink)
    777 {
    778     [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) anchorPoint:anchorPoint isLink:isLink];
     776void PageClientImpl::startDataInteractionWithImage(const IntPoint& clientPosition, const ShareableBitmap::Handle& image, std::optional<WebCore::TextIndicatorData> indicatorData, const FloatPoint& anchorPoint, uint64_t action)
     777{
     778    [m_contentView _startDataInteractionWithImage:ShareableBitmap::create(image)->makeCGImageCopy() withIndicatorData:indicatorData atClientPosition:CGPointMake(clientPosition.x(), clientPosition.y()) anchorPoint:anchorPoint action:action];
    779779}
    780780#endif
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r212376 r212669  
    271271- (void)_didPerformDataInteractionControllerOperation;
    272272- (void)_didHandleStartDataInteractionRequest:(BOOL)started;
    273 - (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint isLink:(BOOL)isLink;
     273- (void)_startDataInteractionWithImage:(RetainPtr<CGImageRef>)image withIndicatorData:(std::optional<WebCore::TextIndicatorData>)indicatorData atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
    274274- (void)_simulateDataInteractionGestureRecognized:(UILongPressGestureRecognizer *)gestureRecognizer WK_API_AVAILABLE(ios(WK_IOS_TBA));
    275275- (void)_simulateDataInteractionEntered:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r212459 r212669  
    14421442
    14431443#if ENABLE(DATA_INTERACTION)
    1444     if (_positionInformation.hasDataInteractionAtPosition) {
     1444    if (_positionInformation.hasSelectionAtPosition) {
    14451445        // If the position might initiate a data interaction, we don't want to consider the content at this position to be selectable.
    14461446        // FIXME: This should be renamed to something more precise, such as textSelectionShouldRecognizeGestureAtPoint:
     
    14621462        return YES;
    14631463
    1464     return _positionInformation.hasDataInteractionAtPosition;
     1464    return _positionInformation.hasSelectionAtPosition;
    14651465}
    14661466
    14671467- (UILongPressGestureRecognizer *)_dataInteractionGestureRecognizer
    14681468{
    1469     if ([_webView._testingDelegate respondsToSelector:@selector(dataInteractionGestureRecognizer)])
    1470         return _webView._testingDelegate.dataInteractionGestureRecognizer;
    1471 
    14721469    return _dataInteractionGestureRecognizer.get();
    14731470}
     
    14881485
    14891486#if ENABLE(DATA_INTERACTION)
    1490     if (_positionInformation.hasDataInteractionAtPosition) {
     1487    if (_positionInformation.hasSelectionAtPosition) {
    14911488        // If the position might initiate data interaction, we don't want to change the selection.
    14921489        // FIXME: This should be renamed to something more precise, such as textInteractionShouldRecognizeGestureAtPoint:
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h

    r212325 r212669  
    9696    void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
    9797    bool executeSavedCommandBySelector(const String& selector) override;
    98     void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) override;
     98    void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) override;
    9999    void setPromisedDataForImage(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
    100100        const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) override;
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r212325 r212669  
    338338}
    339339
    340 void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
     340void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, DragSourceAction action)
    341341{
    342342    RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
     
    346346    [dragNSImage setSize:size];
    347347
    348     m_impl->dragImageForView(m_view, dragNSImage.get(), clientPosition, isLinkDrag);
     348    m_impl->dragImageForView(m_view, dragNSImage.get(), clientPosition, action == DragSourceActionLink);
    349349}
    350350
  • trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r212325 r212669  
    270270
    271271#if ENABLE(DRAG_SUPPORT)
    272 void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, const FloatPoint&, bool isLinkDrag)
     272void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, std::optional<TextIndicatorData>, const FloatPoint&, uint64_t action)
    273273{
    274274    if (auto dragImage = ShareableBitmap::create(dragImageHandle))
    275         m_pageClient.setDragImage(clientPosition, WTFMove(dragImage), isLinkDrag);
     275        m_pageClient.setDragImage(clientPosition, WTFMove(dragImage), static_cast<DragSourceAction>(action));
    276276
    277277    process().send(Messages::WebPage::DidStartDrag(), m_pageID);
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm

    r212379 r212669  
    9494
    9595    // FIXME: Seems this message should be named StartDrag, not SetDragImage.
    96     m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, { }, dragSourceAction == DragSourceActionLink));
     96    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, std::nullopt, { }, dragSourceAction));
    9797}
    9898
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r212342 r212669  
    25502550
    25512551#if ENABLE(DATA_INTERACTION)
    2552     info.hasDataInteractionAtPosition = m_page->hasDataInteractionAtPosition(adjustedPoint);
     2552    info.hasSelectionAtPosition = m_page->hasSelectionAtPosition(adjustedPoint);
    25532553#endif
    25542554    info.adjustedPointForNodeRespondingToClickEvents = adjustedPoint;
Note: See TracChangeset for help on using the changeset viewer.