Title: [96652] trunk/Source/WebCore
- Revision
- 96652
- Author
- [email protected]
- Date
- 2011-10-04 15:14:49 -0700 (Tue, 04 Oct 2011)
Log Message
ScrollElasticityController should keep track of the rubberband timer state
https://bugs.webkit.org/show_bug.cgi?id=69381
Reviewed by Sam Weinig.
Add a m_snapRubberbandTimerIsActive member variable to ScrollElasticityController
and use it instead of checking whether the m_snapRubberbandTimer is active.
Eventually, ScrollElasticityControllerClient will have two member functions for starting
and stopping the timer, and the ScrollElasticityController will call them at the appropriate times.
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::beginScrollGesture):
It's OK to stop the timer unconditionally.
(WebCore::ScrollAnimatorMac::snapRubberBand):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
* platform/mac/ScrollElasticityController.h:
* platform/mac/ScrollElasticityController.mm:
(WebCore::ScrollElasticityController::ScrollElasticityController):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (96651 => 96652)
--- trunk/Source/WebCore/ChangeLog 2011-10-04 21:58:18 UTC (rev 96651)
+++ trunk/Source/WebCore/ChangeLog 2011-10-04 22:14:49 UTC (rev 96652)
@@ -1,5 +1,29 @@
2011-10-04 Anders Carlsson <[email protected]>
+ ScrollElasticityController should keep track of the rubberband timer state
+ https://bugs.webkit.org/show_bug.cgi?id=69381
+
+ Reviewed by Sam Weinig.
+
+ Add a m_snapRubberbandTimerIsActive member variable to ScrollElasticityController
+ and use it instead of checking whether the m_snapRubberbandTimer is active.
+
+ Eventually, ScrollElasticityControllerClient will have two member functions for starting
+ and stopping the timer, and the ScrollElasticityController will call them at the appropriate times.
+
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::handleWheelEvent):
+ (WebCore::ScrollAnimatorMac::beginScrollGesture):
+ It's OK to stop the timer unconditionally.
+
+ (WebCore::ScrollAnimatorMac::snapRubberBand):
+ (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+ * platform/mac/ScrollElasticityController.h:
+ * platform/mac/ScrollElasticityController.mm:
+ (WebCore::ScrollElasticityController::ScrollElasticityController):
+
+2011-10-04 Anders Carlsson <[email protected]>
+
Move all rubber-banding related member variables to ScrollElasticityController
https://bugs.webkit.org/show_bug.cgi?id=69379
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (96651 => 96652)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-10-04 21:58:18 UTC (rev 96651)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2011-10-04 22:14:49 UTC (rev 96652)
@@ -836,7 +836,7 @@
}
bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
- if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_snapRubberBandTimer.isActive())) {
+ if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
m_scrollElasticityController.m_ignoreMomentumScrolls = false;
return true;
@@ -1093,8 +1093,8 @@
m_scrollElasticityController.m_overflowScrollDelta = FloatSize();
- if (m_snapRubberBandTimer.isActive())
- m_snapRubberBandTimer.stop();
+ m_snapRubberBandTimer.stop();
+ m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
}
void ScrollAnimatorMac::endScrollGesture()
@@ -1112,7 +1112,7 @@
m_scrollElasticityController.m_inScrollGesture = false;
- if (m_snapRubberBandTimer.isActive())
+ if (m_scrollElasticityController.m_snapRubberbandTimerIsActive)
return;
m_scrollElasticityController.m_startTime = [NSDate timeIntervalSinceReferenceDate];
@@ -1121,6 +1121,7 @@
m_scrollElasticityController.m_origVelocity = FloatSize();
m_snapRubberBandTimer.startRepeating(1.0/60.0);
+ m_scrollElasticityController.m_snapRubberbandTimerIsActive = true;
}
static inline float roundTowardZero(float num)
@@ -1146,11 +1147,13 @@
m_scrollElasticityController.m_startStretch = m_scrollableArea->overhangAmount();
if (m_scrollElasticityController.m_startStretch == FloatSize()) {
m_snapRubberBandTimer.stop();
+
m_scrollElasticityController.m_stretchScrollForce = FloatSize();
m_scrollElasticityController.m_startTime = 0;
m_scrollElasticityController.m_startStretch = FloatSize();
m_scrollElasticityController.m_origOrigin = FloatPoint();
m_scrollElasticityController.m_origVelocity = FloatSize();
+ m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
return;
}
@@ -1195,12 +1198,13 @@
m_scrollableArea->didCompleteRubberBand(roundedIntSize(m_scrollElasticityController.m_startStretch));
m_snapRubberBandTimer.stop();
+
m_scrollElasticityController.m_stretchScrollForce = FloatSize();
-
m_scrollElasticityController.m_startTime = 0;
m_scrollElasticityController.m_startStretch = FloatSize();
m_scrollElasticityController.m_origOrigin = FloatPoint();
m_scrollElasticityController.m_origVelocity = FloatSize();
+ m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
}
} else {
m_scrollElasticityController.m_startTime = [NSDate timeIntervalSinceReferenceDate];
Modified: trunk/Source/WebCore/platform/mac/ScrollElasticityController.h (96651 => 96652)
--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.h 2011-10-04 21:58:18 UTC (rev 96651)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.h 2011-10-04 22:14:49 UTC (rev 96652)
@@ -70,6 +70,8 @@
FloatSize m_startStretch;
FloatPoint m_origOrigin;
FloatSize m_origVelocity;
+
+ bool m_snapRubberbandTimerIsActive;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm (96651 => 96652)
--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm 2011-10-04 21:58:18 UTC (rev 96651)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm 2011-10-04 22:14:49 UTC (rev 96652)
@@ -41,6 +41,7 @@
, m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin(false)
, m_lastMomentumScrollTimestamp(0)
, m_startTime(0)
+ , m_snapRubberbandTimerIsActive(false)
{
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes