#ifndef AutoscrollController_h
#define AutoscrollController_h
#include "platform/geometry/IntPoint.h"
#include "wtf/PassOwnPtr.h"
namespace WebCore {
class EventHandler;
class LocalFrame;
class FrameView;
class Node;
class Page;
class PlatformMouseEvent;
class RenderBox;
class RenderObject;
enum AutoscrollType {
NoAutoscroll,
AutoscrollForDragAndDrop,
AutoscrollForSelection,
#if OS(WIN)
AutoscrollForPanCanStop,
AutoscrollForPan,
#endif
};
class AutoscrollController {
public:
static PassOwnPtr<AutoscrollController> create(Page&);
void animate(double monotonicFrameBeginTime);
bool autoscrollInProgress() const;
bool autoscrollInProgress(const RenderBox*) const;
bool panScrollInProgress() const;
void startAutoscrollForSelection(RenderObject*);
void stopAutoscroll();
void stopAutoscrollIfNeeded(RenderObject*);
void updateAutoscrollRenderer();
void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, double eventTime);
#if OS(WIN)
void handleMouseReleaseForPanScrolling(LocalFrame*, const PlatformMouseEvent&);
void startPanScrolling(RenderBox*, const IntPoint&);
#endif
private:
explicit AutoscrollController(Page&);
void startAutoscroll();
#if OS(WIN)
void updatePanScrollState(FrameView*, const IntPoint& lastKnownMousePosition);
#endif
Page& m_page;
RenderBox* m_autoscrollRenderer;
AutoscrollType m_autoscrollType;
IntPoint m_dragAndDropAutoscrollReferencePosition;
double m_dragAndDropAutoscrollStartTime;
#if OS(WIN)
IntPoint m_panScrollStartPos;
#endif
};
}
#endif