Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / resources / mouse-events-within-no-element-iframe.html
blobab91863d48ee99f5ae991c8320e3cbdb2b83c84e
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <style type="text/css">
4 html, body, .workspace {
5 height: 100%;
7 button {
8 cursor: pointer;
9 padding: 0px;
10 margin: 0px;
12 .minbox {
13 height: 30px;
14 width: 1px;
16 #div1, #div2 {
17 height: 80px;
18 border: 1px solid #aaaaaa;
20 </style>
21 <body>
22 <div class="workspace"></div>
23 <div class="minbox">
24 <div id="test">
25 <button>POINTER</button>
26 </div>
27 </div>
28 <p id="description"></p>
29 <div id="console"></div>
30 <script>
31 var div = document.getElementById("test");
32 var x = div.offsetLeft + 100;
33 var y = div.offsetTop - window.pageYOffset + 1;
34 var events = [];
35 var targets = [];
37 window.scrollTo(0, 200);
38 if (window.eventSender) {
39 function appendEventLog(e) {
40 events.push(e.type);
41 targets.push(e.currentTarget.nodeName);
44 function runNextTest(eventType1, eventType2)
46 document.addEventListener(eventType1, appendEventLog);
47 document.body.addEventListener(eventType1, appendEventLog);
48 document.addEventListener(eventType2, appendEventLog);
49 document.body.addEventListener(eventType2, appendEventLog);
50 eventSender.mouseMoveTo(x, y); // html element in iframe
51 eventSender.mouseMoveTo(x, y + 200); // out of iframe
52 eventSender.mouseMoveTo(x, y - 100); // body element in iframe
53 eventSender.mouseMoveTo(x, y + 200); // out of iframe
54 document.removeEventListener(eventType1, appendEventLog);
55 document.body.removeEventListener(eventType1, appendEventLog);
56 document.removeEventListener(eventType2, appendEventLog);
57 document.body.removeEventListener(eventType2, appendEventLog);
59 runNextTest('mousemove', '');
60 runNextTest('mouseover', '');
61 runNextTest('mouseout', '');
62 runNextTest('mouseenter', 'mouseleave');
64 var i = 0;
65 function verifyEventLog(eventType, target)
67 shouldBeEqualToString('events[' + i + ']', eventType);
68 shouldBeEqualToString('targets[' + i + ']', target);
69 i++;
71 verifyEventLog('mousemove', '#document'); // x, y
72 verifyEventLog('mousemove', 'BODY'); // x, y - 100
73 verifyEventLog('mousemove', '#document'); // x, y - 100
74 verifyEventLog('mouseover', '#document'); // x, y
75 verifyEventLog('mouseover', 'BODY'); // x, y - 100
76 verifyEventLog('mouseover', '#document'); // x, y - 100
77 verifyEventLog('mouseout', '#document'); // x, y
78 verifyEventLog('mouseout', 'BODY'); // x, y - 100
79 verifyEventLog('mouseout', '#document'); // x, y - 100
80 verifyEventLog('mouseenter', '#document');// x, y
81 verifyEventLog('mouseleave', '#document');// x, y
82 verifyEventLog('mouseenter', '#document');// x, y - 100
83 verifyEventLog('mouseenter', 'BODY'); // x, y - 100
84 verifyEventLog('mouseleave', 'BODY'); // x, y + 200
85 verifyEventLog('mouseleave', '#document');// x, y + 200
86 </script>
87 </body>