LayoutTests:
[WebKit-https.git] / LayoutTests / editing / input / firstrectforcharacterrange-styled.html
1 <html>
2 <head>
3 <style>
4 body { margin: 10; padding: 0 }
5 </style>
6 </head>
7 <body contenteditable>
8 12<b>3<i>4</i></b>
9 <script type="text/javascript">
10
11         var console_messages = document.createElement("ol");
12         
13         function log(message)
14         {
15                 var item = document.createElement("li");
16                 item.appendChild(document.createTextNode(message));
17                 console_messages.appendChild(item);
18         }
19         
20         if (window.layoutTestController) {
21                 
22                 try {
23                 
24                         layoutTestController.dumpAsText();
25                 
26                         window.getSelection().setPosition(document.body, 4);
27             textInputController.setMarkedText("56", 0, 1);
28
29                         log(textInputController.firstRectForCharacterRange(0, 0)); // caret at the beginning 
30                         log(textInputController.firstRectForCharacterRange(1, 0)); // caret after the first character 
31                         log(textInputController.firstRectForCharacterRange(6, 0)); // caret at the end of line
32                         log(textInputController.firstRectForCharacterRange(6, 100)); // -"-
33                         log(textInputController.firstRectForCharacterRange(0, 1)); // first character
34                         log(textInputController.firstRectForCharacterRange(5, 1)); // last character
35                         log(textInputController.firstRectForCharacterRange(5, 2)); // -"-
36                         log(textInputController.firstRectForCharacterRange(5, 100)); // -"-
37                         log(textInputController.firstRectForCharacterRange(0, 6)); // first line
38                         log(textInputController.firstRectForCharacterRange(0, 7)); // -"-
39                         log(textInputController.firstRectForCharacterRange(0, 4294967295)); // -"-
40                         log(textInputController.firstRectForCharacterRange(1, 4294967295)); // first line without the first character
41                         log(textInputController.firstRectForCharacterRange(7, 0)); // out of bounds, should be zero rect
42                         log(textInputController.firstRectForCharacterRange(1000, 0)); // -"-
43                         log(textInputController.firstRectForCharacterRange(7, 1)); // -"-
44                         log(textInputController.firstRectForCharacterRange(7, 4294967295)); // -"-
45
46                 } catch (ex) {
47                         log("Exception: " + ex.description);
48                 }
49                 
50                 var console = document.createElement("p");
51                 console.appendChild(console_messages);
52                 document.body.appendChild(console);
53                 
54         } else {
55                 document.write("(cannot run interactively)");
56         }
57 </script>
58 </body>
59 </html>