summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSimon Wanner <skyrising@pvpctutorials.de>2022-03-20 19:11:03 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-20 19:57:09 +0100
commit69fc7009bfdaec1f52be7d2f072fb6742e45e64e (patch)
tree741f392fa4b9acbbdad3b4955f26034990396d33 /Userland
parenta128d4931d11a8e14c52011946be125452616f1f (diff)
downloadserenity-69fc7009bfdaec1f52be7d2f072fb6742e45e64e.zip
LibWeb: Grey out invisible nodes in the DOM inspector
This makes it easier to navigate large DOM trees where some nodes have display: none
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOMTreeModel.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 364c4ea69c..71220abf93 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -793,6 +793,8 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
MUST(object.add("data"sv, static_cast<DOM::Comment const&>(*this).data()));
}
+ MUST((object.add("visible"sv, !!layout_node())));
+
if (has_child_nodes()) {
auto children = MUST(object.add_array("children"));
for_each_child([&children](DOM::Node& child) {
diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp
index cd8a9302f5..dbfca80b34 100644
--- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp
+++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp
@@ -126,6 +126,8 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return m_tree_view.palette().syntax_comment();
if (type == "pseudo-element"sv)
return m_tree_view.palette().syntax_type();
+ if (!node.get("visible").to_bool(true))
+ return m_tree_view.palette().syntax_comment();
return {};
}