Add basic rubber banding support
<rdar://problem/8219429>
https://bugs.webkit.org/show_bug.cgi?id=53277

Reviewed by Maciej Stachowiak.

Source/JavaScriptCore: 

* wtf/Platform.h: Add ENABLE for rubber banding.

Source/WebCore: 

* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureEvent):
Pass gesture events to the FrameView.

* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleGestureEvent):
* platform/ScrollAnimator.h:
Add stubbed out implementation.

* platform/ScrollView.cpp:
(WebCore::ScrollView::ScrollView):
(WebCore::ScrollView::overhangAmount):
(WebCore::ScrollView::wheelEvent):
* platform/ScrollView.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::ScrollableArea):
(WebCore::ScrollableArea::handleGestureEvent):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::constrainsScrollingToContentEdge):
(WebCore::ScrollableArea::setConstrainsScrollingToContentEdge):
Move constrains scrolling bit to ScrollableArea from ScrollView.

(WebCore::ScrollableArea::contentsSize):
(WebCore::ScrollableArea::overhangAmount):
Add additional virtual functions for information needed by the animator.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::immediateScrollByDeltaX):
(WebCore::ScrollAnimatorMac::immediateScrollByDeltaY):
(WebCore::elasticDeltaForTimeDelta):
(WebCore::elasticDeltaForReboundDelta):
(WebCore::reboundDeltaForElasticDelta):
(WebCore::scrollWheelMultiplier):
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::handleGestureEvent):
(WebCore::ScrollAnimatorMac::pinnedInDirection):
(WebCore::ScrollAnimatorMac::allowsVerticalStretching):
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
(WebCore::ScrollAnimatorMac::beginScrollGesture):
(WebCore::ScrollAnimatorMac::endScrollGesture):
(WebCore::ScrollAnimatorMac::snapRubberBand):
(WebCore::roundTowardZero):
(WebCore::roundToDevicePixelTowardZero):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
Implement basic rubber banding.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h
index a05fcf5..178cfc6 100644
--- a/Source/WebCore/platform/ScrollableArea.h
+++ b/Source/WebCore/platform/ScrollableArea.h
@@ -36,6 +36,10 @@
 class PlatformWheelEvent;
 class ScrollAnimator;
 
+#if ENABLE(GESTURE_EVENTS)
+class PlatformGestureEvent;
+#endif
+
 class ScrollableArea {
 public:
     ScrollableArea();
@@ -48,6 +52,13 @@
     void scrollToYOffsetWithoutAnimation(float x);
 
     void handleWheelEvent(PlatformWheelEvent&);
+#if ENABLE(GESTURE_EVENTS)
+    void handleGestureEvent(const PlatformGestureEvent&);
+#endif
+
+    // Functions for controlling if you can scroll past the end of the document.
+    bool constrainsScrollingToContentEdge() const { return m_constrainsScrollingToContentEdge; }
+    void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEdge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; }
 
     virtual int scrollSize(ScrollbarOrientation) const = 0;
     virtual int scrollPosition(Scrollbar*) const = 0;
@@ -92,12 +103,17 @@
     virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
     virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
 
+    virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); }
+
+    virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); }
+
 private:
     // NOTE: Only called from the ScrollAnimator.
     friend class ScrollAnimator;
     void setScrollOffsetFromAnimation(const IntPoint&);
 
     OwnPtr<ScrollAnimator> m_scrollAnimator;
+    bool m_constrainsScrollingToContentEdge;
 };
 
 } // namespace WebCore