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

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 13ad90d19de26da9a0d2cb6928d177f0892fa477..1d5503c90e719b300940bdaadd714f0cbfe77b08 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()));
pdr. 2016/12/07 00:02:05 Is the new "ancestorScrollingLayer() == root()" ch
chrishtr 2016/12/07 01:00:33 Yes. When root layer scrolling is on, the LayoutVi
}
bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
- if (scrollsWithViewport() != other->scrollsWithViewport())
+ if (sticksToViewport() != other->sticksToViewport())
return true;
return ancestorScrollingLayer() != other->ancestorScrollingLayer();
}

Powered by Google App Engine
This is Rietveld 408576698