Diff
Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebCore/ChangeLog 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog 2015-07-24 07:54:09 UTC (rev 187311)
@@ -1,5 +1,23 @@
2015-07-24 Matthew Hanson <[email protected]>
+ Merge r187173. rdar://problem/21637698
+
+ 2015-07-22 Beth Dakin <[email protected]>
+
+ Animated images should animate in previews
+ https://bugs.webkit.org/show_bug.cgi?id=147173
+ -and corresponding-
+ rdar://problem/21637698
+
+ Reviewed by Dan Bernstein.
+
+ New virtual function to indicate whether or not the image is animated.
+ * platform/graphics/BitmapImage.h:
+ * platform/graphics/Image.h:
+ (WebCore::Image::isAnimated):
+
+2015-07-24 Matthew Hanson <[email protected]>
+
Merge r187170. rdar://problem/21901076
2015-07-22 Wenson Hsieh <[email protected]>
Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/BitmapImage.h (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebCore/platform/graphics/BitmapImage.h 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebCore/platform/graphics/BitmapImage.h 2015-07-24 07:54:09 UTC (rev 187311)
@@ -178,6 +178,8 @@
virtual ImageOrientation orientationForCurrentFrame() override { return frameOrientationAtIndex(currentFrame()); }
virtual bool currentFrameKnownToBeOpaque() override;
+
+ virtual bool isAnimated() override { return m_frameCount > 1; }
bool canAnimate();
Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/Image.h (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebCore/platform/graphics/Image.h 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebCore/platform/graphics/Image.h 2015-07-24 07:54:09 UTC (rev 187311)
@@ -85,6 +85,8 @@
virtual bool isPDFDocumentImage() const { return false; }
virtual bool currentFrameKnownToBeOpaque() = 0;
+ virtual bool isAnimated() { return false; }
+
// Derived classes should override this if they can assure that
// the image contains only resources from its own security origin.
virtual bool hasSingleSecurityOrigin() const { return false; }
Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog 2015-07-24 07:54:09 UTC (rev 187311)
@@ -1,3 +1,34 @@
+2015-07-24 Matthew Hanson <[email protected]>
+
+ Merge r187173. rdar://problem/21637698
+
+ 2015-07-22 Beth Dakin <[email protected]>
+
+ Animated images should animate in previews
+ https://bugs.webkit.org/show_bug.cgi?id=147173
+ -and corresponding-
+ rdar://problem/21637698
+
+ Reviewed by Dan Bernstein.
+
+ InteractionInformationAtPosition needs to know if it’s an animated image.
+ * Shared/InteractionInformationAtPosition.cpp:
+ (WebKit::InteractionInformationAtPosition::encode):
+ (WebKit::InteractionInformationAtPosition::decode):
+ * Shared/InteractionInformationAtPosition.h:
+
+ New delegate method to create a link preview view controller for animated
+ images.
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+
+ Treat animated images more like link previews.
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView previewViewControllerForPosition:inSourceView:]):
+
+ Set info.isAnimatedImage
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::getPositionInformation):
+
2015-07-24 Lucas Forschler <[email protected]>
Merge r187131
Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.cpp (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.cpp 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.cpp 2015-07-24 07:54:09 UTC (rev 187311)
@@ -39,6 +39,7 @@
encoder << isSelectable;
encoder << isNearMarkedText;
encoder << touchCalloutEnabled;
+ encoder << isAnimatedImage;
encoder << clickableElementName;
encoder << url;
encoder << imageURL;
@@ -68,6 +69,9 @@
if (!decoder.decode(result.touchCalloutEnabled))
return false;
+
+ if (!decoder.decode(result.isAnimatedImage))
+ return false;
if (!decoder.decode(result.clickableElementName))
return false;
Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.h (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.h 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.h 2015-07-24 07:54:09 UTC (rev 187311)
@@ -43,6 +43,7 @@
bool isSelectable { false };
bool isNearMarkedText { false };
bool touchCalloutEnabled { true };
+ bool isAnimatedImage { false };
String clickableElementName;
String url;
String imageURL;
Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2015-07-24 07:54:09 UTC (rev 187311)
@@ -33,6 +33,7 @@
@class UIScrollView;
@class UIViewController;
@class _WKActivatedElementInfo;
+@class _WKElementAction;
@class _WKFrameHandle;
@protocol WKUIDelegatePrivate <WKUIDelegate>
@@ -56,7 +57,7 @@
#if TARGET_OS_IPHONE
- (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA);
-- (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;
+- (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(WK_ARRAY(_WKElementAction *) *)defaultActions;
- (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
- (BOOL)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL;
- (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url;
@@ -65,7 +66,8 @@
- (void)_webView:(WKWebView *)webView commitPreviewedImageWithURL:(NSURL *)imageURL WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
- (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController;
- (UIEdgeInsets)_webView:(WKWebView *)webView finalObscuredInsetsForScrollView:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset;
-- (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url defaultActions:(NSArray *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+- (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url defaultActions:(WK_ARRAY(_WKElementAction *) *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+- (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForAnimatedImageAtURL:(NSURL *)url defaultActions:(WK_ARRAY(_WKElementAction *) *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo imageSize:(CGSize)imageSize WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
#endif
@end
Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-07-24 07:54:09 UTC (rev 187311)
@@ -3267,12 +3267,24 @@
String absoluteImageURL = _positionInformation.imageURL;
if (absoluteImageURL.isEmpty() || !(WebCore::protocolIsInHTTPFamily(absoluteImageURL) || WebCore::protocolIs(absoluteImageURL, "data")))
return nil;
+
+ NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.imageURL];
+ RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ _page->startInteractionWithElementAtPosition(_positionInformation.point);
+
+ // Treat animated images like a link preview
+ if (_positionInformation.isAnimatedImage) {
+ if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForAnimatedImageAtURL:defaultActions:elementInfo:imageSize:)]) {
+ _previewType = PreviewElementType::Link;
+ RetainPtr<NSArray> actions = [_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
+ _highlightLongPressCanClick = NO;
+ return [uiDelegate _webView:_webView previewViewControllerForAnimatedImageAtURL:targetURL defaultActions:actions.get() elementInfo:elementInfo.get() imageSize:_positionInformation.image->size()];
+ }
+ }
+
_previewType = PreviewElementType::Image;
- NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.imageURL];
if ([uiDelegate respondsToSelector:@selector(_webView:willPreviewImageWithURL:)])
[uiDelegate _webView:_webView willPreviewImageWithURL:targetURL];
- RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
- _page->startInteractionWithElementAtPosition(_positionInformation.point);
return [[[WKImagePreviewViewController alloc] initWithCGImage:_positionInformation.image->makeCGImageCopy() defaultActions:[_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()] elementInfo:elementInfo] autorelease];
}
Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (187310 => 187311)
--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-24 07:54:04 UTC (rev 187310)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-24 07:54:09 UTC (rev 187311)
@@ -2186,6 +2186,7 @@
if (renderImage.cachedImage() && !renderImage.cachedImage()->errorOccurred()) {
info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
if (Image* image = renderImage.cachedImage()->imageForRenderer(&renderImage)) {
+ info.isAnimatedImage = image->isAnimated();
FloatSize screenSizeInPixels = screenSize();
screenSizeInPixels.scale(corePage()->deviceScaleFactor());
FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();