| 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/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (layer->potentiallyStaleIsUnclippedDescendant()) | 129 if (layer->potentiallyStaleIsUnclippedDescendant()) |
| 130 directReasons |= CompositingReasonOutOfFlowClipping; | 130 directReasons |= CompositingReasonOutOfFlowClipping; |
| 131 | 131 |
| 132 if (layer->scrollParent()) | 132 if (layer->scrollParent()) |
| 133 directReasons |= CompositingReasonOverflowScrollingParent; | 133 directReasons |= CompositingReasonOverflowScrollingParent; |
| 134 | 134 |
| 135 if (layer->needsCompositedScrolling()) | 135 if (layer->needsCompositedScrolling()) |
| 136 directReasons |= CompositingReasonOverflowScrollingTouch; | 136 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 137 } | 137 } |
| 138 | 138 |
| 139 if (requiresCompositingForPositionSticky(renderer, layer)) | |
| 140 directReasons |= CompositingReasonPositionSticky; | |
| 141 | |
| 142 if (requiresCompositingForPositionFixed(renderer, layer, 0)) | 139 if (requiresCompositingForPositionFixed(renderer, layer, 0)) |
| 143 directReasons |= CompositingReasonPositionFixed; | 140 directReasons |= CompositingReasonPositionFixed; |
| 144 | 141 |
| 145 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); | 142 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); |
| 146 | 143 |
| 147 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 144 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
| 148 return directReasons; | 145 return directReasons; |
| 149 } | 146 } |
| 150 | 147 |
| 151 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const | 148 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const |
| 152 { | 149 { |
| 153 if (style->subtreeWillChangeContents()) | 150 if (style->subtreeWillChangeContents()) |
| 154 return style->isRunningAnimationOnCompositor(); | 151 return style->isRunningAnimationOnCompositor(); |
| 155 | 152 |
| 156 return style->shouldCompositeForCurrentAnimations(); | 153 return style->shouldCompositeForCurrentAnimations(); |
| 157 } | 154 } |
| 158 | 155 |
| 159 bool CompositingReasonFinder::requiresCompositingForPosition(RenderObject* rende
rer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReas
on* viewportConstrainedNotCompositedReason) const | |
| 160 { | |
| 161 return requiresCompositingForPositionSticky(renderer, layer) || requiresComp
ositingForPositionFixed(renderer, layer, viewportConstrainedNotCompositedReason)
; | |
| 162 } | |
| 163 | |
| 164 bool CompositingReasonFinder::requiresCompositingForPositionSticky(RenderObject*
renderer, const RenderLayer* layer) const | |
| 165 { | |
| 166 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | |
| 167 return false; | |
| 168 if (renderer->style()->position() != StickyPosition) | |
| 169 return false; | |
| 170 // FIXME: This probably isn't correct for accelerated overflow scrolling. cr
bug.com/361723 | |
| 171 // Instead it should return false only if the layer is not inside a scrollab
le region. | |
| 172 return !layer->enclosingOverflowClipLayer(ExcludeSelf); | |
| 173 } | |
| 174 | |
| 175 bool CompositingReasonFinder::requiresCompositingForPositionFixed(RenderObject*
renderer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotComposite
dReason* viewportConstrainedNotCompositedReason) const | 156 bool CompositingReasonFinder::requiresCompositingForPositionFixed(RenderObject*
renderer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotComposite
dReason* viewportConstrainedNotCompositedReason) const |
| 176 { | 157 { |
| 177 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 158 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) |
| 178 return false; | 159 return false; |
| 179 | 160 |
| 180 if (renderer->style()->position() != FixedPosition) | 161 if (renderer->style()->position() != FixedPosition) |
| 181 return false; | 162 return false; |
| 182 | 163 |
| 183 RenderObject* container = renderer->container(); | 164 RenderObject* container = renderer->container(); |
| 184 // If the renderer is not hooked up yet then we have to wait until it is. | 165 // If the renderer is not hooked up yet then we have to wait until it is. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (viewportConstrainedNotCompositedReason) | 227 if (viewportConstrainedNotCompositedReason) |
| 247 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
itedForBoundsOutOfView; | 228 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
itedForBoundsOutOfView; |
| 248 return false; | 229 return false; |
| 249 } | 230 } |
| 250 } | 231 } |
| 251 | 232 |
| 252 return true; | 233 return true; |
| 253 } | 234 } |
| 254 | 235 |
| 255 } | 236 } |
| OLD | NEW |