LayoutTests:
[WebKit-https.git] / LayoutTests / editing / input / firstrectforcharacterrange-plain.html
1 <html>
2 <head>
3 <style>
4 body { margin: 10; padding: 0 }
5 </style>
6 </head>
7 <body contenteditable>
8 123456
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, 0);
27
28                         log(textInputController.firstRectForCharacterRange(0, 0)); // caret at the beginning 
29                         log(textInputController.firstRectForCharacterRange(1, 0)); // caret after the first character 
30                         log(textInputController.firstRectForCharacterRange(6, 0)); // caret at the end of line
31                         log(textInputController.firstRectForCharacterRange(6, 100)); // -"-
32                         log(textInputController.firstRectForCharacterRange(0, 1)); // first character
33                         log(textInputController.firstRectForCharacterRange(5, 1)); // last character
34                         log(textInputController.firstRectForCharacterRange(5, 2)); // -"-
35                         log(textInputController.firstRectForCharacterRange(5, 100)); // -"-
36                         log(textInputController.firstRectForCharacterRange(0, 6)); // first line
37                         log(textInputController.firstRectForCharacterRange(0, 7)); // -"-
38                         log(textInputController.firstRectForCharacterRange(0, 4294967295)); // -"-
39                         log(textInputController.firstRectForCharacterRange(1, 4294967295)); // first line without the first character
40                         log(textInputController.firstRectForCharacterRange(7, 0)); // out of bounds, should be zero rect
41                         log(textInputController.firstRectForCharacterRange(1000, 0)); // -"-
42                         log(textInputController.firstRectForCharacterRange(7, 1)); // -"-
43                         log(textInputController.firstRectForCharacterRange(7, 4294967295)); // -"-
44
45                 } catch (ex) {
46                         log("Exception: " + ex.description);
47                 }
48                 
49                 var console = document.createElement("p");
50                 console.appendChild(console_messages);
51                 document.body.appendChild(console);
52                 
53         } else {
54                 document.write("(cannot run interactively)");
55         }
56 </script>
57 </body>
58 </html>