Chromium Code Reviews| 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 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class LayoutBoxModelObject; | 13 class LayoutBoxModelObject; |
| 14 class PaintLayer; | |
| 14 | 15 |
| 15 class StickyPositionScrollingConstraints final { | 16 class StickyPositionScrollingConstraints final { |
| 16 public: | 17 public: |
| 17 enum AnchorEdgeFlags { | 18 enum AnchorEdgeFlags { |
| 18 kAnchorEdgeLeft = 1 << 0, | 19 kAnchorEdgeLeft = 1 << 0, |
| 19 kAnchorEdgeRight = 1 << 1, | 20 kAnchorEdgeRight = 1 << 1, |
| 20 kAnchorEdgeTop = 1 << 2, | 21 kAnchorEdgeTop = 1 << 2, |
| 21 kAnchorEdgeBottom = 1 << 3 | 22 kAnchorEdgeBottom = 1 << 3 |
| 22 }; | 23 }; |
| 23 typedef unsigned AnchorEdges; | 24 typedef unsigned AnchorEdges; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 49 total_sticky_box_sticky_offset_(other.total_sticky_box_sticky_offset_), | 50 total_sticky_box_sticky_offset_(other.total_sticky_box_sticky_offset_), |
| 50 total_containing_block_sticky_offset_( | 51 total_containing_block_sticky_offset_( |
| 51 other.total_containing_block_sticky_offset_) {} | 52 other.total_containing_block_sticky_offset_) {} |
| 52 | 53 |
| 53 FloatSize ComputeStickyOffset( | 54 FloatSize ComputeStickyOffset( |
| 54 const FloatRect& viewport_rect, | 55 const FloatRect& viewport_rect, |
| 55 const StickyPositionScrollingConstraints* ancestor_sticky_box_constraints, | 56 const StickyPositionScrollingConstraints* ancestor_sticky_box_constraints, |
| 56 const StickyPositionScrollingConstraints* | 57 const StickyPositionScrollingConstraints* |
| 57 ancestor_containing_block_constraints); | 58 ancestor_containing_block_constraints); |
| 58 | 59 |
| 60 FloatSize ComputeMainThreadStickyOffset( | |
|
flackr
2017/06/02 15:33:58
Let's make this like GetTotalStickyBoxStickyOffset
yigu
2017/06/02 17:59:56
Done.
| |
| 61 const PaintLayer& ancestor_overflow_layer) const; | |
| 62 | |
| 59 bool HasAncestorStickyElement() const { | 63 bool HasAncestorStickyElement() const { |
| 60 return nearest_sticky_box_shifting_sticky_box_ || | 64 return nearest_sticky_box_shifting_sticky_box_ || |
| 61 nearest_sticky_box_shifting_containing_block_; | 65 nearest_sticky_box_shifting_containing_block_; |
| 62 } | 66 } |
| 63 | 67 |
| 64 AnchorEdges GetAnchorEdges() const { return anchor_edges_; } | 68 AnchorEdges GetAnchorEdges() const { return anchor_edges_; } |
| 65 bool HasAnchorEdge(AnchorEdgeFlags flag) const { | 69 bool HasAnchorEdge(AnchorEdgeFlags flag) const { |
| 66 return anchor_edges_ & flag; | 70 return anchor_edges_ & flag; |
| 67 } | 71 } |
| 68 void AddAnchorEdge(AnchorEdgeFlags edge_flag) { anchor_edges_ |= edge_flag; } | 72 void AddAnchorEdge(AnchorEdgeFlags edge_flag) { anchor_edges_ |= edge_flag; } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 // constraining block constriant rect for different sticky descendants is | 181 // constraining block constriant rect for different sticky descendants is |
| 178 // quite complex. See the StickyPositionComplexTableNesting test in | 182 // quite complex. See the StickyPositionComplexTableNesting test in |
| 179 // LayoutBoxModelObjectTest.cpp. | 183 // LayoutBoxModelObjectTest.cpp. |
| 180 FloatSize total_sticky_box_sticky_offset_; | 184 FloatSize total_sticky_box_sticky_offset_; |
| 181 FloatSize total_containing_block_sticky_offset_; | 185 FloatSize total_containing_block_sticky_offset_; |
| 182 }; | 186 }; |
| 183 | 187 |
| 184 } // namespace blink | 188 } // namespace blink |
| 185 | 189 |
| 186 #endif // StickyPositionScrollingConstraints_h | 190 #endif // StickyPositionScrollingConstraints_h |
| OLD | NEW |