Chromium Code Reviews| Index: cc/input/scrollbar_animation_controller.h |
| diff --git a/cc/input/scrollbar_animation_controller.h b/cc/input/scrollbar_animation_controller.h |
| index 17d07d0dfd73bb4c5f0297c1e7d0d8f8ae3f86d1..386d6dea449f24db28ffe71b2b73a701aa7e8354 100644 |
| --- a/cc/input/scrollbar_animation_controller.h |
| +++ b/cc/input/scrollbar_animation_controller.h |
| @@ -43,9 +43,9 @@ class CC_EXPORT ScrollbarAnimationController { |
| CreateScrollbarAnimationControllerAndroid( |
| int scroll_layer_id, |
| ScrollbarAnimationControllerClient* client, |
| - base::TimeDelta delay_before_starting, |
| - base::TimeDelta resize_delay_before_starting, |
| - base::TimeDelta fade_duration); |
| + base::TimeDelta fade_out_delay, |
| + base::TimeDelta fade_out_resize_delay, |
| + base::TimeDelta fade_out_duration); |
| // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has fade in/ |
| // out animation and thinning animation. |
| @@ -53,9 +53,10 @@ class CC_EXPORT ScrollbarAnimationController { |
| CreateScrollbarAnimationControllerAuraOverlay( |
| int scroll_layer_id, |
| ScrollbarAnimationControllerClient* client, |
| - base::TimeDelta delay_before_starting, |
| - base::TimeDelta resize_delay_before_starting, |
| - base::TimeDelta fade_duration, |
| + base::TimeDelta fade_in_delay, |
| + base::TimeDelta fade_out_delay, |
| + base::TimeDelta fade_out_resize_delay, |
| + base::TimeDelta fade_out_duration, |
| base::TimeDelta thinning_duration); |
| ~ScrollbarAnimationController(); |
| @@ -77,18 +78,21 @@ class CC_EXPORT ScrollbarAnimationController { |
| bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const; |
| bool mouse_is_near_any_scrollbar() const; |
| + static constexpr float kMouseMoveDistanceToTriggerFadeInAnimation = 50.0f; |
|
bokan
2017/02/28 17:12:31
Sebastian actually corrected this to 30 so please
|
| + |
| private: |
| ScrollbarAnimationController(int scroll_layer_id, |
| ScrollbarAnimationControllerClient* client, |
| - base::TimeDelta delay_before_starting, |
| - base::TimeDelta resize_delay_before_starting, |
| - base::TimeDelta fade_duration); |
| + base::TimeDelta fade_out_delay, |
| + base::TimeDelta fade_out_resize_delay, |
| + base::TimeDelta fade_out_duration); |
| ScrollbarAnimationController(int scroll_layer_id, |
| ScrollbarAnimationControllerClient* client, |
| - base::TimeDelta delay_before_starting, |
| - base::TimeDelta resize_delay_before_starting, |
| - base::TimeDelta fade_duration, |
| + base::TimeDelta fade_in_delay, |
| + base::TimeDelta fade_out_delay, |
| + base::TimeDelta fade_out_resize_delay, |
| + base::TimeDelta fade_out_duration, |
| base::TimeDelta thinning_duration); |
| ScrollbarSet Scrollbars() const; |
| @@ -103,17 +107,29 @@ class CC_EXPORT ScrollbarAnimationController { |
| void StartAnimation(); |
| void StopAnimation(); |
| - ScrollbarAnimationControllerClient* client_; |
| + void FadeIn(); |
| - void PostDelayedAnimationTask(bool on_resize); |
| + void PostDelayedFadeIn(); |
| + void PostDelayedFadeOut(bool on_resize); |
| bool Captured() const; |
| + bool CalcNeedTriggerScrollbarFadeIn(ScrollbarOrientation orientation, |
| + float distance) const; |
| + |
| void ApplyOpacityToScrollbars(float opacity); |
| + ScrollbarAnimationControllerClient* client_; |
| + |
| base::TimeTicks last_awaken_time_; |
| - base::TimeDelta delay_before_starting_; |
| - base::TimeDelta resize_delay_before_starting_; |
| + |
| + // fade_in_delay_ is only for the case where the mouse hovers near the screen |
| + // edge. |
| + base::TimeDelta fade_in_delay_; |
| + base::TimeDelta fade_out_delay_; |
| + base::TimeDelta fade_out_resize_delay_; |
| + |
| + bool need_trigger_scrollbar_fade_in_; |
| bool is_animating_; |
| @@ -121,9 +137,11 @@ class CC_EXPORT ScrollbarAnimationController { |
| bool currently_scrolling_; |
| bool scroll_gesture_has_scrolled_; |
| - base::CancelableClosure delayed_scrollbar_fade_; |
| + base::CancelableClosure delayed_scrollbar_fade_in_; |
| + base::CancelableClosure delayed_scrollbar_fade_out_; |
| + |
| float opacity_; |
| - base::TimeDelta fade_duration_; |
| + base::TimeDelta fade_out_duration_; |
| const bool need_thinning_animation_; |
| std::unique_ptr<SingleScrollbarAnimationControllerThinning> |