| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/input/scrollbar_animation_controller.h" | 5 #include "cc/input/scrollbar_animation_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 last_awaken_time_ = now; | 35 last_awaken_time_ = now; |
| 36 | 36 |
| 37 float progress = AnimationProgressAtTime(now); | 37 float progress = AnimationProgressAtTime(now); |
| 38 RunAnimationFrame(progress); | 38 RunAnimationFrame(progress); |
| 39 | 39 |
| 40 if (is_animating_) | 40 if (is_animating_) |
| 41 client_->SetNeedsAnimateForScrollbarAnimation(); | 41 client_->SetNeedsAnimateForScrollbarAnimation(); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool ScrollbarAnimationController::ScrollbarsHidden() const { |
| 46 return false; |
| 47 } |
| 48 |
| 45 float ScrollbarAnimationController::AnimationProgressAtTime( | 49 float ScrollbarAnimationController::AnimationProgressAtTime( |
| 46 base::TimeTicks now) { | 50 base::TimeTicks now) { |
| 47 base::TimeDelta delta = now - last_awaken_time_; | 51 base::TimeDelta delta = now - last_awaken_time_; |
| 48 float progress = delta.InSecondsF() / Duration().InSecondsF(); | 52 float progress = delta.InSecondsF() / Duration().InSecondsF(); |
| 49 return std::max(std::min(progress, 1.f), 0.f); | 53 return std::max(std::min(progress, 1.f), 0.f); |
| 50 } | 54 } |
| 51 | 55 |
| 52 void ScrollbarAnimationController::DidScrollBegin() { | 56 void ScrollbarAnimationController::DidScrollBegin() { |
| 53 currently_scrolling_ = true; | 57 currently_scrolling_ = true; |
| 54 } | 58 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void ScrollbarAnimationController::StopAnimation() { | 97 void ScrollbarAnimationController::StopAnimation() { |
| 94 delayed_scrollbar_fade_.Cancel(); | 98 delayed_scrollbar_fade_.Cancel(); |
| 95 is_animating_ = false; | 99 is_animating_ = false; |
| 96 } | 100 } |
| 97 | 101 |
| 98 ScrollbarSet ScrollbarAnimationController::Scrollbars() const { | 102 ScrollbarSet ScrollbarAnimationController::Scrollbars() const { |
| 99 return client_->ScrollbarsFor(scroll_layer_id_); | 103 return client_->ScrollbarsFor(scroll_layer_id_); |
| 100 } | 104 } |
| 101 | 105 |
| 102 } // namespace cc | 106 } // namespace cc |
| OLD | NEW |