LibWeb: Invalidate styles after constructable sheet updates

Constructed stylesheets updated their rule lists, but adopted documents
and shadow roots were not restyled when replace(), replaceSync(),
or disabled-state changes modified the sheet.  That left several CSSOM
tests passing stale computed styles.

Invalidate stylesheet owners after those updates so adopted sheets
recompute promptly. Also set replace()-produced rules' parent
stylesheet so non-import rules keep their stylesheet context.

The imported baseURL test assumes a tuple origin, so move it to the
HTTP fixture now that replaceSync() actually triggers a restyle.
This commit is contained in:
Andreas Kling
2026-04-05 11:20:00 +02:00
committed by Andreas Kling
parent 1bfcf49ffe
commit 0b5ef8fa22
Notes: github-actions[bot] 2026-04-05 10:35:33 +00:00
5 changed files with 25 additions and 6 deletions

View File

@@ -2,8 +2,8 @@ Harness status: OK
Found 32 tests
24 Pass
8 Fail
27 Pass
5 Fail
Pass document.adoptedStyleSheets should initially have length 0.
Pass new CSSStyleSheet produces empty CSSStyleSheet
Pass title can be set in the CSSStyleSheet constructor
@@ -11,7 +11,7 @@ Pass CSSStyleSheet.replace produces Promise<CSSStyleSheet>
Pass Constructed style sheets can be applied on document
Pass Constructed style sheets can be applied on shadow root
Pass Re-attaching shadow host with adopted stylesheets work
Fail Attaching a shadow root that already has adopted stylesheets work
Pass Attaching a shadow root that already has adopted stylesheets work
Pass Re-attaching shadow host and updating attributes work
Pass Changes to constructed stylesheets through CSSOM is reflected
Pass Constructed stylesheet can be used and modified in multiple TreeScopes
@@ -20,13 +20,13 @@ Pass Stylesheet constructed on iframe cannot be used in the main Document
Pass Adding non-constructed stylesheet to AdoptedStyleSheets is not allowed when the owner document of the stylesheet is in the same document tree as the AdoptedStyleSheets
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
Fail CSSStyleSheet.replaceSync correctly updates the style of its adopters 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 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
Fail CSSStyleSheet.replace ignores @import rule but still loads other rules
Pass CSSStyleSheet.replace ignores @import rule but still loads other rules
Pass CSSStyleSheet.replaceSync allows, but ignores, import rule inside
Pass CSSStyleSheet.replace does not reject on failed imports
Pass Cloning a shadow host will not clone shadow root, and also adoptedStyleSheets