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

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

Issue 270383002: Remove will-change: contents GPU rasterization hint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Google Inc. All rights reserved. 3 * Copyright (C) 2014 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 Vector<OverlapMapContainer> m_overlapStack; 156 Vector<OverlapMapContainer> m_overlapStack;
157 }; 157 };
158 158
159 class CompositingRequirementsUpdater::RecursionData { 159 class CompositingRequirementsUpdater::RecursionData {
160 public: 160 public:
161 RecursionData(RenderLayer* compAncestor, bool testOverlap) 161 RecursionData(RenderLayer* compAncestor, bool testOverlap)
162 : m_compositingAncestor(compAncestor) 162 : m_compositingAncestor(compAncestor)
163 , m_subtreeIsCompositing(false) 163 , m_subtreeIsCompositing(false)
164 , m_hasUnisolatedCompositedBlendingDescendant(false) 164 , m_hasUnisolatedCompositedBlendingDescendant(false)
165 , m_testingOverlap(testOverlap) 165 , m_testingOverlap(testOverlap)
166 , m_suppressLayerCreation(false)
167 #ifndef NDEBUG 166 #ifndef NDEBUG
168 , m_depth(0) 167 , m_depth(0)
169 #endif 168 #endif
170 { 169 {
171 } 170 }
172 171
173 RecursionData(const RecursionData& other) 172 RecursionData(const RecursionData& other)
174 : m_compositingAncestor(other.m_compositingAncestor) 173 : m_compositingAncestor(other.m_compositingAncestor)
175 , m_subtreeIsCompositing(other.m_subtreeIsCompositing) 174 , m_subtreeIsCompositing(other.m_subtreeIsCompositing)
176 , m_hasUnisolatedCompositedBlendingDescendant(other.m_hasUnisolatedCompo sitedBlendingDescendant) 175 , m_hasUnisolatedCompositedBlendingDescendant(other.m_hasUnisolatedCompo sitedBlendingDescendant)
177 , m_testingOverlap(other.m_testingOverlap) 176 , m_testingOverlap(other.m_testingOverlap)
178 , m_suppressLayerCreation(other.m_suppressLayerCreation)
179 #ifndef NDEBUG 177 #ifndef NDEBUG
180 , m_depth(other.m_depth + 1) 178 , m_depth(other.m_depth + 1)
181 #endif 179 #endif
182 { 180 {
183 } 181 }
184 182
185 RenderLayer* m_compositingAncestor; 183 RenderLayer* m_compositingAncestor;
186 bool m_subtreeIsCompositing; 184 bool m_subtreeIsCompositing;
187 bool m_hasUnisolatedCompositedBlendingDescendant; 185 bool m_hasUnisolatedCompositedBlendingDescendant;
188 bool m_testingOverlap; 186 bool m_testingOverlap;
189 bool m_suppressLayerCreation;
190 #ifndef NDEBUG 187 #ifndef NDEBUG
191 int m_depth; 188 int m_depth;
192 #endif 189 #endif
193 }; 190 };
194 191
195 static bool requiresCompositingOrSquashing(CompositingReasons reasons) 192 static bool requiresCompositingOrSquashing(CompositingReasons reasons)
196 { 193 {
197 #ifndef NDEBUG 194 #ifndef NDEBUG
198 bool fastAnswer = reasons != CompositingReasonNone; 195 bool fastAnswer = reasons != CompositingReasonNone;
199 bool slowAnswer = requiresCompositing(reasons) || requiresSquashing(reasons) ; 196 bool slowAnswer = requiresCompositing(reasons) || requiresSquashing(reasons) ;
200 ASSERT(fastAnswer == slowAnswer); 197 ASSERT(fastAnswer == slowAnswer);
201 #endif 198 #endif
202 return reasons != CompositingReasonNone; 199 return reasons != CompositingReasonNone;
203 } 200 }
204 201
205 static bool shouldMakeDescendantsSuppressCompositedLayerCreation(CompositingReas ons reasons)
206 {
207 return reasons & CompositingReasonWillChangeGpuRasterizationHint;
208 }
209
210 static CompositingReasons subtreeReasonsForCompositing(RenderObject* renderer, b ool hasCompositedDescendants, bool has3DTransformedDescendants) 202 static CompositingReasons subtreeReasonsForCompositing(RenderObject* renderer, b ool hasCompositedDescendants, bool has3DTransformedDescendants)
211 { 203 {
212 CompositingReasons subtreeReasons = CompositingReasonNone; 204 CompositingReasons subtreeReasons = CompositingReasonNone;
213 205
214 // FIXME: this seems to be a potentially different layer than the layer for which this was called. May not be an error, but is very confusing. 206 // FIXME: this seems to be a potentially different layer than the layer for which this was called. May not be an error, but is very confusing.
215 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); 207 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
216 208
217 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented 209 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented
218 // via compositing so that they also apply to those composited descdendants. 210 // via compositing so that they also apply to those composited descdendants.
219 if (hasCompositedDescendants) { 211 if (hasCompositedDescendants) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 layer->stackingNode()->updateLayerListsIfNeeded(); 284 layer->stackingNode()->updateLayerListsIfNeeded();
293 285
294 // Clear the flag 286 // Clear the flag
295 layer->setHasCompositingDescendant(false); 287 layer->setHasCompositingDescendant(false);
296 288
297 // Start by assuming this layer will not need to composite. 289 // Start by assuming this layer will not need to composite.
298 CompositingReasons reasonsToComposite = CompositingReasonNone; 290 CompositingReasons reasonsToComposite = CompositingReasonNone;
299 291
300 // First accumulate the straightforward compositing reasons. 292 // First accumulate the straightforward compositing reasons.
301 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer); 293 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer);
302 layer->setSuppressingCompositedLayerCreation(currentRecursionData.m_suppress LayerCreation);
303 if (layer->suppressingCompositedLayerCreation())
304 directReasons = m_compositingReasonFinder.suppressWillChangeAndAnimation ForGpuRasterization(layer, directReasons);
305 294
306 // Video is special. It's the only RenderLayer type that can both have 295 // Video is special. It's the only RenderLayer type that can both have
307 // RenderLayer children and whose children can't use its backing to render 296 // RenderLayer children and whose children can't use its backing to render
308 // into. These children (the controls) always need to be promoted into their 297 // into. These children (the controls) always need to be promoted into their
309 // own layers to draw on top of the accelerated video. 298 // own layers to draw on top of the accelerated video.
310 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com positingAncestor->renderer()->isVideo()) 299 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com positingAncestor->renderer()->isVideo())
311 directReasons |= CompositingReasonVideoOverlay; 300 directReasons |= CompositingReasonVideoOverlay;
312 301
313 if (compositor->canBeComposited(layer)) 302 if (compositor->canBeComposited(layer))
314 reasonsToComposite |= directReasons; 303 reasonsToComposite |= directReasons;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) 338 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons))
350 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; 339 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone;
351 340
352 reasonsToComposite |= overlapCompositingReason; 341 reasonsToComposite |= overlapCompositingReason;
353 342
354 // The children of this layer don't need to composite, unless there is 343 // The children of this layer don't need to composite, unless there is
355 // a compositing layer among them, so start by inheriting the compositing 344 // a compositing layer among them, so start by inheriting the compositing
356 // ancestor with m_subtreeIsCompositing set to false. 345 // ancestor with m_subtreeIsCompositing set to false.
357 RecursionData childRecursionData(currentRecursionData); 346 RecursionData childRecursionData(currentRecursionData);
358 childRecursionData.m_subtreeIsCompositing = false; 347 childRecursionData.m_subtreeIsCompositing = false;
359 childRecursionData.m_suppressLayerCreation = layer->suppressingCompositedLay erCreation() || shouldMakeDescendantsSuppressCompositedLayerCreation(directReaso ns);
360 348
361 bool willBeCompositedOrSquashed = compositor->canBeComposited(layer) && requ iresCompositingOrSquashing(reasonsToComposite); 349 bool willBeCompositedOrSquashed = compositor->canBeComposited(layer) && requ iresCompositingOrSquashing(reasonsToComposite);
362 if (willBeCompositedOrSquashed) { 350 if (willBeCompositedOrSquashed) {
363 // Tell the parent it has compositing descendants. 351 // Tell the parent it has compositing descendants.
364 currentRecursionData.m_subtreeIsCompositing = true; 352 currentRecursionData.m_subtreeIsCompositing = true;
365 // This layer now acts as the ancestor for kids. 353 // This layer now acts as the ancestor for kids.
366 childRecursionData.m_compositingAncestor = layer; 354 childRecursionData.m_compositingAncestor = layer;
367 355
368 // Here we know that all children and the layer's own contents can blind ly paint into 356 // Here we know that all children and the layer's own contents can blind ly paint into
369 // this layer's backing, until a descendant is composited. So, we don't need to check 357 // this layer's backing, until a descendant is composited. So, we don't need to check
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 layer->setCompositingReasons(reasonsToComposite); 492 layer->setCompositingReasons(reasonsToComposite);
505 493
506 } 494 }
507 495
508 bool CompositingRequirementsUpdater::isRunningAcceleratedTransformAnimation(Rend erObject* renderer) const 496 bool CompositingRequirementsUpdater::isRunningAcceleratedTransformAnimation(Rend erObject* renderer) const
509 { 497 {
510 return renderer->style()->hasCurrentTransformAnimation(); 498 return renderer->style()->hasCurrentTransformAnimation();
511 } 499 }
512 500
513 } // namespace WebCore 501 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698