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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« 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