Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / drag-in-frames.html
blob1896d29028b4aa161b17ca7a8a8d2b9baa7cb530
1 <head>
2 <script>
3 function log(message) {
4 console_doc = frames[2].document;
5 var item = console_doc.createElement("li");
6 item.appendChild(console_doc.createTextNode(message));
7 console_doc.getElementById('console_messages').appendChild(item);
10 function test() {
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.waitUntilDone();
15 // Find the element to drag
16 elementToDrag = frames[0].document.getElementById("elementToDrag");
17 x1 = elementToDrag.offsetLeft + elementToDrag.offsetWidth / 2;
18 y1 = elementToDrag.offsetTop + elementToDrag.offsetHeight / 2;
20 // Drag to the middle of the destination element in the same frame
21 dragTarget = frames[0].document.getElementById("dragTarget");
22 x2 = dragTarget.offsetLeft + dragTarget.offsetWidth / 2;
23 y2 = dragTarget.offsetTop + dragTarget.offsetHeight / 2;
25 eventSender.mouseMoveTo(x1,y1);
26 eventSender.mouseDown();
27 eventSender.mouseMoveTo(x2, y2);
28 eventSender.mouseMoveTo(x2, y2+1);
29 eventSender.mouseMoveTo(x2, y2+2);
31 // Drag to the middle of the destination element in another frame
32 dragTarget2 = frames[1].document.getElementById("dragTarget2");
33 x3 = 150 + dragTarget2.offsetLeft + dragTarget2.offsetWidth / 2;
34 y3 = dragTarget2.offsetTop + dragTarget2.offsetHeight / 2;
36 eventSender.mouseMoveTo(x3, y3);
37 eventSender.mouseMoveTo(x3, y3+1);
38 eventSender.mouseUp();
40 document.write("<body>" +
41 frames[2].document.body.innerHTML +
42 "<p>These results are just \"sensible\" at the moment, meaning that " +
43 "all the events fire on the right elements, nothing more. The order in particular "+
44 "can rightfully change.</p>" +
45 "<scr" + "ipt>testRunner.notifyDone();</scr" + "ipt>" +
46 "</body>");
49 </script>
50 </head>
51 <!-- frames -->
52 <frameset cols="150,150,*" border="0" onload="test();">
54 <frame name="left" src="resources/drag-in-frames-left.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0"
55 ondrag="alert('ondrag left frame')"
56 ondrop="alert('ondrop left frame')"
57 ondragstart="alert('ondragstart left frame')"
58 ondragend="alert('ondragend left frame')"
59 ondragenter="log('ondragenter left frame')"
60 ondragover="log('ondragover left frame')"
61 ondragleave="log('ondragleave left frame')">
62 <frame name="right" src="resources/drag-in-frames-right.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0"
63 ondrag="alert('ondrag right frame')"
64 ondrop="alert('ondrop right frame')"
65 ondragstart="alert('ondragstart right frame')"
66 ondragend="alert('ondragend right frame')"
67 ondragenter="log('ondragenter right frame')"
68 ondragover="log('ondragover right frame')"
69 ondragleave="log('ondragleave right frame')">
70 <frame name="console" src="resources/drag-in-frames-console.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
71 </frameset>