1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

Browser: Reset the DOM Inspector's state when re-opening it

This resets the DOM Inspector to a default state when re-opening it,
instead of it displaying the previous selection and properties, which
may be outdated. This is closer to how Chrome and Firefox behave.
Eventually, it probably makes sense to copy their behavior of selecting
the `<body>` element by default.
This commit is contained in:
Sam Atkins 2021-08-27 20:21:30 +01:00 committed by Andreas Kling
parent 97379ace25
commit 73c95bcd5f
3 changed files with 28 additions and 4 deletions

View file

@ -485,6 +485,9 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target)
Optional<i32> hovered_node = m_web_content_view->get_hovered_node_id();
VERIFY(hovered_node.has_value());
m_dom_inspector_widget->set_inspected_node(hovered_node.value());
} else {
VERIFY(inspector_target == InspectorTarget::Document);
m_dom_inspector_widget->select_default_node();
}
auto* window = m_dom_inspector_widget->window();