+2012-01-26 Anders Carlsson <andersca@apple.com>
+
+ 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 <scottmg@chomium.org>
Fix include path in gyp file for V8InternalSettings.h
#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)
}
if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
- if (m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition() &&
- isScrollingLeftAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
- return false;
-
- if (m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition() &&
- isScrollingRightAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
+ if (pinnedInDirection(-wheelEvent.deltaX(), 0) &&
+ !shouldRubberBandInHorizontalDirection(wheelEvent, m_scrollableArea))
return false;
didBeginScrollGesture();