diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-12 13:23:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-12 13:23:07 +0200 |
commit | ff2c949d70033e6bc2deb9cb6c1c8baca4fbbe79 (patch) | |
tree | 86709bf91eebcfaf455f9d78a75b660462b8716e /Libraries/LibWeb/Dump.cpp | |
parent | 6f1b5fc0ab9816bb8e54ce57dd86c4bea1fe1dd4 (diff) | |
download | serenity-ff2c949d70033e6bc2deb9cb6c1c8baca4fbbe79.zip |
LibWeb: Include class names in layout tree dumps
This makes it a lot easier to see which layout node is which DOM node.
Diffstat (limited to 'Libraries/LibWeb/Dump.cpp')
-rw-r--r-- | Libraries/LibWeb/Dump.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Libraries/LibWeb/Dump.cpp b/Libraries/LibWeb/Dump.cpp index 42ce636a19..eba734220e 100644 --- a/Libraries/LibWeb/Dump.cpp +++ b/Libraries/LibWeb/Dump.cpp @@ -93,13 +93,18 @@ void dump_tree(const LayoutNode& layout_node) String identifier = ""; if (layout_node.node() && is<Element>(*layout_node.node())) { - auto id = to<Element>(*layout_node.node()).attribute(HTML::AttributeNames::id); + auto& element = to<Element>(*layout_node.node()); + StringBuilder builder; + auto id = element.attribute(HTML::AttributeNames::id); if (!id.is_empty()) { - StringBuilder builder; builder.append('#'); builder.append(id); - identifier = builder.to_string(); } + for (auto& class_name : element.class_names()) { + builder.append('.'); + builder.append(class_name); + } + identifier = builder.to_string(); } if (!layout_node.is_box()) { |