OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CC_TREES_PROPERTY_TREE_H_ | 5 #ifndef CC_TREES_PROPERTY_TREE_H_ |
6 #define CC_TREES_PROPERTY_TREE_H_ | 6 #define CC_TREES_PROPERTY_TREE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "cc/animation/element_id.h" | 14 #include "cc/animation/element_id.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/base/synced_property.h" | 16 #include "cc/base/synced_property.h" |
17 #include "cc/layers/layer_sticky_position_constraint.h" | |
17 #include "cc/output/filter_operations.h" | 18 #include "cc/output/filter_operations.h" |
18 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
19 #include "ui/gfx/geometry/scroll_offset.h" | 20 #include "ui/gfx/geometry/scroll_offset.h" |
20 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 namespace trace_event { | 24 namespace trace_event { |
24 class TracedValue; | 25 class TracedValue; |
25 } | 26 } |
26 } | 27 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 116 |
116 void AsValueInto(base::trace_event::TracedValue* value) const; | 117 void AsValueInto(base::trace_event::TracedValue* value) const; |
117 | 118 |
118 private: | 119 private: |
119 std::vector<T> nodes_; | 120 std::vector<T> nodes_; |
120 | 121 |
121 bool needs_update_; | 122 bool needs_update_; |
122 PropertyTrees* property_trees_; | 123 PropertyTrees* property_trees_; |
123 }; | 124 }; |
124 | 125 |
126 struct StickyPositionNodeData { | |
127 int scroll_ancestor; | |
128 LayerStickyPositionConstraint constraints; | |
129 gfx::Vector2dF main_thread_offset; | |
ajuma
2016/09/08 22:08:54
Please add a comment explaining what this represen
flackr
2016/09/20 17:08:13
Done.
| |
130 | |
131 StickyPositionNodeData() : scroll_ancestor(-1) {} | |
132 }; | |
133 | |
125 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { | 134 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { |
126 public: | 135 public: |
127 TransformTree(); | 136 TransformTree(); |
128 | 137 |
129 // These C++ special member functions cannot be implicit inline because | 138 // These C++ special member functions cannot be implicit inline because |
130 // they are exported by CC_EXPORT. They will be instantiated in every | 139 // they are exported by CC_EXPORT. They will be instantiated in every |
131 // compilation units that included this header, and compilation can fail | 140 // compilation units that included this header, and compilation can fail |
132 // because TransformCachedNodeData may be incomplete. | 141 // because TransformCachedNodeData may be incomplete. |
133 TransformTree(const TransformTree&) = delete; | 142 TransformTree(const TransformTree&) = delete; |
134 ~TransformTree(); | 143 ~TransformTree(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 int TargetId(int node_id) const; | 257 int TargetId(int node_id) const; |
249 void SetTargetId(int node_id, int target_id); | 258 void SetTargetId(int node_id, int target_id); |
250 | 259 |
251 int ContentTargetId(int node_id) const; | 260 int ContentTargetId(int node_id) const; |
252 void SetContentTargetId(int node_id, int content_target_id); | 261 void SetContentTargetId(int node_id, int content_target_id); |
253 | 262 |
254 const std::vector<TransformCachedNodeData>& cached_data() const { | 263 const std::vector<TransformCachedNodeData>& cached_data() const { |
255 return cached_data_; | 264 return cached_data_; |
256 } | 265 } |
257 | 266 |
267 StickyPositionNodeData* StickyPositionData(int node_id); | |
268 void SetNotSticky(int node_id); | |
269 | |
258 void ToProtobuf(proto::PropertyTree* proto) const; | 270 void ToProtobuf(proto::PropertyTree* proto) const; |
259 void FromProtobuf(const proto::PropertyTree& proto, | 271 void FromProtobuf(const proto::PropertyTree& proto, |
260 std::unordered_map<int, int>* node_id_to_index_map); | 272 std::unordered_map<int, int>* node_id_to_index_map); |
261 | 273 |
262 // Computes the combined transform between |source_id| and |dest_id|. These | 274 // Computes the combined transform between |source_id| and |dest_id|. These |
263 // two nodes must be on the same ancestor chain. | 275 // two nodes must be on the same ancestor chain. |
264 void CombineTransformsBetween(int source_id, | 276 void CombineTransformsBetween(int source_id, |
265 int dest_id, | 277 int dest_id, |
266 gfx::Transform* transform) const; | 278 gfx::Transform* transform) const; |
267 | 279 |
(...skipping 28 matching lines...) Expand all Loading... | |
296 bool source_to_parent_updates_allowed_; | 308 bool source_to_parent_updates_allowed_; |
297 // When to_screen transform has perspective, the transform node's sublayer | 309 // When to_screen transform has perspective, the transform node's sublayer |
298 // scale is calculated using page scale factor, device scale factor and the | 310 // scale is calculated using page scale factor, device scale factor and the |
299 // scale factor of device transform. So we need to store them explicitly. | 311 // scale factor of device transform. So we need to store them explicitly. |
300 float page_scale_factor_; | 312 float page_scale_factor_; |
301 float device_scale_factor_; | 313 float device_scale_factor_; |
302 float device_transform_scale_factor_; | 314 float device_transform_scale_factor_; |
303 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; | 315 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; |
304 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; | 316 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; |
305 std::vector<TransformCachedNodeData> cached_data_; | 317 std::vector<TransformCachedNodeData> cached_data_; |
318 std::vector<StickyPositionNodeData> sticky_position_data_; | |
319 std::vector<int> sticky_position_data_free_ids_; | |
306 }; | 320 }; |
307 | 321 |
308 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { | 322 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { |
309 public: | 323 public: |
310 bool operator==(const ClipTree& other) const; | 324 bool operator==(const ClipTree& other) const; |
311 | 325 |
312 static const int kViewportNodeId = 1; | 326 static const int kViewportNodeId = 1; |
313 | 327 |
314 void SetViewportClip(gfx::RectF viewport_rect); | 328 void SetViewportClip(gfx::RectF viewport_rect); |
315 gfx::RectF ViewportClip(); | 329 gfx::RectF ViewportClip(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 gfx::Vector2dF inner_viewport_container_bounds_delta_; | 636 gfx::Vector2dF inner_viewport_container_bounds_delta_; |
623 gfx::Vector2dF outer_viewport_container_bounds_delta_; | 637 gfx::Vector2dF outer_viewport_container_bounds_delta_; |
624 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; | 638 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; |
625 | 639 |
626 PropertyTreesCachedData cached_data_; | 640 PropertyTreesCachedData cached_data_; |
627 }; | 641 }; |
628 | 642 |
629 } // namespace cc | 643 } // namespace cc |
630 | 644 |
631 #endif // CC_TREES_PROPERTY_TREE_H_ | 645 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |