Changeset 96663 in webkit
- Timestamp:
- Oct 4, 2011 4:48:39 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96662 r96663 1 2011-10-04 Anders Carlsson <andersca@apple.com> 2 3 Move code into ScrollElasticityController::beginScrollGesture() 4 https://bugs.webkit.org/show_bug.cgi?id=69383 5 6 Reviewed by John Sullivan. 7 8 * platform/mac/ScrollAnimatorMac.h: 9 Add new ScrollElasticityControllerClient member functions. 10 11 * platform/mac/ScrollAnimatorMac.mm: 12 (WebCore::ScrollAnimatorMac::isHorizontalScrollerPinnedToMinimumPosition): 13 (WebCore::ScrollAnimatorMac::isHorizontalScrollerPinnedToMaximumPosition): 14 (WebCore::ScrollAnimatorMac::stretchAmount): 15 (WebCore::ScrollAnimatorMac::startSnapRubberbandTimer): 16 (WebCore::ScrollAnimatorMac::stopSnapRubberbandTimer): 17 Implement the new ScrollElasticityControllerClient member functions. 18 19 (WebCore::ScrollAnimatorMac::beginScrollGesture): 20 Move code into ScrollElasticityController::beginScrollGesture and call it directly. 21 22 * platform/mac/ScrollElasticityController.h: 23 Add new ScrollElasticityControllerClient member functions. 24 25 * platform/mac/ScrollElasticityController.mm: 26 (WebCore::reboundDeltaForElasticDelta): 27 (WebCore::ScrollElasticityController::beginScrollGesture): 28 Set up the scroll gesture state. 29 30 (WebCore::ScrollElasticityController::stopSnapRubberbandTimer): 31 New helper function. 32 1 33 2011-10-04 Scott Graham <scottmg@chromium.org> 2 34 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h
r96651 r96663 139 139 140 140 #if ENABLE(RUBBER_BANDING) 141 /// ScrollElasticityControllerClient member functions. 142 virtual bool isHorizontalScrollerPinnedToMinimumPosition() OVERRIDE; 143 virtual bool isHorizontalScrollerPinnedToMaximumPosition() OVERRIDE; 144 virtual IntSize stretchAmount() OVERRIDE; 145 virtual void startSnapRubberbandTimer() OVERRIDE; 146 virtual void stopSnapRubberbandTimer() OVERRIDE; 147 141 148 bool allowsVerticalStretching() const; 142 149 bool allowsHorizontalStretching() const; -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r96652 r96663 881 881 return true; 882 882 return false; 883 } 884 885 bool ScrollAnimatorMac::isHorizontalScrollerPinnedToMinimumPosition() 886 { 887 return m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition(); 888 } 889 890 bool ScrollAnimatorMac::isHorizontalScrollerPinnedToMaximumPosition() 891 { 892 return m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition(); 893 } 894 895 IntSize ScrollAnimatorMac::stretchAmount() 896 { 897 return m_scrollableArea->overhangAmount(); 898 } 899 900 void ScrollAnimatorMac::startSnapRubberbandTimer() 901 { 902 m_snapRubberBandTimer.startRepeating(1.0 / 60.0); 903 } 904 905 void ScrollAnimatorMac::stopSnapRubberbandTimer() 906 { 907 m_snapRubberBandTimer.stop(); 883 908 } 884 909 … … 1076 1101 { 1077 1102 didBeginScrollGesture(); 1078 1079 1103 m_haveScrolledSincePageLoad = true; 1080 m_scrollElasticityController.m_inScrollGesture = true; 1081 m_scrollElasticityController.m_momentumScrollInProgress = false; 1082 m_scrollElasticityController.m_ignoreMomentumScrolls = false; 1083 m_scrollElasticityController.m_lastMomentumScrollTimestamp = 0; 1084 m_scrollElasticityController.m_momentumVelocity = FloatSize(); 1085 m_scrollElasticityController.m_scrollerInitiallyPinnedOnLeft = m_scrollableArea->isHorizontalScrollerPinnedToMinimumPosition(); 1086 m_scrollElasticityController.m_scrollerInitiallyPinnedOnRight = m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition(); 1087 m_scrollElasticityController.m_cumulativeHorizontalScroll = 0; 1088 m_scrollElasticityController.m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = false; 1089 1090 IntSize stretchAmount = m_scrollableArea->overhangAmount(); 1091 m_scrollElasticityController.m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width())); 1092 m_scrollElasticityController.m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height())); 1093 1094 m_scrollElasticityController.m_overflowScrollDelta = FloatSize(); 1095 1096 m_snapRubberBandTimer.stop(); 1097 m_scrollElasticityController.m_snapRubberbandTimerIsActive = false; 1104 1105 m_scrollElasticityController.beginScrollGesture(); 1098 1106 } 1099 1107 -
trunk/Source/WebCore/platform/mac/ScrollElasticityController.h
r96652 r96663 36 36 37 37 class ScrollElasticityControllerClient { 38 protected: 39 virtual ~ScrollElasticityControllerClient() { } 40 38 41 public: 39 virtual ~ScrollElasticityControllerClient() { } 42 virtual bool isHorizontalScrollerPinnedToMinimumPosition() = 0; 43 virtual bool isHorizontalScrollerPinnedToMaximumPosition() = 0; 44 45 virtual IntSize stretchAmount() = 0; 46 47 virtual void startSnapRubberbandTimer() = 0; 48 virtual void stopSnapRubberbandTimer() = 0; 40 49 }; 41 50 … … 46 55 explicit ScrollElasticityController(ScrollElasticityControllerClient*); 47 56 57 void beginScrollGesture(); 58 48 59 private: 49 60 ScrollElasticityControllerClient* m_client; 61 62 void stopSnapRubberbandTimer(); 50 63 51 64 // FIXME: These member variables should be private. They are currently public as a stop-gap measure, while -
trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm
r96652 r96663 31 31 namespace WebCore { 32 32 33 static const float rubberbandStiffness = 20; 34 35 static float reboundDeltaForElasticDelta(float delta) 36 { 37 return delta * rubberbandStiffness; 38 } 39 33 40 ScrollElasticityController::ScrollElasticityController(ScrollElasticityControllerClient* client) 34 41 : m_client(client) … … 46 53 } 47 54 55 void ScrollElasticityController::beginScrollGesture() 56 { 57 m_inScrollGesture = true; 58 m_momentumScrollInProgress = false; 59 m_ignoreMomentumScrolls = false; 60 m_lastMomentumScrollTimestamp = 0; 61 m_momentumVelocity = FloatSize(); 62 m_scrollerInitiallyPinnedOnLeft = m_client->isHorizontalScrollerPinnedToMinimumPosition(); 63 m_scrollerInitiallyPinnedOnRight = m_client->isHorizontalScrollerPinnedToMaximumPosition(); 64 m_cumulativeHorizontalScroll = 0; 65 m_didCumulativeHorizontalScrollEverSwitchToOppositeDirectionOfPin = false; 66 67 IntSize stretchAmount = m_client->stretchAmount(); 68 m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width())); 69 m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height())); 70 71 m_overflowScrollDelta = FloatSize(); 72 73 stopSnapRubberbandTimer(); 74 } 75 76 void ScrollElasticityController::stopSnapRubberbandTimer() 77 { 78 m_client->stopSnapRubberbandTimer(); 79 m_snapRubberbandTimerIsActive = false; 80 } 81 48 82 } // namespace WebCore 49 83
Note: See TracChangeset
for help on using the changeset viewer.