| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void MoveChangeTrackingToLayers(); | 157 void MoveChangeTrackingToLayers(); |
| 158 | 158 |
| 159 LayerListIterator<LayerImpl> begin(); | 159 LayerListIterator<LayerImpl> begin(); |
| 160 LayerListIterator<LayerImpl> end(); | 160 LayerListIterator<LayerImpl> end(); |
| 161 LayerListReverseIterator<LayerImpl> rbegin(); | 161 LayerListReverseIterator<LayerImpl> rbegin(); |
| 162 LayerListReverseIterator<LayerImpl> rend(); | 162 LayerListReverseIterator<LayerImpl> rend(); |
| 163 | 163 |
| 164 // TODO(thakis): Consider marking this CC_EXPORT once we understand | 164 // TODO(thakis): Consider marking this CC_EXPORT once we understand |
| 165 // http://crbug.com/575700 better. | 165 // http://crbug.com/575700 better. |
| 166 struct ElementLayers { | 166 struct ElementLayers { |
| 167 // Transform and opacity mutations apply to this layer. | 167 // Transform, filter and opacity mutations apply to this layer. |
| 168 LayerImpl* main = nullptr; | 168 LayerImpl* main = nullptr; |
| 169 // Scroll mutations apply to this layer. | 169 // Scroll mutations apply to this layer. |
| 170 LayerImpl* scroll = nullptr; | 170 LayerImpl* scroll = nullptr; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 void RegisterLayerForElementId(LayerImpl* layer); |
| 174 void UnregisterLayerForElementId(LayerImpl* layer); |
| 173 void AddToElementMap(LayerImpl* layer); | 175 void AddToElementMap(LayerImpl* layer); |
| 174 void RemoveFromElementMap(LayerImpl* layer); | 176 void RemoveFromElementMap(LayerImpl* layer); |
| 175 ElementLayers GetMutableLayers(uint64_t element_id); | 177 ElementLayers GetMutableLayers(ElementId element_id); |
| 176 int source_frame_number() const { return source_frame_number_; } | 178 int source_frame_number() const { return source_frame_number_; } |
| 177 void set_source_frame_number(int frame_number) { | 179 void set_source_frame_number(int frame_number) { |
| 178 source_frame_number_ = frame_number; | 180 source_frame_number_ = frame_number; |
| 179 } | 181 } |
| 180 | 182 |
| 181 bool is_first_frame_after_commit() const { | 183 bool is_first_frame_after_commit() const { |
| 182 return source_frame_number_ != is_first_frame_after_commit_tracker_; | 184 return source_frame_number_ != is_first_frame_after_commit_tracker_; |
| 183 } | 185 } |
| 184 | 186 |
| 185 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) { | 187 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 const Region& UnoccludedScreenSpaceRegion() const; | 301 const Region& UnoccludedScreenSpaceRegion() const; |
| 300 | 302 |
| 301 // These return the size of the root scrollable area and the size of | 303 // These return the size of the root scrollable area and the size of |
| 302 // the user-visible scrolling viewport, in CSS layout coordinates. | 304 // the user-visible scrolling viewport, in CSS layout coordinates. |
| 303 gfx::SizeF ScrollableSize() const; | 305 gfx::SizeF ScrollableSize() const; |
| 304 gfx::SizeF ScrollableViewportSize() const; | 306 gfx::SizeF ScrollableViewportSize() const; |
| 305 | 307 |
| 306 gfx::Rect RootScrollLayerDeviceViewportBounds() const; | 308 gfx::Rect RootScrollLayerDeviceViewportBounds() const; |
| 307 | 309 |
| 308 LayerImpl* LayerById(int id) const; | 310 LayerImpl* LayerById(int id) const; |
| 311 LayerImpl* LayerForElementId(ElementId element_id) const; |
| 312 LayerImpl* ScrollLayerForElementId(ElementId element_id) const; |
| 313 bool HasAnyLayerForElementId(ElementId element_id) const; |
| 309 | 314 |
| 310 void AddLayerShouldPushProperties(LayerImpl* layer); | 315 void AddLayerShouldPushProperties(LayerImpl* layer); |
| 311 void RemoveLayerShouldPushProperties(LayerImpl* layer); | 316 void RemoveLayerShouldPushProperties(LayerImpl* layer); |
| 312 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); | 317 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); |
| 313 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); | 318 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); |
| 314 | 319 |
| 315 // These should be called by LayerImpl's ctor/dtor. | 320 // These should be called by LayerImpl's ctor/dtor. |
| 316 void RegisterLayer(LayerImpl* layer); | 321 void RegisterLayer(LayerImpl* layer); |
| 317 void UnregisterLayer(LayerImpl* layer); | 322 void UnregisterLayer(LayerImpl* layer); |
| 318 | 323 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 float min_page_scale_factor_; | 529 float min_page_scale_factor_; |
| 525 float max_page_scale_factor_; | 530 float max_page_scale_factor_; |
| 526 | 531 |
| 527 float device_scale_factor_; | 532 float device_scale_factor_; |
| 528 float painted_device_scale_factor_; | 533 float painted_device_scale_factor_; |
| 529 | 534 |
| 530 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; | 535 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; |
| 531 | 536 |
| 532 std::unique_ptr<OwnedLayerImplList> layers_; | 537 std::unique_ptr<OwnedLayerImplList> layers_; |
| 533 LayerImplMap layer_id_map_; | 538 LayerImplMap layer_id_map_; |
| 539 |
| 540 using ElementIdToLayerMap = std::unordered_map<ElementId, ElementLayers>; |
| 541 ElementIdToLayerMap element_id_to_layer_map_; |
| 542 // TODO(loyso): Unify it with element_id_to_layer_map_. |
| 543 std::unordered_map<ElementId, ElementLayers> element_layers_map_; |
| 544 |
| 534 // Set of layers that need to push properties. | 545 // Set of layers that need to push properties. |
| 535 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; | 546 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; |
| 536 | 547 |
| 537 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; | |
| 538 | |
| 539 // Maps from clip layer ids to scroll layer ids. Note that this only includes | 548 // Maps from clip layer ids to scroll layer ids. Note that this only includes |
| 540 // the subset of clip layers that act as scrolling containers. (This is | 549 // the subset of clip layers that act as scrolling containers. (This is |
| 541 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) | 550 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) |
| 542 std::unordered_map<int, int> clip_scroll_map_; | 551 std::unordered_map<int, int> clip_scroll_map_; |
| 543 | 552 |
| 544 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there | 553 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there |
| 545 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is | 554 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is |
| 546 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid | 555 // derived from ScrollbarLayerImplBase::scroll_layer_id_ and exists to avoid |
| 547 // O(n) walks.) | 556 // O(n) walks.) |
| 548 std::multimap<int, int> scrollbar_map_; | 557 std::multimap<int, int> scrollbar_map_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 597 |
| 589 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 598 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 590 | 599 |
| 591 private: | 600 private: |
| 592 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 601 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
| 593 }; | 602 }; |
| 594 | 603 |
| 595 } // namespace cc | 604 } // namespace cc |
| 596 | 605 |
| 597 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 606 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
| OLD | NEW |