mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibWeb: Optimize pseudo elements presence check in hover style update
Instead of using `has_pseudo_elements()` that iterates over all pseudo elements, only check if `::before` or `::after` are present. Before this change, `has_pseudo_elements()` was 10% of profiles on Discord while now it's 1-2%.
This commit is contained in:
parent
8ed7dee0f0
commit
e1119023e9
Notes:
github-actions[bot]
2025-02-19 18:57:53 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: e1119023e9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3633
Reviewed-by: https://github.com/awesomekling ✅
2 changed files with 13 additions and 1 deletions
|
@ -1753,9 +1753,11 @@ void Document::invalidate_style_for_elements_affected_by_hover_change(Node& old_
|
|||
bool selector_matched = false;
|
||||
if (SelectorEngine::matches(selector, element, {}, context, {}))
|
||||
selector_matched = true;
|
||||
if (element.has_pseudo_elements()) {
|
||||
if (element.has_pseudo_element(CSS::Selector::PseudoElement::Type::Before)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::Selector::PseudoElement::Type::Before))
|
||||
selector_matched = true;
|
||||
}
|
||||
if (element.has_pseudo_element(CSS::Selector::PseudoElement::Type::After)) {
|
||||
if (SelectorEngine::matches(selector, element, {}, context, CSS::Selector::PseudoElement::Type::After))
|
||||
selector_matched = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue