Chromium Code Reviews| 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 "CSSPropertyNames.h" | 8 #include "CSSPropertyNames.h" |
| 9 #include "HTMLNames.h" | 9 #include "HTMLNames.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 103 |
| 104 if (requiresCompositingForTransform(renderer)) | 104 if (requiresCompositingForTransform(renderer)) |
| 105 directReasons |= CompositingReason3DTransform; | 105 directReasons |= CompositingReason3DTransform; |
| 106 | 106 |
| 107 if (requiresCompositingForFilters(renderer)) | 107 if (requiresCompositingForFilters(renderer)) |
| 108 directReasons |= CompositingReasonFilters; | 108 directReasons |= CompositingReasonFilters; |
| 109 | 109 |
| 110 if (style->backfaceVisibility() == BackfaceVisibilityHidden) | 110 if (style->backfaceVisibility() == BackfaceVisibilityHidden) |
| 111 directReasons |= CompositingReasonBackfaceVisibilityHidden; | 111 directReasons |= CompositingReasonBackfaceVisibilityHidden; |
| 112 | 112 |
| 113 if (style->shouldCompositeForCurrentAnimations()) | 113 if (requiresCompositingForAnimation(renderer)) |
|
abarth-chromium
2014/06/06 17:18:29
Why not pass in the RenderStyle given that these a
ajuma
2014/06/06 17:50:09
Good point. CL up to fix this: https://codereview.
| |
| 114 directReasons |= CompositingReasonActiveAnimation; | 114 directReasons |= CompositingReasonActiveAnimation; |
| 115 | 115 |
| 116 if (style->hasWillChangeCompositingHint()) | 116 if (style->hasWillChangeCompositingHint() && !style->subtreeWillChangeConten ts()) |
| 117 directReasons |= CompositingReasonWillChangeCompositingHint; | 117 directReasons |= CompositingReasonWillChangeCompositingHint; |
| 118 | 118 |
| 119 ASSERT(!(directReasons & ~CompositingReasonComboAllStyleDeterminedReasons)); | 119 ASSERT(!(directReasons & ~CompositingReasonComboAllStyleDeterminedReasons)); |
| 120 return directReasons; | 120 return directReasons; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* rend erer) const | 123 bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* rend erer) const |
| 124 { | 124 { |
| 125 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, | 125 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, |
| 126 // but the renderer may be an inline that doesn't suppport them. | 126 // but the renderer may be an inline that doesn't suppport them. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 159 |
| 160 if (requiresCompositingForPositionFixed(renderer, layer, 0)) | 160 if (requiresCompositingForPositionFixed(renderer, layer, 0)) |
| 161 directReasons |= CompositingReasonPositionFixed; | 161 directReasons |= CompositingReasonPositionFixed; |
| 162 | 162 |
| 163 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger s); | 163 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger s); |
| 164 | 164 |
| 165 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 165 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
| 166 return directReasons; | 166 return directReasons; |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend erer) const | |
| 170 { | |
| 171 if (renderer->style()->subtreeWillChangeContents()) | |
| 172 return renderer->style()->isRunningAnimationOnCompositor(); | |
| 173 | |
| 174 return renderer->style()->shouldCompositeForCurrentAnimations(); | |
| 175 } | |
| 176 | |
| 169 bool CompositingReasonFinder::requiresCompositingForPosition(RenderObject* rende rer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReas on* viewportConstrainedNotCompositedReason) const | 177 bool CompositingReasonFinder::requiresCompositingForPosition(RenderObject* rende rer, const RenderLayer* layer, RenderLayer::ViewportConstrainedNotCompositedReas on* viewportConstrainedNotCompositedReason) const |
| 170 { | 178 { |
| 171 return requiresCompositingForPositionSticky(renderer, layer) || requiresComp ositingForPositionFixed(renderer, layer, viewportConstrainedNotCompositedReason) ; | 179 return requiresCompositingForPositionSticky(renderer, layer) || requiresComp ositingForPositionFixed(renderer, layer, viewportConstrainedNotCompositedReason) ; |
| 172 } | 180 } |
| 173 | 181 |
| 174 bool CompositingReasonFinder::requiresCompositingForPositionSticky(RenderObject* renderer, const RenderLayer* layer) const | 182 bool CompositingReasonFinder::requiresCompositingForPositionSticky(RenderObject* renderer, const RenderLayer* layer) const |
| 175 { | 183 { |
| 176 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 184 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) |
| 177 return false; | 185 return false; |
| 178 if (renderer->style()->position() != StickyPosition) | 186 if (renderer->style()->position() != StickyPosition) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 if (viewportConstrainedNotCompositedReason) | 264 if (viewportConstrainedNotCompositedReason) |
| 257 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos itedForBoundsOutOfView; | 265 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos itedForBoundsOutOfView; |
| 258 return false; | 266 return false; |
| 259 } | 267 } |
| 260 } | 268 } |
| 261 | 269 |
| 262 return true; | 270 return true; |
| 263 } | 271 } |
| 264 | 272 |
| 265 } | 273 } |
| OLD | NEW |