Closed Bug 1651202 Opened 4 years ago Closed 4 years ago

Improve frame tree output for nsContainerFrame and nsBlockFrame

Categories

(Core :: Layout, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(5 files)

I notice this while debugging bug 1422908.

Given the following snippet,

<fieldset style="position: relative; display: flex">
  <div style="position: absolute">

the frame tree output looks like:

FieldSet(fieldset)(8)@7f0e4dc6e508 parent=7f0e4dc6db88 ... <
  FlexContainer(fieldset)(8)@7f0e4dc6e5c0 parent=7f0e4dc6e508 ... <
    Placeholder(div)(1)@7f0e4dc6e738 parent=7f0e4dc6e5c0 ...
  >
  AbsoluteList 7f0e4c5eb940 <
    Block(div)(1)@7f0e4dc6e670 parent=7f0e4dc6e5c0 ... <
    >
  >
>

The AbsoluteList indentation makes the tree look as if Block's parent is FieldSet, but by looking at the parent pointer, its parent is FlexContainer

I think the frame tree can be easier to understand by tweaking the indentation as follows. This might help diagnose bugs related to the correctness of frame tree structure like bug 1422908.

FieldSet(fieldset)(8)@7f0e4dc6e508 parent=7f0e4dc6db88 ... <
  FlexContainer(fieldset)(8)@7f0e4dc6e5c0 parent=7f0e4dc6e508 ... <
    Placeholder(div)(1)@7f0e4dc6e738 parent=7f0e4dc6e5c0 ...
    AbsoluteList 7f0e4c5eb940 <
      Block(div)(1)@7f0e4dc6e670 parent=7f0e4dc6e5c0 ... <
      >
    >
  >
>

ListChildLists lives in nsContainerFrame because I'm going to use it
to improve nsContainerFrame::List() in a later patch.

Make the following tweak so that they are consistent with others.

  • Add a space before the open angle bracket. This is at the end of
    Block(div)(1)@7f10e25de5d0 ... <

  • Tweak nsLineBox format.
    line 7f10e25de808: count=1 becomes line@7f10e25de808 count=1.

  • Tweak child list format.
    AbsoluteList 0x7f10e3c7e560 becomes AbsoluteList@7f10e3c7e560

Depends on D82602

This affects the output of flex, grid, fieldset, etc.

Given a snippet like the following.

<fieldset style="position: relative; display: flex">
  <div style="position: absolute">

Currently, the frame tree output looks as if the AbsoluteList is under
the FieldSet, but it's actually under the FlexContainer.

FieldSet(fieldset)(8)@7f4ae9e73508 ... <
  FlexContainer(fieldset)(8)@7f4ae9e735c0 ... <
    Placeholder(div)(1)@7f4ae9e73738
  >
  AbsoluteList 7f4ae9dcb8c0 <
    Block(div)(1)@7f4ae9e73670 ... <
    >
  >
>

After this patch, the frame tree looks like:

FieldSet(fieldset)(8)@7f4ae9e73508 ... <
  FlexContainer(fieldset)(8)@7f4ae9e735c0 ... <
    Placeholder(div)(1)@7f4ae9e73738
    AbsoluteList 7f4ae9dcb8c0 <
      Block(div)(1)@7f4ae9e73670 ... <
      >
    >
  >
>

Another minor difference is that for a empty container, the end angle
bracket now on its own line, which is consistent with an empty block
frame's output.

This old output

FlexContainer(div)(4)@7f4ae9e73390<>

becomes

FlexContainer(div)(4)@7f4ae9e73390<
>

Depends on D82603

This is equivalent to aFrame->DumpFrameTreeLimited(). It appears only in
nsIFrame.cpp, I doubt it's actually used by developers.

Depends on D82604

Per discussion on matrix, printing mState in hex format is
indecipherable. Remove it to reduce the rate of wrapping of a long line.

Depends on D82605

Attachment #9161994 - Attachment description: Bug 1651202 Part 4 - Remove DebugListFrameTree in nsFrame.cpp. → Bug 1651202 Part 4 - Remove DebugListFrameTree in nsIFrame.cpp.
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/9e09edf99e06 Part 1 - Extract nsBlockFrame's printing child lists logic to a helper methods. r=heycam https://hg.mozilla.org/integration/autoland/rev/370031d45dbe Part 2 - Minor format tweaks for block frame's frame tree output. r=heycam https://hg.mozilla.org/integration/autoland/rev/79de4b2b113b Part 3 - Rewrite container frame's frame tree output. r=heycam https://hg.mozilla.org/integration/autoland/rev/be12ad6f0206 Part 4 - Remove DebugListFrameTree in nsIFrame.cpp. r=heycam https://hg.mozilla.org/integration/autoland/rev/c102a48a9911 Part 5 - Remove mState field from frame tree output. r=heycam
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: