| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( | 194 bool CompositingReasonFinder::requiresCompositingForTransformAnimation( |
| 195 const ComputedStyle& style) { | 195 const ComputedStyle& style) { |
| 196 return style.subtreeWillChangeContents() | 196 return style.subtreeWillChangeContents() |
| 197 ? style.isRunningTransformAnimationOnCompositor() | 197 ? style.isRunningTransformAnimationOnCompositor() |
| 198 : style.hasCurrentTransformAnimation(); | 198 : style.hasCurrentTransformAnimation(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( | 201 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( |
| 202 const PaintLayer* layer) const { | 202 const PaintLayer* layer) const { |
| 203 if (layer->layoutObject()->style()->position() != FixedPosition && | 203 if (layer->layoutObject()->style()->position() != EPosition::kFixed && |
| 204 layer->layoutObject()->style()->position() != StickyPosition) | 204 layer->layoutObject()->style()->position() != EPosition::kSticky) |
| 205 return false; | 205 return false; |
| 206 | 206 |
| 207 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger) && | 207 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger) && |
| 208 (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() || | 208 (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() || |
| 209 !layer->backgroundIsKnownToBeOpaqueInRect( | 209 !layer->backgroundIsKnownToBeOpaqueInRect( |
| 210 LayoutRect(layer->boundingBoxForCompositing())) || | 210 LayoutRect(layer->boundingBoxForCompositing())) || |
| 211 layer->compositesWithTransform() || layer->compositesWithOpacity())) { | 211 layer->compositesWithTransform() || layer->compositesWithOpacity())) { |
| 212 return false; | 212 return false; |
| 213 } | 213 } |
| 214 // 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 |
| 215 // container, e.g. transformed elements. They will stay fixed wrt the | 215 // container, e.g. transformed elements. They will stay fixed wrt the |
| 216 // container rather than the enclosing frame. | 216 // container rather than the enclosing frame. |
| 217 if (layer->sticksToViewport()) | 217 if (layer->sticksToViewport()) |
| 218 return m_layoutView.frameView()->isScrollable(); | 218 return m_layoutView.frameView()->isScrollable(); |
| 219 return layer->layoutObject()->style()->position() == StickyPosition && | 219 return layer->layoutObject()->style()->position() == EPosition::kSticky && |
| 220 layer->ancestorOverflowLayer()->scrollsOverflow(); | 220 layer->ancestorOverflowLayer()->scrollsOverflow(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |