4 <meta charset=
"ISO-8859-8">
6 <p>Test rendering of ISO-
8859-
8.
8 <div class=
"test">ùðá
</div>
9 <div class=
"test">ùðá â÷ë
</div>
10 <div class=
"test">ùðá abc â÷ë
</div>
11 <div class=
"test">abc ùðá def
</div>
12 <div class=
"test">ùðá
<span dir=ltr
>â÷ë
</span></div>
13 <div class=
"test">ùðá
<span dir=rtl
>â÷ë
</span></div>
14 <ul id=
"console" dir=ltr
></ul>
16 <script src=
"../../../resources/js-test.js"></script>
20 function checkClientRect(test
, index
, offset
, dir
, char)
22 if (test
.nodeType
== 3) {
23 for (var i
= 0; i
< test
.textContent
.length
; ++i
) {
24 range
.setStart(test
, i
);
25 range
.setEnd(test
, i
+1);
26 rects
= range
.getClientRects();
28 if (rects
[0].left
< offset
) {
29 testFailed("Test " + index
+ " LTR: character " + range
.toString() + " should be rendered right of " + char);
34 if (rects
[0].left
> offset
) {
35 testFailed("Test " + index
+ " RTL: character " + range
.toString() + " should be rendered left of " + char);
39 offset
= rects
[0].left
;
40 char = range
.toString();
43 } else if (test
.nodeType
== 1) {
44 for (var node
= test
.firstChild
; node
; node
= node
.nextSibling
) {
45 checkClientRect(node
, index
, offset
, dir
, char);
50 if (window
.testRunner
)
51 testRunner
.dumpAsText();
53 var tests
= document
.getElementsByClassName('test');
54 var range
= document
.createRange();
55 for (var i
= 0; i
< tests
.length
; ++i
) {
56 checkClientRect(tests
[i
], i
, -1, "ltr", " ");
58 tests
[i
].style
.direction
= "rtl";
59 checkClientRect(tests
[i
], i
, 10000, "rtl", " ");
61 tests
[i
].style
.display
= "none";
64 testPassed("Test completed successfully");