mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +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
|
@ -61,6 +61,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_class(const FlyString&) const;
|
bool has_class(const FlyString&) const;
|
||||||
|
const Vector<FlyString>& class_names() const { return m_classes; }
|
||||||
|
|
||||||
virtual void apply_presentational_hints(StyleProperties&) const { }
|
virtual void apply_presentational_hints(StyleProperties&) const { }
|
||||||
virtual void parse_attribute(const FlyString& name, const String& value);
|
virtual void parse_attribute(const FlyString& name, const String& value);
|
||||||
|
|
|
@ -93,13 +93,18 @@ void dump_tree(const LayoutNode& layout_node)
|
||||||
|
|
||||||
String identifier = "";
|
String identifier = "";
|
||||||
if (layout_node.node() && is<Element>(*layout_node.node())) {
|
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()) {
|
if (!id.is_empty()) {
|
||||||
StringBuilder builder;
|
|
||||||
builder.append('#');
|
builder.append('#');
|
||||||
builder.append(id);
|
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()) {
|
if (!layout_node.is_box()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue