mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Invalidate pseudo-elements on hover even when not yet created
The hover invalidation code only tried matching ::before/::after selectors when has_pseudo_element() returned true, which requires an existing layout node. A pseudo-element that doesn't exist yet (because its content is only set by a hover rule) has no layout node, so the match was skipped and hovering never triggered a style recompute. Always try ::before/::after selectors during hover invalidation.
This commit is contained in:
committed by
Tim Flynn
parent
77b9fcf7f9
commit
16dffe39a0
Notes:
github-actions[bot]
2026-03-24 14:28:09 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/16dffe39a0c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8605 Reviewed-by: https://github.com/trflynn89 ✅
@@ -2076,14 +2076,10 @@ void Document::invalidate_style_for_elements_affected_by_pseudo_class_change(CSS
|
||||
SelectorEngine::MatchContext context;
|
||||
if (SelectorEngine::matches(selector, element, {}, context, {}))
|
||||
return true;
|
||||
if (element.has_pseudo_element(CSS::PseudoElement::Before)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::Before))
|
||||
return true;
|
||||
}
|
||||
if (element.has_pseudo_element(CSS::PseudoElement::After)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::After))
|
||||
return true;
|
||||
}
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::Before))
|
||||
return true;
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::PseudoElement::After))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user