LibWeb/CSS: Invalidate style sheet owners on rule insertion/deletion

This commit is contained in:
Sam Atkins 2026-05-21 13:46:57 +01:00
parent c67172f368
commit 14a06add85
2 changed files with 6 additions and 4 deletions

View file

@ -52,12 +52,15 @@ WebIDL::ExceptionOr<u32> CSSGroupingRule::insert_rule(StringView rule, u32 index
// AD-HOC: The spec doesn't say where to set the parent rule, so we'll do it here.
m_rules->item(index)->set_parent_rule(this);
m_parent_style_sheet->invalidate_owners(DOM::StyleInvalidationReason::StyleSheetInsertRule);
return index;
}
WebIDL::ExceptionOr<void> CSSGroupingRule::delete_rule(u32 index)
{
return m_rules->remove_a_css_rule(index);
TRY(m_rules->remove_a_css_rule(index));
m_parent_style_sheet->invalidate_owners(DOM::StyleInvalidationReason::StyleSheetDeleteRule);
return {};
}
void CSSGroupingRule::for_each_effective_rule(TraversalOrder order, Function<void(Web::CSS::CSSRule const&)> const& callback) const

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 14 tests
13 Pass
1 Fail
14 Pass
Pass CSSStyleRule is a CSSGroupingRule
Pass Simple CSSOM manipulation of subrules
Pass Simple CSSOM manipulation of subrules 1
@ -17,4 +16,4 @@ Pass Simple CSSOM manipulation of subrules 8
Pass Simple CSSOM manipulation of subrules 9
Pass Simple CSSOM manipulation of subrules 10
Pass Mutating the selectorText of outer rule invalidates inner rules
Fail Manipulation of nested declarations through CSSOM
Pass Manipulation of nested declarations through CSSOM