Title: [106046] trunk/Source/WebCore
Revision
106046
Author
[email protected]
Date
2012-01-26 14:33:49 -0800 (Thu, 26 Jan 2012)

Log Message

Simplify checking of whether we should rubberband horizontally
https://bugs.webkit.org/show_bug.cgi?id=77141

Reviewed by Adam Roben.

Have a single check for horizontal rubber-banding in both directions. This is in preparation
for moving this code into ScrollElasticityController.

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::shouldRubberBandInHorizontalDirection):
(WebCore::ScrollAnimatorMac::handleWheelEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106045 => 106046)


--- trunk/Source/WebCore/ChangeLog	2012-01-26 22:26:42 UTC (rev 106045)
+++ trunk/Source/WebCore/ChangeLog	2012-01-26 22:33:49 UTC (rev 106046)
@@ -1,3 +1,17 @@
+2012-01-26  Anders Carlsson  <[email protected]>
+
+        Simplify checking of whether we should rubberband horizontally
+        https://bugs.webkit.org/show_bug.cgi?id=77141
+
+        Reviewed by Adam Roben.
+
+        Have a single check for horizontal rubber-banding in both directions. This is in preparation
+        for moving this code into ScrollElasticityController.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::shouldRubberBandInHorizontalDirection):
+        (WebCore::ScrollAnimatorMac::handleWheelEvent):
+
 2012-01-26  Scott Graham  <[email protected]>
 
         Fix include path in gyp file for V8InternalSettings.h

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (106045 => 106046)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-26 22:26:42 UTC (rev 106045)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-26 22:33:49 UTC (rev 106046)
@@ -889,14 +889,14 @@
 
 #if ENABLE(RUBBER_BANDING)
 
-static inline bool isScrollingLeftAndShouldNotRubberBand(const PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)
+static bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)
 {
-    return wheelEvent.deltaX() > 0 && !scrollableArea->shouldRubberBandInDirection(ScrollLeft);
-}
+    if (wheelEvent.deltaX() > 0)
+        return scrollableArea->shouldRubberBandInDirection(ScrollLeft);
+    if (wheelEvent.deltaX() < 0)
+        return scrollableArea->shouldRubberBandInDirection(ScrollRight);
 
-static inline bool isScrollingRightAndShouldNotRubberBand(const PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)
-{
-    return wheelEvent.deltaX() < 0 && !scrollableArea->shouldRubberBandInDirection(ScrollRight);
+    return true;
 }
 
 bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
@@ -919,14 +919,10 @@
     }
 
     if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
-        if (m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition() &&
-            isScrollingLeftAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
+        if (pinnedInDirection(-wheelEvent.deltaX(), 0) &&
+            !shouldRubberBandInHorizontalDirection(wheelEvent, m_scrollableArea))
             return false;
 
-        if (m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition() &&
-            isScrollingRightAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
-            return false;
-
         didBeginScrollGesture();
     } else if (wheelEvent.phase() == PlatformWheelEventPhaseEnded)
         didEndScrollGesture();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to