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

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: rebase 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 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.

Powered by Google App Engine
This is Rietveld 408576698