| 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/animation/ActiveAnimations.h" | 10 #include "core/animation/ActiveAnimations.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 directReasons |= CompositingReasonPlugin; | 73 directReasons |= CompositingReasonPlugin; |
| 74 else if (requiresCompositingForFrame(renderer)) | 74 else if (requiresCompositingForFrame(renderer)) |
| 75 directReasons |= CompositingReasonIFrame; | 75 directReasons |= CompositingReasonIFrame; |
| 76 | 76 |
| 77 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) | 77 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) |
| 78 directReasons |= CompositingReasonBackfaceVisibilityHidden; | 78 directReasons |= CompositingReasonBackfaceVisibilityHidden; |
| 79 | 79 |
| 80 if (requiresCompositingForAnimation(renderer)) | 80 if (requiresCompositingForAnimation(renderer)) |
| 81 directReasons |= CompositingReasonActiveAnimation; | 81 directReasons |= CompositingReasonActiveAnimation; |
| 82 | 82 |
| 83 if (requiresCompositingForTransition(renderer)) | |
| 84 directReasons |= CompositingReasonTransitionProperty; | |
| 85 | |
| 86 if (requiresCompositingForFilters(renderer)) | 83 if (requiresCompositingForFilters(renderer)) |
| 87 directReasons |= CompositingReasonFilters; | 84 directReasons |= CompositingReasonFilters; |
| 88 | 85 |
| 89 if (requiresCompositingForPosition(renderer, layer, 0, needToRecomputeCompos
itingRequirements)) | 86 if (requiresCompositingForPosition(renderer, layer, 0, needToRecomputeCompos
itingRequirements)) |
| 90 directReasons |= renderer->style()->position() == FixedPosition ? Compos
itingReasonPositionFixed : CompositingReasonPositionSticky; | 87 directReasons |= renderer->style()->position() == FixedPosition ? Compos
itingReasonPositionFixed : CompositingReasonPositionSticky; |
| 91 | 88 |
| 92 if (requiresCompositingForOverflowScrolling(layer)) | 89 if (requiresCompositingForOverflowScrolling(layer)) |
| 93 directReasons |= CompositingReasonOverflowScrollingTouch; | 90 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 94 | 91 |
| 95 if (requiresCompositingForOverflowScrollingParent(layer)) | 92 if (requiresCompositingForOverflowScrollingParent(layer)) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 163 } |
| 167 | 164 |
| 168 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const | 165 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const |
| 169 { | 166 { |
| 170 if (!(m_compositingTriggers & AnimationTrigger)) | 167 if (!(m_compositingTriggers & AnimationTrigger)) |
| 171 return false; | 168 return false; |
| 172 | 169 |
| 173 return shouldCompositeForActiveAnimations(*renderer); | 170 return shouldCompositeForActiveAnimations(*renderer); |
| 174 } | 171 } |
| 175 | 172 |
| 176 bool CompositingReasonFinder::requiresCompositingForTransition(RenderObject* ren
derer) const | |
| 177 { | |
| 178 if (!(m_compositingTriggers & AnimationTrigger)) | |
| 179 return false; | |
| 180 | |
| 181 if (Settings* settings = m_renderView.document().settings()) { | |
| 182 if (!settings->acceleratedCompositingForTransitionEnabled()) | |
| 183 return false; | |
| 184 } | |
| 185 | |
| 186 return renderer->style()->transitionForProperty(CSSPropertyOpacity) | |
| 187 || renderer->style()->transitionForProperty(CSSPropertyWebkitFilter) | |
| 188 || renderer->style()->transitionForProperty(CSSPropertyWebkitTransform); | |
| 189 } | |
| 190 | |
| 191 bool CompositingReasonFinder::requiresCompositingForFilters(RenderObject* render
er) const | 173 bool CompositingReasonFinder::requiresCompositingForFilters(RenderObject* render
er) const |
| 192 { | 174 { |
| 193 if (!(m_compositingTriggers & FilterTrigger)) | 175 if (!(m_compositingTriggers & FilterTrigger)) |
| 194 return false; | 176 return false; |
| 195 | 177 |
| 196 return renderer->hasFilter(); | 178 return renderer->hasFilter(); |
| 197 } | 179 } |
| 198 | 180 |
| 199 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const | 181 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const |
| 200 { | 182 { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 319 |
| 338 return true; | 320 return true; |
| 339 } | 321 } |
| 340 | 322 |
| 341 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const | 323 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const |
| 342 { | 324 { |
| 343 return layer->needsCompositedScrolling(); | 325 return layer->needsCompositedScrolling(); |
| 344 } | 326 } |
| 345 | 327 |
| 346 } | 328 } |
| OLD | NEW |