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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp

Issue 1649853002: Minor typo/whitespace cleanup in compositing code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // FIXME: we could maybe do this and the hierarchy update in one pass, but t he parenting logic would be more complex. 198 // FIXME: we could maybe do this and the hierarchy update in one pass, but t he parenting logic would be more complex.
199 RecursionData recursionData(root); 199 RecursionData recursionData(root);
200 OverlapMap overlapTestRequestMap; 200 OverlapMap overlapTestRequestMap;
201 bool saw3DTransform = false; 201 bool saw3DTransform = false;
202 202
203 // FIXME: Passing these unclippedDescendants down and keeping track 203 // FIXME: Passing these unclippedDescendants down and keeping track
204 // of them dynamically, we are requiring a full tree walk. This 204 // of them dynamically, we are requiring a full tree walk. This
205 // should be removed as soon as proper overlap testing based on 205 // should be removed as soon as proper overlap testing based on
206 // scrolling and animation bounds is implemented (crbug.com/252472). 206 // scrolling and animation bounds is implemented (crbug.com/252472).
207 Vector<PaintLayer*> unclippedDescendants; 207 Vector<PaintLayer*> unclippedDescendants;
208 IntRect absoluteDecendantBoundingBox; 208 IntRect absoluteDescendantBoundingBox;
209 updateRecursive(0, root, overlapTestRequestMap, recursionData, saw3DTransfor m, unclippedDescendants, absoluteDecendantBoundingBox); 209 updateRecursive(0, root, overlapTestRequestMap, recursionData, saw3DTransfor m, unclippedDescendants, absoluteDescendantBoundingBox);
210 } 210 }
211 211
212 void CompositingRequirementsUpdater::updateRecursive(PaintLayer* ancestorLayer, PaintLayer* layer, OverlapMap& overlapMap, RecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<PaintLayer*>& unclippedDescendants, IntRe ct& absoluteDecendantBoundingBox) 212 void CompositingRequirementsUpdater::updateRecursive(PaintLayer* ancestorLayer, PaintLayer* layer, OverlapMap& overlapMap, RecursionData& currentRecursionData,
213 bool& descendantHas3DTransform, Vector<PaintLayer*>& unclippedDescendants, I ntRect& absoluteDescendantBoundingBox)
213 { 214 {
214 PaintLayerCompositor* compositor = m_layoutView.compositor(); 215 PaintLayerCompositor* compositor = m_layoutView.compositor();
215 216
216 layer->stackingNode()->updateLayerListsIfNeeded(); 217 layer->stackingNode()->updateLayerListsIfNeeded();
217 218
218 CompositingReasons reasonsToComposite = CompositingReasonNone; 219 CompositingReasons reasonsToComposite = CompositingReasonNone;
219 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer); 220 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer);
220 221
221 // Video is special. It's the only PaintLayer type that can both have 222 // Video is special. It's the only PaintLayer type that can both have
222 // PaintLayer children and whose children can't use its backing to render 223 // PaintLayer children and whose children can't use its backing to render
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Remove irrelevant unclipped descendants in reverse order so our store d 281 // Remove irrelevant unclipped descendants in reverse order so our store d
281 // indices remain valid. 282 // indices remain valid.
282 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) 283 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++)
283 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1)); 284 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1));
284 285
285 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) 286 if (reasonsToComposite & CompositingReasonOutOfFlowClipping)
286 unclippedDescendants.append(layer); 287 unclippedDescendants.append(layer);
287 } 288 }
288 289
289 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox(); 290 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox();
290 absoluteDecendantBoundingBox = absBounds; 291 absoluteDescendantBoundingBox = absBounds;
291 292
292 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) 293 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons))
293 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; 294 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone;
294 295
295 reasonsToComposite |= overlapCompositingReason; 296 reasonsToComposite |= overlapCompositingReason;
296 297
297 // The children of this layer don't need to composite, unless there is 298 // The children of this layer don't need to composite, unless there is
298 // a compositing layer among them, so start by inheriting the compositing 299 // a compositing layer among them, so start by inheriting the compositing
299 // ancestor with m_subtreeIsCompositing set to false. 300 // ancestor with m_subtreeIsCompositing set to false.
300 RecursionData childRecursionData = currentRecursionData; 301 RecursionData childRecursionData = currentRecursionData;
(...skipping 16 matching lines...) Expand all
317 #if ENABLE(ASSERT) 318 #if ENABLE(ASSERT)
318 LayerListMutationDetector mutationChecker(layer->stackingNode()); 319 LayerListMutationDetector mutationChecker(layer->stackingNode());
319 #endif 320 #endif
320 321
321 bool anyDescendantHas3DTransform = false; 322 bool anyDescendantHas3DTransform = false;
322 bool willHaveForegroundLayer = false; 323 bool willHaveForegroundLayer = false;
323 324
324 if (layer->stackingNode()->isStackingContext()) { 325 if (layer->stackingNode()->isStackingContext()) {
325 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), Negative ZOrderChildren); 326 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), Negative ZOrderChildren);
326 while (PaintLayerStackingNode* curNode = iterator.next()) { 327 while (PaintLayerStackingNode* curNode = iterator.next()) {
327 IntRect absoluteChildDecendantBoundingBox; 328 IntRect absoluteChildDescendantBoundingBox;
328 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionD ata, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBo undingBox); 329 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionD ata, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDescendantB oundingBox);
329 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox ); 330 absoluteDescendantBoundingBox.unite(absoluteChildDescendantBoundingB ox);
330 331
331 // If we have to make a layer for this child, make one now so we can have a contents layer 332 // If we have to make a layer for this child, make one now so we can have a contents layer
332 // (since we need to ensure that the -ve z-order child renders under neath our contents). 333 // (since we need to ensure that the -ve z-order child renders under neath our contents).
333 if (childRecursionData.m_subtreeIsCompositing) { 334 if (childRecursionData.m_subtreeIsCompositing) {
334 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; 335 reasonsToComposite |= CompositingReasonNegativeZIndexChildren;
335 336
336 if (!willBeCompositedOrSquashed) { 337 if (!willBeCompositedOrSquashed) {
337 // make layer compositing 338 // make layer compositing
338 childRecursionData.m_compositingAncestor = layer; 339 childRecursionData.m_compositingAncestor = layer;
339 overlapMap.beginNewOverlapTestingContext(); 340 overlapMap.beginNewOverlapTestingContext();
(...skipping 19 matching lines...) Expand all
359 // children, and start with a fresh new empty context. 360 // children, and start with a fresh new empty context.
360 overlapMap.finishCurrentOverlapTestingContext(); 361 overlapMap.finishCurrentOverlapTestingContext();
361 overlapMap.beginNewOverlapTestingContext(); 362 overlapMap.beginNewOverlapTestingContext();
362 // This layer is going to be composited, so children can safely ignore t he fact that there's an 363 // This layer is going to be composited, so children can safely ignore t he fact that there's an
363 // animation running behind this layer, meaning they can rely on the ove rlap map testing again 364 // animation running behind this layer, meaning they can rely on the ove rlap map testing again
364 childRecursionData.m_testingOverlap = true; 365 childRecursionData.m_testingOverlap = true;
365 } 366 }
366 367
367 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowCh ildren | PositiveZOrderChildren); 368 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowCh ildren | PositiveZOrderChildren);
368 while (PaintLayerStackingNode* curNode = iterator.next()) { 369 while (PaintLayerStackingNode* curNode = iterator.next()) {
369 IntRect absoluteChildDecendantBoundingBox; 370 IntRect absoluteChildDescendantBoundingBox;
370 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBoundi ngBox); 371 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDescendantBound ingBox);
371 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox); 372 absoluteDescendantBoundingBox.unite(absoluteChildDescendantBoundingBox);
372 } 373 }
373 374
374 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree. 375 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree.
375 376
376 if (layer->stackingNode()->isStackingContext()) { 377 if (layer->stackingNode()->isStackingContext()) {
377 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant); 378 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant);
378 } else { 379 } else {
379 layer->setShouldIsolateCompositedDescendants(false); 380 layer->setShouldIsolateCompositedDescendants(false);
380 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child RecursionData.m_hasUnisolatedCompositedBlendingDescendant; 381 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child RecursionData.m_hasUnisolatedCompositedBlendingDescendant;
381 } 382 }
(...skipping 24 matching lines...) Expand all
406 407
407 // Now check for reasons to become composited that depend on the state o f descendant layers. 408 // Now check for reasons to become composited that depend on the state o f descendant layers.
408 CompositingReasons subtreeCompositingReasons = subtreeReasonsForComposit ing(layer, childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransfor m); 409 CompositingReasons subtreeCompositingReasons = subtreeReasonsForComposit ing(layer, childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransfor m);
409 reasonsToComposite |= subtreeCompositingReasons; 410 reasonsToComposite |= subtreeCompositingReasons;
410 if (!willBeCompositedOrSquashed && canBeComposited && requiresCompositin gOrSquashing(subtreeCompositingReasons)) { 411 if (!willBeCompositedOrSquashed && canBeComposited && requiresCompositin gOrSquashing(subtreeCompositingReasons)) {
411 childRecursionData.m_compositingAncestor = layer; 412 childRecursionData.m_compositingAncestor = layer;
412 // FIXME: this context push is effectively a no-op but needs to exis t for 413 // FIXME: this context push is effectively a no-op but needs to exis t for
413 // now, because the code is designed to push overlap information to the 414 // now, because the code is designed to push overlap information to the
414 // second-from-top context of the stack. 415 // second-from-top context of the stack.
415 overlapMap.beginNewOverlapTestingContext(); 416 overlapMap.beginNewOverlapTestingContext();
416 overlapMap.add(layer, absoluteDecendantBoundingBox); 417 overlapMap.add(layer, absoluteDescendantBoundingBox);
417 willBeCompositedOrSquashed = true; 418 willBeCompositedOrSquashed = true;
418 } 419 }
419 420
420 if (willBeCompositedOrSquashed) 421 if (willBeCompositedOrSquashed)
421 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & CompositingReasonInlineTransform; 422 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & CompositingReasonInlineTransform;
422 423
423 // If the original layer is composited, the reflection needs to be, too. 424 // If the original layer is composited, the reflection needs to be, too.
424 if (layer->reflectionInfo()) { 425 if (layer->reflectionInfo()) {
425 // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another layoutObject? 426 // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another layoutObject?
426 PaintLayer* reflectionLayer = layer->reflectionInfo()->reflectionLay er(); 427 PaintLayer* reflectionLayer = layer->reflectionInfo()->reflectionLay er();
(...skipping 17 matching lines...) Expand all
444 currentRecursionData.m_testingOverlap = false; 445 currentRecursionData.m_testingOverlap = false;
445 446
446 if (childRecursionData.m_compositingAncestor == layer) 447 if (childRecursionData.m_compositingAncestor == layer)
447 overlapMap.finishCurrentOverlapTestingContext(); 448 overlapMap.finishCurrentOverlapTestingContext();
448 449
449 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); 450 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform();
450 } 451 }
451 452
452 // At this point we have finished collecting all reasons to composite this l ayer. 453 // At this point we have finished collecting all reasons to composite this l ayer.
453 layer->setCompositingReasons(reasonsToComposite); 454 layer->setCompositingReasons(reasonsToComposite);
454
455 } 455 }
456 456
457 } // namespace blink 457 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698