<!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>[192138] trunk/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/192138">192138</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-11-07 22:31:50 -0800 (Sat, 07 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use ColorSpaceSRGB for image buffers everywhere
https://bugs.webkit.org/show_bug.cgi?id=150990

Reviewed by Zalan Bujtas.

ColorSpaceSRGB and ColorSpaceDeviceRGB are equivalent now, so convert
code that creates image buffers tagged with ColorSpaceDeviceRGB to use ColorSpaceSRGB.

Source/WebCore:

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::createCompatibleBuffer):
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::create):
* platform/graphics/cg/BitmapImageCG.cpp:
(WebCore::BitmapImage::checkForSolidColor):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::Color::Color):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::sRGBColorSpaceRef): Deleted.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::putByteArray):
* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::createFromImage):
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::FilterEffect):
* platform/graphics/filters/SourceGraphic.h:
(WebCore::SourceGraphic::SourceGraphic):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::build):
(WebCore::FilterEffectRenderer::apply):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

Source/WebKit2:

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::decode):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _takeViewSnapshot]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBufferh">trunk/Source/WebCore/platform/graphics/ImageBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgBitmapImageCGcpp">trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgColorCGcpp">trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp">trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEFloodh">trunk/Source/WebCore/platform/graphics/filters/FEFlood.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFETilecpp">trunk/Source/WebCore/platform/graphics/filters/FETile.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp">trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersSourceGraphich">trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h</a></li>
<li><a href="#trunkSourceWebCorerenderingFilterEffectRenderercpp">trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMacmm">trunk/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourceClippercpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourceFiltercpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourceGradientcpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourceMaskercpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourcePatterncpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsfiltersSVGFEImagecpp">trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/ChangeLog        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2015-11-07  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Use ColorSpaceSRGB for image buffers everywhere
+        https://bugs.webkit.org/show_bug.cgi?id=150990
+
+        Reviewed by Zalan Bujtas.
+
+        ColorSpaceSRGB and ColorSpaceDeviceRGB are equivalent now, so convert
+        code that creates image buffers tagged with ColorSpaceDeviceRGB to use ColorSpaceSRGB.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::createCompatibleBuffer):
+        * platform/graphics/ImageBuffer.h:
+        (WebCore::ImageBuffer::create):
+        * platform/graphics/cg/BitmapImageCG.cpp:
+        (WebCore::BitmapImage::checkForSolidColor):
+        * platform/graphics/cg/ColorCG.cpp:
+        (WebCore::Color::Color):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::sRGBColorSpaceRef): Deleted.
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::putByteArray):
+        * platform/graphics/cocoa/IOSurface.mm:
+        (IOSurface::createFromImage):
+        * platform/graphics/filters/FEFlood.h:
+        * platform/graphics/filters/FETile.cpp:
+        (WebCore::FETile::platformApplySoftware):
+        * platform/graphics/filters/FilterEffect.cpp:
+        (WebCore::FilterEffect::FilterEffect):
+        * platform/graphics/filters/SourceGraphic.h:
+        (WebCore::SourceGraphic::SourceGraphic):
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::build):
+        (WebCore::FilterEffectRenderer::apply):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintProgressBar):
+        * rendering/svg/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyClippingToContext):
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::buildPrimitives):
+        * rendering/svg/RenderSVGResourceGradient.cpp:
+        (WebCore::createMaskAndSwapContextForTextGradient):
+        * rendering/svg/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::applyResource):
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::createTileImage):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::drawPatternForContainer):
+        * svg/graphics/filters/SVGFEImage.cpp:
+        (WebCore::FEImage::platformApplySoftware):
+
</ins><span class="cx"> 2015-11-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash when subtree layout is set on FrameView while auto size mode is enabled.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -640,7 +640,7 @@
</span><span class="cx">     AffineTransform transform = getCTM(DefinitelyIncludeDeviceScale);
</span><span class="cx">     FloatSize scaledSize(static_cast&lt;int&gt;(ceil(size.width() * transform.xScale())), static_cast&lt;int&gt;(ceil(size.height() * transform.yScale())));
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;ImageBuffer&gt; buffer = ImageBuffer::createCompatibleBuffer(scaledSize, 1, ColorSpaceDeviceRGB, *this, hasAlpha);
</del><ins>+    std::unique_ptr&lt;ImageBuffer&gt; buffer = ImageBuffer::createCompatibleBuffer(scaledSize, 1, ColorSpaceSRGB, *this, hasAlpha);
</ins><span class="cx">     if (!buffer)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     // Will return a null pointer on allocation failure.
</span><del>-    static std::unique_ptr&lt;ImageBuffer&gt; create(const FloatSize&amp; size, RenderingMode renderingMode, float resolutionScale = 1, ColorSpace colorSpace = ColorSpaceDeviceRGB)
</del><ins>+    static std::unique_ptr&lt;ImageBuffer&gt; create(const FloatSize&amp; size, RenderingMode renderingMode, float resolutionScale = 1, ColorSpace colorSpace = ColorSpaceSRGB)
</ins><span class="cx">     {
</span><span class="cx">         bool success = false;
</span><span class="cx">         std::unique_ptr&lt;ImageBuffer&gt; buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, success));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgBitmapImageCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">     // Currently we only check for solid color in the important special case of a 1x1 image.
</span><span class="cx">     if (CGImageGetWidth(image) == 1 &amp;&amp; CGImageGetHeight(image) == 1) {
</span><span class="cx">         unsigned char pixel[4]; // RGBA
</span><del>-        RetainPtr&lt;CGContextRef&gt; bitmapContext = adoptCF(CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), deviceRGBColorSpaceRef(),
</del><ins>+        RetainPtr&lt;CGContextRef&gt; bitmapContext = adoptCF(CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), sRGBColorSpaceRef(),
</ins><span class="cx">             kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big));
</span><span class="cx">         if (!bitmapContext)
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgColorCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx">     size_t numComponents = CGColorGetNumberOfComponents(color);
</span><span class="cx">     const CGFloat* components = CGColorGetComponents(color);
</span><span class="cx"> #else
</span><ins>+    // FIXME: can we remove this?
</ins><span class="cx">     RetainPtr&lt;CGColorRef&gt; correctedColor = adoptCF(createCGColorWithDeviceRGBA(color));
</span><span class="cx">     if (!correctedColor)
</span><span class="cx">         correctedColor = color;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -81,9 +81,6 @@
</span><span class="cx"> 
</span><span class="cx"> CGColorSpaceRef sRGBColorSpaceRef()
</span><span class="cx"> {
</span><del>-#if PLATFORM(IOS)
-    return deviceRGBColorSpaceRef();
-#else
</del><span class="cx">     static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx">     // Out-of-date CG installations will not honor kCGColorSpaceSRGB. This logic avoids
</span><span class="lines">@@ -93,7 +90,6 @@
</span><span class="cx">         sRGBSpace = deviceRGBColorSpaceRef();
</span><span class="cx"> #endif // PLATFORM(WIN)
</span><span class="cx">     return sRGBSpace;
</span><del>-#endif // PLATFORM(IOS)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN) || PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx">     // Make a copy of the source to ensure the bits don't change before being drawn
</span><span class="cx">     IntSize sourceCopySize(sourceRect.width(), sourceRect.height());
</span><span class="cx">     // FIXME (149431): Should this ImageBuffer be unconditionally unaccelerated? Making it match the context seems to break putData().
</span><del>-    std::unique_ptr&lt;ImageBuffer&gt; sourceCopy = ImageBuffer::create(sourceCopySize, Unaccelerated, 1, ColorSpaceDeviceRGB);
</del><ins>+    std::unique_ptr&lt;ImageBuffer&gt; sourceCopy = ImageBuffer::create(sourceCopySize, Unaccelerated, 1, ColorSpaceSRGB);
</ins><span class="cx">     if (!sourceCopy)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     size_t width = CGImageGetWidth(image);
</span><span class="cx">     size_t height = CGImageGetHeight(image);
</span><span class="cx"> 
</span><del>-    auto surface = IOSurface::create(IntSize(width, height), ColorSpaceDeviceRGB);
</del><ins>+    auto surface = IOSurface::create(IntSize(width, height), ColorSpaceSRGB);
</ins><span class="cx">     auto surfaceContext = surface-&gt;ensurePlatformContext();
</span><span class="cx">     CGContextDrawImage(surfaceContext, CGRectMake(0, 0, width, height), image);
</span><span class="cx">     CGContextFlush(surfaceContext);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEFloodh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEFlood.h (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEFlood.h        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/filters/FEFlood.h        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx"> #if !USE(CG)
</span><span class="cx">     // feFlood does not perform color interpolation of any kind, so the result is always in the current
</span><span class="cx">     // color space regardless of the value of color-interpolation-filters.
</span><del>-    void setOperatingColorSpace(ColorSpace) override { FilterEffect::setResultColorSpace(ColorSpaceDeviceRGB); }
-    void setResultColorSpace(ColorSpace) override { FilterEffect::setResultColorSpace(ColorSpaceDeviceRGB); }
</del><ins>+    void setOperatingColorSpace(ColorSpace) override { FilterEffect::setResultColorSpace(ColorSpaceSRGB); }
+    void setResultColorSpace(ColorSpace) override { FilterEffect::setResultColorSpace(ColorSpaceSRGB); }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void platformApplySoftware() override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFETilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FETile.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         tileRect.scale(filter.filterResolution().width(), filter.filterResolution().height());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto tileImage = SVGRenderingContext::createImageBuffer(tileRect, tileRect, ColorSpaceDeviceRGB, filter().renderingMode());
</del><ins>+    auto tileImage = SVGRenderingContext::createImageBuffer(tileRect, tileRect, ColorSpaceSRGB, filter().renderingMode());
</ins><span class="cx">     if (!tileImage)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     , m_hasHeight(false)
</span><span class="cx">     , m_clipsToBounds(true)
</span><span class="cx">     , m_operatingColorSpace(ColorSpaceLinearRGB)
</span><del>-    , m_resultColorSpace(ColorSpaceDeviceRGB)
</del><ins>+    , m_resultColorSpace(ColorSpaceSRGB)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersSourceGraphich"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     SourceGraphic(Filter&amp; filter)
</span><span class="cx">         : FilterEffect(filter)
</span><span class="cx">     {
</span><del>-        setOperatingColorSpace(ColorSpaceDeviceRGB);
</del><ins>+        setOperatingColorSpace(ColorSpaceSRGB);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRenderercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -284,7 +284,7 @@
</span><span class="cx">             // Unlike SVG Filters and CSSFilterImages, filter functions on the filter
</span><span class="cx">             // property applied here should not clip to their primitive subregions.
</span><span class="cx">             effect-&gt;setClipsToBounds(consumer == FilterFunction);
</span><del>-            effect-&gt;setOperatingColorSpace(ColorSpaceDeviceRGB);
</del><ins>+            effect-&gt;setOperatingColorSpace(ColorSpaceSRGB);
</ins><span class="cx">             
</span><span class="cx">             if (filterOperation.type() != FilterOperation::REFERENCE) {
</span><span class="cx">                 effect-&gt;inputEffects().append(previousEffect);
</span><span class="lines">@@ -339,7 +339,7 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;FilterEffect&gt; effect = lastEffect();
</span><span class="cx">     effect-&gt;apply();
</span><del>-    effect-&gt;transformResultColorSpace(ColorSpaceDeviceRGB);
</del><ins>+    effect-&gt;transformResultColorSpace(ColorSpaceSRGB);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutRect FilterEffectRenderer::computeSourceImageRectForDirtyRect(const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -1141,7 +1141,7 @@
</span><span class="cx">     trackInfo.reserved = 0;
</span><span class="cx">     trackInfo.filler1 = 0;
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;ImageBuffer&gt; imageBuffer = ImageBuffer::createCompatibleBuffer(inflatedRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB, paintInfo.context(), true);
</del><ins>+    std::unique_ptr&lt;ImageBuffer&gt; imageBuffer = ImageBuffer::createCompatibleBuffer(inflatedRect.size(), deviceScaleFactor, ColorSpaceSRGB, paintInfo.context(), true);
</ins><span class="cx">     if (!imageBuffer)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourceClippercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (shouldCreateClipperMaskImage &amp;&amp; !repaintRect.isEmpty()) {
</span><span class="cx">         // FIXME (149469): This image buffer should not be unconditionally unaccelerated. Making it match the context breaks nested clipping, though.
</span><del>-        clipperMaskImage = SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, ColorSpaceDeviceRGB, Unaccelerated);
</del><ins>+        clipperMaskImage = SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, ColorSpaceSRGB, Unaccelerated);
</ins><span class="cx">         if (!clipperMaskImage)
</span><span class="cx">             return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourceFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         element.setStandardAttributes(effect.get());
</span><span class="cx">         effect-&gt;setEffectBoundaries(SVGLengthContext::resolveRectangle&lt;SVGFilterPrimitiveStandardAttributes&gt;(&amp;element, filterElement().primitiveUnits(), targetBoundingBox));
</span><span class="cx">         if (element.renderer())
</span><del>-            effect-&gt;setOperatingColorSpace(element.renderer()-&gt;style().svgStyle().colorInterpolationFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
</del><ins>+            effect-&gt;setOperatingColorSpace(element.renderer()-&gt;style().svgStyle().colorInterpolationFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceSRGB);
</ins><span class="cx">         builder-&gt;add(element.result(), WTF::move(effect));
</span><span class="cx">     }
</span><span class="cx">     return builder;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourceGradientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     AffineTransform absoluteTransform = SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(*textRootBlock);
</span><span class="cx">     FloatRect repaintRect = textRootBlock-&gt;repaintRectInLocalCoordinates();
</span><span class="cx"> 
</span><del>-    auto maskImage = SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, ColorSpaceDeviceRGB, context-&gt;renderingMode());
</del><ins>+    auto maskImage = SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, ColorSpaceSRGB, context-&gt;renderingMode());
</ins><span class="cx">     if (!maskImage)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourceMaskercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!maskerData-&gt;maskImage &amp;&amp; !repaintRect.isEmpty()) {
</span><span class="cx">         const SVGRenderStyle&amp; svgStyle = style().svgStyle();
</span><del>-        ColorSpace colorSpace = svgStyle.colorInterpolation() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB;
</del><ins>+        ColorSpace colorSpace = svgStyle.colorInterpolation() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceSRGB;
</ins><span class="cx">         // FIXME (149470): This image buffer should not be unconditionally unaccelerated. Making it match the context breaks alpha masking, though.
</span><span class="cx">         maskerData-&gt;maskImage = SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, colorSpace, Unaccelerated);
</span><span class="cx">         if (!maskerData-&gt;maskImage)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourcePatterncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx"> std::unique_ptr&lt;ImageBuffer&gt; RenderSVGResourcePattern::createTileImage(const PatternAttributes&amp; attributes, const FloatRect&amp; tileBoundaries, const FloatRect&amp; absoluteTileBoundaries, const AffineTransform&amp; tileImageTransform, FloatRect&amp; clampedAbsoluteTileBoundaries, RenderingMode renderingMode) const
</span><span class="cx"> {
</span><span class="cx">     clampedAbsoluteTileBoundaries = ImageBuffer::clampedRect(absoluteTileBoundaries);
</span><del>-    auto tileImage = SVGRenderingContext::createImageBuffer(absoluteTileBoundaries, clampedAbsoluteTileBoundaries, ColorSpaceDeviceRGB, renderingMode);
</del><ins>+    auto tileImage = SVGRenderingContext::createImageBuffer(absoluteTileBoundaries, clampedAbsoluteTileBoundaries, ColorSpaceSRGB, renderingMode);
</ins><span class="cx">     if (!tileImage)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx">     FloatRect imageBufferSize = zoomedContainerRect;
</span><span class="cx">     imageBufferSize.scale(imageBufferScale.width(), imageBufferScale.height());
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;ImageBuffer&gt; buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceDeviceRGB, context, true);
</del><ins>+    std::unique_ptr&lt;ImageBuffer&gt; buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(imageBufferSize.size()), 1, ColorSpaceSRGB, context, true);
</ins><span class="cx">     if (!buffer) // Failed to allocate buffer.
</span><span class="cx">         return;
</span><span class="cx">     drawForContainer(buffer-&gt;context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal);
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsfiltersSVGFEImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -112,8 +112,8 @@
</span><span class="cx">     IntPoint paintLocation = absolutePaintRect().location();
</span><span class="cx">     destRect.move(-paintLocation.x(), -paintLocation.y());
</span><span class="cx"> 
</span><del>-    // FEImage results are always in ColorSpaceDeviceRGB
-    setResultColorSpace(ColorSpaceDeviceRGB);
</del><ins>+    // FEImage results are always in ColorSpaceSRGB
+    setResultColorSpace(ColorSpaceSRGB);
</ins><span class="cx"> 
</span><span class="cx">     if (renderer) {
</span><span class="cx">         const AffineTransform&amp; absoluteTransform = filter().absoluteTransform();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-11-07  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Use ColorSpaceSRGB for image buffers everywhere
+        https://bugs.webkit.org/show_bug.cgi?id=150990
+
+        Reviewed by Zalan Bujtas.
+
+        ColorSpaceSRGB and ColorSpaceDeviceRGB are equivalent now, so convert
+        code that creates image buffers tagged with ColorSpaceDeviceRGB to use ColorSpaceSRGB.
+
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::decode):
+        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _takeViewSnapshot]):
+        (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
+
</ins><span class="cx"> 2015-11-06  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Make the result data for a &quot;get&quot; request be an IDBGetResult.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">         MachSendRight sendRight;
</span><span class="cx">         if (!decoder.decode(sendRight))
</span><span class="cx">             return false;
</span><del>-        result.m_frontBuffer.surface = IOSurface::createFromSendRight(sendRight, ColorSpaceDeviceRGB);
</del><ins>+        result.m_frontBuffer.surface = IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">         std::swap(m_frontBuffer, m_backBuffer);
</span><span class="cx"> 
</span><span class="cx">         if (!m_frontBuffer.surface)
</span><del>-            m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceDeviceRGB);
</del><ins>+            m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB);
</ins><span class="cx"> 
</span><span class="cx">         setBufferVolatility(BufferType::Front, false);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (192137 => 192138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-11-08 04:04:23 UTC (rev 192137)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-11-08 06:31:50 UTC (rev 192138)
</span><span class="lines">@@ -1153,7 +1153,7 @@
</span><span class="cx">     CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1);
</span><span class="cx"> 
</span><span class="cx"> #if USE(IOSURFACE)
</span><del>-    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceDeviceRGB);
</del><ins>+    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceSRGB);
</ins><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><span class="cx">     RefPtr&lt;WebKit::ViewSnapshot&gt; viewSnapshot = WebKit::ViewSnapshot::create(nullptr);
</span><span class="lines">@@ -3825,7 +3825,7 @@
</span><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx">     // If we are parented and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly.
</span><span class="cx">     if (CADisplay *display = self.window.screen._display) {
</span><del>-        auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::ColorSpaceDeviceRGB);
</del><ins>+        auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(WebCore::FloatSize(imageSize)), WebCore::ColorSpaceSRGB);
</ins><span class="cx">         CGFloat imageScaleInViewCoordinates = imageWidth / rectInViewCoordinates.size.width;
</span><span class="cx">         CATransform3D transform = CATransform3DMakeScale(imageScaleInViewCoordinates, imageScaleInViewCoordinates, 1);
</span><span class="cx">         transform = CATransform3DTranslate(transform, -rectInViewCoordinates.origin.x, -rectInViewCoordinates.origin.y, 0);
</span></span></pre>
</div>
</div>

</body>
</html>