Title: [183950] trunk
- Revision
- 183950
- Author
- za...@apple.com
- Date
- 2015-05-07 15:03:12 -0700 (Thu, 07 May 2015)
Log Message
REGRESSION (r164449): Subpixel rendering: http://www.apple.com/iphone-6/ "Faster wireless." 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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (183949 => 183950)
--- trunk/LayoutTests/ChangeLog 2015-05-07 21:45:30 UTC (rev 183949)
+++ trunk/LayoutTests/ChangeLog 2015-05-07 22:03:12 UTC (rev 183950)
@@ -1,3 +1,21 @@
+2015-05-07 Zalan Bujtas <za...@apple.com>
+
+ REGRESSION (r164449): Subpixel rendering: http://www.apple.com/iphone-6/ "Faster wireless." 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.
+
2015-05-07 Yoav Weiss <y...@yoav.ws>
Fix sizes crash and add invalid value tests.
Added: trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html (0 => 183950)
--- trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position-expected.html 2015-05-07 22:03:12 UTC (rev 183950)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that child content snapped to device pixel (borders are clear) when ancestor compositing layer has fractional bounds.</title>
+<style>
+ .container {
+ position: absolute;
+ top: 10px;
+ width: 40px;
+ height: 40px;
+ }
+
+ .fuzzy {
+ border: 1px solid blue;
+ width: 10px;
+ height: 10px;
+ }
+</style>
+</head>
+<body>
+<script>
+ var delta = -1;
+ for (i = 0; i < 11; ++i) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = 45 * i + "px";
+ document.body.appendChild(container);
+
+ var fuzzy = document.createElement("div");
+ fuzzy.className = "fuzzy";
+ container.appendChild(fuzzy);
+ delta -= 0.1;
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html (0 => 183950)
--- trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html (rev 0)
+++ trunk/LayoutTests/compositing/ancestor-compositing-layer-is-on-subpixel-position.html 2015-05-07 22:03:12 UTC (rev 183950)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that child content snapped to device pixel (borders are clear) when ancestor compositing layer has fractional bounds.</title>
+<style>
+ .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);
+ }
+</style>
+</head>
+<body>
+ <div class=overlap></div>
+<script>
+ var delta = -1;
+ for (i = 0; i < 11; ++i) {
+ var container = document.createElement("div");
+ container.className = "container";
+ container.style.left = 45 * i + "px";
+ document.body.appendChild(container);
+
+ var pushHorizontal = document.createElement("div");
+ pushHorizontal.className = "push_horizontal";
+ pushHorizontal.style.left = delta + "px";
+ pushHorizontal.style.top = "0px";
+ container.appendChild(pushHorizontal);
+
+ var pushVertical = document.createElement("div");
+ pushVertical.className = "push_vertical";
+ pushVertical.style.left = "0px";
+ pushVertical.style.top = delta + "px";
+ container.appendChild(pushVertical);
+
+ var fuzzy = document.createElement("div");
+ fuzzy.className = "fuzzy";
+ container.appendChild(fuzzy);
+ delta -= 0.1;
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt (183949 => 183950)
--- trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt 2015-05-07 21:45:30 UTC (rev 183949)
+++ trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt 2015-05-07 22:03:12 UTC (rev 183950)
@@ -18,7 +18,7 @@
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 21.13 11.00)
+ (position 22.00 11.00)
(bounds 102.00 102.00)
(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])
)
Modified: trunk/Source/WebCore/ChangeLog (183949 => 183950)
--- trunk/Source/WebCore/ChangeLog 2015-05-07 21:45:30 UTC (rev 183949)
+++ trunk/Source/WebCore/ChangeLog 2015-05-07 22:03:12 UTC (rev 183950)
@@ -1,3 +1,22 @@
+2015-05-07 Zalan Bujtas <za...@apple.com>
+
+ REGRESSION (r164449): Subpixel rendering: http://www.apple.com/iphone-6/ "Faster wireless." 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):
+
2015-05-07 Yoav Weiss <y...@yoav.ws>
Fix sizes crash and add invalid value tests.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (183949 => 183950)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-05-07 21:45:30 UTC (rev 183949)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-05-07 22:03:12 UTC (rev 183950)
@@ -695,16 +695,6 @@
bool preserves3D = style.transformStyle3D() == TransformStyle3DPreserve3D && !renderer().hasReflection();
m_graphicsLayer->setPreserves3D(preserves3D);
m_graphicsLayer->setBackfaceVisibility(style.backfaceVisibility() == BackfaceVisibilityVisible);
-
- RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
-
- // We compute everything relative to the enclosing compositing layer.
- LayoutRect ancestorCompositingBounds;
- if (compAncestor) {
- ASSERT(compAncestor->backing());
- ancestorCompositingBounds = compAncestor->backing()->compositedBounds();
- }
-
/*
* GraphicsLayer: device pixel positioned, enclosing rect.
* RenderLayer: subpixel positioned.
@@ -730,6 +720,13 @@
* devicePixelFractionFromRenderer: rendererOffsetFromGraphicsLayer's fractional part (6.9px -> 0.4px in case of 2x display)
*/
float deviceScaleFactor = this->deviceScaleFactor();
+ RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
+ // We compute everything relative to the enclosing compositing layer.
+ LayoutRect ancestorCompositingBounds;
+ if (compAncestor) {
+ ASSERT(compAncestor->backing());
+ ancestorCompositingBounds = compAncestor->backing()->compositedBounds();
+ }
LayoutRect localCompositingBounds = compositedBounds();
LayoutRect relativeCompositingBounds(localCompositingBounds);
@@ -800,16 +797,17 @@
}
LayoutSize contentsSize = enclosingRelativeCompositingBounds.size();
-
if (m_contentsContainmentLayer) {
m_contentsContainmentLayer->setPreserves3D(preserves3D);
- m_contentsContainmentLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
+ FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
+ m_contentsContainmentLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
// Use the same size as m_graphicsLayer so transforms behave correctly.
m_contentsContainmentLayer->setSize(contentsSize);
graphicsLayerParentLocation = enclosingRelativeCompositingBounds.location();
}
- m_graphicsLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
+ FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);
+ m_graphicsLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));
m_graphicsLayer->setSize(contentsSize);
if (devicePixelOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
m_graphicsLayer->setOffsetFromRenderer(devicePixelOffsetFromRenderer);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes