8 testOffsetFromPoint(container
.firstElementChild
);
10 function testOffsetFromPoint(element
) {
11 var y
= element
.offsetTop
+ element
.offsetHeight
/ 2;
12 var xmin
= element
.offsetLeft
;
13 var xmax
= xmin
+ element
.offsetWidth
;
14 var lastCharacterOffset
= null;
16 for (var x
= xmin
- 1; x
<= xmax
+ 1; ++x
) {
17 var result
= document
.caretRangeFromPoint(x
, y
);
18 var characterOffset
= result
? result
.startOffset
: null;
19 if (characterOffset
=== lastCharacterOffset
)
21 results
.push(characterOffset
);
22 lastCharacterOffset
= characterOffset
;
24 var div
= document
.createElement("div");
25 div
.innerText
= results
.join(" ");
29 if (window
.testRunner
) {
30 container
.style
.display
= "none";
31 testRunner
.dumpAsText();