<!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>[184184] releases/WebKitGTK/webkit-2.8</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/184184">184184</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-12 02:02:24 -0700 (Tue, 12 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/183950">r183950</a> - REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/164449">r164449</a>): Subpixel rendering: http://www.apple.com/iphone-6/ &quot;Faster wireless.&quot; image displays vertical black line on 1x displays at specific window width.
https://bugs.webkit.org/show_bug.cgi?id=144723
rdar://problem/18307094

Reviewed by Simon Fraser.

This patch ensures that the backing store's graphics layer is always positioned on a device pixel boundary.

While calculating the backing store's graphics layer location, its ancestor layer's compositing bounds is taken into account.
However the compositing bounds is an unsnapped value, so in order to place the graphics layer properly,
we need to pixel align the ancestor compositing bounds before using it to adjust the child's graphics layer position.

Source/WebCore:

Test: compositing/ancestor-compositing-layer-is-on-subpixel-position.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):

LayoutTests:

* compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html: Added.
* compositing/ancestor-compositing-layer-is-on-subpixel-position.html: Added.
* platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt: progression.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsplatformmaccompositinglayercreationoverlapanimationcontainerexpectedtxt">releases/WebKitGTK/webkit-2.8/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderLayerBackingcpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestscompositingancestorcompositinglayerisonsubpixelpositionexpectedhtml">releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestscompositingancestorcompositinglayerisonsubpixelpositionhtml">releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (184183 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-05-12 09:01:07 UTC (rev 184183)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-05-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        REGRESSION (r164449): Subpixel rendering: http://www.apple.com/iphone-6/ &quot;Faster wireless.&quot; image displays vertical black line on 1x displays at specific window width.
+        https://bugs.webkit.org/show_bug.cgi?id=144723
+        rdar://problem/18307094
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the backing store's graphics layer is always positioned on a device pixel boundary.
+
+        While calculating the backing store's graphics layer location, its ancestor layer's compositing bounds is taken into account.
+        However the compositing bounds is an unsnapped value, so in order to place the graphics layer properly,
+        we need to pixel align the ancestor compositing bounds before using it to adjust the child's graphics layer position.
+
+        * compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html: Added.
+        * compositing/ancestor-compositing-layer-is-on-subpixel-position.html: Added.
+        * platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt: progression.
+
</ins><span class="cx"> 2015-05-07  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix sizes crash and add invalid value tests.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestscompositingancestorcompositinglayerisonsubpixelpositionexpectedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html (0 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that child content snapped to device pixel (borders are clear) when ancestor compositing layer has fractional bounds.&lt;/title&gt;
+&lt;style&gt;
+        .container {
+            position: absolute;
+            top: 10px;
+                width: 40px;
+                height: 40px;
+        }
+
+        .fuzzy {
+                border: 1px solid blue;
+                width: 10px;
+                height: 10px;
+        }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+        var delta = -1;
+        for (i = 0; i &lt; 11; ++i) {
+                  var container = document.createElement(&quot;div&quot;);
+                  container.className = &quot;container&quot;;
+                  container.style.left = 45 * i + &quot;px&quot;;
+                  document.body.appendChild(container);
+
+                  var fuzzy = document.createElement(&quot;div&quot;);
+                  fuzzy.className = &quot;fuzzy&quot;;
+                  container.appendChild(fuzzy);
+                  delta -= 0.1;
+        }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestscompositingancestorcompositinglayerisonsubpixelpositionhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html (0 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that child content snapped to device pixel (borders are clear) when ancestor compositing layer has fractional bounds.&lt;/title&gt;
+&lt;style&gt;
+        .overlap { 
+                -webkit-transform: translateZ(0);
+                width: 500px;
+                height: 40px;
+                margin-bottom: -5px;
+        }
+
+        .container {
+            position: absolute;
+            top: 10px;
+                width: 40px;
+                height: 40px;
+                z-index: 0;
+        }
+
+        .push_horizontal {
+                position: absolute;
+                  left: -1.4px;
+                  width: 5px;
+                  height: 5px;
+        }
+
+        .push_vertical {
+                position: absolute;
+                  top: -1.4px;
+                  width: 5px;
+                  height: 5px;
+        }
+
+        .fuzzy {
+                border: 1px solid blue;
+                width: 10px;
+                height: 10px;
+                -webkit-transform: translateZ(0);
+        }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div class=overlap&gt;&lt;/div&gt;
+&lt;script&gt;
+        var delta = -1;
+        for (i = 0; i &lt; 11; ++i) {
+                  var container = document.createElement(&quot;div&quot;);
+                  container.className = &quot;container&quot;;
+                  container.style.left = 45 * i + &quot;px&quot;;
+                  document.body.appendChild(container);
+
+                  var pushHorizontal = document.createElement(&quot;div&quot;);
+                  pushHorizontal.className = &quot;push_horizontal&quot;;
+                  pushHorizontal.style.left = delta + &quot;px&quot;;
+                  pushHorizontal.style.top = &quot;0px&quot;; 
+                  container.appendChild(pushHorizontal);
+
+                  var pushVertical = document.createElement(&quot;div&quot;);
+                  pushVertical.className = &quot;push_vertical&quot;;
+                  pushVertical.style.left = &quot;0px&quot;;
+                  pushVertical.style.top = delta + &quot;px&quot;; 
+                  container.appendChild(pushVertical);
+
+                  var fuzzy = document.createElement(&quot;div&quot;);
+                  fuzzy.className = &quot;fuzzy&quot;;
+                  container.appendChild(fuzzy);
+                  delta -= 0.1;
+        }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestsplatformmaccompositinglayercreationoverlapanimationcontainerexpectedtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt (184183 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt        2015-05-12 09:01:07 UTC (rev 184183)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx">           (drawsContent 1)
</span><span class="cx">           (children 1
</span><span class="cx">             (GraphicsLayer
</span><del>-              (position 21.13 11.00)
</del><ins>+              (position 22.00 11.00)
</ins><span class="cx">               (bounds 102.00 102.00)
</span><span class="cx">               (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 -1.00 1.00])
</span><span class="cx">             )
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184183 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-12 09:01:07 UTC (rev 184183)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-05-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        REGRESSION (r164449): Subpixel rendering: http://www.apple.com/iphone-6/ &quot;Faster wireless.&quot; image displays vertical black line on 1x displays at specific window width.
+        https://bugs.webkit.org/show_bug.cgi?id=144723
+        rdar://problem/18307094
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the backing store's graphics layer is always positioned on a device pixel boundary.
+
+        While calculating the backing store's graphics layer location, its ancestor layer's compositing bounds is taken into account.
+        However the compositing bounds is an unsnapped value, so in order to place the graphics layer properly,
+        we need to pixel align the ancestor compositing bounds before using it to adjust the child's graphics layer position.
+
+        Test: compositing/ancestor-compositing-layer-is-on-subpixel-position.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+
</ins><span class="cx"> 2015-05-07  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix sizes crash and add invalid value tests.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp (184183 => 184184)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-05-12 09:01:07 UTC (rev 184183)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-05-12 09:02:24 UTC (rev 184184)
</span><span class="lines">@@ -683,16 +683,6 @@
</span><span class="cx">     bool preserves3D = style.transformStyle3D() == TransformStyle3DPreserve3D &amp;&amp; !renderer().hasReflection();
</span><span class="cx">     m_graphicsLayer-&gt;setPreserves3D(preserves3D);
</span><span class="cx">     m_graphicsLayer-&gt;setBackfaceVisibility(style.backfaceVisibility() == BackfaceVisibilityVisible);
</span><del>-
-    RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
-    
-    // We compute everything relative to the enclosing compositing layer.
-    LayoutRect ancestorCompositingBounds;
-    if (compAncestor) {
-        ASSERT(compAncestor-&gt;backing());
-        ancestorCompositingBounds = compAncestor-&gt;backing()-&gt;compositedBounds();
-    }
-
</del><span class="cx">     /*
</span><span class="cx">     * GraphicsLayer: device pixel positioned, enclosing rect.
</span><span class="cx">     * RenderLayer: subpixel positioned.
</span><span class="lines">@@ -718,6 +708,13 @@
</span><span class="cx">     * devicePixelFractionFromRenderer: rendererOffsetFromGraphicsLayer's fractional part (6.9px -&gt; 0.4px in case of 2x display)
</span><span class="cx">     */
</span><span class="cx">     float deviceScaleFactor = this-&gt;deviceScaleFactor();
</span><ins>+    RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
+    // We compute everything relative to the enclosing compositing layer.
+    LayoutRect ancestorCompositingBounds;
+    if (compAncestor) {
+        ASSERT(compAncestor-&gt;backing());
+        ancestorCompositingBounds = compAncestor-&gt;backing()-&gt;compositedBounds();
+    }
</ins><span class="cx">     LayoutRect localCompositingBounds = compositedBounds();
</span><span class="cx">     LayoutRect relativeCompositingBounds(localCompositingBounds);
</span><span class="cx"> 
</span><span class="lines">@@ -788,16 +785,17 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     LayoutSize contentsSize = enclosingRelativeCompositingBounds.size();
</span><del>-    
</del><span class="cx">     if (m_contentsContainmentLayer) {
</span><span class="cx">         m_contentsContainmentLayer-&gt;setPreserves3D(preserves3D);
</span><del>-        m_contentsContainmentLayer-&gt;setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
</del><ins>+        FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
+        m_contentsContainmentLayer-&gt;setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
</ins><span class="cx">         // Use the same size as m_graphicsLayer so transforms behave correctly.
</span><span class="cx">         m_contentsContainmentLayer-&gt;setSize(contentsSize);
</span><span class="cx">         graphicsLayerParentLocation = enclosingRelativeCompositingBounds.location();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_graphicsLayer-&gt;setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
</del><ins>+    FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
+    m_graphicsLayer-&gt;setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
</ins><span class="cx">     m_graphicsLayer-&gt;setSize(contentsSize);
</span><span class="cx">     if (devicePixelOffsetFromRenderer != m_graphicsLayer-&gt;offsetFromRenderer()) {
</span><span class="cx">         m_graphicsLayer-&gt;setOffsetFromRenderer(devicePixelOffsetFromRenderer);
</span></span></pre>
</div>
</div>

</body>
</html>