Chromium Code Reviews| Index: Source/WebCore/rendering/RenderLayerCompositor.cpp |
| diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| index c9cebfc32df8bbf05334b91d62137c49d51517b6..70d34483c9c08dda1c86ba65cda6c9cb6c8f8b56 100644 |
| --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| @@ -1976,7 +1976,27 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere |
| *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNonViewContainer; |
| 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. |
| + if (container->isRenderView()) { |
| + |
| + RenderLayer* ancestor = layer->parent(); |
| + bool noScrollableAncestor = true; |
| + |
| + if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable())) |
| + noScrollableAncestor = false; |
|
trchen
2013/04/10 01:24:03
I'm concerned about the platforms that use impl-si
|
| + |
| + while (ancestor && noScrollableAncestor) { |
| + if (ancestor->hasHorizontalScrollbar() || ancestor->hasVerticalScrollbar()) |
| + noScrollableAncestor = false; |
| + ancestor = ancestor->parent(); |
| + } |
| + |
| + if (noScrollableAncestor) |
| + 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; |