| OLD | NEW |
| 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 Loading... |
| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 return; | 1293 return; |
| 1282 | 1294 |
| 1283 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1295 m_visibleScrollerThumbRect = rectInViewCoordinates; |
| 1284 } | 1296 } |
| 1285 | 1297 |
| 1286 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1298 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
| 1287 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); | 1299 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); |
| 1288 } | 1300 } |
| 1289 | 1301 |
| 1290 } // namespace WebCore | 1302 } // namespace WebCore |
| OLD | NEW |