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

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: path for re-landing try #2 with removed unnecessary comment 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics Layer* except) 154 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics Layer* except)
155 { 155 {
156 if (layer && layer != except && scrollingWebLayerForGraphicsLayer(layer)) 156 if (layer && layer != except && scrollingWebLayerForGraphicsLayer(layer))
157 scrollingWebLayerForGraphicsLayer(layer)->setPositionConstraint(WebLayer PositionConstraint()); 157 scrollingWebLayerForGraphicsLayer(layer)->setPositionConstraint(WebLayer PositionConstraint());
158 } 158 }
159 159
160 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l ayer) 160 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l ayer)
161 { 161 {
162 ASSERT(layer->isComposited()); 162 ASSERT(layer->compositedLayerMapping());
163 do { 163 do {
164 if (layer->renderer()->style()->position() == FixedPosition) { 164 if (layer->renderer()->style()->position() == FixedPosition) {
165 const RenderObject* fixedPositionObject = layer->renderer(); 165 const RenderObject* fixedPositionObject = layer->renderer();
166 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); 166 bool fixedToRight = !fixedPositionObject->style()->right().isAuto();
167 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto( ); 167 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto( );
168 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed ToBottom); 168 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed ToBottom);
169 } 169 }
170 170
171 layer = layer->parent(); 171 layer = layer->parent();
172 } while (layer && !layer->isComposited()); 172
173 // Composited layers that inherit a fixed position state will be positio ned with respect to the nearest compositedLayerMapping's GraphicsLayer.
174 // So, once we find a layer that has its own compositedLayerMapping, we can stop searching for a fixed position RenderObject.
175 } while (layer && layer->compositedLayerMapping());
173 return WebLayerPositionConstraint(); 176 return WebLayerPositionConstraint();
174 } 177 }
175 178
176 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) 179 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer)
177 { 180 {
178 ASSERT(layer->compositedLayerMapping()); 181 ASSERT(layer->compositedLayerMapping());
179 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng(); 182 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng();
180 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers(); 183 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers();
181 184
182 // Avoid unnecessary commits 185 // Avoid unnecessary commits
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); 802 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
800 if (!viewportConstrainedObjects) 803 if (!viewportConstrainedObjects)
801 return false; 804 return false;
802 805
803 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) { 806 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) {
804 RenderObject* viewportConstrainedObject = *it; 807 RenderObject* viewportConstrainedObject = *it;
805 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer()) 808 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer())
806 return true; 809 return true;
807 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer(); 810 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer();
808 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling. 811 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling.
809 if (!layer->isComposited() && layer->viewportConstrainedNotCompositedRea son() == RenderLayer::NoNotCompositedReason) 812 if (layer->compositingState() != PaintsIntoOwnBacking && layer->viewport ConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason)
810 return true; 813 return true;
811 814
812 // Composited layers that actually paint into their enclosing ancestor 815 // Composited layers that actually paint into their enclosing ancestor
813 // must also force main thread scrolling. 816 // must also force main thread scrolling.
814 if (layer->isComposited() && layer->compositedLayerMapping()->paintsInto CompositedAncestor()) 817 if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor)
815 return true; 818 return true;
816 } 819 }
817 return false; 820 return false;
818 } 821 }
819 822
820 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst 823 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst
821 { 824 {
822 // The main thread scrolling reasons are applicable to scrolls of the main 825 // The main thread scrolling reasons are applicable to scrolls of the main
823 // frame. If it does not exist or if it is not scrollable, there is no 826 // frame. If it does not exist or if it is not scrollable, there is no
824 // reason to force main thread scrolling. 827 // reason to force main thread scrolling.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 stringBuilder.resize(stringBuilder.length() - 2); 859 stringBuilder.resize(stringBuilder.length() - 2);
857 return stringBuilder.toString(); 860 return stringBuilder.toString();
858 } 861 }
859 862
860 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 863 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
861 { 864 {
862 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 865 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
863 } 866 }
864 867
865 } // namespace WebCore 868 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/animation/KeyframeAnimation.cpp ('k') | Source/core/rendering/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698