Commit 96d8c59a authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Add ToString() for FlexLayout data.

Convenience method for debugging and testing, similar to most other
geometry and small data structs in Chrome.

Change-Id: Ic5ad787f8b361c5b5a25b71dce2db6dbae4b8731
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116555Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753348}
parent e06e714c
......@@ -35,6 +35,16 @@ struct FlexChildData {
explicit FlexChildData(const FlexSpecification& flex) : flex(flex) {}
FlexChildData(FlexChildData&& other) = default;
std::string ToString() const {
std::ostringstream oss;
oss << "{ preferred " << preferred_size.ToString() << " current "
<< current_size.ToString() << " margins " << margins.ToString()
<< (using_default_margins ? " (using default)" : "") << " padding "
<< internal_padding.ToString() << " bounds " << actual_bounds.ToString()
<< " }";
return oss.str();
}
NormalizedSize preferred_size;
NormalizedSize current_size;
NormalizedInsets margins;
......@@ -256,6 +266,22 @@ struct FlexLayout::FlexLayoutData {
size_t num_children() const { return child_data.size(); }
std::string ToString() const {
std::ostringstream oss;
oss << "{ " << total_size.ToString() << " " << layout.ToString() << " {";
bool first = true;
for (const FlexChildData& flex_child : child_data) {
if (first)
first = false;
else
oss << ", ";
oss << flex_child.ToString();
}
oss << "} margin " << interior_margin.ToString() << " insets "
<< host_insets.ToString() << "}";
return oss.str();
}
ProposedLayout layout;
// Holds additional information about the child views of this layout.
......
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