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

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

Issue 2877033002: Fix cc scrollbar layer issues with initialization, and use element ids throughout. (Closed)
Patch Set: none 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
« no previous file with comments | « cc/blink/web_scrollbar_layer_impl.cc ('k') | cc/input/scrollbar_animation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 // SingleScrollbarAnimationControllerThinnings. 37 // SingleScrollbarAnimationControllerThinnings.
38 class CC_EXPORT ScrollbarAnimationController { 38 class CC_EXPORT ScrollbarAnimationController {
39 public: 39 public:
40 // ScrollbarAnimationController for Android. It only has show & fade out 40 // ScrollbarAnimationController for Android. It only has show & fade out
41 // animation. 41 // animation.
42 static std::unique_ptr<ScrollbarAnimationController> 42 static std::unique_ptr<ScrollbarAnimationController>
43 CreateScrollbarAnimationControllerAndroid( 43 CreateScrollbarAnimationControllerAndroid(
44 ElementId scroll_element_id, 44 ElementId scroll_element_id,
45 ScrollbarAnimationControllerClient* client, 45 ScrollbarAnimationControllerClient* client,
46 base::TimeDelta fade_delay, 46 base::TimeDelta fade_delay,
47 base::TimeDelta fade_duration); 47 base::TimeDelta fade_duration,
48 float initial_opacity);
48 49
49 // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has show & 50 // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has show &
50 // fade out animation and thinning animation. 51 // fade out animation and thinning animation.
51 static std::unique_ptr<ScrollbarAnimationController> 52 static std::unique_ptr<ScrollbarAnimationController>
52 CreateScrollbarAnimationControllerAuraOverlay( 53 CreateScrollbarAnimationControllerAuraOverlay(
53 ElementId scroll_element_id, 54 ElementId scroll_element_id,
54 ScrollbarAnimationControllerClient* client, 55 ScrollbarAnimationControllerClient* client,
55 base::TimeDelta fade_delay, 56 base::TimeDelta fade_delay,
56 base::TimeDelta fade_duration, 57 base::TimeDelta fade_duration,
57 base::TimeDelta thinning_duration); 58 base::TimeDelta thinning_duration,
59 float initial_opacity);
58 60
59 ~ScrollbarAnimationController(); 61 ~ScrollbarAnimationController();
60 62
61 bool ScrollbarsHidden() const; 63 bool ScrollbarsHidden() const;
62 64
63 bool Animate(base::TimeTicks now); 65 bool Animate(base::TimeTicks now);
64 66
65 // WillUpdateScroll expects to be called even if the scroll position won't 67 // WillUpdateScroll expects to be called even if the scroll position won't
66 // change as a result of the scroll. Only effect Aura Overlay Scrollbar. 68 // change as a result of the scroll. Only effect Aura Overlay Scrollbar.
67 void WillUpdateScroll(); 69 void WillUpdateScroll();
(...skipping 13 matching lines...) Expand all
81 // Called when Blink wants to show the scrollbars (via 83 // Called when Blink wants to show the scrollbars (via
82 // ScrollableArea::showOverlayScrollbars). 84 // ScrollableArea::showOverlayScrollbars).
83 void DidRequestShowFromMainThread(); 85 void DidRequestShowFromMainThread();
84 86
85 // These methods are public for testing. 87 // These methods are public for testing.
86 bool MouseIsOverScrollbarThumb(ScrollbarOrientation orientation) const; 88 bool MouseIsOverScrollbarThumb(ScrollbarOrientation orientation) const;
87 bool MouseIsNearScrollbarThumb(ScrollbarOrientation orientation) const; 89 bool MouseIsNearScrollbarThumb(ScrollbarOrientation orientation) const;
88 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const; 90 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const;
89 bool MouseIsNearAnyScrollbar() const; 91 bool MouseIsNearAnyScrollbar() const;
90 92
93 ScrollbarSet Scrollbars() const;
94
91 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f; 95 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f;
92 96
93 private: 97 private:
94 // Describes whether the current animation should FadeIn or FadeOut. 98 // Describes whether the current animation should FadeIn or FadeOut.
95 enum AnimationChange { NONE, FADE_IN, FADE_OUT }; 99 enum AnimationChange { NONE, FADE_IN, FADE_OUT };
96 100
97 ScrollbarAnimationController(ElementId scroll_element_id, 101 ScrollbarAnimationController(ElementId scroll_element_id,
98 ScrollbarAnimationControllerClient* client, 102 ScrollbarAnimationControllerClient* client,
99 base::TimeDelta fade_delay, 103 base::TimeDelta fade_delay,
100 base::TimeDelta fade_duration); 104 base::TimeDelta fade_duration,
105 float initial_opacity);
101 106
102 ScrollbarAnimationController(ElementId scroll_element_id, 107 ScrollbarAnimationController(ElementId scroll_element_id,
103 ScrollbarAnimationControllerClient* client, 108 ScrollbarAnimationControllerClient* client,
104 base::TimeDelta fade_delay, 109 base::TimeDelta fade_delay,
105 base::TimeDelta fade_duration, 110 base::TimeDelta fade_duration,
106 base::TimeDelta thinning_duration); 111 base::TimeDelta thinning_duration,
112 float initial_opacity);
107 113
108 ScrollbarSet Scrollbars() const;
109 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController( 114 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController(
110 ScrollbarOrientation) const; 115 ScrollbarOrientation) const;
111 116
112 // Returns how far through the animation we are as a progress value from 117 // Returns how far through the animation we are as a progress value from
113 // 0 to 1. 118 // 0 to 1.
114 float AnimationProgressAtTime(base::TimeTicks now); 119 float AnimationProgressAtTime(base::TimeTicks now);
115 void RunAnimationFrame(float progress); 120 void RunAnimationFrame(float progress);
116 121
117 void StartAnimation(); 122 void StartAnimation();
118 void StopAnimation(); 123 void StopAnimation();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 vertical_controller_; 158 vertical_controller_;
154 std::unique_ptr<SingleScrollbarAnimationControllerThinning> 159 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
155 horizontal_controller_; 160 horizontal_controller_;
156 161
157 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; 162 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
158 }; 163 };
159 164
160 } // namespace cc 165 } // namespace cc
161 166
162 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 167 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/blink/web_scrollbar_layer_impl.cc ('k') | cc/input/scrollbar_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698