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

Unified Diff: Source/core/rendering/RenderLayer.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, 3 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/RenderLayerBacking.h » ('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 b671d5ab385a4f3dd0e0ce0408fc4d0d3acf3b17..8b75b365dd96e8d09a165886dab1a5dd6d5b11b3 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -493,7 +493,7 @@ bool RenderLayer::useCompositorDrivenAcceleratedScrolling() const
return true;
}
- return !scrollingLayer->canBeStackingContainer();
+ return !scrollingLayer->needsToBeStackingContainer();
}
// FIXME: This is a temporary flag and should be removed once accelerated
@@ -2082,6 +2082,38 @@ bool RenderLayer::needsToBeStackingContainer() const
return adjustForForceCompositedScrollingMode(m_needsToBeStackingContainer);
}
+bool RenderLayer::hasScrollParent() const
+{
+ if (!useCompositorDrivenAcceleratedScrolling())
+ return false;
+
+ // 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 = ancestorScrollingLayer();
+
+ if (!scrollParent || scrollParent->isStackingContext())
+ return false;
+
+ // 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->isStackingContext())
+ return false;
+ }
+
+ return true;
+}
+
void RenderLayer::updateNeedsCompositedScrolling()
{
TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling");
@@ -5472,6 +5504,29 @@ GraphicsLayer* RenderLayer::layerForScrolling() const
return m_backing ? m_backing->scrollingContentsLayer() : 0;
}
+GraphicsLayer* RenderLayer::layerForScrollChild() const
+{
+ // If we have an ancestor clipping layer because of our scroll parent, we do not want to
+ // scroll that clip layer -- we need it to stay put and we will slide within it. If, on
+ // the other hand, we have an ancestor clipping layer due to some other clipping layer, we
+ // want to scroll the root of the layer's associate graphics layer subtree. I.e., we want it
+ // and its clip to move in concert.
+
+ if (!backing())
+ return 0;
+
+ if (backing()->hasAncestorScrollClippingLayer()) {
+ return backing()->hasAncestorClippingLayer()
+ ? backing()->ancestorClippingLayer()
+ : backing()->graphicsLayer();
+ }
+
+ if (renderer()->containingBlock()->enclosingLayer() == ancestorScrollingLayer())
+ return backing()->graphicsLayer();
+
+ return backing()->childForSuperlayers();
+}
+
GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const
{
return m_backing ? m_backing->layerForHorizontalScrollbar() : 0;
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698