2008-01-03 17:50:30 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=410229
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 410229</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-01-03 17:50:30 -08:00
|
|
|
<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();
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().top, inner.getBoundingClientRect().top,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+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");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().top, rects[0].top,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should start where its first rect starts");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, rects[2].bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should end where its last rect ends");
|
|
|
|
|
|
|
|
s = document.getElementById("s2");
|
|
|
|
inner = document.getElementById("inner2");
|
|
|
|
rects = s.getClientRects();
|
2008-01-03 20:28:15 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+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");
|
2008-01-03 20:28:15 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, rects[2].bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+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();
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should start where its first line starts");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+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");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(rects[0].left, rects[0].right,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should have a zero width first rect");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().top, rects[1].top,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should start where its second rect starts");
|
|
|
|
|
|
|
|
s = document.getElementById("s4");
|
|
|
|
block = document.getElementById("inner4block");
|
|
|
|
rects = s.getClientRects();
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should start where its first line starts");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, block.getBoundingClientRect().bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should end where its last line ends");
|
2009-03-04 04:55:29 -08:00
|
|
|
is(s.getClientRects().length, 3,
|
|
|
|
"'"+s.id+"' "+"IB-split span should have three CSS boxes");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(rects[0].left, rects[0].right,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+s.id+"' "+"IB-split span should have a zero width first rect");
|
2008-01-03 19:02:41 -08:00
|
|
|
is(s.getBoundingClientRect().bottom, rects[1].bottom,
|
2008-01-03 17:50:30 -08:00
|
|
|
"'"+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>
|