OLD | NEW |
1 <head> | 1 <head> |
2 <script> | 2 <script> |
3 | 3 |
4 function testChar(a, b, ch) | 4 function testChar(a, b, ch) |
5 { | 5 { |
6 // Strings a and b selected here do not have any 'interaction' between them. | 6 // Strings a and b selected here do not have any 'interaction' between them. |
7 var span = document.getElementById("characters"); | 7 var span = document.getElementById("characters"); |
8 span.firstChild.data = a + b; | 8 span.firstChild.data = a + b; |
9 var abWidth = span.offsetWidth; | 9 var abWidth = span.offsetWidth; |
10 span.firstChild.data = a; | 10 span.firstChild.data = a; |
11 var aWidth = span.offsetWidth; | 11 var aWidth = span.offsetWidth; |
12 span.firstChild.data = a + String.fromCharCode(ch) + b; | 12 span.firstChild.data = a + String.fromCharCode(ch) + b; |
13 var abWithChWidth = span.offsetWidth; | 13 var abWithChWidth = span.offsetWidth; |
14 | 14 |
15 if (abWithChWidth > abWidth) | 15 if (abWithChWidth > abWidth) |
16 return 1; | 16 return 1; |
17 if (abWidth > aWidth) | 17 if (abWidth > aWidth) |
18 return 0; | 18 return 0; |
19 return 1; | 19 return 1; |
20 } | 20 } |
21 | 21 |
22 function testWithZeroWidthSpace(a, b) { | 22 function testWithZeroWidthSpace(a, b) { |
23 var failedCount = 0; | 23 var failedCount = 0; |
24 | 24 |
25 for (var i = 1; i < 32; ++i) | |
26 if (i != 9 && i != 10 && i != 13) | |
27 failedCount += testChar(a, b, i); | |
28 | |
29 for (var i = 0x7F; i < 0xA0; ++i) | |
30 failedCount += testChar(a, b, i); | |
31 failedCount += testChar(a, b, 0xAD); | 25 failedCount += testChar(a, b, 0xAD); |
32 | 26 |
33 // ZWJ (U+200C) and ZWNJ (U+200D) are excluded because they | 27 // ZWJ (U+200C) and ZWNJ (U+200D) are excluded because they |
34 // can affect the rendering in complex script text. | 28 // can affect the rendering in complex script text. |
35 failedCount += testChar(a, b, 0x200B); | 29 failedCount += testChar(a, b, 0x200B); |
36 failedCount += testChar(a, b, 0x200E); | 30 failedCount += testChar(a, b, 0x200E); |
37 failedCount += testChar(a, b, 0x200F); | 31 failedCount += testChar(a, b, 0x200F); |
38 failedCount += testChar(a, b, 0x202A); | 32 failedCount += testChar(a, b, 0x202A); |
39 failedCount += testChar(a, b, 0x202B); | 33 failedCount += testChar(a, b, 0x202B); |
40 failedCount += testChar(a, b, 0x202C); | 34 failedCount += testChar(a, b, 0x202C); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 document.getElementById("result").firstChild.data = result; | 66 document.getElementById("result").firstChild.data = result; |
73 } | 67 } |
74 </script> | 68 </script> |
75 </head> | 69 </head> |
76 <body onload="test()"> | 70 <body onload="test()"> |
77 <p>This test checks various characters that should always be zero width to ensur
e that they are when enclosed by complex script characters. | 71 <p>This test checks various characters that should always be zero width to ensur
e that they are when enclosed by complex script characters. |
78 The WebKit text system ensures this in a way that's independent of the fonts ins
talled on the system.</p> | 72 The WebKit text system ensures this in a way that's independent of the fonts ins
talled on the system.</p> |
79 <p id="result">FAIL: Script did not run to completion.</p> | 73 <p id="result">FAIL: Script did not run to completion.</p> |
80 <p id="testArea"><span id="characters">काख</span></p> | 74 <p id="testArea"><span id="characters">काख</span></p> |
81 </body> | 75 </body> |
OLD | NEW |