| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 { | 52 { |
| 53 return m_compositingTriggers & AnimationTrigger; | 53 return m_compositingTriggers & AnimationTrigger; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool CompositingReasonFinder::isMainFrame() const | 56 bool CompositingReasonFinder::isMainFrame() const |
| 57 { | 57 { |
| 58 // FIXME: LocalFrame::isMainFrame() is probably better. | 58 // FIXME: LocalFrame::isMainFrame() is probably better. |
| 59 return !m_renderView.document().ownerElement(); | 59 return !m_renderView.document().ownerElement(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er, bool* needToRecomputeCompositingRequirements) const | 62 CompositingReasons CompositingReasonFinder::styleDeterminedDirectReasons(RenderO
bject* renderer) const |
| 63 { | 63 { |
| 64 RenderObject* renderer = layer->renderer(); | |
| 65 CompositingReasons directReasons = CompositingReasonNone; | 64 CompositingReasons directReasons = CompositingReasonNone; |
| 66 | 65 |
| 67 if (requiresCompositingForTransform(renderer)) | 66 if (requiresCompositingForTransform(renderer)) |
| 68 directReasons |= CompositingReason3DTransform; | 67 directReasons |= CompositingReason3DTransform; |
| 69 | 68 |
| 70 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) | 69 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) |
| 71 directReasons |= CompositingReasonBackfaceVisibilityHidden; | 70 directReasons |= CompositingReasonBackfaceVisibilityHidden; |
| 72 | 71 |
| 73 if (requiresCompositingForAnimation(renderer)) | 72 if (requiresCompositingForAnimation(renderer)) |
| 74 directReasons |= CompositingReasonActiveAnimation; | 73 directReasons |= CompositingReasonActiveAnimation; |
| 75 | 74 |
| 76 if (requiresCompositingForFilters(renderer)) | 75 if (requiresCompositingForFilters(renderer)) |
| 77 directReasons |= CompositingReasonFilters; | 76 directReasons |= CompositingReasonFilters; |
| 78 | 77 |
| 79 if (requiresCompositingForPosition(renderer, layer, 0, needToRecomputeCompos
itingRequirements)) | 78 if (requiresCompositingForWillChange(renderer)) |
| 80 directReasons |= renderer->style()->position() == FixedPosition ? Compos
itingReasonPositionFixed : CompositingReasonPositionSticky; | 79 directReasons |= CompositingReasonWillChange; |
| 80 |
| 81 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); |
| 82 |
| 83 ASSERT(!(directReasons & ~CompositingReasonComboAllStyleDeterminedDirectReas
ons)); |
| 84 return directReasons; |
| 85 } |
| 86 |
| 87 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons
t RenderLayer* layer, bool* needToRecomputeCompositingRequirements) const |
| 88 { |
| 89 CompositingReasons directReasons = CompositingReasonNone; |
| 90 |
| 91 if (requiresCompositingForOutOfFlowClipping(layer)) |
| 92 directReasons |= CompositingReasonOutOfFlowClipping; |
| 81 | 93 |
| 82 if (requiresCompositingForOverflowScrolling(layer)) | 94 if (requiresCompositingForOverflowScrolling(layer)) |
| 83 directReasons |= CompositingReasonOverflowScrollingTouch; | 95 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 84 | 96 |
| 85 if (requiresCompositingForOverflowScrollingParent(layer)) | 97 if (requiresCompositingForOverflowScrollingParent(layer)) |
| 86 directReasons |= CompositingReasonOverflowScrollingParent; | 98 directReasons |= CompositingReasonOverflowScrollingParent; |
| 87 | 99 |
| 88 if (requiresCompositingForOutOfFlowClipping(layer)) | 100 RenderObject* renderer = layer->renderer(); |
| 89 directReasons |= CompositingReasonOutOfFlowClipping; | 101 if (requiresCompositingForPosition(renderer, layer, 0, needToRecomputeCompos
itingRequirements)) |
| 102 directReasons |= renderer->style()->position() == FixedPosition ? Compos
itingReasonPositionFixed : CompositingReasonPositionSticky; |
| 90 | 103 |
| 91 if (requiresCompositingForWillChange(renderer)) | 104 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedDirectReaso
ns)); |
| 92 directReasons |= CompositingReasonWillChange; | 105 return directReasons; |
| 106 } |
| 93 | 107 |
| 94 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); | 108 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er, bool* needToRecomputeCompositingRequirements) const |
| 95 | 109 { |
| 96 return directReasons; | 110 return styleDeterminedDirectReasons(layer->renderer()) | nonStyleDeterminedD
irectReasons(layer, needToRecomputeCompositingRequirements); |
| 97 } | 111 } |
| 98 | 112 |
| 99 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const | 113 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const |
| 100 { | 114 { |
| 101 // Need this done first to determine overflow. | 115 // Need this done first to determine overflow. |
| 102 ASSERT(!m_renderView.needsLayout()); | 116 ASSERT(!m_renderView.needsLayout()); |
| 103 if (isMainFrame()) | 117 if (isMainFrame()) |
| 104 return false; | 118 return false; |
| 105 | 119 |
| 106 if (!(m_compositingTriggers & ScrollableInnerFrameTrigger)) | 120 if (!(m_compositingTriggers & ScrollableInnerFrameTrigger)) |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 298 |
| 285 return true; | 299 return true; |
| 286 } | 300 } |
| 287 | 301 |
| 288 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const | 302 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const |
| 289 { | 303 { |
| 290 return layer->needsCompositedScrolling(); | 304 return layer->needsCompositedScrolling(); |
| 291 } | 305 } |
| 292 | 306 |
| 293 } | 307 } |
| OLD | NEW |