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

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

Issue 27030009: Revert "Make compositingState explicit (re-land #2 with bogus ASSERT removed)" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build error 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->compositedLayerMapping()); 161 ASSERT(layer->isComposited());
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 171 } while (layer && !layer->isComposited());
172 // Composited layers that inherit a fixed position state will be positio ned with respect to the nearest compositedLayerMapping's GraphicsLayer.
173 // So, once we find a layer that has its own compositedLayerMapping, we can stop searching for a fixed position RenderObject.
174 } while (layer && layer->compositedLayerMapping());
175 return WebLayerPositionConstraint(); 172 return WebLayerPositionConstraint();
176 } 173 }
177 174
178 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) 175 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer)
179 { 176 {
180 ASSERT(layer->compositedLayerMapping()); 177 ASSERT(layer->compositedLayerMapping());
181 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng(); 178 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng();
182 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers(); 179 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers();
183 180
184 // Avoid unnecessary commits 181 // Avoid unnecessary commits
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); 798 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
802 if (!viewportConstrainedObjects) 799 if (!viewportConstrainedObjects)
803 return false; 800 return false;
804 801
805 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) { 802 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) {
806 RenderObject* viewportConstrainedObject = *it; 803 RenderObject* viewportConstrainedObject = *it;
807 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer()) 804 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer())
808 return true; 805 return true;
809 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer(); 806 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer();
810 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling. 807 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling.
811 if (layer->compositingState() != PaintsIntoOwnBacking && layer->viewport ConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason) 808 if (!layer->isComposited() && layer->viewportConstrainedNotCompositedRea son() == RenderLayer::NoNotCompositedReason)
812 return true; 809 return true;
813 810
814 // Composited layers that actually paint into their enclosing ancestor 811 // Composited layers that actually paint into their enclosing ancestor
815 // must also force main thread scrolling. 812 // must also force main thread scrolling.
816 if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor) 813 if (layer->isComposited() && layer->compositedLayerMapping()->paintsInto CompositedAncestor())
817 return true; 814 return true;
818 } 815 }
819 return false; 816 return false;
820 } 817 }
821 818
822 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst 819 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst
823 { 820 {
824 // The main thread scrolling reasons are applicable to scrolls of the main 821 // The main thread scrolling reasons are applicable to scrolls of the main
825 // frame. If it does not exist or if it is not scrollable, there is no 822 // frame. If it does not exist or if it is not scrollable, there is no
826 // reason to force main thread scrolling. 823 // reason to force main thread scrolling.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 stringBuilder.resize(stringBuilder.length() - 2); 855 stringBuilder.resize(stringBuilder.length() - 2);
859 return stringBuilder.toString(); 856 return stringBuilder.toString();
860 } 857 }
861 858
862 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 859 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
863 { 860 {
864 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 861 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
865 } 862 }
866 863
867 } // namespace WebCore 864 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorLayerTreeAgent.cpp ('k') | Source/core/rendering/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698