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

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

Issue 122093002: Fix page jumping back to initial position after an overflow-bounce scroll. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: does not fail :-/ Created 6 years, 11 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/platform/mac/ScrollAnimatorMac.mm
diff --git a/Source/platform/mac/ScrollAnimatorMac.mm b/Source/platform/mac/ScrollAnimatorMac.mm
index 1fbbb9f7b39d09c32d2d51c6e3b30c1d09919ad6..7789e447be714f4297bf0cd6c66ff4e1a24d9c70 100644
--- a/Source/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/platform/mac/ScrollAnimatorMac.mm
@@ -693,6 +693,18 @@ 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);

Powered by Google App Engine
This is Rietveld 408576698