Clicking a tel:// link on iPad with a trackpad presents different UI than tapping...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 May 2020 19:28:11 +0000 (19:28 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 May 2020 19:28:11 +0000 (19:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211686
<rdar://problem/57941589>

Reviewed by Wenson Hsieh.

Source/WebCore:

* dom/MouseRelatedEvent.h:
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::canPresentDataDetectorsUIForElement):
(WebCore::DataDetection::shouldCancelDefaultAction): Deleted.
Rename shouldCancelDefaultAction to canPresentDataDetectorsUIForElement.
This bit indicates whether a given element should invoke DD UI instead of
doing its default action, so either name is OK, but it feels better to
have it in the affirmative direction.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
Determine if tapping on an anchor should invoke DataDetectors UI instead
of performing the default action, and short-circuit if that is possible.

* loader/EmptyClients.h:
* page/ChromeClient.h:

Source/WebKit:

Previously, iOS WebKit had code in handleTap, handleTwoFingerTapAtPoint, and commitPotentialTap,
which introspected the hit element /before/ dispatching the tap (or synthetic click) to the DOM,
short circuiting all normal event handling machinery in order to prevent the default action
and present the Data Detectors UI for the given link.

There's one immediate problem with this, which is that there is no similar code in the direct
click event handler path, which we now use for trackpad/mouse input on iPad. There's also a
secondary problem (which we have not seen in practice), which is that pages cannot preventDefault
to avoid launching the Data Detectors UI on a link, like they could to prevent an ordinary
link from being followed.

In order to resolve both issues and reduce duplication of logic, move the code that introspects
the element and invokes Data Detectors UI from high-level WebKit event dispatch code (where it
doesn't really belong) down to WebCore's default click event handler for anchors, right next to
the code that would ordinarily cause a navigation. This way, no matter how we get here, whether
by synthetic click or real click, we'll invoke the Data Detectors UI.

One alternative considered at length: we could actually let the navigation happen, and instead
handle the switch in navigation policy code, but there are a few reasons that did not seem ideal:
1) We'd need to plumb platform-specific data structures through a ton of FrameLoader code.
2) Clients often block non-HTTP(S) navigations, so in order to keep the feature functional,
   we'd have to disregard the client's policy decision, defeating much of the purpose of making
   use of the navigation mechanism in the first place.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::showDataDetectorsUIForPositionInformation):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::showDataDetectorsUIForPositionInformation):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::showDataDetectorsUIForElement):
Plumb showDataDetectorsUIForPositionInformation from iOS WebKit's ChromeClient
implementation all the way to WKContentView.

* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showDataDetectorsUIForPositionInformation:]):
(-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
(-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
(-[WKActionSheetAssistant showDataDetectorsSheet]): Deleted.
Make it possible to push InteractionInformationAtPosition into WKActionSheetAssistant,
instead of having it always pull a fresh one upon invocation, so that we can use the
position information passed along with the showDataDetectorsUIForPositionInformation message.

(-[WKActionSheetAssistant _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
(-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):
Fix an existing bug where Data Detectors context menus would show extra default actions,
by moving our implementation of the -_contextMenuInteraction:overrideSuggestedActionsForConfiguration:
delegate here, sharing it with WKContentViewInteraction.

In a future patch, we should reconsider having three separate UIContextMenuInteractions.

Also, remove the contextMenuPresentationLocationForActionSheetAssistant: delegate,
since it will be wrong in the case of pushed-in position information, and instead
use the position information's original hit test point.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showDataDetectorsUI]):
(-[WKContentView _showDataDetectorsUIForPositionInformation:]):
(-[WKContentView _actionForLongPressFromPositionInformation:]):
(-[WKContentView _didNotHandleTapAsClick:]):
(-[WKContentView dataDetectionContextForPositionInformation:]):
(-[WKContentView dataDetectionContextForActionSheetAssistant:positionInformation:]):
(-[WKContentView _showDataDetectorsSheet]): Deleted.
(-[WKContentView currentPositionInformation]): Deleted.
(-[WKContentView dataDetectionContextForActionSheetAssistant:]): Deleted.
Instead of exposing an unnecessary -currentPositionInformation getter on WKActionSheetAssistant,
provide it as an argument to the WKActionSheetAssistantDelegate methods that actually need it.

(-[WKContentView contextMenuPresentationLocationForActionSheetAssistant:]): Deleted.
(-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
Adopt WKActionSheetAssistant's suggestedActions mechanism so we can share code.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
(-[WKPDFView dataDetectionContextForActionSheetAssistant:positionInformation:]):
(-[WKPDFView dataDetectionContextForActionSheetAssistant:]): Deleted.
Adapt to some WKActionSheetAssistantDelegate changes.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleTap):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTap):
Remove the aforementioned short-circuiting paths for Data Detectors links.

Source/WebKitLegacy/ios:

* WebCoreSupport/WebChromeClientIOS.h:

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

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/MouseRelatedEvent.h
Source/WebCore/editing/cocoa/DataDetection.h
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/ChromeClient.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/ios/PageClientImplIOS.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h
Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/UIProcess/ios/WKPDFView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h

index 1943d6a..8cc72ae 100644 (file)
@@ -1,3 +1,29 @@
+2020-05-10  Tim Horton  <timothy_horton@apple.com>
+
+        Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it
+        https://bugs.webkit.org/show_bug.cgi?id=211686
+        <rdar://problem/57941589>
+
+        Reviewed by Wenson Hsieh.
+
+        * dom/MouseRelatedEvent.h:
+        * editing/cocoa/DataDetection.h:
+        * editing/cocoa/DataDetection.mm:
+        (WebCore::DataDetection::canPresentDataDetectorsUIForElement):
+        (WebCore::DataDetection::shouldCancelDefaultAction): Deleted.
+        Rename shouldCancelDefaultAction to canPresentDataDetectorsUIForElement.
+        This bit indicates whether a given element should invoke DD UI instead of
+        doing its default action, so either name is OK, but it feels better to
+        have it in the affirmative direction.
+
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::handleClick):
+        Determine if tapping on an anchor should invoke DataDetectors UI instead
+        of performing the default action, and short-circuit if that is possible.
+
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+
 2020-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [macOS] Search field on mayoclinic.org/forms/us-resident-appointment clips the submit button
index 8fc79c2..d8f1a40 100644 (file)
@@ -61,7 +61,7 @@ public:
     void setIsSimulated(bool value) { m_isSimulated = value; }
     int pageX() const final;
     int pageY() const final;
-    FloatPoint locationInRootViewCoordinates() const;
+    WEBCORE_EXPORT FloatPoint locationInRootViewCoordinates() const;
     virtual const LayoutPoint& pageLocation() const;
     WEBCORE_EXPORT int x() const;
     WEBCORE_EXPORT int y() const;
index 39bbb1f..7ff998d 100644 (file)
@@ -67,7 +67,7 @@ public:
     WEBCORE_EXPORT static bool canBePresentedByDataDetectors(const URL&);
     WEBCORE_EXPORT static bool isDataDetectorLink(Element&);
     WEBCORE_EXPORT static String dataDetectorIdentifier(Element&);
-    WEBCORE_EXPORT static bool shouldCancelDefaultAction(Element&);
+    WEBCORE_EXPORT static bool canPresentDataDetectorsUIForElement(Element&);
     WEBCORE_EXPORT static bool requiresExtendedContext(Element&);
 #endif
 
index a26d83b..084edbf 100644 (file)
@@ -183,7 +183,7 @@ String DataDetection::dataDetectorIdentifier(Element& element)
     return element.attributeWithoutSynchronization(x_apple_data_detectors_resultAttr);
 }
 
-bool DataDetection::shouldCancelDefaultAction(Element& element)
+bool DataDetection::canPresentDataDetectorsUIForElement(Element& element)
 {
     if (!isDataDetectorLink(element))
         return false;
index 6fc9b47..00b78eb 100644 (file)
@@ -25,6 +25,8 @@
 #include "HTMLAnchorElement.h"
 
 #include "AdClickAttribution.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
 #include "DOMTokenList.h"
 #include "ElementIterator.h"
 #include "EventHandler.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringConcatenateNumbers.h>
 
+#if PLATFORM(COCOA)
+#include "DataDetection.h"
+#endif
+
 namespace WebCore {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLAnchorElement);
@@ -466,6 +472,15 @@ void HTMLAnchorElement::handleClick(Event& event)
     appendServerMapMousePosition(url, event);
     URL completedURL = document().completeURL(url.toString());
 
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS_FAMILY)
+    if (DataDetection::isDataDetectorLink(*this) && DataDetection::canPresentDataDetectorsUIForElement(*this)) {
+        if (auto* page = document().page()) {
+            if (page->chrome().client().showDataDetectorsUIForElement(*this, event))
+                return;
+        }
+    }
+#endif
+
     String downloadAttribute;
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
     if (RuntimeEnabledFeatures::sharedFeatures().downloadAttributeEnabled()) {
index b8d1116..71d4e54 100644 (file)
@@ -178,8 +178,10 @@ class EmptyChromeClient : public ChromeClient {
     void addOrUpdateScrollingLayer(Node*, PlatformLayer*, PlatformLayer*, const IntSize&, bool, bool) final { }
     void removeScrollingLayer(Node*, PlatformLayer*, PlatformLayer*) final { }
 
-    void webAppOrientationsUpdated() final { };
-    void showPlaybackTargetPicker(bool, RouteSharingPolicy, const String&) final { };
+    void webAppOrientationsUpdated() final { }
+    void showPlaybackTargetPicker(bool, RouteSharingPolicy, const String&) final { }
+
+    bool showDataDetectorsUIForElement(const Element&, const Event&) final { return false; }
 #endif // PLATFORM(IOS_FAMILY)
 
 #if ENABLE(ORIENTATION_EVENTS)
index 4b1aede..eb092b8 100644 (file)
@@ -272,6 +272,8 @@ public:
 
     virtual void webAppOrientationsUpdated() = 0;
     virtual void showPlaybackTargetPicker(bool hasVideo, RouteSharingPolicy, const String&) = 0;
+
+    virtual bool showDataDetectorsUIForElement(const Element&, const Event&) = 0;
 #endif
 
 #if ENABLE(ORIENTATION_EVENTS)
index ae23b23..c1b78d2 100644 (file)
@@ -1,3 +1,101 @@
+2020-05-10  Tim Horton  <timothy_horton@apple.com>
+
+        Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it
+        https://bugs.webkit.org/show_bug.cgi?id=211686
+        <rdar://problem/57941589>
+
+        Reviewed by Wenson Hsieh.
+
+        Previously, iOS WebKit had code in handleTap, handleTwoFingerTapAtPoint, and commitPotentialTap,
+        which introspected the hit element /before/ dispatching the tap (or synthetic click) to the DOM,
+        short circuiting all normal event handling machinery in order to prevent the default action
+        and present the Data Detectors UI for the given link.
+
+        There's one immediate problem with this, which is that there is no similar code in the direct
+        click event handler path, which we now use for trackpad/mouse input on iPad. There's also a
+        secondary problem (which we have not seen in practice), which is that pages cannot preventDefault
+        to avoid launching the Data Detectors UI on a link, like they could to prevent an ordinary
+        link from being followed.
+
+        In order to resolve both issues and reduce duplication of logic, move the code that introspects
+        the element and invokes Data Detectors UI from high-level WebKit event dispatch code (where it
+        doesn't really belong) down to WebCore's default click event handler for anchors, right next to
+        the code that would ordinarily cause a navigation. This way, no matter how we get here, whether
+        by synthetic click or real click, we'll invoke the Data Detectors UI.
+
+        One alternative considered at length: we could actually let the navigation happen, and instead
+        handle the switch in navigation policy code, but there are a few reasons that did not seem ideal:
+        1) We'd need to plumb platform-specific data structures through a ton of FrameLoader code.
+        2) Clients often block non-HTTP(S) navigations, so in order to keep the feature functional,
+           we'd have to disregard the client's policy decision, defeating much of the purpose of making
+           use of the navigation mechanism in the first place.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::showDataDetectorsUIForPositionInformation):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::showDataDetectorsUIForPositionInformation):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::showDataDetectorsUIForElement):
+        Plumb showDataDetectorsUIForPositionInformation from iOS WebKit's ChromeClient
+        implementation all the way to WKContentView.
+
+        * UIProcess/ios/WKActionSheetAssistant.h:
+        * UIProcess/ios/WKActionSheetAssistant.mm:
+        (-[WKActionSheetAssistant showDataDetectorsUIForPositionInformation:]):
+        (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
+        (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
+        (-[WKActionSheetAssistant showDataDetectorsSheet]): Deleted.
+        Make it possible to push InteractionInformationAtPosition into WKActionSheetAssistant,
+        instead of having it always pull a fresh one upon invocation, so that we can use the
+        position information passed along with the showDataDetectorsUIForPositionInformation message.
+
+        (-[WKActionSheetAssistant _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
+        (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):
+        Fix an existing bug where Data Detectors context menus would show extra default actions,
+        by moving our implementation of the -_contextMenuInteraction:overrideSuggestedActionsForConfiguration:
+        delegate here, sharing it with WKContentViewInteraction.
+
+        In a future patch, we should reconsider having three separate UIContextMenuInteractions.
+
+        Also, remove the contextMenuPresentationLocationForActionSheetAssistant: delegate,
+        since it will be wrong in the case of pushed-in position information, and instead
+        use the position information's original hit test point.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _showDataDetectorsUI]):
+        (-[WKContentView _showDataDetectorsUIForPositionInformation:]):
+        (-[WKContentView _actionForLongPressFromPositionInformation:]):
+        (-[WKContentView _didNotHandleTapAsClick:]):
+        (-[WKContentView dataDetectionContextForPositionInformation:]):
+        (-[WKContentView dataDetectionContextForActionSheetAssistant:positionInformation:]):
+        (-[WKContentView _showDataDetectorsSheet]): Deleted.
+        (-[WKContentView currentPositionInformation]): Deleted.
+        (-[WKContentView dataDetectionContextForActionSheetAssistant:]): Deleted.
+        Instead of exposing an unnecessary -currentPositionInformation getter on WKActionSheetAssistant,
+        provide it as an argument to the WKActionSheetAssistantDelegate methods that actually need it.
+
+        (-[WKContentView contextMenuPresentationLocationForActionSheetAssistant:]): Deleted.
+        (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
+        Adopt WKActionSheetAssistant's suggestedActions mechanism so we can share code.
+
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
+        (-[WKPDFView dataDetectionContextForActionSheetAssistant:positionInformation:]):
+        (-[WKPDFView dataDetectionContextForActionSheetAssistant:]): Deleted.
+        Adapt to some WKActionSheetAssistantDelegate changes.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleTap):
+        (WebKit::WebPage::handleTwoFingerTapAtPoint):
+        (WebKit::WebPage::commitPotentialTap):
+        Remove the aforementioned short-circuiting paths for Data Detectors links.
 2020-05-09  David Kilzer  <ddkilzer@apple.com>
 
         Attempt #2 to fix internal iOS build
index 5767885..34d9741 100644 (file)
@@ -412,6 +412,7 @@ public:
     virtual void positionInformationDidChange(const InteractionInformationAtPosition&) = 0;
     virtual void saveImageToLibrary(Ref<WebCore::SharedBuffer>&&) = 0;
     virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&) = 0;
+    virtual void showDataDetectorsUIForPositionInformation(const InteractionInformationAtPosition&) = 0;
     virtual void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) = 0;
     virtual void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) = 0;
     virtual double minimumZoomScale() const = 0;
index 2dd33e3..0178781 100644 (file)
@@ -819,6 +819,7 @@ public:
     void updateSelectionWithDelta(int64_t locationDelta, int64_t lengthDelta, CompletionHandler<void()>&&);
     void requestDocumentEditingContext(WebKit::DocumentEditingContextRequest, CompletionHandler<void(WebKit::DocumentEditingContext)>&&);
     void generateSyntheticEditingCommand(SyntheticEditingCommandType);
+    void showDataDetectorsUIForPositionInformation(const InteractionInformationAtPosition&);
 #if ENABLE(DRAG_SUPPORT)
     void didHandleDragStartRequest(bool started);
     void didHandleAdditionalDragItemsRequest(bool added);
index 8f80ba4..d120211 100644 (file)
@@ -426,6 +426,8 @@ messages -> WebPageProxy {
 
     UpdateStringForFind(String findString)
     HandleAutocorrectionContext(struct WebKit::WebAutocorrectionContext context)
+
+    ShowDataDetectorsUIForPositionInformation(struct WebKit::InteractionInformationAtPosition information)
 #endif
 
     DidChangeInspectorFrontendCount(uint64_t count)
index ae758d4..7a9377a 100644 (file)
@@ -168,6 +168,7 @@ private:
     void positionInformationDidChange(const InteractionInformationAtPosition&) override;
     void saveImageToLibrary(Ref<WebCore::SharedBuffer>&&) override;
     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&) override;
+    void showDataDetectorsUIForPositionInformation(const InteractionInformationAtPosition&) override;
 
     bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, const FrameInfoData&, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;
     bool showShareSheet(const WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) override;
index 574be22..971996c 100644 (file)
@@ -947,6 +947,11 @@ void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect&, uint6
     notImplemented();
 }
 
+void PageClientImpl::showDataDetectorsUIForPositionInformation(const InteractionInformationAtPosition& positionInformation)
+{
+    [m_contentView _showDataDetectorsUIForPositionInformation:positionInformation];
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(IOS_FAMILY)
index 75dc692..97113ff 100644 (file)
@@ -36,6 +36,7 @@ class WebPageProxy;
 struct InteractionInformationAtPosition;
 }
 
+@class UIMenuElement;
 @class UITargetedPreview;
 @class WKActionSheetAssistant;
 @class _WKActivatedElementInfo;
@@ -60,10 +61,9 @@ struct InteractionInformationAtPosition;
 - (CGRect)unoccludedWindowBoundsForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant willStartInteractionWithElement:(_WKActivatedElementInfo *)element;
 - (void)actionSheetAssistantDidStopInteraction:(WKActionSheetAssistant *)assistant;
-- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
+- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant positionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
 - (NSString *)selectedTextForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant getAlternateURLForImage:(UIImage *)image completion:(void (^)(NSURL *alternateURL, NSDictionary *userInfo))completion;
-- (CGPoint)contextMenuPresentationLocationForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 #if USE(UICONTEXTMENU)
 - (UITargetedPreview *)createTargetedContextMenuHintForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 - (void)removeContextMenuViewIfPossibleForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
@@ -82,7 +82,7 @@ struct InteractionInformationAtPosition;
 - (id)initWithView:(UIView *)view;
 - (void)showLinkSheet;
 - (void)showImageSheet;
-- (void)showDataDetectorsSheet;
+- (void)showDataDetectorsUIForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
 - (void)cleanupSheet;
 - (void)updateSheetPosition;
 - (RetainPtr<NSArray<_WKElementAction *>>)defaultActionsForLinkSheet:(_WKActivatedElementInfo *)elementInfo;
@@ -90,7 +90,7 @@ struct InteractionInformationAtPosition;
 - (BOOL)isShowingSheet;
 - (void)interactionDidStartWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)information;
 - (NSArray *)currentAvailableActionTitles;
-- (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation;
+- (NSArray<UIMenuElement *> *)suggestedActionsForContextMenuWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
 @end
 
 #endif // PLATFORM(IOS_FAMILY)
index 5556b35..2229a9b 100644 (file)
@@ -660,14 +660,13 @@ ALLOW_DEPRECATED_DECLARATIONS_END
 }
 #endif
 
-- (void)showDataDetectorsSheet
+- (void)showDataDetectorsUIForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
 {
 #if ENABLE(DATA_DETECTION)
     if (!_delegate)
         return;
 
-    if (![self synchronouslyRetrievePositionInformation])
-        return;
+    _positionInformation = positionInformation;
 
     if (!WebCore::DataDetection::canBePresentedByDataDetectors(_positionInformation->url))
         return;
@@ -680,8 +679,8 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     NSDictionary *context = nil;
     NSString *textAtSelection = nil;
 
-    if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)])
-        context = [_delegate dataDetectionContextForActionSheetAssistant:self];
+    if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:positionInformation:)])
+        context = [_delegate dataDetectionContextForActionSheetAssistant:self positionInformation:*_positionInformation];
     if ([_delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)])
         textAtSelection = [_delegate selectedTextForActionSheetAssistant:self];
 
@@ -696,15 +695,10 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     if ([dataDetectorsActions count] == 0)
         return;
     
-#if ENABLE(DATA_DETECTION) && USE(UICONTEXTMENU) && HAVE(UICONTEXTMENU_LOCATION)
-    auto delegate = _delegate.get();
-    if ([delegate respondsToSelector:@selector(contextMenuPresentationLocationForActionSheetAssistant:)]) {
-        [self ensureContextMenuInteraction];
-        [_dataDetectorContextMenuInteraction _presentMenuAtLocation:[delegate contextMenuPresentationLocationForActionSheetAssistant:self]];
-        return;
-    }
-#endif
-
+#if USE(UICONTEXTMENU) && HAVE(UICONTEXTMENU_LOCATION)
+    [self ensureContextMenuInteraction];
+    [_dataDetectorContextMenuInteraction _presentMenuAtLocation:_positionInformation->request.point];
+#else
     NSMutableArray *elementActions = [NSMutableArray array];
     for (NSUInteger actionNumber = 0; actionNumber < [dataDetectorsActions count]; actionNumber++) {
         DDAction *action = [dataDetectorsActions objectAtIndex:actionNumber];
@@ -723,6 +717,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     if (![_interactionSheet presentSheet:WKActionSheetPresentAtTouchLocation])
         [self cleanupSheet];
 #endif
+#endif // ENABLE(DATA_DETECTION)
 }
 
 #if USE(UICONTEXTMENU) && ENABLE(DATA_DETECTION)
@@ -732,15 +727,14 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     NSDictionary *context = nil;
     NSString *textAtSelection = nil;
 
-    if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)])
-        context = [_delegate dataDetectionContextForActionSheetAssistant:self];
+    if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:positionInformation:)])
+        context = [_delegate dataDetectionContextForActionSheetAssistant:self positionInformation:*_positionInformation];
     if ([_delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)])
         textAtSelection = [_delegate selectedTextForActionSheetAssistant:self];
 
     NSDictionary *newContext = nil;
     DDResultRef ddResult = [controller resultForURL:_positionInformation->url identifier:_positionInformation->dataDetectorIdentifier selectedText:textAtSelection results:_positionInformation->dataDetectorResults.get() context:context extendedContext:&newContext];
 
-
     CGRect sourceRect;
     if (_positionInformation->isLink)
         sourceRect = _positionInformation->linkIndicator.textBoundingRectInRootViewCoordinates;
@@ -758,13 +752,11 @@ ALLOW_DEPRECATED_DECLARATIONS_END
 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForHighlightingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
 {
     auto delegate = _delegate.get();
-    CGPoint center = CGPointZero;
+    CGPoint center = _positionInformation->request.point;
     
     if ([delegate respondsToSelector:@selector(createTargetedContextMenuHintForActionSheetAssistant:)])
         return [delegate createTargetedContextMenuHintForActionSheetAssistant:self];
     
-    if ([delegate respondsToSelector:@selector(contextMenuPresentationLocationForActionSheetAssistant:)])
-        center = [delegate contextMenuPresentationLocationForActionSheetAssistant:self];
     RetainPtr<UIPreviewParameters> unusedPreviewParameters = adoptNS([[UIPreviewParameters alloc] init]);
     RetainPtr<UIPreviewTarget> previewTarget = adoptNS([[UIPreviewTarget alloc] initWithContainer:_view.getAutoreleased() center:center]);
     RetainPtr<UITargetedPreview> preview = adoptNS([[UITargetedPreview alloc] initWithView:_view.getAutoreleased() parameters:unusedPreviewParameters.get() target:previewTarget.get()]);
@@ -784,6 +776,34 @@ ALLOW_DEPRECATED_DECLARATIONS_END
         [self removeContextMenuInteraction];
     }];
 }
+
+static NSArray<UIMenuElement *> *menuElementsFromDefaultActions(RetainPtr<NSArray> defaultElementActions, RetainPtr<_WKActivatedElementInfo> elementInfo)
+{
+    if (![defaultElementActions count])
+        return nil;
+
+    auto actions = [NSMutableArray arrayWithCapacity:[defaultElementActions count]];
+    for (_WKElementAction *elementAction in defaultElementActions.get())
+        [actions addObject:[elementAction uiActionForElementInfo:elementInfo.get()]];
+
+    return actions;
+}
+
+- (NSArray<UIMenuElement *> *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction overrideSuggestedActionsForConfiguration:(UIContextMenuConfiguration *)configuration
+{
+    if (!_positionInformation)
+        return nil;
+    return [self suggestedActionsForContextMenuWithPositionInformation:*_positionInformation];
+}
+
+- (NSArray<UIMenuElement *> *)suggestedActionsForContextMenuWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
+{
+    auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:positionInformation userInfo:nil]);
+    RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = positionInformation.isLink ? [self defaultActionsForLinkSheet:elementInfo.get()] : [self defaultActionsForImageSheet:elementInfo.get()];
+    return menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
+
+}
+
 #endif
 
 - (void)cleanupSheet
index 9412bbd..7abc3e2 100644 (file)
@@ -530,7 +530,8 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
 - (void)_accessibilityClearSelection;
 - (WKFormInputSession *)_formInputSession;
 - (void)_didChangeWebViewEditability;
-- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation;
+- (NSDictionary *)dataDetectionContextForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
+- (void)_showDataDetectorsUIForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
 
 - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction;
 
@@ -549,7 +550,6 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
 
 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
 
-@property (nonatomic, readonly) WebKit::InteractionInformationAtPosition currentPositionInformation;
 - (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request;
 - (BOOL)ensurePositionInformationIsUpToDate:(WebKit::InteractionInformationRequest)request;
 
index 1d664a4..df6c05b 100644 (file)
@@ -2148,9 +2148,14 @@ static Class tapAndAHalfRecognizerClass()
     [_actionSheetAssistant showLinkSheet];
 }
 
-- (void)_showDataDetectorsSheet
+- (void)_showDataDetectorsUI
 {
-    [_actionSheetAssistant showDataDetectorsSheet];
+    [self _showDataDetectorsUIForPositionInformation:_positionInformation];
+}
+
+- (void)_showDataDetectorsUIForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
+{
+    [_actionSheetAssistant showDataDetectorsUIForPositionInformation:positionInformation];
 }
 
 - (SEL)_actionForLongPressFromPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
@@ -2167,7 +2172,7 @@ static Class tapAndAHalfRecognizerClass()
     if (positionInformation.isLink) {
 #if ENABLE(DATA_DETECTION)
         if (WebCore::DataDetection::canBePresentedByDataDetectors(positionInformation.url))
-            return @selector(_showDataDetectorsSheet);
+            return @selector(_showDataDetectorsUI);
 #endif
         return @selector(_showLinkSheet);
     }
@@ -2182,11 +2187,6 @@ static Class tapAndAHalfRecognizerClass()
     return [self _actionForLongPressFromPositionInformation:_positionInformation];
 }
 
-- (WebKit::InteractionInformationAtPosition)currentPositionInformation
-{
-    return _positionInformation;
-}
-
 - (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request
 {
     if ([self _currentPositionInformationIsValidForRequest:request]) {
@@ -2723,15 +2723,6 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
 {
     [self _resetInputViewDeferral];
 
-    // FIXME: we should also take into account whether or not the UI delegate
-    // has handled this notification.
-#if ENABLE(DATA_DETECTION)
-    if (_hasValidPositionInformation && point == _positionInformation.request.point && _positionInformation.isDataDetectorLink) {
-        [self _showDataDetectorsSheet];
-        return;
-    }
-#endif
-
     if (!_isDoubleTapPending)
         return;
 
@@ -6904,7 +6895,7 @@ static BOOL allPasteboardItemOriginsMatchOrigin(UIPasteboard *pasteboard, const
     _page->stopInteraction();
 }
 
-- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation
+- (NSDictionary *)dataDetectionContextForPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
 {
     RetainPtr<NSMutableDictionary> context;
     id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);
@@ -6933,9 +6924,9 @@ static BOOL allPasteboardItemOriginsMatchOrigin(UIPasteboard *pasteboard, const
 #endif
 }
 
-- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
+- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant positionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
 {
-    return [self dataDetectionContextForPositionInformation:assistant.currentPositionInformation.valueOr(_positionInformation)];
+    return [self dataDetectionContextForPositionInformation:positionInformation];
 }
 
 - (NSString *)selectedTextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
@@ -6954,11 +6945,6 @@ static BOOL allPasteboardItemOriginsMatchOrigin(UIPasteboard *pasteboard, const
         completion(nil, nil);
 }
 
-- (CGPoint)contextMenuPresentationLocationForActionSheetAssistant:(WKActionSheetAssistant *)assistant
-{
-    return [self lastInteractionLocation];
-}
-
 #if USE(UICONTEXTMENU)
 
 - (UITargetedPreview *)createTargetedContextMenuHintForActionSheetAssistant:(WKActionSheetAssistant *)assistant
@@ -9211,13 +9197,11 @@ static UIMenu *menuFromLegacyPreviewOrDefaultActions(UIViewController *previewVi
 
 - (NSArray<UIMenuElement *> *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction overrideSuggestedActionsForConfiguration:(UIContextMenuConfiguration *)configuration
 {
-    if (_contextMenuActionProviderDelegateNeedsOverride) {
-        auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:_positionInformation userInfo:nil]);
-        RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = _positionInformation.isLink ? [_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()] : [_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
-        return menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
-    }
     // If we're here we're in the legacy path, which ignores the suggested actions anyway.
-    return nil;
+    if (!_contextMenuActionProviderDelegateNeedsOverride)
+        return nil;
+
+    return [_actionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:_positionInformation];
 }
 
 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForHighlightingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
index 06b4e9f..10418f9 100644 (file)
@@ -485,12 +485,15 @@ static NSStringCompareOptions stringCompareOptions(_WKFindOptions findOptions)
     positionInformation.url = url;
 
     _positionInformation = WTFMove(positionInformation);
+
 #if ENABLE(DATA_DETECTION)
-    if (WebCore::DataDetection::canBePresentedByDataDetectors(_positionInformation.url))
-        [_actionSheetAssistant showDataDetectorsSheet];
-    else
+    if (WebCore::DataDetection::canBePresentedByDataDetectors(_positionInformation.url)) {
+        [_actionSheetAssistant showDataDetectorsUIForPositionInformation:positionInformation];
+        return;
+    }
 #endif
-        [_actionSheetAssistant showLinkSheet];
+
+    [_actionSheetAssistant showLinkSheet];
 }
 
 - (void)pdfHostViewController:(PDFHostViewController *)controller didLongPressURL:(NSURL *)url atLocation:(CGPoint)location withAnnotationRect:(CGRect)annotationRect
@@ -582,7 +585,7 @@ static NSStringCompareOptions stringCompareOptions(_WKFindOptions findOptions)
     return page->uiClient().actionsForElement(element, WTFMove(defaultActions));
 }
 
-- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
+- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant positionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
 {
     auto webView = _webView.getAutoreleased();
     if (!webView)
index 41270eb..d329227 100644 (file)
@@ -1621,6 +1621,12 @@ void WebPageProxy::setDeviceHasAGXCompilerServiceForTesting() const
     WebCore::setDeviceHasAGXCompilerServiceForTesting();
 }
 
+void WebPageProxy::showDataDetectorsUIForPositionInformation(const InteractionInformationAtPosition& positionInfo)
+{
+    pageClient().showDataDetectorsUIForPositionInformation(positionInfo);
+}
+
+
 } // namespace WebKit
 
 #undef RELEASE_LOG_IF_ALLOWED
index a5f5fe4..7eae3d3 100644 (file)
@@ -185,6 +185,8 @@ private:
     void didDestroyEditableImage(WebCore::GraphicsLayer::EmbeddedViewID) final;
 
     bool shouldUseMouseEventForSelection(const WebCore::PlatformMouseEvent&) final;
+
+    bool showDataDetectorsUIForElement(const WebCore::Element&, const WebCore::Event&) final;
 #endif
 
 #if ENABLE(ORIENTATION_EVENTS)
index 97c714d..8961f5b 100644 (file)
@@ -30,6 +30,8 @@
 
 #import "DrawingArea.h"
 #import "EditableImageControllerMessages.h"
+#import "InteractionInformationAtPosition.h"
+#import "InteractionInformationRequest.h"
 #import "UIKitSPI.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebFrame.h"
@@ -39,6 +41,7 @@
 #import <WebCore/AudioSession.h>
 #import <WebCore/ContentChangeObserver.h>
 #import <WebCore/Icon.h>
+#import <WebCore/MouseEvent.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/PlatformMouseEvent.h>
 #import <wtf/RefPtr.h>
@@ -193,6 +196,18 @@ bool WebChromeClient::shouldUseMouseEventForSelection(const WebCore::PlatformMou
 #endif
 }
 
+bool WebChromeClient::showDataDetectorsUIForElement(const Element& element, const Event& event)
+{
+    if (!event.isMouseEvent())
+        return false;
+
+    // FIXME: Ideally, we would be able to generate InteractionInformationAtPosition without re-hit-testing the element.
+    auto& mouseEvent = downcast<MouseEvent>(event);
+    auto positionInformation = m_page.positionInformation(InteractionInformationRequest { roundedIntPoint(mouseEvent.locationInRootViewCoordinates()) });
+    m_page.send(Messages::WebPageProxy::ShowDataDetectorsUIForPositionInformation(positionInformation));
+    return true;
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(IOS_FAMILY)
index 49caf46..3ddab9a 100644 (file)
@@ -1292,6 +1292,9 @@ public:
     // These include layout overflow for overflow:visible elements, but exclude borders.
     static WebCore::IntRect absoluteInteractionBoundsForElement(const WebCore::Element&);
     static WebCore::IntRect rootViewInteractionBoundsForElement(const WebCore::Element&);
+
+    InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
+    
 #endif // PLATFORM(IOS_FAMILY)
 
 #if USE(QUICK_LOOK)
@@ -1368,7 +1371,6 @@ private:
     void dispatchSyntheticMouseEventsForSelectionGesture(SelectionTouch, const WebCore::IntPoint&);
 
     void sendPositionInformation(InteractionInformationAtPosition&&);
-    InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
     RefPtr<ShareableBitmap> shareableBitmapSnapshotForNode(WebCore::Element&);
     WebAutocorrectionContext autocorrectionContext();
     bool applyAutocorrectionInternal(const String& correction, const String& originalText);
index b7bed03..784c50d 100644 (file)
@@ -869,13 +869,6 @@ void WebPage::handleTap(const IntPoint& point, OptionSet<WebEvent::Modifier> mod
 
     if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad())
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(adjustedIntPoint));
-#if ENABLE(DATA_DETECTION)
-    else if (is<Element>(*nodeRespondingToClick) && DataDetection::shouldCancelDefaultAction(downcast<Element>(*nodeRespondingToClick))) {
-        InteractionInformationRequest request(adjustedIntPoint);
-        requestPositionInformation(request);
-        send(Messages::WebPageProxy::DidNotHandleTapAsClick(adjustedIntPoint));
-    }
-#endif
     else
         handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers);
 }
@@ -1077,14 +1070,7 @@ void WebPage::handleTwoFingerTapAtPoint(const WebCore::IntPoint& point, OptionSe
         return;
     }
     sendTapHighlightForNodeIfNecessary(requestID, nodeRespondingToClick);
-#if ENABLE(DATA_DETECTION)
-    if (is<Element>(*nodeRespondingToClick) && DataDetection::shouldCancelDefaultAction(downcast<Element>(*nodeRespondingToClick))) {
-        InteractionInformationRequest request(roundedIntPoint(adjustedPoint));
-        requestPositionInformation(request);
-        send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(adjustedPoint)));
-    } else
-#endif
-        completeSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, WebCore::TwoFingerTap);
+    completeSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, WebCore::TwoFingerTap);
 }
 
 void WebPage::handleStylusSingleTapAtPoint(const WebCore::IntPoint& point, uint64_t requestID)
@@ -1168,16 +1154,9 @@ void WebPage::commitPotentialTap(OptionSet<WebEvent::Modifier> modifiers, Transa
         return;
     }
 
-    if (m_potentialTapNode == nodeRespondingToClick) {
-#if ENABLE(DATA_DETECTION)
-        if (is<Element>(*nodeRespondingToClick) && DataDetection::shouldCancelDefaultAction(downcast<Element>(*nodeRespondingToClick))) {
-            InteractionInformationRequest request(roundedIntPoint(m_potentialTapLocation));
-            requestPositionInformation(request);
-            commitPotentialTapFailed();
-        } else
-#endif
-            handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, pointerId);
-    } else
+    if (m_potentialTapNode == nodeRespondingToClick)
+        handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, pointerId);
+    else
         commitPotentialTapFailed();
 
     m_potentialTapNode = nullptr;
index 71e0de4..13a18e5 100644 (file)
@@ -1,3 +1,13 @@
+2020-05-10  Tim Horton  <timothy_horton@apple.com>
+
+        Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it
+        https://bugs.webkit.org/show_bug.cgi?id=211686
+        <rdar://problem/57941589>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+
 2020-04-11  Darin Adler  <darin@apple.com>
 
         Stop using live ranges in functions that return range of the selection
index b8b7526..a92baa6 100644 (file)
@@ -97,6 +97,8 @@ private:
     void showPlaybackTargetPicker(bool hasVideo, WebCore::RouteSharingPolicy, const String&) final;
     RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) final;
 
+    bool showDataDetectorsUIForElement(const WebCore::Element&, const WebCore::Event&) final { return false; }
+
 #if ENABLE(ORIENTATION_EVENTS)
     int deviceOrientation() const final;
 #endif