summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_bug410229.html
blob: cf449835558c74a8d46e2a0470d196fdedcceaa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=410229
-->
<head>
  <title>Test for Bug 410229</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>

<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410229">Mozilla Bug 410229</a>
<p id="display"></p>

<span id="s"><span id="inner">Hello</span>
<div>My</div>
Kitty</span>

<br>
<span id="s2">Hello<div>My</div><span id="inner2">Kitty</span></span>

<br>
<span id="s3"><div id="inner3block">My</div><span id="inner3">Kitty</span></span>

<br>
<span id="s4"><div id="inner4block">My</div></span>

<div id="content" style="display: none">

</div>
<pre id="test">
<script class="testbody" type="text/javascript">

var s = document.getElementById("s");
var inner = document.getElementById("inner");
var rects = s.getClientRects();
is(s.getBoundingClientRect().top, inner.getBoundingClientRect().top,
   "'"+s.id+"' "+"IB-split span should start where its first line starts");
is(s.getClientRects().length, 3,
   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
ok(rects[0].left < rects[0].right && rects[0].top < rects[0].bottom,
   "'"+s.id+"' "+"IB-split span should have a non-zero width first rect");
ok(rects[1].left < rects[1].right && rects[1].top < rects[1].bottom,
   "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
ok(rects[2].left < rects[2].right && rects[2].top < rects[2].bottom,
   "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
is(s.getBoundingClientRect().top, rects[0].top,
   "'"+s.id+"' "+"IB-split span should start where its first rect starts");
is(s.getBoundingClientRect().bottom, rects[2].bottom,
   "'"+s.id+"' "+"IB-split span should end where its last rect ends");

s = document.getElementById("s2");
inner = document.getElementById("inner2");
rects = s.getClientRects();
is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
   "'"+s.id+"' "+"IB-split span should end where its last line ends");
is(s.getClientRects().length, 3,
   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
is(s.getBoundingClientRect().bottom, rects[2].bottom,
   "'"+s.id+"' "+"IB-split span should end where its last rect ends");

s = document.getElementById("s3");
inner = document.getElementById("inner3");
var block = document.getElementById("inner3block");
rects = s.getClientRects();
is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
   "'"+s.id+"' "+"IB-split span should start where its first line starts");
is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
   "'"+s.id+"' "+"IB-split span should end where its last line ends");
is(s.getClientRects().length, 3,
   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
is(rects[0].left, rects[0].right,
   "'"+s.id+"' "+"IB-split span should have a zero width first rect");
is(s.getBoundingClientRect().top, rects[1].top,
   "'"+s.id+"' "+"IB-split span should start where its second rect starts");

s = document.getElementById("s4");
block = document.getElementById("inner4block");
rects = s.getClientRects();
is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
   "'"+s.id+"' "+"IB-split span should start where its first line starts");
is(s.getBoundingClientRect().bottom, block.getBoundingClientRect().bottom,
   "'"+s.id+"' "+"IB-split span should end where its last line ends");
is(s.getClientRects().length, 3,
   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
is(rects[0].left, rects[0].right,
   "'"+s.id+"' "+"IB-split span should have a zero width first rect");
is(s.getBoundingClientRect().bottom, rects[1].bottom,
   "'"+s.id+"' "+"IB-split span should end where its block rect ends");
/*
ok(rects[2].left == rects[2].right,
   "'"+s.id+"' "+"IB-split span should have a zero width last rect");
*/

/*
alert("'"+s.id+"' bounding rect:\n"+
      '  left='+s.getBoundingClientRect().left+' right='+s.getBoundingClientRect().right+' top='+s.getBoundingClientRect().top+' bottom='+s.getBoundingClientRect().bottom + '\nclient rects:\n' +
      '  left='+rects[0].left+' right='+rects[0].right+' top='+rects[0].top+' bottom='+rects[0].bottom + '\n' +
      '  left='+rects[1].left+' right='+rects[1].right+' top='+rects[1].top+' bottom='+rects[1].bottom + '\n' +
      '  left='+rects[2].left+' right='+rects[2].right+' top='+rects[2].top+' bottom='+rects[2].bottom + '\n');
*/

</script>
</pre>
</body>

</html>