<html>
<head>
    <title>Hit-testing text in overflows</title>
<script type="text/javascript">
var target;

if (window.testRunner)
    testRunner.waitUntilDone();

function step3()
{
    eventSender.mouseUp();
    testRunner.notifyDone();
}

function step2()
{
    eventSender.mouseDown();
    window.setTimeout(step3, 1);
}

function step1()
{
    target.scrollLeft = 3000;
    if (window.testRunner) {
        eventSender.mouseMoveTo(205, 10);
        window.setTimeout(step2, 1);
    }
}

function test()
{
    target = document.getElementById("target");
    window.setTimeout(step1, 1);
}
</script>
</head>
<body style="margin: 0; padding: 0;" onload="test();">
    <div id="target" style="overflow: auto; width: 210px; white-space: pre;">Seals and caribou live in the arctic, too</div>
    <hr>
    <p>
        This tests for regressions against
        <i>http://bugzilla.opendarwin.org/show_bug.cgi?id=5921 Hit-testing text
        in overflows does not take scrolling into account</i> by scrolling
        the above text all the way to the right, clicking the last letter, and
        verifying that the correct caret position is reported to the editing
        delegate.
    </p>
</body>
