Long pressing a phone number with spaces in it results in a link sheet instead of...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 17:44:17 +0000 (17:44 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 17:44:17 +0000 (17:44 +0000)
commit74b5395f73d88914b9a23cff121cc09fc8e33337
treeb208807037e92b385045656dd29fb218d6543561
parent39a57e56ffb4da2f756621c67371fc4aac391e3e
Long pressing a phone number with spaces in it results in a link sheet instead of a data detectors sheet
https://bugs.webkit.org/show_bug.cgi?id=179646
<rdar://problem/35337288>

Reviewed by Simon Fraser.

Source/WebCore:

* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::canBePresentedByDataDetectors):
(WebCore::DataDetection::isDataDetectorLink):
Expose canBePresentedByDataDetectors, which tests if the URL's
scheme is one of Data Detectors' known long-press schemes.

Source/WebKit:

* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]):
(-[WKActionSheetAssistant showLinkSheet]):
(-[WKActionSheetAssistant showDataDetectorsSheet]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _actionForLongPressFromPositionInformation:]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
Make use of canBePresentedByDataDetectors with our WebCore URL instead
of (sometimes unsucessfully) reparsing the URL with NSURL's parser.
Also, avoid a few unnecessary round-trips through String when converting
from URL to NSURL.

Tools:

* TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
(-[ActionSheetObserver _dataDetectionContextForWebView:]):
(TestWebKitAPI::TEST):
Add a test that ensures that a phone number with spaces in it
invokes a data detectors sheet, not a normal link sheet.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/DataDetection.h
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm