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

Unified Diff: Source/WebCore/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: simplified to hasScrollbars() 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/WebCore/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/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;
« no previous file with comments | « Source/WebCore/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698