1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21: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

@ -21,6 +21,9 @@ void LayoutBox::render(RenderingContext& context)
context.painter().draw_rect(m_rect, Color::Red);
#endif
if (node() && document().inspected_node() == node())
context.painter().draw_rect(m_rect, Color::Magenta);
Rect padded_rect;
padded_rect.set_x(x() - box_model().padding().left.to_px());
padded_rect.set_width(width() + box_model().padding().left.to_px() + box_model().padding().right.to_px());