diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index 5142f171d8aa6c..43421608120d5c 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -61,13 +61,6 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index) return; m_selection = move(selection); - // Note: Non-visible nodes don't have style data and such, and will hit assertions if inspection is attempted. - if (!json->get("visible").to_bool(true)) { - clear_style_json(); - clear_node_box_model(); - return; - } - auto maybe_inspected_node_properties = m_web_view->inspect_dom_node(m_selection.dom_node_id, m_selection.pseudo_element); if (maybe_inspected_node_properties.has_value()) { auto inspected_node_properties = maybe_inspected_node_properties.value(); @@ -75,6 +68,7 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index) update_node_box_model(inspected_node_properties.node_box_sizing_json); } else { clear_style_json(); + clear_node_box_model(); } } diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index f2f483ce1f84c4..449645a3e84356 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -267,7 +267,8 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect }); Web::DOM::Node* node = Web::DOM::Node::from_id(node_id); - if (!node) { + // Note: Nodes without layout (aka non-visible nodes, don't have style computed) + if (!node || !node->layout_node()) { return { false, "", "", "", "" }; }