Title: [184373] trunk
Revision
184373
Author
[email protected]
Date
2015-05-14 22:09:46 -0700 (Thu, 14 May 2015)

Log Message

Images on www.fitstylelife.com jiggle on hover.
https://bugs.webkit.org/show_bug.cgi?id=145020
rdar://problem/20885337

Reviewed by Simon Fraser.

This patch ensures that the clipping layer of a composited content is pixel snapped properly.

Source/WebCore:

Tests: compositing/composited-parent-clipping-layer-on-subpixel-position.html
       compositing/parent-clipping-layer-on-subpixel-position.html

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

LayoutTests:

* compositing/composited-parent-clipping-layer-on-subpixel-position-expected.html: Added.
* compositing/composited-parent-clipping-layer-on-subpixel-position.html: Added.
* compositing/parent-clipping-layer-on-subpixel-position-expected.html: Added.
* compositing/parent-clipping-layer-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (184372 => 184373)


--- trunk/LayoutTests/ChangeLog	2015-05-15 05:07:22 UTC (rev 184372)
+++ trunk/LayoutTests/ChangeLog	2015-05-15 05:09:46 UTC (rev 184373)
@@ -1,3 +1,18 @@
+2015-05-14  Zalan Bujtas  <[email protected]>
+
+        Images on www.fitstylelife.com jiggle on hover.
+        https://bugs.webkit.org/show_bug.cgi?id=145020
+        rdar://problem/20885337
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the clipping layer of a composited content is pixel snapped properly.
+
+        * compositing/composited-parent-clipping-layer-on-subpixel-position-expected.html: Added.
+        * compositing/composited-parent-clipping-layer-on-subpixel-position.html: Added.
+        * compositing/parent-clipping-layer-on-subpixel-position-expected.html: Added.
+        * compositing/parent-clipping-layer-on-subpixel-position.html: Added.
+
 2015-05-14  Simon Fraser  <[email protected]>
 
         REGRESSION (r183794): Garbage tiles when body background switches to fixed

Added: trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position-expected.html (0 => 184373)


--- trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position-expected.html	2015-05-15 05:09:46 UTC (rev 184373)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the composited parent container enforces clipping and it is on a subpixel position, we snap composited child content properly.</title>
+<style>
+	.container {
+		width: 15px;
+		height: 15px;
+		position: absolute;
+		-webkit-transform: translateZ(0);
+	}
+
+	.inner {
+		width: 10px;
+		height: 10px;
+		border: 1px solid red;
+		-webkit-transform: translateZ(0);
+	}
+</style>
+</head>
+<body>
+</div>
+<script>
+	var body = document.body;
+	var x = 0;
+	var y = 0;
+	for (i = 0; i < 20; ++i) {
+	    y = 0;
+		for (j = 0; j < 20; ++j) {
+			var container = document.createElement("div");
+			container.style.top = 15 * i + y + "px";
+			container.style.left = 15 * j + x + "px";
+			container.className = "container";
+			body.appendChild(container);
+
+			var inner = document.createElement("div");
+			inner.className = "inner";
+			container.appendChild(inner);
+			y += 0.1;
+		}
+		x += 0.1;
+	}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position.html (0 => 184373)


--- trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/composited-parent-clipping-layer-on-subpixel-position.html	2015-05-15 05:09:46 UTC (rev 184373)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the composited parent container enforces clipping and it is on a subpixel position, we snap child content properly.</title>
+<style>
+	.container {
+		width: 15px;
+		height: 15px;
+		position: absolute;
+		overflow: hidden;
+		-webkit-transform: translateZ(0);
+	}
+
+	.inner {
+		width: 10px;
+		height: 10px;
+		border: 1px solid red;
+		-webkit-transform: translateZ(0);
+	}
+</style>
+</head>
+<body>
+</div>
+<script>
+	var body = document.body;
+	var x = 0;
+	var y = 0;
+	for (i = 0; i < 20; ++i) {
+	    y = 0;
+		for (j = 0; j < 20; ++j) {
+			var container = document.createElement("div");
+			container.style.top = 15 * i + y + "px";
+			container.style.left = 15 * j + x + "px";
+			container.className = "container";
+			body.appendChild(container);
+
+			var inner = document.createElement("div");
+			inner.className = "inner";
+			container.appendChild(inner);
+			y += 0.1;
+		}
+		x += 0.1;
+	}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position-expected.html (0 => 184373)


--- trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position-expected.html	2015-05-15 05:09:46 UTC (rev 184373)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the parent container enforces clipping and it is on a subpixel position, we snap child content properly.</title>
+<style>
+	.container {
+		width: 15px;
+		height: 15px;
+		position: absolute;
+	}
+
+	.inner {
+		width: 10px;
+		height: 10px;
+		border: 1px solid red;
+		-webkit-transform: translateZ(0);
+	}
+</style>
+</head>
+<body>
+</div>
+<script>
+	var body = document.body;
+	var x = 0;
+	var y = 0;
+	for (i = 0; i < 20; ++i) {
+	    y = 0;
+		for (j = 0; j < 20; ++j) {
+			var container = document.createElement("div");
+			container.style.top = 15 * i + y + "px";
+			container.style.left = 15 * j + x + "px";
+			container.className = "container";
+			body.appendChild(container);
+
+			var inner = document.createElement("div");
+			inner.className = "inner";
+			container.appendChild(inner);
+			y += 0.1;
+		}
+		x += 0.1;
+	}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position.html (0 => 184373)


--- trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/parent-clipping-layer-on-subpixel-position.html	2015-05-15 05:09:46 UTC (rev 184373)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that when the parent container enforces clipping and it is on a subpixel position, we snap child content properly.</title>
+<style>
+	.container {
+		width: 15px;
+		height: 15px;
+		position: absolute;
+		overflow: hidden;
+	}
+
+	.inner {
+		width: 10px;
+		height: 10px;
+		border: 1px solid red;
+		-webkit-transform: translateZ(0);
+	}
+</style>
+</head>
+<body>
+</div>
+<script>
+	var body = document.body;
+	var x = 0;
+	var y = 0;
+	for (i = 0; i < 20; ++i) {
+	    y = 0;
+		for (j = 0; j < 20; ++j) {
+			var container = document.createElement("div");
+			container.style.top = 15 * i + y + "px";
+			container.style.left = 15 * j + x + "px";
+			container.className = "container";
+			body.appendChild(container);
+
+			var inner = document.createElement("div");
+			inner.className = "inner";
+			container.appendChild(inner);
+			y += 0.1;
+		}
+		x += 0.1;
+	}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (184372 => 184373)


--- trunk/Source/WebCore/ChangeLog	2015-05-15 05:07:22 UTC (rev 184372)
+++ trunk/Source/WebCore/ChangeLog	2015-05-15 05:09:46 UTC (rev 184373)
@@ -1,3 +1,19 @@
+2015-05-14  Zalan Bujtas  <[email protected]>
+
+        Images on www.fitstylelife.com jiggle on hover.
+        https://bugs.webkit.org/show_bug.cgi?id=145020
+        rdar://problem/20885337
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that the clipping layer of a composited content is pixel snapped properly.
+
+        Tests: compositing/composited-parent-clipping-layer-on-subpixel-position.html
+               compositing/parent-clipping-layer-on-subpixel-position.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+
 2015-05-14  Chris Dumez  <[email protected]>
 
         Have DOMWindow::createWindow() take references to frames

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (184372 => 184373)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-05-15 05:07:22 UTC (rev 184372)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-05-15 05:09:46 UTC (rev 184373)
@@ -786,7 +786,8 @@
         RenderLayer::ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
         LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
         ASSERT(!parentClipRect.isInfinite());
-        m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
+        FloatPoint enclosingClippingLayerPosition = floorPointToDevicePixels(LayoutPoint(parentClipRect.location() - graphicsLayerParentLocation), deviceScaleFactor);
+        m_ancestorClippingLayer->setPosition(enclosingClippingLayerPosition);
         m_ancestorClippingLayer->setSize(parentClipRect.size());
 
         // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to