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

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: Rebased and addressed reviewers older comments 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 | « LayoutTests/virtual/softwarecompositing/layer-creation/fixed-position-change-out-of-view-in-view-expected.txt ('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..bcb90dbfa7e8d819bc7cb231d084db11b0cae20c 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1931,7 +1931,26 @@ 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 (container == m_renderView && m_renderView->frameView() && (m_renderView->frameView()->isScrollable()))
vangelis 2013/04/16 06:54:23 Because of the code right above, we're guaranteed
shawnsingh 2013/04/16 20:20:06 Oops - forgot to remove this based on your previou
+ noScrollableAncestor = false;
vangelis 2013/04/16 06:54:23 Should you set the value of viewportConstrainedNot
shawnsingh 2013/04/16 20:20:06 Thanks for catching this - will do it.
+
+ RenderLayer* ancestor = layer->parent();
+ while (ancestor && noScrollableAncestor) {
+ if (ancestor->hasHorizontalScrollbar() || ancestor->hasVerticalScrollbar())
vangelis 2013/04/16 06:54:23 Since you know you need to iterate until you get b
trchen 2013/04/16 19:36:21 I have the same concern. For historical reason we
shawnsingh 2013/04/16 20:20:06 I don't think we can eliminate those lines of code
+ noScrollableAncestor = false;
+ if (ancestor->renderer() == container)
+ break;
+ 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;
« no previous file with comments | « LayoutTests/virtual/softwarecompositing/layer-creation/fixed-position-change-out-of-view-in-view-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698