<p>This tests dragging a selected table by mousing down on the contents of one of its cells. It should be in the red bordered area.</p>
<div id="source" style="border: 1px solid blue;" contenteditable="true"><table border="1"><tr><td id="cell">foo</td></tr></table></div>
<div id="destination" style="border: 1px solid red;" contenteditable="true"><br></div>

<script>
function runTest() {
    if (!window.layoutTestController)
        return;
        
    var cell = document.getElementById("cell");
    var source = document.getElementById("source");
    source.focus();
    document.execCommand("SelectAll");

    var x, y;
    x = cell.offsetParent.offsetLeft + cell.offsetLeft + cell.offsetWidth / 2;
    y = cell.offsetParent.offsetTop + cell.offsetTop + cell.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.leapForward(1000);
    
    var destination = document.getElementById("destination");
    x = destination.offsetParent.offsetLeft + destination.offsetLeft + destination.offsetWidth / 2;
    y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2;
    
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseUp();
}

runTest();
</script>
