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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; | 55 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; |
56 typedef SyncedProperty<AdditionGroup<float>> SyncedBrowserControls; | 56 typedef SyncedProperty<AdditionGroup<float>> SyncedBrowserControls; |
57 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; | 57 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; |
58 | 58 |
59 class CC_EXPORT LayerTreeImpl { | 59 class CC_EXPORT LayerTreeImpl { |
60 public: | 60 public: |
61 // This is the number of times a fixed point has to be hit contiuously by a | 61 // This is the number of times a fixed point has to be hit contiuously by a |
62 // layer to consider it as jittering. | 62 // layer to consider it as jittering. |
63 enum : int { kFixedPointHitsThreshold = 3 }; | 63 enum : int { kFixedPointHitsThreshold = 3 }; |
64 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl, | 64 LayerTreeImpl( |
65 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 65 LayerTreeHostImpl* layer_tree_host_impl, |
66 scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio, | 66 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
67 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); | 67 scoped_refptr<SyncedProperty<ScaleGroup>> subframe_page_scale_factor, |
| 68 scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio, |
| 69 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); |
68 virtual ~LayerTreeImpl(); | 70 virtual ~LayerTreeImpl(); |
69 | 71 |
70 void Shutdown(); | 72 void Shutdown(); |
71 void ReleaseResources(); | 73 void ReleaseResources(); |
72 void ReleaseTileResources(); | 74 void ReleaseTileResources(); |
73 void RecreateTileResources(); | 75 void RecreateTileResources(); |
74 | 76 |
75 // Methods called by the layer tree that pass-through or access LTHI. | 77 // Methods called by the layer tree that pass-through or access LTHI. |
76 // --------------------------------------------------------------------------- | 78 // --------------------------------------------------------------------------- |
77 const LayerTreeSettings& settings() const; | 79 const LayerTreeSettings& settings() const; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void set_has_transparent_background(bool transparent) { | 205 void set_has_transparent_background(bool transparent) { |
204 has_transparent_background_ = transparent; | 206 has_transparent_background_ = transparent; |
205 } | 207 } |
206 | 208 |
207 void UpdatePropertyTreeScrollingAndAnimationFromMainThread(); | 209 void UpdatePropertyTreeScrollingAndAnimationFromMainThread(); |
208 void UpdatePropertyTreeScrollOffset(PropertyTrees* property_trees) { | 210 void UpdatePropertyTreeScrollOffset(PropertyTrees* property_trees) { |
209 property_trees_.scroll_tree.UpdateScrollOffsetMap( | 211 property_trees_.scroll_tree.UpdateScrollOffsetMap( |
210 &property_trees->scroll_tree.scroll_offset_map(), this); | 212 &property_trees->scroll_tree.scroll_offset_map(), this); |
211 } | 213 } |
212 void SetPageScaleOnActiveTree(float active_page_scale); | 214 void SetPageScaleOnActiveTree(float active_page_scale); |
| 215 void SetSubframePageScaleOnActiveTree(float active_subframe_page_scale); |
213 void PushPageScaleFromMainThread(float page_scale_factor, | 216 void PushPageScaleFromMainThread(float page_scale_factor, |
| 217 float subframe_page_scale_factor, |
214 float min_page_scale_factor, | 218 float min_page_scale_factor, |
215 float max_page_scale_factor); | 219 float max_page_scale_factor); |
216 float current_page_scale_factor() const { | 220 float current_page_scale_factor() const { |
217 return page_scale_factor()->Current(IsActiveTree()); | 221 return page_scale_factor()->Current(IsActiveTree()); |
218 } | 222 } |
| 223 float GetSubframePageScaleFactor() const { |
| 224 return subframe_page_scale_factor()->Current(IsActiveTree()); |
| 225 } |
219 float min_page_scale_factor() const { return min_page_scale_factor_; } | 226 float min_page_scale_factor() const { return min_page_scale_factor_; } |
220 float max_page_scale_factor() const { return max_page_scale_factor_; } | 227 float max_page_scale_factor() const { return max_page_scale_factor_; } |
221 | 228 |
222 float page_scale_delta() const { return page_scale_factor()->Delta(); } | 229 float page_scale_delta() const { return page_scale_factor()->Delta(); } |
223 | 230 |
224 SyncedProperty<ScaleGroup>* page_scale_factor(); | 231 SyncedProperty<ScaleGroup>* page_scale_factor(); |
225 const SyncedProperty<ScaleGroup>* page_scale_factor() const; | 232 const SyncedProperty<ScaleGroup>* page_scale_factor() const; |
226 | 233 |
| 234 SyncedProperty<ScaleGroup>* subframe_page_scale_factor(); |
| 235 const SyncedProperty<ScaleGroup>* subframe_page_scale_factor() const; |
| 236 |
227 void SetDeviceScaleFactor(float device_scale_factor); | 237 void SetDeviceScaleFactor(float device_scale_factor); |
228 float device_scale_factor() const { return device_scale_factor_; } | 238 float device_scale_factor() const { return device_scale_factor_; } |
229 | 239 |
230 void set_painted_device_scale_factor(float painted_device_scale_factor) { | 240 void set_painted_device_scale_factor(float painted_device_scale_factor) { |
231 painted_device_scale_factor_ = painted_device_scale_factor; | 241 painted_device_scale_factor_ = painted_device_scale_factor; |
232 } | 242 } |
233 float painted_device_scale_factor() const { | 243 float painted_device_scale_factor() const { |
234 return painted_device_scale_factor_; | 244 return painted_device_scale_factor_; |
235 } | 245 } |
236 | 246 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 465 |
456 void AddToLayerList(LayerImpl* layer); | 466 void AddToLayerList(LayerImpl* layer); |
457 | 467 |
458 void ClearLayerList(); | 468 void ClearLayerList(); |
459 | 469 |
460 void BuildLayerListForTesting(); | 470 void BuildLayerListForTesting(); |
461 | 471 |
462 protected: | 472 protected: |
463 float ClampPageScaleFactorToLimits(float page_scale_factor) const; | 473 float ClampPageScaleFactorToLimits(float page_scale_factor) const; |
464 void PushPageScaleFactorAndLimits(const float* page_scale_factor, | 474 void PushPageScaleFactorAndLimits(const float* page_scale_factor, |
| 475 const float* subframe_page_scale_factor, |
465 float min_page_scale_factor, | 476 float min_page_scale_factor, |
466 float max_page_scale_factor); | 477 float max_page_scale_factor); |
467 bool SetPageScaleFactorLimits(float min_page_scale_factor, | 478 bool SetPageScaleFactorLimits(float min_page_scale_factor, |
468 float max_page_scale_factor); | 479 float max_page_scale_factor); |
469 bool IsViewportLayerId(int id) const; | 480 bool IsViewportLayerId(int id) const; |
470 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); | 481 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); |
471 void DidUpdatePageScale(); | 482 void DidUpdatePageScale(); |
472 void PushBrowserControls(const float* top_controls_shown_ratio); | 483 void PushBrowserControls(const float* top_controls_shown_ratio); |
473 bool ClampBrowserControlsShownRatio(); | 484 bool ClampBrowserControlsShownRatio(); |
474 | 485 |
475 LayerTreeHostImpl* layer_tree_host_impl_; | 486 LayerTreeHostImpl* layer_tree_host_impl_; |
476 int source_frame_number_; | 487 int source_frame_number_; |
477 int is_first_frame_after_commit_tracker_; | 488 int is_first_frame_after_commit_tracker_; |
478 LayerImpl* root_layer_for_testing_; | 489 LayerImpl* root_layer_for_testing_; |
479 HeadsUpDisplayLayerImpl* hud_layer_; | 490 HeadsUpDisplayLayerImpl* hud_layer_; |
480 PropertyTrees property_trees_; | 491 PropertyTrees property_trees_; |
481 SkColor background_color_; | 492 SkColor background_color_; |
482 bool has_transparent_background_; | 493 bool has_transparent_background_; |
483 | 494 |
484 int last_scrolled_layer_id_; | 495 int last_scrolled_layer_id_; |
485 int overscroll_elasticity_layer_id_; | 496 int overscroll_elasticity_layer_id_; |
486 int page_scale_layer_id_; | 497 int page_scale_layer_id_; |
487 int inner_viewport_scroll_layer_id_; | 498 int inner_viewport_scroll_layer_id_; |
488 int outer_viewport_scroll_layer_id_; | 499 int outer_viewport_scroll_layer_id_; |
489 | 500 |
490 LayerSelection selection_; | 501 LayerSelection selection_; |
491 | 502 |
492 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor_; | 503 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor_; |
| 504 scoped_refptr<SyncedProperty<ScaleGroup>> subframe_page_scale_factor_; |
493 float min_page_scale_factor_; | 505 float min_page_scale_factor_; |
494 float max_page_scale_factor_; | 506 float max_page_scale_factor_; |
495 | 507 |
496 float device_scale_factor_; | 508 float device_scale_factor_; |
497 float painted_device_scale_factor_; | 509 float painted_device_scale_factor_; |
498 gfx::ColorSpace device_color_space_; | 510 gfx::ColorSpace device_color_space_; |
499 | 511 |
500 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; | 512 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; |
501 | 513 |
502 std::unique_ptr<OwnedLayerImplList> layers_; | 514 std::unique_ptr<OwnedLayerImplList> layers_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 575 |
564 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 576 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
565 | 577 |
566 private: | 578 private: |
567 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 579 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
568 }; | 580 }; |
569 | 581 |
570 } // namespace cc | 582 } // namespace cc |
571 | 583 |
572 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 584 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |