Chromium Code Reviews| Index: Source/core/platform/mac/ScrollAnimatorMac.mm |
| diff --git a/Source/core/platform/mac/ScrollAnimatorMac.mm b/Source/core/platform/mac/ScrollAnimatorMac.mm |
| index e0c60306086d7c7c65a4cc7cc364d769697b446e..79b313d6474d63cde6ec2f4ea2fb6d72714506f8 100644 |
| --- a/Source/core/platform/mac/ScrollAnimatorMac.mm |
| +++ b/Source/core/platform/mac/ScrollAnimatorMac.mm |
| @@ -667,7 +667,7 @@ bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranulari |
| return ScrollAnimator::scroll(orientation, granularity, step, multiplier); |
| float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_currentPosY; |
| - float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0); |
| + float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), m_scrollableArea->maximumScrollPosition(orientation)), m_scrollableArea->minimumScrollPosition(orientation)); |
|
trchen
2013/05/03 23:19:12
Should we add a float version of ScrollableArea::c
|
| if (currentPos == newPos) |
| return false; |
| @@ -693,8 +693,11 @@ FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& |
| if (!m_scrollableArea->constrainsScrollingToContentEdge()) |
| return position; |
| - float newX = max<float>(min<float>(position.x(), m_scrollableArea->contentsSize().width() - m_scrollableArea->visibleWidth()), 0); |
| - float newY = max<float>(min<float>(position.y(), m_scrollableArea->contentsSize().height() - m_scrollableArea->visibleHeight()), 0); |
| + IntPoint minPos = m_scrollableArea->minimumScrollPosition(); |
| + IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); |
| + |
| + float newX = max<float>(min<float>(position.x(), maxPos.x()), minPos.x()); |
| + float newY = max<float>(min<float>(position.y(), maxPos.y()), minPos.y()); |
|
trchen
2013/05/03 23:19:12
ditto
|
| return FloatPoint(newX, newY); |
| } |