Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: Source/core/rendering/compositing/CompositingReasonFinder.cpp

Issue 202523008: Simplify CompositingReasonFinder::requiresCompositingForPlugin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix bad merge Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/compositing/CompositingReasonFinder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 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. 71 // FIXME: These should be handled by overrides of RenderObject::additionalCo mpositingReasons.
72 if (requiresCompositingForPlugin(renderer, needToRecomputeCompositingRequire ments)) 72 if (requiresCompositingForPlugin(renderer))
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
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 { 124 {
125 if (!(m_compositingTriggers & ThreeDTransformTrigger)) 125 if (!(m_compositingTriggers & ThreeDTransformTrigger))
126 return false; 126 return false;
127 127
128 RenderStyle* style = renderer->style(); 128 RenderStyle* style = renderer->style();
129 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, 129 // 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. 130 // but the renderer may be an inline that doesn't suppport them.
131 return renderer->hasTransform() && style->transform().has3DOperation(); 131 return renderer->hasTransform() && style->transform().has3DOperation();
132 } 132 }
133 133
134 bool CompositingReasonFinder::requiresCompositingForPlugin(RenderObject* rendere r, bool* needToRecomputeCompositingRequirements) const 134 bool CompositingReasonFinder::requiresCompositingForPlugin(RenderObject* rendere r) const
135 { 135 {
136 if (!(m_compositingTriggers & PluginTrigger)) 136 if (!(m_compositingTriggers & PluginTrigger))
137 return false; 137 return false;
138 138
139 if (!renderer->isEmbeddedObject() || !toRenderEmbeddedObject(renderer)->allo wsAcceleratedCompositing()) 139 return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->req uiresAcceleratedCompositing();
140 return false;
141
142 // FIXME: this seems bogus. If we don't know the layout position/size of the plugin yet, would't that be handled elsewhere?
143 *needToRecomputeCompositingRequirements = true;
144
145 RenderWidget* pluginRenderer = toRenderWidget(renderer);
146 // If we can't reliably know the size of the plugin yet, don't change compos iting state.
147 if (pluginRenderer->needsLayout())
148 return pluginRenderer->hasLayer() && pluginRenderer->layer()->hasComposi tedLayerMapping();
149
150 // Don't go into compositing mode if height or width are zero, or size is 1x 1.
151 IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect());
152 return contentBox.height() * contentBox.width() > 1;
153 } 140 }
154 141
155 bool CompositingReasonFinder::requiresCompositingForFrame(RenderObject* renderer ) const 142 bool CompositingReasonFinder::requiresCompositingForFrame(RenderObject* renderer ) const
156 { 143 {
157 return renderer->isRenderPart() && toRenderPart(renderer)->requiresAccelerat edCompositing(); 144 return renderer->isRenderPart() && toRenderPart(renderer)->requiresAccelerat edCompositing();
158 } 145 }
159 146
160 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren derObject* renderer) const 147 bool CompositingReasonFinder::requiresCompositingForBackfaceVisibilityHidden(Ren derObject* renderer) const
161 { 148 {
162 if (!(m_compositingTriggers & ThreeDTransformTrigger)) 149 if (!(m_compositingTriggers & ThreeDTransformTrigger))
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 324
338 return true; 325 return true;
339 } 326 }
340 327
341 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend erLayer* layer) const 328 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend erLayer* layer) const
342 { 329 {
343 return layer->needsCompositedScrolling(); 330 return layer->needsCompositedScrolling();
344 } 331 }
345 332
346 } 333 }
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/CompositingReasonFinder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698