mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Skip quick selector rejection using ancestor filter if possible
If selector does not have any descendant combinators then we know for sure it won't be filtered out by ancestor filter, which means there is no need to check for it. This change makes hover style invalidation go faster on Discord where with this change we spend 4-5% in `should_reject_with_ancestor_filter()` instead of 20%.
This commit is contained in:
parent
ea80167723
commit
1843a54df7
Notes:
github-actions[bot]
2025-02-20 18:49:27 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 1843a54df7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3643
Reviewed-by: https://github.com/awesomekling
4 changed files with 6 additions and 2 deletions
|
@ -503,7 +503,8 @@ Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element c
|
|||
if (!rule_is_relevant_for_current_scope)
|
||||
return;
|
||||
|
||||
if (should_reject_with_ancestor_filter(rule_to_run.selector))
|
||||
auto const& selector = rule_to_run.selector;
|
||||
if (selector.can_use_ancestor_filter() && should_reject_with_ancestor_filter(selector))
|
||||
return;
|
||||
|
||||
rules_to_run.unchecked_append(rule_to_run);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue