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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 24921002: Make compositingState explicit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ready for review Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics Layer* except) 153 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics Layer* except)
154 { 154 {
155 if (layer && layer != except && scrollingWebLayerForGraphicsLayer(layer)) 155 if (layer && layer != except && scrollingWebLayerForGraphicsLayer(layer))
156 scrollingWebLayerForGraphicsLayer(layer)->setPositionConstraint(WebLayer PositionConstraint()); 156 scrollingWebLayerForGraphicsLayer(layer)->setPositionConstraint(WebLayer PositionConstraint());
157 } 157 }
158 158
159 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l ayer) 159 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l ayer)
160 { 160 {
161 ASSERT(layer->isComposited()); 161 ASSERT(layer->backing());
162 do { 162 do {
163 if (layer->renderer()->style()->position() == FixedPosition) { 163 if (layer->renderer()->style()->position() == FixedPosition) {
164 const RenderObject* fixedPositionObject = layer->renderer(); 164 const RenderObject* fixedPositionObject = layer->renderer();
165 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); 165 bool fixedToRight = !fixedPositionObject->style()->right().isAuto();
166 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto( ); 166 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto( );
167 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed ToBottom); 167 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed ToBottom);
168 } 168 }
169 169
170 layer = layer->parent(); 170 layer = layer->parent();
171 } while (layer && !layer->isComposited()); 171 // FIXME: should this walk end at the first layer with any backing? Or s hould it end at the
172 // first composited layer that does not paint into its ancestor? And what about for
173 // squashed layers? For now, keeping this code equivalent to what it has been already.
Ian Vollick 2013/10/01 19:46:22 My interpretation of this function: If any layer
shawnsingh 2013/10/03 03:04:04 I'm not sure if your phrasing means the same thing
174 } while (layer && !layer->backing());
172 return WebLayerPositionConstraint(); 175 return WebLayerPositionConstraint();
173 } 176 }
174 177
175 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) 178 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer)
176 { 179 {
177 ASSERT(layer->backing()); 180 ASSERT(layer->backing());
178 RenderLayerBacking* backing = layer->backing(); 181 RenderLayerBacking* backing = layer->backing();
179 GraphicsLayer* mainLayer = backing->childForSuperlayers(); 182 GraphicsLayer* mainLayer = backing->childForSuperlayers();
180 183
181 // Avoid unnecessary commits 184 // Avoid unnecessary commits
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); 801 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
799 if (!viewportConstrainedObjects) 802 if (!viewportConstrainedObjects)
800 return false; 803 return false;
801 804
802 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) { 805 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) {
803 RenderObject* viewportConstrainedObject = *it; 806 RenderObject* viewportConstrainedObject = *it;
804 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer()) 807 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer())
805 return true; 808 return true;
806 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer(); 809 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer();
807 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling. 810 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling.
808 if (!layer->isComposited() && layer->viewportConstrainedNotCompositedRea son() == RenderLayer::NoNotCompositedReason) 811 if (layer->compositingState() != PaintsIntoOwnBacking && layer->viewport ConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason)
809 return true; 812 return true;
810 813
811 // Composited layers that actually paint into their enclosing ancestor 814 // Composited layers that actually paint into their enclosing ancestor
812 // must also force main thread scrolling. 815 // must also force main thread scrolling.
813 if (layer->isComposited() && layer->backing()->paintsIntoCompositedAnces tor()) 816 if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor)
814 return true; 817 return true;
815 } 818 }
816 return false; 819 return false;
817 } 820 }
818 821
819 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst 822 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst
820 { 823 {
821 // The main thread scrolling reasons are applicable to scrolls of the main 824 // The main thread scrolling reasons are applicable to scrolls of the main
822 // frame. If it does not exist or if it is not scrollable, there is no 825 // frame. If it does not exist or if it is not scrollable, there is no
823 // reason to force main thread scrolling. 826 // reason to force main thread scrolling.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 stringBuilder.resize(stringBuilder.length() - 2); 858 stringBuilder.resize(stringBuilder.length() - 2);
856 return stringBuilder.toString(); 859 return stringBuilder.toString();
857 } 860 }
858 861
859 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 862 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
860 { 863 {
861 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 864 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
862 } 865 }
863 866
864 } // namespace WebCore 867 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698