Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / offset-from-point-complex-scripts.html
blob398453f6a464e23d837219d420e45abd4aaf73b4
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <div id="container">
4 <p>مَ متن</p>
5 </div>
6 <div id=log></div>
7 <script>
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;
15 var results = [];
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)
20 continue;
21 results.push(characterOffset);
22 lastCharacterOffset = characterOffset;
24 var div = document.createElement("div");
25 div.innerText = results.join(" ");
26 log.appendChild(div);
29 if (window.testRunner) {
30 container.style.display = "none";
31 testRunner.dumpAsText();
33 </script>