1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:25:07 +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:
Andreas Kling 2019-11-09 11:58:50 +01:00
parent 7fcb21c935
commit 70a4678d77
5 changed files with 30 additions and 0 deletions

View file

@ -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)