Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1516)

Unified Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 22419002: Set up clip and scroll parents on the blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698