<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[187311] branches/safari-601.1-branch/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/187311">187311</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-24 00:54:09 -0700 (Fri, 24 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/187173">r187173</a>. rdar://problem/21637698</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreplatformgraphicsBitmapImageh">branches/safari-601.1-branch/Source/WebCore/platform/graphics/BitmapImage.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreplatformgraphicsImageh">branches/safari-601.1-branch/Source/WebCore/platform/graphics/Image.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2ChangeLog">branches/safari-601.1-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2SharedInteractionInformationAtPositioncpp">branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2SharedInteractionInformationAtPositionh">branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessiosWKContentViewInteractionmm">branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2WebProcessWebPageiosWebPageIOSmm">branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2015-07-24 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r187173. rdar://problem/21637698
+
+ 2015-07-22 Beth Dakin <bdakin@apple.com>
+
+ 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 <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r187170. rdar://problem/21901076
</span><span class="cx">
</span><span class="cx"> 2015-07-22 Wenson Hsieh <wenson_hsieh@apple.com>
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreplatformgraphicsBitmapImageh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/BitmapImage.h (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -178,6 +178,8 @@
</span><span class="cx"> virtual ImageOrientation orientationForCurrentFrame() override { return frameOrientationAtIndex(currentFrame()); }
</span><span class="cx">
</span><span class="cx"> virtual bool currentFrameKnownToBeOpaque() override;
</span><ins>+
+ virtual bool isAnimated() override { return m_frameCount > 1; }
</ins><span class="cx">
</span><span class="cx"> bool canAnimate();
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreplatformgraphicsImageh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/Image.h (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -85,6 +85,8 @@
</span><span class="cx"> virtual bool isPDFDocumentImage() const { return false; }
</span><span class="cx"> virtual bool currentFrameKnownToBeOpaque() = 0;
</span><span class="cx">
</span><ins>+ virtual bool isAnimated() { return false; }
+
</ins><span class="cx"> // Derived classes should override this if they can assure that
</span><span class="cx"> // the image contains only resources from its own security origin.
</span><span class="cx"> virtual bool hasSingleSecurityOrigin() const { return false; }
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-07-24 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r187173. rdar://problem/21637698
+
+ 2015-07-22 Beth Dakin <bdakin@apple.com>
+
+ 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):
+
</ins><span class="cx"> 2015-07-24 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r187131
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2SharedInteractionInformationAtPositioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.cpp (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> encoder << isSelectable;
</span><span class="cx"> encoder << isNearMarkedText;
</span><span class="cx"> encoder << touchCalloutEnabled;
</span><ins>+ encoder << isAnimatedImage;
</ins><span class="cx"> encoder << clickableElementName;
</span><span class="cx"> encoder << url;
</span><span class="cx"> encoder << imageURL;
</span><span class="lines">@@ -68,6 +69,9 @@
</span><span class="cx">
</span><span class="cx"> if (!decoder.decode(result.touchCalloutEnabled))
</span><span class="cx"> return false;
</span><ins>+
+ if (!decoder.decode(result.isAnimatedImage))
+ return false;
</ins><span class="cx">
</span><span class="cx"> if (!decoder.decode(result.clickableElementName))
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2SharedInteractionInformationAtPositionh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/InteractionInformationAtPosition.h (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> bool isSelectable { false };
</span><span class="cx"> bool isNearMarkedText { false };
</span><span class="cx"> bool touchCalloutEnabled { true };
</span><ins>+ bool isAnimatedImage { false };
</ins><span class="cx"> String clickableElementName;
</span><span class="cx"> String url;
</span><span class="cx"> String imageURL;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> @class UIScrollView;
</span><span class="cx"> @class UIViewController;
</span><span class="cx"> @class _WKActivatedElementInfo;
</span><ins>+@class _WKElementAction;
</ins><span class="cx"> @class _WKFrameHandle;
</span><span class="cx">
</span><span class="cx"> @protocol WKUIDelegatePrivate <WKUIDelegate>
</span><span class="lines">@@ -56,7 +57,7 @@
</span><span class="cx">
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA);
</span><del>-- (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;
</del><ins>+- (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(WK_ARRAY(_WKElementAction *) *)defaultActions;
</ins><span class="cx"> - (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
</span><span class="cx"> - (BOOL)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL;
</span><span class="cx"> - (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url;
</span><span class="lines">@@ -65,7 +66,8 @@
</span><span class="cx"> - (void)_webView:(WKWebView *)webView commitPreviewedImageWithURL:(NSURL *)imageURL WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController;
</span><span class="cx"> - (UIEdgeInsets)_webView:(WKWebView *)webView finalObscuredInsetsForScrollView:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset;
</span><del>-- (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url defaultActions:(NSArray *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</del><ins>+- (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);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3267,12 +3267,24 @@
</span><span class="cx"> String absoluteImageURL = _positionInformation.imageURL;
</span><span class="cx"> if (absoluteImageURL.isEmpty() || !(WebCore::protocolIsInHTTPFamily(absoluteImageURL) || WebCore::protocolIs(absoluteImageURL, "data")))
</span><span class="cx"> return nil;
</span><ins>+
+ 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()];
+ }
+ }
+
</ins><span class="cx"> _previewType = PreviewElementType::Image;
</span><del>- NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.imageURL];
</del><span class="cx"> if ([uiDelegate respondsToSelector:@selector(_webView:willPreviewImageWithURL:)])
</span><span class="cx"> [uiDelegate _webView:_webView willPreviewImageWithURL:targetURL];
</span><del>- 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);
</del><span class="cx"> return [[[WKImagePreviewViewController alloc] initWithCGImage:_positionInformation.image->makeCGImageCopy() defaultActions:[_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()] elementInfo:elementInfo] autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (187310 => 187311)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2186,6 +2186,7 @@
</span><span class="cx"> if (renderImage.cachedImage() && !renderImage.cachedImage()->errorOccurred()) {
</span><span class="cx"> info.imageURL = [(NSURL *)element->document().completeURL(renderImage.cachedImage()->url()) absoluteString];
</span><span class="cx"> if (Image* image = renderImage.cachedImage()->imageForRenderer(&renderImage)) {
</span><ins>+ info.isAnimatedImage = image->isAnimated();
</ins><span class="cx"> FloatSize screenSizeInPixels = screenSize();
</span><span class="cx"> screenSizeInPixels.scale(corePage()->deviceScaleFactor());
</span><span class="cx"> FloatSize scaledSize = largestRectWithAspectRatioInsideRect(image->size().width() / image->size().height(), FloatRect(0, 0, screenSizeInPixels.width(), screenSizeInPixels.height())).size();
</span></span></pre>
</div>
</div>
</body>
</html>