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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef StickyPositionScrollingConstraints_h 5 #ifndef StickyPositionScrollingConstraints_h
6 #define StickyPositionScrollingConstraints_h 6 #define StickyPositionScrollingConstraints_h
7 7
8 #include "platform/geometry/FloatRect.h" 8 #include "platform/geometry/FloatRect.h"
9 #include "platform/geometry/FloatSize.h" 9 #include "platform/geometry/FloatSize.h"
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return m_nearestStickyBoxShiftingContainingBlock; 106 return m_nearestStickyBoxShiftingContainingBlock;
107 } 107 }
108 108
109 const FloatSize& getTotalStickyBoxStickyOffset() const { 109 const FloatSize& getTotalStickyBoxStickyOffset() const {
110 return m_totalStickyBoxStickyOffset; 110 return m_totalStickyBoxStickyOffset;
111 } 111 }
112 const FloatSize& getTotalContainingBlockStickyOffset() const { 112 const FloatSize& getTotalContainingBlockStickyOffset() const {
113 return m_totalContainingBlockStickyOffset; 113 return m_totalContainingBlockStickyOffset;
114 } 114 }
115 115
116 const LayoutBoxModelObject* nearestStickyAncestor() const {
117 // If we have one or more sticky ancestor elements between ourselves and our
118 // containing block, |m_nearestStickyBoxShiftingStickyBox| points to the
119 // closest. Otherwise, |m_nearestStickyBoxShiftingContainingBlock| points
120 // to the the first sticky ancestor between our containing block (inclusive)
121 // and our scroll ancestor (exclusive). Therefore our nearest sticky
122 // ancestor is the former if it exists, or the latter otherwise.
123 //
124 // If both are null, then we have no sticky ancestors before our scroll
125 // ancestor, so the correct action is to return null.
126 return m_nearestStickyBoxShiftingStickyBox
127 ? m_nearestStickyBoxShiftingStickyBox
128 : m_nearestStickyBoxShiftingContainingBlock;
129 }
130
116 bool operator==(const StickyPositionScrollingConstraints& other) const { 131 bool operator==(const StickyPositionScrollingConstraints& other) const {
117 return m_leftOffset == other.m_leftOffset && 132 return m_leftOffset == other.m_leftOffset &&
118 m_rightOffset == other.m_rightOffset && 133 m_rightOffset == other.m_rightOffset &&
119 m_topOffset == other.m_topOffset && 134 m_topOffset == other.m_topOffset &&
120 m_bottomOffset == other.m_bottomOffset && 135 m_bottomOffset == other.m_bottomOffset &&
121 m_scrollContainerRelativeContainingBlockRect == 136 m_scrollContainerRelativeContainingBlockRect ==
122 other.m_scrollContainerRelativeContainingBlockRect && 137 other.m_scrollContainerRelativeContainingBlockRect &&
123 m_scrollContainerRelativeStickyBoxRect == 138 m_scrollContainerRelativeStickyBoxRect ==
124 other.m_scrollContainerRelativeStickyBoxRect && 139 other.m_scrollContainerRelativeStickyBoxRect &&
125 m_nearestStickyBoxShiftingStickyBox == 140 m_nearestStickyBoxShiftingStickyBox ==
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // constraining block constriant rect for different sticky descendants is 176 // constraining block constriant rect for different sticky descendants is
162 // quite complex. See the StickyPositionComplexTableNesting test in 177 // quite complex. See the StickyPositionComplexTableNesting test in
163 // LayoutBoxModelObjectTest.cpp. 178 // LayoutBoxModelObjectTest.cpp.
164 FloatSize m_totalStickyBoxStickyOffset; 179 FloatSize m_totalStickyBoxStickyOffset;
165 FloatSize m_totalContainingBlockStickyOffset; 180 FloatSize m_totalContainingBlockStickyOffset;
166 }; 181 };
167 182
168 } // namespace blink 183 } // namespace blink
169 184
170 #endif // StickyPositionScrollingConstraints_h 185 #endif // StickyPositionScrollingConstraints_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698