1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +00:00

LibWeb: Make pseudo-elements inspectable

This makes it possible to set a pseudo-element as the inspected node
using Document::set_inspected_node(), Document then provides
inspected_layout_node() for the painting related functions.
This commit is contained in:
Simon Wanner 2023-06-02 22:50:11 +02:00 committed by Andreas Kling
parent 5e3e9b2f61
commit ee7282cbe4
6 changed files with 28 additions and 15 deletions

View file

@ -136,9 +136,11 @@ public:
Node* hovered_node() { return m_hovered_node.ptr(); }
Node const* hovered_node() const { return m_hovered_node.ptr(); }
void set_inspected_node(Node*);
void set_inspected_node(Node*, Optional<CSS::Selector::PseudoElement>);
Node* inspected_node() { return m_inspected_node.ptr(); }
Node const* inspected_node() const { return m_inspected_node.ptr(); }
Layout::Node* inspected_layout_node();
Layout::Node const* inspected_layout_node() const { return const_cast<Document*>(this)->inspected_layout_node(); }
Element* document_element();
Element const* document_element() const;
@ -494,6 +496,7 @@ private:
JS::GCPtr<CSS::StyleSheetList> m_style_sheets;
JS::GCPtr<Node> m_hovered_node;
JS::GCPtr<Node> m_inspected_node;
Optional<CSS::Selector::PseudoElement> m_inspected_pseudo_element;
JS::GCPtr<Node> m_active_favicon;
WeakPtr<HTML::BrowsingContext> m_browsing_context;
AK::URL m_url;