| 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> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 void AsValueInto(base::trace_event::TracedValue* value) const; | 98 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 std::vector<T> nodes_; | 101 std::vector<T> nodes_; |
| 102 | 102 |
| 103 bool needs_update_; | 103 bool needs_update_; |
| 104 PropertyTrees* property_trees_; | 104 PropertyTrees* property_trees_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 struct StickyPositionNodeData { | 107 struct StickyPositionNodeData; |
| 108 int scroll_ancestor; | |
| 109 LayerStickyPositionConstraint constraints; | |
| 110 | |
| 111 // This is the offset that blink has already applied to counteract the main | |
| 112 // thread scroll offset of the scroll ancestor. We need to account for this | |
| 113 // by computing the additional offset necessary to keep the element stuck. | |
| 114 gfx::Vector2dF main_thread_offset; | |
| 115 | |
| 116 StickyPositionNodeData() : scroll_ancestor(-1) {} | |
| 117 }; | |
| 118 | 108 |
| 119 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { | 109 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { |
| 120 public: | 110 public: |
| 121 TransformTree(); | 111 TransformTree(); |
| 122 | 112 |
| 123 // These C++ special member functions cannot be implicit inline because | 113 // These C++ special member functions cannot be implicit inline because |
| 124 // they are exported by CC_EXPORT. They will be instantiated in every | 114 // they are exported by CC_EXPORT. They will be instantiated in every |
| 125 // compilation units that included this header, and compilation can fail | 115 // compilation units that included this header, and compilation can fail |
| 126 // because TransformCachedNodeData may be incomplete. | 116 // because TransformCachedNodeData may be incomplete. |
| 127 TransformTree(const TransformTree&) = delete; | 117 TransformTree(const TransformTree&) = delete; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // scale factor of device transform. So we need to store them explicitly. | 260 // scale factor of device transform. So we need to store them explicitly. |
| 271 float page_scale_factor_; | 261 float page_scale_factor_; |
| 272 float device_scale_factor_; | 262 float device_scale_factor_; |
| 273 float device_transform_scale_factor_; | 263 float device_transform_scale_factor_; |
| 274 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; | 264 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; |
| 275 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; | 265 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; |
| 276 std::vector<TransformCachedNodeData> cached_data_; | 266 std::vector<TransformCachedNodeData> cached_data_; |
| 277 std::vector<StickyPositionNodeData> sticky_position_data_; | 267 std::vector<StickyPositionNodeData> sticky_position_data_; |
| 278 }; | 268 }; |
| 279 | 269 |
| 270 struct StickyPositionNodeData { |
| 271 int scroll_ancestor; |
| 272 LayerStickyPositionConstraint constraints; |
| 273 |
| 274 // This is the offset that blink has already applied to counteract the main |
| 275 // thread scroll offset of the scroll ancestor. We need to account for this |
| 276 // by computing the additional offset necessary to keep the element stuck. |
| 277 gfx::Vector2dF main_thread_offset; |
| 278 |
| 279 // In order to properly compute the sticky offset, we need to know if we have |
| 280 // any sticky ancestors both between ourselves and our containing block and |
| 281 // between our containing block and the viewport. These ancestors are then |
| 282 // used to correct the constraining rect locations. |
| 283 int nearest_node_shifting_sticky_box; |
| 284 int nearest_node_shifting_containing_block; |
| 285 |
| 286 // For performance we cache our accumulated sticky offset to allow descendant |
| 287 // sticky elements to offset their constraint rects. Because we can either |
| 288 // affect the sticky box constraint rect or the containing block constraint |
| 289 // rect, we need to accumulate both. |
| 290 gfx::Vector2dF total_sticky_box_sticky_offset; |
| 291 gfx::Vector2dF total_containing_block_sticky_offset; |
| 292 |
| 293 StickyPositionNodeData() |
| 294 : scroll_ancestor(TransformTree::kInvalidNodeId), |
| 295 nearest_node_shifting_sticky_box(TransformTree::kInvalidNodeId), |
| 296 nearest_node_shifting_containing_block(TransformTree::kInvalidNodeId) {} |
| 297 }; |
| 298 |
| 280 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { | 299 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { |
| 281 public: | 300 public: |
| 282 bool operator==(const ClipTree& other) const; | 301 bool operator==(const ClipTree& other) const; |
| 283 | 302 |
| 284 static const int kViewportNodeId = 1; | 303 static const int kViewportNodeId = 1; |
| 285 | 304 |
| 286 void SetViewportClip(gfx::RectF viewport_rect); | 305 void SetViewportClip(gfx::RectF viewport_rect); |
| 287 gfx::RectF ViewportClip() const; | 306 gfx::RectF ViewportClip() const; |
| 288 }; | 307 }; |
| 289 | 308 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; | 681 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; |
| 663 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, | 682 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, |
| 664 int effect_id) const; | 683 int effect_id) const; |
| 665 | 684 |
| 666 PropertyTreesCachedData cached_data_; | 685 PropertyTreesCachedData cached_data_; |
| 667 }; | 686 }; |
| 668 | 687 |
| 669 } // namespace cc | 688 } // namespace cc |
| 670 | 689 |
| 671 #endif // CC_TREES_PROPERTY_TREE_H_ | 690 #endif // CC_TREES_PROPERTY_TREE_H_ |
| OLD | NEW |