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

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

Issue 2657863004: Move scroll paint property nodes to be owned by the transform tree (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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // a self-painting descendant in this case, there is no need to dirty our 320 // a self-painting descendant in this case, there is no need to dirty our
321 // ancestors further. 321 // ancestors further.
322 if (layer->isSelfPaintingLayer()) { 322 if (layer->isSelfPaintingLayer()) {
323 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || 323 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty ||
324 parent()->m_hasSelfPaintingLayerDescendant); 324 parent()->m_hasSelfPaintingLayerDescendant);
325 break; 325 break;
326 } 326 }
327 } 327 }
328 } 328 }
329 329
330 static const ScrollPaintPropertyNode* nearestScrollNode(
331 const TransformPaintPropertyNode* transform) {
332 if (transform->isRoot())
333 return nullptr;
334 if (const auto* scrollNode = transform->scrollNode())
335 return scrollNode;
336 return nearestScrollNode(transform->parent());
chrishtr 2017/01/26 21:22:58 Please make this an iteration instead of recursion
pdr. 2017/01/27 20:09:33 Done. I found a bug fixing this: the root transfo
337 }
338
330 bool PaintLayer::sticksToViewport() const { 339 bool PaintLayer::sticksToViewport() const {
331 if (layoutObject()->style()->position() != FixedPosition && 340 if (layoutObject()->style()->position() != FixedPosition &&
332 layoutObject()->style()->position() != StickyPosition) 341 layoutObject()->style()->position() != StickyPosition)
333 return false; 342 return false;
334 343
344 // TODO(pdr): This approach of calculating the nearest scroll node is O(n).
345 // An option for improving this is to cache the nearest scroll node in
346 // the local border box properties.
335 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 347 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
336 const ScrollPaintPropertyNode* ancestorTargetScrollNode; 348 const ScrollPaintPropertyNode* ancestorTargetScrollNode;
337 if (layoutObject()->style()->position() == FixedPosition) { 349 if (layoutObject()->style()->position() == FixedPosition) {
338 ancestorTargetScrollNode = layoutObject() 350 ancestorTargetScrollNode =
339 ->view() 351 nearestScrollNode(layoutObject()
pdr. 2017/01/26 20:04:54 This part of the change is not entirely trivial an
wkorman 2017/01/26 21:01:10 Do existing tests cover this logic sufficiently or
pdr. 2017/01/27 20:09:33 I think we have pretty good coverage here. I wante
340 ->paintProperties() 352 ->view()
341 ->localBorderBoxProperties() 353 ->paintProperties()
342 ->scroll(); 354 ->localBorderBoxProperties()
355 ->transform());
343 } else { 356 } else {
344 ancestorTargetScrollNode = layoutObject() 357 ancestorTargetScrollNode = nearestScrollNode(layoutObject()
345 ->view() 358 ->view()
346 ->paintProperties() 359 ->paintProperties()
347 ->contentsProperties() 360 ->contentsProperties()
348 ->scroll(); 361 ->transform());
349 } 362 }
350 363
351 return layoutObject() 364 return nearestScrollNode(layoutObject()
352 ->paintProperties() 365 ->paintProperties()
353 ->localBorderBoxProperties() 366 ->localBorderBoxProperties()
354 ->scroll() == ancestorTargetScrollNode; 367 ->transform()) == ancestorTargetScrollNode;
355 } 368 }
356 369
357 return (layoutObject()->style()->position() == FixedPosition && 370 return (layoutObject()->style()->position() == FixedPosition &&
358 layoutObject()->containerForFixedPosition() == 371 layoutObject()->containerForFixedPosition() ==
359 layoutObject()->view()) || 372 layoutObject()->view()) ||
360 (layoutObject()->style()->position() == StickyPosition && 373 (layoutObject()->style()->position() == StickyPosition &&
361 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root())); 374 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
362 } 375 }
363 376
364 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { 377 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 } 3248 }
3236 3249
3237 void showLayerTree(const blink::LayoutObject* layoutObject) { 3250 void showLayerTree(const blink::LayoutObject* layoutObject) {
3238 if (!layoutObject) { 3251 if (!layoutObject) {
3239 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3252 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3240 return; 3253 return;
3241 } 3254 }
3242 showLayerTree(layoutObject->enclosingLayer()); 3255 showLayerTree(layoutObject->enclosingLayer());
3243 } 3256 }
3244 #endif 3257 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698