LibWeb/CSS: Clear CSSRule's cached layer name when it is moved

Through the CSSOM, rules can be moved around, and so anything cached
(for now just the qualified layer name) needs to be recalculated when
that happens. This method is virtual so that other rules will be able
to clear their cached data too.
This commit is contained in:
Sam Atkins 2024-10-16 14:10:59 +01:00 committed by Andreas Kling
commit d935a00413
Notes: github-actions[bot] 2024-10-17 18:57:27 +00:00
2 changed files with 9 additions and 0 deletions

View file

@ -41,11 +41,18 @@ void CSSRule::set_css_text(StringView)
void CSSRule::set_parent_rule(CSSRule* parent_rule)
{
m_parent_rule = parent_rule;
clear_caches();
}
void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
{
m_parent_style_sheet = parent_style_sheet;
clear_caches();
}
void CSSRule::clear_caches()
{
m_cached_layer_name.clear();
}
FlyString const& CSSRule::parent_layer_internal_qualified_name_slow_case() const