Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: cc/animation/scrollbar_animation_controller.cc

Issue 608223002: [Android]Increase Scrollbar fade delay on Resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/animation/scrollbar_animation_controller.h" 5 #include "cc/animation/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 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 } 43 }
44 44
45 float ScrollbarAnimationController::AnimationProgressAtTime( 45 float ScrollbarAnimationController::AnimationProgressAtTime(
46 base::TimeTicks now) { 46 base::TimeTicks now) {
47 base::TimeDelta delta = now - last_awaken_time_; 47 base::TimeDelta delta = now - last_awaken_time_;
48 float progress = delta.InSecondsF() / duration_.InSecondsF(); 48 float progress = delta.InSecondsF() / duration_.InSecondsF();
49 return std::max(std::min(progress, 1.f), 0.f); 49 return std::max(std::min(progress, 1.f), 0.f);
50 } 50 }
51 51
52 void ScrollbarAnimationController::SetDelayOnScrollbarAnimation(
53 base::TimeDelta delay) {
54 delay_before_starting_ = delay;
55 }
56
52 void ScrollbarAnimationController::DidScrollBegin() { 57 void ScrollbarAnimationController::DidScrollBegin() {
53 currently_scrolling_ = true; 58 currently_scrolling_ = true;
54 } 59 }
55 60
56 void ScrollbarAnimationController::DidScrollUpdate() { 61 void ScrollbarAnimationController::DidScrollUpdate() {
57 StopAnimation(); 62 StopAnimation();
58 delayed_scrollbar_fade_.Cancel(); 63 delayed_scrollbar_fade_.Cancel();
59 64
60 // As an optimization, we avoid spamming fade delay tasks during active fast 65 // As an optimization, we avoid spamming fade delay tasks during active fast
61 // scrolls. But if we're not within one, we need to post every scroll update. 66 // scrolls. But if we're not within one, we need to post every scroll update.
(...skipping 25 matching lines...) Expand all
87 is_animating_ = true; 92 is_animating_ = true;
88 last_awaken_time_ = base::TimeTicks(); 93 last_awaken_time_ = base::TimeTicks();
89 client_->SetNeedsScrollbarAnimationFrame(); 94 client_->SetNeedsScrollbarAnimationFrame();
90 } 95 }
91 96
92 void ScrollbarAnimationController::StopAnimation() { 97 void ScrollbarAnimationController::StopAnimation() {
93 is_animating_ = false; 98 is_animating_ = false;
94 } 99 }
95 100
96 } // namespace cc 101 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698