Title: [106031] trunk/Source/WebCore
- Revision
- 106031
- Author
- ander...@apple.com
- Date
- 2012-01-26 12:46:15 -0800 (Thu, 26 Jan 2012)
Log Message
Simplify checking for whether we should rubberband or not when at the edge
https://bugs.webkit.org/show_bug.cgi?id=77131
Reviewed by Beth Dakin.
We only need to check once if we're pinned at either edge whether we should rubber-band
or not. Do this when the wheel event phase is PlatformWheelEventPhaseBegan. This lets us
remove a bunch of code that would keep track of the current horizontal scroll direction.
* platform/mac/ScrollAnimatorMac.h:
(ScrollAnimatorMac):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::beginScrollGesture):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (106030 => 106031)
--- trunk/Source/WebCore/ChangeLog 2012-01-26 20:39:06 UTC (rev 106030)
+++ trunk/Source/WebCore/ChangeLog 2012-01-26 20:46:15 UTC (rev 106031)
@@ -1,3 +1,21 @@
+2012-01-26 Anders Carlsson <ander...@apple.com>
+
+ Simplify checking for whether we should rubberband or not when at the edge
+ https://bugs.webkit.org/show_bug.cgi?id=77131
+
+ Reviewed by Beth Dakin.
+
+ We only need to check once if we're pinned at either edge whether we should rubber-band
+ or not. Do this when the wheel event phase is PlatformWheelEventPhaseBegan. This lets us
+ remove a bunch of code that would keep track of the current horizontal scroll direction.
+
+ * platform/mac/ScrollAnimatorMac.h:
+ (ScrollAnimatorMac):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+ (WebCore::ScrollAnimatorMac::handleWheelEvent):
+ (WebCore::ScrollAnimatorMac::beginScrollGesture):
+
2012-01-26 Eli Fidler <efid...@rim.com>
[JSC] Inspector instrumentation for _javascript_ calls.
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (106030 => 106031)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-01-26 20:39:06 UTC (rev 106030)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-01-26 20:46:15 UTC (rev 106031)
@@ -138,11 +138,6 @@
ScrollElasticityController m_scrollElasticityController;
Timer<ScrollAnimatorMac> m_snapRubberBandTimer;
-
- bool m_scrollerInitiallyPinnedOnLeft;
- bool m_scrollerInitiallyPinnedOnRight;
- int m_cumulativeHorizontalScroll;
- bool m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin;
#endif
bool m_haveScrolledSincePageLoad;
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (106030 => 106031)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-01-26 20:39:06 UTC (rev 106030)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-01-26 20:46:15 UTC (rev 106031)
@@ -553,10 +553,6 @@
#if ENABLE(RUBBER_BANDING)
, m_scrollElasticityController(this)
, m_snapRubberBandTimer(this, &ScrollAnimatorMac::snapRubberBandTimerFired)
- , m_scrollerInitiallyPinnedOnLeft(false)
- , m_scrollerInitiallyPinnedOnRight(false)
- , m_cumulativeHorizontalScroll(0)
- , m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin(false)
#endif
, m_haveScrolledSincePageLoad(false)
, m_needsScrollerStyleUpdate(false)
@@ -920,39 +916,20 @@
} else {
if (!allowsHorizontalStretching())
return ScrollAnimator::handleWheelEvent(wheelEvent);
-
- if (m_scrollableArea->horizontalScrollbar()) {
- // If there is a scrollbar, we aggregate the wheel events to get an
- // overall trend of the scroll. If the direction of the scroll is ever
- // in the opposite direction of the pin location, then we switch the
- // boolean, and rubber band. That is, if we were pinned to the left,
- // and we ended up scrolling to the right, we rubber band.
- m_cumulativeHorizontalScroll += wheelEvent.deltaX();
- if (m_scrollerInitiallyPinnedOnLeft && m_cumulativeHorizontalScroll < 0)
- m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = true;
- if (m_scrollerInitiallyPinnedOnRight && m_cumulativeHorizontalScroll > 0)
- m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = true;
- }
-
- // After a gesture begins, we go through:
- // 1+ PlatformWheelEventPhaseNone
- // 0+ PlatformWheelEventPhaseChanged
- // 1 PlatformWheelEventPhaseEnded if there was at least one changed event
- if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseNone && !m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin) {
- if ((isScrollingLeftAndShouldNotRubberBand(wheelEvent, m_scrollableArea) &&
- m_scrollerInitiallyPinnedOnLeft &&
- m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition()) ||
- (isScrollingRightAndShouldNotRubberBand(wheelEvent, m_scrollableArea) &&
- m_scrollerInitiallyPinnedOnRight &&
- m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition())) {
- return ScrollAnimator::handleWheelEvent(wheelEvent);
- }
- }
}
if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
+ if (m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition() &&
+ isScrollingLeftAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
+ return false;
+
+ if (m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition() &&
+ isScrollingRightAndShouldNotRubberBand(wheelEvent, m_scrollableArea))
+ return false;
+
// We don't return after this because we still want the scroll elasticity controller to handle the wheel event.
beginScrollGesture();
+
} else if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) {
endScrollGesture();
return true;
@@ -1088,11 +1065,7 @@
{
didBeginScrollGesture();
- m_scrollerInitiallyPinnedOnLeft = m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition();
- m_scrollerInitiallyPinnedOnRight = m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition();
m_haveScrolledSincePageLoad = true;
- m_cumulativeHorizontalScroll = 0;
- m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = false;
m_scrollElasticityController.beginScrollGesture();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes