| 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..fe0efc39abff504c94bc077f7a914d3bdd6e8144
|
| --- /dev/null
|
| +++ b/Source/platform/scroll/ScrollbarStateTransitionAnimator.h
|
| @@ -0,0 +1,131 @@
|
| +/*
|
| + * Copyright (c) 2011, Google Inc. All rights reserved.
|
| + *
|
| + * Redistribution and use in source and binary forms, with or without
|
| + * modification, are permitted provided that the following conditions are
|
| + * met:
|
| + *
|
| + * * Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * * Redistributions in binary form must reproduce the above
|
| + * copyright notice, this list of conditions and the following disclaimer
|
| + * in the documentation and/or other materials provided with the
|
| + * distribution.
|
| + * * Neither the name of Google Inc. nor the names of its
|
| + * contributors may be used to endorse or promote products derived from
|
| + * this software without specific prior written permission.
|
| + *
|
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + */
|
| +
|
| +#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 WebCore {
|
| +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
|
|
|