diff --git a/mozilla/layout/doc/debugtable.html b/mozilla/layout/doc/debugtable.html index afb7b976535..05093066283 100644 --- a/mozilla/layout/doc/debugtable.html +++ b/mozilla/layout/doc/debugtable.html @@ -1,151 +1,24 @@ - + - - - - - Debugging facilities in HTML-table code - - - - - -

- Debugging facilities in HTML-table code -

-

- Reflow -

- In - nsTableFrame.cpp - by changing the - - #ifdef 1 - - to - - #ifdef 0 - - you can turn on the table reflow log mechanism. - A sample line is: -

- - new: Tbl 00B6C4E0 r=0 a=8940 c=0,0 cnt=0

- TO::Rfl en 00B74D78 rea=0 av=(8940,UC) comp=(0,0) count=0 - -

- The lines has the -

- - - TO::Rfl ex 00B74D78 des=(1500,900) - - - During the initial reflow the minimum size for the corresponding element is - also computed and reported like: + + + + + + Debugging facilities in HTML-Table code + + +

Debugging facilities in HTML-table code

+

Reflow

+

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. + +

Block Reflow

- - TC::Rfl ex 00B75498 des=(2070,315) maxElem=(2070,315) - - -

-

Block Reflow

- Another possibilty to debug the reflow process is implemented inside nsBlockFrame.cpp. It can be invoked by

set GECKO_BLOCK_DEBUG_FLAGS=reflow

@@ -161,6 +34,7 @@ The available options are:

  • lame-reflow-metrics
  • disable-resize-opt +

    These options can be combined with a comma seperated list Messages generated by the reflow switch:

    -
  • + + +

    DEBUG_TABLE_STRATEGY

    +

    +The table layout strategy can be visualized by defining in the makefiles the constant DEBUG_TABLE_STRATEGY. + +If one takes for instance the following table + + + + +
    renderingcode
    + ++++++ + + + + + + +
    cell 1cell 2cell 3cell 4
    +
    +<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>
    +
    +
    +

    +it will produce the following log at the entrance of AssignNonPctColWidths: +

    +
    +
    +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***
    +
    +
    + + +

    +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:

     #define WIDTH_NOT_SET   -1
    +
    +

    +This is followed by a reference to the column frame pointers: +

    +

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

    +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: +

    +

    +  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
    +
    +

    +After this follows the width information for each column: +

    +

    +widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
    +
    +

    +The table code knows ten different width's: +

     #define NUM_WIDTHS       10
     #define NUM_MAJOR_WIDTHS 3 // MIN, DES, FIX
     #define MIN_CON          0 // minimum width required of the content + padding
    @@ -184,51 +153,88 @@ Messages generated by the reflow switch:
     #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 s or cols attribute
    +#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
     
    -A typical part from a table dump when activated by setting in BasicTableLayoutStrategy.cpp - #if 0 -
    -BalanceColumnWidths ex
    -***START TABLE DUMP***
    -mColWidths=6444 330 330 330 330 330 330 396
    +

    +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 +

    +AssignNonPctColWidths ex
    +***START TABLE DUMP*** 
    +mColWidths=360 360 360 360 
     
    - col frame cache ->
    -0=00BF0150 1=00BF01B4 2=00BF0218 3=00BF027C 4=00BF02E0 5=00BF0344 6=00BF03A8 7=0
    -0BF040C
    + col frame cache ->
    +0=00B93138 1=00B931F0 2=024DD728 3=024DD780 
      **START COL DUMP** colIndex=0 isAnonymous=0 constraint=0
    -  widths=405 405 -1 -1 -1 -1 1794 -1 -1 6444  **END COL DUMP**
    +  widths=360 540 1230 -1 -1 -1 -1 -1 -1 360  **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**
    +  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=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***
    +  widths=360 540 -1 -1 -1 -1 -1 -1 -1 360  **END COL DUMP**
    +***END TABLE DUMP***
     
    - -The column dump is implemented in nsTableColFrame.cpp in the routine: -void nsTableColFrame::Dump(PRInt32 aIndent). - --- - +

    +The first column has already the minimum content width, the table column can't shrink below that, the desired content width of 540 twips, thats 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. +

    +

    - - - -
    MIN_CONDES_CONFIXMIN_ADJDES_ADJFIX_ADJPCT PCT_ADJ MIN_PROFINAL
    405405-1-1-1-11794-1-16444
    + +360 540 1230 -1 -1 -1 -1 -1 -1 360 +

    +There was no change till the entrance of BalanceColumnWidths + +

    +

    +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***
    +
    +

    +But at the end the final distribution between the columns has been reached. +

    +

    +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***
    +
    +

    +The column dump is implemented in nsTableColFrame.cpp in the routine: +void nsTableColFrame::Dump(PRInt32 aIndent). + +

    DEBUG_TABLE_REFLOW_TIMING

    +

    needs to be written + +


    +

    author: Bernd Mielke
    2002-06-05

    diff --git a/mozilla/layout/doc/frame_reflow_debug.html b/mozilla/layout/doc/frame_reflow_debug.html new file mode 100644 index 00000000000..4440215f46b --- /dev/null +++ b/mozilla/layout/doc/frame_reflow_debug.html @@ -0,0 +1,194 @@ + + + + + + Debugging Frame Reflow + + +

    Debugging Frame Reflow HowTo

    +

    General Overview

    +

    The frame reflow can be logged with the debug capabilties implemented in nsFrame.cpp. +It provides the following information for each frame at the +start of its reflow +

    +

    When the frame's reflow is finished the following information is displayed :

    + + +

    Getting the log

    + +

    Log File analyis

    +

    The logfile for a simple table like

    +
    +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    +<html>
    +<head>
    +  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    +</head>
    +<body>
    +<table width="100">
    +  <tbody>
    +    <tr>
    +      <td>foo</td>
    +    </tr>
    +  </tbody>
    +</table>
    +</body>
    +</html>
    +
    + +

    will create the following log:

    +
    +
    +VP 00B97C30 r=0 a=9180,4470 c=9180,4470 cnt=856 
    + scroll 00B97EE0 r=0 a=9180,4470 c=9180,4470 cnt=857 
    + scroll 00B97EE0 r=0 a=9180,4470 c=9180,4470 cnt=858 
    +  canvas 00B97C6C r=0 a=9180,UC c=9180,4470 cnt=859 
    +   area 02D7AFE4 r=0 a=9180,UC c=9180,UC cnt=860 
    +    text 02D7B150 r=0 a=9180,UC c=UC,UC cnt=861 
    +    text 02D7B150 d=0,0 
    +    block 02D7B210 r=0 a=9180,UC c=8940,UC cnt=862 
    +    block 02D7B210 d=8940,0 
    +   area 02D7AFE4 d=9180,120 
    +  canvas 00B97C6C d=9180,4470 
    + scroll 00B97EE0 d=9180,4470 
    + scroll 00B97EE0 d=9180,4470 
    +VP 00B97C30 d=9180,4470 
    +VP 00B97C30 r=1 a=9180,4470 c=9180,4470 cnt=863 
    + scroll 00B97EE0 r=1 a=9180,4470 c=9180,4470 cnt=864 
    + scroll 00B97EE0 r=1 a=9180,4470 c=9180,4470 cnt=865 
    +  canvas 00B97C6C r=1 a=9180,UC c=9180,4470 cnt=866 
    +   area 02D7AFE4 r=1 a=9180,UC c=9180,UC cnt=867 
    +    block 02D7B210 r=1 a=9180,UC c=8940,UC cnt=868 
    +     text 02D7B3F8 r=0 a=8940,UC c=UC,UC cnt=869 
    +     text 02D7B3F8 d=0,0 
    +     tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 
    +      tbl 02D7B7EC r=0 a=8940,UC c=1500,UC cnt=871 
    +       rowG 00B984A4 r=0 a=UC,UC c=UC,UC cnt=872 
    +        row 02D7BAF8 r=0 a=UC,UC c=UC,UC cnt=873 
    +         cell 02D7BC98 r=0 a=UC,UC c=UC,UC cnt=874 
    +          block 02D7BCF8 r=0 a=UC,UC c=UC,UC cnt=875 
    +           text 02D7BE84 r=0 a=UC,UC c=UC,UC cnt=876 
    +           text 02D7BE84 d=300,285 me=300 
    +          block 02D7BCF8 d=300,300 me=300 
    +         cell 02D7BC98 d=330,330 me=330 
    +        row 02D7BAF8 d=UC,330 
    +       rowG 00B984A4 d=UC,330 
    +       colG 02D7BFB0 r=0 a=UC,UC c=UC,UC cnt=877 
    +        col 02D7C0D8 r=0 a=0,0 c=1500,UC cnt=878 
    +        col 02D7C0D8 d=0,0 
    +       colG 02D7BFB0 d=0,0 
    +       rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879 
    +        row 02D7BAF8 r=2 a=1500,UC c=1500,UC cnt=880 
    +         cell 02D7BC98 r=2 a=1440,UC c=1410,UC cnt=881 
    +          block 02D7BCF8 r=2 a=1410,UC c=1410,UC cnt=882 
    +          block 02D7BCF8 d=1410,300 
    +         cell 02D7BC98 d=1440,330 
    +        row 02D7BAF8 d=1500,330 
    +       rowG 00B984A4 d=1500,330 
    +       colG 02D7BFB0 r=2 a=1500,UC c=1500,UC cnt=883 
    +        col 02D7C0D8 r=0 a=0,0 c=1500,UC cnt=884 
    +        col 02D7C0D8 d=0,0 
    +       colG 02D7BFB0 d=0,0 
    +      tbl 02D7B7EC d=1500,390 
    +     tblO 02D7B5F0 d=1500,390 
    +     text 02D7C130 r=0 a=8940,UC c=UC,UC cnt=885 
    +     text 02D7C130 d=0,0 
    +    block 02D7B210 d=8940,390 
    +   area 02D7AFE4 d=9180,630 
    +  canvas 00B97C6C d=9180,4470 
    + scroll 00B97EE0 d=9180,4470 
    + scroll 00B97EE0 d=9180,4470 
    +VP 00B97C30 d=9180,4470 
    +
    +
    +

    +The first line shows the reflow of the viewport (VP). This viewport has the address 00B97C30. It is the initial reflow: r=0. Other reflow reasons are:

    + + + + + +
    1incremental reflow
    2resize reflow
    3style change reflow
    4dirty reflow.
    + +

    The available width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). +

    +Below this is a line that reads:

    tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870

    Here the UC shows that on initial reflow the available height for the outer table frame is unconstrained. +

    +The table cell requires its children to compute the MES. It is reported back from the block as: +

    block 02D7BCF8 d=300,300 me=300

    +

    The block max. element size is 300 twips. +

    The second table reflow is started at +

    rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879

    +

    where the previous information is used. +The block has been required to compute the max. element size only once and it reports now: +

    block 02D7BCF8 d=1410,300

    +

    The block shows the same address as the previous one. +The reflow finishes at the same level where it started. + +

    Advanced reflow debugging

    +

    The previously described technique dumps the data for every frame. Sometimes the log is clearer if only the main frames are shown. +The entries in the reflow log can be controlled on a frame level. For instance adding text 0 to the rules in reflow_rules.txt would hide the text entries from the reflow. The display of the following frames can be turned on by adding a line with the frame name and 1 or turned off by adding a line with the frame name and 0:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    short namelayout tag
    areaarea
    blockblock
    brbr
    bulletbullet
    buttongfxButtonControl
    hrhr
    frameIhtmlFrameInner
    frameOhtmlFrameOuter
    imgimage
    inlineinline
    letterletter
    lineline
    selectselect
    objobject
    pagepage
    placeplaceholder
    posInlinepositionedInline
    canvascanvas
    rootroot
    scrollscroll
    captiontableCaption
    celltableCell
    bcCellbcTableCell
    coltableCol
    colGtableColGroup
    tbltable
    tblOtableOuter
    rowGtableRowGroup
    rowtableRow
    textCtltextInput
    texttext
    VPviewport
    +

    Once the problem is reduced to a single frame level, placing a breakpoint at DisplayReflowEnterPrint in nsFrame.cpp is a very efficient way to step through + the reflow tree. + + + diff --git a/mozilla/layout/doc/index.html b/mozilla/layout/doc/index.html index 3df95ebe5fc..32b8cb3a5e6 100644 --- a/mozilla/layout/doc/index.html +++ b/mozilla/layout/doc/index.html @@ -96,7 +96,7 @@ contributors find information on small topics and issues, including simple

    How To / Tech Notes

    -

    How to Debug Reflow (bernd) +

    How to Debug Reflow (bernd)

    Waterson's Block and Line Cheat Sheet

    How to add Style Properties

    Measuring Layout Performance @@ -114,6 +114,8 @@ contributors find information on small topics and issues, including simple

  • 05/06/2002 - Marc Attinasi: created
  • 05/13/2002 - Marc Attinasi: added Block and Line Cheat Sheet, and link to existing Reflow document
  • 05/21/2002 - Marc Attinasi: added Bernd's Table Reflow Debugging How-To (thanks Bernd!)
  • +
  • 05/21/2002 - Bernd Mielke: added Frame Reflow Debugging How-To
  • +