mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:18:12 +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:
parent
5e3e9b2f61
commit
ee7282cbe4
6 changed files with 28 additions and 15 deletions
|
@ -169,7 +169,7 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
|
|||
if (phase == PaintPhase::Overlay && should_clip_rect)
|
||||
context.painter().restore();
|
||||
|
||||
if (phase == PaintPhase::Overlay && layout_box().dom_node() && layout_box().document().inspected_node() == layout_box().dom_node()) {
|
||||
if (phase == PaintPhase::Overlay && layout_box().document().inspected_layout_node() == &layout_box()) {
|
||||
auto content_rect = absolute_rect();
|
||||
|
||||
auto margin_box = box_model().margin_box();
|
||||
|
@ -511,7 +511,7 @@ static void paint_text_fragment(PaintContext& context, Layout::TextNode const& t
|
|||
auto fragment_absolute_rect = fragment.absolute_rect();
|
||||
auto fragment_absolute_device_rect = context.enclosing_device_rect(fragment_absolute_rect);
|
||||
|
||||
if (text_node.document().inspected_node() == &text_node.dom_node())
|
||||
if (text_node.document().inspected_layout_node() == &text_node)
|
||||
context.painter().draw_rect(fragment_absolute_device_rect.to_type<int>(), Color::Magenta);
|
||||
|
||||
auto text = text_node.text_for_rendering();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue