Title: [167582] trunk
Revision
167582
Author
[email protected]
Date
2014-04-20 22:21:45 -0700 (Sun, 20 Apr 2014)

Log Message

Subpixel rendering: RenderLayer's size is set using enclosingRect() which can result in cruft.
https://bugs.webkit.org/show_bug.cgi?id=131468

Reviewed by Darin Adler.

Layers marked opaque may not paint edge pixels, when RenderLayer bounds are non-integral and
get device pixel snapped.
For details see this: https://trac.webkit.org/r159463

Source/WebCore:
Test: compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html

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

LayoutTests:
* compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html: Added.
* compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167581 => 167582)


--- trunk/LayoutTests/ChangeLog	2014-04-21 04:43:46 UTC (rev 167581)
+++ trunk/LayoutTests/ChangeLog	2014-04-21 05:21:45 UTC (rev 167582)
@@ -1,3 +1,17 @@
+2014-04-20  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: RenderLayer's size is set using enclosingRect() which can result in cruft.
+        https://bugs.webkit.org/show_bug.cgi?id=131468
+
+        Reviewed by Darin Adler.
+
+        Layers marked opaque may not paint edge pixels, when RenderLayer bounds are non-integral and
+        get device pixel snapped.
+        For details see this: https://trac.webkit.org/r159463
+
+        * compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html: Added.
+        * compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html: Added.
+
 2014-04-19  Darin Adler  <[email protected]>
 
         Simple layout can get confused by coordinate overflow

Added: trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html (0 => 167582)


--- trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html	2014-04-21 05:21:45 UTC (rev 167582)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that a non simple render backing layer with fractional CSS pixel size paints the background with no cruft.</title>
+<head>
+<style>
+  div {
+    background: green; 
+    position: absolute;
+    border: 0.5px solid red;
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.1;
+  w = 2; h = 2;
+  for (i = 0; i < 30; ++i) {
+    adjustment += 0.1;
+    for (j = 0; j < 40; ++j) {
+      var e = document.createElement("div");
+      e.style.top = ((w + 2) * i + j * adjustment) + "px";
+      e.style.left = ((w + 2) * j + i * adjustment) + "px";
+      e.style.width = w + "px";
+      e.style.height = h + "px";
+      container.appendChild(e);
+      w += 0.01;
+      h += 0.01;
+    }
+  }
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html (0 => 167582)


--- trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html	2014-04-21 05:21:45 UTC (rev 167582)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that a non simple render backing layer with fractional CSS pixel size paints the background with no cruft.</title>
+<head>
+<style>
+  div {
+    background: green; 
+    position: absolute;
+    border: 0.5px solid red;
+    -webkit-transform: translateZ(0);
+  }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+  var container = document.getElementById("container");
+  adjustment = 0.1;
+  w = 2; h = 2;
+  for (i = 0; i < 30; ++i) {
+    adjustment += 0.1;
+    for (j = 0; j < 40; ++j) {
+      var e = document.createElement("div");
+      e.style.top = ((w + 2) * i + j * adjustment) + "px";
+      e.style.left = ((w + 2) * j + i * adjustment) + "px";
+      e.style.width = w + "px";
+      e.style.height = h + "px";
+      container.appendChild(e);
+      w += 0.01;
+      h += 0.01;
+    }
+  }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (167581 => 167582)


--- trunk/Source/WebCore/ChangeLog	2014-04-21 04:43:46 UTC (rev 167581)
+++ trunk/Source/WebCore/ChangeLog	2014-04-21 05:21:45 UTC (rev 167582)
@@ -1,3 +1,19 @@
+2014-04-20  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: RenderLayer's size is set using enclosingRect() which can result in cruft.
+        https://bugs.webkit.org/show_bug.cgi?id=131468
+
+        Reviewed by Darin Adler.
+
+        Layers marked opaque may not paint edge pixels, when RenderLayer bounds are non-integral and
+        get device pixel snapped.
+        For details see this: https://trac.webkit.org/r159463
+
+        Test: compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+
 2014-04-19  Darin Adler  <[email protected]>
 
         Simple layout can get confused by coordinate overflow

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (167581 => 167582)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-04-21 04:43:46 UTC (rev 167581)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-04-21 05:21:45 UTC (rev 167582)
@@ -712,7 +712,7 @@
     }
 
     /*
-    * GraphicsLayer: device pixel positioned. Floored, enclosing rect.
+    * GraphicsLayer: device pixel positioned, enclosing rect.
     * RenderLayer: subpixel positioned.
     * Offset from renderer (GraphicsLayer <-> RenderLayer::renderer()): subpixel based offset.
     *
@@ -730,7 +730,7 @@
     *
     * localCompositingBounds: this RenderLayer relative to its renderer().
     * relativeCompositingBounds: this RenderLayer relative to its parent compositing layer.
-    * enclosingRelativeCompositingBounds: this RenderLayer relative to its parent but floored to device pixel position.
+    * enclosingRelativeCompositingBounds: this RenderLayer relative to its parent, device pixel enclosing.
     * rendererOffsetFromGraphicsLayer: RenderLayer::renderer()'s offset from its enclosing GraphicsLayer.
     * devicePixelOffsetFromRenderer: rendererOffsetFromGraphicsLayer's device pixel part. (6.9px -> 6.5px in case of 2x display)
     * devicePixelFractionFromRenderer: rendererOffsetFromGraphicsLayer's fractional part (6.9px -> 0.4px in case of 2x display)
@@ -823,7 +823,7 @@
     if (!m_isMainFrameRenderViewLayer) {
         // For non-root layers, background is always painted by the primary graphics layer.
         ASSERT(!m_backgroundLayer);
-        bool hadSubpixelRounding = !m_devicePixelFractionFromRenderer.isZero();
+        bool hadSubpixelRounding = enclosingRelativeCompositingBounds != relativeCompositingBounds;
         m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to