Chromium Code Reviews| Index: Source/core/rendering/RenderLayerCompositor.cpp |
| diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
| index 47b0ee0de0f6bde965e04d947f347ac8bcfd414c..6bf4e713bc94d892cf8e74035e865ae2838024c5 100644 |
| --- a/Source/core/rendering/RenderLayerCompositor.cpp |
| +++ b/Source/core/rendering/RenderLayerCompositor.cpp |
| @@ -1967,6 +1967,32 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere |
| return false; |
| } |
| + // If the fixed-position element does not have any scrollable ancestor between it and |
| + // its container, then we do not need to spend compositor resources for it. Start by |
| + // assuming we can opt-out (i.e. no scrollable ancestor), and refine the answer below. |
| + bool hasScrollableAncestor = false; |
| + |
| + // The FrameView has the scrollbars associated with the top level viewport, so we have to |
| + // check the FrameView in addition to the hierarchy of ancestors. |
| + FrameView* frameView = m_renderView->frameView(); |
| + if (frameView && frameView->isScrollable()) |
| + hasScrollableAncestor = true; |
|
enne (OOO)
2013/05/02 01:04:07
Thanks, this is way clearer.
|
| + |
| + RenderLayer* ancestor = layer->parent(); |
| + while (ancestor && !hasScrollableAncestor) { |
| + if (frameView->containsScrollableArea(ancestor)) |
| + hasScrollableAncestor = true; |
| + if (ancestor->renderer() == m_renderView) |
| + break; |
| + ancestor = ancestor->parent(); |
| + } |
| + |
| + if (!hasScrollableAncestor) { |
| + if (viewportConstrainedNotCompositedReason) |
| + *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForUnscrollableAncestors; |
| + return false; |
| + } |
| + |
| // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. |
| if (!m_inPostLayoutUpdate) { |
| m_reevaluateCompositingAfterLayout = true; |