Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=146909
Add actions for default link preview that uses SFSafariViewController.

Use the new private properties to prepare actions for the default link preview controller.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2015-07-14
Reviewed by Dan Bernstein.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView previewViewControllerForPosition:inSourceView:]):

Canonical link: https://commits.webkit.org/164995@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Yongjun Zhang authored and webkit-commit-queue committed Jul 14, 2015
1 parent ceb683a commit 446aade
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,15 @@
2015-07-14 Yongjun Zhang <yongjun_zhang@apple.com>

https://bugs.webkit.org/show_bug.cgi?id=146909
Add actions for default link preview that uses SFSafariViewController.

Use the new private properties to prepare actions for the default link preview controller.

Reviewed by Dan Bernstein.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView previewViewControllerForPosition:inSourceView:]):

2015-07-14 Michael Catanzaro <mcatanzaro@igalia.com>

[Linux] SeccompFilters: whitelist source directory on all ports
Expand Down
8 changes: 6 additions & 2 deletions Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Expand Up @@ -3224,11 +3224,12 @@ - (UIViewController *)previewViewControllerForPosition:(CGPoint)position inSourc
if (canShowLinkPreview) {
_previewType = PreviewElementType::Link;
NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.url];
RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
RetainPtr<NSArray> actions = [_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()];
if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForURL:defaultActions:elementInfo:)]) {
_highlightLongPressCanClick = NO;
RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
_page->startInteractionWithElementAtPosition(_positionInformation.point);
return [uiDelegate _webView:_webView previewViewControllerForURL:targetURL defaultActions:[_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()].get() elementInfo:elementInfo.get()];
return [uiDelegate _webView:_webView previewViewControllerForURL:targetURL defaultActions:actions.get() elementInfo:elementInfo.get()];
}

if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForURL:)]) {
Expand All @@ -3238,7 +3239,10 @@ - (UIViewController *)previewViewControllerForPosition:(CGPoint)position inSourc
#if HAVE(SAFARI_SERVICES_FRAMEWORK)
SFSafariViewController *previewViewController = [allocSFSafariViewControllerInstance() initWithURL:targetURL];
previewViewController._showingLinkPreview = YES;
previewViewController._activatedElementInfo = elementInfo.get();
previewViewController._previewActions = actions.get();
_highlightLongPressCanClick = NO;
_page->startInteractionWithElementAtPosition(_positionInformation.point);
return [previewViewController autorelease];
#else
return nil;
Expand Down

0 comments on commit 446aade

Please sign in to comment.