<!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>[186349] 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/186349">186349</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-06 06:29:00 -0700 (Mon, 06 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/185152">r185152</a> - Subpixel rendering: Composited layer with subpixel gap does not get painted properly when its position changes.
https://bugs.webkit.org/show_bug.cgi?id=145587
Reviewed by Simon Fraser.
The composited layer always snaps to an enclosing device pixel (floors) while the renderer rounds.
At certain positions (for example 0.5px on a 1x display), a gap is formed between the layer(0px) and its renderer(1px).
In such cases, when the the renderer moves to a position (1.1px) where the gap is closed, we need to issue repaint on the layer
in order to get the renderering right.
Source/WebCore:
Test: compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterLayout):
(WebCore::devicePixelFractionGapFromRendererChanged):
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/RenderLayerBacking.h:
LayoutTests:
* compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html: Added.
* compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog</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>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCorerenderingRenderLayerBackingh">releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestscompositingchildlayerwithsubpixelgapneedsrepaintwhenparentmovesexpectedhtml">releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html</a></li>
<li><a href="#releasesWebKitGTKwebkit28LayoutTestscompositingchildlayerwithsubpixelgapneedsrepaintwhenparentmoveshtml">releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.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 (186348 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-07-06 12:55:15 UTC (rev 186348)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-06-03 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Composited layer with subpixel gap does not get painted properly when its position changes.
+ https://bugs.webkit.org/show_bug.cgi?id=145587
+
+ Reviewed by Simon Fraser.
+
+ The composited layer always snaps to an enclosing device pixel (floors) while the renderer rounds.
+ At certain positions (for example 0.5px on a 1x display), a gap is formed between the layer(0px) and its renderer(1px).
+ In such cases, when the the renderer moves to a position (1.1px) where the gap is closed, we need to issue repaint on the layer
+ in order to get the renderering right.
+
+ * compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html: Added.
+ * compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html: Added.
+
</ins><span class="cx"> 2015-05-30 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (179771): zooming on facebook images covers image
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestscompositingchildlayerwithsubpixelgapneedsrepaintwhenparentmovesexpectedhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html (0 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves-expected.html        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we repaint child layer if the subpixel gap changes between layers when parent layer moves.</title>
+<style>
+ .outer {
+ position: relative;
+ left: 0.7px;
+ height: 200px;
+ width: 200px;
+ background-color: rgba(0, 0, 255, 1);
+ }
+
+ .container-background {
+ position: relative;
+ transform: translateZ(0);
+ height: 100px;
+ width: 100px;
+ background-color: green;
+ }
+
+</style>
+<body>
+<div id=container class=outer>foo
+ <div class=container-background>bar
+ </div>
+</div>
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28LayoutTestscompositingchildlayerwithsubpixelgapneedsrepaintwhenparentmoveshtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html (0 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html         (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we repaint child layer if the subpixel gap changes between layers when parent layer moves.</title>
+<style>
+ .outer {
+ position: relative;
+ left: 0.3px;
+ height: 200px;
+ width: 200px;
+ background-color: rgba(0, 0, 255, 1);
+ }
+
+ .container-background {
+ position: relative;
+ transform: translateZ(0);
+ height: 100px;
+ width: 100px;
+ background-color: green;
+ }
+
+</style>
+<script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ function runTest() {
+         setTimeout(function () {
+          document.getElementById("container").style.left = "0.7px";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }
+ window.addEventListener('load', runTest, false);
+</script>
+<body>
+<div id=container class=outer>foo
+ <div class=container-background>bar
+ </div>
+</div>
+</body>
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (186348 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-07-06 12:55:15 UTC (rev 186348)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-06-03 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Composited layer with subpixel gap does not get painted properly when its position changes.
+ https://bugs.webkit.org/show_bug.cgi?id=145587
+
+ Reviewed by Simon Fraser.
+
+ The composited layer always snaps to an enclosing device pixel (floors) while the renderer rounds.
+ At certain positions (for example 0.5px on a 1x display), a gap is formed between the layer(0px) and its renderer(1px).
+ In such cases, when the the renderer moves to a position (1.1px) where the gap is closed, we need to issue repaint on the layer
+ in order to get the renderering right.
+
+ Test: compositing/child-layer-with-subpixel-gap-needs-repaint-when-parent-moves.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateAfterLayout):
+ (WebCore::devicePixelFractionGapFromRendererChanged):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ * rendering/RenderLayerBacking.h:
+
</ins><span class="cx"> 2015-05-30 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (179771): zooming on facebook images covers image
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp (186348 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-07-06 12:55:15 UTC (rev 186348)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.cpp        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -517,7 +517,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (flags & NeedsFullRepaint && !paintsIntoWindow() && !paintsIntoCompositedAncestor())
</del><ins>+ if (flags & NeedsFullRepaint && canIssueSetNeedsDisplay())
</ins><span class="cx"> setContentsNeedDisplay();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -636,6 +636,13 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool devicePixelFractionGapFromRendererChanged(const LayoutSize& previousDevicePixelFractionFromRenderer, const LayoutSize& currentDevicePixelFractionFromRenderer, float deviceScaleFactor)
+{
+ FloatSize previous = snapSizeToDevicePixel(previousDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);
+ FloatSize current = snapSizeToDevicePixel(currentDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);
+ return previous != current;
+}
+
</ins><span class="cx"> static FloatSize pixelFractionForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor)
</span><span class="cx"> {
</span><span class="cx"> LayoutUnit x = point.x();
</span><span class="lines">@@ -730,6 +737,7 @@
</span><span class="cx"> FloatSize devicePixelOffsetFromRenderer;
</span><span class="cx"> LayoutSize devicePixelFractionFromRenderer;
</span><span class="cx"> calculateDevicePixelOffsetFromRenderer(rendererOffsetFromGraphicsLayer, devicePixelOffsetFromRenderer, devicePixelFractionFromRenderer, deviceScaleFactor);
</span><ins>+ LayoutSize oldDevicePixelFractionFromRenderer = m_devicePixelFractionFromRenderer;
</ins><span class="cx"> m_devicePixelFractionFromRenderer = LayoutSize(-devicePixelFractionFromRenderer.width(), -devicePixelFractionFromRenderer.height());
</span><span class="cx">
</span><span class="cx"> adjustAncestorCompositingBoundsForFlowThread(ancestorCompositingBounds, compAncestor);
</span><span class="lines">@@ -984,6 +992,9 @@
</span><span class="cx">
</span><span class="cx"> updateAfterWidgetResize();
</span><span class="cx">
</span><ins>+ if (devicePixelFractionGapFromRendererChanged(oldDevicePixelFractionFromRenderer, m_devicePixelFractionFromRenderer, deviceScaleFactor) && canIssueSetNeedsDisplay())
+ setContentsNeedDisplay();
+
</ins><span class="cx"> compositor().updateScrollCoordinatedStatus(m_owningLayer);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCorerenderingRenderLayerBackingh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.h (186348 => 186349)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.h        2015-07-06 12:55:15 UTC (rev 186348)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayerBacking.h        2015-07-06 13:29:00 UTC (rev 186349)
</span><span class="lines">@@ -331,6 +331,8 @@
</span><span class="cx"> static CSSPropertyID graphicsLayerToCSSProperty(AnimatedPropertyID);
</span><span class="cx"> static AnimatedPropertyID cssToGraphicsLayerProperty(CSSPropertyID);
</span><span class="cx">
</span><ins>+ bool canIssueSetNeedsDisplay() const { return !paintsIntoWindow() && !paintsIntoCompositedAncestor(); }
+
</ins><span class="cx"> RenderLayer& m_owningLayer;
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
</span></span></pre>
</div>
</div>
</body>
</html>