Index: Source/core/rendering/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
index 123800a68af0ce7003c61f8097ef78725214c90f..560e7f12dd24f3ad8f43b3fd2634f75b7d1f86ea 100644 |
--- a/Source/core/rendering/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/RenderLayerCompositor.cpp |
@@ -1934,6 +1934,31 @@ 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 noScrollableAncestor = true; |
+ |
+ // 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. |
+ if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable())) |
+ noScrollableAncestor = false; |
+ |
+ RenderLayer* ancestor = layer->parent(); |
+ while (ancestor && noScrollableAncestor) { |
jamesr
2013/04/20 01:24:10
this seems too slow. This function is called from
shawnsingh
2013/04/21 00:22:21
This only occurs for fixed-position elements. The
|
+ if (ancestor->hasScrollbars()) |
+ noScrollableAncestor = false; |
+ if (ancestor->renderer() == container) |
jamesr
2013/04/20 01:24:10
since we've checked explicitly for transformed con
shawnsingh
2013/04/21 00:22:21
No, it can't. You're right that container is the
|
+ 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; |