Contents

1. Supported features

2. Remaining problems

3. Next steps

4. Implementation design

To implement the auto-table layout, the algorithm first needs to know what the minimum and maximum column widths are. The minimum column width corresponds to the largest minimum width of the cells contained in the column. The maximum column width is in fact the optimum column width which corresponds to the largest full unbroken width of the element-list in the columns cells.

These minimum and maximum column widths are computed in LineLayoutManager.getNextKnuthElements().

In order to pass the min and max values up the hierarchy, a new method has been added to the LayoutManager, called minMaxTextWidths(). It returns a MinOptMax object, giving the minimum and maximum widths of the content. This method has been implemented in AbstractLayoutManager and returns 0 for min and max by default, thus avoiding to implement the method in all Layout Managers. In BlockStackingLayoutManager and TableCellLayoutManager we simply implement minMaxTextWidths() by returning the MinOptMax of the childLM.

When the auto-table layout is detected in TableLayoutManager, determineAutoColumWidths() is called. The first thing the method does is initialize a list of columns which is used to keep track of our current optimum column widths. We also keep a list of minimum column widths. Then the optimum column widths are determined by a first call to contentLM.getNextKnuthElements(). Our list of minimum widths and maximum column widths are updated by TableContentLM.determineAutoColumnWidths() when a new minimum or maximum width is found.

We now have the maximum and minimum column widths, which allows us to calculate the optimal (maximum) and minimum table width by summing the min or max values.

If the maximum width of the table is greater than the specified table-width or available width, then the column widths are equally reduced up to their minimum width. If the minimum width of the table is lower than the specified table-width then the extra width is distributed over the columns, unless the 'table' or 'inline-table' element has 'width: auto', in which case the table width is the greater of the table's containing block width and the minimum table width computed earlier.

GoogleSummerOfCode2006/AutoTableLayoutProgress (last edited 2009-09-20 23:52:32 by localhost)