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

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

Issue 340913002: RenderLayer::scrollParent should walk the containing block chain (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git add tests Created 6 years, 6 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
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index be92d92417e0a84c5a96345eb64f1c16ec420a37..e399a93bd5506b537d5f783e25f74e61d0253d63 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -1082,26 +1082,6 @@ RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i
return 0;
}
-RenderLayer* RenderLayer::ancestorCompositedScrollingLayer() const
-{
- if (!compositor()->acceleratedCompositingForOverflowScrollEnabled())
- return 0;
-
- RenderObject* containingBlock = renderer()->containingBlock();
- if (!containingBlock)
- return 0;
-
- RenderLayer* ancestorCompositedScrollingLayer = 0;
- for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancestorLayer; ancestorLayer = ancestorLayer->parent()) {
- if (ancestorLayer->needsCompositedScrolling()) {
- ancestorCompositedScrollingLayer = ancestorLayer;
- break;
- }
- }
-
- return ancestorCompositedScrollingLayer;
-}
-
RenderLayer* RenderLayer::ancestorScrollingLayer() const
{
RenderObject* containingBlock = renderer()->containingBlock();
@@ -1602,33 +1582,15 @@ RenderLayer* RenderLayer::scrollParent() const
if (stackingNode()->isNormalFlowOnly())
return 0;
- // A layer scrolls with its containing block. So to find the overflow scrolling layer
- // that we scroll with respect to, we must ascend the layer tree until we reach the
- // first overflow scrolling div at or above our containing block. I will refer to this
- // layer as our 'scrolling ancestor'.
- //
- // Now, if we reside in a normal flow list, then we will naturally scroll with our scrolling
- // ancestor, and we need not be composited. If, on the other hand, we reside in a z-order
- // list, and on our walk upwards to our scrolling ancestor we find no layer that is a stacking
- // context, then we know that in the stacking tree, we will not be in the subtree rooted at
- // our scrolling ancestor, and we will therefore not scroll with it. In this case, we must
- // be a composited layer since the compositor will need to take special measures to ensure
- // that we scroll with our scrolling ancestor and it cannot do this if we do not promote.
-
- RenderLayer* scrollParent = ancestorCompositedScrollingLayer();
- if (!scrollParent || scrollParent->stackingNode()->isStackingContext())
+ if (!parent())
return 0;
- // If we hit a stacking context on our way up to the ancestor scrolling layer, it will already
- // be composited due to an overflow scrolling parent, so we don't need to.
- for (RenderLayer* ancestor = parent(); ancestor && ancestor != scrollParent; ancestor = ancestor->parent()) {
- if (ancestor->stackingNode()->isStackingContext()) {
- scrollParent = 0;
- break;
- }
+ for (RenderLayer* current = renderer()->containingBlock()->enclosingLayer(); !current->stackingNode()->isStackingContext(); current = current->renderer()->containingBlock()->enclosingLayer()) {
+ if (current->scrollsOverflow())
+ return current;
}
- return scrollParent;
+ return 0;
}
RenderLayer* RenderLayer::clipParent() const
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698