mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 03:30:17 +01:00
242 lines
9.0 KiB
HTML
242 lines
9.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<style type="text/css">
|
|
body {font-family:arial}
|
|
.log {background-color:silver; color:blue}
|
|
pre.log {display:table-cell}
|
|
</style>
|
|
|
|
<title>Debugging facilities in HTML-Table code</title>
|
|
</head>
|
|
<body>
|
|
<h1>Debugging facilities in HTML-table code</h1>
|
|
<h2>Reflow</h2>
|
|
<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.
|
|
|
|
<h2>Block Reflow</h2>
|
|
<p>
|
|
Another possibilty 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>
|
|
<code>set GECKO_BLOCK_DEBUG_FLAGS=reflow</code>
|
|
<p>
|
|
The available options are:
|
|
<ul>
|
|
<li><code>reflow</code>
|
|
<li> <code>really-noisy-reflow</code>
|
|
<li><code>max-element-size</code>
|
|
<li><code> space-manager</code>
|
|
<li><code>verify-lines</code>
|
|
<li><code>damage-repair</code>
|
|
<li><code>lame-paint-metrics</code>
|
|
<li><code>lame-reflow-metrics</code>
|
|
<li><code>disable-resize-opt</code>
|
|
</ul>
|
|
<p>
|
|
These options can be combined with a comma separated list
|
|
Messages generated by the <code>reflow</code> switch:
|
|
<ul>
|
|
<li><code> Block(div)(1)@00BE5AC4: reflowing dirty lines computedWidth=9000 computedHeight=1500</code>
|
|
<ul>
|
|
<li> this message is generated inside of <br>
|
|
<code>nsresult nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)</code>
|
|
<li> it first shows the Block ID and Address
|
|
<li>and then the computed width and Height from the HTMLReflowState.
|
|
</ul>
|
|
</ul>
|
|
|
|
<h2>DEBUG_TABLE_STRATEGY</h2>
|
|
<p>
|
|
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.
|
|
|
|
If one takes for instance the following table
|
|
<table cellspacing="10"><tr><th>rendering</th><th>code</th></tr>
|
|
<tr valign="top"><td valign="top" style="padding-top:10px">
|
|
<table border width="300">
|
|
<colgroup>
|
|
<col>
|
|
<col width="50%">
|
|
<col width="1*">
|
|
<col>
|
|
</colgroup>
|
|
<tr>
|
|
<td style="width:80px">cell 1</td>
|
|
<td>cell 2</td>
|
|
<td>cell 3</td>
|
|
<td>cell 4</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td valign="top"><pre class="log">
|
|
<table border width="300">
|
|
<colgroup>
|
|
<col>
|
|
<col width="50%">
|
|
<col width="1*">
|
|
<col>
|
|
</colgroup>
|
|
<tr>
|
|
<td style="width:80px">cell 1</td>
|
|
<td>cell 2</td>
|
|
<td>cell 3</td>
|
|
<td>cell 4</td>
|
|
</tr>
|
|
</table>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<p>
|
|
it will produce the following log at the entrance of <code>AssignNonPctColWidths</code>:
|
|
<p>
|
|
<table class="log"><tr><td>
|
|
<pre>
|
|
AssignNonPctColWidths en max=4500 count=0
|
|
***START TABLE DUMP***
|
|
mColWidths=-1 -1 -1 -1
|
|
|
|
col frame cache ->
|
|
0=00B93138 1=00B931F0 2=024DD728 3=024DD780
|
|
**START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
|
|
widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
|
|
**START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
|
|
widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
|
|
**START COL DUMP** colIndex=2 isAnonymous=0 constraint=0
|
|
widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
|
|
**START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
|
|
widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP**
|
|
***END TABLE DUMP***
|
|
</pre>
|
|
</td></tr></table>
|
|
|
|
|
|
<p>
|
|
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:
|
|
<pre>
|
|
#define WIDTH_NOT_SET -1
|
|
</pre>
|
|
<p>
|
|
This is followed by a reference to the column frame pointers:
|
|
<p>
|
|
<pre class="log">
|
|
col frame cache ->
|
|
0=00B93138 1=00B931F0 2=024DD728 3=024DD780
|
|
</pre>
|
|
<p>
|
|
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:
|
|
<p>
|
|
<pre>
|
|
eNoConstraint = 0,
|
|
ePixelConstraint = 1, // pixel width
|
|
ePercentConstraint = 2, // percent width
|
|
eProportionConstraint = 3, // 1*, 2*, etc. cols attribute assigns 1*
|
|
e0ProportionConstraint = 4 // 0*, means to force to min width
|
|
</pre>
|
|
<p>
|
|
After this follows the width information for each column:
|
|
<p>
|
|
<pre class="log">
|
|
widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
|
</pre>
|
|
<p>
|
|
The table code knows ten different width's:
|
|
<pre>
|
|
#define NUM_WIDTHS 10
|
|
#define NUM_MAJOR_WIDTHS 3 // MIN, DES, FIX
|
|
#define MIN_CON 0 // minimum width required of the content + padding
|
|
#define DES_CON 1 // desired width of the content + padding
|
|
#define FIX 2 // fixed width either from the content or cell, col, etc. + padding
|
|
#define MIN_ADJ 3 // minimum width + padding due to col spans
|
|
#define DES_ADJ 4 // desired width + padding due to col spans
|
|
#define FIX_ADJ 5 // fixed width + padding due to col spans
|
|
#define PCT 6 // percent width of cell or col
|
|
#define PCT_ADJ 7 // percent width of cell or col from percent colspan
|
|
#define MIN_PRO 8 // desired width due to proportional <col>s or cols attribute
|
|
#define FINAL 9 // width after the table has been balanced, considering all of the others
|
|
</pre>
|
|
<p>
|
|
In the last log snippet none of these width's has been set.
|
|
Leaving AssignNonPctColWidths shows that already to all columns a width of 360 twips has been assigned
|
|
<pre class="log">
|
|
AssignNonPctColWidths ex
|
|
***START TABLE DUMP***
|
|
mColWidths=360 360 360 360
|
|
|
|
col frame cache ->
|
|
0=00B93138 1=00B931F0 2=024DD728 3=024DD780
|
|
**START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
|
|
widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 540 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
***END TABLE DUMP***
|
|
</pre>
|
|
<p>
|
|
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, thats 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.
|
|
<p>
|
|
<table cellpadding="8">
|
|
<tr>
|
|
<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>
|
|
</tr>
|
|
<tr align="center">
|
|
<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>
|
|
<p>
|
|
There was no change till the entrance of <code>BalanceColumnWidths
|
|
</code>
|
|
<p>
|
|
<pre class="log">
|
|
BalanceColumnWidths en count=1
|
|
***START TABLE DUMP***
|
|
mColWidths=360 360 360 360
|
|
|
|
col frame cache ->
|
|
0=00B93138 1=00B931F0 2=024DD728 3=024DD780
|
|
**START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
|
|
widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 540 360 **END COL DUMP**
|
|
**START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **END COL DUMP**
|
|
***END TABLE DUMP***
|
|
</pre>
|
|
<p>
|
|
But at the end the final distribution between the columns has been reached.
|
|
<p>
|
|
<pre class="log">
|
|
BalanceColumnWidths ex
|
|
***START TABLE DUMP***
|
|
mColWidths=1230 2160 465 465
|
|
|
|
col frame cache ->
|
|
0=00B93138 1=00B931F0 2=024DD728 3=024DD780
|
|
**START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
|
|
widths=360 540 1230 -1 -1 -1 -1 -1 -1 1230 **END COL DUMP**
|
|
**START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 2160 -1 -1 2160 **END COL DUMP**
|
|
**START COL DUMP** colIndex=2 isAnonymous=0 constraint=3
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 540 465 **END COL DUMP**
|
|
**START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
|
|
widths=360 540 -1 -1 -1 -1 -1 -1 -1 465 **END COL DUMP**
|
|
***END TABLE DUMP***
|
|
</pre>
|
|
<p>
|
|
The column dump is implemented in <code>nsTableColFrame.cpp</code> in the routine:
|
|
<code>void nsTableColFrame::Dump(PRInt32 aIndent)</code>.
|
|
|
|
<h2>DEBUG_TABLE_REFLOW_TIMING</h2>
|
|
<p>needs to be written
|
|
|
|
<hr>
|
|
<p style="text-align:right">author: Bernd Mielke <br>2002-06-05</p>
|
|
|
|
</body>
|
|
|
|
</html>
|