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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Revert float changes to unittests too Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
index 84dab3cc2f76ad7170d18bed9235375e5dc16c62..fc06d08cf8f2e4a5aa5f5ed44f17633e148b3571 100644
--- a/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
+++ b/third_party/WebKit/Source/core/page/scrolling/StickyPositionScrollingConstraints.h
@@ -113,6 +113,21 @@ class StickyPositionScrollingConstraints final {
return m_totalContainingBlockStickyOffset;
}
+ const LayoutBoxModelObject* nearestStickyAncestor() const {
+ // If we have one or more sticky ancestor elements between ourselves and our
+ // containing block, |m_nearestStickyBoxShiftingStickyBox| points to the
+ // closest. Otherwise, |m_nearestStickyBoxShiftingContainingBlock| points
+ // to the the first sticky ancestor between our containing block (inclusive)
+ // and our scroll ancestor (exclusive). Therefore our nearest sticky
+ // ancestor is the former if it exists, or the latter otherwise.
+ //
+ // If both are null, then we have no sticky ancestors before our scroll
+ // ancestor, so the correct action is to return null.
+ return m_nearestStickyBoxShiftingStickyBox
+ ? m_nearestStickyBoxShiftingStickyBox
+ : m_nearestStickyBoxShiftingContainingBlock;
+ }
+
bool operator==(const StickyPositionScrollingConstraints& other) const {
return m_leftOffset == other.m_leftOffset &&
m_rightOffset == other.m_rightOffset &&

Powered by Google App Engine
This is Rietveld 408576698