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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 686
687 IntPoint minPos = m_scrollableArea->minimumScrollPosition(); 687 IntPoint minPos = m_scrollableArea->minimumScrollPosition();
688 IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); 688 IntPoint maxPos = m_scrollableArea->maximumScrollPosition();
689 689
690 float newX = max<float>(min<float>(position.x(), maxPos.x()), minPos.x()); 690 float newX = max<float>(min<float>(position.x(), maxPos.x()), minPos.x());
691 float newY = max<float>(min<float>(position.y(), maxPos.y()), minPos.y()); 691 float newY = max<float>(min<float>(position.y(), maxPos.y()), minPos.y());
692 692
693 return FloatPoint(newX, newY); 693 return FloatPoint(newX, newY);
694 } 694 }
695 695
696 void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary()
697 {
698 bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollin gToContentEdge();
699 m_scrollableArea->setConstrainsScrollingToContentEdge(true);
700
701 IntPoint currentScrollPosition = absoluteScrollPosition();
702 FloatPoint nearestPointWithinBounds = adjustScrollPositionIfNecessary(absolu teScrollPosition());
703 immediateScrollBy(nearestPointWithinBounds - currentScrollPosition);
704
705 m_scrollableArea->setConstrainsScrollingToContentEdge(currentlyConstrainsToC ontentEdge);
706 }
707
696 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) 708 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition)
697 { 709 {
698 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); 710 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition);
699 711
700 bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosi tion.y() != m_currentPosY; 712 bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosi tion.y() != m_currentPosY;
701 if (!positionChanged && !scrollableArea()->scrollOriginChanged()) 713 if (!positionChanged && !scrollableArea()->scrollOriginChanged())
702 return; 714 return;
703 715
704 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo sition.y() - m_currentPosY); 716 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo sition.y() - m_currentPosY);
705 717
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 return; 1296 return;
1285 1297
1286 m_visibleScrollerThumbRect = rectInViewCoordinates; 1298 m_visibleScrollerThumbRect = rectInViewCoordinates;
1287 } 1299 }
1288 1300
1289 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1301 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1290 return isScrollbarOverlayAPIAvailable(); 1302 return isScrollbarOverlayAPIAvailable();
1291 } 1303 }
1292 1304
1293 } // namespace WebCore 1305 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698