LibWebView: Inspect <frameset> elements the same as <body> elements

We track this node ID to navigate to a default element when opening the
Inspector. So for all intents and purposes, <frameset> and <body> should
be treated the same.
This commit is contained in:
Timothy Flynn 2024-11-03 21:07:49 -05:00 committed by Tim Ledbetter
commit 27a678322f
Notes: github-actions[bot] 2024-11-04 09:55:35 +00:00
2 changed files with 6 additions and 6 deletions

View file

@ -313,7 +313,7 @@ void InspectorClient::reset()
static constexpr auto script = "inspector.reset();"sv; static constexpr auto script = "inspector.reset();"sv;
m_inspector_web_view.run_javascript(script); m_inspector_web_view.run_javascript(script);
m_body_node_id.clear(); m_body_or_frameset_node_id.clear();
m_pending_selection.clear(); m_pending_selection.clear();
m_dom_tree_loaded = false; m_dom_tree_loaded = false;
@ -331,8 +331,8 @@ void InspectorClient::select_hovered_node()
void InspectorClient::select_default_node() void InspectorClient::select_default_node()
{ {
if (m_body_node_id.has_value()) if (m_body_or_frameset_node_id.has_value())
select_node(*m_body_node_id); select_node(*m_body_or_frameset_node_id);
} }
void InspectorClient::clear_selection() void InspectorClient::clear_selection()
@ -633,8 +633,8 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
return; return;
} }
if (name.equals_ignoring_ascii_case("BODY"sv)) if (name.equals_ignoring_ascii_case("BODY"sv) || name.equals_ignoring_ascii_case("FRAMESET"sv))
m_body_node_id = node_id; m_body_or_frameset_node_id = node_id;
auto tag = name.to_lowercase(); auto tag = name.to_lowercase();

View file

@ -72,7 +72,7 @@ private:
ViewImplementation& m_content_web_view; ViewImplementation& m_content_web_view;
ViewImplementation& m_inspector_web_view; ViewImplementation& m_inspector_web_view;
Optional<Web::UniqueNodeID> m_body_node_id; Optional<Web::UniqueNodeID> m_body_or_frameset_node_id;
Optional<Web::UniqueNodeID> m_pending_selection; Optional<Web::UniqueNodeID> m_pending_selection;
bool m_inspector_loaded { false }; bool m_inspector_loaded { false };