1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0//EN">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
7 <style type=
"text/css">
8 body
{font-family:arial
}
9 .log {background-color:silver
; color:blue
}
10 pre
.log
{display:table-cell
}
13 <title>Debugging facilities in HTML-Table code
</title>
16 <h1>Debugging facilities in HTML-table code
</h1>
18 <p>The most efficient tool to claim that html-table code is the victim and not the source of layout bugs is a
<a href=
"http://lxr.mozilla.org/seamonkey/source/layout/doc/frame_reflow_debug.html">frame reflow debug log
</a>. Look there especially how the maxElementsize (MES) and desired size are propagated.
22 Another way to debug the reflow process is implemented inside
<a href=
"http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsBlockFrame.cpp">nsBlockFrame.cpp
</a>. It can be invoked by
<p>
23 <code>set GECKO_BLOCK_DEBUG_FLAGS=reflow
</code>
25 The available options are:
27 <li><code>reflow
</code>
28 <li> <code>really-noisy-reflow
</code>
29 <li><code>max-element-size
</code>
30 <li><code> space-manager
</code>
31 <li><code>verify-lines
</code>
32 <li><code>damage-repair
</code>
33 <li><code>lame-paint-metrics
</code>
34 <li><code>lame-reflow-metrics
</code>
35 <li><code>disable-resize-opt
</code>
38 These options can be combined with a comma separated list
39 Messages generated by the
<code>reflow
</code> switch:
41 <li><code> Block(div)(
1)@
00BE5AC4: reflowing dirty lines computedWidth=
9000 computedHeight=
1500</code>
43 <li> this message is generated inside of
<br>
44 <code>nsresult nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
</code>
45 <li> it first shows the Block ID and Address
46 <li>and then the computed width and Height from the HTMLReflowState.
50 <h2>DEBUG_TABLE_STRATEGY
</h2>
52 The table layout strategy can be visualized by defining in the
<a href=
"http://lxr.mozilla.org/seamonkey/source/layout/html/table/src/Makefile.in">makefiles
</a> the constant DEBUG_TABLE_STRATEGY.
54 If one takes for instance the following table
55 <table cellspacing=
"10"><tr><th>rendering
</th><th>code
</th></tr>
56 <tr valign=
"top"><td valign=
"top" style=
"padding-top:10px">
57 <table border
width=
"300">
65 <td style=
"width:80px">cell
1</td>
72 <td valign=
"top"><pre class=
"log">
73 <table border
width=
"300">
76 <col
width=
"50%">
77 <col
width=
"1*">
81 <td
style=
"width:80px">cell
1</td
>
82 <td
>cell
2</td
>
83 <td
>cell
3</td
>
84 <td
>cell
4</td
>
92 it will produce the following log at the entrance of
<code>AssignNonPctColWidths
</code>:
94 <table class=
"log"><tr><td>
96 AssignNonPctColWidths en max=
4500 count=
0
97 ***START TABLE DUMP***
98 mColWidths=-
1 -
1 -
1 -
1
100 col frame cache -
>
101 0=
00B93138
1=
00B931F0
2=
024DD728
3=
024DD780
102 **START COL DUMP** colIndex=
0 isAnonymous=
0 constraint=
0
103 widths=-
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 **END COL DUMP**
104 **START COL DUMP** colIndex=
1 isAnonymous=
0 constraint=
0
105 widths=-
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 **END COL DUMP**
106 **START COL DUMP** colIndex=
2 isAnonymous=
0 constraint=
0
107 widths=-
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 **END COL DUMP**
108 **START COL DUMP** colIndex=
3 isAnonymous=
0 constraint=
0
109 widths=-
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 **END COL DUMP**
116 The
<span class=
"log">en
</span> stands for entrance (
<span class=
"log">ex
</span> for leaving a routine). The first line of the data dump shows that no width has yet been assigned to the columns
<span class=
"log">mColWidths=-
1 -
1 -
1 -
1</span>,
<code>-
1</code> stands for:
118 #define WIDTH_NOT_SET -
1
121 This is followed by a reference to the column frame pointers:
124 col frame cache -
>
125 0=
00B93138
1=
00B931F0
2=
024DD728
3=
024DD780
128 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 applied
<span class=
"log">colIndex=
0 isAnonymous=
0 constraint=
0</span>. The following constraint types are known:
132 ePixelConstraint =
1, // pixel width
133 ePercentConstraint =
2, // percent width
134 eProportionConstraint =
3, //
1*,
2*, etc. cols attribute assigns
1*
135 e0ProportionConstraint =
4 //
0*, means to force to min width
138 After this follows the width information for each column:
141 widths=-
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1
144 The table code knows ten different width's:
146 #define NUM_WIDTHS
10
147 #define NUM_MAJOR_WIDTHS
3 // MIN, DES, FIX
148 #define MIN_CON
0 // minimum width required of the content + padding
149 #define DES_CON
1 // desired width of the content + padding
150 #define FIX
2 // fixed width either from the content or cell, col, etc. + padding
151 #define MIN_ADJ
3 // minimum width + padding due to col spans
152 #define DES_ADJ
4 // desired width + padding due to col spans
153 #define FIX_ADJ
5 // fixed width + padding due to col spans
154 #define PCT
6 // percent width of cell or col
155 #define PCT_ADJ
7 // percent width of cell or col from percent colspan
156 #define MIN_PRO
8 // desired width due to proportional
<col
>s or cols attribute
157 #define FINAL
9 // width after the table has been balanced, considering all of the others
160 In the last log snippet none of these width's has been set.
161 Leaving AssignNonPctColWidths shows that already to all columns a width of
360 twips has been assigned
163 AssignNonPctColWidths ex
164 ***START TABLE DUMP***
165 mColWidths=
360 360 360 360
167 col frame cache -
>
168 0=
00B93138
1=
00B931F0
2=
024DD728
3=
024DD780
169 **START COL DUMP** colIndex=
0 isAnonymous=
0 constraint=
0
170 widths=
360 540 1230 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
171 **START COL DUMP** colIndex=
1 isAnonymous=
0 constraint=
0
172 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
173 **START COL DUMP** colIndex=
2 isAnonymous=
0 constraint=
3
174 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 540 360 **END COL DUMP**
175 **START COL DUMP** colIndex=
3 isAnonymous=
0 constraint=
0
176 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
180 The first column has already the minimum content width, the table column can't shrink below that, the desired content width of
<span class=
"log">540</span> twips, that's the space to layout
<code>cell
1</code> without wrapping the text and the
<span class=
"log">1230</span> which correspond to the
<code>style=
"width:80px"</code> at the first cell. At this step the final size is
<span class=
"log">360</span> twips.
182 <table cellpadding=
"8">
184 <th> MIN_CON
</th><th>DES_CON
</th><th>FIX
</th><th>MIN_ADJ
</th><th>DES_ADJ
</th><th>FIX_ADJ
</th><th>PCT
</th><th> PCT_ADJ
</th><th> MIN_PRO
</th><th>FINAL
</th>
187 <td>360</td><td> 540</td><td> 1230 </td><td>-
1</td><td> -
1 </td><td>-
1</td><td> -
1</td><td> -
1</td><td> -
1</td><td> 360</td></tr></table>
189 There was no change till the entrance of
<code>BalanceColumnWidths
193 BalanceColumnWidths en count=
1
194 ***START TABLE DUMP***
195 mColWidths=
360 360 360 360
197 col frame cache -
>
198 0=
00B93138
1=
00B931F0
2=
024DD728
3=
024DD780
199 **START COL DUMP** colIndex=
0 isAnonymous=
0 constraint=
0
200 widths=
360 540 1230 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
201 **START COL DUMP** colIndex=
1 isAnonymous=
0 constraint=
0
202 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
203 **START COL DUMP** colIndex=
2 isAnonymous=
0 constraint=
3
204 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 540 360 **END COL DUMP**
205 **START COL DUMP** colIndex=
3 isAnonymous=
0 constraint=
0
206 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 -
1 360 **END COL DUMP**
210 But at the end the final distribution between the columns has been reached.
213 BalanceColumnWidths ex
214 ***START TABLE DUMP***
215 mColWidths=
1230 2160 465 465
217 col frame cache -
>
218 0=
00B93138
1=
00B931F0
2=
024DD728
3=
024DD780
219 **START COL DUMP** colIndex=
0 isAnonymous=
0 constraint=
0
220 widths=
360 540 1230 -
1 -
1 -
1 -
1 -
1 -
1 1230 **END COL DUMP**
221 **START COL DUMP** colIndex=
1 isAnonymous=
0 constraint=
0
222 widths=
360 540 -
1 -
1 -
1 -
1 2160 -
1 -
1 2160 **END COL DUMP**
223 **START COL DUMP** colIndex=
2 isAnonymous=
0 constraint=
3
224 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 540 465 **END COL DUMP**
225 **START COL DUMP** colIndex=
3 isAnonymous=
0 constraint=
0
226 widths=
360 540 -
1 -
1 -
1 -
1 -
1 -
1 -
1 465 **END COL DUMP**
230 The column dump is implemented in
<code>nsTableColFrame.cpp
</code> in the routine:
231 <code>void nsTableColFrame::Dump(PRInt32 aIndent)
</code>.
233 <h2>DEBUG_TABLE_REFLOW_TIMING
</h2>
234 <p>needs to be written
237 <p style=
"text-align:right">author: Bernd Mielke
<br>2002-
06-
05</p>