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 971ba0cbe5a1d0c56647622be75a7604295ad824..bc89cd550d5201bd526800eb8d55b2b9a3dff4bd 100644 |
| --- a/cc/input/top_controls_manager.cc |
| +++ b/cc/input/top_controls_manager.cc |
| @@ -82,6 +82,17 @@ void TopControlsManager::UpdateTopControlsState(bool enable_hiding, |
| } |
| } |
| +void TopControlsManager::ShowTopControls(bool show) { |
| + if (show) { |
| + DCHECK(visibility_restriction_ != ALWAYS_HIDDEN); |
| + SetupAnimation(SHOWING_CONTROLS); |
| + } else { |
| + DCHECK(visibility_restriction_ != ALWAYS_SHOWN); |
| + SetupAnimation(HIDING_CONTROLS); |
| + } |
| +} |
| + |
|
Ted C
2013/04/16 02:05:58
remove extra line
Michael van Ouwerkerk
2013/04/16 15:02:47
Done.
|
| + |
| void TopControlsManager::ScrollBegin() { |
| ResetAnimations(); |
| current_scroll_delta_ = 0.f; |
| @@ -153,6 +164,18 @@ void TopControlsManager::ResetAnimations() { |
| } |
| void TopControlsManager::SetupAnimation(AnimationDirection direction) { |
| + DCHECK(direction != NO_ANIMATION); |
| + |
| + if (direction == SHOWING_CONTROLS && controls_top_offset_ == 0) |
| + return; |
| + |
| + if (direction == HIDING_CONTROLS && |
| + controls_top_offset_ == -top_controls_height_) |
|
Ted C
2013/04/16 02:05:58
if I recall, I think you need braces if the condit
Michael van Ouwerkerk
2013/04/16 15:02:47
Done.
|
| + return; |
| + |
| + if (top_controls_animation_ && animation_direction_ == direction) |
| + return; |
| + |
| top_controls_animation_ = KeyframedFloatAnimationCurve::Create(); |
| double start_time = |
| (base::TimeTicks::Now() - base::TimeTicks()).InMillisecondsF(); |
| @@ -166,6 +189,7 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) { |
| controls_top_offset_ + max_ending_offset, |
| EaseTimingFunction::Create())); |
| animation_direction_ = direction; |
| + client_->DidChangeTopControlsPosition(); |
| } |
| void TopControlsManager::StartAnimationIfNecessary() { |
| @@ -187,8 +211,7 @@ void TopControlsManager::StartAnimationIfNecessary() { |
| SHOWING_CONTROLS : HIDING_CONTROLS; |
| } |
| - if (show_controls != NO_ANIMATION && |
| - (!top_controls_animation_ || animation_direction_ != show_controls)) { |
| + if (show_controls != NO_ANIMATION) { |
| SetupAnimation(show_controls); |
| client_->DidChangeTopControlsPosition(); |
|
Ted C
2013/04/16 02:05:58
can remove this because it is called in Setup
Michael van Ouwerkerk
2013/04/16 15:02:47
Done.
|
| } |