4 https://bugzilla.mozilla.org/show_bug.cgi?id=410229
7 <title>Test for Bug
410229</title>
8 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
14 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=410229">Mozilla Bug
410229</a>
17 <span id=
"s"><span id=
"inner">Hello
</span>
22 <span id=
"s2">Hello
<div>My
</div><span id=
"inner2">Kitty
</span></span>
25 <span id=
"s3"><div id=
"inner3block">My
</div><span id=
"inner3">Kitty
</span></span>
28 <span id=
"s4"><div id=
"inner4block">My
</div></span>
30 <div id=
"content" style=
"display: none">
34 <script class=
"testbody" type=
"text/javascript">
36 var s = document.getElementById(
"s");
37 var inner = document.getElementById(
"inner");
38 var rects = s.getClientRects();
39 is(s.getBoundingClientRect().top, inner.getBoundingClientRect().top,
40 "'"+s.id+
"' "+
"IB-split span should start where its first line starts");
41 is(s.getClientRects().length,
3,
42 "'"+s.id+
"' "+
"IB-split span should have three CSS boxes");
43 ok(rects[
0].left < rects[
0].right && rects[
0].top < rects[
0].bottom,
44 "'"+s.id+
"' "+
"IB-split span should have a non-zero width first rect");
45 ok(rects[
1].left < rects[
1].right && rects[
1].top < rects[
1].bottom,
46 "'"+s.id+
"' "+
"IB-split span should have a non-zero width second rect");
47 ok(rects[
2].left < rects[
2].right && rects[
2].top < rects[
2].bottom,
48 "'"+s.id+
"' "+
"IB-split span should have a non-zero width second rect");
49 is(s.getBoundingClientRect().top, rects[
0].top,
50 "'"+s.id+
"' "+
"IB-split span should start where its first rect starts");
51 is(s.getBoundingClientRect().bottom, rects[
2].bottom,
52 "'"+s.id+
"' "+
"IB-split span should end where its last rect ends");
54 s = document.getElementById(
"s2");
55 inner = document.getElementById(
"inner2");
56 rects = s.getClientRects();
57 is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
58 "'"+s.id+
"' "+
"IB-split span should end where its last line ends");
59 is(s.getClientRects().length,
3,
60 "'"+s.id+
"' "+
"IB-split span should have three CSS boxes");
61 is(s.getBoundingClientRect().bottom, rects[
2].bottom,
62 "'"+s.id+
"' "+
"IB-split span should end where its last rect ends");
64 s = document.getElementById(
"s3");
65 inner = document.getElementById(
"inner3");
66 var block = document.getElementById(
"inner3block");
67 rects = s.getClientRects();
68 is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
69 "'"+s.id+
"' "+
"IB-split span should start where its first line starts");
70 is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
71 "'"+s.id+
"' "+
"IB-split span should end where its last line ends");
72 is(s.getClientRects().length,
3,
73 "'"+s.id+
"' "+
"IB-split span should have three CSS boxes");
74 is(rects[
0].left, rects[
0].right,
75 "'"+s.id+
"' "+
"IB-split span should have a zero width first rect");
76 is(s.getBoundingClientRect().top, rects[
1].top,
77 "'"+s.id+
"' "+
"IB-split span should start where its second rect starts");
79 s = document.getElementById(
"s4");
80 block = document.getElementById(
"inner4block");
81 rects = s.getClientRects();
82 is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
83 "'"+s.id+
"' "+
"IB-split span should start where its first line starts");
84 is(s.getBoundingClientRect().bottom, block.getBoundingClientRect().bottom,
85 "'"+s.id+
"' "+
"IB-split span should end where its last line ends");
86 is(s.getClientRects().length,
2,
87 "'"+s.id+
"' "+
"IB-split span should have two CSS boxes");
88 is(rects[
0].left, rects[
0].right,
89 "'"+s.id+
"' "+
"IB-split span should have a zero width first rect");
90 is(s.getBoundingClientRect().bottom, rects[
1].bottom,
91 "'"+s.id+
"' "+
"IB-split span should end where its block rect ends");
93 ok(rects[
2].left == rects[
2].right,
94 "'"+s.id+
"' "+
"IB-split span should have a zero width last rect");
98 alert(
"'"+s.id+
"' bounding rect:\n"+
99 ' left='+s.getBoundingClientRect().left+' right='+s.getBoundingClientRect().right+' top='+s.getBoundingClientRect().top+' bottom='+s.getBoundingClientRect().bottom + '\nclient rects:\n' +
100 ' left='+rects[
0].left+' right='+rects[
0].right+' top='+rects[
0].top+' bottom='+rects[
0].bottom + '\n' +
101 ' left='+rects[
1].left+' right='+rects[
1].right+' top='+rects[
1].top+' bottom='+rects[
1].bottom + '\n' +
102 ' left='+rects[
2].left+' right='+rects[
2].right+' top='+rects[
2].top+' bottom='+rects[
2].bottom + '\n');