LayoutTests:
[WebKit-https.git] / LayoutTests / editing / input / wrapped-line-char-rect.html
1 <html>
2 <head>
3 <style>
4 body { margin: 0; padding: 0 }
5 </style>
6 </head>
7 <body>
8 <p contenteditable id='test' STYLE="width: 100px;"></p>
9 <script type="text/javascript">
10
11     if (window.layoutTestController) {
12         
13         try {
14         
15             layoutTestController.dumpAsText();
16             window.getSelection().setPosition(document.getElementById("test"), 0);
17             
18             // currently, firstRectForCharacterRange only works with marked or selected text because of bug 4682
19             textInputController.setMarkedText("aaaaaaaaaa–aaaaaaaaa", 0, 0);
20         
21             var rect = textInputController.firstRectForCharacterRange(11, 1);
22             
23             // should be the first character in a line
24             if (rect[0] == 0 && rect[2] > 5)
25                 document.write("Success.");
26             else
27                 document.write("Failure. Rect: " + rect);
28
29                 } catch (ex) {
30                         document.write("Exception: " + ex.description);
31                 }
32         } else {
33                 document.write("(cannot run interactively)");
34         }
35 </script>
36 </body>
37 </html>