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

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

Issue 2692853016: Change PaintLayer::m_layoutObject to a reference. (Closed)
Patch Set: Added TODO Created 3 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 if (layer->shouldIsolateCompositedDescendants()) { 181 if (layer->shouldIsolateCompositedDescendants()) {
182 DCHECK(layer->stackingNode()->isStackingContext()); 182 DCHECK(layer->stackingNode()->isStackingContext());
183 subtreeReasons |= CompositingReasonIsolateCompositedDescendants; 183 subtreeReasons |= CompositingReasonIsolateCompositedDescendants;
184 } 184 }
185 185
186 // FIXME: This should move into 186 // FIXME: This should move into
187 // CompositingReasonFinder::potentialCompositingReasonsFromStyle, but theres 187 // CompositingReasonFinder::potentialCompositingReasonsFromStyle, but theres
188 // a poor interaction with LayoutTextControlSingleLine, which sets this 188 // a poor interaction with LayoutTextControlSingleLine, which sets this
189 // hasOverflowClip directly. 189 // hasOverflowClip directly.
190 if (layer->layoutObject()->hasClipRelatedProperty()) 190 if (layer->layoutObject().hasClipRelatedProperty())
191 subtreeReasons |= CompositingReasonClipsCompositingDescendants; 191 subtreeReasons |= CompositingReasonClipsCompositingDescendants;
192 192
193 if (layer->layoutObject()->style()->position() == EPosition::kFixed) 193 if (layer->layoutObject().style()->position() == EPosition::kFixed)
194 subtreeReasons |= CompositingReasonPositionFixedWithCompositedDescendants; 194 subtreeReasons |= CompositingReasonPositionFixedWithCompositedDescendants;
195 } 195 }
196 196
197 // A layer with preserve-3d or perspective only needs to be composited if 197 // A layer with preserve-3d or perspective only needs to be composited if
198 // there are descendant layers that will be affected by the preserve-3d or 198 // there are descendant layers that will be affected by the preserve-3d or
199 // perspective. 199 // perspective.
200 if (has3DTransformedDescendants) { 200 if (has3DTransformedDescendants) {
201 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & 201 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() &
202 CompositingReasonCombo3DDescendants; 202 CompositingReasonCombo3DDescendants;
203 } 203 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 CompositingReasons reasonsToComposite = CompositingReasonNone; 249 CompositingReasons reasonsToComposite = CompositingReasonNone;
250 CompositingReasons directReasons = 250 CompositingReasons directReasons =
251 m_compositingReasonFinder.directReasons(layer); 251 m_compositingReasonFinder.directReasons(layer);
252 252
253 // Video is special. It's the only PaintLayer type that can both have 253 // Video is special. It's the only PaintLayer type that can both have
254 // PaintLayer children and whose children can't use its backing to render 254 // PaintLayer children and whose children can't use its backing to render
255 // into. These children (the controls) always need to be promoted into their 255 // into. These children (the controls) always need to be promoted into their
256 // own layers to draw on top of the accelerated video. 256 // own layers to draw on top of the accelerated video.
257 if (currentRecursionData.m_compositingAncestor && 257 if (currentRecursionData.m_compositingAncestor &&
258 currentRecursionData.m_compositingAncestor->layoutObject()->isVideo()) 258 currentRecursionData.m_compositingAncestor->layoutObject().isVideo())
259 directReasons |= CompositingReasonVideoOverlay; 259 directReasons |= CompositingReasonVideoOverlay;
260 260
261 bool hasCompositedScrollingAncestor = 261 bool hasCompositedScrollingAncestor =
262 layer->ancestorScrollingLayer() && 262 layer->ancestorScrollingLayer() &&
263 (m_compositingReasonFinder.directReasons( 263 (m_compositingReasonFinder.directReasons(
264 layer->ancestorScrollingLayer()) & 264 layer->ancestorScrollingLayer()) &
265 CompositingReasonOverflowScrollingTouch); 265 CompositingReasonOverflowScrollingTouch);
266 266
267 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead. 267 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead.
268 if (currentRecursionData.m_hasCompositedScrollingAncestor && 268 if (currentRecursionData.m_hasCompositedScrollingAncestor &&
269 layer->layoutObject()->styleRef().hasViewportConstrainedPosition()) 269 layer->layoutObject().styleRef().hasViewportConstrainedPosition())
270 directReasons |= CompositingReasonScrollDependentPosition; 270 directReasons |= CompositingReasonScrollDependentPosition;
271 271
272 bool canBeComposited = compositor->canBeComposited(layer); 272 bool canBeComposited = compositor->canBeComposited(layer);
273 if (canBeComposited) { 273 if (canBeComposited) {
274 reasonsToComposite |= directReasons; 274 reasonsToComposite |= directReasons;
275 275
276 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) 276 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite())
277 reasonsToComposite |= CompositingReasonRoot; 277 reasonsToComposite |= CompositingReasonRoot;
278 278
279 // Add CompositingReasonOverflowScrollingTouch for layers that do not 279 // Add CompositingReasonOverflowScrollingTouch for layers that do not
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead. 313 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead.
314 if (currentRecursionData.m_hasCompositedScrollingAncestor) { 314 if (currentRecursionData.m_hasCompositedScrollingAncestor) {
315 Vector<size_t> unclippedDescendantsToRemove; 315 Vector<size_t> unclippedDescendantsToRemove;
316 for (size_t i = 0; i < unclippedDescendants.size(); i++) { 316 for (size_t i = 0; i < unclippedDescendants.size(); i++) {
317 PaintLayer* unclippedDescendant = unclippedDescendants.at(i); 317 PaintLayer* unclippedDescendant = unclippedDescendants.at(i);
318 // If we've reached the containing block of one of the unclipped 318 // If we've reached the containing block of one of the unclipped
319 // descendants, that element is no longer relevant to whether or not we 319 // descendants, that element is no longer relevant to whether or not we
320 // should opt in. Unfortunately we can't easily remove from the list 320 // should opt in. Unfortunately we can't easily remove from the list
321 // while we're iterating, so we have to store it for later removal. 321 // while we're iterating, so we have to store it for later removal.
322 if (unclippedDescendant->layoutObject()->containingBlock() == 322 if (unclippedDescendant->layoutObject().containingBlock() ==
323 layer->layoutObject()) { 323 &layer->layoutObject()) {
324 unclippedDescendantsToRemove.push_back(i); 324 unclippedDescendantsToRemove.push_back(i);
325 continue; 325 continue;
326 } 326 }
327 if (layer->scrollsWithRespectTo(unclippedDescendant)) 327 if (layer->scrollsWithRespectTo(unclippedDescendant))
328 reasonsToComposite |= CompositingReasonAssumedOverlap; 328 reasonsToComposite |= CompositingReasonAssumedOverlap;
329 } 329 }
330 330
331 // Remove irrelevant unclipped descendants in reverse order so our stored 331 // Remove irrelevant unclipped descendants in reverse order so our stored
332 // indices remain valid. 332 // indices remain valid.
333 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) { 333 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 !hasCompositedScrollingAncestor); 503 !hasCompositedScrollingAncestor);
504 willBeCompositedOrSquashed = true; 504 willBeCompositedOrSquashed = true;
505 } 505 }
506 506
507 if (willBeCompositedOrSquashed) { 507 if (willBeCompositedOrSquashed) {
508 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & 508 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() &
509 CompositingReasonInlineTransform; 509 CompositingReasonInlineTransform;
510 } 510 }
511 511
512 if (willBeCompositedOrSquashed && 512 if (willBeCompositedOrSquashed &&
513 layer->layoutObject()->style()->hasBlendMode()) 513 layer->layoutObject().style()->hasBlendMode())
514 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; 514 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true;
515 515
516 // Tell the parent it has compositing descendants. 516 // Tell the parent it has compositing descendants.
517 if (willBeCompositedOrSquashed) 517 if (willBeCompositedOrSquashed)
518 currentRecursionData.m_subtreeIsCompositing = true; 518 currentRecursionData.m_subtreeIsCompositing = true;
519 519
520 // Turn overlap testing off for later layers if it's already off, or if we 520 // Turn overlap testing off for later layers if it's already off, or if we
521 // have an animating transform. Note that if the layer clips its 521 // have an animating transform. Note that if the layer clips its
522 // descendants, there's no reason to propagate the child animation to the 522 // descendants, there's no reason to propagate the child animation to the
523 // parent layers. That's because we know for sure the animation is contained 523 // parent layers. That's because we know for sure the animation is contained
524 // inside the clipping rectangle, which is already added to the overlap map. 524 // inside the clipping rectangle, which is already added to the overlap map.
525 bool isCompositedClippingLayer = 525 bool isCompositedClippingLayer =
526 canBeComposited && 526 canBeComposited &&
527 (reasonsToComposite & CompositingReasonClipsCompositingDescendants); 527 (reasonsToComposite & CompositingReasonClipsCompositingDescendants);
528 bool isCompositedWithInlineTransform = 528 bool isCompositedWithInlineTransform =
529 reasonsToComposite & CompositingReasonInlineTransform; 529 reasonsToComposite & CompositingReasonInlineTransform;
530 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || 530 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) ||
531 layer->layoutObject()->style()->hasCurrentTransformAnimation() || 531 layer->layoutObject().style()->hasCurrentTransformAnimation() ||
532 isCompositedWithInlineTransform) 532 isCompositedWithInlineTransform)
533 currentRecursionData.m_testingOverlap = false; 533 currentRecursionData.m_testingOverlap = false;
534 534
535 if (childRecursionData.m_compositingAncestor == layer) 535 if (childRecursionData.m_compositingAncestor == layer)
536 overlapMap.finishCurrentOverlapTestingContext(); 536 overlapMap.finishCurrentOverlapTestingContext();
537 537
538 descendantHas3DTransform |= 538 descendantHas3DTransform |=
539 anyDescendantHas3DTransform || layer->has3DTransform(); 539 anyDescendantHas3DTransform || layer->has3DTransform();
540 } 540 }
541 541
542 // At this point we have finished collecting all reasons to composite this 542 // At this point we have finished collecting all reasons to composite this
543 // layer. 543 // layer.
544 layer->setCompositingReasons(reasonsToComposite); 544 layer->setCompositingReasons(reasonsToComposite);
545 } 545 }
546 546
547 } // namespace blink 547 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698