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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/scroll/Scrollbar.cpp ('k') | Source/platform/scroll/ScrollbarStateTransitionAnimator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollbarStateTransitionAnimator.h
diff --git a/Source/platform/scroll/ScrollbarStateTransitionAnimator.h b/Source/platform/scroll/ScrollbarStateTransitionAnimator.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0e9510a184d4008772c329529c12fe544aef9f4
--- /dev/null
+++ b/Source/platform/scroll/ScrollbarStateTransitionAnimator.h
@@ -0,0 +1,105 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ScrollbarStateTransitionAnimator_h
+#define ScrollbarStateTransitionAnimator_h
+
+#include "platform/PlatformExport.h"
+#include "platform/PlatformWheelEvent.h"
+#include "platform/Timer.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/scroll/ScrollTypes.h"
+#include "public/platform/WebThemeEngine.h"
+#include "wtf/FastAllocBase.h"
+#include "wtf/Forward.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+class ScrollableArea;
+class Scrollbar;
+
+class PLATFORM_EXPORT ScrollbarStateTransitionAnimator {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(ScrollbarStateTransitionAnimator);
+
+public:
+ static PassOwnPtr<ScrollbarStateTransitionAnimator> create(ScrollableArea*);
+
+ explicit ScrollbarStateTransitionAnimator(ScrollableArea*);
+ virtual ~ScrollbarStateTransitionAnimator();
+
+ ScrollableArea* scrollableArea() const
+ {
+ return m_scrollableArea;
+ }
+
+ void cancelAnimations();
+ void serviceAnimations();
+
+ void mouseEnteredScrollbar(Scrollbar*);
+ void mouseExitedScrollbar(Scrollbar*);
+
+ bool isDuringStateTransitionAnimation() const;
+
+ struct PLATFORM_EXPORT Parameters {
+ bool m_isEnabled;
+ double m_animationTime;
+ };
+
+ double stateTransitionProgress() const
+ {
+ return m_data.m_progress;
+ }
+ blink::WebThemeEngine::State stateTransitionStartState() const
+ {
+ return m_data.m_startState;
+ }
+ blink::WebThemeEngine::State stateTransitionEndState() const
+ {
+ return m_data.m_endState;
+ }
+
+protected:
+ void animationWillStart() { }
+ void animationDidFinish() { }
+
+ void notifyStateTransitionInProgress() const;
+
+ struct PLATFORM_EXPORT StateTransitionData {
+ StateTransitionData(ScrollbarStateTransitionAnimator* parent);
+ void reset();
+ void startStateTransitionAnimation(double currentTime, blink::WebThemeEngine::State startState, blink::WebThemeEngine::State endState, const Parameters);
+ bool animate(double currentTime);
+ bool duringAnimation(double currentTime) const;
+
+ double m_startTime;
+ double m_animationTime;
+
+ double m_lastAnimatedTime;
+
+ double m_progress; // between 0 and 1
+ blink::WebThemeEngine::State m_startState;
+ blink::WebThemeEngine::State m_endState;
+ };
+
+ void startNextTimer();
+ void animationTimerFired();
+
+ void stopAnimationTimerIfNeeded();
+ bool animationTimerActive();
+
+ virtual double currentTime() const;
+
+ ScrollableArea* m_scrollableArea;
+
+ Parameters m_parameters;
+ StateTransitionData m_data;
+
+ bool m_animationActive;
+};
+
+} // namespace WebCore
+
+#endif // ScrollbarStateTransitionAnimator_h
« 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