Diff
Modified: trunk/LayoutTests/ChangeLog (111455 => 111456)
--- trunk/LayoutTests/ChangeLog 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/ChangeLog 2012-03-20 23:00:40 UTC (rev 111456)
@@ -1,3 +1,20 @@
+2012-03-20 Adrienne Walker <[email protected]>
+
+ RenderLayerCompositor doesn't properly clip graphics layer sizes
+ https://bugs.webkit.org/show_bug.cgi?id=80372
+
+ Reviewed by Simon Fraser.
+
+ Update several baselines due to smaller backing sizes.
+
+ * compositing/clip-child-by-non-stacking-ancestor-expected.txt: Added.
+ * compositing/clip-child-by-non-stacking-ancestor.html: Added.
+ * compositing/geometry/clip-expected.txt:
+ * compositing/images/clip-on-directly-composited-image-expected.txt:
+ * compositing/overflow/clip-descendents-expected.txt:
+ * platform/chromium-win/compositing/images/clip-on-directly-composited-image-expected.txt: Removed.
+ * platform/chromium-win/compositing/overflow/clip-descendents-expected.txt:
+
2012-03-20 Sheriff Bot <[email protected]>
Unreviewed, rolling out r111445 and r111446.
Copied: trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt (from rev 111455, trunk/LayoutTests/platform/chromium-win/compositing/images/clip-on-directly-composited-image-expected.txt) (0 => 111456)
--- trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -0,0 +1,16 @@
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Property changes: trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor.html (0 => 111456)
--- trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor.html (rev 0)
+++ trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor.html 2012-03-20 23:00:40 UTC (rev 111456)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style type="text/css" media="screen">
+ .container {
+ -webkit-transform: translateZ(0);
+ background-color: silver;
+ width: 100px;
+ height: 100px;
+ }
+
+ /* create a render layer with no stacking context */
+ .clip {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 100px;
+ height: 100px;
+ overflow: hidden;
+ }
+
+ /* being clipped, this shouldn't affect container's composited bounds */
+ .box {
+ position: absolute;
+ top: 100px;
+ left: 100px;
+ height: 100px;
+ width: 100px;
+ background-color: blue;
+ }
+ </style>
+</head>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ if (window.layoutTestController) {
+ document.getElementById('layertree').innerText = layoutTestController.layerTreeAsText();
+ layoutTestController.notifyDone();
+ }
+ }
+
+ window.addEventListener('load', doTest, false);
+</script>
+<body>
+ <!-- the composited bounds of container should be 100px, not 200px -->
+ <div class="container">
+ <div class="clip">
+ <div class="box"></div>
+ </div>
+ </div>
+ <pre id="layertree"></pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/compositing/geometry/clip-expected.txt (111455 => 111456)
--- trunk/LayoutTests/compositing/geometry/clip-expected.txt 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/compositing/geometry/clip-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -7,8 +7,8 @@
(bounds 800.00 600.00)
(children 3
(GraphicsLayer
- (position 10.00 10.00)
- (bounds 120.00 120.00)
+ (position 20.00 20.00)
+ (bounds 100.00 100.00)
(drawsContent 1)
(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/LayoutTests/compositing/images/clip-on-directly-composited-image-expected.txt (111455 => 111456)
--- trunk/LayoutTests/compositing/images/clip-on-directly-composited-image-expected.txt 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/compositing/images/clip-on-directly-composited-image-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -6,8 +6,9 @@
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
- (position 200.00 13.00)
- (bounds 200.00 200.00)
+ (position 210.00 23.00)
+ (anchor 0.64 0.64)
+ (bounds 140.00 140.00)
(drawsContent 1)
)
)
Modified: trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt (111455 => 111456)
--- trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -19,8 +19,8 @@
)
)
(GraphicsLayer
- (position 220.00 54.00)
- (bounds 142.00 142.00)
+ (position 240.00 64.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
)
(GraphicsLayer
@@ -47,12 +47,11 @@
)
)
(GraphicsLayer
- (position 28.00 220.00)
- (bounds 142.00 142.00)
+ (position 48.00 230.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 20.00 10.00)
(bounds 60.00 70.00)
(children 1
(GraphicsLayer
@@ -66,12 +65,11 @@
)
)
(GraphicsLayer
- (position 220.00 220.00)
- (bounds 142.00 142.00)
+ (position 240.00 230.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 20.00 10.00)
(bounds 60.00 70.00)
(children 1
(GraphicsLayer
Deleted: trunk/LayoutTests/platform/chromium-win/compositing/images/clip-on-directly-composited-image-expected.txt (111455 => 111456)
--- trunk/LayoutTests/platform/chromium-win/compositing/images/clip-on-directly-composited-image-expected.txt 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/platform/chromium-win/compositing/images/clip-on-directly-composited-image-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -1,17 +0,0 @@
-
-(GraphicsLayer
- (bounds 800.00 600.00)
- (children 1
- (GraphicsLayer
- (bounds 800.00 600.00)
- (children 1
- (GraphicsLayer
- (position 200.00 13.00)
- (bounds 200.00 200.00)
- (drawsContent 1)
- )
- )
- )
- )
-)
-
Modified: trunk/LayoutTests/platform/chromium-win/compositing/overflow/clip-descendents-expected.txt (111455 => 111456)
--- trunk/LayoutTests/platform/chromium-win/compositing/overflow/clip-descendents-expected.txt 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/LayoutTests/platform/chromium-win/compositing/overflow/clip-descendents-expected.txt 2012-03-20 23:00:40 UTC (rev 111456)
@@ -19,8 +19,8 @@
)
)
(GraphicsLayer
- (position 220.00 56.00)
- (bounds 142.00 142.00)
+ (position 240.00 66.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
)
(GraphicsLayer
@@ -47,12 +47,11 @@
)
)
(GraphicsLayer
- (position 28.00 220.00)
- (bounds 142.00 142.00)
+ (position 48.00 230.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 20.00 10.00)
(bounds 60.00 70.00)
(children 1
(GraphicsLayer
@@ -66,12 +65,11 @@
)
)
(GraphicsLayer
- (position 220.00 220.00)
- (bounds 142.00 142.00)
+ (position 240.00 230.00)
+ (bounds 60.00 70.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 20.00 10.00)
(bounds 60.00 70.00)
(children 1
(GraphicsLayer
Modified: trunk/Source/WebCore/ChangeLog (111455 => 111456)
--- trunk/Source/WebCore/ChangeLog 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/Source/WebCore/ChangeLog 2012-03-20 23:00:40 UTC (rev 111456)
@@ -1,3 +1,29 @@
+2012-03-20 Adrienne Walker <[email protected]>
+
+ RenderLayerCompositor doesn't properly clip graphics layer sizes
+ https://bugs.webkit.org/show_bug.cgi?id=80372
+
+ Reviewed by Simon Fraser.
+
+ To find the bounds for a composited layer, calculateCompositedBounds
+ iterates through all non-composited child layers using z-order and
+ normal flow lists. This does not preserve clipping from ancestor
+ layers, because a clipping ancestor layer can end up as a sibling to
+ its clipped descendent because it is not a stacking context.
+
+ Fix by explicitly checking cached clip roots.
+
+ Test: compositing/clip-child-by-non-stacking-ancestor.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::localClipRect):
+ (WebCore):
+ * rendering/RenderLayer.h:
+ (RenderLayer):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::repaintOnCompositingChange):
+ (WebCore::RenderLayerCompositor::calculateCompositedBounds):
+
2012-03-20 Sheriff Bot <[email protected]>
Unreviewed, rolling out r111445 and r111446.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (111455 => 111456)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-03-20 23:00:40 UTC (rev 111456)
@@ -3804,6 +3804,26 @@
return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox();
}
+LayoutRect RenderLayer::localClipRect() const
+{
+ // FIXME: border-radius not accounted for.
+ // FIXME: Regions not accounted for.
+ RenderLayer* clippingRootLayer = clippingRoot();
+ LayoutRect layerBounds;
+ ClipRect backgroundRect, foregroundRect, outlineRect;
+ calculateRects(clippingRootLayer, 0, PaintInfo::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
+
+ LayoutRect clipRect = backgroundRect.rect();
+ if (clipRect == PaintInfo::infiniteRect())
+ return clipRect;
+
+ LayoutPoint clippingRootOffset;
+ convertToLayerCoords(clippingRootLayer, clippingRootOffset);
+ clipRect.moveBy(-clippingRootOffset);
+
+ return clipRect;
+}
+
void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds)
{
m_blockSelectionGapsBounds.unite(bounds);
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (111455 => 111456)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2012-03-20 23:00:40 UTC (rev 111456)
@@ -468,6 +468,7 @@
LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.
+ LayoutRect localClipRect() const; // Returns the background clip rect of the layer in the local coordinate space.
bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer) const;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (111455 => 111456)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-03-20 22:51:43 UTC (rev 111455)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-03-20 23:00:40 UTC (rev 111456)
@@ -531,12 +531,13 @@
}
LayoutRect unionBounds = boundingBoxRect;
-
- if (layer->renderer()->hasOverflowClip() || layer->renderer()->hasMask()) {
+
+ LayoutRect localClipRect = layer->localClipRect();
+ if (localClipRect != PaintInfo::infiniteRect()) {
LayoutPoint ancestorRelOffset;
layer->convertToLayerCoords(ancestorLayer, ancestorRelOffset);
- boundingBoxRect.moveBy(ancestorRelOffset);
- return pixelSnappedIntRect(boundingBoxRect);
+ localClipRect.moveBy(ancestorRelOffset);
+ return pixelSnappedIntRect(localClipRect);
}
if (RenderLayer* reflection = layer->reflectionLayer()) {