Bug 244635 - [GLIB] Last end wheelEvent (phase=ended) has to be manipulated by the scrollingTree if still userScrollInProgress=True
Summary: [GLIB] Last end wheelEvent (phase=ended) has to be manipulated by the scrolli...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Linux
: P2 Normal
Assignee: Pablo Saavedra
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-08-31 14:44 PDT by Pablo Saavedra
Modified: 2022-09-02 07:44 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pablo Saavedra 2022-08-31 14:44:02 PDT
... on the contrary, the kinetic animation associated to the touch gesture will be inhibited and discarded since none event satisfying the "event.isEndOfNonMomentumScroll()" will be processed by the "ScrollingEffectsController::processWheelEventForKineticScrolling()".

The "ScrollingEffectsController::processWheelEventForKineticScrolling()" is called inside of the "scrollingTree->handleWheelEvent(platformWheelEvent, processingSteps);" on the "ScrollingThread::dispatch()" of the "void EventDispatcher::internalWheelEvent()" in Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp

Therefore, for the GLIB ports, we need to rely the PlatformWheelEventPhase::Ended events to the scrollingTree is still a user scroll action is on going like we already do this for the PlatformWheelEventPhase::Changed.



This is the current behavior:


```
XXX: Source/WebKit/UIProcess/API/wpe/TouchGestureController.cpp - wpe_input_touch_event_type_up - axis
ScrollingTree::determineWheelEventProcessing: wheelEvent PlatformWheelEvent 0x7fc7649573b0 at (640,323) deltaX 0.00 deltaY 0.00 phase "ended" momentum phase "none" velocity width=0 height=0 mapped to content point (640,323), in non-fast region 1
ScrollingTree::determineWheelEventProcessing: processingSteps [main thread scrolling, main thread blocking DOM event dispatch]

XXX: ScrollingThread::dispatch():
            ...
            if (useMainThreadForScrolling) {  /* This will be True */
                scrollingTree->willSendEventToMainThread(platformWheelEvent);
                protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps, wheelEventOrigin); /* The event is processed via MainThread. The ScrollingTree will be not involved */
                scrollingTree->waitForEventToBeProcessedByMainThread(platformWheelEvent);
                return;
            }

...

XXX: void EventHandler::defaultWheelEventHandler()
XXX: void EventHandler::defaultWheelEventHandler()
XXX: EventHandler::handleWheelEventInAppropriateEnclosingBox()
```

And this second trace is the expected behavior (after apply the patch associated to the bug):


```
XXXX: Source/WebKit/UIProcess/API/wpe/TouchGestureController.cpp - wpe_input_touch_event_type_up - axis
ScrollingTree::determineWheelEventProcessing: wheelEvent PlatformWheelEvent 0x7fae221833b0 at (537,358) deltaX 0.00 deltaY 0.00 phase "ended" momentum phase "none" velocity width=0 height=0 mapped to content point (537,358), in non-fast region 1
ScrollingTree::determineWheelEventProcessing: processingSteps [main thread scrolling, main thread blocking DOM event dispatch]

XXX ScrollingThread::dispatch():
            ...
            scrollingTree->willProcessWheelEvent();  /* Since useMainThreadForScrolling = false; because the changes applied in the patch*/
            ...

ScrollingTree 0x7fae6315b700 handleWheelEvent PlatformWheelEvent 0x7fae63016f90 at (537,358) deltaX 0.00 deltaY 0.00 phase "ended" momentum phase "none" velocity width=0 height=0
ScrollingTree::handleWheelEvent found node 85 for point (537,358)
XXX: Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp - WheelEventHandlingResult ScrollingTreeScrollingNodeDelegateNicosia::handleWheelEvent() --- bool handled = scrollingNode().canHandleWheelEvent(wheelEvent, eventTargeting) && m_scrollController.handleWheelEvent(wheelEvent)
XXX: scrollingNode().canHandleWheelEvent(wheelEvent, eventTargeting): 1
XXX: Source/WebCore/platform/ScrollingEffectsController.cpp - bool ScrollingEffectsController::handleWheelEvent()
...
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - event.isEndOfNonMomentumScroll() - 1
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - event.isTransitioningToMomentumScroll() - 0
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - event.isEndOfNonMomentumScroll() || event.isTransitioningToMomentumScroll() 
...
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - kineticAnimation.appendToScrollHistory(m_scrollHistory.takeFirst()) - m_scrollHistory = 0x7fac709882d0
XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent& event)
XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent& event) - append - event.m_deltaX(): 0.000000 - event.m_deltaY(): 54.000000
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - kineticAnimation.appendToScrollHistory(m_scrollHistory.takeFirst()) - m_scrollHistory = 0x7fac709882d0

... (the kinetic events generated during kinetic animation being appended to the Scroll History)

XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent& event)
XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent& event) - append - event.m_deltaX(): 0.000000 - event.m_deltaY(): 0.000000
XXX: bool ScrollingEffectsController::processWheelEventForKineticScrolling() - event.isEndOfNonMomentumScroll
XXX:   bool ScrollAnimationKinetic::startAnimatedScrollWithInitialVelocity - velocity= width=0 height=-3577.46
```


Related to: [GLIB] twitch.tv forces synchronous scrolling - https://bugs.webkit.org/show_bug.cgi?id=232376 - <rdar://problem/85247010>
Comment 1 Pablo Saavedra 2022-08-31 14:51:59 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3878
Comment 2 EWS 2022-09-02 07:43:06 PDT
Committed 254097@main (a1f7dcfc9842): <https://commits.webkit.org/254097@main>

Reviewed commits have been landed. Closing PR #3878 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-09-02 07:44:15 PDT
<rdar://problem/99488900>