3 <title>Line breaks after span inlines - Latin1
</title>
8 <p>With span inline on first word, Latin1 in second position of second word.
</p>
9 <p style=
"font-family:courier; font-size:15px; width: 25px"><span>xx
</span> xéx
</p>
10 <p>With span inline on first word, Latin1 in first position of second word.
</p>
11 <p style=
"font-family:courier; font-size:15px; width: 25px"><span>xx
</span> éxx
</p>
12 <p>With span inline on first word, no Latin1 in second word.
</p>
13 <p style=
"font-family:courier; font-size:15px; width: 25px"><span>xx
</span> xxx
</p>
14 <p>Without span, Latin1 in second position of second word.
</p>
15 <p style=
"font-family:courier; font-size:15px; width: 25px">xx xéx
</p>
16 <p>Without span, Latin1 in first position of second word.
</p>
17 <p style=
"font-family:courier; font-size:15px; width: 25px">xx éxx
</p>
18 <p>Without span, no Latin1 in second word.
</p>
19 <p style=
"font-family:courier; font-size:15px; width: 25px">xx xxx
</p>
21 <div><pre id=results
></pre></div>
23 if (window
.testRunner
)
24 testRunner
.dumpAsText();
26 function mergeRect(rects
, rect
) {
31 for (var i
= 0; i
< rects
.length
; ++i
) {
35 else if (rect
.top
< r
.top
) {
39 } else if (rect
.top
== r
.top
) {
40 if (rect
.left
+ rect
.width
> r
.left
+ r
.width
)
41 r
.width
= rect
.left
+ rect
.width
- r
.left
;
53 function mergeRects(rects
, newRects
) {
54 for (var i
= 0; i
< newRects
.length
; ++i
)
55 rects
= mergeRect(rects
, newRects
[i
]);
59 function getLineRects(paragraphNumber
) {
60 var range
= document
.createRange();
61 var paragraphs
= document
.getElementsByTagName("p");
62 var p
= paragraphs
[paragraphNumber
];
64 for (var i
= 0; i
< p
.childNodes
.length
; ++i
) {
66 range
.setEnd(p
, i
+ 1);
67 rects
= mergeRects(rects
, range
.getClientRects());
72 function appendResults(results
, newResults
) {
73 if (newResults
.length
) {
76 results
+= newResults
;
81 function compareParagraphLineRects(paragraphNumber1
, paragraphNumber2
, results
) {
82 var rects1
= getLineRects(paragraphNumber1
);
83 var rects2
= getLineRects(paragraphNumber2
);
84 if (rects1
.length
!= rects2
.length
)
85 results
= appendResults(results
, 'FAIL: different number of lines, got ' + rects1
.length
+ ', expected ' + rects2
.length
);
87 for (var i
= 0; i
< rects1
.length
; ++i
) {
88 if (rects2
[i
].width
!= rects1
[i
].width
) {
89 results
= appendResults(results
,
90 'FAIL: para[' + paragraphNumber1
+ '] line[' + i
+ '] width differs from para[' + paragraphNumber2
+ '] line[' + i
+ ']' +
91 ', got ' + rects1
[i
].width
+ ', expected ' + rects2
[i
].width
);
99 for (var i
= 0; i
< 3; i
++ )
100 results
= compareParagraphLineRects(i
*2 + 1, i
*2 + 1 + 6, results
);
103 document
.getElementById("results").innerText
= results
;