Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: cc/trees/layer_tree_impl.h

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get element id's from scroll node data directly. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 void PushPropertiesTo(LayerTreeImpl* tree_impl); 147 void PushPropertiesTo(LayerTreeImpl* tree_impl);
148 148
149 void MoveChangeTrackingToLayers(); 149 void MoveChangeTrackingToLayers();
150 150
151 LayerListIterator<LayerImpl> begin(); 151 LayerListIterator<LayerImpl> begin();
152 LayerListIterator<LayerImpl> end(); 152 LayerListIterator<LayerImpl> end();
153 LayerListReverseIterator<LayerImpl> rbegin(); 153 LayerListReverseIterator<LayerImpl> rbegin();
154 LayerListReverseIterator<LayerImpl> rend(); 154 LayerListReverseIterator<LayerImpl> rend();
155 155
156 struct CC_EXPORT ElementLayers {
157 // Transform and opacity mutations apply to this layer.
158 LayerImpl* main = nullptr;
159 // Scroll mutations apply to this layer.
160 LayerImpl* scroll = nullptr;
161 };
162
163 void AddToElementMap(LayerImpl* layer);
164 void RemoveFromElementMap(LayerImpl* layer);
165
166 void AddToOpacityAnimationsMap(int id, float opacity); 156 void AddToOpacityAnimationsMap(int id, float opacity);
167 157
168 ElementLayers GetMutableLayers(uint64_t element_id);
169 int source_frame_number() const { return source_frame_number_; } 158 int source_frame_number() const { return source_frame_number_; }
170 void set_source_frame_number(int frame_number) { 159 void set_source_frame_number(int frame_number) {
171 source_frame_number_ = frame_number; 160 source_frame_number_ = frame_number;
172 } 161 }
173 162
174 bool is_first_frame_after_commit() const { 163 bool is_first_frame_after_commit() const {
175 return source_frame_number_ != is_first_frame_after_commit_tracker_; 164 return source_frame_number_ != is_first_frame_after_commit_tracker_;
176 } 165 }
177 166
178 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) { 167 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return elastic_overscroll_.get(); 245 return elastic_overscroll_.get();
257 } 246 }
258 247
259 SyncedTopControls* top_controls_shown_ratio() { 248 SyncedTopControls* top_controls_shown_ratio() {
260 return top_controls_shown_ratio_.get(); 249 return top_controls_shown_ratio_.get();
261 } 250 }
262 const SyncedTopControls* top_controls_shown_ratio() const { 251 const SyncedTopControls* top_controls_shown_ratio() const {
263 return top_controls_shown_ratio_.get(); 252 return top_controls_shown_ratio_.get();
264 } 253 }
265 254
255 void SetElementIdsForTesting();
256
266 // Updates draw properties and render surface layer list, as well as tile 257 // Updates draw properties and render surface layer list, as well as tile
267 // priorities. Returns false if it was unable to update. Updating lcd 258 // priorities. Returns false if it was unable to update. Updating lcd
268 // text may cause invalidations, so should only be done after a commit. 259 // text may cause invalidations, so should only be done after a commit.
269 bool UpdateDrawProperties(bool update_lcd_text); 260 bool UpdateDrawProperties(bool update_lcd_text);
270 void BuildPropertyTreesForTesting(); 261 void BuildPropertyTreesForTesting();
271 262
272 void set_needs_update_draw_properties() { 263 void set_needs_update_draw_properties() {
273 needs_update_draw_properties_ = true; 264 needs_update_draw_properties_ = true;
274 } 265 }
275 bool needs_update_draw_properties() const { 266 bool needs_update_draw_properties() const {
(...skipping 17 matching lines...) Expand all
293 284
294 // These return the size of the root scrollable area and the size of 285 // These return the size of the root scrollable area and the size of
295 // the user-visible scrolling viewport, in CSS layout coordinates. 286 // the user-visible scrolling viewport, in CSS layout coordinates.
296 gfx::SizeF ScrollableSize() const; 287 gfx::SizeF ScrollableSize() const;
297 gfx::SizeF ScrollableViewportSize() const; 288 gfx::SizeF ScrollableViewportSize() const;
298 289
299 gfx::Rect RootScrollLayerDeviceViewportBounds() const; 290 gfx::Rect RootScrollLayerDeviceViewportBounds() const;
300 291
301 LayerImpl* LayerById(int id) const; 292 LayerImpl* LayerById(int id) const;
302 293
294 // TODO(vollick): this is deprecated. It is used by
295 // animation/compositor-worker to look up layers to mutate, but in future, we
296 // will update property trees.
297 LayerImpl* LayerByElementId(ElementId element_id) const;
298 void AddToElementMap(LayerImpl* layer);
299 void RemoveFromElementMap(LayerImpl* layer);
300
303 void AddLayerShouldPushProperties(LayerImpl* layer); 301 void AddLayerShouldPushProperties(LayerImpl* layer);
304 void RemoveLayerShouldPushProperties(LayerImpl* layer); 302 void RemoveLayerShouldPushProperties(LayerImpl* layer);
305 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); 303 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties();
306 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); 304 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer);
307 305
308 // These should be called by LayerImpl's ctor/dtor. 306 // These should be called by LayerImpl's ctor/dtor.
309 void RegisterLayer(LayerImpl* layer); 307 void RegisterLayer(LayerImpl* layer);
310 void UnregisterLayer(LayerImpl* layer); 308 void UnregisterLayer(LayerImpl* layer);
311 309
312 // These manage ownership of the LayerImpl. 310 // These manage ownership of the LayerImpl.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 float device_scale_factor_; 507 float device_scale_factor_;
510 float painted_device_scale_factor_; 508 float painted_device_scale_factor_;
511 509
512 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; 510 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_;
513 511
514 std::unique_ptr<OwnedLayerImplList> layers_; 512 std::unique_ptr<OwnedLayerImplList> layers_;
515 LayerImplMap layer_id_map_; 513 LayerImplMap layer_id_map_;
516 // Set of layers that need to push properties. 514 // Set of layers that need to push properties.
517 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; 515 std::unordered_set<LayerImpl*> layers_that_should_push_properties_;
518 516
519 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; 517 std::unordered_map<ElementId, LayerImpl*, ElementIdHash> element_layers_map_;
520 518
521 std::unordered_map<int, float> opacity_animations_map_; 519 std::unordered_map<int, float> opacity_animations_map_;
522 520
523 // Maps from clip layer ids to scroll layer ids. Note that this only includes 521 // Maps from clip layer ids to scroll layer ids. Note that this only includes
524 // the subset of clip layers that act as scrolling containers. (This is 522 // the subset of clip layers that act as scrolling containers. (This is
525 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) 523 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.)
526 std::unordered_map<int, int> clip_scroll_map_; 524 std::unordered_map<int, int> clip_scroll_map_;
527 525
528 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there 526 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there
529 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is 527 // may be 1 or 2 scrollbar layers (for vertical and horizontal). (This is
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 569
572 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 570 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
573 571
574 private: 572 private:
575 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 573 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
576 }; 574 };
577 575
578 } // namespace cc 576 } // namespace cc
579 577
580 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 578 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698