Index: Source/core/rendering/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
index ae6cdc3d1d41ab51a0c1619c206612aaddb6ea80..98d6aec05689ffe65e13ea5494787243a6ab4819 100644 |
--- a/Source/core/rendering/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/RenderLayerCompositor.cpp |
@@ -1746,7 +1746,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) |
+ ? layer->ancestorScrollingLayer() |
+ : layer->ancestorCompositingLayer(); |
+ |
if (!compositingAncestor) |
return false; |
@@ -1770,6 +1774,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. |