Skip to content

Commit bb475ba

Browse files
committed
[css2] Replaced autmatic algorithm with Doug Rand's
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401267
1 parent 9301f7e commit bb475ba

1 file changed

Lines changed: 38 additions & 24 deletions

File tree

css2/tables.src

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: tables.src,v 2.22 1998-03-17 08:04:47 ijacobs Exp $ -->
3+
<!-- $Id: tables.src,v 2.23 1998-03-19 19:59:40 bbos Exp $ -->
44
<head>
55
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
66
<title>Tables</title>
@@ -797,43 +797,57 @@ determining the final layout.
797797

798798
<p>For this algorithm, a value of 'auto' for the <span
799799
class="propinst-width">'width'</span> property for the table element
800-
means that the final table width is computed dynamically: is the sum
800+
means that the final table width is computed dynamically: it is the sum
801801
of the column widths and the borders between them.
802802

803803
<p>Column widths are determined as follows:</p>
804804

805805
<ol>
806-
<li>The width is given by the <span
807-
class="propinst-width">'width'</span> property for the column
808-
element.
809-
<li>However, if there is no column element, or its <span
810-
class="propinst-width">'width'</span> is 'auto', the
811-
width is given by the width requirements of the cells in the
812-
column.
813-
<li>If the value of <span class="propinst-width">'width'</span> for the
814-
first cell in the column is 'auto', the UA finds the "optimal" width
815-
of the column, based on some heuristics.
806+
<li>For each cell determine the minimum and maximum widths needed.
807+
Cells with a given 'width' get a minimum width equal to the greater of
808+
the specified width and the minimum needed width.
809+
810+
<li>For each column determine a maximum and minimum width from the
811+
cells with a colspan of 1. If the column has a 'width' greater than
812+
the minimum over the cells, then the 'width' is used as the mimimum
813+
width for the column.
814+
815+
<li>For each cell with a colspan of more than one, increase the
816+
minimum and maximum widths of the columns it spans enough so the
817+
combined minimum/maximum widths are at least those of the cell. If
818+
possible, widen all spanned columns by approximately the same amount.
816819
</ol>
817820

818-
<p><p>A cell that spans columns provides a constraint on the sum of the
819-
widths of the columns it spans. The problem of finding
820-
the widths can be regarded as a constraint resolution system, that may
821-
be over- or under-constrained. </p>
821+
<p>Now we have a maximum and minimum width per column. We now
822+
determine final column widths. Cell spacing is appropriately added
823+
into these calculations.
824+
825+
<p>If there is a table width given, and it is larger than the minimum
826+
width needed, use it, and distribute the width over the columns in
827+
some way.
828+
829+
<p class="note">Note that a table may thus be wider than its 'width'
830+
property.
831+
832+
<p>If the table width is 'auto', there are three cases:
833+
834+
<ol>
835+
<li>If the maximum needed width for the table is less than the width
836+
of the table's containing block, use the maximum width.
837+
838+
<li>If the minimum width needed is greater than the width of the
839+
containing block, use the minimum width.
840+
841+
<li>Otherwise, use the width of the containing block and distribute
842+
the width over the columns in some way.
843+
</ol>
822844

823845
<p>A percentage is relative to the table width. If the table's width
824846
is 'auto', a percentage represents a constraint on the column's width,
825847
which a UA should try to satisfy. (Obviously, this is not always
826848
possible: if the column's width is '110%', the constraint cannot be
827849
satisfied.)</p>
828850

829-
<p>If a cell's content doesn't "fit" the width of the column, the
830-
<span class="propinst-overflow">'overflow'</span> property
831-
determines what happens to it.
832-
833-
<p>If the sum of the columns is not equal to the table's width, the UA
834-
is free to discard or modify any or all of the width properties until
835-
they are the same.
836-
837851
<div class="note">
838852
<P> <em><strong>Note.</strong> In this algorithm, rows (and row
839853
groups) and columns (and column groups) both constrain and are

0 commit comments

Comments
 (0)