[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.24
[framework/web/webkit-efl.git] / LayoutTests / fast / events / mouse-drag-from-frame.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 if (window.layoutTestController) {
6     layoutTestController.waitUntilDone();
7     layoutTestController.dumpAsText();
8 }
9
10 function log(msg) {
11     var msgNode = document.createTextNode(msg);
12     var li = document.createElement("li");
13     li.appendChild(msgNode);
14     document.getElementById("log").appendChild(li);
15 }
16 var dragging = false;
17 var waitingForUp = false;
18 function dragStarted() {
19     if (dragging || waitingForUp) {
20         log("Unexpected drag start");
21         return;
22     }
23     log("Drag started");
24     dragging = true;
25 }
26
27 window.onmousedown = function() {
28     log("Unexpected mousedown");
29 }
30
31 window.onmousemove = function() {
32     if (!dragging || waitingForUp)
33         return;
34     log("Received mouse move");
35     waitingForUp = true;
36 }
37
38 window.onmouseup = function() {
39     if (!waitingForUp) {
40         log("Unexpected mouseup");
41         return;
42     }
43     log("Received mouseup event")
44     log("PASS!");
45 }
46
47 window.onload = function() {
48     try {
49         if (!frames[0] || !frames[0].document || !frames[0].document.getElementById("dragSource")) {
50             log("Window.onload fired before subframe completed load.");
51         }
52         
53         if (!window.layoutTestController) {
54             log("This test needs to be run in DRT.  To test manually drag from the text 'Drag Me!' out into the parent frame.");
55             return;
56         }
57         var dragSource = frames[0].document.getElementById("dragSource");
58         var sourceFrame = document.getElementById("sourceFrame");
59         var x = dragSource.offsetLeft + sourceFrame.offsetLeft + 10;
60         var y = dragSource.offsetTop + sourceFrame.offsetTop + dragSource.offsetHeight / 2;
61         eventSender.mouseMoveTo(x,y);
62         eventSender.mouseDown();
63         eventSender.mouseMoveTo(120, 120);
64         eventSender.mouseUp();
65     } finally {
66         if (window.layoutTestController)
67             layoutTestController.notifyDone();
68     }
69 }
70 </script>
71 </head>
72 <body>
73     <div>This tests that dragging from an element that returns <emph>false</emph> from its mousedown handler will not let the subsequent mousemove events be captured by the containing frame.</div>
74     <iframe id="sourceFrame" style="width: 100px; height: 50px;" src="resources/mouse-drag-from-frame-subframe.html"></iframe>
75     <ul id="log">
76     </ul>
77 </body>
78 </html>