OLD | NEW |
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 Loading... |
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 Loading... |
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 FloatSize& getLocalStickyOffset() const { return m_localStickyOffset; } |
| 118 |
116 bool operator==(const StickyPositionScrollingConstraints& other) const { | 119 bool operator==(const StickyPositionScrollingConstraints& other) const { |
117 return m_leftOffset == other.m_leftOffset && | 120 return m_leftOffset == other.m_leftOffset && |
118 m_rightOffset == other.m_rightOffset && | 121 m_rightOffset == other.m_rightOffset && |
119 m_topOffset == other.m_topOffset && | 122 m_topOffset == other.m_topOffset && |
120 m_bottomOffset == other.m_bottomOffset && | 123 m_bottomOffset == other.m_bottomOffset && |
121 m_scrollContainerRelativeContainingBlockRect == | 124 m_scrollContainerRelativeContainingBlockRect == |
122 other.m_scrollContainerRelativeContainingBlockRect && | 125 other.m_scrollContainerRelativeContainingBlockRect && |
123 m_scrollContainerRelativeStickyBoxRect == | 126 m_scrollContainerRelativeStickyBoxRect == |
124 other.m_scrollContainerRelativeStickyBoxRect && | 127 other.m_scrollContainerRelativeStickyBoxRect && |
125 m_nearestStickyBoxShiftingStickyBox == | 128 m_nearestStickyBoxShiftingStickyBox == |
126 other.m_nearestStickyBoxShiftingStickyBox && | 129 other.m_nearestStickyBoxShiftingStickyBox && |
127 m_nearestStickyBoxShiftingContainingBlock == | 130 m_nearestStickyBoxShiftingContainingBlock == |
128 other.m_nearestStickyBoxShiftingContainingBlock && | 131 other.m_nearestStickyBoxShiftingContainingBlock && |
129 m_totalStickyBoxStickyOffset == other.m_totalStickyBoxStickyOffset && | 132 m_totalStickyBoxStickyOffset == other.m_totalStickyBoxStickyOffset && |
130 m_totalContainingBlockStickyOffset == | 133 m_totalContainingBlockStickyOffset == |
131 other.m_totalContainingBlockStickyOffset; | 134 other.m_totalContainingBlockStickyOffset && |
| 135 m_localStickyOffset == other.m_localStickyOffset; |
132 } | 136 } |
133 | 137 |
134 bool operator!=(const StickyPositionScrollingConstraints& other) const { | 138 bool operator!=(const StickyPositionScrollingConstraints& other) const { |
135 return !(*this == other); | 139 return !(*this == other); |
136 } | 140 } |
137 | 141 |
138 private: | 142 private: |
139 AnchorEdges m_anchorEdges; | 143 AnchorEdges m_anchorEdges; |
140 float m_leftOffset; | 144 float m_leftOffset; |
141 float m_rightOffset; | 145 float m_rightOffset; |
(...skipping 14 matching lines...) Expand all Loading... |
156 // sticky elements to offset their constraint rects. Because we can either | 160 // sticky elements to offset their constraint rects. Because we can either |
157 // affect the sticky box constraint rect or the containing block constraint | 161 // affect the sticky box constraint rect or the containing block constraint |
158 // rect, we need to accumulate both. | 162 // rect, we need to accumulate both. |
159 // | 163 // |
160 // The case where we can affect both the sticky box constraint rect and the | 164 // The case where we can affect both the sticky box constraint rect and the |
161 // constraining block constriant rect for different sticky descendants is | 165 // constraining block constriant rect for different sticky descendants is |
162 // quite complex. See the StickyPositionComplexTableNesting test in | 166 // quite complex. See the StickyPositionComplexTableNesting test in |
163 // LayoutBoxModelObjectTest.cpp. | 167 // LayoutBoxModelObjectTest.cpp. |
164 FloatSize m_totalStickyBoxStickyOffset; | 168 FloatSize m_totalStickyBoxStickyOffset; |
165 FloatSize m_totalContainingBlockStickyOffset; | 169 FloatSize m_totalContainingBlockStickyOffset; |
| 170 |
| 171 FloatSize m_localStickyOffset; |
166 }; | 172 }; |
167 | 173 |
168 } // namespace blink | 174 } // namespace blink |
169 | 175 |
170 #endif // StickyPositionScrollingConstraints_h | 176 #endif // StickyPositionScrollingConstraints_h |
OLD | NEW |