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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 106 |
107 struct StickyPositionNodeData { | 107 struct StickyPositionNodeData { |
108 int scroll_ancestor; | 108 int scroll_ancestor; |
109 LayerStickyPositionConstraint constraints; | 109 LayerStickyPositionConstraint constraints; |
110 | 110 |
111 // This is the offset that blink has already applied to counteract the main | 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 | 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. | 113 // by computing the additional offset necessary to keep the element stuck. |
114 gfx::Vector2dF main_thread_offset; | 114 gfx::Vector2dF main_thread_offset; |
115 | 115 |
116 StickyPositionNodeData() : scroll_ancestor(-1) {} | 116 // In order to properly compute the sticky offset, we need to know if we have |
117 // any sticky ancestors both between ourselves and our containing block and | |
118 // between our containing block and the viewport. These ancestors are then | |
119 // used to correct the constraining rect locations. | |
120 int nearest_node_shifting_sticky_box; | |
121 int nearest_node_shifting_containing_block; | |
122 | |
123 // For performance we cache our accumulated sticky offset to allow descendant | |
124 // sticky elements to offset their constraint rects. Because we can either | |
125 // affect the sticky box constraint rect or the containing block constraint | |
126 // rect, we need to accumulate both. | |
127 gfx::Vector2dF total_sticky_box_sticky_offset; | |
128 gfx::Vector2dF total_containing_block_sticky_offset; | |
129 | |
130 StickyPositionNodeData() | |
131 : scroll_ancestor(-1), | |
flackr
2017/03/17 18:04:08
nit: Can we change these ids to kInvalidNodeId?
smcgruer
2017/03/17 18:42:42
Done.
| |
132 nearest_node_shifting_sticky_box(-1), | |
133 nearest_node_shifting_containing_block(-1) {} | |
117 }; | 134 }; |
118 | 135 |
119 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { | 136 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { |
120 public: | 137 public: |
121 TransformTree(); | 138 TransformTree(); |
122 | 139 |
123 // These C++ special member functions cannot be implicit inline because | 140 // These C++ special member functions cannot be implicit inline because |
124 // they are exported by CC_EXPORT. They will be instantiated in every | 141 // they are exported by CC_EXPORT. They will be instantiated in every |
125 // compilation units that included this header, and compilation can fail | 142 // compilation units that included this header, and compilation can fail |
126 // because TransformCachedNodeData may be incomplete. | 143 // because TransformCachedNodeData may be incomplete. |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; | 679 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; |
663 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, | 680 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, |
664 int effect_id) const; | 681 int effect_id) const; |
665 | 682 |
666 PropertyTreesCachedData cached_data_; | 683 PropertyTreesCachedData cached_data_; |
667 }; | 684 }; |
668 | 685 |
669 } // namespace cc | 686 } // namespace cc |
670 | 687 |
671 #endif // CC_TREES_PROPERTY_TREE_H_ | 688 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |