LibWeb+LibWebView+WebContent: Inform the UI about DOM mutations

This will allow our DevTools server to inform the Firefox DevTools
client about DOM mutations.
This commit is contained in:
Timothy Flynn 2025-03-06 17:32:43 -05:00 committed by Andreas Kling
commit 2c4b420acc
Notes: github-actions[bot] 2025-03-08 00:27:41 +00:00
17 changed files with 253 additions and 12 deletions

View file

@ -222,6 +222,9 @@ public:
FindInPageResult find_in_page_previous_match();
Optional<FindInPageQuery> last_find_in_page_query() const { return m_last_find_in_page_query; }
bool listen_for_dom_mutations() const { return m_listen_for_dom_mutations; }
void set_listen_for_dom_mutations(bool listen_for_dom_mutations) { m_listen_for_dom_mutations = listen_for_dom_mutations; }
private:
explicit Page(GC::Ref<PageClient>);
virtual void visit_edges(Visitor&) override;
@ -287,9 +290,12 @@ private:
// Spec Note: This value also impacts the navigation processing model.
// FIXME: Actually support pdf viewing
bool m_pdf_viewer_supported { false };
size_t m_find_in_page_match_index { 0 };
Optional<FindInPageQuery> m_last_find_in_page_query;
URL::URL m_last_find_in_page_url;
bool m_listen_for_dom_mutations { false };
};
struct PaintOptions {
@ -397,6 +403,8 @@ public:
virtual IPC::File request_worker_agent() { return IPC::File {}; }
virtual void page_did_mutate_dom([[maybe_unused]] FlyString const& type, [[maybe_unused]] DOM::Node const& target, [[maybe_unused]] DOM::NodeList& added_nodes, [[maybe_unused]] DOM::NodeList& removed_nodes, [[maybe_unused]] GC::Ptr<DOM::Node> previous_sibling, [[maybe_unused]] GC::Ptr<DOM::Node> next_sibling, [[maybe_unused]] Optional<String> const& attribute_name) { }
virtual void inspector_did_load() { }
virtual void inspector_did_select_dom_node([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] Optional<CSS::Selector::PseudoElement::Type> const& pseudo_element) { }
virtual void inspector_did_set_dom_node_text([[maybe_unused]] UniqueNodeID node_id, [[maybe_unused]] String const& text) { }