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

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: 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/WebCore/rendering/RenderLayerCompositor.cpp
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index c9cebfc32df8bbf05334b91d62137c49d51517b6..70d34483c9c08dda1c86ba65cda6c9cb6c8f8b56 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1976,7 +1976,27 @@ 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.
+ if (container->isRenderView()) {
+
+ RenderLayer* ancestor = layer->parent();
+ bool noScrollableAncestor = true;
+
+ if (m_renderView->frameView() && (m_renderView->frameView()->isScrollable()))
+ noScrollableAncestor = false;
trchen 2013/04/10 01:24:03 I'm concerned about the platforms that use impl-si
+
+ while (ancestor && noScrollableAncestor) {
+ if (ancestor->hasHorizontalScrollbar() || ancestor->hasVerticalScrollbar())
+ noScrollableAncestor = false;
+ ancestor = ancestor->parent();
+ }
+
+ if (noScrollableAncestor)
+ 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