Index: cc/trees/layer_tree_impl.h |
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h |
index 232913933965f14c223c1ba7e83579783ebdecad..19bba86dbeaf589cfb4f729966093f46a32bc384 100644 |
--- a/cc/trees/layer_tree_impl.h |
+++ b/cc/trees/layer_tree_impl.h |
@@ -55,6 +55,7 @@ struct RendererCapabilities; |
struct SelectionHandle; |
typedef std::vector<UIResourceRequest> UIResourceRequestQueue; |
+typedef SyncedProperty<AdditionGroup<float>> SyncedTopControls; |
typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; |
class CC_EXPORT LayerTreeImpl { |
@@ -62,9 +63,11 @@ class CC_EXPORT LayerTreeImpl { |
static scoped_ptr<LayerTreeImpl> create( |
LayerTreeHostImpl* layer_tree_host_impl, |
scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
+ scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) { |
- return make_scoped_ptr(new LayerTreeImpl( |
- layer_tree_host_impl, page_scale_factor, elastic_overscroll)); |
+ return make_scoped_ptr( |
+ new LayerTreeImpl(layer_tree_host_impl, page_scale_factor, |
+ top_controls_shown_ratio, elastic_overscroll)); |
} |
virtual ~LayerTreeImpl(); |
@@ -192,6 +195,13 @@ class CC_EXPORT LayerTreeImpl { |
return elastic_overscroll_.get(); |
} |
+ SyncedTopControls* top_controls_shown_ratio() { |
+ return top_controls_shown_ratio_.get(); |
+ } |
+ const SyncedTopControls* top_controls_shown_ratio() const { |
+ return top_controls_shown_ratio_.get(); |
+ } |
+ |
// Updates draw properties and render surface layer list, as well as tile |
// priorities. Returns false if it was unable to update. |
bool UpdateDrawProperties(); |
@@ -303,36 +313,17 @@ class CC_EXPORT LayerTreeImpl { |
void RegisterPictureLayerImpl(PictureLayerImpl* layer); |
void UnregisterPictureLayerImpl(PictureLayerImpl* layer); |
- void set_top_controls_shrink_blink_size(bool shrink) { |
- top_controls_shrink_blink_size_ = shrink; |
- } |
- void set_top_controls_height(float height) { top_controls_height_ = height; } |
- void set_top_controls_content_offset(float offset) { |
- top_controls_content_offset_ = offset; |
- } |
- void set_top_controls_delta(float delta) { |
- top_controls_delta_ = delta; |
- } |
- void set_sent_top_controls_delta(float sent_delta) { |
- sent_top_controls_delta_ = sent_delta; |
- } |
- |
+ void set_top_controls_shrink_blink_size(bool shrink); |
bool top_controls_shrink_blink_size() const { |
return top_controls_shrink_blink_size_; |
} |
- float top_controls_height() const { return top_controls_height_; } |
- float top_controls_content_offset() const { |
- return top_controls_content_offset_; |
- } |
- float top_controls_delta() const { |
- return top_controls_delta_; |
- } |
- float sent_top_controls_delta() const { |
- return sent_top_controls_delta_; |
- } |
- float total_top_controls_content_offset() const { |
- return top_controls_content_offset_ + top_controls_delta_; |
+ bool SetCurrentTopControlsShownRatio(float ratio); |
+ float CurrentTopControlsShownRatio() const { |
+ return top_controls_shown_ratio_->Current(IsActiveTree()); |
} |
+ void set_top_controls_height(float top_controls_height); |
+ float top_controls_height() const { return top_controls_height_; } |
+ void PushTopControlsFromMainThread(float top_controls_shown_ratio); |
void SetPendingPageScaleAnimation( |
scoped_ptr<PendingPageScaleAnimation> pending_animation); |
@@ -342,6 +333,7 @@ class CC_EXPORT LayerTreeImpl { |
explicit LayerTreeImpl( |
LayerTreeHostImpl* layer_tree_host_impl, |
scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
+ scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); |
void ProcessLayersRecursive(LayerImpl* current, |
void (LayerImpl::*function)()); |
@@ -353,7 +345,7 @@ class CC_EXPORT LayerTreeImpl { |
float max_page_scale_factor); |
void DidUpdatePageScale(); |
void HideInnerViewportScrollbarsIfNearMinimumScale(); |
- |
+ void PushTopControls(const float* top_controls_shown_ratio); |
LayerTreeHostImpl* layer_tree_host_impl_; |
int source_frame_number_; |
scoped_ptr<LayerImpl> root_layer_; |
@@ -416,11 +408,9 @@ class CC_EXPORT LayerTreeImpl { |
float top_controls_height_; |
- // The up-to-date content offset of the top controls, i.e. the amount that the |
- // web contents have been shifted down from the top of the device viewport. |
- float top_controls_content_offset_; |
- float top_controls_delta_; |
- float sent_top_controls_delta_; |
+ // The amount that the top controls are shown from 0 (hidden) to 1 (fully |
+ // shown). |
+ scoped_refptr<SyncedTopControls> top_controls_shown_ratio_; |
scoped_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |