From 3b81d9d91d8b01b83dcc931bf92d594e22ba58d6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 19 Jan 2025 20:28:03 +0100 Subject: [PATCH] LibWeb: Delete "names used in attribute selectors" from SelectorInsights These are no longer needed because it's possible to tell if attribute name is used in any selector by using invalidation sets. --- Libraries/LibWeb/CSS/StyleComputer.cpp | 12 ------------ Libraries/LibWeb/CSS/StyleComputer.h | 2 -- 2 files changed, 14 deletions(-) diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index 077faa79779..146b9a6b7f5 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -2578,9 +2578,6 @@ void StyleComputer::collect_selector_insights(Selector const& selector, Selector { for (auto const& compound_selector : selector.compound_selectors()) { for (auto const& simple_selector : compound_selector.simple_selectors) { - if (simple_selector.type == Selector::SimpleSelector::Type::Attribute) { - insights.all_names_used_in_attribute_selectors.set(simple_selector.attribute().qualified_name.name.lowercase_name); - } if (simple_selector.type == Selector::SimpleSelector::Type::PseudoClass) { if (simple_selector.pseudo_class().type == PseudoClass::Has) { insights.has_has_selectors = true; @@ -3105,13 +3102,4 @@ bool StyleComputer::has_defined_selectors() const return m_selector_insights->has_defined_selectors; } -bool StyleComputer::has_attribute_selector(FlyString const& attribute_name) const -{ - if (!document().is_active()) - return false; - - build_rule_cache_if_needed(); - return m_selector_insights->all_names_used_in_attribute_selectors.contains(attribute_name); -} - } diff --git a/Libraries/LibWeb/CSS/StyleComputer.h b/Libraries/LibWeb/CSS/StyleComputer.h index 54492fdbf99..e3c1bd383c7 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Libraries/LibWeb/CSS/StyleComputer.h @@ -178,7 +178,6 @@ public: [[nodiscard]] bool has_has_selectors() const; [[nodiscard]] bool has_defined_selectors() const; - [[nodiscard]] bool has_attribute_selector(FlyString const& attribute_name) const; size_t number_of_css_font_faces_with_loading_in_progress() const; @@ -259,7 +258,6 @@ private: struct SelectorInsights { bool has_has_selectors { false }; bool has_defined_selectors { false }; - HashTable all_names_used_in_attribute_selectors; }; struct RuleCache {