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

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

Issue 901813002: Normalize top controls offset to (0, 1), Chromium-side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace more EXPECT_EQ with EXPECT_FLOAT_EQ for windows bots Created 5 years, 10 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class PictureLayerImpl; 48 class PictureLayerImpl;
49 class Proxy; 49 class Proxy;
50 class ResourceProvider; 50 class ResourceProvider;
51 class TileManager; 51 class TileManager;
52 class UIResourceRequest; 52 class UIResourceRequest;
53 struct PendingPageScaleAnimation; 53 struct PendingPageScaleAnimation;
54 struct RendererCapabilities; 54 struct RendererCapabilities;
55 struct SelectionHandle; 55 struct SelectionHandle;
56 56
57 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; 57 typedef std::vector<UIResourceRequest> UIResourceRequestQueue;
58 typedef SyncedProperty<AdditionGroup<float>> SyncedTopControls;
58 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; 59 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll;
59 60
60 class CC_EXPORT LayerTreeImpl { 61 class CC_EXPORT LayerTreeImpl {
61 public: 62 public:
62 static scoped_ptr<LayerTreeImpl> create( 63 static scoped_ptr<LayerTreeImpl> create(
63 LayerTreeHostImpl* layer_tree_host_impl, 64 LayerTreeHostImpl* layer_tree_host_impl,
64 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, 65 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
66 scoped_refptr<SyncedTopControls> top_controls_shown_ratio,
65 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) { 67 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) {
66 return make_scoped_ptr(new LayerTreeImpl( 68 return make_scoped_ptr(
67 layer_tree_host_impl, page_scale_factor, elastic_overscroll)); 69 new LayerTreeImpl(layer_tree_host_impl, page_scale_factor,
70 top_controls_shown_ratio, elastic_overscroll));
68 } 71 }
69 virtual ~LayerTreeImpl(); 72 virtual ~LayerTreeImpl();
70 73
71 void Shutdown(); 74 void Shutdown();
72 void ReleaseResources(); 75 void ReleaseResources();
73 void RecreateResources(); 76 void RecreateResources();
74 77
75 // Methods called by the layer tree that pass-through or access LTHI. 78 // Methods called by the layer tree that pass-through or access LTHI.
76 // --------------------------------------------------------------------------- 79 // ---------------------------------------------------------------------------
77 const LayerTreeSettings& settings() const; 80 const LayerTreeSettings& settings() const;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 SyncedProperty<ScaleGroup>* page_scale_factor(); 188 SyncedProperty<ScaleGroup>* page_scale_factor();
186 const SyncedProperty<ScaleGroup>* page_scale_factor() const; 189 const SyncedProperty<ScaleGroup>* page_scale_factor() const;
187 190
188 SyncedElasticOverscroll* elastic_overscroll() { 191 SyncedElasticOverscroll* elastic_overscroll() {
189 return elastic_overscroll_.get(); 192 return elastic_overscroll_.get();
190 } 193 }
191 const SyncedElasticOverscroll* elastic_overscroll() const { 194 const SyncedElasticOverscroll* elastic_overscroll() const {
192 return elastic_overscroll_.get(); 195 return elastic_overscroll_.get();
193 } 196 }
194 197
198 SyncedTopControls* top_controls_shown_ratio() {
199 return top_controls_shown_ratio_.get();
200 }
201 const SyncedTopControls* top_controls_shown_ratio() const {
202 return top_controls_shown_ratio_.get();
203 }
204
195 // Updates draw properties and render surface layer list, as well as tile 205 // Updates draw properties and render surface layer list, as well as tile
196 // priorities. Returns false if it was unable to update. 206 // priorities. Returns false if it was unable to update.
197 bool UpdateDrawProperties(); 207 bool UpdateDrawProperties();
198 208
199 void set_needs_update_draw_properties() { 209 void set_needs_update_draw_properties() {
200 needs_update_draw_properties_ = true; 210 needs_update_draw_properties_ = true;
201 } 211 }
202 bool needs_update_draw_properties() const { 212 bool needs_update_draw_properties() const {
203 return needs_update_draw_properties_; 213 return needs_update_draw_properties_;
204 } 214 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 const LayerSelectionBound& end); 306 const LayerSelectionBound& end);
297 307
298 // Compute the current selection handle location and visbility with respect to 308 // Compute the current selection handle location and visbility with respect to
299 // the viewport. 309 // the viewport.
300 void GetViewportSelection(ViewportSelectionBound* start, 310 void GetViewportSelection(ViewportSelectionBound* start,
301 ViewportSelectionBound* end); 311 ViewportSelectionBound* end);
302 312
303 void RegisterPictureLayerImpl(PictureLayerImpl* layer); 313 void RegisterPictureLayerImpl(PictureLayerImpl* layer);
304 void UnregisterPictureLayerImpl(PictureLayerImpl* layer); 314 void UnregisterPictureLayerImpl(PictureLayerImpl* layer);
305 315
306 void set_top_controls_shrink_blink_size(bool shrink) { 316 void set_top_controls_shrink_blink_size(bool shrink);
307 top_controls_shrink_blink_size_ = shrink;
308 }
309 void set_top_controls_height(float height) { top_controls_height_ = height; }
310 void set_top_controls_content_offset(float offset) {
311 top_controls_content_offset_ = offset;
312 }
313 void set_top_controls_delta(float delta) {
314 top_controls_delta_ = delta;
315 }
316 void set_sent_top_controls_delta(float sent_delta) {
317 sent_top_controls_delta_ = sent_delta;
318 }
319
320 bool top_controls_shrink_blink_size() const { 317 bool top_controls_shrink_blink_size() const {
321 return top_controls_shrink_blink_size_; 318 return top_controls_shrink_blink_size_;
322 } 319 }
320 bool SetCurrentTopControlsShownRatio(float ratio);
321 float CurrentTopControlsShownRatio() const {
322 return top_controls_shown_ratio_->Current(IsActiveTree());
323 }
324 void set_top_controls_height(float top_controls_height);
323 float top_controls_height() const { return top_controls_height_; } 325 float top_controls_height() const { return top_controls_height_; }
324 float top_controls_content_offset() const { 326 void PushTopControlsFromMainThread(float top_controls_shown_ratio);
325 return top_controls_content_offset_;
326 }
327 float top_controls_delta() const {
328 return top_controls_delta_;
329 }
330 float sent_top_controls_delta() const {
331 return sent_top_controls_delta_;
332 }
333 float total_top_controls_content_offset() const {
334 return top_controls_content_offset_ + top_controls_delta_;
335 }
336 327
337 void SetPendingPageScaleAnimation( 328 void SetPendingPageScaleAnimation(
338 scoped_ptr<PendingPageScaleAnimation> pending_animation); 329 scoped_ptr<PendingPageScaleAnimation> pending_animation);
339 scoped_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); 330 scoped_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation();
340 331
341 protected: 332 protected:
342 explicit LayerTreeImpl( 333 explicit LayerTreeImpl(
343 LayerTreeHostImpl* layer_tree_host_impl, 334 LayerTreeHostImpl* layer_tree_host_impl,
344 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, 335 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor,
336 scoped_refptr<SyncedTopControls> top_controls_shown_ratio,
345 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); 337 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll);
346 void ProcessLayersRecursive(LayerImpl* current, 338 void ProcessLayersRecursive(LayerImpl* current,
347 void (LayerImpl::*function)()); 339 void (LayerImpl::*function)());
348 float ClampPageScaleFactorToLimits(float page_scale_factor) const; 340 float ClampPageScaleFactorToLimits(float page_scale_factor) const;
349 void PushPageScaleFactorAndLimits(const float* page_scale_factor, 341 void PushPageScaleFactorAndLimits(const float* page_scale_factor,
350 float min_page_scale_factor, 342 float min_page_scale_factor,
351 float max_page_scale_factor); 343 float max_page_scale_factor);
352 bool SetPageScaleFactorLimits(float min_page_scale_factor, 344 bool SetPageScaleFactorLimits(float min_page_scale_factor,
353 float max_page_scale_factor); 345 float max_page_scale_factor);
354 void DidUpdatePageScale(); 346 void DidUpdatePageScale();
355 void HideInnerViewportScrollbarsIfNearMinimumScale(); 347 void HideInnerViewportScrollbarsIfNearMinimumScale();
356 348 void PushTopControls(const float* top_controls_shown_ratio);
357 LayerTreeHostImpl* layer_tree_host_impl_; 349 LayerTreeHostImpl* layer_tree_host_impl_;
358 int source_frame_number_; 350 int source_frame_number_;
359 scoped_ptr<LayerImpl> root_layer_; 351 scoped_ptr<LayerImpl> root_layer_;
360 HeadsUpDisplayLayerImpl* hud_layer_; 352 HeadsUpDisplayLayerImpl* hud_layer_;
361 LayerImpl* currently_scrolling_layer_; 353 LayerImpl* currently_scrolling_layer_;
362 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; 354 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_;
363 scoped_ptr<LayerScrollOffsetDelegateProxy> 355 scoped_ptr<LayerScrollOffsetDelegateProxy>
364 inner_viewport_scroll_delegate_proxy_; 356 inner_viewport_scroll_delegate_proxy_;
365 scoped_ptr<LayerScrollOffsetDelegateProxy> 357 scoped_ptr<LayerScrollOffsetDelegateProxy>
366 outer_viewport_scroll_delegate_proxy_; 358 outer_viewport_scroll_delegate_proxy_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 UIResourceRequestQueue ui_resource_request_queue_; 401 UIResourceRequestQueue ui_resource_request_queue_;
410 402
411 int render_surface_layer_list_id_; 403 int render_surface_layer_list_id_;
412 404
413 // Whether or not Blink's viewport size was shrunk by the height of the top 405 // Whether or not Blink's viewport size was shrunk by the height of the top
414 // controls at the time of the last layout. 406 // controls at the time of the last layout.
415 bool top_controls_shrink_blink_size_; 407 bool top_controls_shrink_blink_size_;
416 408
417 float top_controls_height_; 409 float top_controls_height_;
418 410
419 // The up-to-date content offset of the top controls, i.e. the amount that the 411 // The amount that the top controls are shown from 0 (hidden) to 1 (fully
420 // web contents have been shifted down from the top of the device viewport. 412 // shown).
421 float top_controls_content_offset_; 413 scoped_refptr<SyncedTopControls> top_controls_shown_ratio_;
422 float top_controls_delta_;
423 float sent_top_controls_delta_;
424 414
425 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 415 scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
426 416
427 private: 417 private:
428 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 418 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
429 }; 419 };
430 420
431 } // namespace cc 421 } // namespace cc
432 422
433 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 423 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698