Title: [104847] trunk/Source/WebCore
Revision
104847
Author
ander...@apple.com
Date
2012-01-12 12:43:02 -0800 (Thu, 12 Jan 2012)

Log Message

Add allowsHorizontalStretching and allowsVerticalStretching to ScrollElasticityControllerClient
https://bugs.webkit.org/show_bug.cgi?id=76202

Reviewed by Andreas Kling.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::allowsVerticalStretching):
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
* platform/mac/ScrollElasticityController.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104846 => 104847)


--- trunk/Source/WebCore/ChangeLog	2012-01-12 20:25:19 UTC (rev 104846)
+++ trunk/Source/WebCore/ChangeLog	2012-01-12 20:43:02 UTC (rev 104847)
@@ -1,5 +1,19 @@
 2012-01-12  Anders Carlsson  <ander...@apple.com>
 
+        Add allowsHorizontalStretching and allowsVerticalStretching to ScrollElasticityControllerClient
+        https://bugs.webkit.org/show_bug.cgi?id=76202
+
+        Reviewed by Andreas Kling.
+
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::allowsVerticalStretching):
+        (WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
+        (WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
+        * platform/mac/ScrollElasticityController.h:
+
+2012-01-12  Anders Carlsson  <ander...@apple.com>
+
         Move snapRubberBand to ScrollElasticityController
         https://bugs.webkit.org/show_bug.cgi?id=76200
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (104846 => 104847)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-12 20:25:19 UTC (rev 104846)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-12 20:43:02 UTC (rev 104847)
@@ -127,6 +127,8 @@
 #if ENABLE(RUBBER_BANDING)
     /// ScrollElasticityControllerClient member functions.
     virtual IntSize stretchAmount() OVERRIDE;
+    virtual bool allowsHorizontalStretching() OVERRIDE;
+    virtual bool allowsVerticalStretching() OVERRIDE;
     virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
     virtual bool canScrollHorizontally() OVERRIDE;
     virtual bool canScrollVertically() OVERRIDE;
@@ -136,8 +138,6 @@
     virtual void startSnapRubberbandTimer() OVERRIDE;
     virtual void stopSnapRubberbandTimer() OVERRIDE;
 
-    bool allowsVerticalStretching() const;
-    bool allowsHorizontalStretching() const;
     bool pinnedInDirection(float deltaX, float deltaY);
     void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*);
     bool smoothScrollWithEvent(const PlatformWheelEvent&);

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (104846 => 104847)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-12 20:25:19 UTC (rev 104846)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-12 20:43:02 UTC (rev 104847)
@@ -995,6 +995,42 @@
     return false;
 }
 
+bool ScrollAnimatorMac::allowsVerticalStretching()
+{
+    switch (m_scrollableArea->verticalScrollElasticity()) {
+    case ScrollElasticityAutomatic: {
+        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
+        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
+        return (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled())));
+    }
+    case ScrollElasticityNone:
+        return false;
+    case ScrollElasticityAllowed:
+        return true;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+bool ScrollAnimatorMac::allowsHorizontalStretching()
+{
+    switch (m_scrollableArea->horizontalScrollElasticity()) {
+    case ScrollElasticityAutomatic: {
+        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
+        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
+        return (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled())));
+    }
+    case ScrollElasticityNone:
+        return false;
+    case ScrollElasticityAllowed:
+        return true;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 IntSize ScrollAnimatorMac::stretchAmount()
 {
     return m_scrollableArea->overhangAmount();
@@ -1056,42 +1092,6 @@
     m_snapRubberBandTimer.stop();
 }
 
-bool ScrollAnimatorMac::allowsVerticalStretching() const
-{
-    switch (m_scrollableArea->verticalScrollElasticity()) {
-    case ScrollElasticityAutomatic: {
-        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
-        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
-        return (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled())));
-    }
-    case ScrollElasticityNone:
-        return false;
-    case ScrollElasticityAllowed:
-        return true;
-    }
-
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-bool ScrollAnimatorMac::allowsHorizontalStretching() const
-{
-    switch (m_scrollableArea->horizontalScrollElasticity()) {
-    case ScrollElasticityAutomatic: {
-        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
-        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
-        return (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled())));
-    }
-    case ScrollElasticityNone:
-        return false;
-    case ScrollElasticityAllowed:
-        return true;
-    }
-
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
 bool ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent)
 {
     bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
@@ -1197,7 +1197,7 @@
                 m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(deltaX, 0));
             }
         } else {
-            if (!allowsHorizontalStretching()) {
+            if (!m_scrollElasticityController.m_client->allowsHorizontalStretching()) {
                 deltaX = 0;
                 eventCoalescedDeltaX = 0;
             } else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) {
@@ -1207,7 +1207,7 @@
                 deltaX = 0;
             }
             
-            if (!allowsVerticalStretching()) {
+            if (!m_scrollElasticityController.m_client->allowsVerticalStretching()) {
                 deltaY = 0;
                 eventCoalescedDeltaY = 0;
             } else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) {

Modified: trunk/Source/WebCore/platform/mac/ScrollElasticityController.h (104846 => 104847)


--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.h	2012-01-12 20:25:19 UTC (rev 104846)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.h	2012-01-12 20:43:02 UTC (rev 104847)
@@ -39,6 +39,8 @@
     virtual ~ScrollElasticityControllerClient() { } 
 
 public:
+    virtual bool allowsHorizontalStretching() = 0;
+    virtual bool allowsVerticalStretching() = 0;
     virtual IntSize stretchAmount() = 0;
     virtual bool pinnedInDirection(const FloatSize&) = 0;
     virtual bool canScrollHorizontally() = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to