<!DOCTYPE html> 
<html>
<head>
<style>
#textDiv {
    height: 100px;
    width: 100px;
    border: 1px solid black;
    -webkit-writing-mode: vertical-rl;
}
</style>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="textDiv" contenteditable="true">Some text.<p></p></div>
<div id="description"></div>
<div id="console"></div>
<script>
description('Testcase for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=104794">104794</a>:  Unable to place the caret at the end of the first line, when followed by a block, in the vertical writing mode.\nTo manually verify the issue, try clicking on the empty region of the first vertical line. The caret should be drawn at the end of the text.');

if (window.internals) {
    var testDiv = document.getElementById('textDiv');
    eventSender.mouseMoveTo(testDiv.offsetLeft + testDiv.offsetWidth - 5, testDiv.offsetTop);
    eventSender.mouseDown();
    eventSender.mouseUp();
    caretRectAtStart = internals.absoluteCaretBounds();
    
    eventSender.mouseMoveTo(testDiv.offsetLeft + testDiv.offsetWidth - 5, testDiv.offsetTop + testDiv.offsetHeight - 5);
    eventSender.mouseDown();
    eventSender.mouseUp();
    caretRectAtEnd = internals.absoluteCaretBounds();
    
    shouldBe("caretRectAtEnd.left", "caretRectAtStart.left");
    shouldBe("caretRectAtEnd.width", "caretRectAtStart.width");
    shouldBe("caretRectAtEnd.height", "caretRectAtStart.height");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
