Commit f18273ae authored by andersca@apple.com's avatar andersca@apple.com

Move more rubberbanding code into ScrollAnimatorMac::smoothScrollWithEvent

https://bugs.webkit.org/show_bug.cgi?id=75750

Reviewed by Sam Weinig.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Move rubberbanding related code into smoothScrollWithEvent.

(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
Move code here from handleWheelEvent and made the function return a boolean.

(WebCore::ScrollAnimatorMac::snapRubberBand):
Call the client.

(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 128a99d8
2012-01-06 Anders Carlsson <andersca@apple.com>
Move more rubberbanding code into ScrollAnimatorMac::smoothScrollWithEvent
https://bugs.webkit.org/show_bug.cgi?id=75750
Reviewed by Sam Weinig.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Move rubberbanding related code into smoothScrollWithEvent.
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
Move code here from handleWheelEvent and made the function return a boolean.
(WebCore::ScrollAnimatorMac::snapRubberBand):
Call the client.
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
Ditto.
2012-01-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Use HashMap<OwnPtr> in SVGAttributeToPropertyMap
......@@ -141,7 +141,7 @@ private:
bool pinnedInDirection(float deltaX, float deltaY);
void snapRubberBand();
void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*);
void smoothScrollWithEvent(const PlatformWheelEvent&);
bool smoothScrollWithEvent(const PlatformWheelEvent&);
void beginScrollGesture();
void endScrollGesture();
......
......@@ -995,17 +995,7 @@ bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
}
}
bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
m_scrollElasticityController.m_ignoreMomentumScrolls = false;
return true;
}
return false;
}
smoothScrollWithEvent(wheelEvent);
return true;
return smoothScrollWithEvent(wheelEvent);
}
void ScrollAnimatorMac::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
......@@ -1139,8 +1129,17 @@ bool ScrollAnimatorMac::allowsHorizontalStretching() const
return false;
}
void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent)
bool ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent)
{
bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
m_scrollElasticityController.m_ignoreMomentumScrolls = false;
return true;
}
return false;
}
m_haveScrolledSincePageLoad = true;
float deltaX = m_scrollElasticityController.m_overflowScrollDelta.width();
......@@ -1279,6 +1278,8 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
m_scrollElasticityController.m_ignoreMomentumScrolls = false;
m_scrollElasticityController.m_lastMomentumScrollTimestamp = 0;
}
return true;
}
void ScrollAnimatorMac::beginScrollGesture()
......@@ -1317,7 +1318,7 @@ void ScrollAnimatorMac::snapRubberBand()
m_scrollElasticityController.m_origOrigin = FloatPoint();
m_scrollElasticityController.m_origVelocity = FloatSize();
m_snapRubberBandTimer.startRepeating(1.0/60.0);
m_scrollElasticityController.m_client->startSnapRubberbandTimer();
m_scrollElasticityController.m_snapRubberbandTimerIsActive = true;
}
......@@ -1377,7 +1378,7 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*)
if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) {
FloatPoint newOrigin = m_scrollElasticityController.m_origOrigin + delta;
immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
FloatSize newStretch = m_scrollElasticityController.m_client->stretchAmount();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment