Missing cursor/caret showing in search field on google.com
[WebKit-https.git] / LayoutTests / editing / selection / drag-in-iframe.html
1 <html>
2 <body contenteditable="true" onload="test()">
3     <p>
4         This is an automatic pixel test. To test interactively, drag selected text onto the iframe
5         below and verify that a drag caret appears inside the frame.
6     </p>
7     <iframe id="subframe" style="border: 1px solid black;"
8         src="data:text/html,<body contenteditable><span id='target'>There</span> should be a caret here --> <br>See it?</body>"></iframe>
9     <script>
10         function dragAndDrop()
11         {
12             var iframe = document.getElementById("subframe");
13             var target = iframe.contentDocument.getElementById("target");
14         
15             var x1 = iframe.offsetLeft + target.offsetLeft + target.offsetWidth / 2;
16             var x2 = iframe.offsetLeft + iframe.offsetWidth - 20;
17             var y = iframe.offsetTop + target.offsetTop + target.offsetHeight / 2;
18
19             iframe.contentWindow.getSelection().setBaseAndExtent(target, 0, target, 1);
20         
21             eventSender.mouseMoveTo(x1, y);
22             eventSender.dragMode = false;
23             eventSender.mouseDown();
24             eventSender.leapForward(1000);
25             eventSender.mouseMoveTo(x2, y);
26         
27             // Dump pixel results before we drop so we can see where the drag caret is painted.
28             testRunner.notifyDone();
29         
30             eventSender.mouseUp();
31         }
32         
33         function test()
34         {
35             if (!window.testRunner)
36                 return;
37
38             testRunner.waitUntilDone();
39             setTimeout(dragAndDrop, 0);
40         }
41     </script>
42 </body>
43 </html>