| 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::requiresCompositingForEffectAnimation( |
| 182 const ComputedStyle& style) { |
| 183 if (style.subtreeWillChangeContents()) { |
| 184 return style.isRunningOpacityAnimationOnCompositor() || |
| 185 style.isRunningFilterAnimationOnCompositor() || |
| 186 style.isRunningBackdropFilterAnimationOnCompositor(); |
| 187 } |
| 188 |
| 189 return style.hasCurrentOpacityAnimation() || |
| 190 style.hasCurrentFilterAnimation() || |
| 191 style.hasCurrentBackdropFilterAnimation(); |
| 192 } |
| 193 |
| 181 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( | 194 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( |
| 182 const ComputedStyle& style) { | 195 const ComputedStyle& style) { |
| 183 return style.subtreeWillChangeContents() | 196 return style.subtreeWillChangeContents() |
| 184 ? style.isRunningTransformAnimationOnCompositor() | 197 ? style.isRunningTransformAnimationOnCompositor() |
| 185 : style.hasCurrentTransformAnimation(); | 198 : style.hasCurrentTransformAnimation(); |
| 186 } | 199 } |
| 187 | 200 |
| 188 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( | 201 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( |
| 189 const PaintLayer* layer) const { | 202 const PaintLayer* layer) const { |
| 190 if (layer->layoutObject()->style()->position() != FixedPosition && | 203 if (layer->layoutObject()->style()->position() != FixedPosition && |
| (...skipping 10 matching lines...) Expand all Loading... |
| 201 // Don't promote fixed position elements that are descendants of a non-view | 214 // Don't promote fixed position elements that are descendants of a non-view |
| 202 // container, e.g. transformed elements. They will stay fixed wrt the | 215 // container, e.g. transformed elements. They will stay fixed wrt the |
| 203 // container rather than the enclosing frame. | 216 // container rather than the enclosing frame. |
| 204 if (layer->sticksToViewport()) | 217 if (layer->sticksToViewport()) |
| 205 return m_layoutView.frameView()->isScrollable(); | 218 return m_layoutView.frameView()->isScrollable(); |
| 206 return layer->layoutObject()->style()->position() == StickyPosition && | 219 return layer->layoutObject()->style()->position() == StickyPosition && |
| 207 layer->ancestorOverflowLayer()->scrollsOverflow(); | 220 layer->ancestorOverflowLayer()->scrollsOverflow(); |
| 208 } | 221 } |
| 209 | 222 |
| 210 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |