| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "cc/layers/layer_sticky_position_constraint.h" | 5 #include "cc/layers/layer_sticky_position_constraint.h" |
| 6 #include "cc/proto/gfx_conversions.h" | 6 #include "cc/proto/gfx_conversions.h" |
| 7 #include "cc/proto/layer_sticky_position_constraint.pb.h" | 7 #include "cc/proto/layer_sticky_position_constraint.pb.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const LayerStickyPositionConstraint& other) | 23 const LayerStickyPositionConstraint& other) |
| 24 : is_sticky(other.is_sticky), | 24 : is_sticky(other.is_sticky), |
| 25 is_anchored_left(other.is_anchored_left), | 25 is_anchored_left(other.is_anchored_left), |
| 26 is_anchored_right(other.is_anchored_right), | 26 is_anchored_right(other.is_anchored_right), |
| 27 is_anchored_top(other.is_anchored_top), | 27 is_anchored_top(other.is_anchored_top), |
| 28 is_anchored_bottom(other.is_anchored_bottom), | 28 is_anchored_bottom(other.is_anchored_bottom), |
| 29 left_offset(other.left_offset), | 29 left_offset(other.left_offset), |
| 30 right_offset(other.right_offset), | 30 right_offset(other.right_offset), |
| 31 top_offset(other.top_offset), | 31 top_offset(other.top_offset), |
| 32 bottom_offset(other.bottom_offset), | 32 bottom_offset(other.bottom_offset), |
| 33 parent_relative_sticky_box_offset( |
| 34 other.parent_relative_sticky_box_offset), |
| 33 scroll_container_relative_sticky_box_rect( | 35 scroll_container_relative_sticky_box_rect( |
| 34 other.scroll_container_relative_sticky_box_rect), | 36 other.scroll_container_relative_sticky_box_rect), |
| 35 scroll_container_relative_containing_block_rect( | 37 scroll_container_relative_containing_block_rect( |
| 36 other.scroll_container_relative_containing_block_rect) {} | 38 other.scroll_container_relative_containing_block_rect) {} |
| 37 | 39 |
| 38 void LayerStickyPositionConstraint::ToProtobuf( | 40 void LayerStickyPositionConstraint::ToProtobuf( |
| 39 proto::LayerStickyPositionConstraint* proto) const { | 41 proto::LayerStickyPositionConstraint* proto) const { |
| 40 proto->set_is_sticky(is_sticky); | 42 proto->set_is_sticky(is_sticky); |
| 41 proto->set_is_anchored_left(is_anchored_left); | 43 proto->set_is_anchored_left(is_anchored_left); |
| 42 proto->set_is_anchored_right(is_anchored_right); | 44 proto->set_is_anchored_right(is_anchored_right); |
| 43 proto->set_is_anchored_top(is_anchored_top); | 45 proto->set_is_anchored_top(is_anchored_top); |
| 44 proto->set_is_anchored_bottom(is_anchored_bottom); | 46 proto->set_is_anchored_bottom(is_anchored_bottom); |
| 45 proto->set_left_offset(left_offset); | 47 proto->set_left_offset(left_offset); |
| 46 proto->set_right_offset(right_offset); | 48 proto->set_right_offset(right_offset); |
| 47 proto->set_top_offset(top_offset); | 49 proto->set_top_offset(top_offset); |
| 48 proto->set_bottom_offset(bottom_offset); | 50 proto->set_bottom_offset(bottom_offset); |
| 51 PointToProto(parent_relative_sticky_box_offset, |
| 52 proto->mutable_parent_relative_sticky_box_offset()); |
| 49 RectToProto(scroll_container_relative_sticky_box_rect, | 53 RectToProto(scroll_container_relative_sticky_box_rect, |
| 50 proto->mutable_scroll_container_relative_sticky_box_rect()); | 54 proto->mutable_scroll_container_relative_sticky_box_rect()); |
| 51 RectToProto(scroll_container_relative_containing_block_rect, | 55 RectToProto(scroll_container_relative_containing_block_rect, |
| 52 proto->mutable_scroll_container_relative_containing_block_rect()); | 56 proto->mutable_scroll_container_relative_containing_block_rect()); |
| 53 } | 57 } |
| 54 | 58 |
| 55 void LayerStickyPositionConstraint::FromProtobuf( | 59 void LayerStickyPositionConstraint::FromProtobuf( |
| 56 const proto::LayerStickyPositionConstraint& proto) { | 60 const proto::LayerStickyPositionConstraint& proto) { |
| 57 is_sticky = proto.is_sticky(); | 61 is_sticky = proto.is_sticky(); |
| 58 is_anchored_left = proto.is_anchored_left(); | 62 is_anchored_left = proto.is_anchored_left(); |
| 59 is_anchored_right = proto.is_anchored_right(); | 63 is_anchored_right = proto.is_anchored_right(); |
| 60 is_anchored_top = proto.is_anchored_top(); | 64 is_anchored_top = proto.is_anchored_top(); |
| 61 is_anchored_bottom = proto.is_anchored_bottom(); | 65 is_anchored_bottom = proto.is_anchored_bottom(); |
| 62 left_offset = proto.left_offset(); | 66 left_offset = proto.left_offset(); |
| 63 right_offset = proto.right_offset(); | 67 right_offset = proto.right_offset(); |
| 64 top_offset = proto.top_offset(); | 68 top_offset = proto.top_offset(); |
| 65 bottom_offset = proto.bottom_offset(); | 69 bottom_offset = proto.bottom_offset(); |
| 70 parent_relative_sticky_box_offset = |
| 71 ProtoToPoint(proto.parent_relative_sticky_box_offset()); |
| 66 scroll_container_relative_sticky_box_rect = | 72 scroll_container_relative_sticky_box_rect = |
| 67 ProtoToRect(proto.scroll_container_relative_sticky_box_rect()); | 73 ProtoToRect(proto.scroll_container_relative_sticky_box_rect()); |
| 68 scroll_container_relative_containing_block_rect = | 74 scroll_container_relative_containing_block_rect = |
| 69 ProtoToRect(proto.scroll_container_relative_containing_block_rect()); | 75 ProtoToRect(proto.scroll_container_relative_containing_block_rect()); |
| 70 } | 76 } |
| 71 | 77 |
| 72 bool LayerStickyPositionConstraint::operator==( | 78 bool LayerStickyPositionConstraint::operator==( |
| 73 const LayerStickyPositionConstraint& other) const { | 79 const LayerStickyPositionConstraint& other) const { |
| 74 if (!is_sticky && !other.is_sticky) | 80 if (!is_sticky && !other.is_sticky) |
| 75 return true; | 81 return true; |
| 76 return is_sticky == other.is_sticky && | 82 return is_sticky == other.is_sticky && |
| 77 is_anchored_left == other.is_anchored_left && | 83 is_anchored_left == other.is_anchored_left && |
| 78 is_anchored_right == other.is_anchored_right && | 84 is_anchored_right == other.is_anchored_right && |
| 79 is_anchored_top == other.is_anchored_top && | 85 is_anchored_top == other.is_anchored_top && |
| 80 is_anchored_bottom == other.is_anchored_bottom && | 86 is_anchored_bottom == other.is_anchored_bottom && |
| 81 left_offset == other.left_offset && | 87 left_offset == other.left_offset && |
| 82 right_offset == other.right_offset && top_offset == other.top_offset && | 88 right_offset == other.right_offset && top_offset == other.top_offset && |
| 83 bottom_offset == other.bottom_offset && | 89 bottom_offset == other.bottom_offset && |
| 90 parent_relative_sticky_box_offset == |
| 91 other.parent_relative_sticky_box_offset && |
| 84 scroll_container_relative_sticky_box_rect == | 92 scroll_container_relative_sticky_box_rect == |
| 85 other.scroll_container_relative_sticky_box_rect && | 93 other.scroll_container_relative_sticky_box_rect && |
| 86 scroll_container_relative_containing_block_rect == | 94 scroll_container_relative_containing_block_rect == |
| 87 other.scroll_container_relative_containing_block_rect; | 95 other.scroll_container_relative_containing_block_rect; |
| 88 } | 96 } |
| 89 | 97 |
| 90 bool LayerStickyPositionConstraint::operator!=( | 98 bool LayerStickyPositionConstraint::operator!=( |
| 91 const LayerStickyPositionConstraint& other) const { | 99 const LayerStickyPositionConstraint& other) const { |
| 92 return !(*this == other); | 100 return !(*this == other); |
| 93 } | 101 } |
| 94 | 102 |
| 95 } // namespace cc | 103 } // namespace cc |
| OLD | NEW |