Chromium Code Reviews| Index: cc/input/top_controls_manager.cc |
| diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc |
| index 7362805de99acba4c5caa3145f9f268df1778336..bf0bf3fe4a05087f67c1e4fa2397abb6e04c5166 100644 |
| --- a/cc/input/top_controls_manager.cc |
| +++ b/cc/input/top_controls_manager.cc |
| @@ -69,6 +69,9 @@ float TopControlsManager::TopControlsHeight() const { |
| void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, |
| TopControlsState current, |
| bool animate) { |
| + if (!TopControlsEnabled()) |
|
aelias_OOO_until_Jul13
2015/03/04 20:05:53
This one shouldn't be suppressed by height. We sh
bokan
2015/03/04 21:48:30
Done.
|
| + return; |
| + |
| DCHECK(!(constraints == SHOWN && current == HIDDEN)); |
| DCHECK(!(constraints == HIDDEN && current == SHOWN)); |
| @@ -94,6 +97,9 @@ void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, |
| } |
| void TopControlsManager::ScrollBegin() { |
| + if (!TopControlsEnabled()) |
|
aelias_OOO_until_Jul13
2015/03/04 20:05:53
I think we should remove all of the extra early-re
bokan
2015/03/04 21:48:30
Done.
|
| + return; |
| + |
| DCHECK(!pinch_gesture_active_); |
| ResetAnimations(); |
| ResetBaseline(); |
| @@ -101,6 +107,9 @@ void TopControlsManager::ScrollBegin() { |
| gfx::Vector2dF TopControlsManager::ScrollBy( |
| const gfx::Vector2dF& pending_delta) { |
| + if (!TopControlsEnabled()) |
| + return pending_delta; |
| + |
| if (pinch_gesture_active_) |
| return pending_delta; |
| @@ -128,17 +137,26 @@ gfx::Vector2dF TopControlsManager::ScrollBy( |
| } |
| void TopControlsManager::ScrollEnd() { |
| + if (!TopControlsEnabled()) |
| + return; |
| + |
| DCHECK(!pinch_gesture_active_); |
| StartAnimationIfNecessary(); |
| } |
| void TopControlsManager::PinchBegin() { |
| + if (!TopControlsEnabled()) |
| + return; |
| + |
| DCHECK(!pinch_gesture_active_); |
| pinch_gesture_active_ = true; |
| StartAnimationIfNecessary(); |
| } |
| void TopControlsManager::PinchEnd() { |
| + if (!TopControlsEnabled()) |
| + return; |
| + |
| DCHECK(pinch_gesture_active_); |
| // Pinch{Begin,End} will always occur within the scope of Scroll{Begin,End}, |
| // so return to a state expected by the remaining scroll sequence. |
| @@ -147,10 +165,15 @@ void TopControlsManager::PinchEnd() { |
| } |
| void TopControlsManager::MainThreadHasStoppedFlinging() { |
| + if (!TopControlsEnabled()) |
| + return; |
| + |
| StartAnimationIfNecessary(); |
| } |
| gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) { |
| + DCHECK(TopControlsEnabled()); |
|
aelias_OOO_until_Jul13
2015/03/04 20:05:53
I'd suggest removing this DCHECK. If you're worri
bokan
2015/03/04 21:48:30
Done.
|
| + |
| if (!top_controls_animation_ || !client_->HaveRootScrollLayer()) |
| return gfx::Vector2dF(); |
| @@ -231,4 +254,8 @@ void TopControlsManager::ResetBaseline() { |
| baseline_content_offset_ = ContentTopOffset(); |
| } |
| +bool TopControlsManager::TopControlsEnabled() { |
|
aelias_OOO_until_Jul13
2015/03/04 20:05:53
I don't think we should have a method called this,
bokan
2015/03/04 21:48:30
Done.
|
| + return TopControlsHeight(); |
| +} |
| + |
| } // namespace cc |