mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	LibHTML: Paint a magenta rectangle around the currently inspected node
Document now tracks one "inspected" node, set by set_inspected_node() which is called by Browser's DOM inspector view on_selection callback.
This commit is contained in:
		
							parent
							
								
									7fcb21c935
								
							
						
					
					
						commit
						70a4678d77
					
				
					 5 changed files with 30 additions and 0 deletions
				
			
		|  | @ -244,6 +244,20 @@ LayoutDocument* Document::layout_node() | |||
|     return static_cast<LayoutDocument*>(Node::layout_node()); | ||||
| } | ||||
| 
 | ||||
| void Document::set_inspected_node(Node* node) | ||||
| { | ||||
|     if (m_inspected_node == node) | ||||
|         return; | ||||
| 
 | ||||
|     if (m_inspected_node && m_inspected_node->layout_node()) | ||||
|         m_inspected_node->layout_node()->set_needs_display(); | ||||
| 
 | ||||
|     m_inspected_node = node; | ||||
| 
 | ||||
|     if (m_inspected_node && m_inspected_node->layout_node()) | ||||
|         m_inspected_node->layout_node()->set_needs_display(); | ||||
| } | ||||
| 
 | ||||
| void Document::set_hovered_node(Node* node) | ||||
| { | ||||
|     if (m_hovered_node == node) | ||||
|  |  | |||
|  | @ -44,6 +44,10 @@ public: | |||
|     Node* hovered_node() { return m_hovered_node; } | ||||
|     const Node* hovered_node() const { return m_hovered_node; } | ||||
| 
 | ||||
|     void set_inspected_node(Node*); | ||||
|     Node* inspected_node() { return m_inspected_node; } | ||||
|     const Node* inspected_node() const { return m_inspected_node; } | ||||
| 
 | ||||
|     const HTMLHtmlElement* document_element() const; | ||||
|     const HTMLHeadElement* head() const; | ||||
|     const HTMLBodyElement* body() const; | ||||
|  | @ -91,6 +95,7 @@ private: | |||
|     OwnPtr<StyleResolver> m_style_resolver; | ||||
|     NonnullRefPtrVector<StyleSheet> m_sheets; | ||||
|     RefPtr<Node> m_hovered_node; | ||||
|     RefPtr<Node> m_inspected_node; | ||||
|     WeakPtr<Frame> m_frame; | ||||
|     URL m_url; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling