OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/layout/compositing/CompositingReasonFinder.h" | 6 #include "core/layout/compositing/CompositingReasonFinder.h" |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // scrolling layer is not not on the stacking context ancestor chain of |lay
er|. | 156 // scrolling layer is not not on the stacking context ancestor chain of |lay
er|. |
157 // See the definition of the scrollParent property in Layer for more detail. | 157 // See the definition of the scrollParent property in Layer for more detail. |
158 if (const DeprecatedPaintLayer* scrollingAncestor = layer->ancestorScrolling
Layer()) { | 158 if (const DeprecatedPaintLayer* scrollingAncestor = layer->ancestorScrolling
Layer()) { |
159 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent
()) | 159 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent
()) |
160 directReasons |= CompositingReasonOverflowScrollingParent; | 160 directReasons |= CompositingReasonOverflowScrollingParent; |
161 } | 161 } |
162 | 162 |
163 if (requiresCompositingForPositionFixed(layer)) | 163 if (requiresCompositingForPositionFixed(layer)) |
164 directReasons |= CompositingReasonPositionFixed; | 164 directReasons |= CompositingReasonPositionFixed; |
165 | 165 |
| 166 if (layer->scrollsWithScrollAncestor()) |
| 167 directReasons |= CompositingReasonPositionSticky; |
| 168 |
166 directReasons |= layoutObject->additionalCompositingReasons(); | 169 directReasons |= layoutObject->additionalCompositingReasons(); |
167 | 170 |
168 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 171 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
169 return directReasons; | 172 return directReasons; |
170 } | 173 } |
171 | 174 |
172 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl
e& style) const | 175 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl
e& style) const |
173 { | 176 { |
174 if (style.subtreeWillChangeContents()) | 177 if (style.subtreeWillChangeContents()) |
175 return style.isRunningAnimationOnCompositor(); | 178 return style.isRunningAnimationOnCompositor(); |
176 | 179 |
177 return style.shouldCompositeForCurrentAnimations(); | 180 return style.shouldCompositeForCurrentAnimations(); |
178 } | 181 } |
179 | 182 |
180 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat
edPaintLayer* layer) const | 183 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat
edPaintLayer* layer) const |
181 { | 184 { |
182 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 185 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) |
183 return false; | 186 return false; |
184 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. | 187 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. |
185 // They will stay fixed wrt the container rather than the enclosing frame. | 188 // They will stay fixed wrt the container rather than the enclosing frame. |
186 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl
e(); | 189 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl
e(); |
187 } | 190 } |
188 | 191 |
189 } | 192 } |
OLD | NEW |