Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / base / test / test_bug410229.html
blob9e3815b094122a57b0fcd46be0f11e25a85a8b2e
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=410229
5 -->
6 <head>
7 <title>Test for Bug 410229</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410229">Mozilla Bug 410229</a>
14 <p id="display"></p>
16 <span id="s"><span id="inner">Hello</span>
17 <div>My</div>
18 Kitty</span>
20 <br>
21 <span id="s2">Hello<div>My</div><span id="inner2">Kitty</span></span>
23 <br>
24 <span id="s3"><div id="inner3block">My</div><span id="inner3">Kitty</span></span>
26 <br>
27 <span id="s4"><div id="inner4block">My</div></span>
29 <div id="content" style="display: none">
31 </div>
32 <pre id="test">
33 <script class="testbody" type="text/javascript">
35 var s = document.getElementById("s");
36 var inner = document.getElementById("inner");
37 var rects = s.getClientRects();
38 is(s.getBoundingClientRect().top, inner.getBoundingClientRect().top,
39 "'"+s.id+"' "+"IB-split span should start where its first line starts");
40 is(s.getClientRects().length, 3,
41 "'"+s.id+"' "+"IB-split span should have three CSS boxes");
42 ok(rects[0].left < rects[0].right && rects[0].top < rects[0].bottom,
43 "'"+s.id+"' "+"IB-split span should have a non-zero width first rect");
44 ok(rects[1].left < rects[1].right && rects[1].top < rects[1].bottom,
45 "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
46 ok(rects[2].left < rects[2].right && rects[2].top < rects[2].bottom,
47 "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
48 is(s.getBoundingClientRect().top, rects[0].top,
49 "'"+s.id+"' "+"IB-split span should start where its first rect starts");
50 is(s.getBoundingClientRect().bottom, rects[2].bottom,
51 "'"+s.id+"' "+"IB-split span should end where its last rect ends");
53 s = document.getElementById("s2");
54 inner = document.getElementById("inner2");
55 rects = s.getClientRects();
56 is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
57 "'"+s.id+"' "+"IB-split span should end where its last line ends");
58 is(s.getClientRects().length, 3,
59 "'"+s.id+"' "+"IB-split span should have three CSS boxes");
60 is(s.getBoundingClientRect().bottom, rects[2].bottom,
61 "'"+s.id+"' "+"IB-split span should end where its last rect ends");
63 s = document.getElementById("s3");
64 inner = document.getElementById("inner3");
65 var block = document.getElementById("inner3block");
66 rects = s.getClientRects();
67 is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
68 "'"+s.id+"' "+"IB-split span should start where its first line starts");
69 is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
70 "'"+s.id+"' "+"IB-split span should end where its last line ends");
71 is(s.getClientRects().length, 3,
72 "'"+s.id+"' "+"IB-split span should have three CSS boxes");
73 is(rects[0].left, rects[0].right,
74 "'"+s.id+"' "+"IB-split span should have a zero width first rect");
75 is(s.getBoundingClientRect().top, rects[1].top,
76 "'"+s.id+"' "+"IB-split span should start where its second rect starts");
78 s = document.getElementById("s4");
79 block = document.getElementById("inner4block");
80 rects = s.getClientRects();
81 is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
82 "'"+s.id+"' "+"IB-split span should start where its first line starts");
83 is(s.getBoundingClientRect().bottom, block.getBoundingClientRect().bottom,
84 "'"+s.id+"' "+"IB-split span should end where its last line ends");
85 is(s.getClientRects().length, 3,
86 "'"+s.id+"' "+"IB-split span should have three CSS boxes");
87 is(rects[0].left, rects[0].right,
88 "'"+s.id+"' "+"IB-split span should have a zero width first rect");
89 is(s.getBoundingClientRect().bottom, rects[1].bottom,
90 "'"+s.id+"' "+"IB-split span should end where its block rect ends");
92 ok(rects[2].left == rects[2].right,
93 "'"+s.id+"' "+"IB-split span should have a zero width last rect");
97 alert("'"+s.id+"' bounding rect:\n"+
98 ' left='+s.getBoundingClientRect().left+' right='+s.getBoundingClientRect().right+' top='+s.getBoundingClientRect().top+' bottom='+s.getBoundingClientRect().bottom + '\nclient rects:\n' +
99 ' left='+rects[0].left+' right='+rects[0].right+' top='+rects[0].top+' bottom='+rects[0].bottom + '\n' +
100 ' left='+rects[1].left+' right='+rects[1].right+' top='+rects[1].top+' bottom='+rects[1].bottom + '\n' +
101 ' left='+rects[2].left+' right='+rects[2].right+' top='+rects[2].top+' bottom='+rects[2].bottom + '\n');
104 </script>
105 </pre>
106 </body>
108 </html>