Differences between revisions 6 and 7
Revision 6 as of 2006-09-07 06:58:11
Size: 3011
Editor: MTL-HSE-ppp189461
Revision 7 as of 2009-09-20 23:52:32
Size: 3009
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents()]] <<TableOfContents>>


1. Supported features

  • table-layout="auto"
  • redistribution of extra space to the columns
  • table width="auto"
  • a test case has been created to test the basic auto-table layout implemented.

2. Remaining problems

  • when determining the minimum and maximum cell width the 'width' property of the cell has to be taken into account.
  • take into account the column-width if they are specified
  • spanned cells are not supported

3. Next steps

  • avoid creating the inline element lists twice. This require to split the LineLM.getNextKnuthElements() method.
  • support changing available IPD on pages. This implies a big refactoring of the layout engine.

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)