Commit 2957b0c5 authored by andersca@apple.com's avatar andersca@apple.com

Add ScrollElasticityControllerClient::immediateScrollBy

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

Reviewed by Andreas Kling.

Add a new ScrollElasticityControllerClient::immediateScrollBy client member function.
Also, make ScrollAnimatorMac::smoothScrollWithEvent calls go through the ScrollElasticityController
in preparation for moving that function to ScrollElasticityController.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
* platform/mac/ScrollElasticityController.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a207489d
2012-01-06 Anders Carlsson <andersca@apple.com>
Add ScrollElasticityControllerClient::immediateScrollBy
https://bugs.webkit.org/show_bug.cgi?id=75720
Reviewed by Andreas Kling.
Add a new ScrollElasticityControllerClient::immediateScrollBy client member function.
Also, make ScrollAnimatorMac::smoothScrollWithEvent calls go through the ScrollElasticityController
in preparation for moving that function to ScrollElasticityController.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
* platform/mac/ScrollElasticityController.h:
2012-01-06 Wei James <james.wei@intel.com>
Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
......@@ -123,13 +123,13 @@ private:
FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;
void immediateScrollTo(const FloatPoint&);
void immediateScrollBy(const FloatSize&);
#if ENABLE(RUBBER_BANDING)
/// ScrollElasticityControllerClient member functions.
virtual IntSize stretchAmount() OVERRIDE;
virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
virtual void startSnapRubberbandTimer() OVERRIDE;
virtual void stopSnapRubberbandTimer() OVERRIDE;
......
......@@ -1144,7 +1144,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
bool isHorizontallyStretched = false;
bool shouldStretch = false;
IntSize stretchAmount = m_scrollableArea->overhangAmount();
IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount();
isHorizontallyStretched = stretchAmount.width();
isVerticallyStretched = stretchAmount.height();
......@@ -1207,11 +1207,11 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) {
if (deltaY != 0) {
deltaY *= scrollWheelMultiplier();
immediateScrollBy(FloatSize(0, deltaY));
m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(0, deltaY));
}
if (deltaX != 0) {
deltaX *= scrollWheelMultiplier();
immediateScrollBy(FloatSize(deltaX, 0));
m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(deltaX, 0));
}
} else {
if (!allowsHorizontalStretching()) {
......@@ -1220,7 +1220,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
} else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) {
deltaX *= scrollWheelMultiplier();
immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
deltaX = 0;
}
......@@ -1230,11 +1230,11 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
} else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) {
deltaY *= scrollWheelMultiplier();
immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
deltaY = 0;
}
IntSize stretchAmount = m_scrollableArea->overhangAmount();
IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount();
if (m_scrollElasticityController.m_momentumScrollInProgress) {
if ((pinnedInDirection(eventCoalescedDeltaX, eventCoalescedDeltaY) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_scrollElasticityController.m_lastMomentumScrollTimestamp) {
......@@ -1249,7 +1249,7 @@ void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEve
FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.height())));
immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
}
}
......
......@@ -41,6 +41,7 @@ protected:
public:
virtual IntSize stretchAmount() = 0;
virtual bool pinnedInDirection(const FloatSize&) = 0;
virtual void immediateScrollBy(const FloatSize&) = 0;
virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
virtual void startSnapRubberbandTimer() = 0;
virtual void stopSnapRubberbandTimer() = 0;
......@@ -55,13 +56,13 @@ public:
void beginScrollGesture();
private:
ScrollElasticityControllerClient* m_client;
void stopSnapRubberbandTimer();
// FIXME: These member variables should be private. They are currently public as a stop-gap measure, while
// the rubber-band related code from ScrollAnimatorMac is being moved over.
public:
ScrollElasticityControllerClient* m_client;
bool m_inScrollGesture;
bool m_momentumScrollInProgress;
bool m_ignoreMomentumScrolls;
......
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