LibWeb: Remove MatchingRule::contains_root_pseudo_class member

This can be a local variable while building a rule cache, no need to
take up space in MatchingRule.
This commit is contained in:
Andreas Kling 2024-09-09 13:52:07 +02:00 committed by Andreas Kling
parent c8f22f65d9
commit 49d2b11085
Notes: github-actions[bot] 2024-09-09 18:13:17 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -2699,10 +2699,11 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
selector.specificity(),
cascade_origin,
false,
false,
SelectorEngine::can_use_fast_matches(selector),
};
bool contains_root_pseudo_class = false;
for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) {
if (!matching_rule.contains_pseudo_element) {
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::PseudoElement) {
@ -2710,10 +2711,10 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
++num_pseudo_element_rules;
}
}
if (!matching_rule.contains_root_pseudo_class) {
if (!contains_root_pseudo_class) {
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::PseudoClass
&& simple_selector.pseudo_class().type == CSS::PseudoClass::Root) {
matching_rule.contains_root_pseudo_class = true;
contains_root_pseudo_class = true;
++num_root_rules;
}
}
@ -2752,7 +2753,7 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
if (!added_to_bucket) {
if (matching_rule.contains_pseudo_element) {
rule_cache->pseudo_element_rules.append(move(matching_rule));
} else if (matching_rule.contains_root_pseudo_class) {
} else if (contains_root_pseudo_class) {
rule_cache->root_rules.append(move(matching_rule));
} else {
for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) {

View file

@ -91,7 +91,6 @@ struct MatchingRule {
u32 specificity { 0 };
CascadeOrigin cascade_origin;
bool contains_pseudo_element { false };
bool contains_root_pseudo_class { false };
bool can_use_fast_matches { false };
bool skip { false };
};