| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_LAYERS_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_LAYER_IMPL_H_ | 6 #define CC_LAYERS_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool OpacityCanAnimateOnImplThread() const { return false; } | 100 bool OpacityCanAnimateOnImplThread() const { return false; } |
| 101 | 101 |
| 102 // Tree structure. | 102 // Tree structure. |
| 103 LayerImpl* parent() { return parent_; } | 103 LayerImpl* parent() { return parent_; } |
| 104 LayerImplList& children() { return children_; } | 104 LayerImplList& children() { return children_; } |
| 105 LayerImpl* child_at(size_t index) const { return children_[index]; } | 105 LayerImpl* child_at(size_t index) const { return children_[index]; } |
| 106 void AddChild(std::unique_ptr<LayerImpl> child); | 106 void AddChild(std::unique_ptr<LayerImpl> child); |
| 107 std::unique_ptr<LayerImpl> RemoveChildForTesting(LayerImpl* child); | 107 std::unique_ptr<LayerImpl> RemoveChildForTesting(LayerImpl* child); |
| 108 void SetParent(LayerImpl* parent); | 108 void SetParent(LayerImpl* parent); |
| 109 | 109 |
| 110 void SetScrollParent(LayerImpl* parent); | |
| 111 | |
| 112 LayerImpl* scroll_parent() { return scroll_parent_; } | |
| 113 | |
| 114 void SetScrollChildren(std::set<LayerImpl*>* children); | |
| 115 | |
| 116 std::set<LayerImpl*>* scroll_children() { return scroll_children_.get(); } | |
| 117 const std::set<LayerImpl*>* scroll_children() const { | |
| 118 return scroll_children_.get(); | |
| 119 } | |
| 120 | |
| 121 void DistributeScroll(ScrollState* scroll_state); | 110 void DistributeScroll(ScrollState* scroll_state); |
| 122 void ApplyScroll(ScrollState* scroll_state); | 111 void ApplyScroll(ScrollState* scroll_state); |
| 123 | 112 |
| 124 void set_property_tree_sequence_number(int sequence_number) {} | 113 void set_property_tree_sequence_number(int sequence_number) {} |
| 125 | 114 |
| 126 void SetTransformTreeIndex(int index); | 115 void SetTransformTreeIndex(int index); |
| 127 int transform_tree_index() const { return transform_tree_index_; } | 116 int transform_tree_index() const { return transform_tree_index_; } |
| 128 | 117 |
| 129 void SetClipTreeIndex(int index); | 118 void SetClipTreeIndex(int index); |
| 130 int clip_tree_index() const { return clip_tree_index_; } | 119 int clip_tree_index() const { return clip_tree_index_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 153 | 142 |
| 154 bool is_clipped() const { return draw_properties_.is_clipped; } | 143 bool is_clipped() const { return draw_properties_.is_clipped; } |
| 155 | 144 |
| 156 void UpdatePropertyTreeTransform(); | 145 void UpdatePropertyTreeTransform(); |
| 157 void UpdatePropertyTreeTransformIsAnimated(bool is_animated); | 146 void UpdatePropertyTreeTransformIsAnimated(bool is_animated); |
| 158 void UpdatePropertyTreeOpacity(); | 147 void UpdatePropertyTreeOpacity(); |
| 159 void UpdatePropertyTreeScrollOffset(); | 148 void UpdatePropertyTreeScrollOffset(); |
| 160 | 149 |
| 161 // For compatibility with Layer. | 150 // For compatibility with Layer. |
| 162 bool has_render_surface() const { return !!render_surface(); } | 151 bool has_render_surface() const { return !!render_surface(); } |
| 163 void SetClipParent(LayerImpl* ancestor); | |
| 164 | |
| 165 LayerImpl* clip_parent() { | |
| 166 return clip_parent_; | |
| 167 } | |
| 168 | |
| 169 void SetClipChildren(std::set<LayerImpl*>* children); | |
| 170 | |
| 171 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); } | |
| 172 const std::set<LayerImpl*>* clip_children() const { | |
| 173 return clip_children_.get(); | |
| 174 } | |
| 175 | 152 |
| 176 void PassCopyRequests( | 153 void PassCopyRequests( |
| 177 std::vector<std::unique_ptr<CopyOutputRequest>>* requests); | 154 std::vector<std::unique_ptr<CopyOutputRequest>>* requests); |
| 178 // Can only be called when the layer has a copy request. | 155 // Can only be called when the layer has a copy request. |
| 179 void TakeCopyRequestsAndTransformToTarget( | 156 void TakeCopyRequestsAndTransformToTarget( |
| 180 std::vector<std::unique_ptr<CopyOutputRequest>>* request); | 157 std::vector<std::unique_ptr<CopyOutputRequest>>* request); |
| 181 bool HasCopyRequest() const { return !copy_requests_.empty(); } | 158 bool HasCopyRequest() const { return !copy_requests_.empty(); } |
| 182 bool InsideCopyRequest() const; | 159 bool InsideCopyRequest() const; |
| 183 | 160 |
| 184 void SetMaskLayer(std::unique_ptr<LayerImpl> mask_layer); | 161 void SetMaskLayer(std::unique_ptr<LayerImpl> mask_layer); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 557 |
| 581 void NoteLayerPropertyChangedForDescendantsInternal(); | 558 void NoteLayerPropertyChangedForDescendantsInternal(); |
| 582 void PushLayerPropertyChangedForSubtreeInternal(); | 559 void PushLayerPropertyChangedForSubtreeInternal(); |
| 583 | 560 |
| 584 virtual const char* LayerTypeAsString() const; | 561 virtual const char* LayerTypeAsString() const; |
| 585 | 562 |
| 586 // Properties internal to LayerImpl | 563 // Properties internal to LayerImpl |
| 587 LayerImpl* parent_; | 564 LayerImpl* parent_; |
| 588 LayerImplList children_; | 565 LayerImplList children_; |
| 589 | 566 |
| 590 LayerImpl* scroll_parent_; | |
| 591 | |
| 592 // Storing a pointer to a set rather than a set since this will be rarely | |
| 593 // used. If this pointer turns out to be too heavy, we could have this (and | |
| 594 // the scroll parent above) be stored in a LayerImpl -> scroll_info | |
| 595 // map somewhere. | |
| 596 std::unique_ptr<std::set<LayerImpl*>> scroll_children_; | |
| 597 | |
| 598 LayerImpl* clip_parent_; | |
| 599 std::unique_ptr<std::set<LayerImpl*>> clip_children_; | |
| 600 | |
| 601 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to | 567 // mask_layer_ can be temporarily stolen during tree sync, we need this ID to |
| 602 // confirm newly assigned layer is still the previous one | 568 // confirm newly assigned layer is still the previous one |
| 603 int mask_layer_id_; | 569 int mask_layer_id_; |
| 604 LayerImpl* mask_layer_; | 570 LayerImpl* mask_layer_; |
| 605 int replica_layer_id_; // ditto | 571 int replica_layer_id_; // ditto |
| 606 LayerImpl* replica_layer_; | 572 LayerImpl* replica_layer_; |
| 607 int layer_id_; | 573 int layer_id_; |
| 608 LayerTreeImpl* layer_tree_impl_; | 574 LayerTreeImpl* layer_tree_impl_; |
| 609 | 575 |
| 610 std::unique_ptr<LayerImplTestProperties> test_properties_; | 576 std::unique_ptr<LayerImplTestProperties> test_properties_; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 bool scrolls_drawn_descendant_; | 664 bool scrolls_drawn_descendant_; |
| 699 // If true, the layer or one of its descendants has a touch handler. | 665 // If true, the layer or one of its descendants has a touch handler. |
| 700 bool layer_or_descendant_has_touch_handler_; | 666 bool layer_or_descendant_has_touch_handler_; |
| 701 | 667 |
| 702 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 668 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 703 }; | 669 }; |
| 704 | 670 |
| 705 } // namespace cc | 671 } // namespace cc |
| 706 | 672 |
| 707 #endif // CC_LAYERS_LAYER_IMPL_H_ | 673 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |