| Index: LayoutTests/fast/dom/Range/getBoundingClientRect-caret.html
|
| diff --git a/LayoutTests/fast/dom/Range/getBoundingClientRect-caret.html b/LayoutTests/fast/dom/Range/getBoundingClientRect-caret.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..41adea808c1cc78bd616e4cceacc6dcd2aff07bf
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/Range/getBoundingClientRect-caret.html
|
| @@ -0,0 +1,34 @@
|
| +<!doctype html>
|
| +<html>
|
| +<head>
|
| +<script src="../../../resources/js-test.js"></script>
|
| +</head>
|
| +<body>
|
| +<div id="d1" contenteditable="true"> hello </div>
|
| +<div id="console"></div>
|
| +</body>
|
| +<script>
|
| + description('Test getBoundingClientRect of caret for collapsed range.');
|
| +
|
| + /* Set caret position */
|
| + var el = document.getElementById("d1");
|
| + var sel = window.getSelection();
|
| + var range = document.createRange();
|
| + range.setStart(el.childNodes[0], 3);
|
| + range.collapse(true);
|
| + sel.removeAllRanges();
|
| + sel.addRange(range);
|
| + el.focus();
|
| +
|
| + /* Actual test */
|
| + sel = window.getSelection();
|
| + range = sel.getRangeAt(0);
|
| + range.collapse(true);
|
| + var rect = range.getBoundingClientRect();
|
| +
|
| + shouldBe("rect.left", "22");
|
| + shouldBe("rect.top", "8");
|
| + shouldBe("rect.width", "0");
|
| + shouldBe("rect.height", "19");
|
| +</script>
|
| +</html>
|
|
|