Skip to content

Commit ba638d1

Browse files
Don't adjust untrusted TouchEvents.
Untrusted touch events are not fired to DOM for whatever reason. But they still go through the adjustment and causes problem when event target is an empty document. We need to fix wpt/touch-events/touch-retargeting.html by avoiding untrusted event dispatch but test_driver doesn't support input to shadow DOM yet. So switched the test to be manual for now. I manually verified that both Chrome and Firefox passes the manual test. Fixed: 1230583 Change-Id: Ia82cbf4a65d859d76180dae063ee7840efb7f3ab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3094727 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/main@{#918857}
1 parent 6271c7f commit ba638d1

File tree

2 files changed

+36
-54
lines changed

2 files changed

+36
-54
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<title>TouchEvent Retargeting Tests</title>
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
</head>
8+
<body>
9+
<h1>Touch retargeting manual test</h1>
10+
<div>This test requires touch input.</div>
11+
<div id="host"></div>
12+
</body>
13+
<script>
14+
var host = document.getElementById("host");
15+
var root = host.attachShadow({ mode: "open" });
16+
var target = document.createElement("h2");
17+
target.textContent = "Tap on THIS line of text";
18+
root.appendChild(target);
19+
20+
var test_touch_retargeting = async_test("touch_retargeting");
21+
22+
on_event(host, "touchstart", e => {
23+
test_touch_retargeting.step(() => {
24+
assert_equals(e.touches.length, 1, "touches.length is correct");
25+
assert_equals(e.touches[0].target, host, "touches[0] is retargeted to host");
26+
27+
assert_equals(e.targetTouches.length, 1, "targetTouches.length is correct");
28+
assert_equals(e.targetTouches[0].target, host, "targetTouches[0] is retargeted to host");
29+
30+
assert_equals(e.changedTouches.length, 1, "changedTouches.length is correct");
31+
assert_equals(e.changedTouches[0].target, host, "changedTouches[0] is retargeted to host");
32+
});
33+
});
34+
on_event(host, "touchend", e => test_touch_retargeting.done());
35+
</script>
36+
</html>

touch-events/touch-retargeting.html

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)