LibWeb: Invalidate whole document style on attr change if :has() present

This sucks, and we're gonna have to do better, but for now let's
invalidate the whole document's style, so that we get correct behavior
if there are :has() selectors present.
This commit is contained in:
Andreas Kling 2024-10-27 12:14:12 +01:00 committed by Andreas Kling
parent 690d9c8752
commit f24b91b01e
Notes: github-actions[bot] 2024-10-27 12:34:57 +00:00

View file

@ -1930,8 +1930,10 @@ void Element::invalidate_style_after_attribute_change(FlyString const& attribute
// FIXME: Only invalidate if the attribute can actually affect style.
(void)attribute_name;
// FIXME: This will need to become smarter when we implement the :has() selector.
invalidate_style(StyleInvalidationReason::ElementAttributeChange);
if (document().style_computer().has_has_selectors())
document().invalidate_style(StyleInvalidationReason::ElementAttributeChange);
else
invalidate_style(StyleInvalidationReason::ElementAttributeChange);
}
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion