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