1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

LibWeb+LibWebView: Show shadow roots in the DOM inspector

This commit is contained in:
Simon Wanner 2023-03-18 00:19:25 +01:00 committed by Andreas Kling
parent 482fa2d4e2
commit a5a3913e39
2 changed files with 15 additions and 5 deletions

View file

@ -127,7 +127,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
if (role == GUI::ModelRole::ForegroundColor) {
// FIXME: Allow models to return a foreground color *role*.
// Then we won't need to have a GUI::TreeView& member anymore.
if (type == "comment"sv)
if (type == "comment"sv || type == "shadow-root"sv)
return m_tree_view->palette().syntax_comment();
if (type == "pseudo-element"sv)
return m_tree_view->palette().syntax_type();
@ -154,6 +154,8 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return with_whitespace_collapsed(node.get_deprecated_string("text"sv).value());
if (type == "comment"sv)
return DeprecatedString::formatted("<!--{}-->", node.get_deprecated_string("data"sv).value());
if (type == "shadow-root"sv)
return DeprecatedString::formatted("{} ({})", node_name, node.get_deprecated_string("mode"sv).value());
if (type != "element")
return node_name;