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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2667373002: Ensure PaintArtifactCompositor assigns a scroll tree index to all cc layers (Closed)
Patch Set: 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // a self-painting descendant in this case, there is no need to dirty our 321 // a self-painting descendant in this case, there is no need to dirty our
322 // ancestors further. 322 // ancestors further.
323 if (layer->isSelfPaintingLayer()) { 323 if (layer->isSelfPaintingLayer()) {
324 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || 324 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty ||
325 parent()->m_hasSelfPaintingLayerDescendant); 325 parent()->m_hasSelfPaintingLayerDescendant);
326 break; 326 break;
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 static const ScrollPaintPropertyNode* nearestScrollNode(
332 const TransformPaintPropertyNode* transform) {
333 if (const auto* scrollNode = transform->scrollNode())
334 return scrollNode;
335 for (const auto* ancestor = transform->parent(); ancestor;
336 ancestor = ancestor->parent()) {
337 if (const auto* scrollNode = ancestor->scrollNode())
338 return scrollNode;
339 }
340 // The root transform node references the root scroll node so a scroll node
341 // should always exist.
342 NOTREACHED();
343 return nullptr;
344 }
345
346 bool PaintLayer::sticksToViewport() const { 331 bool PaintLayer::sticksToViewport() const {
347 if (layoutObject()->style()->position() != FixedPosition && 332 if (layoutObject()->style()->position() != FixedPosition &&
348 layoutObject()->style()->position() != StickyPosition) 333 layoutObject()->style()->position() != StickyPosition)
349 return false; 334 return false;
350 335
351 // TODO(pdr): This approach of calculating the nearest scroll node is O(n). 336 // TODO(pdr): This approach of calculating the nearest scroll node is O(n).
352 // An option for improving this is to cache the nearest scroll node in 337 // An option for improving this is to cache the nearest scroll node in
353 // the local border box properties. 338 // the local border box properties.
354 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 339 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
340 const auto* viewProperties = layoutObject()->view()->paintProperties();
355 const ScrollPaintPropertyNode* ancestorTargetScrollNode; 341 const ScrollPaintPropertyNode* ancestorTargetScrollNode;
356 if (layoutObject()->style()->position() == FixedPosition) { 342 if (layoutObject()->style()->position() == FixedPosition) {
357 ancestorTargetScrollNode = 343 ancestorTargetScrollNode = viewProperties->localBorderBoxProperties()
358 nearestScrollNode(layoutObject() 344 ->transform()
359 ->view() 345 ->findEnclosingScrollNode();
360 ->paintProperties()
361 ->localBorderBoxProperties()
362 ->transform());
363 } else { 346 } else {
364 ancestorTargetScrollNode = nearestScrollNode(layoutObject() 347 ancestorTargetScrollNode = viewProperties->contentsProperties()
365 ->view() 348 ->transform()
366 ->paintProperties() 349 ->findEnclosingScrollNode();
367 ->contentsProperties()
368 ->transform());
369 } 350 }
370 351
371 return nearestScrollNode(layoutObject() 352 const auto* properties = layoutObject()->paintProperties();
372 ->paintProperties() 353 const auto* transform = properties->localBorderBoxProperties()->transform();
373 ->localBorderBoxProperties() 354 return transform->findEnclosingScrollNode() == ancestorTargetScrollNode;
374 ->transform()) == ancestorTargetScrollNode;
375 } 355 }
376 356
377 return (layoutObject()->style()->position() == FixedPosition && 357 return (layoutObject()->style()->position() == FixedPosition &&
378 layoutObject()->containerForFixedPosition() == 358 layoutObject()->containerForFixedPosition() ==
379 layoutObject()->view()) || 359 layoutObject()->view()) ||
380 (layoutObject()->style()->position() == StickyPosition && 360 (layoutObject()->style()->position() == StickyPosition &&
381 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root())); 361 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
382 } 362 }
383 363
384 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { 364 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
(...skipping 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 } 3192 }
3213 3193
3214 void showLayerTree(const blink::LayoutObject* layoutObject) { 3194 void showLayerTree(const blink::LayoutObject* layoutObject) {
3215 if (!layoutObject) { 3195 if (!layoutObject) {
3216 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3196 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3217 return; 3197 return;
3218 } 3198 }
3219 showLayerTree(layoutObject->enclosingLayer()); 3199 showLayerTree(layoutObject->enclosingLayer());
3220 } 3200 }
3221 #endif 3201 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698