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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 70 // Only zero or one of the following conditions will be true for a given Ren
derLayer. |
71 if (requiresCompositingForVideo(renderer)) | 71 if (requiresCompositingForVideo(renderer)) |
72 directReasons |= CompositingReasonVideo; | 72 directReasons |= CompositingReasonVideo; |
73 else if (requiresCompositingForCanvas(renderer)) | 73 else if (requiresCompositingForCanvas(renderer)) |
74 directReasons |= CompositingReasonCanvas; | 74 directReasons |= CompositingReasonCanvas; |
75 else if (requiresCompositingForPlugin(renderer, needToRecomputeCompositingRe
quirements)) | 75 else if (requiresCompositingForPlugin(renderer, needToRecomputeCompositingRe
quirements)) |
76 directReasons |= CompositingReasonPlugin; | 76 directReasons |= CompositingReasonPlugin; |
77 else if (requiresCompositingForFrame(renderer, needToRecomputeCompositingReq
uirements)) | 77 else if (requiresCompositingForFrame(renderer)) |
78 directReasons |= CompositingReasonIFrame; | 78 directReasons |= CompositingReasonIFrame; |
79 | 79 |
80 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) | 80 if (requiresCompositingForBackfaceVisibilityHidden(renderer)) |
81 directReasons |= CompositingReasonBackfaceVisibilityHidden; | 81 directReasons |= CompositingReasonBackfaceVisibilityHidden; |
82 | 82 |
83 if (requiresCompositingForAnimation(renderer)) | 83 if (requiresCompositingForAnimation(renderer)) |
84 directReasons |= CompositingReasonActiveAnimation; | 84 directReasons |= CompositingReasonActiveAnimation; |
85 | 85 |
86 if (requiresCompositingForTransition(renderer)) | 86 if (requiresCompositingForTransition(renderer)) |
87 directReasons |= CompositingReasonTransitionProperty; | 87 directReasons |= CompositingReasonTransitionProperty; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 RenderWidget* pluginRenderer = toRenderWidget(renderer); | 176 RenderWidget* pluginRenderer = toRenderWidget(renderer); |
177 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. | 177 // If we can't reliably know the size of the plugin yet, don't change compos
iting state. |
178 if (pluginRenderer->needsLayout()) | 178 if (pluginRenderer->needsLayout()) |
179 return pluginRenderer->hasLayer() && pluginRenderer->layer()->hasComposi
tedLayerMapping(); | 179 return pluginRenderer->hasLayer() && pluginRenderer->layer()->hasComposi
tedLayerMapping(); |
180 | 180 |
181 // Don't go into compositing mode if height or width are zero, or size is 1x
1. | 181 // Don't go into compositing mode if height or width are zero, or size is 1x
1. |
182 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 182 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
183 return contentBox.height() * contentBox.width() > 1; | 183 return contentBox.height() * contentBox.width() > 1; |
184 } | 184 } |
185 | 185 |
186 bool CompositingReasonFinder::requiresCompositingForFrame(RenderObject* renderer
, bool* needToRecomputeCompositingRequirements) const | 186 bool CompositingReasonFinder::requiresCompositingForFrame(RenderObject* renderer
) const |
187 { | 187 { |
188 if (!renderer->isRenderPart()) | 188 return renderer->isRenderPart() && toRenderPart(renderer)->requiresAccelerat
edCompositing(); |
189 return false; | |
190 | |
191 RenderPart* frameRenderer = toRenderPart(renderer); | |
192 | |
193 if (!frameRenderer->requiresAcceleratedCompositing()) | |
194 return false; | |
195 | |
196 if (frameRenderer->node() && frameRenderer->node()->isFrameOwnerElement() &&
toHTMLFrameOwnerElement(frameRenderer->node())->contentFrame() && toHTMLFrameOw
nerElement(frameRenderer->node())->contentFrame()->remotePlatformLayer()) | |
197 return true; | |
198 | |
199 // FIXME: this seems bogus. If we don't know the layout position/size of the
frame yet, wouldn't that be handled elsehwere? | |
200 *needToRecomputeCompositingRequirements = true; | |
201 | |
202 RenderLayerCompositor* innerCompositor = RenderLayerCompositor::frameContent
sCompositor(frameRenderer); | |
203 if (!innerCompositor) | |
204 return false; | |
205 | |
206 // If we can't reliably know the size of the iframe yet, don't change compos
iting state. | |
207 if (renderer->needsLayout()) | |
208 return frameRenderer->hasLayer() && frameRenderer->layer()->hasComposite
dLayerMapping(); | |
209 | |
210 // Don't go into compositing mode if height or width are zero. | |
211 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); | |
212 return contentBox.height() * contentBox.width() > 0; | |
213 } | 189 } |
214 | 190 |
215 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren
derObject* renderer) const | 191 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren
derObject* renderer) const |
216 { | 192 { |
217 if (!(m_compositingTriggers & ChromeClient::ThreeDTransformTrigger)) | 193 if (!(m_compositingTriggers & ChromeClient::ThreeDTransformTrigger)) |
218 return false; | 194 return false; |
219 | 195 |
220 return renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden; | 196 return renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden; |
221 } | 197 } |
222 | 198 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 368 |
393 return true; | 369 return true; |
394 } | 370 } |
395 | 371 |
396 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const | 372 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const |
397 { | 373 { |
398 return layer->needsCompositedScrolling(); | 374 return layer->needsCompositedScrolling(); |
399 } | 375 } |
400 | 376 |
401 } | 377 } |
OLD | NEW |