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

Side by Side Diff: Source/platform/scroll/ScrollbarStateTransitionAnimator.h

Issue 246293006: Blink Support for Overlay Scrollbar Animation Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix unittest and move unittest to blink_platform_unittests Created 6 years, 3 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ScrollbarStateTransitionAnimator_h
6 #define ScrollbarStateTransitionAnimator_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/PlatformWheelEvent.h"
10 #include "platform/Timer.h"
11 #include "platform/geometry/FloatPoint.h"
12 #include "platform/geometry/FloatSize.h"
13 #include "platform/scroll/ScrollTypes.h"
14 #include "public/platform/WebThemeEngine.h"
15 #include "wtf/FastAllocBase.h"
16 #include "wtf/Forward.h"
17 #include "wtf/Noncopyable.h"
18
19 namespace blink {
20 class ScrollableArea;
21 class Scrollbar;
22
23 class PLATFORM_EXPORT ScrollbarStateTransitionAnimator {
24 WTF_MAKE_FAST_ALLOCATED;
25 WTF_MAKE_NONCOPYABLE(ScrollbarStateTransitionAnimator);
26
27 public:
28 static PassOwnPtr<ScrollbarStateTransitionAnimator> create(ScrollableArea*);
29
30 explicit ScrollbarStateTransitionAnimator(ScrollableArea*);
31 virtual ~ScrollbarStateTransitionAnimator();
32
33 ScrollableArea* scrollableArea() const
34 {
35 return m_scrollableArea;
36 }
37
38 void cancelAnimations();
39 void serviceAnimations();
40
41 void mouseEnteredScrollbar(Scrollbar*);
42 void mouseExitedScrollbar(Scrollbar*);
43
44 bool isDuringStateTransitionAnimation() const;
45
46 struct PLATFORM_EXPORT Parameters {
47 bool m_isEnabled;
48 double m_animationTime;
49 };
50
51 double stateTransitionProgress() const
52 {
53 return m_data.m_progress;
54 }
55 blink::WebThemeEngine::State stateTransitionStartState() const
56 {
57 return m_data.m_startState;
58 }
59 blink::WebThemeEngine::State stateTransitionEndState() const
60 {
61 return m_data.m_endState;
62 }
63
64 protected:
65 void animationWillStart() { }
66 void animationDidFinish() { }
67
68 void notifyStateTransitionInProgress() const;
69
70 struct PLATFORM_EXPORT StateTransitionData {
71 StateTransitionData(ScrollbarStateTransitionAnimator* parent);
72 void reset();
73 void startStateTransitionAnimation(double currentTime, blink::WebThemeEn gine::State startState, blink::WebThemeEngine::State endState, const Parameters) ;
74 bool animate(double currentTime);
75 bool duringAnimation(double currentTime) const;
76
77 double m_startTime;
78 double m_animationTime;
79
80 double m_lastAnimatedTime;
81
82 double m_progress; // between 0 and 1
83 blink::WebThemeEngine::State m_startState;
84 blink::WebThemeEngine::State m_endState;
85 };
86
87 void startNextTimer();
88 void animationTimerFired();
89
90 void stopAnimationTimerIfNeeded();
91 bool animationTimerActive();
92
93 virtual double currentTime() const;
94
95 ScrollableArea* m_scrollableArea;
96
97 Parameters m_parameters;
98 StateTransitionData m_data;
99
100 bool m_animationActive;
101 };
102
103 } // namespace WebCore
104
105 #endif // ScrollbarStateTransitionAnimator_h
OLDNEW
« no previous file with comments | « Source/platform/scroll/Scrollbar.cpp ('k') | Source/platform/scroll/ScrollbarStateTransitionAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698