diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-09-01 12:50:47 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-02 22:16:41 +0200 |
commit | 724f45c7841e18962184a5b486b62b8f98358d5f (patch) | |
tree | 4beb8d3ff270c95e121fcf28fcb827d47bb86fc9 /Userland/Applications/Browser/Tab.cpp | |
parent | 73c95bcd5f4031a7049ec5af515208e14d2ee7b8 (diff) | |
download | serenity-724f45c7841e18962184a5b486b62b8f98358d5f.zip |
Browser: Reload the DOM Inspector's JSON data when loading a new page
Of course, there are other reasons the DOM might change, but one thing
at a time. :^)
Diffstat (limited to 'Userland/Applications/Browser/Tab.cpp')
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index cee913d7c4..570d7a82b6 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -175,6 +175,14 @@ Tab::Tab(BrowserWindow& window) update_actions(); update_bookmark_button(url.to_string()); + + if (m_dom_inspector_widget) + m_dom_inspector_widget->clear_dom_json(); + }; + + hooks().on_load_finish = [this](auto&) { + if (m_dom_inspector_widget) + m_web_content_view->inspect_dom_tree(); }; hooks().on_link_click = [this](auto& url, auto& target, unsigned modifiers) { @@ -478,8 +486,8 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target) }; m_dom_inspector_widget = window->set_main_widget<InspectorWidget>(); m_dom_inspector_widget->set_web_view(*m_web_content_view); + m_web_content_view->inspect_dom_tree(); } - m_web_content_view->inspect_dom_tree(); if (inspector_target == InspectorTarget::HoveredElement) { Optional<i32> hovered_node = m_web_content_view->get_hovered_node_id(); |