Chromium Code Reviews| Index: Source/core/rendering/RenderLayerCompositor.cpp |
| diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
| index bee43c6984f7c488a0e866d41e5c44673a86f2c0..74f13a50428ccbced6f0016545252a2a968d2d71 100644 |
| --- a/Source/core/rendering/RenderLayerCompositor.cpp |
| +++ b/Source/core/rendering/RenderLayerCompositor.cpp |
| @@ -1751,7 +1751,11 @@ bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const |
| if (!layer->isComposited() || !layer->parent()) |
| return false; |
| - RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); |
| + // Scroll children use their scrolling ancestor as their clip root. |
| + RenderLayer* compositingAncestor = clippedByScrollingAncestor(layer) |
|
enne (OOO)
2013/08/22 20:54:30
clippedByScrollingAncestor seems like a bunch of w
|
| + ? layer->ancestorScrollingLayer() |
| + : layer->ancestorCompositingLayer(); |
| + |
| if (!compositingAncestor) |
| return false; |
| @@ -1775,6 +1779,31 @@ bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const |
| return layer->backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRoot, 0, TemporaryClipRects)).rect() != PaintInfo::infiniteRect(); // FIXME: Incorrect for CSS regions. |
| } |
| +bool RenderLayerCompositor::clippedByScrollingAncestor(RenderLayer* layer) const |
| +{ |
| + if (!layer->isComposited() || !layer->parent()) |
| + return false; |
| + |
| + if (!requiresCompositingForOverflowScrollingParent(layer)) |
| + return false; |
| + |
| + RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); |
| + if (!compositingAncestor) |
| + return false; |
| + |
| + RenderLayer* scrollingAncestor = layer->ancestorScrollingLayer(); |
| + if (!scrollingAncestor) |
| + return false; |
| + |
| + if (!scrollingAncestor->hasAncestor(compositingAncestor)) |
| + return false; |
| + |
| + // FIXME: Incorrect for CSS regions. |
| + RenderLayer::ClipRectsContext clipRectsContext(compositingAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip, scrollingAncestor); |
| + LayoutRect clipRect = layer->backgroundClipRect(clipRectsContext).rect(); |
| + return clipRect != PaintInfo::infiniteRect() && !clipRect.isEmpty(); |
| +} |
| + |
| // Return true if the given layer is a stacking context and has compositing child |
| // layers that it needs to clip. In this case we insert a clipping GraphicsLayer |
| // into the hierarchy between this layer and its children in the z-order hierarchy. |