LibWebView: Display layouting information in devtools

Specifically, you can now see whether an element is visible,
scrollable or creates a stacking context in the devtools.
This commit is contained in:
Psychpsyo 2024-11-19 18:19:04 +01:00 committed by Sam Atkins
parent 0320494c3f
commit d4d335ebda
Notes: github-actions[bot] 2024-12-04 19:51:07 +00:00
2 changed files with 57 additions and 26 deletions

View file

@ -1430,6 +1430,18 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
MUST(children.finish());
}
}
if (paintable_box()) {
if (paintable_box()->is_scrollable()) {
MUST(object.add("scrollable"sv, true));
}
if (!paintable_box()->is_visible()) {
MUST(object.add("invisible"sv, true));
}
if (paintable_box()->has_stacking_context()) {
MUST(object.add("stackingContext"sv, true));
}
}
} else if (is_text()) {
MUST(object.add("type"sv, "text"));