content/base/test/test_bug410229.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug410229.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,108 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=410229
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 410229</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410229">Mozilla Bug 410229</a>
    1.17 +<p id="display"></p>
    1.18 +
    1.19 +<span id="s"><span id="inner">Hello</span>
    1.20 +<div>My</div>
    1.21 +Kitty</span>
    1.22 +
    1.23 +<br>
    1.24 +<span id="s2">Hello<div>My</div><span id="inner2">Kitty</span></span>
    1.25 +
    1.26 +<br>
    1.27 +<span id="s3"><div id="inner3block">My</div><span id="inner3">Kitty</span></span>
    1.28 +
    1.29 +<br>
    1.30 +<span id="s4"><div id="inner4block">My</div></span>
    1.31 +
    1.32 +<div id="content" style="display: none">
    1.33 +
    1.34 +</div>
    1.35 +<pre id="test">
    1.36 +<script class="testbody" type="text/javascript">
    1.37 +
    1.38 +var s = document.getElementById("s");
    1.39 +var inner = document.getElementById("inner");
    1.40 +var rects = s.getClientRects();
    1.41 +is(s.getBoundingClientRect().top, inner.getBoundingClientRect().top,
    1.42 +   "'"+s.id+"' "+"IB-split span should start where its first line starts");
    1.43 +is(s.getClientRects().length, 3,
    1.44 +   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
    1.45 +ok(rects[0].left < rects[0].right && rects[0].top < rects[0].bottom,
    1.46 +   "'"+s.id+"' "+"IB-split span should have a non-zero width first rect");
    1.47 +ok(rects[1].left < rects[1].right && rects[1].top < rects[1].bottom,
    1.48 +   "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
    1.49 +ok(rects[2].left < rects[2].right && rects[2].top < rects[2].bottom,
    1.50 +   "'"+s.id+"' "+"IB-split span should have a non-zero width second rect");
    1.51 +is(s.getBoundingClientRect().top, rects[0].top,
    1.52 +   "'"+s.id+"' "+"IB-split span should start where its first rect starts");
    1.53 +is(s.getBoundingClientRect().bottom, rects[2].bottom,
    1.54 +   "'"+s.id+"' "+"IB-split span should end where its last rect ends");
    1.55 +
    1.56 +s = document.getElementById("s2");
    1.57 +inner = document.getElementById("inner2");
    1.58 +rects = s.getClientRects();
    1.59 +is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
    1.60 +   "'"+s.id+"' "+"IB-split span should end where its last line ends");
    1.61 +is(s.getClientRects().length, 3,
    1.62 +   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
    1.63 +is(s.getBoundingClientRect().bottom, rects[2].bottom,
    1.64 +   "'"+s.id+"' "+"IB-split span should end where its last rect ends");
    1.65 +
    1.66 +s = document.getElementById("s3");
    1.67 +inner = document.getElementById("inner3");
    1.68 +var block = document.getElementById("inner3block");
    1.69 +rects = s.getClientRects();
    1.70 +is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
    1.71 +   "'"+s.id+"' "+"IB-split span should start where its first line starts");
    1.72 +is(s.getBoundingClientRect().bottom, inner.getBoundingClientRect().bottom,
    1.73 +   "'"+s.id+"' "+"IB-split span should end where its last line ends");
    1.74 +is(s.getClientRects().length, 3,
    1.75 +   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
    1.76 +is(rects[0].left, rects[0].right,
    1.77 +   "'"+s.id+"' "+"IB-split span should have a zero width first rect");
    1.78 +is(s.getBoundingClientRect().top, rects[1].top,
    1.79 +   "'"+s.id+"' "+"IB-split span should start where its second rect starts");
    1.80 +
    1.81 +s = document.getElementById("s4");
    1.82 +block = document.getElementById("inner4block");
    1.83 +rects = s.getClientRects();
    1.84 +is(s.getBoundingClientRect().top, block.getBoundingClientRect().top,
    1.85 +   "'"+s.id+"' "+"IB-split span should start where its first line starts");
    1.86 +is(s.getBoundingClientRect().bottom, block.getBoundingClientRect().bottom,
    1.87 +   "'"+s.id+"' "+"IB-split span should end where its last line ends");
    1.88 +is(s.getClientRects().length, 3,
    1.89 +   "'"+s.id+"' "+"IB-split span should have three CSS boxes");
    1.90 +is(rects[0].left, rects[0].right,
    1.91 +   "'"+s.id+"' "+"IB-split span should have a zero width first rect");
    1.92 +is(s.getBoundingClientRect().bottom, rects[1].bottom,
    1.93 +   "'"+s.id+"' "+"IB-split span should end where its block rect ends");
    1.94 +/*
    1.95 +ok(rects[2].left == rects[2].right,
    1.96 +   "'"+s.id+"' "+"IB-split span should have a zero width last rect");
    1.97 +*/
    1.98 +
    1.99 +/*
   1.100 +alert("'"+s.id+"' bounding rect:\n"+
   1.101 +      '  left='+s.getBoundingClientRect().left+' right='+s.getBoundingClientRect().right+' top='+s.getBoundingClientRect().top+' bottom='+s.getBoundingClientRect().bottom + '\nclient rects:\n' +
   1.102 +      '  left='+rects[0].left+' right='+rects[0].right+' top='+rects[0].top+' bottom='+rects[0].bottom + '\n' +
   1.103 +      '  left='+rects[1].left+' right='+rects[1].right+' top='+rects[1].top+' bottom='+rects[1].bottom + '\n' +
   1.104 +      '  left='+rects[2].left+' right='+rects[2].right+' top='+rects[2].top+' bottom='+rects[2].bottom + '\n');
   1.105 +*/
   1.106 +
   1.107 +</script>
   1.108 +</pre>
   1.109 +</body>
   1.110 +
   1.111 +</html>

mercurial