Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 13828004: Avoid compositing fixed-position elements if they cannot scroll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased again Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698