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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index 24badd0f8985551a921d7dfcb484d25d0ab069e0..8a2ceafec70d524fec4f83601f7ab4216ebe48f3 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -338,16 +338,42 @@ void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() {
}
}
-bool PaintLayer::scrollsWithViewport() const {
+bool PaintLayer::sticksToViewport() const {
+ if (layoutObject()->style()->position() != FixedPosition &&
+ layoutObject()->style()->position() != StickyPosition)
+ return false;
+
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ const ScrollPaintPropertyNode* ancestorTargetScrollNode;
+ if (layoutObject()->style()->position() == FixedPosition) {
+ ancestorTargetScrollNode = layoutObject()
+ ->view()
+ ->paintProperties()
+ ->localBorderBoxProperties()
+ ->propertyTreeState.scroll();
+ } else {
+ ancestorTargetScrollNode = layoutObject()
+ ->view()
+ ->paintProperties()
+ ->contentsProperties()
+ .propertyTreeState.scroll();
+ }
+
+ return layoutObject()
+ ->paintProperties()
+ ->localBorderBoxProperties()
+ ->propertyTreeState.scroll() == ancestorTargetScrollNode;
+ }
+
return (layoutObject()->style()->position() == FixedPosition &&
layoutObject()->containerForFixedPosition() ==
layoutObject()->view()) ||
(layoutObject()->style()->position() == StickyPosition &&
- !ancestorScrollingLayer());
+ (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
}
bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
- if (scrollsWithViewport() != other->scrollsWithViewport())
+ if (sticksToViewport() != other->sticksToViewport())
return true;
return ancestorScrollingLayer() != other->ancestorScrollingLayer();
}
« 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