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,
return has_content;
}
String StringForBoxType(NGPhysicalFragment::NGBoxType box_type,
bool is_old_layout_root) {
String StringForBoxType(const NGPhysicalFragment& fragment) {
StringBuilder result;
switch (box_type) {
switch (fragment.BoxType()) {
case NGPhysicalFragment::NGBoxType::kNormalBox:
break;
case NGPhysicalFragment::NGBoxType::kInlineBlock:
......@@ -62,11 +61,23 @@ String StringForBoxType(NGPhysicalFragment::NGBoxType box_type,
default:
NOTREACHED();
}
if (is_old_layout_root) {
if (fragment.IsOldLayoutRoot()) {
if (result.length())
result.Append(" ");
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();
}
......@@ -83,8 +94,7 @@ void AppendFragmentToString(const NGPhysicalFragment* fragment,
if (fragment->IsBox()) {
if (flags & NGPhysicalFragment::DumpType) {
builder->Append("Box");
String box_type =
StringForBoxType(fragment->BoxType(), fragment->IsOldLayoutRoot());
String box_type = StringForBoxType(*fragment);
if (!box_type.IsEmpty()) {
builder->Append(" (");
builder->Append(box_type);
......@@ -299,7 +309,7 @@ String NGPhysicalFragment::ToString() const {
"Type: '%d' Size: '%s' Offset: '%s' Placed: '%d', BoxType: '%s'", Type(),
Size().ToString().Ascii().data(),
is_placed_ ? Offset().ToString().Ascii().data() : "no offset", IsPlaced(),
StringForBoxType(BoxType(), IsOldLayoutRoot()).Ascii().data());
StringForBoxType(*this).Ascii().data());
}
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