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

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: Add comment referencing crbug.com/702229 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 30 matching lines...) Expand all
41 m_scrollContainerRelativeContainingBlockRect( 41 m_scrollContainerRelativeContainingBlockRect(
42 other.m_scrollContainerRelativeContainingBlockRect), 42 other.m_scrollContainerRelativeContainingBlockRect),
43 m_scrollContainerRelativeStickyBoxRect( 43 m_scrollContainerRelativeStickyBoxRect(
44 other.m_scrollContainerRelativeStickyBoxRect), 44 other.m_scrollContainerRelativeStickyBoxRect),
45 m_nearestStickyBoxShiftingStickyBox( 45 m_nearestStickyBoxShiftingStickyBox(
46 other.m_nearestStickyBoxShiftingStickyBox), 46 other.m_nearestStickyBoxShiftingStickyBox),
47 m_nearestStickyBoxShiftingContainingBlock( 47 m_nearestStickyBoxShiftingContainingBlock(
48 other.m_nearestStickyBoxShiftingContainingBlock), 48 other.m_nearestStickyBoxShiftingContainingBlock),
49 m_totalStickyBoxStickyOffset(other.m_totalStickyBoxStickyOffset), 49 m_totalStickyBoxStickyOffset(other.m_totalStickyBoxStickyOffset),
50 m_totalContainingBlockStickyOffset( 50 m_totalContainingBlockStickyOffset(
51 other.m_totalContainingBlockStickyOffset) {} 51 other.m_totalContainingBlockStickyOffset),
52 m_localStickyOffset(other.m_localStickyOffset) {}
52 53
53 FloatSize computeStickyOffset( 54 FloatSize computeStickyOffset(
54 const FloatRect& viewportRect, 55 const FloatRect& viewportRect,
55 const StickyPositionScrollingConstraints* ancestorStickyBoxConstraints, 56 const StickyPositionScrollingConstraints* ancestorStickyBoxConstraints,
56 const StickyPositionScrollingConstraints* 57 const StickyPositionScrollingConstraints*
57 ancestorContainingBlockConstraints); 58 ancestorContainingBlockConstraints);
58 59
59 bool hasAncestorStickyElement() const { 60 bool hasAncestorStickyElement() const {
60 return m_nearestStickyBoxShiftingStickyBox || 61 return m_nearestStickyBoxShiftingStickyBox ||
61 m_nearestStickyBoxShiftingContainingBlock; 62 m_nearestStickyBoxShiftingContainingBlock;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return m_nearestStickyBoxShiftingContainingBlock; 107 return m_nearestStickyBoxShiftingContainingBlock;
107 } 108 }
108 109
109 const FloatSize& getTotalStickyBoxStickyOffset() const { 110 const FloatSize& getTotalStickyBoxStickyOffset() const {
110 return m_totalStickyBoxStickyOffset; 111 return m_totalStickyBoxStickyOffset;
111 } 112 }
112 const FloatSize& getTotalContainingBlockStickyOffset() const { 113 const FloatSize& getTotalContainingBlockStickyOffset() const {
113 return m_totalContainingBlockStickyOffset; 114 return m_totalContainingBlockStickyOffset;
114 } 115 }
115 116
117 const LayoutBoxModelObject* nearestStickyAncestor() const {
118 return m_nearestStickyBoxShiftingStickyBox
119 ? m_nearestStickyBoxShiftingStickyBox
120 : m_nearestStickyBoxShiftingContainingBlock;
121 }
122
116 bool operator==(const StickyPositionScrollingConstraints& other) const { 123 bool operator==(const StickyPositionScrollingConstraints& other) const {
117 return m_leftOffset == other.m_leftOffset && 124 return m_leftOffset == other.m_leftOffset &&
118 m_rightOffset == other.m_rightOffset && 125 m_rightOffset == other.m_rightOffset &&
119 m_topOffset == other.m_topOffset && 126 m_topOffset == other.m_topOffset &&
120 m_bottomOffset == other.m_bottomOffset && 127 m_bottomOffset == other.m_bottomOffset &&
121 m_scrollContainerRelativeContainingBlockRect == 128 m_scrollContainerRelativeContainingBlockRect ==
122 other.m_scrollContainerRelativeContainingBlockRect && 129 other.m_scrollContainerRelativeContainingBlockRect &&
123 m_scrollContainerRelativeStickyBoxRect == 130 m_scrollContainerRelativeStickyBoxRect ==
124 other.m_scrollContainerRelativeStickyBoxRect && 131 other.m_scrollContainerRelativeStickyBoxRect &&
125 m_nearestStickyBoxShiftingStickyBox == 132 m_nearestStickyBoxShiftingStickyBox ==
126 other.m_nearestStickyBoxShiftingStickyBox && 133 other.m_nearestStickyBoxShiftingStickyBox &&
127 m_nearestStickyBoxShiftingContainingBlock == 134 m_nearestStickyBoxShiftingContainingBlock ==
128 other.m_nearestStickyBoxShiftingContainingBlock && 135 other.m_nearestStickyBoxShiftingContainingBlock &&
129 m_totalStickyBoxStickyOffset == other.m_totalStickyBoxStickyOffset && 136 m_totalStickyBoxStickyOffset == other.m_totalStickyBoxStickyOffset &&
130 m_totalContainingBlockStickyOffset == 137 m_totalContainingBlockStickyOffset ==
131 other.m_totalContainingBlockStickyOffset; 138 other.m_totalContainingBlockStickyOffset &&
139 m_localStickyOffset == other.m_localStickyOffset;
132 } 140 }
133 141
134 bool operator!=(const StickyPositionScrollingConstraints& other) const { 142 bool operator!=(const StickyPositionScrollingConstraints& other) const {
135 return !(*this == other); 143 return !(*this == other);
136 } 144 }
137 145
138 private: 146 private:
139 AnchorEdges m_anchorEdges; 147 AnchorEdges m_anchorEdges;
140 float m_leftOffset; 148 float m_leftOffset;
141 float m_rightOffset; 149 float m_rightOffset;
(...skipping 14 matching lines...) Expand all
156 // sticky elements to offset their constraint rects. Because we can either 164 // sticky elements to offset their constraint rects. Because we can either
157 // affect the sticky box constraint rect or the containing block constraint 165 // affect the sticky box constraint rect or the containing block constraint
158 // rect, we need to accumulate both. 166 // rect, we need to accumulate both.
159 // 167 //
160 // The case where we can affect both the sticky box constraint rect and the 168 // The case where we can affect both the sticky box constraint rect and the
161 // constraining block constriant rect for different sticky descendants is 169 // constraining block constriant rect for different sticky descendants is
162 // quite complex. See the StickyPositionComplexTableNesting test in 170 // quite complex. See the StickyPositionComplexTableNesting test in
163 // LayoutBoxModelObjectTest.cpp. 171 // LayoutBoxModelObjectTest.cpp.
164 FloatSize m_totalStickyBoxStickyOffset; 172 FloatSize m_totalStickyBoxStickyOffset;
165 FloatSize m_totalContainingBlockStickyOffset; 173 FloatSize m_totalContainingBlockStickyOffset;
174
175 FloatSize m_localStickyOffset;
flackr 2017/03/17 15:01:56 This seems unused, remove it?
smcgruer 2017/03/17 17:36:52 Done.
166 }; 176 };
167 177
168 } // namespace blink 178 } // namespace blink
169 179
170 #endif // StickyPositionScrollingConstraints_h 180 #endif // StickyPositionScrollingConstraints_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698