blob: c697feb88df556558ef90e0e1d769620f8dc27a3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<script>
function log(str)
{
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
onload = function()
{
var div = document.getElementById("div");
var pre = document.getElementById("pre");
var rightOfClientBox = div.clientWidth + div.offsetLeft - 20; // 20 for right padding in 'div' and 'pre'.
if (window.textInputController) {
var caretRect = textInputController.firstRectForCharacterRange(0, 0);
var xOfRightmostCharacter = caretRect[0];
if (xOfRightmostCharacter > rightOfClientBox)
log("FAILED: rightmost character (at " + xOfRightmostCharacter + ") is beyond the right edge (" + rightOfClientBox + ") of client box");
else
log("PASS");
caretRect = textInputController.firstRectForCharacterRange(1, 0);
if (caretRect[0] >= xOfRightmostCharacter)
log("FAILED: second rightmost character (at " + caretRect[0] + ") is on or beyond the right edge (" + rightOfClientBox + ") of client box");
else
log("PASS");
}
if (window.testRunner)
div.style.display = "none";
}
if (window.testRunner)
testRunner.dumpAsText();
</script>
</head>
<body>
<div contenteditable id="div" dir="rtl" style="padding-right: 10px; border-width: 10px; width: 40ex;border: solid 1px;"><pre style="padding-right: 10px; border-width: 10px" id="pre">פורסם: 24.04.09, 21:14</pre></div>
<ul id="console"></ul>
</body>
</html>