| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er, bool* needToRecomputeCompositingRequirements) const | 62 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er, bool* needToRecomputeCompositingRequirements) const |
| 63 { | 63 { |
| 64 RenderObject* renderer = layer->renderer(); | 64 RenderObject* renderer = layer->renderer(); |
| 65 CompositingReasons directReasons = CompositingReasonNone; | 65 CompositingReasons directReasons = CompositingReasonNone; |
| 66 | 66 |
| 67 if (requiresCompositingForTransform(renderer)) | 67 if (requiresCompositingForTransform(renderer)) |
| 68 directReasons |= CompositingReason3DTransform; | 68 directReasons |= CompositingReason3DTransform; |
| 69 | 69 |
| 70 // Only zero or one of the following conditions will be true for a given Ren
derLayer. | |
| 71 // FIXME: These should be handled by overrides of RenderObject::additionalCo
mpositingReasons. | |
| 72 if (requiresCompositingForPlugin(renderer)) | |
| 73 directReasons |= CompositingReasonPlugin; | |
| 74 else if (requiresCompositingForFrame(renderer)) | |
| 75 directReasons |= CompositingReasonIFrame; | |
| 76 | |
| 77 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) | 70 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) |
| 78 directReasons |= CompositingReasonBackfaceVisibilityHidden; | 71 directReasons |= CompositingReasonBackfaceVisibilityHidden; |
| 79 | 72 |
| 80 if (requiresCompositingForAnimation(renderer)) | 73 if (requiresCompositingForAnimation(renderer)) |
| 81 directReasons |= CompositingReasonActiveAnimation; | 74 directReasons |= CompositingReasonActiveAnimation; |
| 82 | 75 |
| 83 if (requiresCompositingForTransition(renderer)) | 76 if (requiresCompositingForTransition(renderer)) |
| 84 directReasons |= CompositingReasonTransitionProperty; | 77 directReasons |= CompositingReasonTransitionProperty; |
| 85 | 78 |
| 86 if (requiresCompositingForFilters(renderer)) | 79 if (requiresCompositingForFilters(renderer)) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 { | 117 { |
| 125 if (!(m_compositingTriggers & ThreeDTransformTrigger)) | 118 if (!(m_compositingTriggers & ThreeDTransformTrigger)) |
| 126 return false; | 119 return false; |
| 127 | 120 |
| 128 RenderStyle* style = renderer->style(); | 121 RenderStyle* style = renderer->style(); |
| 129 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, | 122 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, |
| 130 // but the renderer may be an inline that doesn't suppport them. | 123 // but the renderer may be an inline that doesn't suppport them. |
| 131 return renderer->hasTransform() && style->transform().has3DOperation(); | 124 return renderer->hasTransform() && style->transform().has3DOperation(); |
| 132 } | 125 } |
| 133 | 126 |
| 134 bool CompositingReasonFinder::requiresCompositingForPlugin(RenderObject* rendere
r) const | |
| 135 { | |
| 136 if (!(m_compositingTriggers & PluginTrigger)) | |
| 137 return false; | |
| 138 | |
| 139 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req
uiresAcceleratedCompositing(); | |
| 140 } | |
| 141 | |
| 142 bool CompositingReasonFinder::requiresCompositingForFrame(RenderObject* renderer
) const | |
| 143 { | |
| 144 return renderer->isRenderPart() && toRenderPart(renderer)->requiresAccelerat
edCompositing(); | |
| 145 } | |
| 146 | |
| 147 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren
derObject* renderer) const | 127 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren
derObject* renderer) const |
| 148 { | 128 { |
| 149 if (!(m_compositingTriggers & ThreeDTransformTrigger)) | 129 if (!(m_compositingTriggers & ThreeDTransformTrigger)) |
| 150 return false; | 130 return false; |
| 151 | 131 |
| 152 return renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden; | 132 return renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden; |
| 153 } | 133 } |
| 154 | 134 |
| 155 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const | 135 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const |
| 156 { | 136 { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 304 |
| 325 return true; | 305 return true; |
| 326 } | 306 } |
| 327 | 307 |
| 328 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const | 308 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const |
| 329 { | 309 { |
| 330 return layer->needsCompositedScrolling(); | 310 return layer->needsCompositedScrolling(); |
| 331 } | 311 } |
| 332 | 312 |
| 333 } | 313 } |
| OLD | NEW |