Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1443)

Unified Diff: Source/core/platform/mac/ScrollAnimatorMac.mm

Issue 14703004: Reland "Unifies ScrollView and RenderLayer to use non-shi..." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/mac/ScrollAnimatorMac.mm
diff --git a/Source/core/platform/mac/ScrollAnimatorMac.mm b/Source/core/platform/mac/ScrollAnimatorMac.mm
index 3a3cecc83745591291c961f8eba2e5a3777cb8c8..00135e67b06567e830dde3f91a11cb459832cffe 100644
--- a/Source/core/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/core/platform/mac/ScrollAnimatorMac.mm
@@ -666,7 +666,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));
if (currentPos == newPos)
return false;
@@ -692,8 +692,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());
return FloatPoint(newX, newY);
}
« no previous file with comments | « Source/core/platform/graphics/chromium/GraphicsLayerChromium.cpp ('k') | Source/core/rendering/RenderLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698