Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / text / glyph-reordering.html
blob3a552bdb6f16902f2221ecc801b690dc5130e3f1
1 <p>
2 This tests text selection in complex scripts where glyph reordering occurs.
3 </p>
4 <div id="target" style="font-size: 48px;"><span>[</span>&#x0939;&#x093F;&#x0928;&#x094D;&#x0926;&#x0940;<span>]</span></div>
5 <div id="reference" style="font-size: 48px;"><span>[</span>&#x0928;&#x094D;&#x0926;&#x0940;<span>]</span></div>
6 <p id="result">Test did not run</p>
7 <script>
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 var target = document.getElementById("target");
13 var textNode = target.firstChild.nextSibling;
14 var range = document.createRange();
15 range.setStart(textNode, 0);
16 range.setEnd(textNode, 2);
17 var width = range.getClientRects()[0].width;
19 range.setStart(target, 0);
20 range.setEnd(target, 3);
21 var totalWidth = range.getBoundingClientRect().width;
23 var reference = document.getElementById("reference");
24 range.setStart(reference, 0)
25 range.setEnd(reference, 3);
26 var referenceWidth = totalWidth - range.getBoundingClientRect().width;
28 document.getElementById("result").innerText = Math.abs(width - referenceWidth) < 0.5 ? "PASS" : "FAIL: width was " + width + " instead of " + referenceWidth;
29 </script>