<!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>[192419] branches/safari-601.1.46-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/192419">192419</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-13 09:02:48 -0800 (Fri, 13 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/190574">r190574</a>. rdar://problem/22846841</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformgraphicscocoaIOSurfaceh">branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformgraphicscocoaIOSurfacemm">branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformspicocoaIOSurfaceSPIh">branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2ChangeLog">branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebKit2UIProcessmacViewSnapshotStoremm">branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-11-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r190574. rdar://problem/22846841
+
+    2015-10-05  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Compress snapshots on iOS
+            https://bugs.webkit.org/show_bug.cgi?id=149814
+            -and corresponding-
+            rdar://problem/22976230
+
+            Reviewed by Simon Fraser.
+
+            Though the default is still RGBA, it is now possible to create an IOSurface
+            that uses the YUV422 pixel format.
+            * platform/graphics/cocoa/IOSurface.h:
+            * platform/graphics/cocoa/IOSurface.mm:
+            (IOSurface::surfaceFromPool):
+            (IOSurface::create):
+            (IOSurface::createFromImage):
+            (IOSurface::IOSurface):
+            (IOSurface::releaseGraphicsContext):
+
+            In order to have a YUV IOSurface, we actually have to create an RGBA surface
+            first and then convert it to YUV, so this class method will handle that.
+            (IOSurface::convertToFormat):
+
+            Necessary SPI.
+            * platform/spi/cocoa/IOSurfaceSPI.h:
+
</ins><span class="cx"> 2015-10-29  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r191706. rdar://problem/23319282
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformgraphicscocoaIOSurfaceh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -38,7 +38,14 @@
</span><span class="cx"> 
</span><span class="cx"> class IOSurface final {
</span><span class="cx"> public:
</span><del>-    WEBCORE_EXPORT static std::unique_ptr&lt;IOSurface&gt; create(IntSize, ColorSpace);
</del><ins>+    enum class Format {
+        RGBA,
+#if PLATFORM(IOS)
+        YUV422
+#endif
+    };
+
+    WEBCORE_EXPORT static std::unique_ptr&lt;IOSurface&gt; create(IntSize, ColorSpace, Format = Format::RGBA);
</ins><span class="cx">     WEBCORE_EXPORT static std::unique_ptr&lt;IOSurface&gt; create(IntSize, IntSize contextSize, ColorSpace);
</span><span class="cx">     WEBCORE_EXPORT static std::unique_ptr&lt;IOSurface&gt; createFromSendRight(const MachSendRight&amp;, ColorSpace);
</span><span class="cx">     static std::unique_ptr&lt;IOSurface&gt; createFromSurface(IOSurfaceRef, ColorSpace);
</span><span class="lines">@@ -73,6 +80,7 @@
</span><span class="cx">     IntSize size() const { return m_size; }
</span><span class="cx">     size_t totalBytes() const { return m_totalBytes; }
</span><span class="cx">     ColorSpace colorSpace() const { return m_colorSpace; }
</span><ins>+    Format format() const { return m_format; }
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT bool isInUse() const;
</span><span class="cx"> 
</span><span class="lines">@@ -80,8 +88,12 @@
</span><span class="cx">     // an accurate result from isInUse(), it needs to be released.
</span><span class="cx">     WEBCORE_EXPORT void releaseGraphicsContext();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    WEBCORE_EXPORT static void convertToFormat(std::unique_ptr&lt;WebCore::IOSurface&gt;&amp;&amp; inSurface, Format, std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt;);
+#endif
+
</ins><span class="cx"> private:
</span><del>-    IOSurface(IntSize, ColorSpace);
</del><ins>+    IOSurface(IntSize, ColorSpace, Format);
</ins><span class="cx">     IOSurface(IntSize, IntSize contextSize, ColorSpace);
</span><span class="cx">     IOSurface(IOSurfaceRef, ColorSpace);
</span><span class="cx"> 
</span><span class="lines">@@ -90,6 +102,7 @@
</span><span class="cx">     void setContextSize(IntSize);
</span><span class="cx"> 
</span><span class="cx">     ColorSpace m_colorSpace;
</span><ins>+    Format m_format;
</ins><span class="cx">     IntSize m_size;
</span><span class="cx">     IntSize m_contextSize;
</span><span class="cx">     size_t m_totalBytes;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformgraphicscocoaIOSurfacemm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -51,11 +51,15 @@
</span><span class="cx">     return cachedSurface;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::create(IntSize size, ColorSpace colorSpace)
</del><ins>+std::unique_ptr&lt;IOSurface&gt; IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
</ins><span class="cx"> {
</span><del>-    if (auto cachedSurface = surfaceFromPool(size, size, colorSpace))
-        return cachedSurface;
-    return std::unique_ptr&lt;IOSurface&gt;(new IOSurface(size, colorSpace));
</del><ins>+    // YUV422 IOSurfaces do not go in the pool.
+    if (pixelFormat == Format::RGBA) {
+        if (auto cachedSurface = surfaceFromPool(size, size, colorSpace))
+            return cachedSurface;
+    }
+
+    return std::unique_ptr&lt;IOSurface&gt;(new IOSurface(size, colorSpace, pixelFormat));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;IOSurface&gt; IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace)
</span><span class="lines">@@ -92,17 +96,30 @@
</span><span class="cx">     return surface;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::IOSurface(IntSize size, ColorSpace colorSpace)
</del><ins>+IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
</ins><span class="cx">     : m_colorSpace(colorSpace)
</span><ins>+    , m_format(format)
</ins><span class="cx">     , m_size(size)
</span><span class="cx">     , m_contextSize(size)
</span><span class="cx"> {
</span><span class="cx">     unsigned pixelFormat = 'BGRA';
</span><ins>+    unsigned bytesPerPixel = 4;
</ins><span class="cx">     unsigned bytesPerElement = 4;
</span><ins>+    unsigned elementWidth = 1;
+
+#if PLATFORM(IOS)
+    if (format == Format::YUV422) {
+        pixelFormat = 'yuvf';
+        bytesPerPixel = 2;
+        elementWidth = 2;
+        bytesPerElement = 4;
+    }
+#endif
+
</ins><span class="cx">     int width = size.width();
</span><span class="cx">     int height = size.height();
</span><span class="cx"> 
</span><del>-    size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement);
</del><ins>+    size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerPixel);
</ins><span class="cx">     ASSERT(bytesPerRow);
</span><span class="cx"> 
</span><span class="cx">     m_totalBytes = IOSurfaceAlignProperty(kIOSurfaceAllocSize, height * bytesPerRow);
</span><span class="lines">@@ -116,15 +133,17 @@
</span><span class="cx">         (id)kIOSurfaceBytesPerRow: @(bytesPerRow),
</span><span class="cx">         (id)kIOSurfaceAllocSize: @(m_totalBytes),
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache)
</del><ins>+        (id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache),
</ins><span class="cx"> #endif
</span><ins>+        (id)kIOSurfaceElementWidth: @(elementWidth),
+        (id)kIOSurfaceElementHeight: @(1)
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_surface = adoptCF(IOSurfaceCreate((CFDictionaryRef)options));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace)
</span><del>-    : IOSurface(size, colorSpace)
</del><ins>+    : IOSurface(size, colorSpace, Format::RGBA)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(contextSize.width() &lt;= size.width());
</span><span class="cx">     ASSERT(contextSize.height() &lt;= size.height());
</span><span class="lines">@@ -133,6 +152,7 @@
</span><span class="cx"> 
</span><span class="cx"> IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
</span><span class="cx">     : m_colorSpace(colorSpace)
</span><ins>+    , m_format(Format::RGBA)
</ins><span class="cx">     , m_surface(surface)
</span><span class="cx"> {
</span><span class="cx">     m_size = IntSize(IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
</span><span class="lines">@@ -228,4 +248,39 @@
</span><span class="cx">     m_cgContext = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+ void IOSurface::convertToFormat(std::unique_ptr&lt;WebCore::IOSurface&gt;&amp;&amp; inSurface, Format format, std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt; callback)
+{
+    static IOSurfaceAcceleratorRef accelerator;
+    if (!accelerator) {
+        IOSurfaceAcceleratorCreate(nullptr, nullptr, &amp;accelerator);
+
+        auto runLoopSource = IOSurfaceAcceleratorGetRunLoopSource(accelerator);
+        CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, kCFRunLoopDefaultMode);
+    }
+
+    if (inSurface-&gt;format() == format) {
+        callback(WTF::move(inSurface));
+        return;
+    }
+
+    auto destinationSurface = IOSurface::create(inSurface-&gt;size(), inSurface-&gt;colorSpace(), format);
+    IOSurfaceRef destinationIOSurfaceRef = destinationSurface-&gt;surface();
+
+    IOSurfaceAcceleratorCompletion completion;
+    completion.completionRefCon = new std::function&lt;void(std::unique_ptr&lt;IOSurface&gt;)&gt; (WTF::move(callback));
+    completion.completionRefCon2 = destinationSurface.release();
+    completion.completionCallback = [](void *completionRefCon, IOReturn, void * completionRefCon2) {
+        auto* callback = static_cast&lt;std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt;*&gt;(completionRefCon);
+        auto destinationSurface = std::unique_ptr&lt;IOSurface&gt;(static_cast&lt;IOSurface*&gt;(completionRefCon2));
+        
+        (*callback)(WTF::move(destinationSurface));
+        delete callback;
+    };
+
+    IOReturn ret = IOSurfaceAcceleratorTransformSurface(accelerator, inSurface-&gt;surface(), destinationIOSurfaceRef, nullptr, nullptr, &amp;completion, nullptr, nullptr);
+    ASSERT_UNUSED(ret, ret == kIOReturnSuccess);
+}
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #endif // USE(IOSURFACE)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformspicocoaIOSurfaceSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -94,6 +94,35 @@
</span><span class="cx"> 
</span><span class="cx"> WTF_EXTERN_C_END
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#if PLATFORM(IOS)
+#if USE(APPLE_INTERNAL_SDK)
</ins><span class="cx"> 
</span><ins>+#import &lt;IOSurfaceAccelerator/IOSurfaceAccelerator.h&gt;
+
+#else
+
+typedef struct __IOSurfaceAccelerator *IOSurfaceAcceleratorRef;
+
+WTF_EXTERN_C_BEGIN
+
+IOReturn IOSurfaceAcceleratorCreate(CFAllocatorRef allocator, CFDictionaryRef properties, IOSurfaceAcceleratorRef* acceleratorOut);
+CFRunLoopSourceRef IOSurfaceAcceleratorGetRunLoopSource(IOSurfaceAcceleratorRef accelerator);
+
+typedef void (*IOSurfaceAcceleratorCompletionCallback)(void* completionRefCon, IOReturn status, void* completionRefCon2);
+
+typedef struct IOSurfaceAcceleratorCompletion {
+    IOSurfaceAcceleratorCompletionCallback completionCallback;
+    void* completionRefCon;
+    void* completionRefCon2;
+} IOSurfaceAcceleratorCompletion;
+
+IOReturn IOSurfaceAcceleratorTransformSurface(IOSurfaceAcceleratorRef accelerator, IOSurfaceRef sourceBuffer, IOSurfaceRef destinationBuffer, CFDictionaryRef options, void* pCropRectangles, IOSurfaceAcceleratorCompletion* pCompletion, void* pSwap, uint32_t* pCommandID);
+
+WTF_EXTERN_C_END
+
+#endif // USE(APPLE_INTERNAL_SDK)
+#endif // PLATFORM(IOS)
+
+#endif // !PLATFORM(IOS_SIMULATOR)
+
</ins><span class="cx"> #endif // IOSurfaceSPI_h
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2015-11-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r190574. rdar://problem/22846841
+
+    2015-10-05  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Compress snapshots on iOS
+            https://bugs.webkit.org/show_bug.cgi?id=149814
+            -and corresponding-
+            rdar://problem/22976230
+
+            Reviewed by Simon Fraser.
+
+            Compress the snapshot.
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _takeViewSnapshot]):
+
+            Since the snapshots are converted to YUV asynchronously, it is possible to
+            get here and have a snapshot that does not yet have an image, so we have to
+            relax this constraint.
+            * UIProcess/mac/ViewSnapshotStore.mm:
+            (WebKit::ViewSnapshotStore::recordSnapshot):
+
+2015-11-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r189635. rdar://problem/22846841
</span><span class="cx"> 
</span><span class="cx">     2015-09-11  Beth Dakin  &lt;bdakin@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -1114,7 +1114,12 @@
</span><span class="cx">     auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceDeviceRGB);
</span><span class="cx">     CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast&lt;uint64_t&gt;(self.layer), surface-&gt;surface(), 0, 0, &amp;transform);
</span><span class="cx"> 
</span><del>-    return WebKit::ViewSnapshot::create(nullptr);
</del><ins>+    RefPtr&lt;WebKit::ViewSnapshot&gt; viewSnapshot = WebKit::ViewSnapshot::create(nullptr);
+    WebCore::IOSurface::convertToFormat(WTF::move(surface), WebCore::IOSurface::Format::YUV422, [viewSnapshot](std::unique_ptr&lt;WebCore::IOSurface&gt; convertedSurface) {
+        viewSnapshot-&gt;setSurface(WTF::move(convertedSurface));
+    });
+
+    return viewSnapshot;
</ins><span class="cx"> #else
</span><span class="cx">     uint32_t slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES];
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebKit2UIProcessmacViewSnapshotStoremm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm (192418 => 192419)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm        2015-11-13 17:02:44 UTC (rev 192418)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm        2015-11-13 17:02:48 UTC (rev 192419)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">     webPageProxy.willRecordNavigationSnapshot(item);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;ViewSnapshot&gt; snapshot = webPageProxy.takeViewSnapshot();
</span><del>-    if (!snapshot || !snapshot-&gt;hasImage())
</del><ins>+    if (!snapshot)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     snapshot-&gt;setRenderTreeSize(webPageProxy.renderTreeSize());
</span></span></pre>
</div>
</div>

</body>
</html>