Bug 1651202 Part 3 - Rewrite container frame's frame tree output. r=heycam

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 is 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<
>
```

Differential Revision: https://phabricator.services.mozilla.com/D82604
This commit is contained in:
Ting-Yu Lin 2020-07-08 05:39:57 +00:00
Родитель 4ecda7f556
Коммит 8dd11ff135
1 изменённых файлов: 15 добавлений и 29 удалений

Просмотреть файл

@ -3243,38 +3243,22 @@ void nsContainerFrame::List(FILE* out, const char* aPrefix,
ListGeneric(str, aPrefix, aFlags);
ExtraContainerFrameInfo(str);
// Output the children
bool outputOneList = false;
for (const auto& [list, listID] : ChildLists()) {
if (outputOneList) {
str += aPrefix;
}
if (listID != kPrincipalList) {
if (!outputOneList) {
str += "\n";
str += aPrefix;
}
str += nsPrintfCString("%s %p ", mozilla::layout::ChildListName(listID),
&GetChildList(listID));
}
fprintf_stderr(out, "%s<\n", str.get());
str = "";
for (nsIFrame* kid : list) {
// Verify the child frame's parent frame pointer is correct
NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");
// Output the frame name and various fields.
fprintf_stderr(out, "%s <\n", str.get());
// Have the child frame list
nsCString pfx(aPrefix);
pfx += " ";
const nsCString pfx = nsCString(aPrefix) + " "_ns;
// Output principal child list separately since we want to omit its
// name and address.
for (nsIFrame* kid : PrincipalChildList()) {
kid->List(out, pfx.get(), aFlags);
}
fprintf_stderr(out, "%s>\n", aPrefix);
outputOneList = true;
}
if (!outputOneList) {
fprintf_stderr(out, "%s<>\n", str.get());
}
// Output rest of the child lists.
const ChildListIDs skippedListIDs = {kPrincipalList};
ListChildLists(out, pfx.get(), aFlags, skippedListIDs);
fprintf_stderr(out, "%s>\n", aPrefix);
}
void nsContainerFrame::ListWithMatchedRules(FILE* out,
@ -3314,6 +3298,8 @@ void nsContainerFrame::ListChildLists(FILE* aOut, const char* aPrefix,
fprintf_stderr(aOut, "%s", str.get());
for (nsIFrame* kid : list) {
// Verify the child frame's parent frame pointer is correct.
NS_ASSERTION(kid->GetParent() == this, "Bad parent frame pointer!");
kid->List(aOut, nestedPfx.get(), aFlags);
}
fprintf_stderr(aOut, "%s>\n", aPrefix);