mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +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:
committed by
Alexander Kalenik
parent
ea80167723
commit
1843a54df7
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user