webdriver: Support interspersed pointerMove actions via event queue#42289
Merged
yezhizhen merged 5 commits intoservo:mainfrom Feb 3, 2026
Merged
webdriver: Support interspersed pointerMove actions via event queue#42289yezhizhen merged 5 commits intoservo:mainfrom
yezhizhen merged 5 commits intoservo:mainfrom
Conversation
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Member
Author
|
This is reviewable by commits. |
Member
Author
|
🔨 Triggering try run (#21586343788) for Linux (WPT) |
|
Test results for linux-wpt from try job (#21586343788): Flaky unexpected result (39)
Stable unexpected results that are known to be intermittent (27)
|
|
✨ Try run (#21586343788) succeeded. |
f741752 to
781db23
Compare
Signed-off-by: Euclid Ye <[email protected]>
Member
Author
|
Let me try to add a test. |
Member
Author
def test_interspersed_touch_moves(session, test_actions_pointer_page):
pointerArea = session.find.css("#pointerArea", all=False)
session.execute_script("""
window.touchmoveEvents = [];
const area = document.getElementById("pointerArea");
area.addEventListener("touchmove", (event) => {
window.touchmoveEvents.push({
"type": "touchmove",
"pointerId": event.changedTouches[0].identifier,
"pageX": event.changedtouches[[0].pageX,
"pageY": event.changedtouches[[0].pageY,
});
});
""")
# Two fingers
touch_chain_1 = session.actions.sequence(
"pointer",
"touch_pointer_1",
{"pointerType": "touch"})
touch_chain_2 = session.actions.sequence(
"pointer",
"touch_pointer_2",
{"pointerType": "touch"})
touch_chain_1 \
.pointer_move(0, 0, origin=pointerArea) \
.pointer_down() \
.pointer_move(10, 10, origin=pointerArea, duration=200) \
.pointer_up()
touch_chain_2 \
.pointer_move(1, 1, origin=pointerArea) \
.pointer_down() \
.pointer_move(20, 20, origin=pointerArea, duration=200) \
.pointer_up()
# Perform both action sequences in parallel.
session.actions.perform([touch_chain_1.dict, touch_chain_2.dict])
time.sleep(2)
touchmove_events = session.execute_script("return window.touchmoveEvents;")
assert len(touchmove_events) > 0, "No touchmove events recorded"
# Verify events are interspersed: alternating patterns
pointer_ids = [e["pointerId"] for e in touchmove_events]
unique_pointer_ids = set(pointer_ids)
assert len(unique_pointer_ids) == 2, \
f"Expected touchmove events from 2 pointers, but got from {len(unique_pointer_ids)}"I added a local test, but I'm reluctant to push this upstream. But I see clear improvement from this PR: Now I can see pinch zoom effect and test completion to the end. |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 11, 2026
Scroll and PointerMove is quite similar. We did so for `PointeMove` in #42289 + #42946. Imagine having 3 non-zero duration scroll actions with origin at different Elements. Previously we would wait for one to be fully dispatched before moving to next action, instead of interspersed. We also consolidate `PendingPointerMove` and newly added `PendingScroll` into `enum PendingActions`. Testing: [Existing tests behaviour not changing.](https://github.com/servo/servo/actions/runs/22887005716). Added a wdspec test. Previously: `['wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'wheel', 'move']` Now: `['wheel', 'move', 'wheel', 'move', 'wheel', 'move', 'move', 'wheel', 'wheel', 'move', 'move', 'wheel', 'wheel', 'move', 'move', 'wheel']` --------- Signed-off-by: Euclid Ye <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For
pointerMovewith duration, we need to wait asynchronously and execute in parallel for subsequent moves.But we never did this correctly: we waited in a blocking way which broke the whole point of tick: making sure we simultaneously perform actions from multiple sources within a single unit time.
To avoid async borrow-checker hell, we achieve the same effect using a event queue.
Testing: Existing WPT tests not affected, which is a good sign. This fixes a potential deadlock: #42289 (comment).
Fixes: #42235
This is a pre-requisite to #41923: multi-touch support.