Title: [104321] trunk/Source/WebCore
- Revision
- 104321
- Author
- [email protected]
- Date
- 2012-01-06 12:25:40 -0800 (Fri, 06 Jan 2012)
Log Message
Make ScrollAnimatorMac::snapRubberBandTimerFired use m_scrollElasticityController in more places
https://bugs.webkit.org/show_bug.cgi?id=75726
Reviewed by Sam Weinig.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::canScrollHorizontally):
(WebCore::ScrollAnimatorMac::canScrollVertically):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
* platform/mac/ScrollElasticityController.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104320 => 104321)
--- trunk/Source/WebCore/ChangeLog 2012-01-06 20:22:53 UTC (rev 104320)
+++ trunk/Source/WebCore/ChangeLog 2012-01-06 20:25:40 UTC (rev 104321)
@@ -1,3 +1,17 @@
+2012-01-06 Anders Carlsson <[email protected]>
+
+ Make ScrollAnimatorMac::snapRubberBandTimerFired use m_scrollElasticityController in more places
+ https://bugs.webkit.org/show_bug.cgi?id=75726
+
+ Reviewed by Sam Weinig.
+
+ * platform/mac/ScrollAnimatorMac.h:
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::canScrollHorizontally):
+ (WebCore::ScrollAnimatorMac::canScrollVertically):
+ (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+ * platform/mac/ScrollElasticityController.h:
+
2012-01-06 Pratik Solanki <[email protected]>
WebKit1 fails to compile with USE(CFNETWORK) and HAVE(NETWORK_CFDATA_ARRAY_CALLBACK)
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (104320 => 104321)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-01-06 20:22:53 UTC (rev 104320)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2012-01-06 20:25:40 UTC (rev 104321)
@@ -128,6 +128,8 @@
/// ScrollElasticityControllerClient member functions.
virtual IntSize stretchAmount() OVERRIDE;
virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
+ virtual bool canScrollHorizontally() OVERRIDE;
+ virtual bool canScrollVertically() OVERRIDE;
virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
virtual void startSnapRubberbandTimer() OVERRIDE;
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (104320 => 104321)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-01-06 20:22:53 UTC (rev 104320)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2012-01-06 20:25:40 UTC (rev 104321)
@@ -1065,6 +1065,22 @@
return pinnedInDirection(direction.width(), direction.height());
}
+bool ScrollAnimatorMac::canScrollHorizontally()
+{
+ Scrollbar* scrollbar = m_scrollableArea->horizontalScrollbar();
+ if (!scrollbar)
+ return false;
+ return scrollbar->enabled();
+}
+
+bool ScrollAnimatorMac::canScrollVertically()
+{
+ Scrollbar* scrollbar = m_scrollableArea->verticalScrollbar();
+ if (!scrollbar)
+ return false;
+ return scrollbar->enabled();
+}
+
void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta)
{
m_scrollableArea->setConstrainsScrollingToContentEdge(false);
@@ -1320,9 +1336,9 @@
CFTimeInterval timeDelta = [NSDate timeIntervalSinceReferenceDate] - m_scrollElasticityController.m_startTime;
if (m_scrollElasticityController.m_startStretch == FloatSize()) {
- m_scrollElasticityController.m_startStretch = m_scrollableArea->overhangAmount();
- if (m_scrollElasticityController.m_startStretch == FloatSize()) {
- m_snapRubberBandTimer.stop();
+ m_scrollElasticityController.m_startStretch = m_scrollElasticityController.m_client->stretchAmount();
+ if (m_scrollElasticityController.m_startStretch == FloatSize()) {
+ m_scrollElasticityController.m_client->stopSnapRubberbandTimer();
m_scrollElasticityController.m_stretchScrollForce = FloatSize();
m_scrollElasticityController.m_startTime = 0;
@@ -1342,13 +1358,11 @@
m_scrollElasticityController.m_origVelocity.setWidth(0);
// Don't rubber-band horizontally if it's not possible to scroll horizontally
- Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
- if (!hScroller || !hScroller->enabled())
+ if (!m_scrollElasticityController.m_client->canScrollHorizontally())
m_scrollElasticityController.m_origVelocity.setWidth(0);
- // Don't rubber-band vertically if it's not possible to scroll horizontally
- Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
- if (!vScroller || !vScroller->enabled())
+ // Don't rubber-band vertically if it's not possible to scroll vertically
+ if (!m_scrollElasticityController.m_client->canScrollVertically())
m_scrollElasticityController.m_origVelocity.setHeight(0);
}
@@ -1358,16 +1372,16 @@
if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) {
FloatPoint newOrigin = m_scrollElasticityController.m_origOrigin + delta;
- immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollableArea->overhangAmount());
+ immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
- FloatSize newStretch = m_scrollableArea->overhangAmount();
+ FloatSize newStretch = m_scrollElasticityController.m_client->stretchAmount();
m_scrollElasticityController.m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
m_scrollElasticityController.m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
} else {
immediateScrollTo(m_scrollElasticityController.m_origOrigin);
- m_snapRubberBandTimer.stop();
+ m_scrollElasticityController.m_client->stopSnapRubberbandTimer();
m_scrollElasticityController.m_stretchScrollForce = FloatSize();
m_scrollElasticityController.m_startTime = 0;
Modified: trunk/Source/WebCore/platform/mac/ScrollElasticityController.h (104320 => 104321)
--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.h 2012-01-06 20:22:53 UTC (rev 104320)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.h 2012-01-06 20:25:40 UTC (rev 104321)
@@ -41,6 +41,8 @@
public:
virtual IntSize stretchAmount() = 0;
virtual bool pinnedInDirection(const FloatSize&) = 0;
+ virtual bool canScrollHorizontally() = 0;
+ virtual bool canScrollVertically() = 0;
virtual void immediateScrollBy(const FloatSize&) = 0;
virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
virtual void startSnapRubberbandTimer() = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes