LibWeb: Invalidate stylesheet owners when disabled state changes

Toggling CSSStyleSheet::disabled previously cleared the cached media
match bits and reloaded fonts, but never informed the owning documents
or shadow roots that style resolution was now stale. Worse, the IDL
binding for the disabled attribute dispatches through a non-virtual
setter on StyleSheet, so any override on CSSStyleSheet was bypassed
entirely.

Make set_disabled() virtual so the CSSStyleSheet override actually runs,
snapshot the pre-mutation shadow-root stylesheet effects before flipping
the flag, and hand them to invalidate_owners() so a disable that strips
the last host-reaching rule still tears down host-side style correctly.
This commit is contained in:
Andreas Kling
2026-04-22 22:35:21 +02:00
committed by Andreas Kling
parent a0dc0c61f4
commit cfa75e6eb4
Notes: github-actions[bot] 2026-04-23 14:49:35 +00:00
6 changed files with 52 additions and 6 deletions

View File

@@ -2,8 +2,8 @@ Harness status: OK
Found 32 tests
27 Pass
5 Fail
29 Pass
3 Fail
Pass document.adoptedStyleSheets should initially have length 0.
Pass new CSSStyleSheet produces empty CSSStyleSheet
Pass title can be set in the CSSStyleSheet constructor
@@ -21,8 +21,8 @@ Pass Adding non-constructed stylesheet to AdoptedStyleSheets is not allowed when
Pass Adding non-constructed stylesheet to AdoptedStyleSheets is not allowed when the owner document of the stylesheet and the AdoptedStyleSheets are in different document trees
Pass CSSStyleSheet.replaceSync replaces stylesheet text synchronously
Pass CSSStyleSheet.replaceSync correctly updates the style of its adopters synchronously
Fail Adopted sheets are ordered after non-adopted sheets in the shadow root
Fail Adopted sheets are ordered after non-adopted sheets in the document
Pass Adopted sheets are ordered after non-adopted sheets in the shadow root
Pass Adopted sheets are ordered after non-adopted sheets in the document
Pass Inserting an @import rule through insertRule on a constructed stylesheet throws an exception
Fail CSSStyleSheet.replaceSync should not trigger any loads from @import rules
Pass CSSStyleSheet.replace allows, but ignores, import rule inside