зеркало из https://github.com/mozilla/gecko-dev.git
236 строки
6.7 KiB
HTML
236 строки
6.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<style>
|
|
body {font-family:arial}
|
|
</style>
|
|
<title>
|
|
Debugging facilities in HTML-table code
|
|
</title>
|
|
</head>
|
|
|
|
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
|
|
|
|
<h1>
|
|
Debugging facilities in HTML-table code
|
|
</h1>
|
|
<h2>
|
|
Reflow
|
|
</h2>
|
|
In
|
|
<a href="http://lxr.mozilla.org/seamonkey/source/layout/html/table/src/nsTableFrame.cpp#71"><code> nsTableFrame.cpp</code></a>
|
|
by changing the
|
|
<code>
|
|
#ifdef 1
|
|
</code>
|
|
to
|
|
<code>
|
|
#ifdef 0
|
|
</code>
|
|
you can turn on the table reflow log mechanism.
|
|
A sample line is:
|
|
<p>
|
|
<code>
|
|
new: Tbl 00B6C4E0 r=0 a=8940 c=0,0 cnt=0 <p>
|
|
TO::Rfl en 00B74D78 rea=0 av=(8940,UC) comp=(0,0) count=0
|
|
</code>
|
|
<p>
|
|
The lines has the
|
|
<ul>
|
|
<li>
|
|
message :
|
|
<code>
|
|
TO::Rfl en
|
|
</code> , these messages are generated in the following routines:
|
|
<ul>
|
|
<li>
|
|
<code>
|
|
TO::
|
|
</code>
|
|
nsTableOuterFrame::Reflow
|
|
<li>
|
|
<code>
|
|
T::
|
|
</code>
|
|
nsTableFrame::Reflow
|
|
<li>
|
|
<code>
|
|
TRG::
|
|
</code>
|
|
nsTableRowGroupFrame::Reflow
|
|
<li>
|
|
<code>
|
|
TR::
|
|
</code>
|
|
nsTableRowFrame::Reflow
|
|
<li>
|
|
<code>
|
|
TC::
|
|
</code>
|
|
nsTableCellFrame::Reflow
|
|
<li>
|
|
<code>
|
|
Area::
|
|
</code>
|
|
nsTableCellFrame::Reflow
|
|
</ul>
|
|
<li>
|
|
the frame ID
|
|
<code>
|
|
00B74D78
|
|
</code>
|
|
<li>
|
|
the reason for the reflow:
|
|
<code>
|
|
rea=0
|
|
</code>
|
|
The correpsonding enumerate is in
|
|
<a href="http://lxr.mozilla.org/seamonkey/source/layout/public/nsHTMLReflowState.h"><code> nsHTMLReflowState.h</code></a>
|
|
.
|
|
<ul>
|
|
<li>
|
|
0 initial reflow
|
|
<li>
|
|
1 incremental reflow
|
|
<li>
|
|
2 resize (general request to determine the desired size)
|
|
<li>
|
|
3 request to reflow because of a style change. Note: you must reflow all your
|
|
child frames
|
|
<li>
|
|
4 request to reflow because you and/or your children are dirty
|
|
</ul>
|
|
<li>
|
|
the available width and height:
|
|
<code>
|
|
av=(8940,UC)
|
|
</code>
|
|
for this case the available width is 8940 twips this corresponds to 8940/15=
|
|
596 pixel. The height is unconstrained. (This is 1<<30).
|
|
<li>
|
|
the computed width and height:
|
|
<code>
|
|
comp=(0,0)
|
|
</code>
|
|
also in twips
|
|
<li>
|
|
and the global reflow count:
|
|
<code>
|
|
count=0
|
|
</code>
|
|
</ul>
|
|
|
|
<code>
|
|
TO::Rfl ex 00B74D78 des=(1500,900)
|
|
</code>
|
|
<ul>
|
|
<li>
|
|
This line is the corresponding message once the reflow is done.
|
|
<li>
|
|
It contains as additional information about the desired width and height,
|
|
stored in the HTMLReflowMetrics.
|
|
</ul>
|
|
During the initial reflow the minimum size for the corresponding element is
|
|
also computed and reported like:
|
|
<p>
|
|
<code>
|
|
TC::Rfl ex 00B75498 des=(2070,315) maxElem=(2070,315)
|
|
</code>
|
|
|
|
<ul>
|
|
<li>
|
|
In the maxElem parameter the maxElementsize (width,height) from the HTMLReflowmetrics is
|
|
reported.
|
|
</ul>
|
|
<h2>Block Reflow</h2>
|
|
|
|
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>
|
|
These options can be combined with a comma seperated 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>
|
|
</li>
|
|
<pre>
|
|
#define WIDTH_NOT_SET -1
|
|
#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>
|
|
A typical part from a table dump when activated by setting in BasicTableLayoutStrategy.cpp
|
|
<code> #if 0</code>
|
|
<pre>
|
|
BalanceColumnWidths ex
|
|
***START TABLE DUMP***
|
|
mColWidths=6444 330 330 330 330 330 330 396
|
|
|
|
col frame cache ->
|
|
0=00BF0150 1=00BF01B4 2=00BF0218 3=00BF027C 4=00BF02E0 5=00BF0344 6=00BF03A8 7=0
|
|
0BF040C
|
|
**START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
|
|
widths=405 405 -1 -1 -1 -1 1794 -1 -1 6444 **END COL DUMP**
|
|
**START COL DUMP** colIndex=1 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 90 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=2 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 -1 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=3 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 -1 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=4 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 -1 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=5 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 -1 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=6 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 90 -1 -1 -1 -1 -1 330 **END COL DUMP**
|
|
**START COL DUMP** colIndex=7 isAnonymous=0 constraint=0
|
|
widths=0 0 -1 120 -1 -1 -1 -1 -1 396 **END COL DUMP** ***END TABLE DUMP***
|
|
</pre>
|
|
|
|
The column dump is implemented in <code>nsTableColFrame.cpp</code> in the routine:
|
|
<code>void nsTableColFrame::Dump(PRInt32 aIndent)</code>.
|
|
<table>
|
|
<colgroup>
|
|
<col span=9 width="100">
|
|
</colgroup>
|
|
<tbody align="center">
|
|
<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><td>405</td><td>405</td><td>-1</td><td>-1</td><td>-1</td><td>-1</td><td >1794</td><td>-1</td><td>-1</td><td>6444 </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|