LibWeb: Filter :hover selectors early for elements that aren't hovered

Some websites (like vercel.com...) have a *lot* of :hover selectors that
we can simply skip for any element that isn't currently hovered.

(cherry picked from commit ef4f5ac8fb761f43839e9fbd753716a57544c795)
This commit is contained in:
Andreas Kling
2024-09-09 15:37:17 +02:00
committed by Nico Weber
parent 318d53e9b4
commit 417d2005a9
4 changed files with 33 additions and 1 deletions

View File

@@ -140,7 +140,7 @@ static inline bool matches_link_pseudo_class(DOM::Element const& element)
return element.has_attribute(HTML::AttributeNames::href);
}
static inline bool matches_hover_pseudo_class(DOM::Element const& element)
bool matches_hover_pseudo_class(DOM::Element const& element)
{
auto* hovered_node = element.document().hovered_node();
if (!hovered_node)