Skip to content

Commit

Permalink
Bug 1936826 [wpt PR 49656] - [Interop] WPT and fix for click dispatch…
Browse files Browse the repository at this point in the history
… with chorded buttons., a=testonly

Automatic update from web-platform-tests
[Interop] WPT and fix for click dispatch with chorded buttons.

This CL adds a WPT for click-like events from chorded buttons, which
is currently being discussed in PEWG as an Interop problem:
  w3c/pointerevents#530

The CL also fixes a behind-a-flag crack in Chromium.  The crack
prevented firing of click-like events with the chorded buttons when
ClickToCapturedPointer is enabled.  This is because the call to
`DispatchMouseClickIfNeeded` is wrongly skipped in this case since
the `pointer_event->type()` is `kPointermove` not `kPointerup`.

Bug: 40851596
Change-Id: I11606ed8f709f08aaa2d8aba3ebaeb07f26bbc1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6059955
Reviewed-by: Robert Flack <[email protected]>
Auto-Submit: Mustaq Ahmed <[email protected]>
Commit-Queue: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1395404}

--

wpt-commits: fae8dd06efde90fd0b43ca757b6e691e7bbe55fa
wpt-pr: 49656
  • Loading branch information
mustaqahmed authored and moz-wptsync-bot committed Dec 16, 2024
1 parent 357d333 commit c5be599
Showing 1 changed file with 91 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!doctype html>
<!--
Tentative due to:
https://github.com/w3c/pointerevents/issues/530
TODO: Revisit the asserts below when the spec issue is resolved.
-->
<title>Click-like events on chorded button state changes</title>
<meta name="viewport" content="width=device-width">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="text/javascript" src="pointerevent_support.js"></script>
<style>
div {
width: 100px;
height: 100px;
touch-action: none;
user-select: none;
}
</style>
<body onload="run()">
<div id="target"></div>
<div id="done"></div>
</body>
<script>
"use strict";

let event_log = [];

function eventLogger(e) {
event_log.push(e.type);
}

function run() {
var target = document.getElementById("target");
var done = document.getElementById("done");

["click", "auxclick"].forEach(ename => {
target.addEventListener(ename, eventLogger);
});

promise_test(async test => {
event_log = [];

let done_click_promise = getEvent("click", done);

let actions = new test_driver.Actions();
actions = actions
.pointerMove(0,0, {origin:target})
.pointerDown({button:actions.ButtonType.LEFT})
.pointerDown({button:actions.ButtonType.MIDDLE})
.pointerUp({button:actions.ButtonType.MIDDLE})
.pointerUp({button:actions.ButtonType.LEFT})
.pointerMove(0,0, {origin:done})
.pointerDown()
.pointerUp();

await actions.send();
await done_click_promise;

assert_equals(event_log.toString(), "auxclick,click",
"received click-like events");
}, "Chorded button sequence L-down M-down M-up L-up");

promise_test(async test => {
event_log = [];

let done_click_promise = getEvent("click", done);

let actions = new test_driver.Actions();
actions = actions
.pointerMove(0,0, {origin:target})
.pointerDown({button:actions.ButtonType.MIDDLE})
.pointerDown({button:actions.ButtonType.LEFT})
.pointerUp({button:actions.ButtonType.LEFT})
.pointerUp({button:actions.ButtonType.MIDDLE})
.pointerMove(0,0, {origin:done})
.pointerDown()
.pointerUp();

await actions.send();
await done_click_promise;

assert_equals(event_log.toString(), "click,auxclick",
"received click-like events");
}, "Chorded button sequence M-down L-down L-up M-up");
}
</script>

0 comments on commit c5be599

Please sign in to comment.