Changeset 182334 in webkit
- Timestamp:
- Apr 3, 2015 2:32:59 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r182333 r182334 1 2015-04-03 Brent Fulgham <bfulgham@apple.com> 2 3 Expand test infrastructure to support scrolling tests 4 https://bugs.webkit.org/show_bug.cgi?id=143383 5 6 Reviewed by Darin Adler. 7 8 No new tests: No change in behavior. 9 10 This is an initial set of changes that clean up a few things I noticed while extending testing support 11 for scroll animations and wheel event gestures. 12 1. Reduce the amount of #ifdef code in EventHandler{Mac}. 13 2. Consolidate the idea of an "End Gesture" in the PlatformWheelEvent class. 14 3. Remove a number of unneeded null checks in EventHandler. 15 4. ScrollController must always have a client, so hold a reference instead of using a pointer. 16 17 * page/EventHandler.cpp: 18 (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'. 19 (WebCore::EventHandler::handleWheelEvent): Call 'platformNotifySnapIfNecessary' at method exit points. 20 (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted. 21 * page/EventHandler.h: 22 * page/mac/EventHandlerMac.mm: 23 (WebCore::EventHandler::platformCompleteWheelEvent): Remove unneeded null checks for 'view'. Remove 24 CSS_SNAP-specific call to 'platformNotifySnapIfNecessary'. This logic is now handled in the new 25 'platformNotifyIfEndGesture' method. 26 (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'. 27 (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted. 28 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: 29 (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): Pass 'this' as 30 reference to ScrollController constructor. 31 * platform/PlatformWheelEvent.h: 32 (WebCore::PlatformWheelEvent::shouldResetLatching): Call new 'isEndGesture' method. 33 (WebCore::PlatformWheelEvent::isEndGesture): Added method to encapsulate some code that was duplicated 34 in a number of places. 35 * platform/ScrollAnimator.cpp: 36 (WebCore::ScrollAnimator::ScrollAnimator): Pass 'this' as reference to ScrollController constructor. 37 * platform/cocoa/ScrollController.h: 38 * platform/cocoa/ScrollController.mm: 39 (WebCore::ScrollController::ScrollController): Update to reflect m_client is now a reference. 40 (WebCore::ScrollController::handleWheelEvent): Ditto. 41 (WebCore::ScrollController::snapRubberBandTimerFired): Ditto. Also, a drive-by fix for ending rubberband 42 snapping. This end-state wasn't deactivating the timer (even when the animation finished). This isn't a 43 huge problem, but I (will) rely on the state of the animation timer in a future patch to decide if 44 tests should run or continue waiting. 45 (WebCore::ScrollController::isRubberBandInProgress): Ditto. 46 (WebCore::ScrollController::startSnapRubberbandTimer): Ditto. 47 (WebCore::ScrollController::stopSnapRubberbandTimer): Ditto. 48 (WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Ditto. 49 (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Ditto. 50 (WebCore::ScrollController::startScrollSnapTimer): Ditto. 51 (WebCore::ScrollController::stopScrollSnapTimer): Ditto. 52 (WebCore::ScrollController::scrollSnapAnimationUpdate): Ditto. 53 (WebCore::ScrollController::beginScrollSnapAnimation): Ditto. 54 (WebCore::ScrollController::computeSnapDelta): Ditto. 55 (WebCore::ScrollController::computeGlideDelta): Ditto. 56 * platform/mac/ScrollAnimatorMac.mm: 57 (WebCore::gestureShouldBeginSnap): Use new PlatformWheelEvent::isEndGesture() method. 58 1 59 2015-04-03 Chris Fleizach <cfleizach@apple.com> 2 60 -
trunk/Source/WebCore/page/EventHandler.cpp
r181971 r182334 2628 2628 } 2629 2629 2630 #if ENABLE(CSS_SCROLL_SNAP) 2631 void EventHandler::platformNotifySnapIfNecessary(const PlatformWheelEvent&, ScrollableArea&) 2632 { 2633 } 2634 #endif 2630 void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent&, ScrollableArea*) 2631 { 2632 } 2635 2633 2636 2634 #endif … … 2683 2681 if (scrollableArea) 2684 2682 scrollableArea->setScrolledProgrammatically(false); 2683 platformNotifyIfEndGesture(adjustedEvent, scrollableArea); 2685 2684 if (!widget->platformWidget()) 2686 2685 return true; … … 2698 2697 } 2699 2698 2700 #if ENABLE(CSS_SCROLL_SNAP) 2701 if (scrollableArea) 2702 platformNotifySnapIfNecessary(adjustedEvent, *scrollableArea); 2703 #endif 2699 platformNotifyIfEndGesture(adjustedEvent, scrollableArea); 2704 2700 return true; 2705 2701 } … … 2709 2705 scrollableArea->setScrolledProgrammatically(false); 2710 2706 2711 return platformCompleteWheelEvent(event, scrollableContainer.get(), scrollableArea); 2707 bool handledEvent = platformCompleteWheelEvent(event, scrollableContainer.get(), scrollableArea); 2708 platformNotifyIfEndGesture(adjustedEvent, scrollableArea); 2709 return handledEvent; 2712 2710 } 2713 2711 -
trunk/Source/WebCore/page/EventHandler.h
r181971 r182334 211 211 bool platformCompleteWheelEvent(const PlatformWheelEvent&, ContainerNode* scrollableContainer, ScrollableArea*); 212 212 bool platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget&, ContainerNode* scrollableContainer); 213 214 #if ENABLE(CSS_SCROLL_SNAP) 215 void platformNotifySnapIfNecessary(const PlatformWheelEvent&, ScrollableArea&); 216 #endif 213 void platformNotifyIfEndGesture(const PlatformWheelEvent&, ScrollableArea*); 217 214 218 215 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS) -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r181879 r182334 939 939 { 940 940 // We do another check on the frame view because the event handler can run JS which results in the frame getting destroyed. 941 ASSERT(m_frame.view()); 941 942 FrameView* view = m_frame.view(); 942 943 … … 955 956 view = frameViewForLatchingState(m_frame, latchingState); 956 957 957 bool didHandleWheelEvent = view && view->wheelEvent(wheelEvent); 958 ASSERT(view); 959 960 bool didHandleWheelEvent = view->wheelEvent(wheelEvent); 958 961 if (scrollableContainer == latchingState->scrollableContainer()) { 959 962 // If we are just starting a scroll event, and have nowhere left to scroll, allow … … 963 966 964 967 // If the platform widget is handling the event, we always want to return false. 965 if ( view &&scrollableArea == view && view->platformWidget())968 if (scrollableArea == view && view->platformWidget()) 966 969 didHandleWheelEvent = false; 967 970 … … 969 972 } 970 973 971 bool didHandleEvent = view ? view->wheelEvent(wheelEvent) : false;974 bool didHandleEvent = view->wheelEvent(wheelEvent); 972 975 m_isHandlingWheelEvent = false; 973 974 #if ENABLE(CSS_SCROLL_SNAP)975 if (scrollableArea)976 platformNotifySnapIfNecessary(wheelEvent, *scrollableArea);977 #endif978 979 976 return didHandleEvent; 980 977 } … … 996 993 } 997 994 998 #if ENABLE(CSS_SCROLL_SNAP) 999 void EventHandler::platformNotifySnapIfNecessary(const PlatformWheelEvent& wheelEvent, ScrollableArea& scrollableArea) 1000 { 995 void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea) 996 { 997 if (!scrollableArea) 998 return; 999 1001 1000 // Special case handling for ending wheel gesture to activate snap animation: 1002 1001 if (wheelEvent.phase() != PlatformWheelEventPhaseEnded && wheelEvent.momentumPhase() != PlatformWheelEventPhaseEnded) 1003 1002 return; 1004 1003 1005 if (ScrollAnimator* scrollAnimator = scrollableArea.existingScrollAnimator()) 1004 #if ENABLE(CSS_SCROLL_SNAP) 1005 if (ScrollAnimator* scrollAnimator = scrollableArea->existingScrollAnimator()) 1006 1006 scrollAnimator->processWheelEventForScrollSnap(wheelEvent); 1007 }1008 1007 #endif 1009 1010 } 1008 } 1009 1010 } -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
r182242 r182334 56 56 ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac(ScrollingTree& scrollingTree, ScrollingNodeID nodeID) 57 57 : ScrollingTreeFrameScrollingNode(scrollingTree, nodeID) 58 , m_scrollController( this)58 , m_scrollController(*this) 59 59 , m_verticalScrollbarPainter(0) 60 60 , m_horizontalScrollbarPainter(0) -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r181879 r182334 163 163 float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; } 164 164 float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; } 165 bool useLatchedEventElement() const 166 { 167 return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseChanged 168 || m_momentumPhase == PlatformWheelEventPhaseBegan || m_momentumPhase == PlatformWheelEventPhaseChanged 169 || (m_phase == PlatformWheelEventPhaseEnded && m_momentumPhase == PlatformWheelEventPhaseNone); 170 } 171 bool shouldConsiderLatching() const 172 { 173 return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseMayBegin; 174 } 175 bool shouldResetLatching() const 176 { 177 if (m_phase == PlatformWheelEventPhaseCancelled || m_phase == PlatformWheelEventPhaseMayBegin) 178 return true; 179 180 if (m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseEnded) 181 return true; 182 183 return false; 184 } 165 bool useLatchedEventElement() const; 166 bool shouldConsiderLatching() const; 167 bool shouldResetLatching() const; 168 bool isEndGesture() const; 185 169 #else 186 170 bool useLatchedEventElement() const { return false; } … … 211 195 }; 212 196 197 #if PLATFORM(COCOA) 198 inline bool PlatformWheelEvent::useLatchedEventElement() const 199 { 200 return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseChanged 201 || m_momentumPhase == PlatformWheelEventPhaseBegan || m_momentumPhase == PlatformWheelEventPhaseChanged 202 || (m_phase == PlatformWheelEventPhaseEnded && m_momentumPhase == PlatformWheelEventPhaseNone); 203 } 204 205 inline bool PlatformWheelEvent::shouldConsiderLatching() const 206 { 207 return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseMayBegin; 208 } 209 210 inline bool PlatformWheelEvent::shouldResetLatching() const 211 { 212 return m_phase == PlatformWheelEventPhaseCancelled || m_phase == PlatformWheelEventPhaseMayBegin || isEndGesture(); 213 } 214 215 inline bool PlatformWheelEvent::isEndGesture() const 216 { 217 return m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseEnded; 218 } 219 220 #endif 221 213 222 } // namespace WebCore 214 223 -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r181087 r182334 51 51 : m_scrollableArea(scrollableArea) 52 52 #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC) 53 , m_scrollController( this)53 , m_scrollController(*this) 54 54 #endif 55 55 , m_currentPosX(0) -
trunk/Source/WebCore/platform/cocoa/ScrollController.h
r181510 r182334 100 100 101 101 public: 102 explicit ScrollController(ScrollControllerClient *);102 explicit ScrollController(ScrollControllerClient&); 103 103 104 104 bool handleWheelEvent(const PlatformWheelEvent&); … … 142 142 #endif 143 143 144 ScrollControllerClient *m_client;144 ScrollControllerClient& m_client; 145 145 146 146 CFTimeInterval m_lastMomentumScrollTimestamp; -
trunk/Source/WebCore/platform/cocoa/ScrollController.mm
r181510 r182334 121 121 } 122 122 123 ScrollController::ScrollController(ScrollControllerClient *client)123 ScrollController::ScrollController(ScrollControllerClient& client) 124 124 : m_client(client) 125 125 , m_lastMomentumScrollTimestamp(0) … … 145 145 if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) { 146 146 // First, check if we should rubber-band at all. 147 if (m_client ->pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0))147 if (m_client.pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0)) 148 148 && !shouldRubberBandInHorizontalDirection(wheelEvent)) 149 149 return false; … … 155 155 m_momentumVelocity = FloatSize(); 156 156 157 IntSize stretchAmount = m_client ->stretchAmount();157 IntSize stretchAmount = m_client.stretchAmount(); 158 158 m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width())); 159 159 m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height())); … … 185 185 m_overflowScrollDelta = FloatSize(); 186 186 187 IntSize stretchAmount = m_client ->stretchAmount();187 IntSize stretchAmount = m_client.stretchAmount(); 188 188 bool isVerticallyStretched = stretchAmount.height(); 189 189 bool isHorizontallyStretched = stretchAmount.width(); … … 229 229 230 230 if (isVerticallyStretched) { 231 if (!isHorizontallyStretched && m_client ->pinnedInDirection(FloatSize(deltaX, 0))) {231 if (!isHorizontallyStretched && m_client.pinnedInDirection(FloatSize(deltaX, 0))) { 232 232 // Stretching only in the vertical. 233 233 if (deltaY && (fabsf(deltaX / deltaY) < rubberbandDirectionLockStretchRatio)) … … 241 241 } else if (isHorizontallyStretched) { 242 242 // Stretching only in the horizontal. 243 if (m_client ->pinnedInDirection(FloatSize(0, deltaY))) {243 if (m_client.pinnedInDirection(FloatSize(0, deltaY))) { 244 244 if (deltaX && (fabsf(deltaY / deltaX) < rubberbandDirectionLockStretchRatio)) 245 245 deltaY = 0; … … 252 252 } else { 253 253 // Not stretching at all yet. 254 if (m_client ->pinnedInDirection(FloatSize(deltaX, deltaY))) {254 if (m_client.pinnedInDirection(FloatSize(deltaX, deltaY))) { 255 255 if (fabsf(deltaY) >= fabsf(deltaX)) { 256 256 if (fabsf(deltaX) < rubberbandMinimumRequiredDeltaBeforeStretch) { … … 269 269 if (deltaY) { 270 270 deltaY *= scrollWheelMultiplier(); 271 m_client ->immediateScrollBy(FloatSize(0, deltaY));271 m_client.immediateScrollBy(FloatSize(0, deltaY)); 272 272 } 273 273 if (deltaX) { 274 274 deltaX *= scrollWheelMultiplier(); 275 m_client ->immediateScrollBy(FloatSize(deltaX, 0));275 m_client.immediateScrollBy(FloatSize(deltaX, 0)); 276 276 } 277 277 } else { 278 if (!m_client ->allowsHorizontalStretching(wheelEvent)) {278 if (!m_client.allowsHorizontalStretching(wheelEvent)) { 279 279 deltaX = 0; 280 280 eventCoalescedDeltaX = 0; 281 } else if (deltaX && !isHorizontallyStretched && !m_client ->pinnedInDirection(FloatSize(deltaX, 0))) {281 } else if (deltaX && !isHorizontallyStretched && !m_client.pinnedInDirection(FloatSize(deltaX, 0))) { 282 282 deltaX *= scrollWheelMultiplier(); 283 283 284 m_client ->immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));284 m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0)); 285 285 deltaX = 0; 286 286 } 287 287 288 if (!m_client ->allowsVerticalStretching(wheelEvent)) {288 if (!m_client.allowsVerticalStretching(wheelEvent)) { 289 289 deltaY = 0; 290 290 eventCoalescedDeltaY = 0; 291 } else if (deltaY && !isVerticallyStretched && !m_client ->pinnedInDirection(FloatSize(0, deltaY))) {291 } else if (deltaY && !isVerticallyStretched && !m_client.pinnedInDirection(FloatSize(0, deltaY))) { 292 292 deltaY *= scrollWheelMultiplier(); 293 293 294 m_client ->immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));294 m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY)); 295 295 deltaY = 0; 296 296 } 297 297 298 IntSize stretchAmount = m_client ->stretchAmount();298 IntSize stretchAmount = m_client.stretchAmount(); 299 299 300 300 if (m_momentumScrollInProgress) { 301 if ((m_client ->pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_lastMomentumScrollTimestamp) {301 if ((m_client.pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_lastMomentumScrollTimestamp) { 302 302 m_ignoreMomentumScrolls = true; 303 303 m_momentumScrollInProgress = false; … … 311 311 FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.height()))); 312 312 313 m_client ->immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);313 m_client.immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount); 314 314 } 315 315 } … … 344 344 345 345 if (m_startStretch == FloatSize()) { 346 m_startStretch = m_client ->stretchAmount();346 m_startStretch = m_client.stretchAmount(); 347 347 if (m_startStretch == FloatSize()) { 348 348 stopSnapRubberbandTimer(); … … 356 356 } 357 357 358 m_origOrigin = m_client ->absoluteScrollPosition() - m_startStretch;358 m_origOrigin = m_client.absoluteScrollPosition() - m_startStretch; 359 359 m_origVelocity = m_momentumVelocity; 360 360 … … 364 364 365 365 // Don't rubber-band horizontally if it's not possible to scroll horizontally 366 if (!m_client ->canScrollHorizontally())366 if (!m_client.canScrollHorizontally()) 367 367 m_origVelocity.setWidth(0); 368 368 369 369 // Don't rubber-band vertically if it's not possible to scroll vertically 370 if (!m_client ->canScrollVertically())370 if (!m_client.canScrollVertically()) 371 371 m_origVelocity.setHeight(0); 372 372 } … … 376 376 377 377 if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) { 378 m_client ->immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client->stretchAmount());379 380 FloatSize newStretch = m_client ->stretchAmount();378 m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client.stretchAmount()); 379 380 FloatSize newStretch = m_client.stretchAmount(); 381 381 382 382 m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width())); 383 383 m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height())); 384 384 } else { 385 m_client ->adjustScrollPositionToBoundsIfNecessary();385 m_client.adjustScrollPositionToBoundsIfNecessary(); 386 386 387 387 stopSnapRubberbandTimer(); … … 395 395 m_startTime = [NSDate timeIntervalSinceReferenceDate]; 396 396 m_startStretch = FloatSize(); 397 if (!isRubberBandInProgress()) 398 stopSnapRubberbandTimer(); 397 399 } 398 400 } … … 403 405 return false; 404 406 405 return !m_client ->stretchAmount().isZero();407 return !m_client.stretchAmount().isZero(); 406 408 } 407 409 408 410 void ScrollController::startSnapRubberbandTimer() 409 411 { 410 m_client ->startSnapRubberbandTimer();412 m_client.startSnapRubberbandTimer(); 411 413 m_snapRubberbandTimer.startRepeating(1.0 / 60.0); 412 414 } … … 414 416 void ScrollController::stopSnapRubberbandTimer() 415 417 { 416 m_client ->stopSnapRubberbandTimer();418 m_client.stopSnapRubberbandTimer(); 417 419 m_snapRubberbandTimer.stop(); 418 420 m_snapRubberbandTimerIsActive = false; … … 442 444 { 443 445 if (wheelEvent.deltaX() > 0) 444 return m_client ->shouldRubberBandInDirection(ScrollLeft);446 return m_client.shouldRubberBandInDirection(ScrollLeft); 445 447 if (wheelEvent.deltaX() < 0) 446 return m_client ->shouldRubberBandInDirection(ScrollRight);448 return m_client.shouldRubberBandInDirection(ScrollRight); 447 449 448 450 return true; … … 527 529 endScrollSnapAnimation(axis, ScrollSnapState::UserInteraction); 528 530 snapState.pushInitialWheelDelta(wheelDelta); 529 snapState.m_beginTrackingWheelDeltaOffset = m_client ->scrollOffsetOnAxis(axis);531 snapState.m_beginTrackingWheelDeltaOffset = m_client.scrollOffsetOnAxis(axis); 530 532 break; 531 533 … … 609 611 RunLoop::Timer<ScrollController>& scrollSnapTimer = axis == ScrollEventAxis::Horizontal ? m_horizontalScrollSnapTimer : m_verticalScrollSnapTimer; 610 612 if (!scrollSnapTimer.isActive()) { 611 m_client ->startScrollSnapTimer(axis);613 m_client.startScrollSnapTimer(axis); 612 614 scrollSnapTimer.startRepeating(1.0 / 60.0); 613 615 } … … 616 618 void ScrollController::stopScrollSnapTimer(ScrollEventAxis axis) 617 619 { 618 m_client ->stopScrollSnapTimer(axis);620 m_client.stopScrollSnapTimer(axis); 619 621 RunLoop::Timer<ScrollController>& scrollSnapTimer = axis == ScrollEventAxis::Horizontal ? m_horizontalScrollSnapTimer : m_verticalScrollSnapTimer; 620 622 scrollSnapTimer.stop(); … … 646 648 float delta = snapState.m_currentState == ScrollSnapState::Snapping ? computeSnapDelta(axis) : computeGlideDelta(axis); 647 649 if (delta) 648 m_client ->immediateScrollOnAxis(axis, delta);650 m_client.immediateScrollOnAxis(axis, delta); 649 651 else 650 652 endScrollSnapAnimation(axis, ScrollSnapState::DestinationReached); … … 679 681 ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis); 680 682 681 LayoutUnit offset = m_client ->scrollOffsetOnAxis(axis);683 LayoutUnit offset = m_client.scrollOffsetOnAxis(axis); 682 684 float initialWheelDelta = newState == ScrollSnapState::Gliding ? snapState.averageInitialWheelDelta() : 0; 683 685 LayoutUnit projectedScrollDestination = newState == ScrollSnapState::Gliding ? snapState.m_beginTrackingWheelDeltaOffset + LayoutUnit(projectedInertialScrollDistance(initialWheelDelta)) : offset; … … 685 687 return; 686 688 687 float scaleFactor = m_client ->pageScaleFactor();689 float scaleFactor = m_client.pageScaleFactor(); 688 690 689 691 projectedScrollDestination = std::min(std::max(LayoutUnit(projectedScrollDestination / scaleFactor), snapState.m_snapOffsets.first()), snapState.m_snapOffsets.last()); … … 744 746 const ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis); 745 747 746 LayoutUnit offset = m_client ->scrollOffsetOnAxis(axis);748 LayoutUnit offset = m_client.scrollOffsetOnAxis(axis); 747 749 bool canComputeSnap = (snapState.m_initialOffset <= offset && offset < snapState.m_targetOffset) || (snapState.m_targetOffset < offset && offset <= snapState.m_initialOffset); 748 750 if (snapState.m_currentState != ScrollSnapState::Snapping || !canComputeSnap) … … 791 793 const ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis); 792 794 793 LayoutUnit offset = m_client ->scrollOffsetOnAxis(axis);795 LayoutUnit offset = m_client.scrollOffsetOnAxis(axis); 794 796 bool canComputeGlide = (snapState.m_initialOffset <= offset && offset < snapState.m_targetOffset) || (snapState.m_targetOffset < offset && offset <= snapState.m_initialOffset); 795 797 if (snapState.m_currentState != ScrollSnapState::Gliding || !canComputeGlide) -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r181087 r182334 1155 1155 return false; 1156 1156 1157 if ((wheelEvent.phase() != PlatformWheelEventPhaseEnded) 1158 && !(wheelEvent.phase() == PlatformWheelEventPhaseNone && wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded)) { 1157 if (wheelEvent.phase() != PlatformWheelEventPhaseEnded && !wheelEvent.isEndGesture()) 1159 1158 return false; 1160 }1161 1159 1162 1160 return true;
Note: See TracChangeset
for help on using the changeset viewer.