Chromium Code Reviews| Index: cc/top_controls_manager.cc |
| diff --git a/cc/top_controls_manager.cc b/cc/top_controls_manager.cc |
| index 7c0f03cf3b5bcc25be9ad55829f611f1bb7136ea..ce0c8992050b1b6adc3e5dbe4e293e7a8edfe80e 100644 |
| --- a/cc/top_controls_manager.cc |
| +++ b/cc/top_controls_manager.cc |
| @@ -34,35 +34,31 @@ TopControlsManager::TopControlsManager(TopControlsManagerClient* client, |
| : client_(client), |
| animation_direction_(NO_ANIMATION), |
| is_overlay_mode_(false), |
| - scroll_readjustment_enabled_(false), |
| top_controls_height_(top_controls_height), |
| controls_top_offset_(0), |
| content_top_offset_(top_controls_height), |
| - previous_root_scroll_offset_(0.f) { |
| + in_user_scroll_(false) { |
| CHECK(client_); |
| } |
| TopControlsManager::~TopControlsManager() { |
| } |
| -void TopControlsManager::UpdateDrawPositions() { |
| - if (!client_->haveRootScrollLayer()) |
| +void TopControlsManager::ProgrammaticScroll(gfx::Vector2d targetOffset) { |
| + if (controls_top_offset_ == -top_controls_height_) |
| return; |
| - // If the scroll position has changed underneath us (i.e. a javascript |
| - // scroll), then simulate a scroll that covers the delta. |
| - float scroll_total_y = RootScrollLayerTotalScrollY(); |
| - if (scroll_readjustment_enabled_ |
| - && scroll_total_y != previous_root_scroll_offset_) { |
| - ScrollBy(gfx::Vector2dF(0, scroll_total_y - previous_root_scroll_offset_)); |
| - StartAnimationIfNecessary(); |
| - previous_root_scroll_offset_ = RootScrollLayerTotalScrollY(); |
| - } |
| + // We're in a user scroll. |
| + if (in_user_scroll_) |
| + return; |
| + |
| + ScrollBy(gfx::Vector2dF(0, top_controls_height_)); |
|
Ted C
2013/01/24 22:01:01
hmm...so any javascript scroll will attempt to hid
John Knottenbelt
2013/01/30 16:08:45
We can restrict it here to just 0,0 and 0,1 if we
|
| + StartAnimationIfNecessary(); |
|
Ted C
2013/01/24 22:01:01
The start animation if necessary shouldn't be requ
John Knottenbelt
2013/01/30 16:08:45
Done.
|
| } |
| void TopControlsManager::ScrollBegin() { |
| ResetAnimations(); |
| - scroll_readjustment_enabled_ = false; |
| + in_user_scroll_ = true; |
| } |
| gfx::Vector2dF TopControlsManager::ScrollBy( |
| @@ -113,8 +109,7 @@ gfx::Vector2dF TopControlsManager::ScrollInternal( |
| void TopControlsManager::ScrollEnd() { |
| StartAnimationIfNecessary(); |
| - previous_root_scroll_offset_ = RootScrollLayerTotalScrollY(); |
| - scroll_readjustment_enabled_ = true; |
| + in_user_scroll_ = false; |
| } |
| void TopControlsManager::Animate(base::TimeTicks monotonic_time) { |