| 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
|
|
|