layout/doc/debugtable.html

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 4
michael@0 5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
michael@0 6
michael@0 7 <html>
michael@0 8 <head>
michael@0 9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
michael@0 10
michael@0 11 <style type="text/css">
michael@0 12 body {font-family:arial}
michael@0 13 .log {background-color:silver; color:blue}
michael@0 14 pre.log {display:table-cell}
michael@0 15 </style>
michael@0 16
michael@0 17 <title>Debugging facilities in HTML-Table code</title>
michael@0 18 </head>
michael@0 19 <body>
michael@0 20 <h1>Debugging facilities in HTML-table code</h1>
michael@0 21 <h2>Reflow</h2>
michael@0 22 <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.
michael@0 23
michael@0 24 <h2>Block Reflow</h2>
michael@0 25 <p>
michael@0 26 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>
michael@0 27 <code>set GECKO_BLOCK_DEBUG_FLAGS=reflow</code>
michael@0 28 <p>
michael@0 29 The available options are:
michael@0 30 <ul>
michael@0 31 <li><code>reflow</code>
michael@0 32 <li> <code>really-noisy-reflow</code>
michael@0 33 <li><code>max-element-size</code>
michael@0 34 <li><code> space-manager</code>
michael@0 35 <li><code>verify-lines</code>
michael@0 36 <li><code>damage-repair</code>
michael@0 37 <li><code>lame-paint-metrics</code>
michael@0 38 <li><code>lame-reflow-metrics</code>
michael@0 39 <li><code>disable-resize-opt</code>
michael@0 40 </ul>
michael@0 41 <p>
michael@0 42 These options can be combined with a comma separated list
michael@0 43 Messages generated by the <code>reflow</code> switch:
michael@0 44 <ul>
michael@0 45 <li><code> Block(div)(1)@00BE5AC4: reflowing dirty lines computedWidth=9000 computedHeight=1500</code>
michael@0 46 <ul>
michael@0 47 <li> this message is generated inside of <br>
michael@0 48 <code>nsresult nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)</code>
michael@0 49 <li> it first shows the Block ID and Address
michael@0 50 <li>and then the computed width and Height from the HTMLReflowState.
michael@0 51 </ul>
michael@0 52 </ul>
michael@0 53
michael@0 54 <h2>DEBUG_TABLE_STRATEGY</h2>
michael@0 55 <p>
michael@0 56 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.
michael@0 57
michael@0 58 If one takes for instance the following table
michael@0 59 <table cellspacing="10"><tr><th>rendering</th><th>code</th></tr>
michael@0 60 <tr valign="top"><td valign="top" style="padding-top:10px">
michael@0 61 <table border width="300">
michael@0 62 <colgroup>
michael@0 63 <col>
michael@0 64 <col width="50%">
michael@0 65 <col width="1*">
michael@0 66 <col>
michael@0 67 </colgroup>
michael@0 68 <tr>
michael@0 69 <td style="width:80px">cell 1</td>
michael@0 70 <td>cell 2</td>
michael@0 71 <td>cell 3</td>
michael@0 72 <td>cell 4</td>
michael@0 73 </tr>
michael@0 74 </table>
michael@0 75 </td>
michael@0 76 <td valign="top"><pre class="log">
michael@0 77 &lt;table border width="300"&gt;
michael@0 78 &lt;colgroup&gt;
michael@0 79 &lt;col&gt;
michael@0 80 &lt;col width="50%"&gt;
michael@0 81 &lt;col width="1*"&gt;
michael@0 82 &lt;col&gt;
michael@0 83 &lt;/colgroup&gt;
michael@0 84 &lt;tr&gt;
michael@0 85 &lt;td style="width:80px"&gt;cell 1&lt;/td&gt;
michael@0 86 &lt;td&gt;cell 2&lt;/td&gt;
michael@0 87 &lt;td&gt;cell 3&lt;/td&gt;
michael@0 88 &lt;td&gt;cell 4&lt;/td&gt;
michael@0 89 &lt;/tr&gt;
michael@0 90 &lt;/table&gt;
michael@0 91 </pre>
michael@0 92 </td>
michael@0 93 </tr>
michael@0 94 </table>
michael@0 95 <p>
michael@0 96 it will produce the following log at the entrance of <code>AssignNonPctColWidths</code>:
michael@0 97 <p>
michael@0 98 <table class="log"><tr><td>
michael@0 99 <pre>
michael@0 100 AssignNonPctColWidths en max=4500 count=0
michael@0 101 ***START TABLE DUMP***
michael@0 102 mColWidths=-1 -1 -1 -1
michael@0 103
michael@0 104 col frame cache -&gt;
michael@0 105 0=00B93138 1=00B931F0 2=024DD728 3=024DD780
michael@0 106 **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0 107 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
michael@0 108 **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0 109 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
michael@0 110 **START COL DUMP** colIndex=2 isAnonymous=0 constraint=0
michael@0 111 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
michael@0 112 **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0 113 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
michael@0 114 ***END TABLE DUMP***
michael@0 115 </pre>
michael@0 116 </td></tr></table>
michael@0 117
michael@0 118
michael@0 119 <p>
michael@0 120 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:
michael@0 121 <pre>
michael@0 122 #define WIDTH_NOT_SET -1
michael@0 123 </pre>
michael@0 124 <p>
michael@0 125 This is followed by a reference to the column frame pointers:
michael@0 126 <p>
michael@0 127 <pre class="log">
michael@0 128 col frame cache -&gt;
michael@0 129 0=00B93138 1=00B931F0 2=024DD728 3=024DD780
michael@0 130 </pre>
michael@0 131 <p>
michael@0 132 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:
michael@0 133 <p>
michael@0 134 <pre>
michael@0 135 eNoConstraint = 0,
michael@0 136 ePixelConstraint = 1, // pixel width
michael@0 137 ePercentConstraint = 2, // percent width
michael@0 138 eProportionConstraint = 3, // 1*, 2*, etc. cols attribute assigns 1*
michael@0 139 e0ProportionConstraint = 4 // 0*, means to force to min width
michael@0 140 </pre>
michael@0 141 <p>
michael@0 142 After this follows the width information for each column:
michael@0 143 <p>
michael@0 144 <pre class="log">
michael@0 145 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
michael@0 146 </pre>
michael@0 147 <p>
michael@0 148 The table code knows ten different width's:
michael@0 149 <pre>
michael@0 150 #define NUM_WIDTHS 10
michael@0 151 #define NUM_MAJOR_WIDTHS 3 // MIN, DES, FIX
michael@0 152 #define MIN_CON 0 // minimum width required of the content + padding
michael@0 153 #define DES_CON 1 // desired width of the content + padding
michael@0 154 #define FIX 2 // fixed width either from the content or cell, col, etc. + padding
michael@0 155 #define MIN_ADJ 3 // minimum width + padding due to col spans
michael@0 156 #define DES_ADJ 4 // desired width + padding due to col spans
michael@0 157 #define FIX_ADJ 5 // fixed width + padding due to col spans
michael@0 158 #define PCT 6 // percent width of cell or col
michael@0 159 #define PCT_ADJ 7 // percent width of cell or col from percent colspan
michael@0 160 #define MIN_PRO 8 // desired width due to proportional &lt;col&gt;s or cols attribute
michael@0 161 #define FINAL 9 // width after the table has been balanced, considering all of the others
michael@0 162 </pre>
michael@0 163 <p>
michael@0 164 In the last log snippet none of these width's has been set.
michael@0 165 Leaving AssignNonPctColWidths shows that already to all columns a width of 360 twips has been assigned
michael@0 166 <pre class="log">
michael@0 167 AssignNonPctColWidths ex
michael@0 168 ***START TABLE DUMP***
michael@0 169 mColWidths=360 360 360 360
michael@0 170
michael@0 171 col frame cache -&gt;
michael@0 172 0=00B93138 1=00B931F0 2=024DD728 3=024DD780
michael@0 173 **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0 174 widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 175 **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0 176 widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 177 **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0 178 widths=360 540 -1 -1 -1 -1 -1 -1 540 360 **END COL DUMP**
michael@0 179 **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0 180 widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 181 ***END TABLE DUMP***
michael@0 182 </pre>
michael@0 183 <p>
michael@0 184 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.
michael@0 185 <p>
michael@0 186 <table cellpadding="8">
michael@0 187 <tr>
michael@0 188 <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>
michael@0 189 </tr>
michael@0 190 <tr align="center">
michael@0 191 <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>
michael@0 192 <p>
michael@0 193 There was no change till the entrance of <code>BalanceColumnWidths
michael@0 194 </code>
michael@0 195 <p>
michael@0 196 <pre class="log">
michael@0 197 BalanceColumnWidths en count=1
michael@0 198 ***START TABLE DUMP***
michael@0 199 mColWidths=360 360 360 360
michael@0 200
michael@0 201 col frame cache -&gt;
michael@0 202 0=00B93138 1=00B931F0 2=024DD728 3=024DD780
michael@0 203 **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0 204 widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 205 **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0 206 widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 207 **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0 208 widths=360 540 -1 -1 -1 -1 -1 -1 540 360 **END COL DUMP**
michael@0 209 **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0 210 widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
michael@0 211 ***END TABLE DUMP***
michael@0 212 </pre>
michael@0 213 <p>
michael@0 214 But at the end the final distribution between the columns has been reached.
michael@0 215 <p>
michael@0 216 <pre class="log">
michael@0 217 BalanceColumnWidths ex
michael@0 218 ***START TABLE DUMP***
michael@0 219 mColWidths=1230 2160 465 465
michael@0 220
michael@0 221 col frame cache -&gt;
michael@0 222 0=00B93138 1=00B931F0 2=024DD728 3=024DD780
michael@0 223 **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
michael@0 224 widths=360 540 1230 -1 -1 -1 -1 -1 -1 1230 **END COL DUMP**
michael@0 225 **START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
michael@0 226 widths=360 540 -1 -1 -1 -1 2160 -1 -1 2160 **END COL DUMP**
michael@0 227 **START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
michael@0 228 widths=360 540 -1 -1 -1 -1 -1 -1 540 465 **END COL DUMP**
michael@0 229 **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
michael@0 230 widths=360 540 -1 -1 -1 -1 -1 -1 -1 465 **END COL DUMP**
michael@0 231 ***END TABLE DUMP***
michael@0 232 </pre>
michael@0 233 <p>
michael@0 234 The column dump is implemented in <code>nsTableColFrame.cpp</code> in the routine:
michael@0 235 <code>void nsTableColFrame::Dump(int32_t aIndent)</code>.
michael@0 236
michael@0 237 <h2>DEBUG_TABLE_REFLOW_TIMING</h2>
michael@0 238 <p>needs to be written
michael@0 239
michael@0 240 <hr>
michael@0 241 <p style="text-align:right">author: Bernd Mielke <br>2002-06-05</p>
michael@0 242
michael@0 243 </body>
michael@0 244
michael@0 245 </html>

mercurial