Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: cc/input/scrollbar_animation_controller.h

Issue 2841943002: Overlay scrollbars expand only when mouse is near thumb (Closed)
Patch Set: pass point to SingleScrollbarController Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_H_ 5 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // DidResize expects to be called when clip layer size changed or scroll layer 75 // DidResize expects to be called when clip layer size changed or scroll layer
76 // size changed. 76 // size changed.
77 void DidResize(); 77 void DidResize();
78 78
79 void DidScrollBegin(); 79 void DidScrollBegin();
80 void DidScrollEnd(); 80 void DidScrollEnd();
81 81
82 void DidMouseDown(); 82 void DidMouseDown();
83 void DidMouseUp(); 83 void DidMouseUp();
84 void DidMouseLeave(); 84 void DidMouseLeave();
85 void DidMouseMoveNear(ScrollbarOrientation, float); 85 void DidMouseMove(const gfx::PointF& device_viewport_point);
86 86
87 // Called when Blink wants to show the scrollbars (via 87 // Called when Blink wants to show the scrollbars (via
88 // ScrollableArea::showOverlayScrollbars). 88 // ScrollableArea::showOverlayScrollbars).
89 void DidRequestShowFromMainThread(); 89 void DidRequestShowFromMainThread();
90 90
91 bool MouseIsOverScrollbar(ScrollbarOrientation orientation) const; 91 bool MouseIsOverScrollbarThumb(ScrollbarOrientation orientation) const;
bokan 2017/04/28 18:08:11 Add a comment that these methods are public for te
92 bool MouseIsNearScrollbarThumb(ScrollbarOrientation orientation) const;
92 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const; 93 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const;
93 bool MouseIsNearAnyScrollbar() const; 94 bool MouseIsNearAnyScrollbar() const;
94 95
95 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f; 96 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f;
96 97
97 private: 98 private:
98 // Describes whether the current animation should FadeIn or FadeOut. 99 // Describes whether the current animation should FadeIn or FadeOut.
99 enum AnimationChange { NONE, FADE_IN, FADE_OUT }; 100 enum AnimationChange { NONE, FADE_IN, FADE_OUT };
100 101
101 ScrollbarAnimationController(ElementId scroll_element_id, 102 ScrollbarAnimationController(ElementId scroll_element_id,
(...skipping 20 matching lines...) Expand all
122 123
123 void StartAnimation(); 124 void StartAnimation();
124 void StopAnimation(); 125 void StopAnimation();
125 126
126 void Show(); 127 void Show();
127 128
128 void PostDelayedAnimation(AnimationChange animation_change, bool on_resize); 129 void PostDelayedAnimation(AnimationChange animation_change, bool on_resize);
129 130
130 bool Captured() const; 131 bool Captured() const;
131 132
132 bool CalcNeedTriggerScrollbarShow(ScrollbarOrientation orientation,
133 float distance) const;
134
135 void ApplyOpacityToScrollbars(float opacity); 133 void ApplyOpacityToScrollbars(float opacity);
136 134
137 ScrollbarAnimationControllerClient* client_; 135 ScrollbarAnimationControllerClient* client_;
138 136
139 base::TimeTicks last_awaken_time_; 137 base::TimeTicks last_awaken_time_;
140 138
141 base::TimeDelta fade_delay_; 139 base::TimeDelta fade_delay_;
142 base::TimeDelta fade_out_resize_delay_; 140 base::TimeDelta fade_out_resize_delay_;
143 141
144 base::TimeDelta fade_duration_; 142 base::TimeDelta fade_duration_;
145 143
146 bool need_trigger_scrollbar_show_; 144 bool need_trigger_scrollbar_fade_in_;
147 145
148 bool is_animating_; 146 bool is_animating_;
149 AnimationChange animation_change_; 147 AnimationChange animation_change_;
150 148
151 const ElementId scroll_element_id_; 149 const ElementId scroll_element_id_;
152 bool currently_scrolling_; 150 bool currently_scrolling_;
153 bool show_in_fast_scroll_; 151 bool show_in_fast_scroll_;
154 152
155 base::CancelableClosure delayed_scrollbar_animation_; 153 base::CancelableClosure delayed_scrollbar_animation_;
156 154
157 float opacity_; 155 float opacity_;
158 156
159 const bool show_scrollbars_on_scroll_gesture_; 157 const bool show_scrollbars_on_scroll_gesture_;
160 const bool need_thinning_animation_; 158 const bool need_thinning_animation_;
159
161 std::unique_ptr<SingleScrollbarAnimationControllerThinning> 160 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
162 vertical_controller_; 161 vertical_controller_;
163 std::unique_ptr<SingleScrollbarAnimationControllerThinning> 162 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
164 horizontal_controller_; 163 horizontal_controller_;
165 164
166 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; 165 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
167 }; 166 };
168 167
169 } // namespace cc 168 } // namespace cc
170 169
171 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 170 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller.cc » ('j') | cc/input/scrollbar_animation_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698