OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script> |
| 4 function log(message) { |
| 5 var console = document.getElementById("console"); |
| 6 var div = document.createElement("div"); |
| 7 var text = document.createTextNode(message); |
| 8 |
| 9 console.appendChild(div); |
| 10 div.appendChild(text); |
| 11 } |
| 12 |
| 13 function runTest() { |
| 14 if (window.testRunner) { |
| 15 testRunner.dumpAsText(); |
| 16 testRunner.waitUntilDone(); |
| 17 } else |
| 18 return; |
| 19 |
| 20 selectSelection(); |
| 21 dragElementToContentEditable(document.getElementById("dragimage")); |
| 22 |
| 23 selectSelection(); |
| 24 dragElementToContentEditable(document.getElementById("draglink")); |
| 25 |
| 26 selectSelection(); |
| 27 dragElementToContentEditable(document.getElementById("dragtext")); |
| 28 |
| 29 var target = document.getElementById("target"); |
| 30 log("Dumping info about contenteditable div:"); |
| 31 log("Number of children: " + target.children.length); |
| 32 log("Contents:"); |
| 33 for (var i = 0; i < target.children.length; ++i) |
| 34 log(target.children[i].tagName); |
| 35 |
| 36 log("Number of selected ranges: " + window.getSelection().rangeCount); |
| 37 |
| 38 testRunner.notifyDone(); |
| 39 } |
| 40 |
| 41 function selectSelection() { |
| 42 window.getSelection().selectAllChildren(document.getElementById("selection")
); |
| 43 } |
| 44 |
| 45 function dragElementToContentEditable(dragSource) |
| 46 { |
| 47 x = dragSource.offsetLeft + dragSource.offsetWidth / 2; |
| 48 y = dragSource.offsetTop + dragSource.offsetHeight / 2; |
| 49 |
| 50 eventSender.mouseMoveTo(x, y); |
| 51 eventSender.mouseDown(); |
| 52 |
| 53 var dropTarget = document.getElementById("target"); |
| 54 x = dropTarget.offsetLeft + dropTarget.offsetWidth / 2; |
| 55 y = dropTarget.offsetTop + dropTarget.offsetHeight / 2; |
| 56 |
| 57 eventSender.mouseMoveTo(x, y); |
| 58 eventSender.mouseUp(); |
| 59 } |
| 60 </script> |
| 61 </head> |
| 62 |
| 63 <body style="padding:0; margin:0" onload="runTest();"> |
| 64 |
| 65 <div id="target" style="border: 1px solid black; width: 300px; height: 200px;" c
ontenteditable="true"></div> |
| 66 <div id="selection"> |
| 67 <img id="dragimage" src="../../../../editing/resources/abe.png"> |
| 68 <a href="#" id="draglink">Link</a> |
| 69 <span id="dragtext">Random text.</span></div> |
| 70 |
| 71 <p>This test checks selection drag edge cases on Mac. To run the test manually: |
| 72 <ol> |
| 73 <li>Select everything above, start the drag over the image, and with no delay, d
rag it to the content editable area. Only the image should be dragged. |
| 74 <li>Select everything above, start the drag over the link, and with no delay, dr
ag it to the content editable area. The entire selection should be dragged. |
| 75 <li>Select everything above, start the drag over the text, and with no delay, dr
ag it to the content editable area. Nothing should be dragged, but a bunch of te
xt should be selected instead. |
| 76 </ol> |
| 77 </p> |
| 78 <div id="console"></ul> |
| 79 </body> |
OLD | NEW |