1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug414190.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,85 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=414190 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 414190</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=414190">Mozilla Bug 414190</a> 1.17 +<p id="display"></p> 1.18 + 1.19 +<table id="table" border="0" cellspacing="0" cellpadding="0" 1.20 + style="width:100px; border:10px solid silver;"> 1.21 + <tr><td id="cell" style="height:100px;"></td></tr> 1.22 + <caption id="caption" style="caption-side:bottom; width:50px; height:70px; background:yellow;"></caption> 1.23 +</table> 1.24 + 1.25 +<div id="content" style="display: none"> 1.26 + 1.27 +</div> 1.28 +<pre id="test"> 1.29 +<script class="testbody" type="text/javascript"> 1.30 + 1.31 +function isEqualRect(r1, r2, r1border, s) { 1.32 + is(r1.left + r1border, r2.left, s + " (left)"); 1.33 + is(r1.right - r1border, r2.right, s + " (right)"); 1.34 + is(r1.top + r1border, r2.top, s + " (top)"); 1.35 + is(r1.bottom - r1border, r2.bottom, s + " (bottom)"); 1.36 +} 1.37 + 1.38 +var table = document.getElementById("table"); 1.39 +var cell = document.getElementById("cell"); 1.40 +var caption = document.getElementById("caption"); 1.41 +var tableRects = table.getClientRects(); 1.42 +var tableBoundingRect = table.getBoundingClientRect(); 1.43 +var cellBoundingRect = cell.getBoundingClientRect(); 1.44 +var captionBoundingRect = caption.getBoundingClientRect(); 1.45 + 1.46 +is(tableRects.length, 2, "Table should have rects for body and caption"); 1.47 +isEqualRect(tableRects[0], cellBoundingRect, 10, 1.48 + "Table first rect should be cell rect"); 1.49 +isEqualRect(tableRects[1], captionBoundingRect, 0, 1.50 + "Table second rect should be caption rect"); 1.51 +is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width"); 1.52 +is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height"); 1.53 +is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width"); 1.54 +is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height"); 1.55 +is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry"); 1.56 + 1.57 +is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error"); 1.58 +is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error"); 1.59 +is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error"); 1.60 +is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error"); 1.61 + 1.62 +caption.style.captionSide = "left"; 1.63 + 1.64 +tableRects = table.getClientRects(); 1.65 +tableBoundingRect = table.getBoundingClientRect(); 1.66 +cellBoundingRect = cell.getBoundingClientRect(); 1.67 +captionBoundingRect = caption.getBoundingClientRect(); 1.68 + 1.69 +is(tableRects.length, 2, "Table should have rects for body and caption"); 1.70 +isEqualRect(tableRects[0], cellBoundingRect, 10, 1.71 + "Table first rect should be cell rect plus border"); 1.72 +isEqualRect(tableRects[1], captionBoundingRect, 0, 1.73 + "Table second rect should be caption rect"); 1.74 +is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width"); 1.75 +is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height"); 1.76 +is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width"); 1.77 +is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height"); 1.78 +is(captionBoundingRect.right + 10, cellBoundingRect.left, "Discontiguous horizontal geometry"); 1.79 +is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error"); 1.80 +is(tableBoundingRect.left, captionBoundingRect.left, "Table left error"); 1.81 +is(tableBoundingRect.bottom, cellBoundingRect.bottom + 10, "Table bottom error"); 1.82 +is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error"); 1.83 + 1.84 +</script> 1.85 +</pre> 1.86 +</body> 1.87 + 1.88 +</html>