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

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 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
Index: Source/core/rendering/RenderLayerCompositor.cpp
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 397a5e8703c6d3b0c683f0d2c716caeb5eebb490..2ba3141a2de2890920e3ef4cc1e9dfb5cfc17dfc 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -1924,6 +1924,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;
enne (OOO) 2013/04/30 01:51:35 style nit: bools are always easier to understand w
+
+ // The FrameView has the scrollbars associated with the top level viewport, so we have to
enne (OOO) 2013/04/30 01:51:35 I'm not sure what you mean by "top level" here. T
+ // check the FrameView in addition to the hierarchy of ancestors.
+ if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable()))
+ noScrollableAncestor = false;
enne (OOO) 2013/04/30 01:51:35 I don't quite understand how you can set this to f
shawnsingh 2013/04/30 20:53:51 Setting it to false means that we should still com
+
+ RenderLayer* ancestor = layer->parent();
Tom Hudson 2013/04/29 14:50:24 Naive question: this function assumes layer is non
shawnsingh 2013/04/29 15:57:13 It's a "reasonable assumption" that it will not be
+ while (ancestor && noScrollableAncestor) {
+ if (ancestor->hasScrollbars())
Ian Vollick 2013/04/30 00:22:22 I believe the check is frameView->containsScrollab
+ noScrollableAncestor = false;
+ if (ancestor->renderer() == container)
enne (OOO) 2013/04/30 01:51:35 I think it would be clearer to call container m_re
+ 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;

Powered by Google App Engine
This is Rietveld 408576698