LibWeb/CSS: Clear child CSS rules' caches too

If a rule gets its caches cleared because it's moved in the OM, then its
child rules' caches are likely invalid and need clearing too.

Assuming that caches only point "upwards", this will correctly clear
them all. For the time being that will be true.
This commit is contained in:
Sam Atkins 2024-11-04 17:13:51 +00:00 committed by Andreas Kling
commit 0b23dddb4b
Notes: github-actions[bot] 2024-11-07 14:12:48 +00:00
4 changed files with 13 additions and 4 deletions

View file

@ -34,6 +34,13 @@ void CSSGroupingRule::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_rules);
}
void CSSGroupingRule::clear_caches()
{
Base::clear_caches();
for (auto& rule : *m_rules)
rule->clear_caches();
}
WebIDL::ExceptionOr<u32> CSSGroupingRule::insert_rule(StringView rule, u32 index)
{
TRY(m_rules->insert_a_css_rule(rule, index));