Title: [199408] releases/WebKitGTK/webkit-2.12
Revision
199408
Author
[email protected]
Date
2016-04-12 23:37:10 -0700 (Tue, 12 Apr 2016)

Log Message

Merge r198309 - Subpixel rendering: Directly composited image layers need pixelsnapping.
https://bugs.webkit.org/show_bug.cgi?id=155558

Reviewed by Simon Fraser.

In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
layer bounds for directly composited images.

Source/WebCore:

Test: fast/images/hidpi-directly-composited-image-on-subpixel-position.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::resetContentsRect):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateImageContents):

LayoutTests:

* fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html: Added.
* fast/images/hidpi-directly-composited-image-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (199407 => 199408)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 06:35:49 UTC (rev 199407)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-13 06:37:10 UTC (rev 199408)
@@ -1,3 +1,16 @@
+2016-03-16  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Directly composited image layers need pixelsnapping.
+        https://bugs.webkit.org/show_bug.cgi?id=155558
+
+        Reviewed by Simon Fraser.
+
+        In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
+        layer bounds for directly composited images.
+
+        * fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html: Added.
+        * fast/images/hidpi-directly-composited-image-on-subpixel-position.html: Added.
+
 2016-03-16  Jiewen Tan  <[email protected]>
 
         URL Parsing should signal failure for illegal IDN

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html (0 => 199408)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html	2016-04-13 06:37:10 UTC (rev 199408)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we position directly composited images properly.</title>
+<style>
+img {
+    position: absolute;
+    width: 10px;
+    height: 10px;
+  }
+</style>
+</head>
+<body>
+<div id=container></div>
+</body>
+<script>
+var container = document.getElementById("container");
+var offset = 0;
+for (i = 0; i < 20; ++i) {
+    for (j = 0; j < 20; ++j) {
+        var element = document.createElement("img");
+        element.src = ""
+        element.style.top = 15 * i + offset;
+        element.style.left = 15 * j + offset;
+        container.appendChild(element);
+    }
+    offset += 0.2;
+}
+</script>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html (0 => 199408)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html	2016-04-13 06:37:10 UTC (rev 199408)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we position directly composited images properly.</title>
+<style>
+img {
+    position: absolute;
+    width: 10px;
+    height: 10px;
+    -webkit-transform: translateZ(0);
+  }
+</style>
+</head>
+<body>
+<div id=container></div>
+</body>
+<script>
+var container = document.getElementById("container");
+var offset = 0;
+for (i = 0; i < 20; ++i) {
+    for (j = 0; j < 20; ++j) {
+        var element = document.createElement("img");
+        element.src = ""
+        element.style.top = 15 * i + offset;
+        element.style.left = 15 * j + offset;
+        container.appendChild(element);
+    }
+    offset += 0.2;
+}
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (199407 => 199408)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 06:35:49 UTC (rev 199407)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-13 06:37:10 UTC (rev 199408)
@@ -1,3 +1,20 @@
+2016-03-16  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Directly composited image layers need pixelsnapping.
+        https://bugs.webkit.org/show_bug.cgi?id=155558
+
+        Reviewed by Simon Fraser.
+
+        In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
+        layer bounds for directly composited images.
+
+        Test: fast/images/hidpi-directly-composited-image-on-subpixel-position.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::resetContentsRect):
+        (WebCore::RenderLayerBacking::updateChildClippingStrategy):
+        (WebCore::RenderLayerBacking::updateImageContents):
+
 2016-03-16  Alex Christensen  <[email protected]>
 
         Fix assertion failure on drive.google.com after r196052

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderLayerBacking.cpp (199407 => 199408)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderLayerBacking.cpp	2016-04-13 06:35:49 UTC (rev 199407)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderLayerBacking.cpp	2016-04-13 06:37:10 UTC (rev 199408)
@@ -1205,12 +1205,12 @@
 
 void RenderLayerBacking::resetContentsRect()
 {
-    m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
+    m_graphicsLayer->setContentsRect(snapRectToDevicePixels(contentsBox(), deviceScaleFactor()));
     
     if (is<RenderBox>(renderer())) {
         LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
+        boxRect.move(contentOffsetInCompostingLayer());
         FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
-        contentsClippingRect.move(contentOffsetInCompostingLayer());
         m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
     }
 
@@ -1549,8 +1549,8 @@
         if (is<RenderBox>(renderer()) && (renderer().style().clipPath() || renderer().style().hasBorderRadius())) {
             // FIXME: we shouldn't get geometry here as layout may not have been udpated.
             LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
+            boxRect.move(contentOffsetInCompostingLayer());
             FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
-            contentsClippingRect.move(contentOffsetInCompostingLayer());
             if (clippingLayer()->setMasksToBoundsRect(contentsClippingRect)) {
                 if (m_childClippingMaskLayer) 
                     m_childClippingMaskLayer = nullptr;
@@ -2062,11 +2062,11 @@
         return;
 
     // This is a no-op if the layer doesn't have an inner layer for the image.
-    m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
+    m_graphicsLayer->setContentsRect(snapRectToDevicePixels(contentsBox(), deviceScaleFactor()));
 
     LayoutRect boxRect(LayoutPoint(), imageRenderer.size());
+    boxRect.move(contentOffsetInCompostingLayer());
     FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
-    contentsClippingRect.move(contentOffsetInCompostingLayer());
     m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
 
     m_graphicsLayer->setContentsToImage(image);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to