Changeset 188641 in webkit
- Timestamp:
- Aug 19, 2015 11:13:53 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r188634 r188641 1 2015-08-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Scroll snapping should trigger when receiving a momentum end wheel event 4 https://bugs.webkit.org/show_bug.cgi?id=148155 5 6 Reviewed by Alexey Proskuryakov. 7 8 No new tests, since the purpose of this patch is to get existing tests to pass when 9 allowing similar wheel events to coalesce. To accomplish this, we relax our assumption 10 that the user must have generated at least 3 momentum wheel events in order for the 11 gliding animation to trigger. Upon receiving a wheel event indicating the end of the 12 momentum phase, we now kick off the gliding animation as long as any momentum event 13 was tracked earlier in the gesture with a nonzero wheel delta. 14 15 * platform/cocoa/ScrollController.mm: 16 (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Added logic to 17 begin a glide animation if we have received a momentum end event but have not 18 yet triggered a gliding animation. 19 * platform/cocoa/ScrollSnapAnimatorState.h: 20 * platform/cocoa/ScrollSnapAnimatorState.mm: 21 (WebCore::ScrollSnapAnimatorState::wheelDeltaTrackingIsInProgress): Minor refactoring 22 to make the wheel event processing code more readable. 23 (WebCore::ScrollSnapAnimatorState::hasFinishedTrackingWheelDeltas): Ditto. 24 1 25 2015-08-18 Myles C. Maxfield <mmaxfield@apple.com> 2 26 -
trunk/Source/WebCore/platform/cocoa/ScrollController.mm
r186469 r188641 555 555 // This check for DestinationReached ensures that we don't receive another set of momentum events after ending the last glide. 556 556 if (snapState.m_currentState != ScrollSnapState::Gliding && snapState.m_currentState != ScrollSnapState::DestinationReached) { 557 if (snapState. m_numWheelDeltasTracked < snapState.wheelDeltaWindowSize&& wheelDelta)557 if (snapState.wheelDeltaTrackingIsInProgress() && wheelDelta) 558 558 snapState.pushInitialWheelDelta(wheelDelta); 559 559 560 if ( (snapState.m_numWheelDeltasTracked == snapState.wheelDeltaWindowSize) && snapState.averageInitialWheelDelta())560 if (snapState.hasFinishedTrackingWheelDeltas() && snapState.averageInitialWheelDelta()) 561 561 beginScrollSnapAnimation(axis, ScrollSnapState::Gliding); 562 562 } … … 564 564 565 565 case WheelEventStatus::InertialScrollEnd: 566 if (snapState.wheelDeltaTrackingIsInProgress() && snapState.averageInitialWheelDelta()) 567 beginScrollSnapAnimation(axis, ScrollSnapState::Gliding); 568 566 569 snapState.clearInitialWheelDeltaWindow(); 567 570 snapState.m_shouldOverrideWheelEvent = false; -
trunk/Source/WebCore/platform/cocoa/ScrollSnapAnimatorState.h
r186469 r188641 53 53 bool isSnapping() const; 54 54 bool canReachTargetWithCurrentInitialScrollDelta() const; 55 bool wheelDeltaTrackingIsInProgress() const; 56 bool hasFinishedTrackingWheelDeltas() const; 55 57 float interpolatedOffsetAtProgress(float) const; 56 58 -
trunk/Source/WebCore/platform/cocoa/ScrollSnapAnimatorState.mm
r186469 r188641 85 85 } 86 86 87 bool ScrollSnapAnimatorState::wheelDeltaTrackingIsInProgress() const 88 { 89 return m_numWheelDeltasTracked && m_numWheelDeltasTracked < wheelDeltaWindowSize; 90 } 91 92 bool ScrollSnapAnimatorState::hasFinishedTrackingWheelDeltas() const 93 { 94 return m_numWheelDeltasTracked == wheelDeltaWindowSize; 95 } 96 87 97 float ScrollSnapAnimatorState::interpolatedOffsetAtProgress(float progress) const 88 98 {
Note: See TracChangeset
for help on using the changeset viewer.