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(); |
} |