Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0c538173039a9a42c2e4ee039fa4a536f81a8b1
      
https://github.com/WebKit/WebKit/commit/f0c538173039a9a42c2e4ee039fa4a536f81a8b1
  Author: Pablo Saavedra <[email protected]>
  Date:   2026-08-27 (Thu, 27 Aug 2026)

  Changed paths:
    A 
LayoutTests/fast/events/touch/touch-move-during-pending-touch-start-expected.txt
    A LayoutTests/fast/events/touch/touch-move-during-pending-touch-start.html
    M Source/WebKit/UIProcess/WebPageProxy.cpp

  Log Message:
  -----------
  REGRESSION(319347@main): Touchmove is dropped when it arrives while 
touchstart is still in flight
https://bugs.webkit.org/show_bug.cgi?id=322698

Reviewed by Fujii Hironori.

319347@main ([GTK][WPE] Support touch event asynchronous scrolling) introduced a
serialized touch event queue in the UI process for the COORDINATED_TOUCH_EVENTS
path, which coalesces consecutive touch moves onto the queued one. The 
coalescing
condition, however, has no fallback:

    if (event.type() == WebEventType::TouchMove && !touchEventQueue.isEmpty()) {
        QueuedTouchEvents& lastEvent = touchEventQueue.last();
        if (lastEvent.forwardedEvent.type() == WebEventType::TouchMove)
            lastEvent.deferredTouchEvents.append(event);
    } else {
        touchEventQueue.append(event);
        ...
    }

When a TouchMove arrives while the queue is non-empty but the last queued event 
is
not itself a TouchMove -- that is, while the TouchStart is still awaiting its
asynchronous reply from the web process -- neither branch runs and the event is
silently discarded. It is not forwarded to the web process and it is not 
appended
to deferredTouchEvents, so it never reaches the DOM and, because
PageClientImpl::doneWithTouchEvent() is only called for events that made it into
the queue, it never reaches the WPE gesture controller either.

The practical effect is that a touch drag delivered as a back-to-back
down/move/up burst degenerates into a second tap: the page observes touchstart
and touchend with no touchmove, the gesture controller sees no motion and
synthesizes mousemove/mousedown/mouseup/click, and nothing scrolls. This is how
touch events arrive both from a real touchscreen and from WebDriver, which emits
a single WPE_EVENT_TOUCH_MOVE per move action with no interpolation and no wait
between events (see the TODO in 
WebAutomationSession::platformSimulateTouchInteraction,
https://bugs.webkit.org/show_bug.cgi?id=275031).

Before 319347@main, the generic ENABLE(TOUCH_EVENTS) path sent every touch event
straight through with sendWithAsyncReply and no queue at all, and on non-Cocoa
platforms updateTouchEventTracking() unconditionally marked every tracking type
Synchronous, so every touchmove reached the DOM.

Restructure the condition so that coalescing is an early return and every other
event, including a TouchMove that cannot be coalesced, falls through to the
enqueue path. The intended coalescing behaviour is unchanged.

This went unnoticed because every test in fast/events/touch/ drives the engine
through eventSender.asyncTouchStart()/asyncTouchMove()/asyncTouchEnd(), each of
which awaits its round trip via 
doAfterProcessingAllPendingTouchAndWheelEvents().
The queue is therefore always empty by the time the next event is dispatched, 
and
the dropped-event path is never exercised.

The new test uses the synchronous eventSender touch API instead, which 
dispatches
the event and returns without waiting, so the whole sequence is pushed back to
back the way a touchscreen or WebDriver delivers it. Its listeners are 
registered
non-passive so that the touch start is tracked synchronously: its reply then
requires the web process main thread, which is blocked in the synchronous
eventSender message for the touch move, making the reproduction deterministic
rather than a race.

Test: fast/events/touch/touch-move-during-pending-touch-start.html
* 
LayoutTests/fast/events/touch/touch-move-during-pending-touch-start-expected.txt:
 Added.
* LayoutTests/fast/events/touch/touch-move-during-pending-touch-start.html: 
Added.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent):

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Canonical link: https://commits.webkit.org/319960@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to