1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +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

@ -114,9 +114,7 @@ void InlinePaintable::paint(PaintContext& context, PaintPhase phase) const
});
}
// FIXME: We check for a non-null dom_node(), since pseudo-elements have a null one and were getting
// highlighted incorrectly. A better solution will be needed if we want to inspect them too.
if (phase == PaintPhase::Overlay && layout_node().dom_node() && layout_node().document().inspected_node() == layout_node().dom_node()) {
if (phase == PaintPhase::Overlay && layout_node().document().inspected_layout_node() == &layout_node()) {
// FIXME: This paints a double-thick border between adjacent fragments, where ideally there
// would be none. Once we implement non-rectangular outlines for the `outline` CSS
// property, we can use that here instead.