| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 T* parent(const T* t) { return Node(t->parent_id); } | 76 T* parent(const T* t) { return Node(t->parent_id); } |
| 77 const T* parent(const T* t) const { return Node(t->parent_id); } | 77 const T* parent(const T* t) const { return Node(t->parent_id); } |
| 78 | 78 |
| 79 T* back() { return size() ? &nodes_.back() : nullptr; } | 79 T* back() { return size() ? &nodes_.back() : nullptr; } |
| 80 const T* back() const { return size() ? &nodes_.back() : nullptr; } | 80 const T* back() const { return size() ? &nodes_.back() : nullptr; } |
| 81 | 81 |
| 82 void clear(); | 82 void clear(); |
| 83 size_t size() const { return nodes_.size(); } | 83 size_t size() const { return nodes_.size(); } |
| 84 | 84 |
| 85 void set_needs_update(bool needs_update) { needs_update_ = needs_update; } | 85 virtual void set_needs_update(bool needs_update) { |
| 86 needs_update_ = needs_update; |
| 87 } |
| 86 bool needs_update() const { return needs_update_; } | 88 bool needs_update() const { return needs_update_; } |
| 87 | 89 |
| 88 std::vector<T>& nodes() { return nodes_; } | 90 std::vector<T>& nodes() { return nodes_; } |
| 89 const std::vector<T>& nodes() const { return nodes_; } | 91 const std::vector<T>& nodes() const { return nodes_; } |
| 90 | 92 |
| 91 int next_available_id() const { return static_cast<int>(size()); } | 93 int next_available_id() const { return static_cast<int>(size()); } |
| 92 | 94 |
| 93 void SetPropertyTrees(PropertyTrees* property_trees) { | 95 void SetPropertyTrees(PropertyTrees* property_trees) { |
| 94 property_trees_ = property_trees; | 96 property_trees_ = property_trees; |
| 95 } | 97 } |
| 96 PropertyTrees* property_trees() const { return property_trees_; } | 98 PropertyTrees* property_trees() const { return property_trees_; } |
| 97 | 99 |
| 98 void AsValueInto(base::trace_event::TracedValue* value) const; | 100 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 99 | 101 |
| 100 T* FindNodeFromOwningLayerId(int id) { | 102 const T* FindNodeFromOwningLayerId(int id) const { |
| 101 return Node(FindNodeIndexFromOwningLayerId(id)); | 103 return Node(FindNodeIndexFromOwningLayerId(id)); |
| 102 } | 104 } |
| 105 T* UpdateNodeFromOwningLayerId(int id) { |
| 106 int index = FindNodeIndexFromOwningLayerId(id); |
| 107 if (index == kInvalidNodeId && property_trees()->is_main_thread) { |
| 108 property_trees()->needs_rebuild = true; |
| 109 } |
| 110 |
| 111 return Node(index); |
| 112 } |
| 113 |
| 103 int FindNodeIndexFromOwningLayerId(int id) const { | 114 int FindNodeIndexFromOwningLayerId(int id) const { |
| 104 auto iter = owning_layer_id_to_node_index.find(id); | 115 auto iter = owning_layer_id_to_node_index.find(id); |
| 105 if (iter == owning_layer_id_to_node_index.end()) | 116 if (iter == owning_layer_id_to_node_index.end()) |
| 106 return kInvalidNodeId; | 117 return kInvalidNodeId; |
| 107 else | 118 else |
| 108 return iter->second; | 119 return iter->second; |
| 109 } | 120 } |
| 110 | 121 |
| 111 void SetOwningLayerIdForNode(const T* node, int id) { | 122 void SetOwningLayerIdForNode(const T* node, int id) { |
| 112 if (!node) { | 123 if (!node) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 void ResetChangeTracking(); | 187 void ResetChangeTracking(); |
| 177 // Updates the parent, target, and screen space transforms and snapping. | 188 // Updates the parent, target, and screen space transforms and snapping. |
| 178 void UpdateTransforms(int id); | 189 void UpdateTransforms(int id); |
| 179 void UpdateTransformChanged(TransformNode* node, | 190 void UpdateTransformChanged(TransformNode* node, |
| 180 TransformNode* parent_node, | 191 TransformNode* parent_node, |
| 181 TransformNode* source_node); | 192 TransformNode* source_node); |
| 182 void UpdateNodeAndAncestorsAreAnimatedOrInvertible( | 193 void UpdateNodeAndAncestorsAreAnimatedOrInvertible( |
| 183 TransformNode* node, | 194 TransformNode* node, |
| 184 TransformNode* parent_node); | 195 TransformNode* parent_node); |
| 185 | 196 |
| 186 void set_needs_update(bool needs_update); | 197 void set_needs_update(bool needs_update) final; |
| 187 | 198 |
| 188 // A TransformNode's source_to_parent value is used to account for the fact | 199 // A TransformNode's source_to_parent value is used to account for the fact |
| 189 // that fixed-position layers are positioned by Blink wrt to their layer tree | 200 // that fixed-position layers are positioned by Blink wrt to their layer tree |
| 190 // parent (their "source"), but are parented in the transform tree by their | 201 // parent (their "source"), but are parented in the transform tree by their |
| 191 // fixed-position container. This value needs to be updated on main-thread | 202 // fixed-position container. This value needs to be updated on main-thread |
| 192 // property trees (for position changes initiated by Blink), but not on the | 203 // property trees (for position changes initiated by Blink), but not on the |
| 193 // compositor thread (since the offset from a node corresponding to a | 204 // compositor thread (since the offset from a node corresponding to a |
| 194 // fixed-position layer to its fixed-position container is unaffected by | 205 // fixed-position layer to its fixed-position container is unaffected by |
| 195 // compositor-driven effects). | 206 // compositor-driven effects). |
| 196 void set_source_to_parent_updates_allowed(bool allowed) { | 207 void set_source_to_parent_updates_allowed(bool allowed) { |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; | 688 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; |
| 678 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, | 689 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, |
| 679 int effect_id) const; | 690 int effect_id) const; |
| 680 | 691 |
| 681 PropertyTreesCachedData cached_data_; | 692 PropertyTreesCachedData cached_data_; |
| 682 }; | 693 }; |
| 683 | 694 |
| 684 } // namespace cc | 695 } // namespace cc |
| 685 | 696 |
| 686 #endif // CC_TREES_PROPERTY_TREE_H_ | 697 #endif // CC_TREES_PROPERTY_TREE_H_ |
| OLD | NEW |