gecko-dev/layout/reftests/bugs/427129-table-caption-ref.html
Ehsan Akhgari 4b84fe41d5 Bug 659828 - Part 1: Apply table margins to the outer table frame instead of the inner table frame (also fixes bug 87277); r=dbaron
Outer table frames act as CSS2.1 table wrapper boxes.  We used to lay them out
without taking their margins into the account, which meant that their width was
always equal to the available width.  This breaks horizontal positioning of
absolutely positioned kids of a table frame.

The main purpose of this patch is to apply the margins of tables to their outer
frame, instead of the inner frame.  This means that the inner table frame will
always have a zero margin, which means that a lot of the stuff which used to
rely on the fact that table margins are applied to the inner frame need to
change.

In particular, in order to get the computed margins of a table, we used to query
the inner table frame, and this patch corrects that.  Also, when shrink wrapping
tables, we used to not take the margins of the inner table frame into account,
which is fixed by this patch too.  nsBlockReflowState::
ComputeReplacedBlockOffsetsForFloats also needed to be changed to read the
margin values from the outer frame too.

Also, as part of this patch, we start to respect the CSS2.1 margin model for
captions on all sides.  This means that in particular, the top/bottom margins on
the top-outside and bottom-outside captions will not be collapsed with the
top/bottom margins of the table, and that the margins of the caption element
contribute to the width and height of the outer table frame.  The
427129-table-caption reftest has been modified to match this new behavior.

Another side effect of this bug is fixing bug 87277, and the reftests for that
bug are marked as passing in this patch.
2011-05-31 19:02:56 -04:00

712 lines
18 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title>Reftest, bug 427129</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
html, body { margin: 0; }
.contain {
background: aqua; color: black;
height: 4px; margin: 1px 50px;
padding-top: 0.1px; /* needed for some reason (XXX WHY?) */
}
div.pushed { height: 2px; }
div.t { background: blue; height: 1px; width: 100px; }
div.caption { background: purple; height: 1px; width: 100px; }
div.side { display: inline-block; vertical-align: top; }
</style>
</head>
<body>
<!--
WARNING: Both this test and the reference are constructed to test
our current behavior, which is far from optimal in a number of cases.
Fixing the test to test better behavior is encouraged when such
behavior is implemented.
To test the behavior under resizing, every test in this page is
repeated three times, once in a container one pixel above the
transition width, once at the transition width (just fitting), and
once in a container a pixel below the transition width.
-->
<div style="width: 405px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 116px"></div>
</div>
</div>
<div style="width: 404px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 116px"></div>
</div>
</div>
<div style="width: 403px">
<div class="contain">
<div class="pushed"></div>
<div class="t" style="margin-left: 55px"></div>
<div class="caption" style="margin-left: 115px"></div>
</div>
</div>
<div style="width: 405px">
<div class="contain">
<div class="caption" style="margin-left: 116px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 404px">
<div class="contain">
<div class="caption" style="margin-left: 116px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 403px">
<div class="contain">
<div class="pushed"></div>
<div class="caption" style="margin-left: 116px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 406px">
<div class="contain">
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 117px"></div>
</div>
</div>
<div style="width: 405px">
<div class="contain">
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 117px"></div>
</div>
</div>
<div style="width: 404px">
<div class="contain">
<div class="pushed"></div>
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 117px"></div>
</div>
</div>
<div style="width: 401px">
<div class="contain">
<div class="caption" style="margin-left: 112px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="caption" style="margin-left: 112px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 399px">
<div class="contain">
<div class="pushed"></div>
<div class="caption" style="margin-left: 112px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 401px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 112px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 112px"></div>
</div>
</div>
<div style="width: 399px">
<div class="contain">
<div class="pushed"></div>
<div class="t" style="margin-left: 55px"></div>
<div class="caption" style="margin-left: 111px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 111px"></div>
</div>
</div>
<div style="width: 399px">
<div class="contain">
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 111px"></div>
</div>
</div>
<div style="width: 398px">
<div class="contain">
<div class="pushed"></div>
<div class="t" style="margin-left: 56px"></div>
<div class="caption" style="margin-left: 111px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="caption" style="margin-left: 111px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 399px">
<div class="contain">
<div class="caption" style="margin-left: 111px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 398px">
<div class="contain">
<div class="pushed"></div>
<div class="caption" style="margin-left: 110px"></div>
<div class="t" style="margin-left: 55px"></div>
</div>
</div>
<div style="width: 402px">
<div class="contain">
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 113px"></div>
</div>
</div>
<div style="width: 401px">
<div class="contain">
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 113px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="pushed"></div>
<div class="t" style="margin-left: 57px"></div>
<div class="caption" style="margin-left: 113px"></div>
</div>
</div>
<div style="width: 402px">
<div class="contain">
<div class="caption" style="margin-left: 113px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 401px">
<div class="contain">
<div class="caption" style="margin-left: 113px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 400px">
<div class="contain">
<div class="pushed"></div>
<div class="caption" style="margin-left: 113px"></div>
<div class="t" style="margin-left: 56px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="side caption" style="margin-left: 155px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 655px">
<div class="contain">
<div class="side caption" style="margin-left: 155px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 654px">
<div class="contain">
<div class="pushed"></div>
<div class="side caption" style="margin-left: 155px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 657px">
<div class="contain">
<div class="side caption" style="margin-left: 156px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="side caption" style="margin-left: 156px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 655px">
<div class="contain">
<div class="pushed"></div>
<div class="side caption" style="margin-left: 156px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 658px">
<div class="contain">
<div class="side caption" style="margin-left: 157px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 657px">
<div class="contain">
<div class="side caption" style="margin-left: 157px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="pushed"></div>
<div class="side caption" style="margin-left: 157px"></div
><div class="side t" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 657px">
<div class="contain">
<div class="side t" style="margin-left: 56px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="side t" style="margin-left: 56px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 655px">
<div class="contain">
<div class="pushed"></div>
<div class="side t" style="margin-left: 55px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 657px">
<div class="contain">
<div class="side t" style="margin-left: 56px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="side t" style="margin-left: 56px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 655px">
<div class="contain">
<div class="pushed"></div>
<div class="side t" style="margin-left: 56px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 658px">
<div class="contain">
<div class="side t" style="margin-left: 57px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 657px">
<div class="contain">
<div class="side t" style="margin-left: 57px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 656px">
<div class="contain">
<div class="pushed"></div>
<div class="side t" style="margin-left: 57px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 425px">
<div class="contain rtl">
<div class="t" style="margin-left: 152px"></div>
<div class="caption" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 424px">
<div class="contain rtl">
<div class="t" style="margin-left: 151px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 423px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="t" style="margin-left: 151px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 425px">
<div class="contain rtl">
<div class="caption" style="margin-left: 72px"></div>
<div class="t" style="margin-left: 152px"></div>
</div>
</div>
<div style="width: 424px">
<div class="contain rtl">
<div class="caption" style="margin-left: 71px"></div>
<div class="t" style="margin-left: 151px"></div>
</div>
</div>
<div style="width: 423px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="caption" style="margin-left: 70px"></div>
<div class="t" style="margin-left: 150px"></div>
</div>
</div>
<div style="width: 426px">
<div class="contain rtl">
<div class="t" style="margin-left: 152px"></div>
<div class="caption" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 425px">
<div class="contain rtl">
<div class="t" style="margin-left: 151px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 424px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="t" style="margin-left: 150px"></div>
<div class="caption" style="margin-left: 70px"></div>
</div>
</div>
<div style="width: 418px">
<div class="contain rtl">
<div class="caption" style="margin-left: 72px"></div>
<div class="t" style="margin-left: 145px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="caption" style="margin-left: 71px"></div>
<div class="t" style="margin-left: 144px"></div>
</div>
</div>
<div style="width: 416px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="caption" style="margin-left: 70px"></div>
<div class="t" style="margin-left: 143px"></div>
</div>
</div>
<div style="width: 418px">
<div class="contain rtl">
<div class="t" style="margin-left: 145px"></div>
<div class="caption" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="t" style="margin-left: 144px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 416px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="t" style="margin-left: 144px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="t" style="margin-left: 144px"></div>
<div class="caption" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 416px">
<div class="contain rtl">
<div class="t" style="margin-left: 143px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 415px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="t" style="margin-left: 142px"></div>
<div class="caption" style="margin-left: 70px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="caption" style="margin-left: 72px"></div>
<div class="t" style="margin-left: 144px"></div>
</div>
</div>
<div style="width: 416px">
<div class="contain rtl">
<div class="caption" style="margin-left: 71px"></div>
<div class="t" style="margin-left: 143px"></div>
</div>
</div>
<div style="width: 415px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="caption" style="margin-left: 71px"></div>
<div class="t" style="margin-left: 143px"></div>
</div>
</div>
<div style="width: 419px">
<div class="contain rtl">
<div class="t" style="margin-left: 145px"></div>
<div class="caption" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 418px">
<div class="contain rtl">
<div class="t" style="margin-left: 144px"></div>
<div class="caption" style="margin-left: 71px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="t" style="margin-left: 143px"></div>
<div class="caption" style="margin-left: 70px"></div>
</div>
</div>
<div style="width: 419px">
<div class="contain rtl">
<div class="caption" style="margin-left: 72px"></div>
<div class="t" style="margin-left: 146px"></div>
</div>
</div>
<div style="width: 418px">
<div class="contain rtl">
<div class="caption" style="margin-left: 71px"></div>
<div class="t" style="margin-left: 145px"></div>
</div>
</div>
<div style="width: 417px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="caption" style="margin-left: 70px"></div>
<div class="t" style="margin-left: 144px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 201px"></div
><div class="side t" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 672px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 200px"></div
><div class="side t" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 671px">
<div class="contain rtl">
<div class="pushed"></div>
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 199px"></div
><div class="side t" style="margin-left: 72px"></div>
</div>
</div>
<div style="width: 674px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 201px"></div
><div class="side t" style="margin-left: 73px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 200px"></div
><div class="side t" style="margin-left: 73px"></div>
</div>
</div>
<div style="width: 672px">
<div class="contain rtl">
<div class="pushed"></div>
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 199px"></div
><div class="side t" style="margin-left: 73px"></div>
</div>
</div>
<div style="width: 675px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 201px"></div
><div class="side t" style="margin-left: 74px"></div>
</div>
</div>
<div style="width: 674px">
<div class="contain rtl">
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 200px"></div
><div class="side t" style="margin-left: 74px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<div class="pushed"></div>
<!-- margins showing up in the wrong places? -->
<div class="side caption" style="margin-left: 199px"></div
><div class="side t" style="margin-left: 74px"></div>
</div>
</div>
<div style="width: 674px">
<div class="contain rtl">
<div class="side t" style="margin-left: 101px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<div class="side t" style="margin-left: 100px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 672px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="side t" style="margin-left: 100px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 674px">
<div class="contain rtl">
<div class="side t" style="margin-left: 101px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<div class="side t" style="margin-left: 100px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 672px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="side t" style="margin-left: 99px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 675px">
<div class="contain rtl">
<div class="side t" style="margin-left: 101px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 674px">
<div class="contain rtl">
<div class="side t" style="margin-left: 100px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
<div style="width: 673px">
<div class="contain rtl">
<div class="pushed"></div>
<div class="side t" style="margin-left: 99px"></div
><div class="side caption" style="margin-left: 100px"></div>
</div>
</div>
</body>
</html>