Commit 1491a482 authored by Emil A Eklund's avatar Emil A Eklund Committed by Commit Bot

[LayoutNG] Expose more debug info for fragments

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I20d6e94f1e192b18814959be24fd8648cefb7fd9
Reviewed-on: https://chromium-review.googlesource.com/884883Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532091}
parent 2460e714
...@@ -41,10 +41,9 @@ bool AppendFragmentOffsetAndSize(const NGPhysicalFragment* fragment, ...@@ -41,10 +41,9 @@ bool AppendFragmentOffsetAndSize(const NGPhysicalFragment* fragment,
return has_content; return has_content;
} }
String StringForBoxType(NGPhysicalFragment::NGBoxType box_type, String StringForBoxType(const NGPhysicalFragment& fragment) {
bool is_old_layout_root) {
StringBuilder result; StringBuilder result;
switch (box_type) { switch (fragment.BoxType()) {
case NGPhysicalFragment::NGBoxType::kNormalBox: case NGPhysicalFragment::NGBoxType::kNormalBox:
break; break;
case NGPhysicalFragment::NGBoxType::kInlineBlock: case NGPhysicalFragment::NGBoxType::kInlineBlock:
...@@ -62,11 +61,23 @@ String StringForBoxType(NGPhysicalFragment::NGBoxType box_type, ...@@ -62,11 +61,23 @@ String StringForBoxType(NGPhysicalFragment::NGBoxType box_type,
default: default:
NOTREACHED(); NOTREACHED();
} }
if (is_old_layout_root) { if (fragment.IsOldLayoutRoot()) {
if (result.length()) if (result.length())
result.Append(" "); result.Append(" ");
result.Append("old-layout-root"); result.Append("old-layout-root");
} }
if (fragment.IsBlockFlow()) {
if (result.length())
result.Append(" ");
result.Append("block-flow");
}
if (fragment.IsBox() &&
static_cast<const NGPhysicalBoxFragment&>(fragment).ChildrenInline()) {
if (result.length())
result.Append(" ");
result.Append("children-inline");
}
return result.ToString(); return result.ToString();
} }
...@@ -83,8 +94,7 @@ void AppendFragmentToString(const NGPhysicalFragment* fragment, ...@@ -83,8 +94,7 @@ void AppendFragmentToString(const NGPhysicalFragment* fragment,
if (fragment->IsBox()) { if (fragment->IsBox()) {
if (flags & NGPhysicalFragment::DumpType) { if (flags & NGPhysicalFragment::DumpType) {
builder->Append("Box"); builder->Append("Box");
String box_type = String box_type = StringForBoxType(*fragment);
StringForBoxType(fragment->BoxType(), fragment->IsOldLayoutRoot());
if (!box_type.IsEmpty()) { if (!box_type.IsEmpty()) {
builder->Append(" ("); builder->Append(" (");
builder->Append(box_type); builder->Append(box_type);
...@@ -299,7 +309,7 @@ String NGPhysicalFragment::ToString() const { ...@@ -299,7 +309,7 @@ String NGPhysicalFragment::ToString() const {
"Type: '%d' Size: '%s' Offset: '%s' Placed: '%d', BoxType: '%s'", Type(), "Type: '%d' Size: '%s' Offset: '%s' Placed: '%d', BoxType: '%s'", Type(),
Size().ToString().Ascii().data(), Size().ToString().Ascii().data(),
is_placed_ ? Offset().ToString().Ascii().data() : "no offset", IsPlaced(), is_placed_ ? Offset().ToString().Ascii().data() : "no offset", IsPlaced(),
StringForBoxType(BoxType(), IsOldLayoutRoot()).Ascii().data()); StringForBoxType(*this).Ascii().data());
} }
String NGPhysicalFragment::DumpFragmentTree(DumpFlags flags, String NGPhysicalFragment::DumpFragmentTree(DumpFlags flags,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment