mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
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. :^)
This commit is contained in:
parent
73c95bcd5f
commit
724f45c784
3 changed files with 17 additions and 1 deletions
|
@ -117,6 +117,13 @@ void InspectorWidget::set_dom_json(String json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InspectorWidget::clear_dom_json()
|
||||||
|
{
|
||||||
|
m_dom_json.clear();
|
||||||
|
m_dom_tree_view->set_model(nullptr);
|
||||||
|
clear_style_json();
|
||||||
|
}
|
||||||
|
|
||||||
void InspectorWidget::set_dom_node_properties_json(i32 node_id, String specified_values_json, String computed_values_json)
|
void InspectorWidget::set_dom_node_properties_json(i32 node_id, String specified_values_json, String computed_values_json)
|
||||||
{
|
{
|
||||||
if (node_id != m_inspected_node_id) {
|
if (node_id != m_inspected_node_id) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
|
|
||||||
void set_web_view(NonnullRefPtr<Web::OutOfProcessWebView> web_view) { m_web_view = web_view; }
|
void set_web_view(NonnullRefPtr<Web::OutOfProcessWebView> web_view) { m_web_view = web_view; }
|
||||||
void set_dom_json(String);
|
void set_dom_json(String);
|
||||||
|
void clear_dom_json();
|
||||||
void set_dom_node_properties_json(i32 node_id, String specified_values_json, String computed_values_json);
|
void set_dom_node_properties_json(i32 node_id, String specified_values_json, String computed_values_json);
|
||||||
|
|
||||||
void set_inspected_node(i32 node_id);
|
void set_inspected_node(i32 node_id);
|
||||||
|
|
|
@ -175,6 +175,14 @@ Tab::Tab(BrowserWindow& window)
|
||||||
|
|
||||||
update_actions();
|
update_actions();
|
||||||
update_bookmark_button(url.to_string());
|
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) {
|
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 = window->set_main_widget<InspectorWidget>();
|
||||||
m_dom_inspector_widget->set_web_view(*m_web_content_view);
|
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) {
|
if (inspector_target == InspectorTarget::HoveredElement) {
|
||||||
Optional<i32> hovered_node = m_web_content_view->get_hovered_node_id();
|
Optional<i32> hovered_node = m_web_content_view->get_hovered_node_id();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue