| Index: third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
|
| index ac2930618bc1d1910990bc6705fbb430d7650ae1..f95d51d176ef7445381c363cce38b3fa787a9741 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
|
| @@ -7,10 +7,41 @@
|
| #include "core/layout/ng/ng_constraint_space.h"
|
| #include "core/layout/ng/ng_exclusion.h"
|
| #include "wtf/NonCopyingSort.h"
|
| +#include "wtf/text/StringBuilder.h"
|
|
|
| namespace blink {
|
| namespace {
|
|
|
| +void AppendNodeToString(const NGLayoutOpportunityTreeNode* node,
|
| + StringBuilder* string_builder,
|
| + unsigned indent = 0) {
|
| + DCHECK(string_builder);
|
| + if (!node) {
|
| + string_builder->append("'null'\n");
|
| + return;
|
| + }
|
| +
|
| + string_builder->append(node->ToString());
|
| + string_builder->append("\n");
|
| +
|
| + StringBuilder indent_builder;
|
| + for (unsigned i = 0; i < indent; i++)
|
| + indent_builder.append("\t");
|
| +
|
| + if (!node->exclusion)
|
| + return;
|
| +
|
| + string_builder->append(indent_builder.toString());
|
| + string_builder->append("Left:\t");
|
| + AppendNodeToString(node->left, string_builder, indent + 2);
|
| + string_builder->append(indent_builder.toString());
|
| + string_builder->append("Right:\t");
|
| + AppendNodeToString(node->right, string_builder, indent + 2);
|
| + string_builder->append(indent_builder.toString());
|
| + string_builder->append("Bottom:\t");
|
| + AppendNodeToString(node->bottom, string_builder, indent + 2);
|
| +}
|
| +
|
| // Collects all opportunities from leaves of Layout Opportunity spatial tree.
|
| void CollectAllOpportunities(const NGLayoutOpportunityTreeNode* node,
|
| NGLayoutOpportunities& opportunities) {
|
| @@ -276,4 +307,13 @@ const NGLayoutOpportunity NGLayoutOpportunityIterator::Next() {
|
| return NGLayoutOpportunity(*opportunity);
|
| }
|
|
|
| +#ifndef NDEBUG
|
| +void NGLayoutOpportunityIterator::ShowLayoutOpportunityTree() const {
|
| + StringBuilder string_builder;
|
| + string_builder.append("\n.:: LayoutOpportunity Tree ::.\n\nRoot Node: ");
|
| + AppendNodeToString(opportunity_tree_root_.get(), &string_builder);
|
| + fprintf(stderr, "%s\n", string_builder.toString().utf8().data());
|
| +}
|
| +#endif
|
| +
|
| } // namespace blink
|
|
|