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

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

Issue 2549353002: Implement PaintLayer::scrollsWithViewport for SPv2. (Closed)
Patch Set: none Created 4 years 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // a self-painting descendant in this case, there is no need to dirty our 331 // a self-painting descendant in this case, there is no need to dirty our
332 // ancestors further. 332 // ancestors further.
333 if (layer->isSelfPaintingLayer()) { 333 if (layer->isSelfPaintingLayer()) {
334 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || 334 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty ||
335 parent()->m_hasSelfPaintingLayerDescendant); 335 parent()->m_hasSelfPaintingLayerDescendant);
336 break; 336 break;
337 } 337 }
338 } 338 }
339 } 339 }
340 340
341 bool PaintLayer::scrollsWithViewport() const { 341 bool PaintLayer::sticksToViewport() const {
342 if (layoutObject()->style()->position() != FixedPosition &&
343 layoutObject()->style()->position() != StickyPosition)
344 return false;
345
346 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
347 const ScrollPaintPropertyNode* ancestorTargetScrollNode;
348 if (layoutObject()->style()->position() == FixedPosition) {
349 ancestorTargetScrollNode = layoutObject()
350 ->view()
351 ->paintProperties()
352 ->localBorderBoxProperties()
353 ->propertyTreeState.scroll();
354 } else {
355 ancestorTargetScrollNode = layoutObject()
356 ->view()
357 ->paintProperties()
358 ->contentsProperties()
359 .propertyTreeState.scroll();
360 }
361
362 return layoutObject()
363 ->paintProperties()
364 ->localBorderBoxProperties()
365 ->propertyTreeState.scroll() == ancestorTargetScrollNode;
366 }
367
342 return (layoutObject()->style()->position() == FixedPosition && 368 return (layoutObject()->style()->position() == FixedPosition &&
343 layoutObject()->containerForFixedPosition() == 369 layoutObject()->containerForFixedPosition() ==
344 layoutObject()->view()) || 370 layoutObject()->view()) ||
345 (layoutObject()->style()->position() == StickyPosition && 371 (layoutObject()->style()->position() == StickyPosition &&
346 !ancestorScrollingLayer()); 372 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
347 } 373 }
348 374
349 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { 375 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
350 if (scrollsWithViewport() != other->scrollsWithViewport()) 376 if (sticksToViewport() != other->sticksToViewport())
351 return true; 377 return true;
352 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); 378 return ancestorScrollingLayer() != other->ancestorScrollingLayer();
353 } 379 }
354 380
355 void PaintLayer::updateLayerPositionsAfterOverflowScroll( 381 void PaintLayer::updateLayerPositionsAfterOverflowScroll(
356 const DoubleSize& scrollDelta) { 382 const DoubleSize& scrollDelta) {
357 clipper().clearClipRectsIncludingDescendants(); 383 clipper().clearClipRectsIncludingDescendants();
358 updateLayerPositionsAfterScrollRecursive(scrollDelta, 384 updateLayerPositionsAfterScrollRecursive(scrollDelta,
359 isPaintInvalidationContainer()); 385 isPaintInvalidationContainer());
360 } 386 }
(...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 } 3277 }
3252 3278
3253 void showLayerTree(const blink::LayoutObject* layoutObject) { 3279 void showLayerTree(const blink::LayoutObject* layoutObject) {
3254 if (!layoutObject) { 3280 if (!layoutObject) {
3255 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3281 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3256 return; 3282 return;
3257 } 3283 }
3258 showLayerTree(layoutObject->enclosingLayer()); 3284 showLayerTree(layoutObject->enclosingLayer());
3259 } 3285 }
3260 #endif 3286 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698