mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Use fast CSS selector matching in default matches() code path
Before this change, checking if fast selector matching could be used was only enabled in style recalculation and hover invalidation. With this change it's enabled for all callers of SelectorEngine::matches() by default. This way APIs like `Element.matches()` and `querySelector()` could take advantage of this optimization.
This commit is contained in:
parent
17c0d4469c
commit
0f17ad9ebc
Notes:
github-actions[bot]
2025-02-03 09:29:08 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 0f17ad9ebc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3431
Reviewed-by: https://github.com/gmta ✅
7 changed files with 59 additions and 66 deletions
|
@ -595,13 +595,8 @@ Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element c
|
|||
if (context.did_match_any_hover_rules)
|
||||
did_match_any_hover_rules = true;
|
||||
};
|
||||
if (rule_to_run.can_use_fast_matches) {
|
||||
if (!SelectorEngine::fast_matches(selector, element, shadow_host_to_use, context))
|
||||
continue;
|
||||
} else {
|
||||
if (!SelectorEngine::matches(selector, element, shadow_host_to_use, context, pseudo_element))
|
||||
continue;
|
||||
}
|
||||
if (!SelectorEngine::matches(selector, element, shadow_host_to_use, context, pseudo_element))
|
||||
continue;
|
||||
matching_rules.append(&rule_to_run);
|
||||
}
|
||||
|
||||
|
@ -2686,7 +2681,6 @@ void StyleComputer::make_rule_cache_for_cascade_origin(CascadeOrigin cascade_ori
|
|||
selector.specificity(),
|
||||
cascade_origin,
|
||||
false,
|
||||
SelectorEngine::can_use_fast_matches(selector),
|
||||
false,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue