Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html

Issue 1989623002: Suppressed MEs for gestures from cancelled PEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 div.box {
5 height: 100px;
6 width: 100px;
7 background-color: red;
8 }
9 </style>
10
11 <div class="box" id="target"></div>
12
13 <div id="console"></div>
14
15 <script>
16 description("Verifies that canceling pointerdowns for touches correctly suppress es mouseevents.");
17
18 var preventDefaultPrimary = false;
19
20 function init() {
21 var events = [
22 "mouseup",
23 "mousedown",
24 "mousemove",
25 "pointerup",
26 "pointerdown",
27 "pointermove",
28 "click",
29 "touchstart",
30 "touchend",
31 "touchmove",
32 ];
33
34 events.forEach(function(event) {
35 document.getElementById("target").addEventListener(event, function(e) {
36 var isPrimary = e.isPrimary;
37 var desc = [];
38 if (e.type.startsWith("pointer") && isPrimary)
39 desc.push("primary");
40 if (e.type == "pointerdown" && preventDefaultPrimary == isPrimary) {
41 e.preventDefault();
42 desc.push("canceled");
43 }
44 debug("Received " + e.type + " " + desc);
45 });
46 });
47 }
48
49 function testTapWithPairedGE() {
50 var rect = document.getElementById("target").getBoundingClientRect();
51 var x = rect.left + 50;
52 var y = rect.top + 50;
53
54 var uniqueId = 1234;
55 var tapWidth = 30;
56 var tapHeight = 30;
57
58 eventSender.addTouchPoint(x, y);
59 eventSender.touchStart(uniqueId);
60 eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId);
61
62 eventSender.releaseTouchPoint(0);
63 eventSender.touchEnd();
64 eventSender.gestureTap(x, y);
65 }
66
67 function testTapWithoutPairedGE() {
68 var rect = document.getElementById("target").getBoundingClientRect();
69 var x = rect.left + 50;
70 var y = rect.top + 50;
71
72 var uniqueId = 1234;
73 var tapWidth = 30;
74 var tapHeight = 30;
75
76 eventSender.addTouchPoint(x, y);
77 eventSender.touchStart(uniqueId);
78 eventSender.releaseTouchPoint(0);
79 eventSender.touchEnd();
80
81 eventSender.addTouchPoint(x, y);
82 eventSender.touchStart(uniqueId+1);
83 eventSender.releaseTouchPoint(0);
84 eventSender.touchEnd();
85
86 eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId+1);
87 eventSender.gestureTap(x, y);
88
89 eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId+2);
90 eventSender.gestureTap(x, y);
91 }
92
93 function runTests() {
94 [false, true, false].forEach(function(boolVal) {
95 debug("=== With primary pointerdown " + (boolVal ? "canceled" : "uncanceled" ) +" ===");
96 preventDefaultPrimary = boolVal;
97
98 debug("-- Tap with paired GEs --");
99 testTapWithPairedGE();
100
101 debug("-- Tap without paired GEs --");
102 testTapWithoutPairedGE();
103
104 debug("");
105 });
106 }
107
108 init();
109 if (window.eventSender)
110 runTests();
111 else
112 debug("This test requires eventSender");
113
114 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698