OLD | NEW |
---|---|
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 Loading... | |
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 |
172 // This walk ends once we found the first layer that has its own backing . | |
173 } while (layer && (layer->compositingState() == PaintsIntoOwnBacking || laye r->compositingState() == HasOwnBackingButPaintsIntoAncestor)); | |
Julien - ping for review
2013/10/03 20:08:36
Couldn't we use backing() here instead to be consi
shawnsingh
2013/10/07 11:45:04
Actually yes, I am reverting this back to using ba
| |
172 return WebLayerPositionConstraint(); | 174 return WebLayerPositionConstraint(); |
173 } | 175 } |
174 | 176 |
175 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) | 177 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) |
176 { | 178 { |
177 ASSERT(layer->backing()); | 179 ASSERT(layer->backing()); |
178 RenderLayerBacking* backing = layer->backing(); | 180 RenderLayerBacking* backing = layer->backing(); |
179 GraphicsLayer* mainLayer = backing->childForSuperlayers(); | 181 GraphicsLayer* mainLayer = backing->childForSuperlayers(); |
180 | 182 |
181 // Avoid unnecessary commits | 183 // Avoid unnecessary commits |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); | 800 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); |
799 if (!viewportConstrainedObjects) | 801 if (!viewportConstrainedObjects) |
800 return false; | 802 return false; |
801 | 803 |
802 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) { | 804 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; + +it) { |
803 RenderObject* viewportConstrainedObject = *it; | 805 RenderObject* viewportConstrainedObject = *it; |
804 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer()) | 806 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain edObject->hasLayer()) |
805 return true; | 807 return true; |
806 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer(); | 808 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)-> layer(); |
807 // Any explicit reason that a fixed position element is not composited s houldn't cause slow scrolling. | 809 // 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) | 810 if (layer->compositingState() != PaintsIntoOwnBacking && layer->viewport ConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason) |
809 return true; | 811 return true; |
810 | 812 |
811 // Composited layers that actually paint into their enclosing ancestor | 813 // Composited layers that actually paint into their enclosing ancestor |
812 // must also force main thread scrolling. | 814 // must also force main thread scrolling. |
813 if (layer->isComposited() && layer->backing()->paintsIntoCompositedAnces tor()) | 815 if (layer->compositingState() == HasOwnBackingButPaintsIntoAncestor) |
814 return true; | 816 return true; |
815 } | 817 } |
816 return false; | 818 return false; |
817 } | 819 } |
818 | 820 |
819 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst | 821 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co nst |
820 { | 822 { |
821 // The main thread scrolling reasons are applicable to scrolls of the main | 823 // 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 | 824 // frame. If it does not exist or if it is not scrollable, there is no |
823 // reason to force main thread scrolling. | 825 // reason to force main thread scrolling. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 stringBuilder.resize(stringBuilder.length() - 2); | 857 stringBuilder.resize(stringBuilder.length() - 2); |
856 return stringBuilder.toString(); | 858 return stringBuilder.toString(); |
857 } | 859 } |
858 | 860 |
859 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 861 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
860 { | 862 { |
861 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); | 863 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); |
862 } | 864 } |
863 | 865 |
864 } // namespace WebCore | 866 } // namespace WebCore |
OLD | NEW |