| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 void Layer::SetStickyPositionConstraint( | 1103 void Layer::SetStickyPositionConstraint( |
| 1104 const LayerStickyPositionConstraint& constraint) { | 1104 const LayerStickyPositionConstraint& constraint) { |
| 1105 DCHECK(IsPropertyChangeAllowed()); | 1105 DCHECK(IsPropertyChangeAllowed()); |
| 1106 if (inputs_.sticky_position_constraint == constraint) | 1106 if (inputs_.sticky_position_constraint == constraint) |
| 1107 return; | 1107 return; |
| 1108 inputs_.sticky_position_constraint = constraint; | 1108 inputs_.sticky_position_constraint = constraint; |
| 1109 SetPropertyTreesNeedRebuild(); | 1109 SetPropertyTreesNeedRebuild(); |
| 1110 SetNeedsCommit(); | 1110 SetNeedsCommit(); |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 void Layer::SetOffsetForStickyPositionFromMainThread(const gfx::Size& offset) { | |
| 1114 DCHECK(IsPropertyChangeAllowed()); | |
| 1115 if (inputs_.offset_for_sticky_position_from_main_thread == offset) | |
| 1116 return; | |
| 1117 inputs_.offset_for_sticky_position_from_main_thread = offset; | |
| 1118 | |
| 1119 if (!layer_tree_host_) | |
| 1120 return; | |
| 1121 | |
| 1122 SetSubtreePropertyChanged(); | |
| 1123 PropertyTrees* property_trees = layer_tree_host_->property_trees(); | |
| 1124 if (TransformNode* transform_node = | |
| 1125 property_trees->transform_tree.FindNodeFromElementId( | |
| 1126 inputs_.element_id)) { | |
| 1127 DCHECK_EQ(transform_tree_index(), transform_node->id); | |
| 1128 transform_node->offset_for_sticky_position_from_main_thread = | |
| 1129 gfx::Vector2dF(offset.width(), offset.height()); | |
| 1130 transform_node->needs_local_transform_update = true; | |
| 1131 transform_node->transform_changed = true; | |
| 1132 layer_tree_host_->property_trees()->transform_tree.set_needs_update(true); | |
| 1133 } | |
| 1134 | |
| 1135 SetNeedsCommit(); | |
| 1136 } | |
| 1137 | |
| 1138 static void RunCopyCallbackOnMainThread( | 1113 static void RunCopyCallbackOnMainThread( |
| 1139 std::unique_ptr<CopyOutputRequest> request, | 1114 std::unique_ptr<CopyOutputRequest> request, |
| 1140 std::unique_ptr<CopyOutputResult> result) { | 1115 std::unique_ptr<CopyOutputResult> result) { |
| 1141 request->SendResult(std::move(result)); | 1116 request->SendResult(std::move(result)); |
| 1142 } | 1117 } |
| 1143 | 1118 |
| 1144 static void PostCopyCallbackToMainThread( | 1119 static void PostCopyCallbackToMainThread( |
| 1145 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 1120 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 1146 std::unique_ptr<CopyOutputRequest> request, | 1121 std::unique_ptr<CopyOutputRequest> request, |
| 1147 std::unique_ptr<CopyOutputResult> result) { | 1122 std::unique_ptr<CopyOutputResult> result) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 ->subtree_has_copy_request; | 1428 ->subtree_has_copy_request; |
| 1454 } | 1429 } |
| 1455 | 1430 |
| 1456 gfx::Transform Layer::ScreenSpaceTransform() const { | 1431 gfx::Transform Layer::ScreenSpaceTransform() const { |
| 1457 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1432 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
| 1458 return draw_property_utils::ScreenSpaceTransform( | 1433 return draw_property_utils::ScreenSpaceTransform( |
| 1459 this, layer_tree_host_->property_trees()->transform_tree); | 1434 this, layer_tree_host_->property_trees()->transform_tree); |
| 1460 } | 1435 } |
| 1461 | 1436 |
| 1462 } // namespace cc | 1437 } // namespace cc |
| OLD | NEW |