<body contenteditable="true">

<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>

<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>

<script>

function runTest() {
    if (!window.testRunner)
        return;

    window.testRunner.waitUntilDone();
    
    var spanToDrag = document.getElementById("spanToDrag");
    var x = spanToDrag.offsetLeft + spanToDrag.offsetWidth / 2;
    var y = spanToDrag.offsetTop + spanToDrag.offsetHeight / 2;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();
    
    // Wait a moment so that the next mouseDown will kick off a drag, instead of a triple-click
    eventSender.leapForward(1300);
    eventSender.mouseDown();
    // Wait a moment so that the mouseDown will kick off a drag instead of starting a new selection.
    eventSender.leapForward(400);
    
    var li = document.getElementById("li");
    var ul = document.getElementById("ul");
    
    // WebCore paints a position:outside list markers at an offset from the top left corner of the 
    // bounds of the list item.  The offset is computed using a magic number and the
    // fonts ascent, two values we can't get to.  This (x, y) *should* be over the list marker.
    var x = ul.offsetLeft + 18;
    var y = li.offsetTop + li.offsetHeight / 2 + 20;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseUp();

    window.testRunner.notifyDone();
}

runTest();
</script>

</body>