OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 604 |
605 SetSubtreePropertyChanged(); | 605 SetSubtreePropertyChanged(); |
606 PropertyTrees* property_trees = layer_tree_->property_trees(); | 606 PropertyTrees* property_trees = layer_tree_->property_trees(); |
607 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, | 607 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
608 id())) { | 608 id())) { |
609 DCHECK_EQ(transform_tree_index(), | 609 DCHECK_EQ(transform_tree_index(), |
610 property_trees->transform_id_to_index_map[id()]); | 610 property_trees->transform_id_to_index_map[id()]); |
611 TransformNode* transform_node = | 611 TransformNode* transform_node = |
612 property_trees->transform_tree.Node(transform_tree_index()); | 612 property_trees->transform_tree.Node(transform_tree_index()); |
613 transform_node->update_post_local_transform(position, transform_origin()); | 613 transform_node->update_post_local_transform(position, transform_origin()); |
| 614 if (transform_node->sticky_position_constraint_id >= 0) { |
| 615 StickyPositionNodeData* sticky_data = |
| 616 property_trees->transform_tree.StickyPositionData( |
| 617 transform_tree_index()); |
| 618 sticky_data->main_thread_offset = |
| 619 position.OffsetFromOrigin() - |
| 620 sticky_data->constraints.scroll_container_relative_sticky_box_rect |
| 621 .OffsetFromOrigin(); |
| 622 } |
614 transform_node->needs_local_transform_update = true; | 623 transform_node->needs_local_transform_update = true; |
615 transform_node->transform_changed = true; | 624 transform_node->transform_changed = true; |
616 layer_tree_->property_trees()->transform_tree.set_needs_update(true); | 625 layer_tree_->property_trees()->transform_tree.set_needs_update(true); |
617 SetNeedsCommitNoRebuild(); | 626 SetNeedsCommitNoRebuild(); |
618 return; | 627 return; |
619 } | 628 } |
620 | 629 |
621 SetNeedsCommit(); | 630 SetNeedsCommit(); |
622 } | 631 } |
623 | 632 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 } | 1111 } |
1103 | 1112 |
1104 void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { | 1113 void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { |
1105 DCHECK(IsPropertyChangeAllowed()); | 1114 DCHECK(IsPropertyChangeAllowed()); |
1106 if (inputs_.position_constraint == constraint) | 1115 if (inputs_.position_constraint == constraint) |
1107 return; | 1116 return; |
1108 inputs_.position_constraint = constraint; | 1117 inputs_.position_constraint = constraint; |
1109 SetNeedsCommit(); | 1118 SetNeedsCommit(); |
1110 } | 1119 } |
1111 | 1120 |
| 1121 void Layer::SetStickyPositionConstraint( |
| 1122 const LayerStickyPositionConstraint& constraint) { |
| 1123 DCHECK(IsPropertyChangeAllowed()); |
| 1124 if (inputs_.sticky_position_constraint == constraint) |
| 1125 return; |
| 1126 inputs_.sticky_position_constraint = constraint; |
| 1127 SetNeedsCommit(); |
| 1128 } |
| 1129 |
1112 static void RunCopyCallbackOnMainThread( | 1130 static void RunCopyCallbackOnMainThread( |
1113 std::unique_ptr<CopyOutputRequest> request, | 1131 std::unique_ptr<CopyOutputRequest> request, |
1114 std::unique_ptr<CopyOutputResult> result) { | 1132 std::unique_ptr<CopyOutputResult> result) { |
1115 request->SendResult(std::move(result)); | 1133 request->SendResult(std::move(result)); |
1116 } | 1134 } |
1117 | 1135 |
1118 static void PostCopyCallbackToMainThread( | 1136 static void PostCopyCallbackToMainThread( |
1119 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 1137 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
1120 std::unique_ptr<CopyOutputRequest> request, | 1138 std::unique_ptr<CopyOutputRequest> request, |
1121 std::unique_ptr<CopyOutputResult> result) { | 1139 std::unique_ptr<CopyOutputResult> result) { |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1899 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1882 return draw_property_utils::ScreenSpaceTransform( | 1900 return draw_property_utils::ScreenSpaceTransform( |
1883 this, layer_tree_->property_trees()->transform_tree); | 1901 this, layer_tree_->property_trees()->transform_tree); |
1884 } | 1902 } |
1885 | 1903 |
1886 LayerTree* Layer::GetLayerTree() const { | 1904 LayerTree* Layer::GetLayerTree() const { |
1887 return layer_tree_; | 1905 return layer_tree_; |
1888 } | 1906 } |
1889 | 1907 |
1890 } // namespace cc | 1908 } // namespace cc |
OLD | NEW |