Chromium Code Reviews| Index: cc/input/scrollbar_animation_controller_thinning.h |
| diff --git a/cc/input/scrollbar_animation_controller_thinning.h b/cc/input/scrollbar_animation_controller_thinning.h |
| index 0b393088b89c209f5771c617781c4bce7a264f89..425dabaeaadc5e6221d5048ffb0eac8cfe4bfa2c 100644 |
| --- a/cc/input/scrollbar_animation_controller_thinning.h |
| +++ b/cc/input/scrollbar_animation_controller_thinning.h |
| @@ -5,20 +5,24 @@ |
| #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
| #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
| +#include <algorithm> |
|
bokan
2016/12/08 19:34:07
I think this is unneeded?
|
| #include <memory> |
| #include "base/macros.h" |
| #include "cc/base/cc_export.h" |
| #include "cc/input/scrollbar_animation_controller.h" |
| +#include "cc/input/single_scrollbar_animation_controller_thinning.h" |
| namespace cc { |
| +using std::unique_ptr; |
|
bokan
2016/12/08 19:34:07
I would prefer just using std:: in the declaration
|
| + |
| // Scrollbar animation that partially fades and thins after an idle delay, |
| // and reacts to mouse movements. |
| class CC_EXPORT ScrollbarAnimationControllerThinning |
|
bokan
2016/12/08 19:34:07
Please file a bug and add a TODO to clean up the i
|
| : public ScrollbarAnimationController { |
| public: |
| - static std::unique_ptr<ScrollbarAnimationControllerThinning> Create( |
| + static unique_ptr<ScrollbarAnimationControllerThinning> Create( |
| int scroll_layer_id, |
| ScrollbarAnimationControllerClient* client, |
| base::TimeDelta delay_before_starting, |
| @@ -28,19 +32,18 @@ class CC_EXPORT ScrollbarAnimationControllerThinning |
| ~ScrollbarAnimationControllerThinning() override; |
| - void set_mouse_move_distance_for_test(float distance) { |
| - mouse_move_distance_to_trigger_animation_ = distance; |
| - } |
| - bool mouse_is_over_scrollbar() const { return mouse_is_over_scrollbar_; } |
| - bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; } |
| + void set_mouse_move_distance_for_test(float distance); |
| - void DidScrollUpdate(bool on_resize) override; |
| + bool mouse_is_over_scrollbar(ScrollbarOrientation orientation) const; |
| + bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const; |
| + bool ScrollbarsHidden() const override; |
| + bool Animate(base::TimeTicks now) override; |
| + void DidScrollUpdate(bool on_resize) override; |
| void DidMouseDown() override; |
| void DidMouseUp() override; |
| void DidMouseLeave() override; |
| - void DidMouseMoveNear(float distance) override; |
| - bool ScrollbarsHidden() const override; |
| + void DidMouseMoveNear(ScrollbarOrientation, float) override; |
| protected: |
| ScrollbarAnimationControllerThinning( |
| @@ -55,34 +58,11 @@ class CC_EXPORT ScrollbarAnimationControllerThinning |
| const base::TimeDelta& Duration() override; |
| private: |
| - // Describes whether the current animation should INCREASE (thicken) |
| - // a bar or DECREASE it (thin). |
| - enum AnimationChange { NONE, INCREASE, DECREASE }; |
| - enum AnimatingProperty { OPACITY, THICKNESS }; |
| - float ThumbThicknessScaleAt(float progress); |
| - float AdjustScale(float new_value, |
| - float current_value, |
| - AnimationChange animation_change, |
| - float min_value, |
| - float max_value); |
| - void ApplyOpacity(float opacity); |
| - void ApplyThumbThicknessScale(float thumb_thickness_scale); |
| - |
| - void SetCurrentAnimatingProperty(AnimatingProperty property); |
| - |
| - float opacity_; |
| - bool captured_; |
| - bool mouse_is_over_scrollbar_; |
| - bool mouse_is_near_scrollbar_; |
| - // Are we narrowing or thickening the bars. |
| - AnimationChange thickness_change_; |
| - // How close should the mouse be to the scrollbar before we thicken it. |
| - float mouse_move_distance_to_trigger_animation_; |
| - |
| - base::TimeDelta fade_duration_; |
| - base::TimeDelta thinning_duration_; |
| - |
| - AnimatingProperty current_animating_property_; |
| + unique_ptr<SingleScrollbarAnimationControllerThinning> v_scrollbar_controller; |
| + unique_ptr<SingleScrollbarAnimationControllerThinning> h_scrollbar_controller; |
|
bokan
2016/12/08 19:34:07
Call these vertical_controller_ and horizontal_con
|
| + |
| + SingleScrollbarAnimationControllerThinning* GetScrollbarAnimationController( |
| + ScrollbarOrientation) const; |
| DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerThinning); |
| }; |