Chromium Code Reviews| Index: Source/WebCore/rendering/RenderLayerCompositor.cpp |
| diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| index b27fea85a626c964804447d14aff9d3925888857..eff23e45000c8ef2920b13740ae85c92d601ed2f 100644 |
| --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp |
| @@ -1931,7 +1931,29 @@ 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. |
| + bool noScrollableAncestor = true; |
| + if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable())) |
|
trchen
2013/04/17 20:38:14
Do we have to check whether container is a transfo
shawnsingh
2013/04/17 20:57:36
That's exactly what the if-statement above this ne
trchen
2013/04/17 21:03:03
Hmm I didn't realize that transformed container ne
vangelis
2013/04/17 22:05:29
Actually that's not necessarily bad. If an element
|
| + noScrollableAncestor = false; |
| + |
| + RenderLayer* ancestor = layer->parent(); |
| + while (ancestor && noScrollableAncestor) { |
|
trchen
2013/04/17 20:38:14
nits: I prefer to use for loop:
for (RenderLayer*
shawnsingh
2013/04/17 20:57:36
The for-loop version skips the case where ancestor
trchen
2013/04/17 21:03:03
Ah ha you're right. Got your point. :)
|
| + if (ancestor->hasScrollbars()) |
|
vangelis
2013/04/17 19:53:15
I'm wondering whether ancestor->hasScrollbars() wi
shawnsingh
2013/04/17 20:15:57
I had empirically checked, with printf debugging o
trchen
2013/04/17 20:38:14
Shawn is right. RenderView itself, as a RenderBloc
vangelis
2013/04/17 22:05:29
Ah, ok!
|
| + noScrollableAncestor = false; |
| + if (ancestor->renderer() == container) |
| + break; |
| + ancestor = ancestor->parent(); |
| + } |
| + |
| + if (noScrollableAncestor) { |
| + 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; |