mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +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
Notes:
sideshowbarker
2024-07-19 05:42:53 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ff2c949d700
2 changed files with 9 additions and 3 deletions
|
@ -61,6 +61,7 @@ public:
|
|||
}
|
||||
|
||||
bool has_class(const FlyString&) const;
|
||||
const Vector<FlyString>& class_names() const { return m_classes; }
|
||||
|
||||
virtual void apply_presentational_hints(StyleProperties&) const { }
|
||||
virtual void parse_attribute(const FlyString& name, const String& value);
|
||||
|
|
|
@ -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
Reference in a new issue