From 5113128bc9a7f904d43ba5b74f2e9ad02c597a73 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 25 Feb 2022 16:58:56 +0000 Subject: [PATCH] LibWeb: Paint InlineNode overlay in correct phase, skip pseudo-elements We were painting this in the Foreground phase by mistake. Also, the `inspected_node() == dom_node()` check returns true for pseudo-elements (both values are nullptr) so I've added an extra check there. As noted, once pseudo-elements are inspectable we will need to revisit this. --- Userland/Libraries/LibWeb/Layout/InlineNode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp index 2422d4b356..68048e7cb8 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp @@ -112,7 +112,9 @@ void InlineNode::paint(PaintContext& context, PaintPhase phase) }); } - if (phase == PaintPhase::Foreground && document().inspected_node() == dom_node()) { + // 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 && dom_node() && document().inspected_node() == dom_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.