content/base/test/test_bug410229.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial