Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / lists / drag-into-marker.html
blob2813e7d188c7b7fe8851a48aef3b5508098df482
1 <body contenteditable="true">
3 <ul id="ul" style="margin:1em; border:1px solid black;"><li id="li" contenteditable="true" style="list-style-type: square; font-size: 3em;">hello <span id="spanToDrag">world</span></a></div></li></ul>
5 <p>This is an automated test for elementAtPoint for points over position:outside list markers. The dictionary returned by elementAtPoint should contain the list item as the DOMNode, not the list, for points over position:outside list markers. elementAtPoint is used to determine the drag operation that will occur when something is dropped over a given point. So, this test drags a bit of text over the list marker and drops it. It should be pasted into the list item, which is contenteditable.</p>
7 <script>
9 function runTest() {
10 if (!window.testRunner)
11 return;
13 window.testRunner.waitUntilDone();
15 var spanToDrag = document.getElementById("spanToDrag");
16 var x = spanToDrag.offsetLeft + spanToDrag.offsetWidth / 2;
17 var y = spanToDrag.offsetTop + spanToDrag.offsetHeight / 2;
19 eventSender.mouseMoveTo(x, y);
20 eventSender.mouseDown();
21 eventSender.mouseUp();
22 eventSender.mouseDown();
23 eventSender.mouseUp();
25 // Wait a moment so that the next mouseDown will kick off a drag, instead of a triple-click
26 eventSender.leapForward(1300);
27 eventSender.mouseDown();
28 // Wait a moment so that the mouseDown will kick off a drag instead of starting a new selection.
29 eventSender.leapForward(400);
31 var li = document.getElementById("li");
32 var ul = document.getElementById("ul");
34 // WebCore paints a position:outside list markers at an offset from the top left corner of the
35 // bounds of the list item. The offset is computed using a magic number and the
36 // fonts ascent, two values we can't get to. This (x, y) *should* be over the list marker.
37 var x = ul.offsetLeft + 18;
38 var y = li.offsetTop + li.offsetHeight / 2 + 20;
40 eventSender.mouseMoveTo(x, y);
41 eventSender.mouseUp();
43 window.testRunner.notifyDone();
46 runTest();
47 </script>
49 </body>