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 bb3f810a4c2269d58267730ea97694916de2a899..25e129661251541c4145002a6c0bfe16c543cd4e 100644 |
| --- a/cc/input/scrollbar_animation_controller.h |
| +++ b/cc/input/scrollbar_animation_controller.h |
| @@ -9,14 +9,13 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/time/time.h" |
| #include "cc/base/cc_export.h" |
| +#include "cc/input/single_scrollbar_animation_controller_thinning.h" |
| #include "cc/layers/layer_impl.h" |
| #include "cc/layers/scrollbar_layer_impl_base.h" |
| #include "ui/gfx/geometry/vector2d_f.h" |
| namespace cc { |
| -class ScrollbarAnimationController; |
| - |
| class CC_EXPORT ScrollbarAnimationControllerClient { |
| public: |
| virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task, |
| @@ -33,6 +32,10 @@ class CC_EXPORT ScrollbarAnimationControllerClient { |
| // This abstract class represents the compositor-side analogy of |
| // ScrollbarAnimator. Individual platforms should subclass it to provide |
| // specialized implementation. |
| +// This class also passes the mouse state to each |
| +// SingleScrollbarAnimationControllerThinning. The thinning animations are |
| +// independent between vertical/horizontal and are managed by the |
| +// SingleScrollbarAnimationControllerThinnings. |
| class CC_EXPORT ScrollbarAnimationController { |
| public: |
| virtual ~ScrollbarAnimationController(); |
| @@ -42,11 +45,19 @@ class CC_EXPORT ScrollbarAnimationController { |
| virtual void DidScrollBegin(); |
| virtual void DidScrollUpdate(bool on_resize); |
| virtual void DidScrollEnd(); |
| - virtual void DidMouseDown() {} |
| - virtual void DidMouseUp() {} |
| - virtual void DidMouseLeave() {} |
| - virtual void DidMouseMoveNear(float distance) {} |
| virtual bool ScrollbarsHidden() const; |
| + virtual bool NeedThinningAnimation() const; |
|
weiliangc
2017/01/26 23:13:54
Not need to change this, just providing some alter
|
| + |
| + void DidMouseDown(); |
| + void DidMouseUp(); |
| + void DidMouseLeave(); |
| + void DidMouseMoveNear(ScrollbarOrientation, float); |
| + |
| + bool mouse_is_over_scrollbar(ScrollbarOrientation orientation) const; |
| + bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const; |
| + bool mouse_is_near_any_scrollbar() const; |
| + |
| + void set_mouse_move_distance_for_test(float distance); |
| protected: |
| ScrollbarAnimationController(int scroll_layer_id, |
| @@ -56,6 +67,7 @@ class CC_EXPORT ScrollbarAnimationController { |
| virtual void RunAnimationFrame(float progress) = 0; |
| virtual const base::TimeDelta& Duration() = 0; |
| + virtual void ApplyOpacityToScrollbars(float opacity) = 0; |
| void StartAnimation(); |
| void StopAnimation(); |
| @@ -67,11 +79,23 @@ class CC_EXPORT ScrollbarAnimationController { |
| int scroll_layer_id() const { return scroll_layer_id_; } |
| + bool animating_fade() const { return is_animating_; } |
| + |
| + bool Captured() const; |
| + |
| + std::unique_ptr<SingleScrollbarAnimationControllerThinning> |
| + vertical_controller_; |
| + std::unique_ptr<SingleScrollbarAnimationControllerThinning> |
| + horizontal_controller_; |
| + |
| private: |
| // Returns how far through the animation we are as a progress value from |
| // 0 to 1. |
| float AnimationProgressAtTime(base::TimeTicks now); |
| + SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController( |
| + ScrollbarOrientation) const; |
| + |
| base::TimeTicks last_awaken_time_; |
| base::TimeDelta delay_before_starting_; |
| base::TimeDelta resize_delay_before_starting_; |