<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>244635</bug_id>
          
          <creation_ts>2022-08-31 14:44:02 -0700</creation_ts>
          <short_desc>[GLIB] Last end wheelEvent (phase=ended) has to be manipulated by the scrollingTree if still userScrollInProgress=True</short_desc>
          <delta_ts>2022-09-02 07:44:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=232376</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Pablo Saavedra">psaavedra</reporter>
          <assigned_to name="Pablo Saavedra">psaavedra</assigned_to>
          <cc>alex</cc>
    
    <cc>clord</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>psaavedra</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1895289</commentid>
    <comment_count>0</comment_count>
    <who name="Pablo Saavedra">psaavedra</who>
    <bug_when>2022-08-31 14:44:02 -0700</bug_when>
    <thetext>... on the contrary, the kinetic animation associated to the touch gesture will be inhibited and discarded since none event satisfying the &quot;event.isEndOfNonMomentumScroll()&quot; will be processed by the &quot;ScrollingEffectsController::processWheelEventForKineticScrolling()&quot;.

The &quot;ScrollingEffectsController::processWheelEventForKineticScrolling()&quot; is called inside of the &quot;scrollingTree-&gt;handleWheelEvent(platformWheelEvent, processingSteps);&quot; on the &quot;ScrollingThread::dispatch()&quot; of the &quot;void EventDispatcher::internalWheelEvent()&quot; 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 &quot;ended&quot; momentum phase &quot;none&quot; 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-&gt;willSendEventToMainThread(platformWheelEvent);
                protectedThis-&gt;dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps, wheelEventOrigin); /* The event is processed via MainThread. The ScrollingTree will be not involved */
                scrollingTree-&gt;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 &quot;ended&quot; momentum phase &quot;none&quot; 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-&gt;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 &quot;ended&quot; momentum phase &quot;none&quot; 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) &amp;&amp; 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&amp; event)
XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent&amp; 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&amp; event)
XXX:  ScrollAnimationKinetic::appendToScrollHistory(const PlatformWheelEvent&amp; 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 - &lt;rdar://problem/85247010&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895292</commentid>
    <comment_count>1</comment_count>
    <who name="Pablo Saavedra">psaavedra</who>
    <bug_when>2022-08-31 14:51:59 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/3878</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895777</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-09-02 07:43:06 -0700</bug_when>
    <thetext>Committed 254097@main (a1f7dcfc9842): &lt;https://commits.webkit.org/254097@main&gt;

Reviewed commits have been landed. Closing PR #3878 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895778</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-02 07:44:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/99488900&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>