<html>
<head>
<script src=../editing.js type="text/javascript"></script>
<script>
function editingTest() {
    if (!window.testRunner)
        return;

    var field = document.getElementById('target');
    var middleX = field.offsetLeft + field.offsetWidth / 2;
    var middleY = field.offsetTop + field.offsetHeight / 2;
    
    // middle
    eventSender.mouseMoveTo(middleX, middleY);
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    // left
    eventSender.mouseMoveTo(0, middleY);
    // right
    eventSender.mouseMoveTo(document.body.offsetWidth, middleY);
    // way up
    eventSender.mouseMoveTo(middleX, middleY - 2 * field.offsetHeight);
    // up
    eventSender.mouseMoveTo(middleX, middleY - field.offsetHeight);
    // down
    eventSender.mouseMoveTo(middleX, middleY + field.offsetHeight);
    // way down
    eventSender.mouseMoveTo(middleX, middleY + 2 * field.offsetHeight);
    eventSender.mouseUp();
}
</script>
</head>
<body onLoad="runEditingTest();">
    <p>
        This is a test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=9312">http://bugzilla.opendarwin.org/show_bug.cgi?id=9312</a>
        REGRESSION: Selection bug in new text fields when selecting past the first letter</i>.
    </p>
    <hr>
    <p>
        Curabitur pretium, quam quis semper malesuada, est libero feugiat libero, vel fringilla orci nibh sed neque. Quisque eu nulla non nisi molestie accumsan. Etiam tellus urna, laoreet ac, laoreet non, suscipit sed, sapien. Phasellus vehicula, sem at posuere vehicula, augue nibh molestie nisl, nec ullamcorper lacus ante vulputate pede.
    </p>
    <input id="target" value="Lorem ipsum dolor" style="font-size: 24px; padding: 10px; margin: 20px;">
    <p>
        Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris viverra augue vitae purus. Morbi sed sem. Donec dui nisi, ultrices non, pretium quis, hendrerit non, est. Donec tellus. Donec eget dui id eros pharetra rutrum. Suspendisse sodales lectus sit amet nulla. Morbi tortor arcu, convallis blandit, elementum eu, aliquet a, tellus.
    </p>
</body>
</html>
