summaryrefslogtreecommitdiffstats
path: root/cc/animation/scrollbar_animation_controller_linear_fade.h
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 05:24:00 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 05:24:00 +0000
commit930ff43bda6d5fa5b9a2ba957ce0ef063ef66615 (patch)
treefdc902052878bf5fad1824efb81bebe9bd8f0f8f /cc/animation/scrollbar_animation_controller_linear_fade.h
parent3f19f1a0a393cd620ddb72a7901c5e192cd5ede1 (diff)
downloadchromium_src-930ff43bda6d5fa5b9a2ba957ce0ef063ef66615.zip
chromium_src-930ff43bda6d5fa5b9a2ba957ce0ef063ef66615.tar.gz
chromium_src-930ff43bda6d5fa5b9a2ba957ce0ef063ef66615.tar.bz2
Remove physical time dependency from scrollbar fades.
This patch switches fade delay to use base::CancelableClosure, and makes the animation only note the time during the first animation frame. Background: we need to avoid spamming unnecessary animation frames during the 300ms between a scroll and when the scrollbar starts fading. Therefore, we post a delayed task and then start a redraw cycle only when that task wakes up. The difficulty is that the fade may actually need to be postponed, depending on events that occured during the waiting period. In the past, we've dealt with this by noting the timestamp of the last ScrollEnd, and reposting if it's later than the current time when the task wakes up. This made the fade logic complex, and introduced a problematic dependency on true physical time (as opposed to frame time) that exists nowhere else in CC. NOTRY=true BUG=369006 Review URL: https://codereview.chromium.org/236743003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/animation/scrollbar_animation_controller_linear_fade.h')
-rw-r--r--cc/animation/scrollbar_animation_controller_linear_fade.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/cc/animation/scrollbar_animation_controller_linear_fade.h b/cc/animation/scrollbar_animation_controller_linear_fade.h
index 85cdada..1070049 100644
--- a/cc/animation/scrollbar_animation_controller_linear_fade.h
+++ b/cc/animation/scrollbar_animation_controller_linear_fade.h
@@ -17,40 +17,29 @@ class CC_EXPORT ScrollbarAnimationControllerLinearFade
public:
static scoped_ptr<ScrollbarAnimationControllerLinearFade> Create(
LayerImpl* scroll_layer,
- base::TimeDelta fadeout_delay,
- base::TimeDelta fadeout_length);
+ ScrollbarAnimationControllerClient* client,
+ base::TimeDelta delay_before_starting,
+ base::TimeDelta duration);
virtual ~ScrollbarAnimationControllerLinearFade();
- // ScrollbarAnimationController overrides.
- virtual bool IsAnimating() const OVERRIDE;
- virtual base::TimeDelta DelayBeforeStart(base::TimeTicks now) const OVERRIDE;
-
- virtual bool Animate(base::TimeTicks now) OVERRIDE;
- virtual void DidScrollGestureBegin() OVERRIDE;
- virtual void DidScrollGestureEnd(base::TimeTicks now) OVERRIDE;
- virtual void DidMouseMoveOffScrollbar(base::TimeTicks now) OVERRIDE;
- virtual bool DidScrollUpdate(base::TimeTicks now) OVERRIDE;
- virtual bool DidMouseMoveNear(base::TimeTicks now, float distance) OVERRIDE;
+ virtual void DidScrollUpdate() OVERRIDE;
protected:
- ScrollbarAnimationControllerLinearFade(LayerImpl* scroll_layer,
- base::TimeDelta fadeout_delay,
- base::TimeDelta fadeout_length);
+ ScrollbarAnimationControllerLinearFade(
+ LayerImpl* scroll_layer,
+ ScrollbarAnimationControllerClient* client,
+ base::TimeDelta delay_before_starting,
+ base::TimeDelta duration);
+
+ virtual void RunAnimationFrame(float progress) OVERRIDE;
private:
- float OpacityAtTime(base::TimeTicks now);
+ float OpacityAtTime(base::TimeTicks now) const;
void ApplyOpacityToScrollbars(float opacity);
LayerImpl* scroll_layer_;
- base::TimeTicks last_awaken_time_;
- bool scroll_gesture_in_progress_;
- bool scroll_gesture_has_scrolled_;
-
- base::TimeDelta fadeout_delay_;
- base::TimeDelta fadeout_length_;
-
DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerLinearFade);
};