Index: cc/trees/layer_tree_impl.h |
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h |
index ef4f8777f912cfd8cbbf3dd658eb50d446b5c052..d16234bad35b2e4badb5c6b6c2f73dfd04952693 100644 |
--- a/cc/trees/layer_tree_impl.h |
+++ b/cc/trees/layer_tree_impl.h |
@@ -14,6 +14,7 @@ |
#include "base/values.h" |
#include "cc/base/scoped_ptr_vector.h" |
#include "cc/base/swap_promise.h" |
+#include "cc/base/synced_property.h" |
#include "cc/layers/layer_impl.h" |
#include "cc/output/renderer.h" |
#include "cc/resources/ui_resource_client.h" |
@@ -53,8 +54,10 @@ typedef std::list<UIResourceRequest> UIResourceRequestQueue; |
class CC_EXPORT LayerTreeImpl { |
public: |
static scoped_ptr<LayerTreeImpl> create( |
- LayerTreeHostImpl* layer_tree_host_impl) { |
- return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); |
+ LayerTreeHostImpl* layer_tree_host_impl, |
+ scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor) { |
+ return make_scoped_ptr( |
+ new LayerTreeImpl(layer_tree_host_impl, page_scale_factor)); |
} |
virtual ~LayerTreeImpl(); |
@@ -161,23 +164,20 @@ class CC_EXPORT LayerTreeImpl { |
has_transparent_background_ = transparent; |
} |
- void SetPageScaleFactorAndLimits(float page_scale_factor, |
- float min_page_scale_factor, float max_page_scale_factor); |
- void SetPageScaleDelta(float delta); |
- void SetPageScaleValues(float page_scale_factor, |
- float min_page_scale_factor, float max_page_scale_factor, |
- float page_scale_delta); |
- float total_page_scale_factor() const { |
- return page_scale_factor_ * page_scale_delta_; |
+ void SetPageScaleOnActiveTree(float active_page_scale); |
+ void PushPageScaleFromMainThread(float page_scale_factor, |
+ float min_page_scale_factor, |
+ float max_page_scale_factor); |
+ float current_page_scale_factor() const { |
+ return page_scale_factor()->Current(IsActiveTree()); |
} |
- float page_scale_factor() const { return page_scale_factor_; } |
float min_page_scale_factor() const { return min_page_scale_factor_; } |
float max_page_scale_factor() const { return max_page_scale_factor_; } |
- float page_scale_delta() const { return page_scale_delta_; } |
- void set_sent_page_scale_delta(float delta) { |
- sent_page_scale_delta_ = delta; |
- } |
- float sent_page_scale_delta() const { return sent_page_scale_delta_; } |
+ |
+ float page_scale_delta() const { return page_scale_factor()->Delta(); } |
+ |
+ SyncedProperty<ScaleGroup>* page_scale_factor(); |
+ const SyncedProperty<ScaleGroup>* page_scale_factor() const; |
// Updates draw properties and render surface layer list, as well as tile |
// priorities. Returns false if it was unable to update. |
@@ -287,9 +287,10 @@ class CC_EXPORT LayerTreeImpl { |
void RegisterPictureLayerImpl(PictureLayerImpl* layer); |
void UnregisterPictureLayerImpl(PictureLayerImpl* layer); |
- void set_top_controls_layout_height(float height) { |
- top_controls_layout_height_ = height; |
+ 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; |
} |
@@ -300,9 +301,10 @@ class CC_EXPORT LayerTreeImpl { |
sent_top_controls_delta_ = sent_delta; |
} |
- float top_controls_layout_height() const { |
- return top_controls_layout_height_; |
+ 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_; |
} |
@@ -321,8 +323,17 @@ class CC_EXPORT LayerTreeImpl { |
scoped_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); |
protected: |
- explicit LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
+ explicit LayerTreeImpl( |
+ LayerTreeHostImpl* layer_tree_host_impl, |
+ scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor); |
void ReleaseResourcesRecursive(LayerImpl* current); |
+ float ClampPageScaleFactorToLimits(float page_scale_factor) const; |
+ void PushPageScaleFactorAndLimits(const float* page_scale_factor, |
+ float min_page_scale_factor, |
+ float max_page_scale_factor); |
+ bool SetPageScaleFactorLimits(float min_page_scale_factor, |
+ float max_page_scale_factor); |
+ void DidUpdatePageScale(); |
LayerTreeHostImpl* layer_tree_host_impl_; |
int source_frame_number_; |
@@ -345,9 +356,7 @@ class CC_EXPORT LayerTreeImpl { |
LayerSelectionBound selection_start_; |
LayerSelectionBound selection_end_; |
- float page_scale_factor_; |
- float page_scale_delta_; |
- float sent_page_scale_delta_; |
+ scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor_; |
float min_page_scale_factor_; |
float max_page_scale_factor_; |
@@ -380,10 +389,11 @@ class CC_EXPORT LayerTreeImpl { |
int render_surface_layer_list_id_; |
- // The top controls content offset at the time of the last layout (and thus, |
- // viewport resize) in Blink. i.e. How much the viewport was shrunk by the top |
- // controls. |
- float top_controls_layout_height_; |
+ // Whether or not Blink's viewport size was shrunk by the height of the top |
+ // controls at the time of the last layout. |
+ bool top_controls_shrink_blink_size_; |
+ |
+ 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. |