Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / drag-in-iframe.html
blob88428df7ae802eba02ec8df3660c494f31553568
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()
12 var iframe = document.getElementById("subframe");
13 var target = iframe.contentDocument.getElementById("target");
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;
19 iframe.contentWindow.getSelection().setBaseAndExtent(target, 0, target, 1);
21 eventSender.mouseMoveTo(x1, y);
22 eventSender.dragMode = false;
23 eventSender.mouseDown();
24 eventSender.leapForward(1000);
25 eventSender.mouseMoveTo(x2, y);
27 // Dump pixel results before we drop so we can see where the drag caret is painted.
28 testRunner.notifyDone();
30 // Pixel dumping is asynchronous. We still have chance to send mouseUp.
31 setTimeout(function() { eventSender.mouseUp(); }, 0);
34 function test()
36 if (!window.testRunner)
37 return;
39 testRunner.waitUntilDone();
40 setTimeout(dragAndDrop, 0);
42 </script>
43 </body>
44 </html>