| 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/rendering/compositing/CompositingReasonFinder.h" | 6 #include "core/rendering/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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 directReasons |= CompositingReasonOverflowScrollingParent; | 140 directReasons |= CompositingReasonOverflowScrollingParent; |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (layer->needsCompositedScrolling()) | 143 if (layer->needsCompositedScrolling()) |
| 144 directReasons |= CompositingReasonOverflowScrollingTouch; | 144 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 145 } | 145 } |
| 146 | 146 |
| 147 if (requiresCompositingForPositionFixed(layer)) | 147 if (requiresCompositingForPositionFixed(layer)) |
| 148 directReasons |= CompositingReasonPositionFixed; | 148 directReasons |= CompositingReasonPositionFixed; |
| 149 | 149 |
| 150 Node* node = layer->renderer()->node(); |
| 151 if (node->isElementNode() && toElement(node)->hasBoundAnimatedProperty()) |
| 152 directReasons |= CompositingReasonTeleport; |
| 153 |
| 150 directReasons |= renderer->additionalCompositingReasons(); | 154 directReasons |= renderer->additionalCompositingReasons(); |
| 151 | 155 |
| 152 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 156 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
| 153 return directReasons; | 157 return directReasons; |
| 154 } | 158 } |
| 155 | 159 |
| 156 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const | 160 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const |
| 157 { | 161 { |
| 158 if (style->subtreeWillChangeContents()) | 162 if (style->subtreeWillChangeContents()) |
| 159 return style->isRunningAnimationOnCompositor(); | 163 return style->isRunningAnimationOnCompositor(); |
| 160 | 164 |
| 161 return style->shouldCompositeForCurrentAnimations(); | 165 return style->shouldCompositeForCurrentAnimations(); |
| 162 } | 166 } |
| 163 | 167 |
| 164 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const RenderLa
yer* layer) const | 168 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const RenderLa
yer* layer) const |
| 165 { | 169 { |
| 166 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 170 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) |
| 167 return false; | 171 return false; |
| 168 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. | 172 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. |
| 169 // They will stay fixed wrt the container rather than the enclosing frame. | 173 // They will stay fixed wrt the container rather than the enclosing frame. |
| 170 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl
e(); | 174 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl
e(); |
| 171 } | 175 } |
| 172 | 176 |
| 173 } | 177 } |
| OLD | NEW |