Changeset 197656 in webkit
- Timestamp:
- Mar 6, 2016, 7:36:53 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/WKUIDelegatePrivate.h (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r197638 r197656 1 2016-03-05 Enrica Casucci <enrica@apple.com> 2 3 Support preview on attachment elements. 4 https://bugs.webkit.org/show_bug.cgi?id=155074 5 rdar://problem/24806079 6 7 Reviewed by Sam Weinig. 8 9 Allowing preview to start on attachment elements. 10 Adding a private UIDelegate method to provide the data for the preview. 11 12 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 13 * UIProcess/ios/WKContentViewInteraction.mm: 14 (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]): 15 (-[WKContentView _dataForPreviewItemController:atPosition:type:]): 16 1 17 2016-03-06 Andreas Kling <akling@apple.com> 2 18 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r197596 r197656 73 73 - (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController WK_AVAILABLE(NA, 9_0); 74 74 - (BOOL)_webView:(WKWebView *)webView showCustomSheetForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA); 75 - (NSArray *)_attachmentListForWebView:(WKWebView *)webView WK_AVAILABLE(NA, WK_IOS_TBA); 76 - (NSUInteger)_webView:(WKWebView *)webView indexIntoAttachmentListForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA); 75 77 - (UIEdgeInsets)_webView:(WKWebView *)webView finalObscuredInsetsForScrollView:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset WK_AVAILABLE(NA, 9_0); 76 78 - (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url defaultActions:(WK_ARRAY(_WKElementAction *) *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo WK_AVAILABLE(NA, 9_0); -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r197632 r197656 3633 3633 3634 3634 [self ensurePositionInformationIsUpToDate:position]; 3635 if (!_positionInformation.isLink && !_positionInformation.isImage )3635 if (!_positionInformation.isLink && !_positionInformation.isImage && !_positionInformation.isAttachment) 3636 3636 return NO; 3637 3637 … … 3664 3664 BOOL canShowLinkPreview = _positionInformation.isLink || canShowImagePreview; 3665 3665 BOOL useImageURLForLink = NO; 3666 BOOL supportsAttachmentPreview = [uiDelegate respondsToSelector:@selector(_attachmentListForWebView:)] && [uiDelegate respondsToSelector:@selector(_webView:indexIntoAttachmentListForElement:)]; 3667 BOOL canShowAttachmentPreview = _positionInformation.isAttachment && supportsAttachmentPreview; 3666 3668 3667 3669 if (canShowImagePreview && _positionInformation.isAnimatedImage) { … … 3671 3673 } 3672 3674 3673 if (!canShowLinkPreview && !canShowImagePreview )3675 if (!canShowLinkPreview && !canShowImagePreview && !canShowAttachmentPreview) 3674 3676 return nil; 3675 3677 … … 3690 3692 if (_positionInformation.isDataDetectorLink) { 3691 3693 NSDictionary *context = nil; 3692 id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);3693 3694 if ([uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)]) 3694 3695 context = [uiDelegate _dataDetectionContextForWebView:_webView]; … … 3707 3708 *type = UIPreviewItemTypeImage; 3708 3709 dataForPreview[UIPreviewDataLink] = [NSURL _web_URLWithWTFString:_positionInformation.imageURL]; 3710 } else if (canShowAttachmentPreview) { 3711 // FIXME: Should use UIKit constants. 3712 enum { WKUIPreviewItemTypeAttachment = 5 }; 3713 *type = static_cast<UIPreviewItemType>(WKUIPreviewItemTypeAttachment); 3714 const auto& element = [[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:nil]; 3715 dataForPreview[@"UIPreviewDataAttachmentList"] = [uiDelegate _attachmentListForWebView:_webView]; 3716 dataForPreview[@"UIPreviewDataAttachmentIndex"] = [NSNumber numberWithUnsignedInteger:[uiDelegate _webView:_webView indexIntoAttachmentListForElement:element]]; 3709 3717 } 3710 3718
Note:
See TracChangeset
for help on using the changeset viewer.