OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ |
| 6 #define CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ |
| 7 |
| 8 #include "cc/base/cc_export.h" |
| 9 |
| 10 #include "ui/gfx/geometry/rect.h" |
| 11 |
| 12 namespace cc { |
| 13 |
| 14 namespace proto { |
| 15 class LayerStickyPositionConstraint; |
| 16 } |
| 17 |
| 18 struct CC_EXPORT LayerStickyPositionConstraint { |
| 19 LayerStickyPositionConstraint(); |
| 20 LayerStickyPositionConstraint(const LayerStickyPositionConstraint& other); |
| 21 |
| 22 bool is_sticky : 1; |
| 23 bool is_anchored_left : 1; |
| 24 bool is_anchored_right : 1; |
| 25 bool is_anchored_top : 1; |
| 26 bool is_anchored_bottom : 1; |
| 27 |
| 28 // The offset from each edge of the ancestor scroller (or the viewport) to |
| 29 // try to maintain to the sticky box as we scroll. |
| 30 float left_offset; |
| 31 float right_offset; |
| 32 float top_offset; |
| 33 float bottom_offset; |
| 34 |
| 35 // The rectangle corresponding to original layout position of the sticky box |
| 36 // relative to the scroll ancestor. The sticky box is only offset once the |
| 37 // scroll has passed its initial position (e.g. top_offset will only push |
| 38 // the element down from its original position). |
| 39 gfx::Rect scroll_container_relative_sticky_box_rect; |
| 40 |
| 41 // The layout rectangle of the sticky box's containing block relative to the |
| 42 // scroll ancestor. The sticky box is only moved as far as its containing |
| 43 // block boundary. |
| 44 gfx::Rect scroll_container_relative_containing_block_rect; |
| 45 |
| 46 void ToProtobuf(proto::LayerStickyPositionConstraint* proto) const; |
| 47 void FromProtobuf(const proto::LayerStickyPositionConstraint& proto); |
| 48 |
| 49 bool operator==(const LayerStickyPositionConstraint&) const; |
| 50 bool operator!=(const LayerStickyPositionConstraint&) const; |
| 51 }; |
| 52 |
| 53 } // namespace cc |
| 54 |
| 55 #endif // CC_LAYERS_LAYER_STICKY_POSITION_CONSTRAINT_H_ |
OLD | NEW |