<!DOCTYPE html>
<html>
<body>
<div>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=70277">bug 70277</a>.
This tests that a link is dragged and dropped properly in an already focused editable area.
This test passes only if it does not hit an assertion.
</p>
<a href=# id="anchorElement">Test Link</a>
</div>
<div id="editableDiv" contenteditable="true">
<h3>Editable area</h3>
<br>
<br>
</div>
<div id="result">
</div>
<script>
function dragElement(srcElement, destElement) 
{
    eventSender.mouseMoveTo(srcElement.offsetLeft + srcElement.offsetWidth / 2,
        srcElement.offsetTop + srcElement.offsetHeight / 2);
    eventSender.mouseDown();
    eventSender.leapForward(100);
    eventSender.mouseMoveTo(destElement.offsetLeft + destElement.offsetWidth / 2,
        destElement.offsetTop + destElement.offsetHeight / 2);
    eventSender.mouseUp();

    document.getElementById('result').innerHTML = "PASS";
}

if (window.testRunner)
    testRunner.dumpAsText();

var editableDiv = document.getElementById('editableDiv');
editableDiv.focus();
dragElement(document.getElementById('anchorElement'), editableDiv);
</script>
</body>
</html>
