From 49d2b11085c8a59db2f1c54ad8e8f5938e6776c9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 9 Sep 2024 13:52:07 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 9 +++++---- Userland/Libraries/LibWeb/CSS/StyleComputer.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index a5d8acb4a14..970e90ad05d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -2699,10 +2699,11 @@ NonnullOwnPtr 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::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::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) { diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.h b/Userland/Libraries/LibWeb/CSS/StyleComputer.h index 9ad2e830357..fbe90dbeac9 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.h @@ -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 }; };