| 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 "core/layout/compositing/CompositingReasonFinder.h" | 5 #include "core/layout/compositing/CompositingReasonFinder.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool CompositingReasonFinder::requiresCompositingForAnimation( | 173 bool CompositingReasonFinder::requiresCompositingForAnimation( |
| 174 const ComputedStyle& style) { | 174 const ComputedStyle& style) { |
| 175 if (style.subtreeWillChangeContents()) | 175 if (style.subtreeWillChangeContents()) |
| 176 return style.isRunningAnimationOnCompositor(); | 176 return style.isRunningAnimationOnCompositor(); |
| 177 | 177 |
| 178 return style.shouldCompositeForCurrentAnimations(); | 178 return style.shouldCompositeForCurrentAnimations(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool CompositingReasonFinder::requiresCompositingForOpacityAnimation( |
| 182 const ComputedStyle& style) { |
| 183 return style.subtreeWillChangeContents() |
| 184 ? style.isRunningOpacityAnimationOnCompositor() |
| 185 : style.hasCurrentOpacityAnimation(); |
| 186 } |
| 187 |
| 188 bool CompositingReasonFinder::requiresCompositingForFilterAnimation( |
| 189 const ComputedStyle& style) { |
| 190 return style.subtreeWillChangeContents() |
| 191 ? style.isRunningFilterAnimationOnCompositor() |
| 192 : style.hasCurrentFilterAnimation(); |
| 193 } |
| 194 |
| 195 bool CompositingReasonFinder::requiresCompositingForBackdropFilterAnimation( |
| 196 const ComputedStyle& style) { |
| 197 return style.subtreeWillChangeContents() |
| 198 ? style.isRunningBackdropFilterAnimationOnCompositor() |
| 199 : style.hasCurrentBackdropFilterAnimation(); |
| 200 } |
| 201 |
| 181 bool CompositingReasonFinder::requiresCompositingForEffectAnimation( | 202 bool CompositingReasonFinder::requiresCompositingForEffectAnimation( |
| 182 const ComputedStyle& style) { | 203 const ComputedStyle& style) { |
| 183 if (style.subtreeWillChangeContents()) { | 204 return requiresCompositingForOpacityAnimation(style) || |
| 184 return style.isRunningOpacityAnimationOnCompositor() || | 205 requiresCompositingForFilterAnimation(style) || |
| 185 style.isRunningFilterAnimationOnCompositor() || | 206 requiresCompositingForBackdropFilterAnimation(style); |
| 186 style.isRunningBackdropFilterAnimationOnCompositor(); | |
| 187 } | |
| 188 | |
| 189 return style.hasCurrentOpacityAnimation() || | |
| 190 style.hasCurrentFilterAnimation() || | |
| 191 style.hasCurrentBackdropFilterAnimation(); | |
| 192 } | 207 } |
| 193 | 208 |
| 194 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( | 209 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( |
| 195 const ComputedStyle& style) { | 210 const ComputedStyle& style) { |
| 196 return style.subtreeWillChangeContents() | 211 return style.subtreeWillChangeContents() |
| 197 ? style.isRunningTransformAnimationOnCompositor() | 212 ? style.isRunningTransformAnimationOnCompositor() |
| 198 : style.hasCurrentTransformAnimation(); | 213 : style.hasCurrentTransformAnimation(); |
| 199 } | 214 } |
| 200 | 215 |
| 201 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( | 216 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 214 // Don't promote fixed position elements that are descendants of a non-view | 229 // Don't promote fixed position elements that are descendants of a non-view |
| 215 // container, e.g. transformed elements. They will stay fixed wrt the | 230 // container, e.g. transformed elements. They will stay fixed wrt the |
| 216 // container rather than the enclosing frame. | 231 // container rather than the enclosing frame. |
| 217 if (layer->sticksToViewport()) | 232 if (layer->sticksToViewport()) |
| 218 return m_layoutView.frameView()->isScrollable(); | 233 return m_layoutView.frameView()->isScrollable(); |
| 219 return layer->layoutObject()->style()->position() == EPosition::kSticky && | 234 return layer->layoutObject()->style()->position() == EPosition::kSticky && |
| 220 layer->ancestorOverflowLayer()->scrollsOverflow(); | 235 layer->ancestorOverflowLayer()->scrollsOverflow(); |
| 221 } | 236 } |
| 222 | 237 |
| 223 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |