mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:07:46 +00:00
LibWeb: Include class names in layout tree dumps
This makes it a lot easier to see which layout node is which DOM node.
This commit is contained in:
parent
6f1b5fc0ab
commit
ff2c949d70
2 changed files with 9 additions and 3 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue