| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_LAYER_TREE_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ |
| 6 #define CC_TREES_LAYER_TREE_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 LayerListReverseIterator<LayerImpl> rbegin(); | 161 LayerListReverseIterator<LayerImpl> rbegin(); |
| 162 LayerListReverseIterator<LayerImpl> rend(); | 162 LayerListReverseIterator<LayerImpl> rend(); |
| 163 | 163 |
| 164 struct CC_EXPORT ElementLayers { | 164 struct CC_EXPORT ElementLayers { |
| 165 // Transform and opacity mutations apply to this layer. | 165 // Transform and opacity mutations apply to this layer. |
| 166 LayerImpl* main = nullptr; | 166 LayerImpl* main = nullptr; |
| 167 // Scroll mutations apply to this layer. | 167 // Scroll mutations apply to this layer. |
| 168 LayerImpl* scroll = nullptr; | 168 LayerImpl* scroll = nullptr; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 struct CC_EXPORT PropertyTreeIndices { |
| 172 int transform_tree_index = -1; |
| 173 int effect_tree_index = -1; |
| 174 int clip_tree_index = -1; |
| 175 int scroll_tree_index = -1; |
| 176 }; |
| 177 |
| 171 void AddToElementMap(LayerImpl* layer); | 178 void AddToElementMap(LayerImpl* layer); |
| 172 void RemoveFromElementMap(LayerImpl* layer); | 179 void RemoveFromElementMap(LayerImpl* layer); |
| 173 | 180 |
| 174 void AddToOpacityAnimationsMap(int id, float opacity); | 181 void AddToOpacityAnimationsMap(int id, float opacity); |
| 175 | 182 |
| 183 void UpdateLayerToPropertyTreeIndicesMap(int id, |
| 184 int tree_index, |
| 185 PropertyTrees::Types tree_type); |
| 186 void RemoveFromLayerToPropertyTreeIndicesMap(int id); |
| 187 |
| 176 ElementLayers GetMutableLayers(uint64_t element_id); | 188 ElementLayers GetMutableLayers(uint64_t element_id); |
| 177 int source_frame_number() const { return source_frame_number_; } | 189 int source_frame_number() const { return source_frame_number_; } |
| 178 void set_source_frame_number(int frame_number) { | 190 void set_source_frame_number(int frame_number) { |
| 179 source_frame_number_ = frame_number; | 191 source_frame_number_ = frame_number; |
| 180 } | 192 } |
| 181 | 193 |
| 182 bool is_first_frame_after_commit() const { | 194 bool is_first_frame_after_commit() const { |
| 183 return source_frame_number_ != is_first_frame_after_commit_tracker_; | 195 return source_frame_number_ != is_first_frame_after_commit_tracker_; |
| 184 } | 196 } |
| 185 | 197 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 EventListenerProperties event_listener_properties( | 491 EventListenerProperties event_listener_properties( |
| 480 EventListenerClass event_class) const { | 492 EventListenerClass event_class) const { |
| 481 return event_listener_properties_[static_cast<size_t>(event_class)]; | 493 return event_listener_properties_[static_cast<size_t>(event_class)]; |
| 482 } | 494 } |
| 483 void set_event_listener_properties(EventListenerClass event_class, | 495 void set_event_listener_properties(EventListenerClass event_class, |
| 484 EventListenerProperties event_properties) { | 496 EventListenerProperties event_properties) { |
| 485 event_listener_properties_[static_cast<size_t>(event_class)] = | 497 event_listener_properties_[static_cast<size_t>(event_class)] = |
| 486 event_properties; | 498 event_properties; |
| 487 } | 499 } |
| 488 | 500 |
| 489 void ResetAllChangeTracking(PropertyTrees::ResetFlags flag); | 501 void ResetAllChangeTracking(PropertyTrees::Types type); |
| 490 | 502 |
| 491 protected: | 503 protected: |
| 492 explicit LayerTreeImpl( | 504 explicit LayerTreeImpl( |
| 493 LayerTreeHostImpl* layer_tree_host_impl, | 505 LayerTreeHostImpl* layer_tree_host_impl, |
| 494 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 506 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
| 495 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, | 507 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
| 496 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); | 508 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); |
| 497 float ClampPageScaleFactorToLimits(float page_scale_factor) const; | 509 float ClampPageScaleFactorToLimits(float page_scale_factor) const; |
| 498 void PushPageScaleFactorAndLimits(const float* page_scale_factor, | 510 void PushPageScaleFactorAndLimits(const float* page_scale_factor, |
| 499 float min_page_scale_factor, | 511 float min_page_scale_factor, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 544 |
| 533 std::unique_ptr<OwnedLayerImplList> layers_; | 545 std::unique_ptr<OwnedLayerImplList> layers_; |
| 534 LayerImplMap layer_id_map_; | 546 LayerImplMap layer_id_map_; |
| 535 // Set of layers that need to push properties. | 547 // Set of layers that need to push properties. |
| 536 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; | 548 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; |
| 537 | 549 |
| 538 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; | 550 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; |
| 539 | 551 |
| 540 std::unordered_map<int, float> opacity_animations_map_; | 552 std::unordered_map<int, float> opacity_animations_map_; |
| 541 | 553 |
| 554 std::unordered_map<int, PropertyTreeIndices> |
| 555 layer_to_property_tree_indices_map_; |
| 556 |
| 542 // Maps from clip layer ids to scroll layer ids. Note that this only includes | 557 // Maps from clip layer ids to scroll layer ids. Note that this only includes |
| 543 // the subset of clip layers that act as scrolling containers. (This is | 558 // the subset of clip layers that act as scrolling containers. (This is |
| 544 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) | 559 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) |
| 545 std::unordered_map<int, int> clip_scroll_map_; | 560 std::unordered_map<int, int> clip_scroll_map_; |
| 546 | 561 |
| 547 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there | 562 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there |
| 548 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is | 563 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is |
| 549 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid | 564 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid |
| 550 // O(n) walks.) | 565 // O(n) walks.) |
| 551 std::multimap<int, int> scrollbar_map_; | 566 std::multimap<int, int> scrollbar_map_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 606 |
| 592 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 607 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 593 | 608 |
| 594 private: | 609 private: |
| 595 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 610 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
| 596 }; | 611 }; |
| 597 | 612 |
| 598 } // namespace cc | 613 } // namespace cc |
| 599 | 614 |
| 600 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 615 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
| OLD | NEW |