Diff
Modified: trunk/LayoutTests/ChangeLog (164448 => 164449)
--- trunk/LayoutTests/ChangeLog 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/LayoutTests/ChangeLog 2014-02-20 23:04:20 UTC (rev 164449)
@@ -1,3 +1,21 @@
+2014-02-20 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Enable compositing RenderLayer painting on device pixel position.
+ https://bugs.webkit.org/show_bug.cgi?id=128509
+
+ Reviewed by Simon Fraser.
+
+ GraphicsLayer is now positioned on device pixel boundary. This enables us to put
+ compositing layers on a subpixel position and animate them with device pixel
+ precision.
+
+ * TestExpectations:
+ * fast/sub-pixel/compositing-layers-on-subpixel-position-expected.html: Added.
+ * fast/sub-pixel/compositing-layers-on-subpixel-position.html: Added.
+ * fast/sub-pixel/simple-clipping-expected.html: Added.
+ * fast/sub-pixel/simple-clipping.html: Added.
+ * platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt:
+
2014-02-20 Mark Hahnenberg <[email protected]>
Unskip fast/workers/use-machine-stack.html
Modified: trunk/LayoutTests/TestExpectations (164448 => 164449)
--- trunk/LayoutTests/TestExpectations 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/LayoutTests/TestExpectations 2014-02-20 23:04:20 UTC (rev 164449)
@@ -102,3 +102,7 @@
webkit.org/b/83618 fast/dom/inline-event-attributes-release.html [ Failure ]
webkit.org/b/129057 media/controls-styling-strict.html [ Pass Failure ]
+
+#subpixel failure on non-retina displays.
+webkit.org/b/129050 fast/sub-pixel/compositing-layers-on-subpixel-position.html [ Failure ]
+webkit.org/b/129113 fast/multicol/newmulticol/clipping.html [ Failure ]
Added: trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position-expected.html (0 => 164449)
--- trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position-expected.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position-expected.html 2014-02-20 23:04:20 UTC (rev 164449)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we properly position render layers when composition is introduced.</title>
+<style>
+ div {
+ background-color: black;
+ position: absolute;
+ }
+ .parent {
+ background-color: red;
+ }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+ var childPos = -2;
+ function createGrid(topPos, leftPos) {
+ var container = document.getElementById("container");
+ localTopPos = topPos;
+ localLeftPos = leftPos;
+ for (var i = 0; i < 10; ++i, localTopPos = localTopPos + 7) {
+ localLeftPos = leftPos;
+ for (var j = 0; j < 10; ++j, localLeftPos = localLeftPos + 7, childPos = childPos < 2 ? childPos + 0.1 : -2) {
+ var outer = document.createElement("div");
+ outer.className = "parent";
+ outer.style.top = localTopPos + "px";
+ outer.style.left = localLeftPos + "px";
+ outer.style.width = "4px";
+ outer.style.height = "4px";
+
+ var inner = document.createElement("div");
+ inner.style.top = childPos + "px";
+ inner.style.left = childPos + "px";
+ inner.style.width = "2px";
+ inner.style.height = "2px";
+
+ outer.appendChild(inner);
+ container.appendChild(outer);
+ }
+ }
+ }
+
+ for (var i = 0; i < 10; ++i)
+ createGrid(i * 0.1, i * 70.1);
+</script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position.html (0 => 164449)
--- trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/compositing-layers-on-subpixel-position.html 2014-02-20 23:04:20 UTC (rev 164449)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we properly position render layers when composition is introduced.</title>
+<style>
+ div {
+ background-color: black;
+ position: absolute;
+ }
+ .parent {
+ background-color: red;
+ -webkit-transform: translateZ(0);
+ }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+ var childPos = -2;
+ function createGrid(topPos, leftPos) {
+ var container = document.getElementById("container");
+ localTopPos = topPos;
+ localLeftPos = leftPos;
+ for (var i = 0; i < 10; ++i, localTopPos = localTopPos + 7) {
+ localLeftPos = leftPos;
+ for (var j = 0; j < 10; ++j, localLeftPos = localLeftPos + 7, childPos = childPos < 2 ? childPos + 0.1 : -2) {
+ var outer = document.createElement("div");
+ outer.className = "parent";
+ outer.style.top = localTopPos + "px";
+ outer.style.left = localLeftPos + "px";
+ outer.style.width = "4px";
+ outer.style.height = "4px";
+
+ var inner = document.createElement("div");
+ inner.style.top = childPos + "px";
+ inner.style.left = childPos + "px";
+ inner.style.width = "2px";
+ inner.style.height = "2px";
+
+ outer.appendChild(inner);
+ container.appendChild(outer);
+ }
+ }
+ }
+
+ for (var i = 0; i < 10; ++i)
+ createGrid(i * 0.1, i * 70.1);
+</script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/sub-pixel/simple-clipping-expected.html (0 => 164449)
--- trunk/LayoutTests/fast/sub-pixel/simple-clipping-expected.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/simple-clipping-expected.html 2014-02-20 23:04:20 UTC (rev 164449)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Simple clipping. This tests that we properly clip device pixel positioned elements.</title>
+<style>
+ div {
+ width: 20px;
+ height: 20px;
+ border: solid 1px red;
+ position: absolute;
+ top: 0px;
+ }
+</style>
+</head>
+<body>
+<p id="container"></p>
+
+<script>
+ var container = document.getElementById("container");
+ for (i = 0; i < 100; i = i + 21) {
+ var e1 = document.createElement("div");
+ var e2 = document.createElement("div");
+ var e3 = document.createElement("div");
+
+ e1.style.left = i + 101 + "px";
+
+ e2.style.top = "22px";
+ e2.style.left = i + 101.5 +"px";
+
+ e3.style.top = "44px";
+ e3.style.left = i + 102 + "px";
+
+ container.appendChild(e1);
+ container.appendChild(e2);
+ container.appendChild(e3);
+ }
+</script>
+
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/sub-pixel/simple-clipping.html (0 => 164449)
--- trunk/LayoutTests/fast/sub-pixel/simple-clipping.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/simple-clipping.html 2014-02-20 23:04:20 UTC (rev 164449)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Simple clipping. This tests that we properly clip device pixel positioned elements.</title>
+<style>
+ div {
+ width: 20px;
+ height: 20px;
+ border: solid 1px red;
+ position: absolute;
+ top: 0px;
+ -webkit-transform: translateZ(0);
+ }
+</style>
+<script>
+ if (window.testRunner)
+ window.testRunner.waitUntilDone();
+
+ function moveBoxes() {
+ var boxes = document.getElementsByTagName("div");
+
+ for (var i = 0; i < boxes.length; i++)
+ boxes[i].style.left = parseFloat(boxes[i].style.left) + 100.5 + 'px';
+
+ if (window.testRunner)
+ window.testRunner.notifyDone();
+ }
+</script>
+</head>
+<body _onload_="setTimeout(moveBoxes, 0);">
+<p id="container"></p>
+<script>
+ var container = document.getElementById("container");
+ for (i = 0; i < 100; i = i + 21) {
+ var e1 = document.createElement("div");
+ var e2 = document.createElement("div");
+ var e3 = document.createElement("div");
+
+ e1.style.left = i + 0.5 + "px";
+
+ e2.style.top = "22px";
+ e2.style.left = i + 1 +"px";
+
+ e3.style.top = "44px";
+ e3.style.left = i + 1.5 + "px";
+
+ container.appendChild(e1);
+ container.appendChild(e2);
+ container.appendChild(e3);
+ }
+</script>
+
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt (164448 => 164449)
--- trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/LayoutTests/platform/mac/compositing/layer-creation/overlap-animation-container-expected.txt 2014-02-20 23:04:20 UTC (rev 164449)
@@ -12,12 +12,12 @@
(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 -110.00 0.00 1.00])
)
(GraphicsLayer
- (position 47.00 229.00)
- (bounds 144.00 454.00)
+ (position 46.00 229.00)
+ (bounds 146.00 454.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 21.00 11.00)
+ (position 21.13 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 (164448 => 164449)
--- trunk/Source/WebCore/ChangeLog 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/ChangeLog 2014-02-20 23:04:20 UTC (rev 164449)
@@ -1,3 +1,35 @@
+2014-02-20 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Enable compositing RenderLayer painting on device pixel position.
+ https://bugs.webkit.org/show_bug.cgi?id=128509
+
+ Reviewed by Simon Fraser.
+
+ GraphicsLayer is now positioned on device pixel boundary. This enables us to put
+ compositing layers on a subpixel position and animate them with device pixel
+ precision.
+
+ Tests: fast/sub-pixel/compositing-layers-on-subpixel-position.html
+ fast/sub-pixel/simple-clipping.html
+
+ * platform/LayoutUnit.h:
+ (WebCore::ceilToDevicePixel):
+ * platform/graphics/LayoutPoint.h:
+ (WebCore::flooredForPainting):
+ (WebCore::ceiledForPainting):
+ * platform/graphics/LayoutRect.cpp:
+ (WebCore::enclosingRectForPainting):
+ * platform/graphics/LayoutRect.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::clipToRect):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::clipBox):
+ (WebCore::pixelFractionForLayerPainting):
+ (WebCore::calculateDevicePixelOffsetFromRenderer):
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::paintIntoLayer):
+ * rendering/RenderLayerBacking.h:
+
2014-02-20 Bem Jones-Bey <[email protected]>
Rename border/padding/margin width/height to horizontal/vertical extent on RenderBoxModelObject
Modified: trunk/Source/WebCore/platform/LayoutUnit.h (164448 => 164449)
--- trunk/Source/WebCore/platform/LayoutUnit.h 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/platform/LayoutUnit.h 2014-02-20 23:04:20 UTC (rev 164449)
@@ -945,6 +945,11 @@
return floorf((value.rawValue() * pixelSnappingFactor) / kEffectiveFixedPointDenominator) / pixelSnappingFactor;
}
+inline float ceilToDevicePixel(LayoutUnit value, float pixelSnappingFactor)
+{
+ return ceilf((value.rawValue() * pixelSnappingFactor) / kEffectiveFixedPointDenominator) / pixelSnappingFactor;
+}
+
inline float snapSizeToDevicePixel(LayoutUnit size, LayoutUnit location, float pixelSnappingFactor)
{
LayoutUnit fraction = location.fraction();
Modified: trunk/Source/WebCore/platform/graphics/LayoutPoint.h (164448 => 164449)
--- trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2014-02-20 23:04:20 UTC (rev 164449)
@@ -185,6 +185,26 @@
return IntSize(snapSizeToPixel(s.width(), p.x()), snapSizeToPixel(s.height(), p.y()));
}
+inline FloatPoint flooredForPainting(const LayoutPoint& point, float pixelSnappingFactor)
+{
+#if ENABLE(SUBPIXEL_LAYOUT)
+ return FloatPoint(floorToDevicePixel(point.x(), pixelSnappingFactor), floorToDevicePixel(point.y(), pixelSnappingFactor));
+#else
+ UNUSED_PARAM(pixelSnappingFactor);
+ return FloatPoint(point);
+#endif
+}
+
+inline FloatPoint ceiledForPainting(const LayoutPoint& point, float pixelSnappingFactor)
+{
+#if ENABLE(SUBPIXEL_LAYOUT)
+ return FloatPoint(ceilToDevicePixel(point.x(), pixelSnappingFactor), ceilToDevicePixel(point.y(), pixelSnappingFactor));
+#else
+ UNUSED_PARAM(pixelSnappingFactor);
+ return FloatPoint(point);
+#endif
+}
+
inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
{
#if ENABLE(SUBPIXEL_LAYOUT)
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.cpp (164448 => 164449)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.cpp 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.cpp 2014-02-20 23:04:20 UTC (rev 164449)
@@ -147,4 +147,12 @@
#endif
}
+FloatRect enclosingRectForPainting(const LayoutRect& rect, float pixelSnappingFactor)
+{
+ FloatPoint location = flooredForPainting(rect.minXMinYCorner(), pixelSnappingFactor);
+ FloatPoint maxPoint = ceiledForPainting(rect.maxXMaxYCorner(), pixelSnappingFactor);
+
+ return FloatRect(location, maxPoint - location);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.h (164448 => 164449)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.h 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.h 2014-02-20 23:04:20 UTC (rev 164449)
@@ -214,8 +214,8 @@
IntRect enclosingIntRect(const LayoutRect&);
LayoutRect enclosingLayoutRect(const FloatRect&);
+FloatRect enclosingRectForPainting(const LayoutRect&, float pixelSnappingFactor);
-
inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit width, LayoutUnit height)
{
return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snapSizeToPixel(height, top));
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (164448 => 164449)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-20 23:04:20 UTC (rev 164449)
@@ -3572,7 +3572,7 @@
{
if (clipRect.rect() != paintDirtyRect || clipRect.hasRadius()) {
context->save();
- context->clip(pixelSnappedIntRect(clipRect.rect()));
+ context->clip(clipRect.rect());
}
if (!clipRect.hasRadius())
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (164448 => 164449)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-20 23:04:20 UTC (rev 164449)
@@ -642,9 +642,25 @@
if (renderer.hasClip())
result.intersect(renderer.clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
- return pixelSnappedIntRect(result);
+ return result;
}
+static FloatSize pixelFractionForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor)
+{
+ LayoutUnit x = point.x();
+ LayoutUnit y = point.y();
+ x = x >= 0 ? floorToDevicePixel(x, pixelSnappingFactor) : ceilToDevicePixel(x, pixelSnappingFactor);
+ y = y >= 0 ? floorToDevicePixel(y, pixelSnappingFactor) : ceilToDevicePixel(y, pixelSnappingFactor);
+ return point - LayoutPoint(x, y);
+}
+
+static void calculateDevicePixelOffsetFromRenderer(const LayoutSize& rendererOffsetFromGraphicsLayer, FloatSize& devicePixelOffsetFromRenderer,
+ LayoutSize& devicePixelFractionFromRenderer, float deviceScaleFactor)
+{
+ devicePixelFractionFromRenderer = LayoutSize(pixelFractionForLayerPainting(toLayoutPoint(rendererOffsetFromGraphicsLayer), deviceScaleFactor));
+ devicePixelOffsetFromRenderer = rendererOffsetFromGraphicsLayer - devicePixelFractionFromRenderer;
+}
+
void RenderLayerBacking::updateGraphicsLayerGeometry()
{
// If we haven't built z-order lists yet, wait until later.
@@ -689,21 +705,50 @@
LayoutRect ancestorCompositingBounds;
if (compAncestor) {
ASSERT(compAncestor->backing());
- ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()->compositedBounds());
+ ancestorCompositingBounds = compAncestor->backing()->compositedBounds();
}
- LayoutRect localRawCompositingBounds = compositedBounds();
- LayoutPoint rawDelta;
- m_owningLayer.convertToLayerCoords(compAncestor, rawDelta, RenderLayer::AdjustForColumns);
- IntPoint delta = flooredIntPoint(rawDelta);
- m_subpixelAccumulation = toLayoutSize(rawDelta.fraction());
- // Move the bounds by the subpixel accumulation so that it pixel-snaps relative to absolute pixels instead of local coordinates.
- localRawCompositingBounds.move(m_subpixelAccumulation);
-
- LayoutRect localCompositingBounds = pixelSnappedIntRect(localRawCompositingBounds);
+ /*
+ * GraphicsLayer: device pixel positioned. Floored, enclosing rect.
+ * RenderLayer: subpixel positioned.
+ * Offset from renderer (GraphicsLayer <-> RenderLayer::renderer()): subpixel based offset.
+ *
+ * relativeCompositingBounds
+ * _______________________________________
+ * |\ GraphicsLayer |
+ * | \ |
+ * | \ offset from renderer: (device pixel + subpixel)
+ * | \ |
+ * | \______________________________ |
+ * | | localCompositingBounds | |
+ * | | | |
+ * | | RenderLayer::renderer() | |
+ * | | | |
+ *
+ * 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.
+ * 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)
+ */
+ float deviceScaleFactor = this->deviceScaleFactor();
+ LayoutRect localCompositingBounds = compositedBounds();
LayoutRect relativeCompositingBounds(localCompositingBounds);
- relativeCompositingBounds.moveBy(delta);
+ LayoutPoint offsetFromParent;
+ m_owningLayer.convertToLayerCoords(compAncestor, offsetFromParent, RenderLayer::AdjustForColumns);
+ relativeCompositingBounds.moveBy(offsetFromParent);
+
+ LayoutRect enclosingRelativeCompositingBounds = LayoutRect(enclosingRectForPainting(relativeCompositingBounds, deviceScaleFactor));
+ LayoutSize subpixelOffsetAdjustment = enclosingRelativeCompositingBounds.location() - relativeCompositingBounds.location();
+ LayoutSize rendererOffsetFromGraphicsLayer = toLayoutSize(localCompositingBounds.location()) + subpixelOffsetAdjustment;
+
+ FloatSize devicePixelOffsetFromRenderer;
+ LayoutSize devicePixelFractionFromRenderer;
+ calculateDevicePixelOffsetFromRenderer(rendererOffsetFromGraphicsLayer, devicePixelOffsetFromRenderer, devicePixelFractionFromRenderer, deviceScaleFactor);
+ m_devicePixelFractionFromRenderer = LayoutSize(fabs(devicePixelFractionFromRenderer.width().toFloat()), fabs(devicePixelFractionFromRenderer.height().toFloat()));
+
adjustAncestorCompositingBoundsForFlowThread(ancestorCompositingBounds, compAncestor);
LayoutPoint graphicsLayerParentLocation;
@@ -741,40 +786,39 @@
// layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
// for a compositing layer, rootLayer is the layer itself.
RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
- LayoutRect parentClipRect = pixelSnappedIntRect(m_owningLayer.backgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions.
+ LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
ASSERT(parentClipRect != LayoutRect::infiniteRect());
m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
m_ancestorClippingLayer->setSize(parentClipRect.size());
// backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
- m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
+ m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - offsetFromParent);
// The primary layer is then parented in, and positioned relative to this clipping layer.
graphicsLayerParentLocation = parentClipRect.location();
}
- LayoutSize contentsSize = relativeCompositingBounds.size();
+ LayoutSize contentsSize = enclosingRelativeCompositingBounds.size();
if (m_contentsContainmentLayer) {
m_contentsContainmentLayer->setPreserves3D(preserves3D);
- m_contentsContainmentLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
+ m_contentsContainmentLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
// Use the same size as m_graphicsLayer so transforms behave correctly.
m_contentsContainmentLayer->setSize(contentsSize);
- graphicsLayerParentLocation = relativeCompositingBounds.location();
+ graphicsLayerParentLocation = enclosingRelativeCompositingBounds.location();
}
- m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
+ m_graphicsLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - graphicsLayerParentLocation));
m_graphicsLayer->setSize(contentsSize);
- FloatSize offsetFromRenderer = toLayoutSize(localCompositingBounds.location());
- if (offsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
- m_graphicsLayer->setOffsetFromRenderer(offsetFromRenderer);
+ if (devicePixelOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
+ m_graphicsLayer->setOffsetFromRenderer(devicePixelOffsetFromRenderer);
positionOverflowControlsLayers();
}
if (!m_isMainFrameRenderViewLayer) {
// For non-root layers, background is always painted by the primary graphics layer.
ASSERT(!m_backgroundLayer);
- bool hadSubpixelRounding = relativeCompositingBounds.size() != localRawCompositingBounds.size();
+ bool hadSubpixelRounding = !m_devicePixelFractionFromRenderer.isEmpty();
m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
}
@@ -797,14 +841,14 @@
const LayoutRect borderBox = toRenderBox(renderer()).pixelSnappedBorderBoxRect();
// Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- LayoutRect layerBounds(delta, borderBox.size());
+ LayoutRect layerBounds(offsetFromParent, borderBox.size());
// Update properties that depend on layer dimensions
FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
// Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
- FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layerBounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCompositingBounds.width() : 0.5f,
- relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.height() : 0.5f,
- transformOrigin.z());
+ FloatPoint3D anchor(enclosingRelativeCompositingBounds.width() != 0.0f ? ((layerBounds.x() - enclosingRelativeCompositingBounds.x()) + transformOrigin.x())
+ / enclosingRelativeCompositingBounds.width() : 0.5f, enclosingRelativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - enclosingRelativeCompositingBounds.y())
+ + transformOrigin.y()) / enclosingRelativeCompositingBounds.height() : 0.5f, transformOrigin.z());
if (m_contentsContainmentLayer)
m_contentsContainmentLayer->setAnchorPoint(anchor);
else
@@ -876,15 +920,15 @@
if (m_scrollingLayer) {
ASSERT(m_scrollingContentsLayer);
RenderBox& renderBox = toRenderBox(renderer());
- IntRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), renderBox.height() - renderBox.borderTop() - renderBox.borderBottom());
- IntSize scrollOffset = m_owningLayer.scrollOffset();
+ LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), renderBox.height() - renderBox.borderTop() - renderBox.borderBottom());
+ LayoutSize scrollOffset = m_owningLayer.scrollOffset();
m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - localCompositingBounds.location()));
m_scrollingLayer->setSize(paddingBox.size());
#if PLATFORM(IOS)
FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
- m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location());
+ m_scrollingLayer->setOffsetFromRenderer(FloatPoint() - paddingBox.location());
bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
if (m_owningLayer.isInUserScroll()) {
@@ -914,7 +958,7 @@
m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
- m_scrollingLayer->setOffsetFromRenderer(-toIntSize(paddingBox.location()));
+ m_scrollingLayer->setOffsetFromRenderer(-toFloatSize(paddingBox.location()));
bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
@@ -922,7 +966,7 @@
if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
m_scrollingContentsLayer->setNeedsDisplay();
- IntSize scrollingContentsOffset = toIntSize(paddingBox.location() - scrollOffset);
+ LayoutSize scrollingContentsOffset = toLayoutSize(paddingBox.location() - scrollOffset);
if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
compositor().scrollingLayerDidChange(m_owningLayer);
@@ -938,7 +982,7 @@
}
// If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store.
- setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compAncestor, relativeCompositingBounds, ancestorCompositingBounds));
+ setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compAncestor, enclosingRelativeCompositingBounds, ancestorCompositingBounds));
bool didUpdateContentsRect = false;
updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
@@ -2161,7 +2205,7 @@
paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
// FIXME: GraphicsLayers need a way to split for RenderRegions.
- RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, m_subpixelAccumulation);
+ RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, m_devicePixelFractionFromRenderer);
m_owningLayer.paintLayerContents(context, paintingInfo, paintFlags);
if (m_owningLayer.containsDirtyOverlayScrollbars())
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (164448 => 164449)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-20 22:55:11 UTC (rev 164448)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-20 23:04:20 UTC (rev 164449)
@@ -311,7 +311,7 @@
uint64_t m_scrollLayerID;
LayoutRect m_compositedBounds;
- LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of the compositedBounds compared to absolute coordinates.
+ LayoutSize m_devicePixelFractionFromRenderer;
bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
bool m_isMainFrameRenderViewLayer;