Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / paint / selection / selection-drag-image-in-iframe.html
blob30082cc238b862d844d5948e7e95de051807e270
1 <!doctype HTML>
2 <iframe id="subframe" style="position:relative; top: 100px; left: 100px" srcdoc="<img id='target' src='../../fast/images/resources/grid-small.png'>"></iframe>
3 <script>
5 function dragAndDrop() {
6 var target = subframe.contentDocument.getElementById("target");
8 var x1 = subframe.offsetLeft + target.offsetLeft;
9 var x2 = subframe.offsetLeft + target.offsetLeft + target.offsetWidth;
10 var y = subframe.offsetTop + target.offsetTop + target.offsetHeight / 2;
12 subframe.contentWindow.getSelection().setBaseAndExtent(target, 0, target, 1);
14 if (window.eventSender) {
15 eventSender.dragMode = true;
16 eventSender.mouseMoveTo((x1 + x2) / 2, y);
17 eventSender.mouseDown();
18 eventSender.mouseMoveTo(0, 0);
19 eventSender.mouseUp();
21 testRunner.notifyDone();
24 if (window.testRunner) {
25 testRunner.waitUntilDone();
26 testRunner.dumpDragImage();
27 } else {
28 // To run manually, click and select the image in the iframe to try to drag it.
29 document.write("this test does not work in manual mode");
31 window.onload = dragAndDrop;
33 </script>