4 <title> Testcase for bug https://bugs.webkit.org/show_bug.cgi?id=89649 </title>
14 <script src="../../resources/js-test.js"></script>
17 description('Testcase for bug <a href="http://www.webkit.org/b/89649">http://www.webkit.org/b/89649</a>. \
18 The test case checks if caret is drawn properly(especially scrolls properly) inside a editable container having word-wrap:normal.');
20 editableContainer = document.getElementById('test');
21 editableContainer.focus();
23 startCaretRect = internals.absoluteCaretBounds();
25 window.getSelection().setPosition(editableContainer,0);
26 if (window.testRunner)
27 testRunner.execCommand('MoveToEndOfLine');
29 finalCaretRect = {right:-1,left:-1};
31 finalCaretRect = internals.absoluteCaretBounds();
33 caretWidth = finalCaretRect.right - finalCaretRect.left;
35 debug('To manually test, move the caret to the end of the line. \nThe content must scroll for the caret to reach the end of the editable text.');
36 shouldBeTrue("editableContainer.scrollLeft > 0");
38 debug('<br>Final caret rect is calculated by following constraints');
39 debug('1) ScrollWidth = text content width + caret width');
40 debug('2) Caret rect is always within container bounding box (thus substracting the scroll left)');
41 shouldBe("startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft - caretWidth", "finalCaretRect.right");
43 document.body.removeChild(editableContainer);
44 isSuccessfullyParsed();
48 <body onload="runTest();">
49 <div id="test" contenteditable="true" class="editableDiv" >
50 SOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERFILLERSFILLERSFILLERSFILLERSFILLERS
52 <div id="description"></div>
53 <div id="console"></div>