| 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 26 matching lines...) Expand all Loading... |
| 37 last_awaken_time_ = now; | 37 last_awaken_time_ = now; |
| 38 | 38 |
| 39 float progress = AnimationProgressAtTime(now); | 39 float progress = AnimationProgressAtTime(now); |
| 40 RunAnimationFrame(progress); | 40 RunAnimationFrame(progress); |
| 41 | 41 |
| 42 if (is_animating_) | 42 if (is_animating_) |
| 43 client_->SetNeedsAnimateForScrollbarAnimation(); | 43 client_->SetNeedsAnimateForScrollbarAnimation(); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool ScrollbarAnimationController::MouseIsNearScrollbar() { |
| 48 return false; |
| 49 } |
| 50 |
| 47 float ScrollbarAnimationController::AnimationProgressAtTime( | 51 float ScrollbarAnimationController::AnimationProgressAtTime( |
| 48 base::TimeTicks now) { | 52 base::TimeTicks now) { |
| 49 base::TimeDelta delta = now - last_awaken_time_; | 53 base::TimeDelta delta = now - last_awaken_time_; |
| 50 float progress = delta.InSecondsF() / duration_.InSecondsF(); | 54 float progress = delta.InSecondsF() / duration_.InSecondsF(); |
| 51 return std::max(std::min(progress, 1.f), 0.f); | 55 return std::max(std::min(progress, 1.f), 0.f); |
| 52 } | 56 } |
| 53 | 57 |
| 54 void ScrollbarAnimationController::DidScrollBegin() { | 58 void ScrollbarAnimationController::DidScrollBegin() { |
| 55 currently_scrolling_ = true; | 59 currently_scrolling_ = true; |
| 56 } | 60 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 99 |
| 96 void ScrollbarAnimationController::StopAnimation() { | 100 void ScrollbarAnimationController::StopAnimation() { |
| 97 is_animating_ = false; | 101 is_animating_ = false; |
| 98 } | 102 } |
| 99 | 103 |
| 100 ScrollbarSet ScrollbarAnimationController::Scrollbars() const { | 104 ScrollbarSet ScrollbarAnimationController::Scrollbars() const { |
| 101 return client_->ScrollbarsFor(scroll_layer_id_); | 105 return client_->ScrollbarsFor(scroll_layer_id_); |
| 102 } | 106 } |
| 103 | 107 |
| 104 } // namespace cc | 108 } // namespace cc |
| OLD | NEW |