Index: Source/platform/mac/ScrollAnimatorMac.mm |
diff --git a/Source/platform/mac/ScrollAnimatorMac.mm b/Source/platform/mac/ScrollAnimatorMac.mm |
index b84bf606885782a016f7c69a26d7efab33abdf29..87bb470545ae2bcbf7ffc2393d6756efbb716c6f 100644 |
--- a/Source/platform/mac/ScrollAnimatorMac.mm |
+++ b/Source/platform/mac/ScrollAnimatorMac.mm |
@@ -661,10 +661,6 @@ ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) |
: ScrollAnimator(scrollableArea) |
, m_initialScrollbarPaintTimer(this, &ScrollAnimatorMac::initialScrollbarPaintTimerFired) |
, m_sendContentAreaScrolledTimer(this, &ScrollAnimatorMac::sendContentAreaScrolledTimerFired) |
-#if USE(RUBBER_BANDING) |
- , m_scrollElasticityController(this) |
- , m_snapRubberBandTimer(this, &ScrollAnimatorMac::snapRubberBandTimerFired) |
-#endif |
, m_haveScrolledSincePageLoad(false) |
, m_needsScrollerStyleUpdate(false) |
{ |
@@ -700,24 +696,6 @@ static bool scrollAnimationEnabledForSystem() |
return enabled; |
} |
-#if USE(RUBBER_BANDING) |
-static bool rubberBandingEnabledForSystem() |
-{ |
- static bool initialized = false; |
- static bool enabled = true; |
- // Caches the result, which is consistent with other apps like the Finder, which all |
- // require a restart after changing this default. |
- if (!initialized) { |
- // Uses -objectForKey: and not -boolForKey: in order to default to true if the value wasn't set. |
- id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"NSScrollViewRubberbanding"]; |
- if ([value isKindOfClass:[NSNumber class]]) |
- enabled = [value boolValue]; |
- initialized = true; |
- } |
- return enabled; |
-} |
-#endif |
- |
ScrollResultOneDimensional ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float delta) |
{ |
m_haveScrolledSincePageLoad = true; |
@@ -766,18 +744,6 @@ FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& |
return FloatPoint(newX, newY); |
} |
-void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary() |
-{ |
- bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollingToContentEdge(); |
- m_scrollableArea->setConstrainsScrollingToContentEdge(true); |
- |
- IntPoint currentScrollPosition = absoluteScrollPosition(); |
- FloatPoint nearestPointWithinBounds = adjustScrollPositionIfNecessary(absoluteScrollPosition()); |
- immediateScrollBy(nearestPointWithinBounds - currentScrollPosition); |
- |
- m_scrollableArea->setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge); |
-} |
- |
void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) |
{ |
FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); |
@@ -794,15 +760,6 @@ void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) |
notifyPositionChanged(); |
} |
-bool ScrollAnimatorMac::isRubberBandInProgress() const |
-{ |
-#if !USE(RUBBER_BANDING) |
- return false; |
-#else |
- return m_scrollElasticityController.isRubberBandInProgress(); |
-#endif |
-} |
- |
void ScrollAnimatorMac::immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition) |
{ |
ASSERT(m_scrollAnimationHelper); |
@@ -1076,168 +1033,6 @@ void ScrollAnimatorMac::handleWheelEventPhase(PlatformWheelEventPhase phase) |
mayBeginScrollGesture(); |
} |
-#if USE(RUBBER_BANDING) |
-ScrollResult ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) |
-{ |
- m_haveScrolledSincePageLoad = true; |
- |
- if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSystem() || m_scrollableArea->rubberBandingOnCompositorThread()) |
- return ScrollAnimator::handleWheelEvent(wheelEvent); |
- |
- // FIXME: This is somewhat roundabout hack to allow forwarding wheel events |
- // up to the parent scrollable area. It takes advantage of the fact that |
- // the base class implementation of handleWheelEvent will not accept the |
- // wheel event if there is nowhere to scroll. |
- if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) { |
- if (!allowsVerticalStretching()) |
- return ScrollAnimator::handleWheelEvent(wheelEvent); |
- } else { |
- if (!allowsHorizontalStretching()) |
- return ScrollAnimator::handleWheelEvent(wheelEvent); |
- } |
- |
- bool didHandleEvent = m_scrollElasticityController.handleWheelEvent(wheelEvent); |
- |
- // The elasticity controller can return false on a phase end event if rubber banding wasn't in progress. |
- // In this case, the wheel phase must still be handled so that that overlay scroll bars get hidden. |
- if (didHandleEvent || wheelEvent.phase() == PlatformWheelEventPhaseEnded || wheelEvent.phase() == PlatformWheelEventPhaseCancelled) |
- handleWheelEventPhase(wheelEvent.phase()); |
- |
- // Rubber banding in Blink does not exist anymore, so the fact that this does not compute the unused |
- // scroll deltas does not matter. This code will be deleted soon. |
- return ScrollResult(didHandleEvent); |
-} |
- |
-bool ScrollAnimatorMac::pinnedInDirection(float deltaX, float deltaY) |
-{ |
- FloatSize limitDelta; |
- if (fabsf(deltaY) >= fabsf(deltaX)) { |
- if (deltaY < 0) { |
- // We are trying to scroll up. Make sure we are not pinned to the top |
- limitDelta.setHeight(m_scrollableArea->visibleContentRect().y() + + m_scrollableArea->scrollOrigin().y()); |
- } else { |
- // We are trying to scroll down. Make sure we are not pinned to the bottom |
- limitDelta.setHeight(m_scrollableArea->contentsSize().height() - (m_scrollableArea->visibleContentRect().maxY() + m_scrollableArea->scrollOrigin().y())); |
- } |
- } else if (deltaX != 0) { |
- if (deltaX < 0) { |
- // We are trying to scroll left. Make sure we are not pinned to the left |
- limitDelta.setWidth(m_scrollableArea->visibleContentRect().x() + m_scrollableArea->scrollOrigin().x()); |
- } else { |
- // We are trying to scroll right. Make sure we are not pinned to the right |
- limitDelta.setWidth(m_scrollableArea->contentsSize().width() - (m_scrollableArea->visibleContentRect().maxX() + m_scrollableArea->scrollOrigin().x())); |
- } |
- } |
- |
- if ((deltaX != 0 || deltaY != 0) && (limitDelta.width() < 1 && limitDelta.height() < 1)) |
- return true; |
- return false; |
-} |
- |
-bool ScrollAnimatorMac::allowsVerticalStretching() |
-{ |
- switch (m_scrollableArea->verticalScrollElasticity()) { |
- case ScrollElasticityAutomatic: { |
- Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); |
- Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); |
- return (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()))); |
- } |
- case ScrollElasticityNone: |
- return false; |
- case ScrollElasticityAllowed: |
- return true; |
- } |
- |
- ASSERT_NOT_REACHED(); |
- return false; |
-} |
- |
-bool ScrollAnimatorMac::allowsHorizontalStretching() |
-{ |
- switch (m_scrollableArea->horizontalScrollElasticity()) { |
- case ScrollElasticityAutomatic: { |
- Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); |
- Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); |
- return (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()))); |
- } |
- case ScrollElasticityNone: |
- return false; |
- case ScrollElasticityAllowed: |
- return true; |
- } |
- |
- ASSERT_NOT_REACHED(); |
- return false; |
-} |
- |
-IntSize ScrollAnimatorMac::stretchAmount() |
-{ |
- return m_scrollableArea->overhangAmount(); |
-} |
- |
-bool ScrollAnimatorMac::pinnedInDirection(const FloatSize& direction) |
-{ |
- 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(); |
-} |
- |
-IntPoint ScrollAnimatorMac::absoluteScrollPosition() |
-{ |
- return m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin(); |
-} |
- |
-void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta) |
-{ |
- m_scrollableArea->setConstrainsScrollingToContentEdge(false); |
- immediateScrollBy(delta); |
- m_scrollableArea->setConstrainsScrollingToContentEdge(true); |
-} |
- |
-void ScrollAnimatorMac::immediateScrollBy(const FloatSize& delta) |
-{ |
- FloatPoint newPos = adjustScrollPositionIfNecessary(FloatPoint(m_currentPosX, m_currentPosY) + delta); |
- if (newPos.x() == m_currentPosX && newPos.y() == m_currentPosY) |
- return; |
- |
- FloatSize adjustedDelta = FloatSize(newPos.x() - m_currentPosX, newPos.y() - m_currentPosY); |
- |
- m_currentPosX = newPos.x(); |
- m_currentPosY = newPos.y(); |
- notifyContentAreaScrolled(adjustedDelta); |
- notifyPositionChanged(); |
-} |
- |
-void ScrollAnimatorMac::startSnapRubberbandTimer() |
-{ |
- m_snapRubberBandTimer.startRepeating(1.0 / 60.0, FROM_HERE); |
-} |
- |
-void ScrollAnimatorMac::stopSnapRubberbandTimer() |
-{ |
- m_snapRubberBandTimer.stop(); |
-} |
- |
-void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*) |
-{ |
- m_scrollElasticityController.snapRubberBandTimerFired(); |
-} |
-#endif |
- |
void ScrollAnimatorMac::setIsActive() |
{ |
if (!ScrollbarThemeMacCommon::isOverlayAPIAvailable()) |