Commit 4d9633ea authored by vollick@chromium.org's avatar vollick@chromium.org

Clean up ancestorScrollingLayer

This function should have walked up the containing blocks rather than
the parents. This cl fixes that and removes the useless
ancestorCompositedScrollingLayer.

Note: the layout test here was taken from abarth's patch
https://codereview.chromium.org/340913002/

BUG=None

Review URL: https://codereview.chromium.org/344733003

git-svn-id: svn://svn.chromium.org/blink/trunk@176520 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0e3d85cc
(GraphicsLayer
(bounds 785.00 5516.00)
(children 1
(GraphicsLayer
(bounds 785.00 5516.00)
(contentsOpaque 1)
(drawsContent 1)
(children 4
(GraphicsLayer
(position 8.00 8.00)
(bounds 500.00 500.00)
(contentsOpaque 1)
(drawsContent 1)
(backgroundColor #0000FF)
(children 4
(GraphicsLayer
(bounds 485.00 485.00)
(children 1
(GraphicsLayer
(bounds 485.00 5000.00)
(shouldFlattenTransform 0)
(drawsContent 1)
(children 1
(GraphicsLayer
)
)
)
)
)
(GraphicsLayer
(position 0.00 485.00)
(bounds 485.00 15.00)
(drawsContent 1)
)
(GraphicsLayer
(position 485.00 0.00)
(bounds 15.00 485.00)
(drawsContent 1)
)
(GraphicsLayer
(position 485.00 485.00)
(bounds 15.00 15.00)
(drawsContent 1)
)
)
)
(GraphicsLayer
(position 8.00 8.00)
(bounds 400.00 400.00)
(contentsOpaque 1)
(drawsContent 1)
(backgroundColor #008000)
(hasClipParent 1)
)
(GraphicsLayer
(position 8.00 8.00)
(bounds 300.00 300.00)
(contentsOpaque 1)
(drawsContent 1)
(backfaceVisibility hidden)
(backgroundColor #FFFF00)
)
(GraphicsLayer
(position 8.00 8.00)
(bounds 20.00 5000.00)
(contentsOpaque 1)
(drawsContent 1)
(backgroundColor #FA8072)
(hasScrollParent 1)
)
)
)
)
)
<!DOCTYPE html>
<body>
<div id="top" style="overflow: scroll; height: 500px; width: 500px; background-color: blue">
<div id="middle" style="position: absolute; height: 400px; width: 400px; background-color: green">
<div id="child" style="position: relative; height: 300px; width: 300px; background-color: yellow; -webkit-backface-visibility: hidden"></div>
</div>
<div id="tall" style="position: relative; height: 5000px; width: 20px; background-color: salmon"></div>
</div>
<div style="height: 5000px; width: 20px; background-color: papayawhip"></div>
<script>
if (window.testRunner) {
internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
testRunner.dumpAsText();
testRunner.setCustomTextOutput(
internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_CLIP_AND_SCROLL_PARENTS));
}
</script>
...@@ -1088,35 +1088,12 @@ RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i ...@@ -1088,35 +1088,12 @@ RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i
return 0; 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 RenderLayer* RenderLayer::ancestorScrollingLayer() const
{ {
RenderObject* containingBlock = renderer()->containingBlock(); for (RenderObject* container = renderer()->containingBlock(); container; container = container->containingBlock()) {
if (!containingBlock) RenderLayer* currentLayer = container->enclosingLayer();
return 0; if (currentLayer->scrollsOverflow())
return currentLayer;
for (RenderLayer* ancestorLayer = containingBlock->enclosingLayer(); ancestorLayer; ancestorLayer = ancestorLayer->parent()) {
if (ancestorLayer->scrollsOverflow())
return ancestorLayer;
} }
return 0; return 0;
...@@ -1621,7 +1598,7 @@ RenderLayer* RenderLayer::scrollParent() const ...@@ -1621,7 +1598,7 @@ RenderLayer* RenderLayer::scrollParent() const
// be a composited layer since the compositor will need to take special measures to ensure // 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. // that we scroll with our scrolling ancestor and it cannot do this if we do not promote.
RenderLayer* scrollParent = ancestorCompositedScrollingLayer(); RenderLayer* scrollParent = ancestorScrollingLayer();
if (!scrollParent || scrollParent->stackingNode()->isStackingContext()) if (!scrollParent || scrollParent->stackingNode()->isStackingContext())
return 0; return 0;
......
...@@ -225,9 +225,6 @@ public: ...@@ -225,9 +225,6 @@ public:
// Ancestor compositing layer, excluding this. // Ancestor compositing layer, excluding this.
RenderLayer* ancestorCompositingLayer() const { return enclosingCompositingLayer(ExcludeSelf); } RenderLayer* ancestorCompositingLayer() const { return enclosingCompositingLayer(ExcludeSelf); }
// Ancestor composited scrolling layer at or above our containing block.
RenderLayer* ancestorCompositedScrollingLayer() const;
// Ancestor scrolling layer at or above our containing block. // Ancestor scrolling layer at or above our containing block.
RenderLayer* ancestorScrollingLayer() const; RenderLayer* ancestorScrollingLayer() const;
......
...@@ -380,7 +380,7 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration(GraphicsLayerUpdat ...@@ -380,7 +380,7 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration(GraphicsLayerUpdat
if (scrollParent) { if (scrollParent) {
// If our containing block is our ancestor scrolling layer, then we'll already be clipped // If our containing block is our ancestor scrolling layer, then we'll already be clipped
// to it via our scroll parent and we don't need an ancestor clipping layer. // to it via our scroll parent and we don't need an ancestor clipping layer.
if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_owningLayer.ancestorCompositedScrollingLayer()) if (m_owningLayer.renderer()->containingBlock()->enclosingLayer() == m_owningLayer.ancestorScrollingLayer())
needsAncestorClip = false; needsAncestorClip = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment