⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 233589 in webkit


Ignore:
Timestamp:
Jul 6, 2018, 1:13:22 PM (8 years ago)
Author:
aestes@apple.com
Message:

[iOS] WKPDFView should show the Data Detectors sheet when long-pressing a URL that Data Detectors can handle
​https://bugs.webkit.org/show_bug.cgi?id=187396
<rdar://problem/41786980>

Reviewed by Dan Bernstein.

If a URL can be presented by Data Detectors, show the Data Detectors sheet instead
of the link sheet. Also implement the optional WKActionSheetAssistantDelegate
method that asks the UI delegate for its data detection context.

  • UIProcess/ios/WKPDFView.mm:

(-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
(-[WKPDFView dataDetectionContextForActionSheetAssistant:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r233587 r233589  
     12018-07-06  Andy Estes  <aestes@apple.com>
     2
     3        [iOS] WKPDFView should show the Data Detectors sheet when long-pressing a URL that Data Detectors can handle
     4        https://bugs.webkit.org/show_bug.cgi?id=187396
     5        <rdar://problem/41786980>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        If a URL can be presented by Data Detectors, show the Data Detectors sheet instead
     10        of the link sheet. Also implement the optional WKActionSheetAssistantDelegate
     11        method that asks the UI delegate for its data detection context.
     12
     13        * UIProcess/ios/WKPDFView.mm:
     14        (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
     15        (-[WKPDFView dataDetectionContextForActionSheetAssistant:]):
     16
    1172018-07-06  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm

    r233501 r233589  
    3333#import "PDFKitSPI.h"
    3434#import "WKActionSheetAssistant.h"
     35#import "WKUIDelegatePrivate.h"
    3536#import "WKWebViewInternal.h"
    3637#import "WebPageProxy.h"
    3738#import "_WKWebViewPrintFormatterInternal.h"
    3839#import <MobileCoreServices/MobileCoreServices.h>
     40#import <WebCore/DataDetection.h>
    3941#import <WebCore/WebCoreNSURLExtras.h>
    4042#import <wtf/BlockPtr.h>
    … …  
    440442
    441443    _positionInformation = WTFMove(positionInformation);
    442     [_actionSheetAssistant showLinkSheet];
     444#if ENABLE(DATA_DETECTION)
     445    if (WebCore::DataDetection::canBePresentedByDataDetectors(_positionInformation.url))
     446        [_actionSheetAssistant showDataDetectorsSheet];
     447    else
     448#endif
     449        [_actionSheetAssistant showLinkSheet];
    443450}
    444451
    … …  
    514521}
    515522
     523- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
     524{
     525    auto webView = _webView.getAutoreleased();
     526    if (!webView)
     527        return nil;
     528
     529    id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>(webView.UIDelegate);
     530    if (![uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)])
     531        return nil;
     532
     533    return [uiDelegate _dataDetectionContextForWebView:webView];
     534}
     535
    516536@end
    517537
Note: See TracChangeset for help on using the changeset viewer.