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/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // If the implementation of createsGroup changes, we need to be aware of tha
t in this part of code. | 96 // If the implementation of createsGroup changes, we need to be aware of tha
t in this part of code. |
97 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->hasFil
ter() || renderer->hasBlendMode()) == renderer->createsGroup()); | 97 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->hasFil
ter() || renderer->hasBlendMode()) == renderer->createsGroup()); |
98 | 98 |
99 if (style->hasMask()) | 99 if (style->hasMask()) |
100 reasons |= CompositingReasonMaskWithCompositedDescendants; | 100 reasons |= CompositingReasonMaskWithCompositedDescendants; |
101 | 101 |
102 if (style->hasFilter()) | 102 if (style->hasFilter()) |
103 reasons |= CompositingReasonFilterWithCompositedDescendants; | 103 reasons |= CompositingReasonFilterWithCompositedDescendants; |
104 | 104 |
105 // See RenderLayer::updateTransform for an explanation of why we check both. | 105 // See RenderLayer::updateTransform for an explanation of why we check both. |
106 if (renderer->hasTransform() && style->hasTransform()) | 106 if (renderer->hasTransformRelatedProperty() && style->hasTransform()) |
107 reasons |= CompositingReasonTransformWithCompositedDescendants; | 107 reasons |= CompositingReasonTransformWithCompositedDescendants; |
108 | 108 |
109 if (renderer->isTransparent()) | 109 if (renderer->isTransparent()) |
110 reasons |= CompositingReasonOpacityWithCompositedDescendants; | 110 reasons |= CompositingReasonOpacityWithCompositedDescendants; |
111 | 111 |
112 if (renderer->hasBlendMode()) | 112 if (renderer->hasBlendMode()) |
113 reasons |= CompositingReasonBlendingWithCompositedDescendants; | 113 reasons |= CompositingReasonBlendingWithCompositedDescendants; |
114 | 114 |
115 if (renderer->hasReflection()) | 115 if (renderer->hasReflection()) |
116 reasons |= CompositingReasonReflectionWithCompositedDescendants; | 116 reasons |= CompositingReasonReflectionWithCompositedDescendants; |
117 | 117 |
118 ASSERT(!(reasons & ~CompositingReasonComboAllStyleDeterminedReasons)); | 118 ASSERT(!(reasons & ~CompositingReasonComboAllStyleDeterminedReasons)); |
119 return reasons; | 119 return reasons; |
120 } | 120 } |
121 | 121 |
122 bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* rend
erer) const | 122 bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* rend
erer) const |
123 { | 123 { |
124 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, | 124 // Note that we ask the renderer if it has a transform, because the style ma
y have transforms, |
125 // but the renderer may be an inline that doesn't suppport them. | 125 // but the renderer may be an inline that doesn't suppport them. |
126 return renderer->hasTransform() && renderer->style()->transform().has3DOpera
tion(); | 126 return renderer->hasTransformRelatedProperty() && renderer->style()->transfo
rm().has3DOperation(); |
127 } | 127 } |
128 | 128 |
129 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons
t RenderLayer* layer) const | 129 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons
t RenderLayer* layer) const |
130 { | 130 { |
131 CompositingReasons directReasons = CompositingReasonNone; | 131 CompositingReasons directReasons = CompositingReasonNone; |
132 RenderObject* renderer = layer->renderer(); | 132 RenderObject* renderer = layer->renderer(); |
133 | 133 |
134 if (hasOverflowScrollTrigger()) { | 134 if (hasOverflowScrollTrigger()) { |
135 if (layer->clipParent()) | 135 if (layer->clipParent()) |
136 directReasons |= CompositingReasonOutOfFlowClipping; | 136 directReasons |= CompositingReasonOutOfFlowClipping; |
(...skipping 27 matching lines...) Expand all Loading... |
164 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const RenderLa
yer* layer) const | 164 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const RenderLa
yer* layer) const |
165 { | 165 { |
166 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 166 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) |
167 return false; | 167 return false; |
168 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. | 168 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. |
169 // They will stay fixed wrt the container rather than the enclosing frame. | 169 // They will stay fixed wrt the container rather than the enclosing frame. |
170 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl
e(); | 170 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl
e(); |
171 } | 171 } |
172 | 172 |
173 } | 173 } |
OLD | NEW |