4 text-rendering: optimizeLegibility;
8 <script src=
"../../resources/js-test.js"></script>
9 <p>For each pair of paragraphs, the second one should be wider than the first one.
</p>
11 This test ensures that we properly accumulate sub-pixel word and letter spacing:
<a href=
"http://crbug.com/336358">bug
336358</a>.
13 <div id=
"ls005" style=
"letter-spacing: 0.05em">
14 This test ensures that we properly accumulate sub-pixel word and letter spacing:
<a href=
"http://crbug.com/336358">bug
336358</a>.
17 Pack Emil's box with five dozen
<a href=
"#pangram">liquor jugs
</a>!
19 <div id=
"ws005" style=
"word-spacing: 0.05em">
20 Pack Emil's box with five dozen
<a href=
"#pangram">liquor jugs
</a>!
23 description("This test confirms fractional values for word- and letter-spacing are not truncated in complex path.");
25 function getWidth(element
) {
26 if (window
.getComputedStyle(element
).display
!= 'block')
27 return elment
.offsetWidth
;
28 var child
= element
.firstChild
;
31 if (child
=== element
.lastChild
)
32 return getWidth(child
);
33 var span
= document
.createElement('span');
34 while (child
= element
.firstChild
)
35 span
.appendChild(child
);
36 element
.appendChild(span
);
37 return span
.offsetWidth
;
40 shouldBeCloseTo('getWidth(ls005)-getWidth(ls0)', 73, 1);
41 shouldBeCloseTo('getWidth(ws005)-getWidth(ws0)', 5, 1); // 7*0.05em = 5.6px.