#ifndef ScrollAnimator_h
#define ScrollAnimator_h
#include "platform/PlatformExport.h"
#include "platform/PlatformWheelEvent.h"
#include "platform/geometry/FloatSize.h"
#include "platform/scroll/ScrollTypes.h"
#include "wtf/FastAllocBase.h"
#include "wtf/Forward.h"
#include "wtf/Noncopyable.h"
namespace WebCore {
class FloatPoint;
class ScrollableArea;
class Scrollbar;
class PLATFORM_EXPORT ScrollAnimator {
WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(ScrollAnimator);
public:
static PassOwnPtr<ScrollAnimator> create(ScrollableArea*);
virtual ~ScrollAnimator();
virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float delta);
virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
ScrollableArea* scrollableArea() const { return m_scrollableArea; }
virtual void setIsActive() { }
virtual bool handleWheelEvent(const PlatformWheelEvent&);
#if OS(MACOSX)
virtual void handleWheelEventPhase(PlatformWheelEventPhase) { }
#endif
void setCurrentPosition(const FloatPoint&);
FloatPoint currentPosition() const;
virtual void cancelAnimations() { }
virtual void serviceScrollAnimations() { }
virtual void contentAreaWillPaint() const { }
virtual void mouseEnteredContentArea() const { }
virtual void mouseExitedContentArea() const { }
virtual void mouseMovedInContentArea() const { }
virtual void mouseEnteredScrollbar(Scrollbar*) const { }
virtual void mouseExitedScrollbar(Scrollbar*) const { }
virtual void willStartLiveResize() { }
virtual void contentsResized() const { }
virtual void willEndLiveResize() { }
virtual void contentAreaDidShow() const { }
virtual void contentAreaDidHide() const { }
virtual void finishCurrentScrollAnimations() { }
virtual void didAddVerticalScrollbar(Scrollbar*) { }
virtual void willRemoveVerticalScrollbar(Scrollbar*) { }
virtual void didAddHorizontalScrollbar(Scrollbar*) { }
virtual void willRemoveHorizontalScrollbar(Scrollbar*) { }
virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return true; }
virtual void notifyContentAreaScrolled(const FloatSize&) { }
virtual bool isRubberBandInProgress() const { return false; }
protected:
explicit ScrollAnimator(ScrollableArea*);
virtual void notifyPositionChanged();
ScrollableArea* m_scrollableArea;
float m_currentPosX;
float m_currentPosY;
private:
float clampScrollPosition(ScrollbarOrientation, float);
};
}
#endif