LibWeb: Bucket CSS rules by pseudo-element

Instead of throwing all pseudo-element rules in one bucket, let's have
one bucket per pseudo-element.

This means we only run ::before rules for ::before pseudo-elements,
only ::after rules for ::after, etc.

Average style update time on https://tailwindcss.com/ 250ms -> 215ms.
This commit is contained in:
Andreas Kling 2024-09-10 15:18:29 +02:00 committed by Andreas Kling
commit 87056ee0d2
Notes: github-actions[bot] 2024-09-10 14:55:39 +00:00
2 changed files with 9 additions and 3 deletions

View file

@ -215,7 +215,7 @@ private:
HashMap<FlyString, Vector<MatchingRule>> rules_by_class;
HashMap<FlyString, Vector<MatchingRule>> rules_by_tag_name;
HashMap<FlyString, Vector<MatchingRule>, AK::ASCIICaseInsensitiveFlyStringTraits> rules_by_attribute_name;
Vector<MatchingRule> pseudo_element_rules;
Array<Vector<MatchingRule>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount)> rules_by_pseudo_element;
Vector<MatchingRule> root_rules;
Vector<MatchingRule> other_rules;