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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class PictureLayerImpl; | 42 class PictureLayerImpl; |
43 class Proxy; | 43 class Proxy; |
44 class ResourceProvider; | 44 class ResourceProvider; |
45 class TileManager; | 45 class TileManager; |
46 class UIResourceRequest; | 46 class UIResourceRequest; |
47 struct PendingPageScaleAnimation; | 47 struct PendingPageScaleAnimation; |
48 struct RendererCapabilities; | 48 struct RendererCapabilities; |
49 struct SelectionHandle; | 49 struct SelectionHandle; |
50 | 50 |
51 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; | 51 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; |
| 52 typedef SyncedProperty<AdditionGroup<float>> SyncedTopControls; |
52 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; | 53 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; |
53 | 54 |
54 class CC_EXPORT LayerTreeImpl { | 55 class CC_EXPORT LayerTreeImpl { |
55 public: | 56 public: |
56 static scoped_ptr<LayerTreeImpl> create( | 57 static scoped_ptr<LayerTreeImpl> create( |
57 LayerTreeHostImpl* layer_tree_host_impl, | 58 LayerTreeHostImpl* layer_tree_host_impl, |
58 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 59 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
| 60 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
59 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) { | 61 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) { |
60 return make_scoped_ptr(new LayerTreeImpl( | 62 return make_scoped_ptr( |
61 layer_tree_host_impl, page_scale_factor, elastic_overscroll)); | 63 new LayerTreeImpl(layer_tree_host_impl, page_scale_factor, |
| 64 top_controls_shown_ratio, elastic_overscroll)); |
62 } | 65 } |
63 virtual ~LayerTreeImpl(); | 66 virtual ~LayerTreeImpl(); |
64 | 67 |
65 void Shutdown(); | 68 void Shutdown(); |
66 void ReleaseResources(); | 69 void ReleaseResources(); |
67 | 70 |
68 // Methods called by the layer tree that pass-through or access LTHI. | 71 // Methods called by the layer tree that pass-through or access LTHI. |
69 // --------------------------------------------------------------------------- | 72 // --------------------------------------------------------------------------- |
70 const LayerTreeSettings& settings() const; | 73 const LayerTreeSettings& settings() const; |
71 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 74 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 SyncedProperty<ScaleGroup>* page_scale_factor(); | 181 SyncedProperty<ScaleGroup>* page_scale_factor(); |
179 const SyncedProperty<ScaleGroup>* page_scale_factor() const; | 182 const SyncedProperty<ScaleGroup>* page_scale_factor() const; |
180 | 183 |
181 SyncedElasticOverscroll* elastic_overscroll() { | 184 SyncedElasticOverscroll* elastic_overscroll() { |
182 return elastic_overscroll_.get(); | 185 return elastic_overscroll_.get(); |
183 } | 186 } |
184 const SyncedElasticOverscroll* elastic_overscroll() const { | 187 const SyncedElasticOverscroll* elastic_overscroll() const { |
185 return elastic_overscroll_.get(); | 188 return elastic_overscroll_.get(); |
186 } | 189 } |
187 | 190 |
| 191 SyncedTopControls* top_controls_shown_ratio() { |
| 192 return top_controls_shown_ratio_.get(); |
| 193 } |
| 194 const SyncedTopControls* top_controls_shown_ratio() const { |
| 195 return top_controls_shown_ratio_.get(); |
| 196 } |
| 197 |
188 // Updates draw properties and render surface layer list, as well as tile | 198 // Updates draw properties and render surface layer list, as well as tile |
189 // priorities. Returns false if it was unable to update. | 199 // priorities. Returns false if it was unable to update. |
190 bool UpdateDrawProperties(); | 200 bool UpdateDrawProperties(); |
191 | 201 |
192 void set_needs_update_draw_properties() { | 202 void set_needs_update_draw_properties() { |
193 needs_update_draw_properties_ = true; | 203 needs_update_draw_properties_ = true; |
194 } | 204 } |
195 bool needs_update_draw_properties() const { | 205 bool needs_update_draw_properties() const { |
196 return needs_update_draw_properties_; | 206 return needs_update_draw_properties_; |
197 } | 207 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 const LayerSelectionBound& end); | 299 const LayerSelectionBound& end); |
290 | 300 |
291 // Compute the current selection handle location and visbility with respect to | 301 // Compute the current selection handle location and visbility with respect to |
292 // the viewport. | 302 // the viewport. |
293 void GetViewportSelection(ViewportSelectionBound* start, | 303 void GetViewportSelection(ViewportSelectionBound* start, |
294 ViewportSelectionBound* end); | 304 ViewportSelectionBound* end); |
295 | 305 |
296 void RegisterPictureLayerImpl(PictureLayerImpl* layer); | 306 void RegisterPictureLayerImpl(PictureLayerImpl* layer); |
297 void UnregisterPictureLayerImpl(PictureLayerImpl* layer); | 307 void UnregisterPictureLayerImpl(PictureLayerImpl* layer); |
298 | 308 |
299 void set_top_controls_shrink_blink_size(bool shrink) { | 309 void set_top_controls_shrink_blink_size(bool shrink); |
300 top_controls_shrink_blink_size_ = shrink; | |
301 } | |
302 void set_top_controls_height(float height) { top_controls_height_ = height; } | |
303 void set_top_controls_content_offset(float offset) { | |
304 top_controls_content_offset_ = offset; | |
305 } | |
306 void set_top_controls_delta(float delta) { | |
307 top_controls_delta_ = delta; | |
308 } | |
309 void set_sent_top_controls_delta(float sent_delta) { | |
310 sent_top_controls_delta_ = sent_delta; | |
311 } | |
312 | |
313 bool top_controls_shrink_blink_size() const { | 310 bool top_controls_shrink_blink_size() const { |
314 return top_controls_shrink_blink_size_; | 311 return top_controls_shrink_blink_size_; |
315 } | 312 } |
| 313 bool SetCurrentTopControlsShownRatio(float ratio); |
| 314 float CurrentTopControlsShownRatio() const { |
| 315 return top_controls_shown_ratio_->Current(IsActiveTree()); |
| 316 } |
| 317 void set_top_controls_height(float top_controls_height); |
316 float top_controls_height() const { return top_controls_height_; } | 318 float top_controls_height() const { return top_controls_height_; } |
317 float top_controls_content_offset() const { | 319 void PushTopControlsFromMainThread(float top_controls_shown_ratio); |
318 return top_controls_content_offset_; | |
319 } | |
320 float top_controls_delta() const { | |
321 return top_controls_delta_; | |
322 } | |
323 float sent_top_controls_delta() const { | |
324 return sent_top_controls_delta_; | |
325 } | |
326 float total_top_controls_content_offset() const { | |
327 return top_controls_content_offset_ + top_controls_delta_; | |
328 } | |
329 | 320 |
330 void SetPendingPageScaleAnimation( | 321 void SetPendingPageScaleAnimation( |
331 scoped_ptr<PendingPageScaleAnimation> pending_animation); | 322 scoped_ptr<PendingPageScaleAnimation> pending_animation); |
332 scoped_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); | 323 scoped_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); |
333 | 324 |
334 protected: | 325 protected: |
335 explicit LayerTreeImpl( | 326 explicit LayerTreeImpl( |
336 LayerTreeHostImpl* layer_tree_host_impl, | 327 LayerTreeHostImpl* layer_tree_host_impl, |
337 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 328 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
| 329 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
338 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); | 330 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); |
339 void ReleaseResourcesRecursive(LayerImpl* current); | 331 void ReleaseResourcesRecursive(LayerImpl* current); |
340 float ClampPageScaleFactorToLimits(float page_scale_factor) const; | 332 float ClampPageScaleFactorToLimits(float page_scale_factor) const; |
341 void PushPageScaleFactorAndLimits(const float* page_scale_factor, | 333 void PushPageScaleFactorAndLimits(const float* page_scale_factor, |
342 float min_page_scale_factor, | 334 float min_page_scale_factor, |
343 float max_page_scale_factor); | 335 float max_page_scale_factor); |
344 bool SetPageScaleFactorLimits(float min_page_scale_factor, | 336 bool SetPageScaleFactorLimits(float min_page_scale_factor, |
345 float max_page_scale_factor); | 337 float max_page_scale_factor); |
346 void DidUpdatePageScale(); | 338 void DidUpdatePageScale(); |
347 void HideInnerViewportScrollbarsIfNearMinimumScale(); | 339 void HideInnerViewportScrollbarsIfNearMinimumScale(); |
348 | 340 void PushTopControls(const float* top_controls_shown_ratio); |
349 LayerTreeHostImpl* layer_tree_host_impl_; | 341 LayerTreeHostImpl* layer_tree_host_impl_; |
350 int source_frame_number_; | 342 int source_frame_number_; |
351 scoped_ptr<LayerImpl> root_layer_; | 343 scoped_ptr<LayerImpl> root_layer_; |
352 HeadsUpDisplayLayerImpl* hud_layer_; | 344 HeadsUpDisplayLayerImpl* hud_layer_; |
353 LayerImpl* currently_scrolling_layer_; | 345 LayerImpl* currently_scrolling_layer_; |
354 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; | 346 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; |
355 scoped_ptr<LayerScrollOffsetDelegateProxy> | 347 scoped_ptr<LayerScrollOffsetDelegateProxy> |
356 inner_viewport_scroll_delegate_proxy_; | 348 inner_viewport_scroll_delegate_proxy_; |
357 scoped_ptr<LayerScrollOffsetDelegateProxy> | 349 scoped_ptr<LayerScrollOffsetDelegateProxy> |
358 outer_viewport_scroll_delegate_proxy_; | 350 outer_viewport_scroll_delegate_proxy_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 UIResourceRequestQueue ui_resource_request_queue_; | 393 UIResourceRequestQueue ui_resource_request_queue_; |
402 | 394 |
403 int render_surface_layer_list_id_; | 395 int render_surface_layer_list_id_; |
404 | 396 |
405 // Whether or not Blink's viewport size was shrunk by the height of the top | 397 // Whether or not Blink's viewport size was shrunk by the height of the top |
406 // controls at the time of the last layout. | 398 // controls at the time of the last layout. |
407 bool top_controls_shrink_blink_size_; | 399 bool top_controls_shrink_blink_size_; |
408 | 400 |
409 float top_controls_height_; | 401 float top_controls_height_; |
410 | 402 |
411 // The up-to-date content offset of the top controls, i.e. the amount that the | 403 // The amount that the top controls are shown from 0 (hidden) to 1 (fully |
412 // web contents have been shifted down from the top of the device viewport. | 404 // shown). |
413 float top_controls_content_offset_; | 405 scoped_refptr<SyncedTopControls> top_controls_shown_ratio_; |
414 float top_controls_delta_; | |
415 float sent_top_controls_delta_; | |
416 | 406 |
417 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 407 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
418 | 408 |
419 private: | 409 private: |
420 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 410 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
421 }; | 411 }; |
422 | 412 |
423 } // namespace cc | 413 } // namespace cc |
424 | 414 |
425 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 415 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |