Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / internal-caret-rect.html
blob4488562632fbc0771d337fe8806abcde2b5653fa
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/ahem.js"></script>
5 <script src="../../resources/js-test.js" type="text/javascript"></script>
6 <style>
7 body {
8 font: 20px Ahem;
10 </style>
11 </head>
12 <body>
13 <p> Bug <a href="http://webkit.org/b/86390">86390</a>: Expose FrameSelection::absoluteCaretBounds via window.internals</p>
14 <p>This test demonstrates the usage of window.internals.absoluteCaretBounds()</p>
15 <div id="testDiv" CONTENTEDITABLE>abcd</div>
16 <div id="console"></div>
17 </body>
18 <script>
19 var caretRects = [];
20 function verifyCaretRect(left, top, width, height)
22 if (window.internals) {
23 var index = caretRects.length;
24 caretRects.push(internals.absoluteCaretBounds());
25 shouldBe("caretRects[" + index + "].left", left.toString());
26 shouldBe("caretRects[" + index + "].top", top.toString());
27 shouldBe("caretRects[" + index + "].width", width.toString());
28 shouldBe("caretRects[" + index + "].height", height.toString());
32 var textNode = document.getElementById("testDiv").firstChild;
33 getSelection().collapse(textNode, 0); // before a
34 verifyCaretRect(8, 160, 1, 20);
35 getSelection().collapse(textNode, 1); // after a
36 verifyCaretRect(28, 160, 1, 20);
37 getSelection().collapse(textNode, 2); // after b
38 verifyCaretRect(48, 160, 1, 20);
39 getSelection().collapse(textNode, 3); // after c
40 verifyCaretRect(68, 160, 1, 20);
41 getSelection().collapse(textNode, 4); // after d
42 verifyCaretRect(88, 160, 1, 20);
43 </script>
44 </html>