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_SINGLE_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 5 #ifndef CC_INPUT_SINGLE_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
6 #define CC_INPUT_SINGLE_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 6 #define CC_INPUT_SINGLE_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 15 matching lines...) Expand all Loading... |
26 static constexpr float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; | 26 static constexpr float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; |
27 | 27 |
28 static std::unique_ptr<SingleScrollbarAnimationControllerThinning> Create( | 28 static std::unique_ptr<SingleScrollbarAnimationControllerThinning> Create( |
29 ElementId scroll_element_id, | 29 ElementId scroll_element_id, |
30 ScrollbarOrientation orientation, | 30 ScrollbarOrientation orientation, |
31 ScrollbarAnimationControllerClient* client, | 31 ScrollbarAnimationControllerClient* client, |
32 base::TimeDelta thinning_duration); | 32 base::TimeDelta thinning_duration); |
33 | 33 |
34 ~SingleScrollbarAnimationControllerThinning() {} | 34 ~SingleScrollbarAnimationControllerThinning() {} |
35 | 35 |
36 bool mouse_is_over_scrollbar() const { return mouse_is_over_scrollbar_; } | 36 bool mouse_is_over_scrollbar_thumb() const { |
| 37 return mouse_is_over_scrollbar_thumb_; |
| 38 } |
| 39 bool mouse_is_near_scrollbar_thumb() const { |
| 40 return mouse_is_near_scrollbar_thumb_; |
| 41 } |
37 bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; } | 42 bool mouse_is_near_scrollbar() const { return mouse_is_near_scrollbar_; } |
38 bool captured() const { return captured_; } | 43 bool captured() const { return captured_; } |
39 | 44 |
40 bool Animate(base::TimeTicks now); | 45 bool Animate(base::TimeTicks now); |
41 void StartAnimation(); | 46 void StartAnimation(); |
42 void StopAnimation(); | 47 void StopAnimation(); |
43 | 48 |
44 void UpdateThumbThicknessScale(); | 49 void UpdateThumbThicknessScale(); |
45 | 50 |
46 void DidMouseDown(); | 51 void DidMouseDown(); |
47 void DidMouseUp(); | 52 void DidMouseUp(); |
48 void DidMouseLeave(); | 53 void DidMouseLeave(); |
49 void DidMouseMoveNear(float distance); | 54 void DidMouseMoveNear(float distance_to_scrollbar, float distance_to_thumb); |
50 | 55 |
51 private: | 56 private: |
52 SingleScrollbarAnimationControllerThinning( | 57 SingleScrollbarAnimationControllerThinning( |
53 ElementId scroll_element_id, | 58 ElementId scroll_element_id, |
54 ScrollbarOrientation orientation, | 59 ScrollbarOrientation orientation, |
55 ScrollbarAnimationControllerClient* client, | 60 ScrollbarAnimationControllerClient* client, |
56 base::TimeDelta thinning_duration); | 61 base::TimeDelta thinning_duration); |
57 | 62 |
58 float AnimationProgressAtTime(base::TimeTicks now); | 63 float AnimationProgressAtTime(base::TimeTicks now); |
59 void RunAnimationFrame(float progress); | 64 void RunAnimationFrame(float progress); |
(...skipping 13 matching lines...) Expand all Loading... |
73 | 78 |
74 ScrollbarAnimationControllerClient* client_; | 79 ScrollbarAnimationControllerClient* client_; |
75 | 80 |
76 base::TimeTicks last_awaken_time_; | 81 base::TimeTicks last_awaken_time_; |
77 bool is_animating_; | 82 bool is_animating_; |
78 | 83 |
79 ElementId scroll_element_id_; | 84 ElementId scroll_element_id_; |
80 | 85 |
81 ScrollbarOrientation orientation_; | 86 ScrollbarOrientation orientation_; |
82 bool captured_; | 87 bool captured_; |
83 bool mouse_is_over_scrollbar_; | 88 bool mouse_is_over_scrollbar_thumb_; |
| 89 bool mouse_is_near_scrollbar_thumb_; |
84 bool mouse_is_near_scrollbar_; | 90 bool mouse_is_near_scrollbar_; |
85 // Are we narrowing or thickening the bars. | 91 // Are we narrowing or thickening the bars. |
86 AnimationChange thickness_change_; | 92 AnimationChange thickness_change_; |
87 | 93 |
88 base::TimeDelta thinning_duration_; | 94 base::TimeDelta thinning_duration_; |
89 | 95 |
90 DISALLOW_COPY_AND_ASSIGN(SingleScrollbarAnimationControllerThinning); | 96 DISALLOW_COPY_AND_ASSIGN(SingleScrollbarAnimationControllerThinning); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace cc | 99 } // namespace cc |
94 | 100 |
95 #endif // CC_INPUT_SINGLE_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ | 101 #endif // CC_INPUT_SINGLE_SCROLLBAR_ANIMATION_CONTROLLER_THINNING_H_ |
OLD | NEW |