content/base/test/test_bug417255.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug417255.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=417255
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 417255</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 +  <style>
    1.14 +  .spacer { display:inline-block; height:10px; }
    1.15 +  </style>
    1.16 +</head>
    1.17 +<body>
    1.18 +
    1.19 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417255">Mozilla Bug 417255</a>
    1.20 +<div id="display" style="width:800px"></div>
    1.21 +
    1.22 +<div><span id="s1" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
    1.23 +<div style="width:500px; height:100px; background:yellow;"></div>
    1.24 +<span class="spacer" style="width:200px"></span></span></div>
    1.25 +
    1.26 +<div><span id="s2" style="border:2px dotted red;"><span class="spacer" style="width:100px"></span>
    1.27 +<div style="width:150px; height:100px; background:yellow;"></div>
    1.28 +<span class="spacer" style="width:200px"></span></span></div>
    1.29 +
    1.30 +<!-- test nested spans around the IB split -->
    1.31 +<div><span id="s3" style="border:2px dotted red;"><span><span class="spacer" style="width:100px"></span>
    1.32 +<div style="width:500px; height:100px; background:yellow;"></div>
    1.33 +<span class="spacer" style="width:200px"></span></span></span></div>
    1.34 +
    1.35 +<div id="content" style="display: none">
    1.36 +
    1.37 +</div>
    1.38 +
    1.39 +<pre id="test">
    1.40 +<script class="testbody" type="text/javascript">
    1.41 +
    1.42 +function getWidth(box) {
    1.43 +  return box.right - box.left;
    1.44 +}
    1.45 +
    1.46 +function doTest(id, boundsWidth, w1, w2, w3) {
    1.47 +  var s = document.getElementById(id);
    1.48 +  is(s.offsetWidth, boundsWidth, "bad offsetWidth");
    1.49 +  is(getWidth(s.getBoundingClientRect()), boundsWidth, "bad getBoundingClientRect width");
    1.50 +  is(getWidth(s.getClientRects()[0]), w1, "bad getClientRects width"); 
    1.51 +  is(getWidth(s.getClientRects()[1]), w2, "bad getClientRects width"); 
    1.52 +  is(getWidth(s.getClientRects()[2]), w3, "bad getClientRects width"); 
    1.53 +}
    1.54 +
    1.55 +doTest("s1", 500, 102, 500, 202);
    1.56 +doTest("s2", 202, 102, 150, 202);
    1.57 +doTest("s3", 500, 102, 500, 202);
    1.58 +
    1.59 +</script>
    1.60 +</pre>
    1.61 +</body>
    1.62 +
    1.63 +</html>

mercurial