| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targ
etOrigin.y) : NSMakePoint(targetOrigin.x, newPos); | 719 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, targ
etOrigin.y) : NSMakePoint(targetOrigin.x, newPos); |
| 720 } else | 720 } else |
| 721 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_cu
rrentPosY) : NSMakePoint(m_currentPosX, newPos); | 721 newPoint = orientation == HorizontalScrollbar ? NSMakePoint(newPos, m_cu
rrentPosY) : NSMakePoint(m_currentPosX, newPos); |
| 722 | 722 |
| 723 [m_scrollAnimationHelper.get() scrollToPoint:newPoint]; | 723 [m_scrollAnimationHelper.get() scrollToPoint:newPoint]; |
| 724 | 724 |
| 725 float usedDelta = (newPos - currentPos) / step; | 725 float usedDelta = (newPos - currentPos) / step; |
| 726 return ScrollResultOneDimensional(true, delta - usedDelta); | 726 return ScrollResultOneDimensional(true, delta - usedDelta); |
| 727 } | 727 } |
| 728 | 728 |
| 729 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset) | 729 void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset,
ScrollType scrollType) |
| 730 { | 730 { |
| 731 [m_scrollAnimationHelper.get() _stopRun]; | 731 [m_scrollAnimationHelper.get() _stopRun]; |
| 732 immediateScrollTo(offset); | 732 immediateScrollTo(offset, scrollType); |
| 733 } | 733 } |
| 734 | 734 |
| 735 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint&
position) const | 735 FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint&
position) const |
| 736 { | 736 { |
| 737 if (!m_scrollableArea->constrainsScrollingToContentEdge()) | 737 if (!m_scrollableArea->constrainsScrollingToContentEdge()) |
| 738 return position; | 738 return position; |
| 739 | 739 |
| 740 IntPoint minPos = m_scrollableArea->minimumScrollPosition(); | 740 IntPoint minPos = m_scrollableArea->minimumScrollPosition(); |
| 741 IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); | 741 IntPoint maxPos = m_scrollableArea->maximumScrollPosition(); |
| 742 | 742 |
| 743 float newX = std::max<float>(std::min<float>(position.x(), maxPos.x()), minP
os.x()); | 743 float newX = std::max<float>(std::min<float>(position.x(), maxPos.x()), minP
os.x()); |
| 744 float newY = std::max<float>(std::min<float>(position.y(), maxPos.y()), minP
os.y()); | 744 float newY = std::max<float>(std::min<float>(position.y(), maxPos.y()), minP
os.y()); |
| 745 | 745 |
| 746 return FloatPoint(newX, newY); | 746 return FloatPoint(newX, newY); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition) | 749 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition, ScrollT
ype scrollType) |
| 750 { | 750 { |
| 751 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); | 751 FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition); |
| 752 | 752 |
| 753 bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosi
tion.y() != m_currentPosY; | 753 bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosi
tion.y() != m_currentPosY; |
| 754 if (!positionChanged && !scrollableArea()->scrollOriginChanged()) | 754 if (!positionChanged && !scrollableArea()->scrollOriginChanged()) |
| 755 return; | 755 return; |
| 756 | 756 |
| 757 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo
sition.y() - m_currentPosY); | 757 FloatSize delta = FloatSize(adjustedPosition.x() - m_currentPosX, adjustedPo
sition.y() - m_currentPosY); |
| 758 | 758 |
| 759 m_currentPosX = adjustedPosition.x(); | 759 m_currentPosX = adjustedPosition.x(); |
| 760 m_currentPosY = adjustedPosition.y(); | 760 m_currentPosY = adjustedPosition.y(); |
| 761 notifyContentAreaScrolled(delta); | 761 notifyContentAreaScrolled(delta); |
| 762 notifyPositionChanged(); | 762 notifyPositionChanged(scrollType); |
| 763 } | 763 } |
| 764 | 764 |
| 765 void ScrollAnimatorMac::contentAreaWillPaint() const | 765 void ScrollAnimatorMac::contentAreaWillPaint() const |
| 766 { | 766 { |
| 767 if (!scrollableArea()->scrollbarsCanBeActive()) | 767 if (!scrollableArea()->scrollbarsCanBeActive()) |
| 768 return; | 768 return; |
| 769 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) | 769 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) |
| 770 [m_scrollbarPainterController.get() contentAreaWillDraw]; | 770 [m_scrollbarPainterController.get() contentAreaWillDraw]; |
| 771 } | 771 } |
| 772 | 772 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 return; | 1154 return; |
| 1155 | 1155 |
| 1156 m_visibleScrollerThumbRect = rectInViewCoordinates; | 1156 m_visibleScrollerThumbRect = rectInViewCoordinates; |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { | 1159 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { |
| 1160 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); | 1160 return ScrollbarThemeMacCommon::isOverlayAPIAvailable(); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 } // namespace blink | 1163 } // namespace blink |
| OLD | NEW |