| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 5 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
| 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 ~ScrollbarAnimationControllerThinning() override; | 29 ~ScrollbarAnimationControllerThinning() override; |
| 30 | 30 |
| 31 void set_mouse_move_distance_for_test(float distance) { | 31 void set_mouse_move_distance_for_test(float distance) { |
| 32 mouse_move_distance_to_trigger_animation_ = distance; | 32 mouse_move_distance_to_trigger_animation_ = distance; |
| 33 } | 33 } |
| 34 bool mouse_is_over_scrollbar() const { return mouse_is_over_scrollbar_; } | 34 bool mouse_is_over_scrollbar() const { return mouse_is_over_scrollbar_; } |
| 35 bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; } | 35 bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; } |
| 36 | 36 |
| 37 void DidScrollUpdate(bool on_resize) override; | 37 void DidScrollUpdate(bool on_resize) override; |
| 38 |
| 39 void DidCaptureScrollbarBegin() override; |
| 40 void DidCaptureScrollbarEnd() override; |
| 38 void DidMouseMoveOffScrollbar() override; | 41 void DidMouseMoveOffScrollbar() override; |
| 39 void DidMouseMoveNear(float distance) override; | 42 void DidMouseMoveNear(float distance) override; |
| 40 | 43 |
| 41 protected: | 44 protected: |
| 42 ScrollbarAnimationControllerThinning( | 45 ScrollbarAnimationControllerThinning( |
| 43 int scroll_layer_id, | 46 int scroll_layer_id, |
| 44 ScrollbarAnimationControllerClient* client, | 47 ScrollbarAnimationControllerClient* client, |
| 45 base::TimeDelta delay_before_starting, | 48 base::TimeDelta delay_before_starting, |
| 46 base::TimeDelta resize_delay_before_starting, | 49 base::TimeDelta resize_delay_before_starting, |
| 47 base::TimeDelta duration); | 50 base::TimeDelta duration); |
| 48 | 51 |
| 49 void RunAnimationFrame(float progress) override; | 52 void RunAnimationFrame(float progress) override; |
| 50 | 53 |
| 51 private: | 54 private: |
| 52 // Describes whether the current animation should INCREASE (darken / thicken) | 55 // Describes whether the current animation should INCREASE (darken / thicken) |
| 53 // a bar or DECREASE it (lighten / thin). | 56 // a bar or DECREASE it (lighten / thin). |
| 54 enum AnimationChange { NONE, INCREASE, DECREASE }; | 57 enum AnimationChange { NONE, INCREASE, DECREASE }; |
| 55 float OpacityAtAnimationProgress(float progress); | 58 float OpacityAtAnimationProgress(float progress); |
| 56 float ThumbThicknessScaleAtAnimationProgress(float progress); | 59 float ThumbThicknessScaleAtAnimationProgress(float progress); |
| 57 float AdjustScale(float new_value, | 60 float AdjustScale(float new_value, |
| 58 float current_value, | 61 float current_value, |
| 59 AnimationChange animation_change); | 62 AnimationChange animation_change); |
| 60 void ApplyOpacityAndThumbThicknessScale(float opacity, | 63 void ApplyOpacityAndThumbThicknessScale(float opacity, |
| 61 float thumb_thickness_scale); | 64 float thumb_thickness_scale); |
| 62 | 65 |
| 66 bool captured_; |
| 63 bool mouse_is_over_scrollbar_; | 67 bool mouse_is_over_scrollbar_; |
| 64 bool mouse_is_near_scrollbar_; | 68 bool mouse_is_near_scrollbar_; |
| 65 // Are we narrowing or thickening the bars. | 69 // Are we narrowing or thickening the bars. |
| 66 AnimationChange thickness_change_; | 70 AnimationChange thickness_change_; |
| 67 // Are we darkening or lightening the bars. | 71 // Are we darkening or lightening the bars. |
| 68 AnimationChange opacity_change_; | 72 AnimationChange opacity_change_; |
| 69 // How close should the mouse be to the scrollbar before we thicken it. | 73 // How close should the mouse be to the scrollbar before we thicken it. |
| 70 float mouse_move_distance_to_trigger_animation_; | 74 float mouse_move_distance_to_trigger_animation_; |
| 71 | 75 |
| 72 DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerThinning); | 76 DISALLOW_COPY_AND_ASSIGN(ScrollbarAnimationControllerThinning); |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 } // namespace cc | 79 } // namespace cc |
| 76 | 80 |
| 77 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 81 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
| OLD | NEW |