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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert histograms.xml Created 3 years, 7 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 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 </head>
7 <body>
8 <a inert id="a" href="javascript:void(0)">Click me</a>
9 <button inert id="button">Click me</button>
10 <div inert id="div" style="background-color: blue; width: 50px; height: 50px">Cl ick meeee</div>
11 <span inert id="span">Click me</span>
12 <script>
13 function clickOn(element)
14 {
15 return new Promise(function(resolve, reject) {
16 if (!window.eventSender)
17 reject();
18
19 var absoluteTop = 0;
20 var absoluteLeft = 0;
21 for (var parentNode = element; parentNode; parentNode = parentNode.offse tParent) {
22 absoluteLeft += parentNode.offsetLeft;
23 absoluteTop += parentNode.offsetTop;
24 }
25
26 var x = absoluteLeft + element.offsetWidth / 2;
27 var y = absoluteTop + element.offsetHeight / 2;
28 var pointerActions = [{
29 source: "mouse",
30 actions: [
31 { name: "pointerMove", x: x, y: y },
32 { name: "pointerDown", x: x, y: x },
33 { name: "pointerUp" },
34 { name: "pointerMove", x: 0, y: 0}
35 ]
36 }];
37 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve);
38 });
39 }
40
41 function eventFiredOnInertElement(e) {
42 e.target.style.background = 'red';
43 inertElementFiredOn = true;
44 }
45
46 inertElements = ['a', 'button', 'div', 'span']
47 inertElements.forEach(function(id) {
48 element = document.getElementById(id);
49 element.addEventListener('click', eventFiredOnInertElement);
50 element.addEventListener('mousemove', eventFiredOnInertElement);
51 });
52
53 document.addEventListener('click', function(e) {
54 document.firedOn = true;
55 });
56
57 test(function() {
58 inertElements.forEach(function(id) {
59 expectedTarget = document;
60 element = document.getElementById(id);
61 inertElementFiredOn = false;
62 expectedTarget.firedOn = false;
63 clickOn(element).then(() => {
64 assert_false(inertElementFiredOn, 'no event should be fired on ' + i d);
65 assert_true(expectedTarget.firedOn, 'event should be fired on docume nt instead of ' + id);
66 });
67 });
68 }, 'Tests that inert inlines do not receive mouse events. ' +
69 'To test manually, click on all the "Click me"s. The test ' +
70 'fails if you see red.');
71
72 </script>
73 </body>
74 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698