michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: Debugging facilities in HTML-Table code michael@0: michael@0: michael@0:

Debugging facilities in HTML-table code

michael@0:

Reflow

michael@0:

The most efficient tool to claim that html-table code is the victim and not the source of layout bugs is a frame reflow debug log. Look there especially how the maxElementsize (MES) and desired size are propagated. michael@0: michael@0:

Block Reflow

michael@0:

michael@0: Another way to debug the reflow process is implemented inside nsBlockFrame.cpp. It can be invoked by

michael@0: set GECKO_BLOCK_DEBUG_FLAGS=reflow michael@0:

michael@0: The available options are: michael@0:

michael@0:

michael@0: These options can be combined with a comma separated list michael@0: Messages generated by the reflow switch: michael@0:

michael@0: michael@0:

DEBUG_TABLE_STRATEGY

michael@0:

michael@0: The table layout strategy can be visualized by defining in the makefiles the constant DEBUG_TABLE_STRATEGY. michael@0: michael@0: If one takes for instance the following table michael@0: michael@0: michael@0: michael@0: michael@0:
renderingcode
michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0:
cell 1cell 2cell 3cell 4
michael@0:
michael@0: <table border width="300">
michael@0: <colgroup>
michael@0: <col>
michael@0: <col width="50%">
michael@0: <col width="1*">
michael@0: <col>
michael@0: </colgroup>
michael@0: 	<tr>
michael@0: 	      <td style="width:80px">cell 1</td>
michael@0:             <td>cell 2</td>
michael@0:             <td>cell 3</td>
michael@0:             <td>cell 4</td>
michael@0: 	</tr>
michael@0: </table>
michael@0: 
michael@0:
michael@0:

michael@0: it will produce the following log at the entrance of AssignNonPctColWidths: michael@0:

michael@0:
michael@0:
michael@0: AssignNonPctColWidths en max=4500 count=0 
michael@0: ***START TABLE DUMP*** 
michael@0: mColWidths=-1 -1 -1 -1 
michael@0: 
michael@0:  col frame cache ->
michael@0: 0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
michael@0:  **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0:   widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0:   widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=2 isAnonymous=0 constraint=0
michael@0:   widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0:   widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1  **END COL DUMP**
michael@0: ***END TABLE DUMP***
michael@0: 
michael@0:
michael@0: michael@0: michael@0:

michael@0: The en stands for entrance (ex for leaving a routine). The first line of the data dump shows that no width has yet been assigned to the columns mColWidths=-1 -1 -1 -1, -1 stands for: michael@0:

michael@0: #define WIDTH_NOT_SET   -1
michael@0: 
michael@0:

michael@0: This is followed by a reference to the column frame pointers: michael@0:

michael@0:

michael@0: col frame cache ->
michael@0: 0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
michael@0: 
michael@0:

michael@0: This is followed by the information which width has been set for each column. The index of the column, whether it is anonymous and what kind of constrained has been appliedcolIndex=0 isAnonymous=0 constraint=0. The following constraint types are known: michael@0:

michael@0:

michael@0:   eNoConstraint          = 0,
michael@0:   ePixelConstraint       = 1,      // pixel width 
michael@0:   ePercentConstraint     = 2,      // percent width
michael@0:   eProportionConstraint  = 3,      // 1*, 2*, etc. cols attribute assigns 1*
michael@0:   e0ProportionConstraint = 4       // 0*, means to force to min width
michael@0: 
michael@0:

michael@0: After this follows the width information for each column: michael@0:

michael@0:

michael@0: widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
michael@0: 
michael@0:

michael@0: The table code knows ten different width's: michael@0:

michael@0: #define NUM_WIDTHS       10
michael@0: #define NUM_MAJOR_WIDTHS 3 // MIN, DES, FIX
michael@0: #define MIN_CON          0 // minimum width required of the content + padding
michael@0: #define DES_CON          1 // desired width of the content + padding
michael@0: #define FIX              2 // fixed width either from the content or cell, col, etc. + padding
michael@0: #define MIN_ADJ          3 // minimum width + padding due to col spans
michael@0: #define DES_ADJ          4 // desired width + padding due to col spans
michael@0: #define FIX_ADJ          5 // fixed width + padding due to col spans
michael@0: #define PCT              6 // percent width of cell or col 
michael@0: #define PCT_ADJ          7 // percent width of cell or col from percent colspan
michael@0: #define MIN_PRO          8 // desired width due to proportional <col>s or cols attribute
michael@0: #define FINAL            9 // width after the table has been balanced, considering all of the others
michael@0: 
michael@0:

michael@0: In the last log snippet none of these width's has been set. michael@0: Leaving AssignNonPctColWidths shows that already to all columns a width of 360 twips has been assigned michael@0:

michael@0: AssignNonPctColWidths ex
michael@0: ***START TABLE DUMP*** 
michael@0: mColWidths=360 360 360 360 
michael@0: 
michael@0:  col frame cache ->
michael@0: 0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
michael@0:  **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0:   widths=360 540 1230 -1 -1 -1 -1 -1 -1 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 -1 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 540 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 -1 360  **END COL DUMP**
michael@0: ***END TABLE DUMP***
michael@0: 
michael@0:

michael@0: The first column has already the minimum content width, the table column can't shrink below that, the desired content width of 540 twips, that's the space to layout cell 1 without wrapping the text and the 1230 which correspond to the style="width:80px" at the first cell. At this step the final size is 360 twips. michael@0:

michael@0: michael@0: michael@0: michael@0: michael@0: michael@0:
MIN_CONDES_CONFIXMIN_ADJDES_ADJFIX_ADJPCT PCT_ADJ MIN_PROFINAL
360 540 1230 -1 -1 -1 -1 -1 -1 360
michael@0:

michael@0: There was no change till the entrance of BalanceColumnWidths michael@0: michael@0:

michael@0:

michael@0: BalanceColumnWidths en count=1
michael@0: ***START TABLE DUMP*** 
michael@0: mColWidths=360 360 360 360 
michael@0: 
michael@0:  col frame cache ->
michael@0: 0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
michael@0:  **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0:   widths=360 540 1230 -1 -1 -1 -1 -1 -1 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 -1 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 540 360  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 -1 360  **END COL DUMP**
michael@0: ***END TABLE DUMP***
michael@0: 
michael@0:

michael@0: But at the end the final distribution between the columns has been reached. michael@0:

michael@0:

michael@0: BalanceColumnWidths ex
michael@0: ***START TABLE DUMP*** 
michael@0: mColWidths=1230 2160 465 465 
michael@0: 
michael@0:  col frame cache ->
michael@0: 0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
michael@0:  **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0:   widths=360 540 1230 -1 -1 -1 -1 -1 -1 1230  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 2160 -1 -1 2160  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 540 465  **END COL DUMP** 
michael@0:  **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0:   widths=360 540 -1 -1 -1 -1 -1 -1 -1 465  **END COL DUMP**
michael@0: ***END TABLE DUMP***
michael@0: 
michael@0:

michael@0: The column dump is implemented in nsTableColFrame.cpp in the routine: michael@0: void nsTableColFrame::Dump(int32_t aIndent). michael@0: michael@0:

DEBUG_TABLE_REFLOW_TIMING

michael@0:

needs to be written michael@0: michael@0:


michael@0:

author: Bernd Mielke
2002-06-05

michael@0: michael@0: michael@0: michael@0: