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