Truly independent web browser
Tests/LibWeb: Read restyle reach from the style trace
Aliaksandr Kalenikf1465bd7d19e
diff --git a/Tests/LibWeb/Text/expected/canvas/canvas-font-reads-settled-style-without-rematching.txt b/Tests/LibWeb/Text/expected/canvas/canvas-font-reads-settled-style-without-rematching.txtindex 2bd055d8f05..c9b131449f0 100644--- a/Tests/LibWeb/Text/expected/canvas/canvas-font-reads-settled-style-without-rematching.txt+++ b/Tests/LibWeb/Text/expected/canvas/canvas-font-reads-settled-style-without-rematching.txt@@ -1,6 +1,5 @@fonts: 20px serif, 22px serif, 24px serif, 26px serif, 28px serif, 30px serif, 32px serif, 34px serif, 36px serif, 38px serif-passes == 0: true-styled == 0: true+font reads: passes [], restyled []restyled: 50px serifhidden: 60px serifstill hidden: 70px serifdiff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-cache-hits.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-cache-hits.txtdeleted file mode 100644index cf8013fd9ae..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-cache-hits.txt+++ /dev/null@@ -1,2 +0,0 @@-[after remove .match]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-no-has.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-no-has.txtdeleted file mode 100644index 34093bf5e27..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-no-has.txt+++ /dev/null@@ -1,2 +0,0 @@-[after add .descendant (no :has() in sheet)]- styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-non-subject-has.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-non-subject-has.txtdeleted file mode 100644index a7e2229b4a8..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-non-subject-has.txt+++ /dev/null@@ -1,2 +0,0 @@-[after add .match on target]- styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-sibling-has.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-sibling-has.txtdeleted file mode 100644index 2622a416e4a..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-sibling-has.txt+++ /dev/null@@ -1,2 +0,0 @@-[after add .match on adjacent sibling]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-subject-has.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-subject-has.txtdeleted file mode 100644index 0deddf32c67..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/baseline-subject-has.txt+++ /dev/null@@ -1,4 +0,0 @@-[after add .match on target]- styled <= 4: true-[after remove .match on target]- styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/cold-shadow-root-sheet-insights.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/cold-shadow-root-sheet-insights.txtdeleted file mode 100644index e68d513413e..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/cold-shadow-root-sheet-insights.txt+++ /dev/null@@ -1,5 +0,0 @@-[cold shadow roots without :has()]- styled <= 50: true-rgb(255, 0, 0)-[cold shadow root with :has()]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/deep-dom-with-anchor-halfway.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/deep-dom-with-anchor-halfway.txtdeleted file mode 100644index a6364a86f90..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/deep-dom-with-anchor-halfway.txt+++ /dev/null@@ -1,2 +0,0 @@-[add .match at depth 10 (anchor at depth 5)]- styled <= 6: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/fast-path-unrelated-mutation.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/fast-path-unrelated-mutation.txtdeleted file mode 100644index e5ba88d65fc..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/fast-path-unrelated-mutation.txt+++ /dev/null@@ -1,4 +0,0 @@-[add unrelated class outside any :has() scope]- styled <= 1: true-[add .match class outside any :has() scope]- styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-child-combinator.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-child-combinator.txtdeleted file mode 100644index 6d1a97bd102..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-child-combinator.txt+++ /dev/null@@ -1,4 +0,0 @@-[add .match to direct child]- styled <= 3: true-[add .match to grandchild (should not style anchor)]- styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-complex-sibling-subtree-scan-insights.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-complex-sibling-subtree-scan-insights.txtdeleted file mode 100644index 22d5c8b26e0..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-complex-sibling-subtree-scan-insights.txt+++ /dev/null@@ -1,2 +0,0 @@-[add .match]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-control-no-has-with-text-insert.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-control-no-has-with-text-insert.txtdeleted file mode 100644index 6e867a85fe4..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-control-no-has-with-text-insert.txt+++ /dev/null@@ -1,2 +0,0 @@-[after text insert (no :has() rule)]- styled <= 0: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-feature-metadata-buckets.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-feature-metadata-buckets.txtdeleted file mode 100644index 684a1b945ad..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-feature-metadata-buckets.txt+++ /dev/null@@ -1,6 +0,0 @@-[add unrelated class]- styled <= 1: true-[add class referenced by one :has()]- styled <= 1: true-[add class referenced by two :has() rules]- styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-order-insensitive-plan-merge.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-order-insensitive-plan-merge.txtdeleted file mode 100644index cddfa889c72..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-order-insensitive-plan-merge.txt+++ /dev/null@@ -1,2 +0,0 @@-[after add .leaf]- styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-sibling-scan-insights.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-sibling-scan-insights.txtdeleted file mode 100644index 23f01c6f9b6..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-sibling-scan-insights.txt+++ /dev/null@@ -1,4 +0,0 @@-[descendant-only :has() sheet]- styled <= 3: true-[sheet with sibling-sensitive :has()]- styled <= 3: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-subsequent-sibling.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-subsequent-sibling.txtdeleted file mode 100644index 3d28c99aa81..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-subsequent-sibling.txt+++ /dev/null@@ -1,2 +0,0 @@-[add .match to non-adjacent later sibling]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-attribute.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-attribute.txtdeleted file mode 100644index ff9077a8ff6..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-attribute.txt+++ /dev/null@@ -1,4 +0,0 @@-[set data-matched attribute]- styled <= 2: true-[remove data-matched attribute]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-is.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-is.txtdeleted file mode 100644index 43bf298c2df..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-is.txt+++ /dev/null@@ -1,4 +0,0 @@-[add .a (matches :is() branch)]- styled <= 3: true-[swap to .b (other :is() branch)]- styled <= 3: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-not.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-not.txtdeleted file mode 100644index e34b8e02953..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/has-with-not.txt+++ /dev/null@@ -1,4 +0,0 @@-[add .x (anchor should stop being styled)]- styled <= 3: true-[remove .x (anchor should be styled again)]- styled <= 3: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/insertion-triggers-has.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/insertion-triggers-has.txtdeleted file mode 100644index 6921e034758..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/insertion-triggers-has.txt+++ /dev/null@@ -1,4 +0,0 @@-[insert <span class='match'> into anchor subtree]- styled <= 4: true-[remove the matching span]- styled <= 3: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/multiple-has-rules.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/multiple-has-rules.txtdeleted file mode 100644index 183160d7b72..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/multiple-has-rules.txt+++ /dev/null@@ -1,4 +0,0 @@-[add .red (only :has(.red) flips)]- styled <= 2: true-[add .blue (only :has(.blue) flips, .red stable)]- styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/unstyled-shadow-root-mutation.txt b/Tests/LibWeb/Text/expected/css-has-invalidation/unstyled-shadow-root-mutation.txtdeleted file mode 100644index bc0ead1bcaf..00000000000--- a/Tests/LibWeb/Text/expected/css-has-invalidation/unstyled-shadow-root-mutation.txt+++ /dev/null@@ -1,3 +0,0 @@-rgb(255, 0, 0)-[insert matching element into unstyled shadow root]- styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css/child-change-no-op-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/child-change-no-op-invalidation-counters.txtdeleted file mode 100644index 483db7e63f3..00000000000--- a/Tests/LibWeb/Text/expected/css/child-change-no-op-invalidation-counters.txt+++ /dev/null@@ -1,3 +0,0 @@-appending a child to a parent without observable child-state pseudos: styled <= 1: true-removing the only child from a parent without observable child-state pseudos: styled <= 0: true-appending a fragment to a parent without observable child-state pseudos: styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt b/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txtindex 11212ef12ee..3d72c7b2e56 100644--- a/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt+++ b/Tests/LibWeb/Text/expected/css/font-cascade-stable-display-period.txt@@ -1,6 +1,6 @@selected face is loading: truelayout after paint change while pending: (no layout)-display transition recomputes style: true+display transition style work: passes [PARTIAL], restyled [span]display transition keeps fallback metrics: truelayout after paint change with visible fallback: (no layout)loaded face changes metrics: truediff --git a/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt b/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txtindex f845fe3a06f..58a53220dcc 100644--- a/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt+++ b/Tests/LibWeb/Text/expected/css/font-cascade-unchanged-pending-selection.txt@@ -1,8 +1,8 @@layout after paint change with pending cascade: (no layout)-unused weight registration recomputed style: false-unused weight completion recomputed style: false+unused weight registration style work: passes [], restyled []+unused weight completion style work: passes [], restyled []unchanged selection preserves width: trueunused subset stays unloaded: true-matching weight registration recomputed style: true+matching weight registration style work: passes [PARTIAL], restyled [span]matching selection changes width: trueremoving matching face restores width: truediff --git a/Tests/LibWeb/Text/expected/css/font-completion-preserves-settled-style.txt b/Tests/LibWeb/Text/expected/css/font-completion-preserves-settled-style.txtindex ddab952ccaa..a96cf9ac065 100644--- a/Tests/LibWeb/Text/expected/css/font-completion-preserves-settled-style.txt+++ b/Tests/LibWeb/Text/expected/css/font-completion-preserves-settled-style.txt@@ -1,7 +1,7 @@resident face used before completion: truestatus before completion: loadingstatus after completion: loaded-completion recomputed style: false+completion style work: passes [], restyled []completion preserves geometry: trueunused subset: unloadedregistered script face: loaded, width=20diff --git a/Tests/LibWeb/Text/expected/css/font-face-weight-specific-invalidation.txt b/Tests/LibWeb/Text/expected/css/font-face-weight-specific-invalidation.txtindex f4cec3a38c5..0df7dc01f51 100644--- a/Tests/LibWeb/Text/expected/css/font-face-weight-specific-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/font-face-weight-specific-invalidation.txt@@ -1,3 +1,2 @@-affected weight recomputed: true-unaffected weights skipped: true+restyled: [span.regular]regular face loaded: loadeddiff --git a/Tests/LibWeb/Text/expected/css/font-load-restyle-keeps-matches.txt b/Tests/LibWeb/Text/expected/css/font-load-restyle-keeps-matches.txtindex c1668088462..1c8dd25b691 100644--- a/Tests/LibWeb/Text/expected/css/font-load-restyle-keeps-matches.txt+++ b/Tests/LibWeb/Text/expected/css/font-load-restyle-keeps-matches.txt@@ -1,4 +1,5 @@-font users restyled: true-elements matched against every rule: 0-elements sharing a style: 48+style passes: PARTIAL+spans computed: span, span@2+spans sharing a style: 48+spans whose style changed: 50face loaded: loadeddiff --git a/Tests/LibWeb/Text/expected/css/font-load-restyles-metric-readers.txt b/Tests/LibWeb/Text/expected/css/font-load-restyles-metric-readers.txtindex a7306caa24b..b80a64e4451 100644--- a/Tests/LibWeb/Text/expected/css/font-load-restyles-metric-readers.txt+++ b/Tests/LibWeb/Text/expected/css/font-load-restyles-metric-readers.txt@@ -1,5 +1,5 @@face loaded: loaded-elements styled: 5+elements styled: [span.ch, span.ch@2, span.ch@3, span.ch@4, span.ch@5]text width changed: truech width changed: truetext width matches a fresh style: truediff --git a/Tests/LibWeb/Text/expected/css/font-load-restyles-root-metric-readers.txt b/Tests/LibWeb/Text/expected/css/font-load-restyles-root-metric-readers.txtindex 1e2923c886d..052813a7be4 100644--- a/Tests/LibWeb/Text/expected/css/font-load-restyles-root-metric-readers.txt+++ b/Tests/LibWeb/Text/expected/css/font-load-restyles-root-metric-readers.txt@@ -1,5 +1,5 @@face loaded: loaded-elements styled: 6+elements styled: [html, span.rex, span.rex@2, span.rex@3, span.rch, span.rch@2]rem width changed: falserch width changed: truerem width matches a fresh style: truediff --git a/Tests/LibWeb/Text/expected/css/has-anchor-answer-once-per-pass.txt b/Tests/LibWeb/Text/expected/css/has-anchor-answer-once-per-pass.txtindex d74a02557b1..499362e8c2e 100644--- a/Tests/LibWeb/Text/expected/css/has-anchor-answer-once-per-pass.txt+++ b/Tests/LibWeb/Text/expected/css/has-anchor-answer-once-per-pass.txt@@ -1,3 +1 @@last item: rgb(0, 128, 0)-relational walks at least one: true-relational walks fewer than one per ten items: truediff --git a/Tests/LibWeb/Text/expected/css/inherited-custom-property-change-reuses-shared-styles.txt b/Tests/LibWeb/Text/expected/css/inherited-custom-property-change-reuses-shared-styles.txtindex c8d71c5a842..66ed447748e 100644--- a/Tests/LibWeb/Text/expected/css/inherited-custom-property-change-reuses-shared-styles.txt+++ b/Tests/LibWeb/Text/expected/css/inherited-custom-property-change-reuses-shared-styles.txt@@ -1,5 +1,5 @@margin after change: 2pxevery child keeps its own margin: trueevery child inherits the new theme: true-styled at most 1: true-children compute no record of their own past the first: true+restyled: [outer]+children that only took the moved environment: 20diff --git a/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-shadow-host-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-shadow-host-invalidation-counters.txtdeleted file mode 100644index 539a5a4d3bb..00000000000--- a/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-shadow-host-invalidation-counters.txt+++ /dev/null@@ -1 +0,0 @@-bare :host keyframes insertRule only restyles the host, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-style-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-style-invalidation-counters.txtdeleted file mode 100644index 8b8610bb580..00000000000--- a/Tests/LibWeb/Text/expected/css/insert-rule-keyframes-style-invalidation-counters.txt+++ /dev/null@@ -1 +0,0 @@-keyframes insertRule only restyles animation users, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/insert-rule-style-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/insert-rule-style-invalidation-counters.txtdeleted file mode 100644index 6e03c99cfc4..00000000000--- a/Tests/LibWeb/Text/expected/css/insert-rule-style-invalidation-counters.txt+++ /dev/null@@ -1,2 +0,0 @@-document insertRule stays targeted across many bystanders, styled <= 1: true-shadow insertRule stays targeted across many bystanders, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/invalidation-of-scope-bounds-stays-with-their-roots.txt b/Tests/LibWeb/Text/expected/css/invalidation-of-scope-bounds-stays-with-their-roots.txtindex b20da00e37e..9fc9f90f78a 100644--- a/Tests/LibWeb/Text/expected/css/invalidation-of-scope-bounds-stays-with-their-roots.txt+++ b/Tests/LibWeb/Text/expected/css/invalidation-of-scope-bounds-stays-with-their-roots.txt@@ -1,6 +1,6 @@-arrival among children read by a plain rule: 1-departure among children read by a plain rule: 0-a class nothing tests: 0-arrival moving a root: true+arrival among children read by a plain rule: [div, div.plain]+departure among children read by a plain rule: [div.plain]+a class nothing tests: []+arrival moving a root: [li, li@2, a.in-first]moved root: rgb(0, 0, 0)moved back: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/shadow-media-query-invalidation-stays-scoped.txt b/Tests/LibWeb/Text/expected/css/shadow-media-query-invalidation-stays-scoped.txtdeleted file mode 100644index 1b6944ccd79..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-media-query-invalidation-stays-scoped.txt+++ /dev/null@@ -1,2 +0,0 @@-Target color: rgb(0, 128, 0)-shadow media query update stays scoped, styled <= 15: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-host-light-dom-trailing-universal-invalidation.txt b/Tests/LibWeb/Text/expected/css/shadow-root-host-light-dom-trailing-universal-invalidation.txtdeleted file mode 100644index 7dce8ada97b..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-host-light-dom-trailing-universal-invalidation.txt+++ /dev/null@@ -1,6 +0,0 @@-host child combinator add keeps work scoped: color unchanged true, styled < 10: true-host descendant combinator add keeps work scoped: color unchanged true, styled < 10: true-broad host-side stylesheet add avoids document-wide work: color unchanged true, styled < 10: true-broad host-side sibling escape avoids root-side work: color unchanged true, styled < 10: true-broad functional host-side selector avoids document-wide work: color unchanged true, styled < 10: true-broad functional host-side sibling escape avoids root-side work: color unchanged true, styled < 10: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-keyframes-shadow-local-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/shadow-root-keyframes-shadow-local-invalidation-counters.txtdeleted file mode 100644index 0b6988b2246..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-keyframes-shadow-local-invalidation-counters.txt+++ /dev/null@@ -1 +0,0 @@-shadow-local keyframes insert ignores matching light-DOM bystanders, styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-layer-order-shadow-local-invalidation.txt b/Tests/LibWeb/Text/expected/css/shadow-root-layer-order-shadow-local-invalidation.txtdeleted file mode 100644index f9ec7a0c37a..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-layer-order-shadow-local-invalidation.txt+++ /dev/null@@ -1,2 +0,0 @@-shadow-local layer-order add stays inside the shadow root, styled <= 4: true-shadow-local layer-order remove stays inside the shadow root, styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-shadow-local-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-shadow-local-invalidation-counters.txtdeleted file mode 100644index c5daccabbbd..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-shadow-local-invalidation-counters.txt+++ /dev/null@@ -1,3 +0,0 @@-shadow-local replaceSync ignores matching light-DOM bystanders, styled <= 2: true-shadow-local replaceSync stays bounded on subsequent updates, styled <= 2: true-shadow-local replaceSync clearing the sheet stays bounded, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-slot-only-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-slot-only-invalidation-counters.txtdeleted file mode 100644index e3ad88b3ebb..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-replacesync-slot-only-invalidation-counters.txt+++ /dev/null@@ -1,2 +0,0 @@-slot-only replaceSync stays scoped to the current host subtree, styled <= 4: true-slot-only replaceSync removal stays scoped to the current host subtree, styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-slot-style-add-remove-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/shadow-root-slot-style-add-remove-invalidation-counters.txtdeleted file mode 100644index 8d5e999c71d..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-slot-style-add-remove-invalidation-counters.txt+++ /dev/null@@ -1,2 +0,0 @@-slotted stylesheet add ignores matching bystanders outside the current host, styled <= 4: true-slotted stylesheet remove ignores matching bystanders outside the current host, styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.txtdeleted file mode 100644index 18f114cb226..00000000000--- a/Tests/LibWeb/Text/expected/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.txt+++ /dev/null@@ -1,2 +0,0 @@-shadow-local stylesheet add ignores matching light-DOM bystanders, styled <= 4: true-shadow-local stylesheet remove ignores matching light-DOM bystanders, styled <= 4: truediff --git a/Tests/LibWeb/Text/expected/css/style-attribute-no-op-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/style-attribute-no-op-invalidation-counters.txtdeleted file mode 100644index 7bf922da36b..00000000000--- a/Tests/LibWeb/Text/expected/css/style-attribute-no-op-invalidation-counters.txt+++ /dev/null@@ -1,4 +0,0 @@-setting identical style text, styled <= 0: true-setting changed style text, styled <= 1: true-setting identical custom property, styled <= 0: true-setting changed custom property, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/style-engine/animated-slot-style-propagation.txt b/Tests/LibWeb/Text/expected/css/style-engine/animated-slot-style-propagation.txtindex 5c592a83e3a..991e861a749 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/animated-slot-style-propagation.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/animated-slot-style-propagation.txt@@ -1,4 +1,4 @@-named/transition paint avoids descendant style work: true+named/transition paint restyled: []named/transition slot sample: rgb(75, 75, 75)named/transition assigned background: rgba(0, 0, 0, 0)named/transition explicit inheritance: rgb(25, 25, 25)@@ -12,7 +12,7 @@ named/transition animated flex blockifies: blocknamed/transition animated contents restores inline: inlinenamed/transition fallback inherits: rgb(0, 0, 255)named/transition fallback explicitly inherits animated paint: rgb(50, 50, 50)-named/animation paint avoids descendant style work: true+named/animation paint restyled: []named/animation slot sample: rgb(75, 75, 75)named/animation assigned background: rgba(0, 0, 0, 0)named/animation explicit inheritance: rgb(25, 25, 25)@@ -26,7 +26,7 @@ named/animation animated flex blockifies: blocknamed/animation animated contents restores inline: inlinenamed/animation fallback inherits: rgb(0, 0, 255)named/animation fallback explicitly inherits animated paint: rgb(50, 50, 50)-named/web-animation paint avoids descendant style work: true+named/web-animation paint restyled: []named/web-animation slot sample: rgb(75, 75, 75)named/web-animation assigned background: rgba(0, 0, 0, 0)named/web-animation explicit inheritance: rgb(25, 25, 25)@@ -40,7 +40,7 @@ named/web-animation animated flex blockifies: blocknamed/web-animation animated contents restores inline: inlinenamed/web-animation fallback inherits: rgb(0, 0, 255)named/web-animation fallback explicitly inherits animated paint: rgb(50, 50, 50)-manual/transition paint avoids descendant style work: true+manual/transition paint restyled: []manual/transition slot sample: rgb(75, 75, 75)manual/transition assigned background: rgba(0, 0, 0, 0)manual/transition explicit inheritance: rgb(25, 25, 25)@@ -54,7 +54,7 @@ manual/transition animated flex blockifies: blockmanual/transition animated contents restores inline: inlinemanual/transition fallback inherits: rgb(0, 0, 255)manual/transition fallback explicitly inherits animated paint: rgb(50, 50, 50)-manual/animation paint avoids descendant style work: true+manual/animation paint restyled: []manual/animation slot sample: rgb(75, 75, 75)manual/animation assigned background: rgba(0, 0, 0, 0)manual/animation explicit inheritance: rgb(25, 25, 25)@@ -68,7 +68,7 @@ manual/animation animated flex blockifies: blockmanual/animation animated contents restores inline: inlinemanual/animation fallback inherits: rgb(0, 0, 255)manual/animation fallback explicitly inherits animated paint: rgb(50, 50, 50)-manual/web-animation paint avoids descendant style work: true+manual/web-animation paint restyled: []manual/web-animation slot sample: rgb(75, 75, 75)manual/web-animation assigned background: rgba(0, 0, 0, 0)manual/web-animation explicit inheritance: rgb(25, 25, 25)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/broad-sheet-change-with-element-input.txt b/Tests/LibWeb/Text/expected/css/style-engine/broad-sheet-change-with-element-input.txtindex 8668315ed85..36029656964 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/broad-sheet-change-with-element-input.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/broad-sheet-change-with-element-input.txt@@ -1,9 +1,9 @@-insert stays selective: true+insert restyled: [div, div.other]insert target opacity: 0.5insert other opacity: 0.75-delete stays selective: true+delete restyled: [div]delete target opacity: 0.25delete other opacity: 0.75-declaration stays selective: true+declaration restyled: [div, div.other]declaration target opacity: 0.75declaration other opacity: 0.125diff --git a/Tests/LibWeb/Text/expected/css/style-engine/cascade-topology-mutations.txt b/Tests/LibWeb/Text/expected/css/style-engine/cascade-topology-mutations.txtindex d6b2122b225..c529898f8e9 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/cascade-topology-mutations.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/cascade-topology-mutations.txt@@ -5,6 +5,14 @@ swap their order: [item]unadopt both: [item]declare the layers in the other order: [item]take that statement away again: [item]+attach a layer statement reversing the layers, behind a media attribute that does not match: []+ item color: rgb(0, 0, 255)+ungate it: [item]+ item color: rgb(0, 128, 0)+detach it: [item]+ item color: rgb(0, 0, 255)+attach a sheet declaring only layers nothing is in: []+detach that sheet: []make a layered declaration important: [item]make it normal again: [item]insert an empty layer block: []diff --git a/Tests/LibWeb/Text/expected/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.txt b/Tests/LibWeb/Text/expected/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.txtindex f35fcf714b1..6477db1e1b6 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.txt@@ -1,5 +1,5 @@-li > div > :focus: 0-li > div > *: 1-li :focus: 0+li > div > :focus: []+li > div > *: [button]+li :focus: []before focus: rgb(0, 0, 0)after focus: rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/converging-style-input-shares-style.txt b/Tests/LibWeb/Text/expected/css/style-engine/converging-style-input-shares-style.txtindex 377565ca4ff..7000fe6da54 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/converging-style-input-shares-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/converging-style-input-shares-style.txt@@ -1,2 +1,5 @@-shared converging style: true+style PARTIAL+ span.new (computed, changed)+ span.new@2 (shared, changed)+ span.new@3 (shared, changed)colors became green: truediff --git a/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-does-not-restyle-children.txt b/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-does-not-restyle-children.txtindex 3f179cd35a4..e7e047ba6cf 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-does-not-restyle-children.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-does-not-restyle-children.txt@@ -1,5 +1,4 @@-elements: 25-styled: 10, full passes: 0-rebuilding the boxes restyles nothing again: true+restyled: [list, span, span@2, span@3, span@4, span@5, span@6, span@7, span@8, generated]+rebuilding the boxes restyles nothing again: passes [PARTIAL]marker rebuilt: truegenerated content rebuilt: truediff --git a/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-spares-unrelated-records.txt b/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-spares-unrelated-records.txtindex fd6311240ab..f26380089e8 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-spares-unrelated-records.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/counter-style-change-spares-unrelated-records.txt@@ -1,3 +1,3 @@-plain received a new style record: true+changed records: [ol, item, plain]plain color: rgb(0, 128, 0)item color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/custom-function-input-precision.txt b/Tests/LibWeb/Text/expected/css/style-engine/custom-function-input-precision.txtindex 60b873e330b..4d94f8b4785 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/custom-function-input-precision.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/custom-function-input-precision.txt@@ -1,13 +1,13 @@initial width: 10pxdelete width: 100px-delete styled: 1, full passes: 0+delete restyled: [target]restore width: 30px-restore styled: 1, full passes: 0+restore restyled: [target]grouped replacement width: 40px-grouped replacement styled: 1, full passes: 0+grouped replacement restyled: [target]remove grouped definition width: 100px-remove grouped definition styled: 1, full passes: 0+remove grouped definition restyled: [target]unused definition width: 100px-unused definition styled: 1, full passes: 0+unused definition restyled: [target]mixed broad rule width: 60px-mixed broad rule styled: 1, full passes: 0+mixed broad rule restyled: [target]diff --git a/Tests/LibWeb/Text/expected/css/style-engine/declaration-mutations.txt b/Tests/LibWeb/Text/expected/css/style-engine/declaration-mutations.txtindex e67607ae13b..5239e9e3c3d 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/declaration-mutations.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/declaration-mutations.txt@@ -10,3 +10,6 @@ lose it: [circle]remove one inline property through the CSSOM: [] + unchanged [item]remove the last property from a stylesheet rule: [item, sibling]rewrite the same inline style: []+set a root custom property to the value it has: []+move a root custom property one element reads: computed [html, reader]+ reader height: 10pxdiff --git a/Tests/LibWeb/Text/expected/css/style-engine/early-sharing-context-dependencies.txt b/Tests/LibWeb/Text/expected/css/style-engine/early-sharing-context-dependencies.txtindex 26b00a887bd..baf9852d66e 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/early-sharing-context-dependencies.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/early-sharing-context-dependencies.txt@@ -1,7 +1,7 @@-random() computations share no record: true+random() computations: div.random computed, div.random@2 computed, div.random@3 computed, div.random@4 computed, div.random@5 computed, div.random@6 computed, div.random@7 computed, div.random@8 computedrandom values survive inherited changes: true-shared-random computations share: 0+shared-random computations: div.shared-random computed, div.shared-random@2 computed, div.shared-random@3 computed, div.shared-random@4 computed, div.shared-random@5 computed, div.shared-random@6 computed, div.shared-random@7 computed, div.shared-random@8 computedshared-random computations agree: true-fixed-random computations share: 0+fixed-random computations: div.fixed-random computed, div.fixed-random@2 computed, div.fixed-random@3 computed, div.fixed-random@4 computed, div.fixed-random@5 computed, div.fixed-random@6 computed, div.fixed-random@7 computed, div.fixed-random@8 computedfixed-random computations agree: trueimage declaration contexts agree: truediff --git a/Tests/LibWeb/Text/expected/css/style-engine/equivalent-cascade-input-shares-style.txt b/Tests/LibWeb/Text/expected/css/style-engine/equivalent-cascade-input-shares-style.txtindex dfdb63f74e1..466a7b5d8cc 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/equivalent-cascade-input-shares-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/equivalent-cascade-input-shares-style.txt@@ -1,3 +1,5 @@-shared equivalent cascade: true+style PARTIAL+ span.winner.loser-a (computed, changed)+ span.winner.loser-b (reused, changed)first color: rgb(0, 128, 0)second color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css-has-invalidation/has-featureless-and-concrete-child-list-coalescing.txt b/Tests/LibWeb/Text/expected/css/style-engine/has-featureless-and-concrete-child-list-coalescing.txtsimilarity index 100%rename from Tests/LibWeb/Text/expected/css-has-invalidation/has-featureless-and-concrete-child-list-coalescing.txtrename to Tests/LibWeb/Text/expected/css/style-engine/has-featureless-and-concrete-child-list-coalescing.txtdiff --git a/Tests/LibWeb/Text/expected/css/style-engine/has-reach.txt b/Tests/LibWeb/Text/expected/css/style-engine/has-reach.txtnew file mode 100644index 00000000000..0a690529c61--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/has-reach.txt@@ -0,0 +1,28 @@+a grandchild gains the class a child query names: []+ child-anchor color: rgb(0, 0, 0)+the child gains it: [child-anchor, child, grandchild]+ child-anchor color: rgb(0, 128, 0)+a witness of the first of two :has() rules on one anchor: [two-rules, two-rules-witness]+a witness of the second, whose property does not inherit: [two-rules]+ two-rules color: rgb(0, 128, 0)+ two-rules background-color: rgb(0, 128, 0)+a witness under an anchor halfway down a deep tree: [deep-anchor, d6, d7, d8, d9, deep-witness]+ deep-anchor color: rgb(0, 128, 0)+a witness of a negated :has() arrives: [negated, negated-middle, negated-witness]+ negated color: rgb(0, 0, 0)+and leaves: [negated, negated-middle, negated-witness]+ negated color: rgb(0, 128, 0)+a later sibling past the adjacent one becomes a witness: [later]+ later color: rgb(0, 128, 0)+a witness gains the argument's attribute: [attributed, attributed-witness]+ attributed color: rgb(0, 128, 0)+and loses it: [attributed, attributed-witness]+ attributed color: rgb(0, 0, 0)+an element outside every anchor gains a class no rule names: []+and a class a :has() argument names: []+ outside-anchor color: rgb(0, 128, 0)+a witness class arrives in a shadow root with no sheets: [shadow-witness]+text arrives where no rule asks about emptiness: []+fill new shadow roots whose sheet has no :has(): [cold-host-0, cold-target-0, cold-host-1, cold-target-1]+a new host whose :host(:has()) rule its new light-DOM child answers: [has-host, light-target]+ has-host color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.txt b/Tests/LibWeb/Text/expected/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.txtindex 140a9dcb56b..d9c593f2f50 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.txt@@ -1,8 +1,8 @@-li: 1-:host > li: 1-:host(.a) li: 0-:host([data-priority]) > li: 0-:host: 2+li: [li]+:host > li: [li]+:host(.a) li: []+:host([data-priority]) > li: []+:host: [host, li]without the host attribute: rgb(0, 0, 0)with the host attribute: rgb(1, 2, 3)after removing the host attribute: rgb(0, 0, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/keyframes-input-precision.txt b/Tests/LibWeb/Text/expected/css/style-engine/keyframes-input-precision.txtindex 8d4de82ea3a..2214de41fae 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/keyframes-input-precision.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/keyframes-input-precision.txt@@ -1,6 +1,6 @@-insert stays selective: true+insert restyled: [target]insert opacity: 0.5-edit stays selective: true+edit restyled: []edit opacity: 0.25-delete stays selective: true+delete restyled: []delete opacity: 1diff --git a/Tests/LibWeb/Text/expected/css/style-engine/manual-slot-style-propagation.txt b/Tests/LibWeb/Text/expected/css/style-engine/manual-slot-style-propagation.txtindex b0781cc2c78..a6c0612f6bc 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/manual-slot-style-propagation.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/manual-slot-style-propagation.txt@@ -1,7 +1,7 @@-manual slot paint change only reaches slot: true+manual slot paint change restyled: [first]child background: rgba(0, 0, 0, 0)text remains assigned: true-manual reassignment only reaches moved subtree: true+manual reassignment restyled: [div, span]moved child assigned to second: trueremaining child stays assigned to first: truemoved child color: rgb(0, 0, 255)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-media-mutations.txt b/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-media-mutations.txtnew file mode 100644index 00000000000..3a43b732d47--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-media-mutations.txt@@ -0,0 +1,48 @@+activate a bare :host rule: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule with a class: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule with an attribute: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule with a negation: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule with :is(): [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule with :where(): [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+deactivate a :host() rule with a class: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(1, 2, 3) -> rgb(0, 0, 0)+activate a :host rule with appendMedium(): [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+deactivate a :host rule with deleteMedium(): [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(1, 2, 3) -> rgb(0, 0, 0)+activate a rule inside the tree guarded by :host(): [inner]+ inner color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule with a class: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule with a type and a class: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule with an attribute: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule with :is(): [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule with a negation: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule for a named slot: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule for a property that does not inherit: [assigned]+ assigned background-color: rgba(0, 0, 0, 0) -> rgb(4, 5, 6)+activate a rule for a bare slot the assigned element inherits from: [slot, assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a rule for a named slot the assigned element inherits from: [slot, assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a descendant rule for a slot the assigned element inherits from: [slot, assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule for a host nested in a classed wrapper: [host, shadow-wrapper, slot, assigned, inner]+ host color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a ::slotted() rule for an assigned paragraph: [assigned]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)+activate a :host() rule and a ::slotted() rule together: [host, shadow-wrapper, slot, assigned, inner]+ assigned background-color: rgba(0, 0, 0, 0) -> rgb(4, 5, 6)+activate a rule inside the tree and a ::slotted() rule together: [assigned, inner]+ assigned color: rgb(0, 0, 0) -> rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-reach.txt b/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-reach.txtnew file mode 100644index 00000000000..fde8444a0ac--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/shadow-sheet-reach.txt@@ -0,0 +1,42 @@+insert a rule into a shadow root's style element: [local-target]+ local-target color: rgb(0, 128, 0)+delete it: [local-target]+attach a style element to a shadow root: [local-target, style]+ local-target color: rgb(0, 128, 0)+detach it: [local-target]+replaceSync an adopted shadow sheet onto the class: [local-target]+replaceSync it onto another value: [local-target]+ local-target color: rgb(0, 0, 255)+replaceSync it empty: [local-target]+ light-local color: rgb(0, 0, 0)+attach a layer statement ahead of a shadow root's layers, reversing them: [style, layer-target]+ layer-target color: rgb(255, 0, 0)+detach it: [layer-target]+ layer-target color: rgb(0, 128, 0)+insert @keyframes a light-DOM element also names into a shadow root's style element: [] + unchanged [keyframes-target]+ keyframes-target opacity: 0.25+ keyframes-bystander opacity: 1+insert the @keyframes a :host rule names into its adopted sheet: []+ animated-host opacity: 0.25+attach a ::slotted() style element to one of two shadow roots: [slotted-a, style]+ slotted-a color: rgb(0, 0, 255)+ slotted-b color: rgb(0, 0, 0)+detach it: [slotted-a]+replaceSync an adopted sheet onto the slot: [slot-a, slotted-a]+ slotted-a color: rgb(0, 128, 0)+ slotted-b color: rgb(0, 0, 0)+replaceSync it empty: [slot-a, slotted-a]+attach :host > .light to a shadow root: [style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+attach :host .light: [style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+attach :host * beside keyframes: [escape-inside, style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+attach :host + :has(*) beside keyframes: [style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+attach :is(:host) * beside keyframes: [escape-inside, style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+attach :is(:host) + :has(*) beside keyframes: [style]+ light DOM colors: rgb(0, 0, 0), rgb(0, 0, 0), rgb(0, 0, 0)+insert a host whose new shadow tree has a sheet behind a matching media query: [media-host, style, media-target]+ media-target color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/sheet-mutations.txt b/Tests/LibWeb/Text/expected/css/style-engine/sheet-mutations.txtindex aca361e1184..0a4ca8c1bfd 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/sheet-mutations.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/sheet-mutations.txt@@ -35,6 +35,22 @@ adopt a constructed sheet: [item, slottee]replaceSync it onto another selector: [item, slottee]replaceSync it back: [item, slottee]unadopt it: [item, slottee]+adopt a constructed sheet whose media list does not match: []+ item font-style: normal+unadopt the gated sheet: []+adopt one whose media list does not match around a matching @media: []+ item font-style: normal+unadopt the wrapped sheet: []+adopt one whose media list matches: [item, slottee]+ item font-style: italic+unadopt the matching sheet: [item, slottee]+attach a style element whose media attribute does not match: []+ item font-weight: 400+detach the gated style element: []+attach a sheet whose only rule styles .item::before: [item, slottee]+ item::before content: ""+detach the pseudo-element sheet: [item, slottee]+ item::before content: normaldetach and reattach a subtree holding a sheet: [dispatch, by-id, by-tag, by-attr, style]adopt a sheet into a shadow root: [inner]unadopt it from the shadow root: [inner]diff --git a/Tests/LibWeb/Text/expected/css/style-engine/slot-reassignment-keeps-unmoved-siblings.txt b/Tests/LibWeb/Text/expected/css/style-engine/slot-reassignment-keeps-unmoved-siblings.txtindex ddc1e4929de..c587f9a7e9a 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/slot-reassignment-keeps-unmoved-siblings.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/slot-reassignment-keeps-unmoved-siblings.txt@@ -1,10 +1,10 @@-move to second: only moved subtree reached: true+move to second restyled: [div, span]moved color: rgb(0, 0, 255)child color: rgb(0, 0, 255)unmoved color: rgb(0, 128, 0)moved positional style: rgb(255, 0, 0)unmoved positional style: rgba(0, 0, 0, 0)-move to first: only moved subtree reached: true+move to first restyled: [div, span]moved color: rgb(0, 128, 0)child color: rgb(0, 128, 0)unmoved color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/slot-style-propagation.txt b/Tests/LibWeb/Text/expected/css/style-engine/slot-style-propagation.txtindex 403885df11a..d5363d30732 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/slot-style-propagation.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/slot-style-propagation.txt@@ -1,6 +1,6 @@-background change only reaches slot: true+background change restyled: [slot]child background: rgba(0, 0, 0, 0)-inherited color avoids full passes: true+inherited color passes: [PARTIAL]inherited color: rgb(0, 128, 0)last child color: rgb(0, 128, 0)shadow descendant color: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/typing-selection-style-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-engine/typing-selection-style-invalidation.txtindex 95c4e5042c2..b574ecea6b2 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/typing-selection-style-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/typing-selection-style-invalidation.txt@@ -1,12 +1,12 @@-typing stays local: true+typing restyled: []typing leaves a caret: true-repeated typing stays local: true+repeated typing restyled: []repeated typing leaves a caret: true-typing with a formatting override stays local: true+typing with a formatting override restyled: [b]typing with a formatting override leaves a caret: trueinserted text: textabcformatting preserved: 700selection query: rgb(10, 20, 30)input handler selection: rgb(40, 50, 60)input handler leaves a selection: true-selection styles activated locally: true+selection styles activated: [html, head, body, unrelated, editor, b, script, out]diff --git a/Tests/LibWeb/Text/expected/css/style-engine/unfocused-subject-skips-descendants.txt b/Tests/LibWeb/Text/expected/css/style-engine/unfocused-subject-skips-descendants.txtindex a8290ccb197..496353d5f99 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/unfocused-subject-skips-descendants.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/unfocused-subject-skips-descendants.txt@@ -1,4 +1,4 @@unfocused probe: rgb(0, 0, 0)-styled with no focused element: 0+styled with no focused element: []focused probe: rgb(0, 128, 0)-styled with one focused element: 4+styled with one focused element: [input, div, div@2, div@3]diff --git a/Tests/LibWeb/Text/expected/css/style-engine/where-is-subject-class-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-engine/where-is-subject-class-invalidation.txtindex fc50ec2dcc3..e14155a9843 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/where-is-subject-class-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/where-is-subject-class-invalidation.txt@@ -1,4 +1,5 @@colors with .prose: rgb(0, 128, 0) rgb(0, 0, 255)-invalidation tests don't grow with unrelated elements: true+restyled among 64 children: [one, two]+restyled among 1024 children: [one, two]color without .prose: rgb(0, 0, 0)alternatives with .other: rgb(128, 0, 128) rgb(128, 0, 128)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/active-state-featureless-has-targeted-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/active-state-featureless-has-targeted-invalidation.txtindex 9ece2797cf2..0fb8480c4d0 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/active-state-featureless-has-targeted-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/active-state-featureless-has-targeted-invalidation.txt@@ -1,2 +1,2 @@active color: rgb(1, 2, 3)-:active state change styled fewer than 50: true, full passes: 0+:active state change passes: [PARTIAL], restyled: [active-target]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/animated-custom-property-skips-restyle.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/animated-custom-property-skips-restyle.txtindex c44ca377d52..7279965c744 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/animated-custom-property-skips-restyle.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/animated-custom-property-skips-restyle.txt@@ -1,3 +1,3 @@-plain: skipped, rotate(45deg)-inactive: skipped, rotate(45deg)-ordinary: recomputed, rotate(45deg)+plain: restyled [], rotate(45deg)+inactive: restyled [], rotate(45deg)+ordinary: restyled [ordinary], rotate(45deg)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/child-list-featureless-has-targeted-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/child-list-featureless-has-targeted-invalidation.txtindex 482cd8060ef..2a5679d860b 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/child-list-featureless-has-targeted-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/child-list-featureless-has-targeted-invalidation.txt@@ -1 +1 @@-streamed appends styled fewer than 100: true, full passes: 0+streamed appends restyled per pass: PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.txtindex d03e2649cb8..e363154e027 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.txt@@ -1 +1 @@-PASS: descendant-only complex :has() keeps later :has() invalidation targeted (styled <= 9: true)+PASS: descendant-only complex :has() keeps later :has() invalidation targeted (restyled: [div.target])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.txtindex f1d71ec9792..c5659f2932f 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.txt@@ -1,9 +1,9 @@-PASS: compound :hover descendant invalidation ignores unrelated hover (styled <= 6: true)-PASS: compound :hover descendant invalidation applies to matching guard (styled <= 2: true)-PASS: co-invalidated pseudo-class guard updates descendant (styled <= 2: true)-PASS: partial :where() alternative guard updates sibling (styled <= 2: true)-PASS: complex :is() alternative guard updates sibling (styled <= 2: true)-PASS: tag-only :hover descendant invalidation ignores unrelated hover (styled <= 3: true)-PASS: case-sensitive SVG tag guard updates descendant (styled <= 2: true)-PASS: case-sensitive SVG attribute guard updates descendant (styled <= 2: true)-PASS: lowercase SVG attribute selector does not match camel-case attribute (styled <= 2: true)+PASS: compound :hover descendant invalidation ignores unrelated hover (restyled: [])+PASS: compound :hover descendant invalidation applies to matching guard (restyled: [span])+PASS: co-invalidated pseudo-class guard updates descendant (restyled: [a, span.target])+PASS: partial :where() alternative guard updates sibling (restyled: [label.target])+PASS: complex :is() alternative guard updates sibling (restyled: [label.target])+PASS: tag-only :hover descendant invalidation ignores unrelated hover (restyled: [span])+PASS: case-sensitive SVG tag guard updates descendant (restyled: [div.target])+PASS: case-sensitive SVG attribute guard updates descendant (restyled: [div.target, div.target@2])+PASS: lowercase SVG attribute selector does not match camel-case attribute (restyled: [div.target])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.txtindex 292387bc3e0..8981f37911a 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.txt@@ -1,2 +1,2 @@-PASS: computed style read outside a dirty subtree (styled: 10, full passes: 0)+PASS: computed style read outside a dirty subtree (restyled: [div.leaf, div.leaf@2, div.leaf@3, div.leaf@4, div.leaf@5, div.leaf@6, div.leaf@7, div.leaf@8, div.leaf@9, div.leaf@10])PASS: computed style read inside the dirty subtree sees fresh stylediff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/container-size-query-targeted-restyle.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/container-size-query-targeted-restyle.txtindex 7cddf08725a..2dc8641df87 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/container-size-query-targeted-restyle.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/container-size-query-targeted-restyle.txt@@ -1,5 +1,5 @@initial target color: rgb(0, 0, 0)-initial recomputations bounded: true+initial read restyled: [target]dynamic target color: rgb(0, 128, 0)-dynamic recomputations bounded: true-dynamic noop recomputations bounded: true+dynamic read restyled: [container, target]+dynamic read restyled without change: []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.txtindex a5fa26fea56..9df5be75355 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.txt@@ -1 +1 @@-PASS: :has() with a :first-child target stays targeted (styled <= 9: true)+PASS: :has() with a :first-child target stays targeted (restyled: [target])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.txtindex c15bd885f61..fc9dd9d9947 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.txt@@ -1,3 +1,3 @@-appends near interaction :has() styled fewer than 100: true, full passes: 0+appends near interaction :has() restyled per pass: PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p]focused: rgb(7, 7, 7)focused element removed: rgb(1, 1, 1)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-mutation-root-filter.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-mutation-root-filter.txtindex d34a37df182..b623a9a609b 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-mutation-root-filter.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-mutation-root-filter.txt@@ -1,30 +1,30 @@-PASS: actual mutation root skips unrelated :has anchor: attribute argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: attribute argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: class argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: class argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: id argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: id argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: tag argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: tag argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: negation argument with positive tag (styled: 0, full passes: 0)-PASS: actual mutation root keeps related :has anchor: negation argument with positive tag (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: child combinator argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: child combinator argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: descendant combinator argument (styled: 2, full passes: 0)-PASS: actual mutation root keeps related :has anchor: descendant combinator argument (styled: 3, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: empty pseudo-class argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: empty pseudo-class argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: checked pseudo-class argument (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: checked pseudo-class argument (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated :has anchor: checked pseudo-class argument after unrelated disabled mutation (styled: 1, full passes: 0)-PASS: actual mutation root keeps related :has anchor: checked pseudo-class argument after unrelated disabled mutation (styled: 2, full passes: 0)-PASS: actual mutation root skips unrelated sibling-combinator :has anchor (styled: 0, full passes: 0)-PASS: actual mutation root keeps sibling-combinator :has anchor for child removal (styled: 1, full passes: 0)-PASS: actual mutation root skips unrelated RHS sibling-combinator :has anchor: adjacent sibling argument (styled: 0, full passes: 0)-PASS: actual mutation root keeps RHS sibling-combinator :has anchor: adjacent sibling argument (styled: 1, full passes: 0)-PASS: actual mutation root skips unrelated RHS sibling-combinator :has anchor: subsequent sibling argument (styled: 0, full passes: 0)-PASS: actual mutation root keeps RHS sibling-combinator :has anchor: subsequent sibling argument (styled: 1, full passes: 0)+PASS: actual mutation root skips unrelated :has anchor: attribute argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: attribute argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: class argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: class argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: id argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: id argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: tag argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: tag argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: negation argument with positive tag (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: negation argument with positive tag (restyled beyond the insertion: [div.subgrid.unrelated])+PASS: actual mutation root skips unrelated :has anchor: child combinator argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: child combinator argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: descendant combinator argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: descendant combinator argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: empty pseudo-class argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: empty pseudo-class argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: checked pseudo-class argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: checked pseudo-class argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated :has anchor: checked pseudo-class argument after unrelated disabled mutation (restyled beyond the insertion: [])+PASS: actual mutation root keeps related :has anchor: checked pseudo-class argument after unrelated disabled mutation (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated sibling-combinator :has anchor (restyled beyond the insertion: [])+PASS: actual mutation root keeps sibling-combinator :has anchor for child removal (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated RHS sibling-combinator :has anchor: adjacent sibling argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps RHS sibling-combinator :has anchor: adjacent sibling argument (restyled beyond the insertion: [div.subgrid])+PASS: actual mutation root skips unrelated RHS sibling-combinator :has anchor: subsequent sibling argument (restyled beyond the insertion: [])+PASS: actual mutation root keeps RHS sibling-combinator :has anchor: subsequent sibling argument (restyled beyond the insertion: [div.subgrid])PASS: batched :has mutation invalidates after earlier unrelated mutation: adjacent sibling argumentPASS: batched :has mutation invalidates after earlier unrelated mutation: subsequent sibling argument-PASS: mixed-rule sibling scan preserves feature-filter skip: relative adjacent sibling argument (styled: 0, full passes: 0)-PASS: mixed-rule sibling scan preserves feature-filter skip: relative subsequent sibling argument (styled: 0, full passes: 0)+PASS: mixed-rule sibling scan preserves feature-filter skip: relative adjacent sibling argument (restyled beyond the insertion: [])+PASS: mixed-rule sibling scan preserves feature-filter skip: relative subsequent sibling argument (restyled beyond the insertion: [])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-non-subject-universal-argument-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-non-subject-universal-argument-invalidation.txtindex 44c17519c12..c10b549bab9 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-non-subject-universal-argument-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-non-subject-universal-argument-invalidation.txt@@ -1,3 +1,3 @@-appends without list items styled fewer than 100: true, full passes: 0+appends without list items restyled per pass: PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p], PARTIAL [p]with list item: rgb(9, 9, 9)list item removed: rgb(1, 1, 1)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-structural-feature-filter.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-structural-feature-filter.txtindex 37ccddef473..f3d6d017029 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-structural-feature-filter.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-structural-feature-filter.txt@@ -1,293 +1,293 @@-PASS: unrelated structural mutation skips :has walk: class / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: class / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: class / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: class / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: class / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: class / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: id / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: id / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: id / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: id / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: id / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: attribute / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: attribute / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: attribute / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: attribute / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: attribute / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: tag / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: tag / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: tag / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: tag / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: tag / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: checked pseudo / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: checked pseudo / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: checked pseudo / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: checked pseudo / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: checked pseudo / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: disabled pseudo / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: disabled pseudo / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: disabled pseudo / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: disabled pseudo / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: disabled pseudo / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: required pseudo / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: required pseudo / append matching child (styled: 5, full passes: 0)-PASS: related structural mutation keeps :has walk: required pseudo / append matching nested descendant (styled: 6, full passes: 0)-PASS: related structural mutation keeps :has walk: required pseudo / append matching fragment child (styled: 6, full passes: 0)-PASS: related structural mutation keeps :has walk: required pseudo / move matching child into anchor (styled: 5, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: compound class tag / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: compound class tag / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: compound class tag / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: compound class tag / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: compound class tag / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: is concrete class / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: is concrete class / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: is concrete class / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: is concrete class / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: is concrete class / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: where concrete tag / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: where concrete tag / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: where concrete tag / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: where concrete tag / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: where concrete tag / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: not-filtered concrete class / move matching child into anchor (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other class (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other id (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other attribute (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other tag (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append nested unrelated subtree (styled: 3, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append document fragment with unrelated children (styled: 2, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / remove unrelated child (styled: 0, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / move unrelated sibling before unrelated root (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / replace unrelated child with plain element (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / insert unrelated before anchor (styled: 1, full passes: 0)-PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append unrelated after fixture (styled: 1, full passes: 0)-PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching child (styled: 2, full passes: 0)-PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching nested descendant (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching fragment child (styled: 3, full passes: 0)-PASS: related structural mutation keeps :has walk: selector-list concrete class / move matching child into anchor (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: class / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: class / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: class / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: class / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: class / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: id / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: id / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: id / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: id / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: id / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: attribute / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: attribute / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: attribute / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: attribute / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: attribute / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: tag / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: tag / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: tag / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: tag / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: tag / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: compound / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: compound / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: compound / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: compound / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: compound / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: child / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: child / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: child / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: child / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: child / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: is concrete / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: is concrete / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: where concrete / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: where concrete / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / replace plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append plain child (styled: 1, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append plain nested subtree (styled: 2, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append text node (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / remove plain child (styled: 0, full passes: 0)-PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / replace plain child (styled: 1, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child universal insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: descendant universal insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :not(class) insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: adjacent :not(class) starts matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: adjacent :not(class) stops matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: following :not(id) starts matching (styled: 1, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: following :not(attribute) stops matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :not(tag) insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :is(:not(class)) insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :where(:not(attribute)) insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :not(class, id) insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: descendant :not(class) nested insertion (styled: 3, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :empty insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :empty stops matching after text append (styled: 1, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :first-child insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :last-child insertion (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :only-child stops matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :nth-child(2) starts matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :nth-last-child(2) starts matching (styled: 2, full passes: 0)-PASS: featureless-sensitive structural mutation keeps :has walk: child :only-of-type stops matching (styled: 2, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: descendant :focus insertion through wrapper with unrelated metadata (styled: 6, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus-within insertion with unrelated metadata (styled: 6, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus-visible insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :default checkbox insertion with unrelated metadata (styled: 2, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: descendant :default selected option insertion with unrelated metadata (styled: 10, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :valid insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :invalid insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :open insertion with unrelated metadata (styled: 6, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :read-only insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :read-write insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :is(:focus) insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: unprobeable pseudo structural mutation keeps :has walk: child :where(:invalid) insertion with unrelated metadata (styled: 5, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag insertion (styled: 2, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag nested insertion (styled: 3, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag inside html subtree (styled: 3, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg case-sensitive attribute insertion (styled: 2, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg case-sensitive attribute nested insertion (styled: 2, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: mathml case-sensitive attribute insertion (styled: 2, full passes: 0)-PASS: case-sensitive name structural mutation keeps :has walk: svg lower-case selector does not match camel-case attribute (styled: 1, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion breaks adjacent subject match (styled: 2, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal restores adjacent subject match (styled: 1, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion breaks complex following subject match (styled: 2, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal restores complex following subject match (styled: 1, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion updates non-subject sibling target (styled: 2, full passes: 0)-PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal updates non-subject sibling target (styled: 1, full passes: 0)+PASS: unrelated structural mutation skips :has walk: class / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: class / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: class / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: class / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: class / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: class / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: id / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: id / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: id / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: id / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: id / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: id / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: attribute / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: attribute / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: attribute / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: attribute / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: attribute / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: attribute / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: tag / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: tag / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: tag / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: tag / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: tag / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: tag / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: checked pseudo / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: checked pseudo / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: checked pseudo / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: checked pseudo / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: checked pseudo / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: disabled pseudo / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: disabled pseudo / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: disabled pseudo / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: disabled pseudo / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: disabled pseudo / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: required pseudo / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: required pseudo / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: required pseudo / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: required pseudo / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: required pseudo / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: required pseudo / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: compound class tag / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: compound class tag / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: compound class tag / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: compound class tag / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: compound class tag / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: compound class tag / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: is concrete class / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: is concrete class / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: is concrete class / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: is concrete class / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: is concrete class / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: is concrete class / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: where concrete tag / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: where concrete tag / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: where concrete tag / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: where concrete tag / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: where concrete tag / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: not-filtered concrete class / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: not-filtered concrete class / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: not-filtered concrete class / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other class (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other id (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other attribute (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append other tag (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append nested unrelated subtree (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append document fragment with unrelated children (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / remove unrelated child (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / move unrelated sibling before unrelated root (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / replace unrelated child with plain element (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / insert unrelated before anchor (restyled beyond the insertion: [])+PASS: unrelated structural mutation skips :has walk: selector-list concrete class / append unrelated after fixture (restyled beyond the insertion: [])+PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching nested descendant (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: selector-list concrete class / append matching fragment child (restyled beyond the insertion: [div.anchor])+PASS: related structural mutation keeps :has walk: selector-list concrete class / move matching child into anchor (restyled beyond the insertion: [div.anchor])+PASS: concrete :has argument keeps featureless mutation filtered: class / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: class / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: class / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: class / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: class / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: id / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: id / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: id / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: id / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: id / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: attribute / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: attribute / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: attribute / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: attribute / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: attribute / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: tag / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: tag / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: tag / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: tag / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: tag / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: compound / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: compound / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: compound / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: compound / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: compound / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: nested descendant / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: child / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: child / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: child / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: child / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: child / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: is concrete / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: is concrete / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: is concrete / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: where concrete / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: where concrete / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: where concrete / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: not still concrete / replace plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append plain nested subtree (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / append text node (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / remove plain child (restyled beyond the insertion: [])+PASS: concrete :has argument keeps featureless mutation filtered: selector list concrete / replace plain child (restyled beyond the insertion: [])+PASS: featureless-sensitive structural mutation keeps :has walk: child universal insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: descendant universal insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :not(class) insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: adjacent :not(class) starts matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: adjacent :not(class) stops matching (restyled beyond the insertion: [div.anchor, div.foo])+PASS: featureless-sensitive structural mutation keeps :has walk: following :not(id) starts matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: following :not(attribute) stops matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :not(tag) insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :is(:not(class)) insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :where(:not(attribute)) insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :not(class, id) insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: descendant :not(class) nested insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :empty insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :empty stops matching after text append (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :first-child insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :last-child insertion (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :only-child stops matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :nth-child(2) starts matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :nth-last-child(2) starts matching (restyled beyond the insertion: [div.anchor])+PASS: featureless-sensitive structural mutation keeps :has walk: child :only-of-type stops matching (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: descendant :focus insertion through wrapper with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus-within insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :focus-visible insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :default checkbox insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: descendant :default selected option insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :valid insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :invalid insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :open insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :read-only insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :read-write insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :is(:focus) insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: unprobeable pseudo structural mutation keeps :has walk: child :where(:invalid) insertion with unrelated metadata (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag insertion (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag nested insertion (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg camel-case tag inside html subtree (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg case-sensitive attribute insertion (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg case-sensitive attribute nested insertion (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: mathml case-sensitive attribute insertion (restyled beyond the insertion: [div.anchor])+PASS: case-sensitive name structural mutation keeps :has walk: svg lower-case selector does not match camel-case attribute (restyled beyond the insertion: [])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion breaks adjacent subject match (restyled beyond the insertion: [div.anchor])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal restores adjacent subject match (restyled beyond the insertion: [div.anchor])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion breaks complex following subject match (restyled beyond the insertion: [div.anchor])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal restores complex following subject match (restyled beyond the insertion: [div.anchor])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless insertion updates non-subject sibling target (restyled beyond the insertion: [div.target])+PASS: sibling relationship mutation keeps sibling-aware :has updates: featureless removal updates non-subject sibling target (restyled beyond the insertion: [div.target])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/has-subject-hover-skips-descendant-fanout.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/has-subject-hover-skips-descendant-fanout.txtindex 48ea7903783..f8fd5ee253e 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/has-subject-hover-skips-descendant-fanout.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/has-subject-hover-skips-descendant-fanout.txt@@ -1,3 +1,3 @@-PASS: subject :has() hover skips descendant fanout (styled <= 19: true)-PASS: batched subject-only :has() invalidation upgrades to descendant fanout (styled >= 1: true)+PASS: subject :has() hover skips descendant fanout (restyled: [span.hover-source])+PASS: batched subject-only :has() invalidation upgrades to descendant fanout (restyled: [span.target])PASS: descendant :has(:focus) fanout uses pseudo-class metadatadiff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/identical-elements-share-one-computed-style.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/identical-elements-share-one-computed-style.txtindex 3cb3cf46f25..b31effd12b2 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/identical-elements-share-one-computed-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/identical-elements-share-one-computed-style.txt@@ -1,2 +1,2 @@-PASS: alike siblings compute one style between them: true-PASS: an element's own declaration keeps its style its own: true+alike siblings: computed 1, shared 9, reused 0+siblings with declarations of their own: computed 10, shared 0, reused 0diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.txtindex dcc595e19e5..aa6e44e0870 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.txt@@ -1,2 +1,12 @@-identical markers: shared: 0, reused: 0+style PARTIAL+ li (computed, changed)+ li@2 (computed, changed)+ li@3 (computed, changed)+ li@4 (computed, changed)+ li@5 (computed, changed)+ li@6 (computed, changed)+ li@7 (computed, changed)+ li@8 (computed, changed)+ li@9 (computed, changed)+ li@10 (computed, changed)PASS: every marker inherited its color: truediff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/input-type-same-state-no-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/input-type-same-state-no-invalidation.txtindex 2744f9a66d6..866102fbfa5 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/input-type-same-state-no-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/input-type-same-state-no-invalidation.txt@@ -1 +1 @@-PASS: same-state type set stayed targeted+same-state type set restyled: []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-adopted-sheet-counters.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-adopted-sheet-counters.txtdeleted file mode 100644index e400e65a561..00000000000--- a/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-adopted-sheet-counters.txt+++ /dev/null@@ -1,15 +0,0 @@-PASS: adopt sheet with empty outer media (styled <= 1: true)-PASS: adopt sheet with outer media=all (styled <= 1: true)-PASS: adopt sheet with outer media=screen (matches) (styled <= 1: true)-PASS: adopt sheet with outer media=print (does not match) (styled <= 0: true)-PASS: adopt sheet with outer width media that matches (styled <= 1: true)-PASS: adopt sheet with outer width media that does not match (styled <= 0: true)-PASS: adopt sheet with rule that matches no element (styled <= 0: true)-PASS: adopt sheet with inner @media that matches (styled <= 1: true)-PASS: adopt sheet with inner @media that does not match (styled <= 0: true)-PASS: adopt sheet with non-matching outer media wrapping a matching inner @media (styled <= 0: true)-PASS: adopt sheet with multiple inner @media rules, all matching (styled <= 1: true)-PASS: adopt sheet with multiple inner @media rules, none matching (styled <= 0: true)-PASS: adopt sheet with mixed matching and non-matching inner @media rules (styled <= 1: true)-PASS: adopt sheet with nested inner @media rules (styled <= 1: true)-PASS: adopt sheet with @supports wrapping an inner @media (styled <= 1: true)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-style-element-counters.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-style-element-counters.txtdeleted file mode 100644index f88929cf544..00000000000--- a/Tests/LibWeb/Text/expected/css/style-invalidation/media-eval-style-element-counters.txt+++ /dev/null@@ -1,12 +0,0 @@-PASS: <style> with empty outer media (styled <= 2: true)-PASS: <style> with outer media=all (styled <= 2: true)-PASS: <style> with outer media=screen (matches) (styled <= 2: true)-PASS: <style> with outer media=print (does not match) (styled <= 1: true)-PASS: <style> with outer width media that matches (styled <= 2: true)-PASS: <style> with outer width media that does not match (styled <= 1: true)-PASS: <style> with rule that matches no element (styled <= 1: true)-PASS: <style> with inner @media that matches (styled <= 2: true)-PASS: <style> with inner @media that does not match (styled <= 1: true)-PASS: <style> with multiple inner @media rules, all matching (styled <= 2: true)-PASS: <style> with mixed matching and non-matching inner @media rules (styled <= 2: true)-PASS: <style> with nested inner @media rules (styled <= 2: true)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/media-list-shadow-mutation-counters.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/media-list-shadow-mutation-counters.txtdeleted file mode 100644index c6e3367d1a7..00000000000--- a/Tests/LibWeb/Text/expected/css/style-invalidation/media-list-shadow-mutation-counters.txt+++ /dev/null@@ -1,24 +0,0 @@-PASS: shadow media mutation activates bare :host selector (styled <= 5: true)-PASS: shadow media mutation activates classed :host selector (styled <= 5: true)-PASS: shadow media mutation activates attributed :host selector (styled <= 5: true)-PASS: shadow media mutation activates negated :host selector (styled <= 5: true)-PASS: shadow media mutation activates :host :is selector (styled <= 5: true)-PASS: shadow media mutation activates :host :where selector (styled <= 5: true)-PASS: shadow media mutation deactivates classed :host selector (styled <= 5: true)-PASS: shadow media appendMedium activates :host selector (styled <= 5: true)-PASS: shadow media deleteMedium deactivates :host selector (styled <= 5: true)-PASS: shadow media mutation activates internal rule guarded by :host (styled <= 5: true)-PASS: shadow media mutation activates ::slotted class selector (styled <= 5: true)-PASS: shadow media mutation activates ::slotted type and class selector (styled <= 5: true)-PASS: shadow media mutation activates ::slotted attribute selector (styled <= 5: true)-PASS: shadow media mutation activates ::slotted :is selector (styled <= 5: true)-PASS: shadow media mutation activates ::slotted :not selector (styled <= 5: true)-PASS: shadow media mutation activates named-slot ::slotted selector (styled <= 5: true)-PASS: shadow media mutation activates slotted background style (styled <= 5: true)-PASS: shadow media mutation activates bare slot inheritance (styled <= 5: true)-PASS: shadow media mutation activates named slot inheritance (styled <= 5: true)-PASS: shadow media mutation activates descendant slot inheritance (styled <= 5: true)-PASS: shadow media mutation activates nested host structure (styled <= 5: true)-PASS: shadow media mutation activates paragraph assigned node (styled <= 5: true)-PASS: shadow media mutation activates compound host and slotted selectors (styled <= 5: true)-PASS: shadow media mutation activates inner and slotted selectors together (styled <= 5: true)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/non-inherited-change-stops-above-children.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/non-inherited-change-stops-above-children.txtindex 6b6369bf077..6f9a9e07b74 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/non-inherited-change-stops-above-children.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/non-inherited-change-stops-above-children.txt@@ -1,5 +1,6 @@-PASS: a non-inherited change reaches no child (styled <= 1: true)-PASS: a child explicitly inheriting a non-inherited property is reached (styled <= 4: true)+PASS: a non-inherited change reaches no child (restyled: [plain])+background-color: rgb(0, 0, 255)+PASS: a child explicitly inheriting a non-inherited property is reached (restyled: [inheriting, span, span@2, span@3])explicitly inherited margin-left: 27px-PASS: an inherited change reaches every child (styled <= 4: true)+PASS: an inherited change reaches every child (restyled: [color-source, span, span@2, span@3])inherited color: rgb(0, 0, 255)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/opaque-selectors-restyle-around-the-change.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/opaque-selectors-restyle-around-the-change.txtindex 29574d98d7c..9073c13ebd2 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/opaque-selectors-restyle-around-the-change.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/opaque-selectors-restyle-around-the-change.txt@@ -1,9 +1,9 @@-unrelated class: styled <= 1: true, full passes 0-:nth-child(… of S) sibling: styled <= 6: true, full passes 0+unrelated class: restyled []+:nth-child(… of S) sibling: restyled [first, second, third, li, li@2]second: rgb(0, 0, 0), third: rgb(0, 128, 0)-@scope root: styled <= 4: true, full passes 0+@scope root: restyled [scope, scoped, limit, limited]scoped: rgb(0, 0, 255)-@scope limit: styled <= 2: true, full passes 0+@scope limit: restyled [limit, limited]limited: rgb(0, 0, 0)-host or ancestor: styled <= 3: true, full passes 0+host or ancestor: restyled [host, style, shadow-child]shadow child: rgb(255, 0, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/recomputed-elements-still-share-one-computed-style.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/recomputed-elements-still-share-one-computed-style.txtindex d83461d2c4e..c9b0a01e249 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/recomputed-elements-still-share-one-computed-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/recomputed-elements-still-share-one-computed-style.txt@@ -1 +1 @@-PASS: alike siblings share a recomputed style too: true+recomputed siblings: computed 1, shared 9, reused 0diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/same-parent-move-root-only.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/same-parent-move-root-only.txtindex ee5efdb85a7..be252b03dea 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/same-parent-move-root-only.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/same-parent-move-root-only.txt@@ -1,4 +1,4 @@-PASS: same-parent move preserves unchanged descendant styles (styled <= 51: true)+PASS: same-parent move preserves unchanged descendant styles: 51 of the 51 moved elements restyled (restyled beyond the insertion: [])PASS: same-parent move invalidates descendants: first-child descendant begins matchingPASS: same-parent move invalidates descendants: first-child child combinator begins matchingPASS: same-parent move invalidates descendants: first-child descendant stops matchingdiff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/scroll-state-container-move-scans.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/scroll-state-container-move-scans.txtindex 836363c04fb..658e0a51e0b 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/scroll-state-container-move-scans.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/scroll-state-container-move-scans.txt@@ -1,3 +1,3 @@dependent before the move: rgb(1, 2, 3)-elements styled after moving the container <= 4: true+elements styled after moving the container: [scroller, filler, span, span@2]dependent after the move: rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.txtindex 7ef22e9a431..b0a76126e4b 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.txt@@ -1 +1 @@-PASS+restyled: []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-first-child-pseudo-only.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-first-child-pseudo-only.txtdeleted file mode 100644index ac6b88f38bf..00000000000--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-first-child-pseudo-only.txt+++ /dev/null@@ -1 +0,0 @@-:first-child-only sheet add: styled 34, full passes 0diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-face-only.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-face-only.txtindex 83a49156562..5e514879c36 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-face-only.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-face-only.txt@@ -1 +1 @@-@font-face only sheet add: styled <= 1: true+@font-face only sheet add: restyled []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-feature-values-targeted.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-feature-values-targeted.txtindex 8316ec49442..01b50378b96 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-feature-values-targeted.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-font-feature-values-targeted.txt@@ -1,3 +1,3 @@-@font-feature-values nobody uses: styled <= 1: true, full passes 0-@font-feature-values one element uses: styled <= 2: true, full passes 0-@font-feature-values removed: styled <= 2: true, full passes 0+@font-feature-values nobody uses: restyled []+@font-feature-values one element uses: restyled [fancy]+@font-feature-values removed: restyled [fancy]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-hover-pseudo-only.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-hover-pseudo-only.txtindex c619be8c167..d0b82b76618 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-hover-pseudo-only.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-hover-pseudo-only.txt@@ -1 +1 @@-:hover-only sheet add: styled <= 1: true+:hover-only sheet add: restyled []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-keyframes-only-shadow-host.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-keyframes-only-shadow-host.txtindex d75ebf0ba4e..882498c4691 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-keyframes-only-shadow-host.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-keyframes-only-shadow-host.txt@@ -1 +1,2 @@-@keyframes only sheet add (host animation-name via :host): styled <= 1: true+@keyframes only sheet add (host animation-name via :host): restyled [style]+host opacity: 0.25diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-registration-rules-targeted.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-registration-rules-targeted.txtindex ff5baa8cede..b29ec263336 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-registration-rules-targeted.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sheet-add-registration-rules-targeted.txt@@ -1,9 +1,9 @@-@property nobody uses: styled <= 1: true, full passes 0-@property a parent declares: styled <= 6: true, full passes 0+@property nobody uses: restyled [caller]+@property a parent declares: restyled [parent, inheritor, reader, caller]parent: 10pxinheritor: 3px-CSS.registerProperty() one element reads: styled <= 2: true, full passes 0+CSS.registerProperty() one element reads: restyled [reader, caller]reader: rgb(0, 128, 0)-@counter-style nobody uses: styled <= 1: true, full passes 0-@function one element calls: styled <= 2: true, full passes 0+@counter-style nobody uses: restyled []+@function one element calls: restyled [caller]caller: 10pxdiff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/sibling-structural-invalidation-root-only.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/sibling-structural-invalidation-root-only.txtindex 3956ebf8650..dd8fb572e7f 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/sibling-structural-invalidation-root-only.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/sibling-structural-invalidation-root-only.txt@@ -1,10 +1,10 @@-PASS: prepend before :first-child sibling does not recompute its descendants (styled <= 10: true)-PASS: prepend before :first-child sibling recomputes descendants when a descendant selector depends on it (styled <= 9: true)-PASS: append after :last-child sibling does not recompute its descendants (styled <= 10: true)-PASS: breaking adjacent sibling combinator does not recompute descendants (styled <= 10: true)-PASS: starting adjacent sibling descendant match recomputes descendants (styled <= 2: true)-PASS: starting general sibling descendant match recomputes descendants (styled <= 2: true)-PASS: prepend before :nth-child(1) sibling does not recompute its descendants (styled <= 10: true)+PASS: prepend before :first-child sibling does not recompute its descendants (restyled: [div, div.watcher, span.leaf, span.leaf@2, span.leaf@3, span.leaf@4, span.leaf@5, span.leaf@6, span.leaf@7, span.leaf@8])+PASS: prepend before :first-child sibling recomputes descendants when a descendant selector depends on it (restyled: [div, span.leaf, span.leaf@2, span.leaf@3, span.leaf@4, span.leaf@5, span.leaf@6, span.leaf@7, span.leaf@8])+PASS: append after :last-child sibling does not recompute its descendants (restyled: [div.watcher, span.leaf, span.leaf@2, span.leaf@3, span.leaf@4, span.leaf@5, span.leaf@6, span.leaf@7, span.leaf@8, div])+PASS: breaking adjacent sibling combinator does not recompute descendants (restyled: [div, div.watcher, span.leaf, span.leaf@2, span.leaf@3, span.leaf@4, span.leaf@5, span.leaf@6, span.leaf@7, span.leaf@8])+PASS: starting adjacent sibling descendant match recomputes descendants (restyled: [div.anchor, span.leaf])+PASS: starting general sibling descendant match recomputes descendants (restyled: [div.anchor, span.leaf])+PASS: prepend before :nth-child(1) sibling does not recompute its descendants (restyled: [div, div.watcher, span.leaf, span.leaf@2, span.leaf@3, span.leaf@4, span.leaf@5, span.leaf@6, span.leaf@7, span.leaf@8])PASS: shadow host loses :first-child inherited color after prependPASS: shadow host gains :first-child inherited color after previous removalPASS: shadow host loses :last-child inherited color after appenddiff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/size-query-container-scans.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/size-query-container-scans.txtindex 9ea7783b17b..c57d49fa321 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/size-query-container-scans.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/size-query-container-scans.txt@@ -1,5 +1,7 @@dependent before: rgb(0, 0, 0)-PASS: a block-size-only container relayout styles only the container (styled <= 1: true)-PASS: resizing a container no query names styles only the container (styled <= 1: true)-PASS: resizing the query container styles it and its dependent (styled <= 2: true)+PASS: a block-size-only container relayout styles only the container (restyled: [queried])+queried height: 20px+PASS: resizing a container no query names styles only the container (restyled: [unqueried])+unqueried width: 400px+PASS: resizing the query container styles it and its dependent (restyled: [queried, dependent])dependent after: rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/slotted-argument-slot-early-out.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/slotted-argument-slot-early-out.txtindex d3fe5d2fc36..e5fe587d544 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/slotted-argument-slot-early-out.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/slotted-argument-slot-early-out.txt@@ -1,3 +1,3 @@-PASS: matching ::slotted() against a shadow tree slot (styled <= 0: true)-PASS: matching ::slotted() against a slotted element (styled <= 0: true)-PASS: matching simple ::slotted() against a slotted element (styled <= 0: true)+PASS: matching ::slotted() against a shadow tree slot (restyled: [])+PASS: matching ::slotted() against a slotted element (restyled: [])+PASS: matching simple ::slotted() against a slotted element (restyled: [])diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/style-query-container-scans.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/style-query-container-scans.txtindex 84e9105b3de..c622b519841 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/style-query-container-scans.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/style-query-container-scans.txt@@ -1,5 +1,6 @@dependent before: rgb(0, 0, 0)-PASS: a change on an element no query names styles only that element (styled <= 1: true)+PASS: a change on an element no query names styles only that element (restyled: [unqueried])+unqueried background-color: rgb(0, 0, 255)dependent after unrelated change: rgb(0, 0, 0)-PASS: a change on the query container styles its subtree (styled <= 3: true)+PASS: a change on the query container styles its subtree (restyled: [queried, dependent])dependent after: rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.txtindex bd973fa735a..ed245724354 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.txt@@ -1,3 +1,6 @@-PASS: a read after a non-inherited change marks no child (styled: 4, full passes: 0)-PASS: a read marks a child explicitly inheriting a non-inherited property (styled <= 4: true)-PASS: a read after an inherited change marks every child (styled <= 4: true)+PASS: a read after a non-inherited change marks no child (restyled: [plain, span, span@2, span@3])+background-color: rgb(0, 0, 255)+PASS: a read marks a child explicitly inheriting a non-inherited property (restyled: [inheriting, span, span@2, span@3])+explicitly inherited margin-left: 27px+PASS: a read after an inherited change marks every child (restyled: [color-source, span, span@2, span@3])+inherited color: rgb(0, 0, 255)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/url-change-skips-full-document-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/url-change-skips-full-document-invalidation.txtindex 15a9c04f17b..d202104f4b6 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/url-change-skips-full-document-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/url-change-skips-full-document-invalidation.txt@@ -1,3 +1,5 @@-PASS: no :local-link rule (styled <= 0: true)-PASS: :local-link rule, anchor flips (styled <= 1: true)-PASS: shadow-only :local-link rule, shadow anchor flips (styled: 2, full passes: 0)+PASS: no :local-link rule (restyled: [])+PASS: :local-link rule, anchor flips (restyled: [same-doc])+same-doc color: rgb(0, 128, 0)+PASS: shadow-only :local-link rule, shadow anchor flips (restyled: [same-doc, shadow-anchor])+shadow-anchor color: rgb(0, 0, 128)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.txtindex 54d90d75889..83d4103176c 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.txt@@ -1,4 +1,7 @@-plain text hover: styled <= 0: true-link hover: styled <= 1: true+plain text hover: restyled []+link hover: restyled [link]link color: rgb(0, 128, 0)-active state: styled <= 4: true+active state: restyled [link, active-target, active-sibling, active-ancestor-descendant]+active-target color: rgb(1, 2, 3)+active-sibling color: rgb(4, 5, 6)+active-ancestor-descendant color: rgb(7, 8, 9)diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-animation-targeted-restyle.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-animation-targeted-restyle.txtindex e560ebde757..d1f9f819482 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-animation-targeted-restyle.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-animation-targeted-restyle.txt@@ -11,4 +11,4 @@ resized root-font animated width: 75pxresized animated font size: 75pxresized animated inherited-font width: 112.5pxresized post-style animated width: 75px-resize restyle: styled 12 of 13 elements+resize restyle passes: PARTIAL [html, head, body, viewport-target, font-source, inherited-font-target, root-font-target, animated-font-source, pending-outline-animation-target, post-style-animation-target, script], PARTIAL [animated-inherited-font-target]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.txtindex f653e7620c0..d2dfd914b47 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.txt@@ -4,5 +4,4 @@ initial outline width: 1pxupdated device pixel ratio: 2updated border width: 0.5pxupdated outline width: 0.5px-target restyled: true-every element restyled: false+passes: [PARTIAL], restyled: [html, target]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-media-query-evaluation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-media-query-evaluation.txtindex 76ca9554e0a..cf9119f36bf 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-media-query-evaluation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-media-query-evaluation.txt@@ -4,7 +4,7 @@ initial nested color: rgb(255, 0, 0)targeted canvas fill style: #008000resized color: rgb(0, 128, 0)resized nested color: rgb(0, 0, 255)-media query restyle stays targeted: true+media query restyle passes: PARTIAL [target, canvas-target, span.nested-target]resized back color: rgb(255, 0, 0)resized back nested color: rgb(255, 0, 0)-media query restyle after resize back stays targeted: true+media query restyle passes after resize back: PARTIAL [target, canvas-target, span.nested-target]diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-shadow-broad-invalidation.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-shadow-broad-invalidation.txtindex e13a1bea96f..ee8c4afb3e8 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-shadow-broad-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-shadow-broad-invalidation.txt@@ -1,5 +1,5 @@initial shadow host color: rgb(255, 0, 0)resized shadow host color: rgb(255, 0, 0)-resized: styled 0, full passes: 0+resized: passes [], restyled []resized back shadow host color: rgb(255, 0, 0)-resized back: styled 0, full passes: 0+resized back: passes [], restyled []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-targeted-restyle.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-targeted-restyle.txtindex 96a625dacbe..95f0bd11c2b 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-targeted-restyle.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/viewport-resize-targeted-restyle.txt@@ -9,4 +9,4 @@ explicit inherit width: 50pxpseudo width: 50pxpseudo originating font size: 50pxpseudo inherited font size: 50px-root font metrics recompute descendants: true+resize restyle: passes [PARTIAL], elements not restyled [style]diff --git a/Tests/LibWeb/Text/expected/css/style-sharing-across-shadow-roots-with-same-font.txt b/Tests/LibWeb/Text/expected/css/style-sharing-across-shadow-roots-with-same-font.txtindex 8537e6ae940..3db0e4c4a43 100644--- a/Tests/LibWeb/Text/expected/css/style-sharing-across-shadow-roots-with-same-font.txt+++ b/Tests/LibWeb/Text/expected/css/style-sharing-across-shadow-roots-with-same-font.txt@@ -1,4 +1,6 @@-full passes for 20 more shadow trees: 0-shared elements: 20+passes for 20 more shadow trees: PARTIAL+computed: div x1, style x20, p x20, span x20+shared: span x20+reused: div x19span font: 13px 700all spans alike: truediff --git a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.txt b/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.txtdeleted file mode 100644index 6bd7267bb5e..00000000000--- a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.txt+++ /dev/null@@ -1,2 +0,0 @@-inactive media stylesheet add publishes no broad reactions, styled <= 1: true-inactive media stylesheet remove publishes no broad reactions, styled <= 1: truediff --git a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-layer-order-invalidation.txt b/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-layer-order-invalidation.txtdeleted file mode 100644index d1c3ff1b356..00000000000--- a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-layer-order-invalidation.txt+++ /dev/null@@ -1,3 +0,0 @@-layer-only stylesheet add restyles nothing but itself, styled <= 1: true-layer-only stylesheet remove restyles nothing but itself, styled <= 1: true-PASS: layer reorder reaches the layered elementdiff --git a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-style-invalidation-counters.txt b/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-style-invalidation-counters.txtdeleted file mode 100644index ccb8c5afdf3..00000000000--- a/Tests/LibWeb/Text/expected/css/stylesheet-add-remove-style-invalidation-counters.txt+++ /dev/null@@ -1,3 +0,0 @@-document stylesheet add stays bounded, styled <= 4: true-shadow stylesheet add stays bounded, styled <= 4: true-pseudo-only stylesheet removal stays bounded, styled <= 2: truediff --git a/Tests/LibWeb/Text/expected/css/text-decoration-line-style-sharing.txt b/Tests/LibWeb/Text/expected/css/text-decoration-line-style-sharing.txtindex 242d9b54808..4e7ab57935b 100644--- a/Tests/LibWeb/Text/expected/css/text-decoration-line-style-sharing.txt+++ b/Tests/LibWeb/Text/expected/css/text-decoration-line-style-sharing.txt@@ -1,4 +1,10 @@nonenonenone-spans taking another's record >= 2: true+style PARTIAL+ div.underline (computed, changed)+ span (computed, changed)+ div.overline (computed, changed)+ span@2 (reused, changed)+ div.line-through (computed, changed)+ span@3 (reused, changed)diff --git a/Tests/LibWeb/Text/expected/css/user-agent-selectors-compile-once-per-process.txt b/Tests/LibWeb/Text/expected/css/user-agent-selectors-compile-once-per-process.txtindex fb8629ca1c3..1205fb52f49 100644--- a/Tests/LibWeb/Text/expected/css/user-agent-selectors-compile-once-per-process.txt+++ b/Tests/LibWeb/Text/expected/css/user-agent-selectors-compile-once-per-process.txt@@ -1,5 +1,3 @@margin-top from the user-agent sheet: 16px-user-agent rule index shared, not built: true-no user-agent selector compiled again: true-index builds for the added rule: 0-selectors compiled for the added rule, at most its two: true+what the frame did to its rules: [rule index built]+what the added rule did to the rule index: [rule index updated, selectors compiled x2]diff --git a/Tests/LibWeb/Text/input/canvas/canvas-font-reads-settled-style-without-rematching.html b/Tests/LibWeb/Text/input/canvas/canvas-font-reads-settled-style-without-rematching.htmlindex d463cd7de17..0dc8cb73c73 100644--- a/Tests/LibWeb/Text/input/canvas/canvas-font-reads-settled-style-without-rematching.html+++ b/Tests/LibWeb/Text/input/canvas/canvas-font-reads-settled-style-without-rematching.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>#wrapper { font-size: 20px; }.item { color: green; }@@ -18,19 +19,17 @@items.insertAdjacentHTML("beforeend", `<div class="item"><span>Item ${i}</span></div>`);const context = canvas.getContext("2d");- internals.updateStyle();- internals.resetStyleCounters();const fonts = [];- for (let i = 0; i < 10; i++) {- context.font = `${1 + i / 10}em serif`;- fonts.push(context.font);- }+ const work = styleWork(() => {+ for (let i = 0; i < 10; i++) {+ context.font = `${1 + i / 10}em serif`;+ fonts.push(context.font);+ }+ }, internals, { flush: false });- const counters = internals.styleCounters();println(`fonts: ${fonts.join(", ")}`);- println(`passes == 0: ${counters.passes === 0}`);- println(`styled == 0: ${counters.styledElements === 0}`);+ println(`font reads: passes [${work.passes().join(", ")}], restyled [${work.restyled().map(shortStyleName).join(", ")}]`);// The font follows a change of the canvas's own style.wrapper.style.fontSize = "25px";diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/_helpers.js b/Tests/LibWeb/Text/input/css-has-invalidation/_helpers.jsdeleted file mode 100644index 01fee6badb5..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/_helpers.js+++ /dev/null@@ -1,31 +0,0 @@-// Shared helpers for :has() invalidation tests.-// Each test includes include.js first, then this file.--// Forget what the style engine counted so far, so that the next mutation is measured alone.-function resetCounters() {- internals.resetStyleCounters();-}--// Print how many elements the style engine styled since the counters were last reset. With a bound, print-// only whether the count stays within it.-function printCounters(label, bound) {- const styled = internals.styleCounters().styledElements;- println(`[${label}]`);- if (bound === undefined) {- println(` styled: ${styled}`);- } else {- println(` styled <= ${bound}: ${styled <= bound}`);- }-}--// Have the style engine own the document, settle style and reset the counters, so that a subsequent-// mutation can be measured in isolation.-function settleAndReset(triggerElement) {- internals.updateStyle();- document.documentElement.classList.add("__settle__");- getComputedStyle(triggerElement || document.documentElement).color;- document.documentElement.classList.remove("__settle__");- getComputedStyle(triggerElement || document.documentElement).color;- internals.updateStyle();- resetCounters();-}diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-cache-hits.html b/Tests/LibWeb/Text/input/css-has-invalidation/baseline-cache-hits.htmldeleted file mode 100644index c318fb3ea0a..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-cache-hits.html+++ /dev/null@@ -1,30 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- /* Many sibling anchors with the same :has() selector. Each sibling will be- tested during a single style pass. The HasResultCache should absorb repeat- matches against the same anchor. */- .anchor:has(.match) { color: red; }- .anchor:has(.match) + .anchor { color: blue; }-</style>-<div id="container">- <div class="anchor"><span>x</span></div>- <div class="anchor"><span>x</span></div>- <div class="anchor"><span>x</span></div>- <div class="anchor"><span>x</span></div>- <div class="anchor"><span class="match" id="target">x</span></div>-</div>-<script>- test(() => {- getComputedStyle(document.getElementById("container")).color;- internals.updateStyle();- internals.updateStyle();- resetCounters();-- // Removing the .match class forces re-match on all anchors in the next pass.- document.getElementById("target").classList.remove("match");- internals.updateStyle();- printCounters("after remove .match", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-no-has.html b/Tests/LibWeb/Text/input/css-has-invalidation/baseline-no-has.htmldeleted file mode 100644index c78635222ae..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-no-has.html+++ /dev/null@@ -1,23 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor .descendant { color: red; }-</style>-<div class="anchor">- <div>- <span id="target">target</span>- </div>-</div>-<script>- test(() => {- getComputedStyle(document.getElementById("target")).color;- internals.updateStyle();- resetCounters();-- // No :has() in any stylesheet: walk must not run, no matches should happen.- document.getElementById("target").classList.add("descendant");- getComputedStyle(document.getElementById("target")).color;- printCounters("after add .descendant (no :has() in sheet)", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-non-subject-has.html b/Tests/LibWeb/Text/input/css-has-invalidation/baseline-non-subject-has.htmldeleted file mode 100644index d1e7f8d3ec2..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-non-subject-has.html+++ /dev/null@@ -1,27 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) .styled { color: red; }-</style>-<div id="a1">- <div id="a2" class="anchor">- <div id="a3">- <span id="styled" class="styled">styled</span>- <span id="target">target</span>- </div>- </div>-</div>-<script>- test(() => {- getComputedStyle(document.getElementById("styled")).color;- internals.updateStyle();- resetCounters();-- // Non-subject :has(): the :has() qualifies an ancestor, styling descendants.- // Adding .match on target should invalidate the anchor path and re-style .styled.- document.getElementById("target").classList.add("match");- getComputedStyle(document.getElementById("styled")).color;- printCounters("after add .match on target", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-sibling-has.html b/Tests/LibWeb/Text/input/css-has-invalidation/baseline-sibling-has.htmldeleted file mode 100644index e0871d801a6..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-sibling-has.html+++ /dev/null@@ -1,25 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(+ .match) { color: red; }-</style>-<div id="a1">- <div id="a2">- <span id="anchor" class="anchor">anchor</span>- <span id="target">target</span>- </div>-</div>-<script>- test(() => {- getComputedStyle(document.getElementById("anchor")).color;- internals.updateStyle();- resetCounters();-- // Sibling combinator in :has(). Anchor has sibling-combinator flag,- // so invalidation must also walk siblings of each visited ancestor.- document.getElementById("target").classList.add("match");- getComputedStyle(document.getElementById("anchor")).color;- printCounters("after add .match on adjacent sibling", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-subject-has.html b/Tests/LibWeb/Text/input/css-has-invalidation/baseline-subject-has.htmldeleted file mode 100644index 49e56de7594..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/baseline-subject-has.html+++ /dev/null@@ -1,37 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) { color: red; }-</style>-<div id="a1">- <div id="a2">- <div id="a3" class="anchor">- <div id="a4">- <div id="a5">- <span id="target">target</span>- </div>- </div>- </div>- </div>-</div>-<script>- test(() => {- // Force a style pass before measuring so initial-matching counters are not in scope.- getComputedStyle(document.getElementById("a3")).color;- internals.updateStyle();- resetCounters();-- // Subject-position :has() mutation: add matching class to deep descendant.- document.getElementById("target").classList.add("match");- getComputedStyle(document.getElementById("a3")).color;- printCounters("after add .match on target", 4);-- resetCounters();-- // Remove the class again.- document.getElementById("target").classList.remove("match");- getComputedStyle(document.getElementById("a3")).color;- printCounters("after remove .match on target", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/cold-shadow-root-sheet-insights.html b/Tests/LibWeb/Text/input/css-has-invalidation/cold-shadow-root-sheet-insights.htmldeleted file mode 100644index f921a470e0b..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/cold-shadow-root-sheet-insights.html+++ /dev/null@@ -1,55 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<script>- function settleDocumentStyle() {- document.documentElement.classList.toggle("__settle__");- getComputedStyle(document.body).color;- document.documentElement.classList.toggle("__settle__");- getComputedStyle(document.body).color;- resetCounters();- }-- test(() => {- const noHasSheet = new CSSStyleSheet();- noHasSheet.replaceSync(".target { color: green; }");-- internals.updateStyle();- settleDocumentStyle();-- const shadowRoots = [];- for (let i = 0; i < 25; ++i) {- const host = document.createElement("div");- document.body.appendChild(host);- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.adoptedStyleSheets = [noHasSheet];- shadowRoots.push(shadowRoot);- }-- for (const shadowRoot of shadowRoots) {- const target = document.createElement("span");- target.className = "target";- shadowRoot.appendChild(target);- }- getComputedStyle(document.body).color;-- printCounters("cold shadow roots without :has()", 50);-- const hasSheet = new CSSStyleSheet();- hasSheet.replaceSync(":host(:has(.target)) { color: red; }");-- settleDocumentStyle();-- const host = document.createElement("div");- document.body.appendChild(host);- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.adoptedStyleSheets = [hasSheet];-- const target = document.createElement("span");- target.className = "target";- host.appendChild(target);- println(getComputedStyle(host).color);-- printCounters("cold shadow root with :has()", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/deep-dom-with-anchor-halfway.html b/Tests/LibWeb/Text/input/css-has-invalidation/deep-dom-with-anchor-halfway.htmldeleted file mode 100644index da10ab1e2f0..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/deep-dom-with-anchor-halfway.html+++ /dev/null@@ -1,29 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) { color: red; }-</style>-<!-- 10-deep chain, anchor sits at depth 5. Mutation at depth 10.- The walker must stop at depth ~4 (the ancestor just above the anchor),- not walk to the document root. -->-<div id="d1">-<div id="d2">-<div id="d3">-<div id="d4">-<div id="anchor" class="anchor">-<div id="d6">-<div id="d7">-<div id="d8">-<div id="d9">-<span id="target">target</span>-</div></div></div></div></div></div></div></div></div>-<script>- test(() => {- settleAndReset();-- document.getElementById("target").classList.add("match");- internals.updateStyle();- printCounters("add .match at depth 10 (anchor at depth 5)", 6);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/fast-path-unrelated-mutation.html b/Tests/LibWeb/Text/input/css-has-invalidation/fast-path-unrelated-mutation.htmldeleted file mode 100644index a86987de1f7..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/fast-path-unrelated-mutation.html+++ /dev/null@@ -1,38 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) { color: red; }-</style>-<!-- "anchor" is one subtree. "outside" is another subtree that has no :has()- rule pointing at it. Mutations inside "outside" must not walk any :has()- ancestors. -->-<div id="wrapper">- <div class="anchor"><span class="match">a</span></div>- <div id="outside">- <div>- <div>- <span id="target">target</span>- </div>- </div>- </div>-</div>-<script>- test(() => {- settleAndReset();-- // The class "unrelated" is not used in any selector (including :has()).- // The walker should not run at all.- document.getElementById("target").classList.add("unrelated");- getComputedStyle(document.getElementById("target")).color;- printCounters("add unrelated class outside any :has() scope", 1);-- resetCounters();-- // The class "match" IS used in :has(.match), but target is not inside- // any anchor's scope. The walker should still terminate immediately.- document.getElementById("target").classList.add("match");- getComputedStyle(document.getElementById("target")).color;- printCounters("add .match class outside any :has() scope", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-child-combinator.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-child-combinator.htmldeleted file mode 100644index 36299a7dd84..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-child-combinator.html+++ /dev/null@@ -1,30 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(> .match) { color: red; }-</style>-<div class="anchor" id="anchor">- <div id="child">- <span id="grandchild">grandchild</span>- </div>-</div>-<script>- test(() => {- settleAndReset();-- // Adding .match to a direct child should invalidate.- document.getElementById("child").classList.add("match");- internals.updateStyle();- printCounters("add .match to direct child", 3);-- resetCounters();-- // Adding .match to a grandchild is NOT enough for :has(> .match);- // the anchor should stay unstyled. The walker may still run if the- // grandchild is in_has_scope (walked during initial match attempt).- document.getElementById("grandchild").classList.add("match");- internals.updateStyle();- printCounters("add .match to grandchild (should not style anchor)", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-complex-sibling-subtree-scan-insights.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-complex-sibling-subtree-scan-insights.htmldeleted file mode 100644index 7c6c5d5143a..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-complex-sibling-subtree-scan-insights.html+++ /dev/null@@ -1,31 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(+ .wrapper .match) { color: red; }-</style>-<div id="outer">- <div id="anchor" class="anchor">anchor</div>- <div class="wrapper">- <div>- <div>- <span id="target">target</span>- </div>- </div>- </div>- <div>unrelated sibling</div>-</div>-<script>- test(() => {- let anchor = document.getElementById("anchor");- let target = document.getElementById("target");-- getComputedStyle(anchor).color;- internals.updateStyle();- resetCounters();-- target.classList.add("match");- getComputedStyle(anchor).color;- printCounters("add .match", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-control-no-has-with-text-insert.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-control-no-has-with-text-insert.htmldeleted file mode 100644index 370c0239d10..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-control-no-has-with-text-insert.html+++ /dev/null@@ -1,18 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- /* No :has() rule. Same DOM and mutation as has-empty-pseudo so the- difference in matching counters isolates the :has()-specific cost. */-</style>-<div class="anchor" id="anchor">- <div id="target"></div>-</div>-<script>- test(() => {- settleAndReset();- document.getElementById("target").appendChild(document.createTextNode("x"));- getComputedStyle(document.getElementById("anchor")).color;- printCounters("after text insert (no :has() rule)", 0);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-feature-metadata-buckets.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-feature-metadata-buckets.htmldeleted file mode 100644index 9bf721f0c37..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-feature-metadata-buckets.html+++ /dev/null@@ -1,44 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor-a:has(.match-a) { color: red; }- .anchor-b:has(.match-b) { color: red; }- .anchor-c:has(.shared) { color: red; }- .anchor-d:has(.shared) { color: red; }-</style>-<div class="anchor-a"><span class="match-a">a</span></div>-<div class="anchor-b"><span class="match-b">b</span></div>-<div class="anchor-c"><span class="shared">c</span></div>-<div class="anchor-d"><span class="shared">d</span></div>--<div id="outside">- <span id="unrelated-target">u</span>- <span id="single-target">s</span>- <span id="shared-target">m</span>-</div>-<script>- test(() => {- let unrelatedTarget = document.getElementById("unrelated-target");- let singleTarget = document.getElementById("single-target");- let sharedTarget = document.getElementById("shared-target");-- settleAndReset();-- unrelatedTarget.classList.add("unrelated");- getComputedStyle(unrelatedTarget).color;- printCounters("add unrelated class", 1);-- resetCounters();-- singleTarget.classList.add("match-a");- getComputedStyle(singleTarget).color;- printCounters("add class referenced by one :has()", 1);-- resetCounters();-- sharedTarget.classList.add("shared");- getComputedStyle(sharedTarget).color;- printCounters("add class referenced by two :has() rules", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-order-insensitive-plan-merge.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-order-insensitive-plan-merge.htmldeleted file mode 100644index a028139ab42..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-order-insensitive-plan-merge.html+++ /dev/null@@ -1,28 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(:is(.outer-a, .outer-b) :is(.inner-a, .inner-b) .leaf) { color: red; }- .anchor:has(:is(.outer-b, .outer-a) :is(.inner-b, .inner-a) .leaf) { color: red; }- .anchor:has(:is(.outer-a, .outer-b) :is(.inner-b, .inner-a) .leaf) { color: red; }- .anchor:has(:is(.outer-b, .outer-a) :is(.inner-a, .inner-b) .leaf) { color: red; }-</style>-<div class="anchor" id="anchor">- <div class="outer-a" id="outer">- <div class="inner-b" id="inner">- <span id="target">leaf</span>- </div>- </div>-</div>-<script>- test(() => {- let anchor = document.getElementById("anchor");- let target = document.getElementById("target");-- settleAndReset(anchor);-- target.classList.add("leaf");- internals.updateStyle();- printCounters("after add .leaf", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-sibling-scan-insights.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-sibling-scan-insights.htmldeleted file mode 100644index 960b2528b9e..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-sibling-scan-insights.html+++ /dev/null@@ -1,36 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style id="test-style">- .anchor:has(.match) { color: red; }-</style>-<div id="outer">- <div id="anchor" class="anchor">- <div><span id="target">target</span></div>- </div>- <div>unrelated sibling</div>-</div>-<script>- test(() => {- let anchor = document.getElementById("anchor");- let target = document.getElementById("target");- let style = document.getElementById("test-style");-- getComputedStyle(anchor).color;- internals.updateStyle();- resetCounters();-- target.classList.add("match");- getComputedStyle(anchor).color;- printCounters("descendant-only :has() sheet", 3);-- target.classList.remove("match");- style.textContent += "\n.unused-anchor:has(+ .unused-match) { color: blue; }";- getComputedStyle(anchor).color;- resetCounters();-- target.classList.add("match");- getComputedStyle(anchor).color;- printCounters("sheet with sibling-sensitive :has()", 3);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-subsequent-sibling.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-subsequent-sibling.htmldeleted file mode 100644index 8e43e2df07f..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-subsequent-sibling.html+++ /dev/null@@ -1,21 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(~ .match) { color: red; }-</style>-<div>- <span id="anchor" class="anchor">anchor</span>- <span>between</span>- <span id="far-sibling">far</span>-</div>-<script>- test(() => {- settleAndReset();-- // Add .match to a non-adjacent later sibling: anchor should restyle.- document.getElementById("far-sibling").classList.add("match");- internals.updateStyle();- printCounters("add .match to non-adjacent later sibling", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-attribute.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-with-attribute.htmldeleted file mode 100644index 1c790716b72..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-attribute.html+++ /dev/null@@ -1,24 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has([data-matched]) { color: red; }-</style>-<div class="anchor" id="anchor">- <span id="target">target</span>-</div>-<script>- test(() => {- settleAndReset();-- document.getElementById("target").setAttribute("data-matched", "");- internals.updateStyle();- printCounters("set data-matched attribute", 2);-- resetCounters();-- document.getElementById("target").removeAttribute("data-matched");- internals.updateStyle();- printCounters("remove data-matched attribute", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-is.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-with-is.htmldeleted file mode 100644index 8ad876021ec..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-is.html+++ /dev/null@@ -1,29 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(:is(.a, .b)) { color: red; }-</style>-<div class="anchor" id="anchor">- <div>- <span id="target">target</span>- </div>-</div>-<script>- test(() => {- settleAndReset();-- // .a is in the :is() branch - anchor should restyle.- document.getElementById("target").classList.add("a");- internals.updateStyle();- printCounters("add .a (matches :is() branch)", 3);-- resetCounters();-- // Replace .a with .b - anchor still matches via the other :is() branch.- document.getElementById("target").classList.remove("a");- document.getElementById("target").classList.add("b");- internals.updateStyle();- printCounters("swap to .b (other :is() branch)", 3);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-not.html b/Tests/LibWeb/Text/input/css-has-invalidation/has-with-not.htmldeleted file mode 100644index 3f7f58f80d4..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-with-not.html+++ /dev/null@@ -1,28 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:not(:has(.x)) { color: red; }-</style>-<!-- Negated :has(). When .x appears inside the anchor, the rule stops matching;- when .x disappears, it starts matching. -->-<div class="anchor" id="anchor">- <div>- <span id="target">target</span>- </div>-</div>-<script>- test(() => {- settleAndReset();-- document.getElementById("target").classList.add("x");- internals.updateStyle();- printCounters("add .x (anchor should stop being styled)", 3);-- resetCounters();-- document.getElementById("target").classList.remove("x");- internals.updateStyle();- printCounters("remove .x (anchor should be styled again)", 3);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/insertion-triggers-has.html b/Tests/LibWeb/Text/input/css-has-invalidation/insertion-triggers-has.htmldeleted file mode 100644index 192173e2348..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/insertion-triggers-has.html+++ /dev/null@@ -1,31 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) { color: red; }-</style>-<div class="anchor" id="anchor">- <div id="container">- <span>existing</span>- </div>-</div>-<script>- test(() => {- settleAndReset();-- // Insert an already-matching element. The freshly inserted node has- // no in_has_scope flag; invalidation must run via the parent.- const child = document.createElement("span");- child.className = "match";- document.getElementById("container").appendChild(child);- internals.updateStyle();- printCounters("insert <span class='match'> into anchor subtree", 4);-- resetCounters();-- // Remove the matching element. Anchor should unstyle.- child.remove();- internals.updateStyle();- printCounters("remove the matching span", 3);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/multiple-has-rules.html b/Tests/LibWeb/Text/input/css-has-invalidation/multiple-has-rules.htmldeleted file mode 100644index e4396b57152..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/multiple-has-rules.html+++ /dev/null@@ -1,28 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- /* Two different :has() rules on the same anchor. Each has a different- argument, so changes to either argument class should trigger match- re-evaluation. */- .anchor:has(.red) { color: red; }- .anchor:has(.blue) { background: blue; }-</style>-<div class="anchor" id="anchor">- <span id="target">target</span>-</div>-<script>- test(() => {- settleAndReset();-- document.getElementById("target").classList.add("red");- internals.updateStyle();- printCounters("add .red (only :has(.red) flips)", 2);-- resetCounters();-- document.getElementById("target").classList.add("blue");- internals.updateStyle();- printCounters("add .blue (only :has(.blue) flips, .red stable)", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/unstyled-shadow-root-mutation.html b/Tests/LibWeb/Text/input/css-has-invalidation/unstyled-shadow-root-mutation.htmldeleted file mode 100644index 8ecbe4065d8..00000000000--- a/Tests/LibWeb/Text/input/css-has-invalidation/unstyled-shadow-root-mutation.html+++ /dev/null@@ -1,23 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>-<style>- .anchor:has(.match) { color: red; }-</style>-<div class="anchor" id="anchor">- <span class="match"></span>-</div>-<div id="host"></div>-<script>- test(() => {- const shadowRoot = host.attachShadow({ mode: "open" });- settleAndReset(anchor);-- const child = document.createElement("span");- child.className = "match";- shadowRoot.appendChild(child);-- println(getComputedStyle(anchor).color);- printCounters("insert matching element into unstyled shadow root", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/child-change-no-op-invalidation-counters.html b/Tests/LibWeb/Text/input/css/child-change-no-op-invalidation-counters.htmldeleted file mode 100644index af9c39a2524..00000000000--- a/Tests/LibWeb/Text/input/css/child-change-no-op-invalidation-counters.html+++ /dev/null@@ -1,45 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<style>- .plain {- color: rgb(0, 0, 0);- }-</style>-<div id="parent" class="plain"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements, the children that arrived, since- // its counters were reset.- function report(label, maximum) {- const styled = internals.styleCounters().styledElements;- println(`${label}: styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const parent = document.getElementById("parent");-- settleAndReset(parent);- const child = document.createElement("span");- parent.appendChild(child);- getComputedStyle(parent).color;- report("appending a child to a parent without observable child-state pseudos", 1);-- settleAndReset(parent);- parent.removeChild(child);- getComputedStyle(parent).color;- report("removing the only child from a parent without observable child-state pseudos", 0);-- settleAndReset(parent);- const fragment = document.createDocumentFragment();- fragment.appendChild(document.createElement("span"));- fragment.appendChild(document.createElement("span"));- parent.appendChild(fragment);- getComputedStyle(parent).color;- report("appending a fragment to a parent without observable child-state pseudos", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html b/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.htmlindex 61f66bd1d1b..d269ab70062 100644--- a/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html+++ b/Tests/LibWeb/Text/input/css/font-cascade-stable-display-period.html@@ -30,10 +30,11 @@});results.push(`layout after paint change while pending: ${layoutPasses(work)}`);- internals.resetStyleCounters();- face.display = "swap";- target.getBoundingClientRect();- results.push(`display transition recomputes style: ${internals.styleCounters().passes > 0}`);+ const displayWork = styleWork(() => {+ face.display = "swap";+ target.getBoundingClientRect();+ });+ results.push(`display transition style work: passes [${displayWork.passes().join(", ")}], restyled [${displayWork.restyled().map(shortStyleName).join(", ")}]`);results.push(`display transition keeps fallback metrics: ${target.getBoundingClientRect().width === fallbackWidth}`);work = layoutWork(() => {diff --git a/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html b/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.htmlindex 27ad26204cc..25567a4dd3f 100644--- a/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html+++ b/Tests/LibWeb/Text/input/css/font-cascade-unchanged-pending-selection.html@@ -14,6 +14,7 @@const width = target.getBoundingClientRect().width;internals.updateStyle();const results = [];+ const styleSummary = work => `passes [${work.passes().join(", ")}], restyled [${work.restyled().map(shortStyleName).join(", ")}]`;const paintChangeWork = layoutWork(() => {target.style.color = "red";@@ -23,20 +24,22 @@const unused = new FontFace("PendingSelection", 'url("../../../Ref/data/fonts/Ahem.ttf")', { weight: "700", unicodeRange: "U+0-7F" });await unused.load();- internals.resetStyleCounters();- document.fonts.add(unused);- internals.updateStyle();- results.push(`unused weight registration recomputed style: ${internals.styleCounters().passes > 0}`);+ const registrationWork = styleWork(() => document.fonts.add(unused));+ results.push(`unused weight registration style work: ${styleSummary(registrationWork)}`);document.fonts.delete(unused);internals.updateStyle();const loading = new FontFace("PendingSelection", 'url("../../../Ref/data/fonts/Ahem.ttf")', { weight: "700", unicodeRange: "U+0-7F" });document.fonts.add(loading);target.getBoundingClientRect();- internals.resetStyleCounters();+ internals.updateStyle();+ internals.beginStyleTrace();await loading.load();internals.updateStyle();- results.push(`unused weight completion recomputed style: ${internals.styleCounters().passes > 0}`);+ const completionEvents = parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true });+ const completionPasses = completionEvents.filter(event => event.event === "pass").map(event => event.kind);+ const completionRestyled = completionEvents.filter(event => event.event === "restyle" && event.outcome !== "kept").map(event => shortStyleName(event.element));+ results.push(`unused weight completion style work: passes [${completionPasses.join(", ")}], restyled [${completionRestyled.join(", ")}]`);results.push(`unchanged selection preserves width: ${target.getBoundingClientRect().width === width}`);results.push(`unused subset stays unloaded: ${pending.status === "unloaded"}`);@@ -45,10 +48,12 @@document.fonts.delete(loading);document.fonts.delete(resident);target.getBoundingClientRect();- internals.resetStyleCounters();- document.fonts.add(replacement);- const changedWidth = target.getBoundingClientRect().width;- results.push(`matching weight registration recomputed style: ${internals.styleCounters().passes > 0}`);+ let changedWidth;+ const matchingWork = styleWork(() => {+ document.fonts.add(replacement);+ changedWidth = target.getBoundingClientRect().width;+ }, internals, { flush: false });+ results.push(`matching weight registration style work: ${styleSummary(matchingWork)}`);results.push(`matching selection changes width: ${changedWidth !== width}`);document.fonts.delete(replacement);document.fonts.add(resident);diff --git a/Tests/LibWeb/Text/input/css/font-completion-preserves-settled-style.html b/Tests/LibWeb/Text/input/css/font-completion-preserves-settled-style.htmlindex 99914d8adeb..f0ad286b0c9 100644--- a/Tests/LibWeb/Text/input/css/font-completion-preserves-settled-style.html+++ b/Tests/LibWeb/Text/input/css/font-completion-preserves-settled-style.html@@ -1,5 +1,6 @@<!doctype html><script src="../include.js"></script>+<script src="../work-test.js"></script><script>promiseTest(async () => {await document.fonts.ready;@@ -26,15 +27,17 @@const loadedFace = faces.find(face => face.unicodeRange === "U+41");const loadingStatus = loadedFace.status;internals.updateStyle();- internals.resetStyleCounters();+ internals.beginStyleTrace();await loadedFace.loaded;internals.updateStyle();- const after = internals.styleCounters();+ const completionEvents = parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true });+ const completionPasses = completionEvents.filter(event => event.event === "pass").map(event => event.kind);+ const completionRestyled = completionEvents.filter(event => event.event === "restyle" && event.outcome !== "kept").map(event => shortStyleName(event.element));const finalWidth = target.getBoundingClientRect().width;println(`resident face used before completion: ${width === 20}`);println(`status before completion: ${loadingStatus}`);println(`status after completion: ${loadedFace.status}`);- println(`completion recomputed style: ${after.passes > 0}`);+ println(`completion style work: passes [${completionPasses.join(", ")}], restyled [${completionRestyled.join(", ")}]`);println(`completion preserves geometry: ${finalWidth === width}`);println(`unused subset: ${faces.find(face => face !== loadedFace).status}`);diff --git a/Tests/LibWeb/Text/input/css/font-face-weight-specific-invalidation.html b/Tests/LibWeb/Text/input/css/font-face-weight-specific-invalidation.htmlindex eb487a8cc2b..d2c60f50c03 100644--- a/Tests/LibWeb/Text/input/css/font-face-weight-specific-invalidation.html+++ b/Tests/LibWeb/Text/input/css/font-face-weight-specific-invalidation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>#container > span {font-family: "WeightSpecific", serif;@@ -26,7 +27,7 @@container.appendChild(document.createElement("span")).className = "bold";internals.updateStyle();- internals.resetStyleCounters();+ internals.beginStyleTrace();const regularFace = new FontFace("WeightSpecific", 'url("../../../Assets/HashSansNoSpace.woff")', { weight: "400" });document.fonts.add(regularFace);await regularFace.load();@@ -34,9 +35,10 @@// Only the span with the regular weight selects the new face, so it is the only one of the// 101 spans that has to be restyled.- const recomputed = internals.styleCounters().styledElements;- println(`affected weight recomputed: ${recomputed > 0}`);- println(`unaffected weights skipped: ${recomputed < 10}`);+ const restyled = [...new Set(parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true })+ .filter(event => event.event === "restyle" && event.outcome !== "kept")+ .map(event => shortStyleName(event.element)))];+ println(`restyled: [${restyled.join(", ")}]`);println(`regular face loaded: ${regularFace.status}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/font-load-restyle-keeps-matches.html b/Tests/LibWeb/Text/input/css/font-load-restyle-keeps-matches.htmlindex 3a90f629863..0aa10d04c9e 100644--- a/Tests/LibWeb/Text/input/css/font-load-restyle-keeps-matches.html+++ b/Tests/LibWeb/Text/input/css/font-load-restyle-keeps-matches.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>#container > span {font-family: "LateFace", serif;@@ -17,18 +18,21 @@container.appendChild(document.createElement("span")).textContent = "x";internals.updateStyle();- internals.resetStyleCounters();+ internals.beginStyleTrace();const face = new FontFace("LateFace", 'url("../../../Assets/HashSans.woff")');document.fonts.add(face);await face.load();internals.updateStyle();+ const trace = internals.takeStyleTrace();// A loaded face moves the fonts of the spans naming it, and no selector reads a font: the// spans are computed again from the rules they matched before.- const counters = internals.styleCounters();- println(`font users restyled: ${counters.styledElements >= 50}`);- println(`elements matched against every rule: ${counters.matchedElements}`);- println(`elements sharing a style: ${counters.sharedElements}`);+ const events = parseStyleTrace(trace);+ const restyled = events.filter(event => event.event === "restyle");+ println(`style passes: ${events.filter(event => event.event === "pass").map(event => event.kind).join(", ")}`);+ println(`spans computed: ${restyled.filter(event => event.outcome === "computed").map(event => event.element).join(", ")}`);+ println(`spans sharing a style: ${restyled.filter(event => event.outcome === "shared").length}`);+ println(`spans whose style changed: ${restyled.filter(event => event.changed).length}`);println(`face loaded: ${face.status}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/font-load-restyles-metric-readers.html b/Tests/LibWeb/Text/input/css/font-load-restyles-metric-readers.htmlindex 79f0a6f4d47..3c40cdfb07c 100644--- a/Tests/LibWeb/Text/input/css/font-load-restyles-metric-readers.html+++ b/Tests/LibWeb/Text/input/css/font-load-restyles-metric-readers.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>#container {font-family: "LateFace", serif;@@ -35,15 +36,17 @@const textWidthBefore = text.getBoundingClientRect().width;const chWidthBefore = chSized[0].getBoundingClientRect().width;- internals.resetStyleCounters();+ internals.beginStyleTrace();await face.load();internals.updateStyle();- const counters = internals.styleCounters();+ const restyled = [...new Set(parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true })+ .filter(event => event.event === "restyle" && event.outcome !== "kept")+ .map(event => shortStyleName(event.element)))];// The face fills in where the cascade waited on it: only the styles reading its metrics// compute again, and the text renders in the loaded face.println(`face loaded: ${face.status}`);- println(`elements styled: ${counters.styledElements}`);+ println(`elements styled: [${restyled.join(", ")}]`);println(`text width changed: ${text.getBoundingClientRect().width !== textWidthBefore}`);println(`ch width changed: ${chSized[0].getBoundingClientRect().width !== chWidthBefore}`);diff --git a/Tests/LibWeb/Text/input/css/font-load-restyles-root-metric-readers.html b/Tests/LibWeb/Text/input/css/font-load-restyles-root-metric-readers.htmlindex 0373bfa4ea5..37ed52a8471 100644--- a/Tests/LibWeb/Text/input/css/font-load-restyles-root-metric-readers.html+++ b/Tests/LibWeb/Text/input/css/font-load-restyles-root-metric-readers.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>html {font-family: "LateRootFace", serif;@@ -45,15 +46,17 @@const remWidthBefore = remSized[0].getBoundingClientRect().width;const rchWidthBefore = rchSized[0].getBoundingClientRect().width;- internals.resetStyleCounters();+ internals.beginStyleTrace();await face.load();internals.updateStyle();- const counters = internals.styleCounters();+ const restyled = [...new Set(parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true })+ .filter(event => event.event === "restyle" && event.outcome !== "kept")+ .map(event => shortStyleName(event.element)))];// The root element's font size stays as it was: only the document element and the styles// reading a metric of its font compute again.println(`face loaded: ${face.status}`);- println(`elements styled: ${counters.styledElements}`);+ println(`elements styled: [${restyled.join(", ")}]`);println(`rem width changed: ${remSized[0].getBoundingClientRect().width !== remWidthBefore}`);println(`rch width changed: ${rchSized[0].getBoundingClientRect().width !== rchWidthBefore}`);diff --git a/Tests/LibWeb/Text/input/css/has-anchor-answer-once-per-pass.html b/Tests/LibWeb/Text/input/css/has-anchor-answer-once-per-pass.htmlindex de7df61b93e..9929a236bb8 100644--- a/Tests/LibWeb/Text/input/css/has-anchor-answer-once-per-pass.html+++ b/Tests/LibWeb/Text/input/css/has-anchor-answer-once-per-pass.html@@ -23,12 +23,7 @@anchor.append(item);}internals.updateStyle();- const before = internals.styleCounters().relativeWalks;container.append(anchor);- const color = getComputedStyle(document.getElementById(`item${itemCount - 1}`)).color;- const walks = internals.styleCounters().relativeWalks - before;- println(`last item: ${color}`);- println(`relational walks at least one: ${walks >= 1}`);- println(`relational walks fewer than one per ten items: ${walks < itemCount / 10}`);+ println(`last item: ${getComputedStyle(document.getElementById(`item${itemCount - 1}`)).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/inherited-custom-property-change-reuses-shared-styles.html b/Tests/LibWeb/Text/input/css/inherited-custom-property-change-reuses-shared-styles.htmlindex 1d9bad98b2e..9f34474effd 100644--- a/Tests/LibWeb/Text/input/css/inherited-custom-property-change-reuses-shared-styles.html+++ b/Tests/LibWeb/Text/input/css/inherited-custom-property-change-reuses-shared-styles.html@@ -11,6 +11,7 @@</style><div id="outer"></div><script src="../include.js"></script>+<script src="../work-test.js"></script><script>test(() => {const outer = document.getElementById("outer");@@ -21,18 +22,13 @@outer.append(child);}getComputedStyle(outer.lastChild).marginLeft;- internals.updateStyle();- internals.resetStyleCounters();- outer.style.setProperty("--theme", "2px");+ const work = styleWork(() => outer.style.setProperty("--theme", "2px"));println("margin after change: " + getComputedStyle(outer.lastChild).marginLeft);println("every child keeps its own margin: " + [...outer.children].every(child => getComputedStyle(child).marginLeft === "2px"));println("every child inherits the new theme: " + [...outer.children].every(child => getComputedStyle(child).getPropertyValue("--theme") === "2px"));// No child reads --theme, so none of them computes its style again: the moved environment// reaches each child directly.- const counters = internals.styleCounters();- println("styled at most 1: " + (counters.styledElements <= 1));- // Of the elements styled, only #outer and the first child compute a record; every other- // child takes the record of one before it.- println("children compute no record of their own past the first: " + (counters.styledElements - counters.sharedElements - counters.reusedElements <= 2));+ println(`restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);+ println(`children that only took the moved environment: ${work.count({ event: "restyle", outcome: "kept" })}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/insert-rule-keyframes-shadow-host-invalidation-counters.html b/Tests/LibWeb/Text/input/css/insert-rule-keyframes-shadow-host-invalidation-counters.htmldeleted file mode 100644index 2fa8ef83eef..00000000000--- a/Tests/LibWeb/Text/input/css/insert-rule-keyframes-shadow-host-invalidation-counters.html+++ /dev/null@@ -1,39 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).animationName;- getComputedStyle(triggerElement).animationName;- internals.updateStyle();- internals.resetStyleCounters();- }-- function addBystanders(parent, count) {- for (let i = 0; i < count; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `bystander ${i}`;- parent.appendChild(bystander);- }- }-- test(() => {- const host = document.getElementById("host");- const shadowRoot = host.attachShadow({ mode: "open" });- const sheet = new CSSStyleSheet();- sheet.replaceSync(`- :host {- animation-name: fade;- animation-duration: 1s;- }- `);- shadowRoot.adoptedStyleSheets = [sheet];-- addBystanders(document.body, 25);- settleAndReset(host);-- sheet.insertRule("@keyframes fade { from { opacity: 0.25; } to { opacity: 0.25; } }", sheet.cssRules.length);- getComputedStyle(host).animationName;- println(`bare :host keyframes insertRule only restyles the host, styled <= 2: ${internals.styleCounters().styledElements <= 2}`);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/insert-rule-keyframes-style-invalidation-counters.html b/Tests/LibWeb/Text/input/css/insert-rule-keyframes-style-invalidation-counters.htmldeleted file mode 100644index af291f54ab3..00000000000--- a/Tests/LibWeb/Text/input/css/insert-rule-keyframes-style-invalidation-counters.html+++ /dev/null@@ -1,40 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<style id="style-sheet">- #target {- animation-name: fade;- animation-duration: 1s;- }-</style>-<div id="target">target</div>-<div>bystander 1</div>-<div>bystander 2</div>-<div>bystander 3</div>-<script>- function settleAndReset(triggerElement) {- // Force style resolution before we observe counters so the inserted- // @keyframes rule is the only thing contributing to the measurement.- getComputedStyle(triggerElement).animationName;- getComputedStyle(triggerElement).animationName;- internals.updateStyle();- internals.resetStyleCounters();- }-- function addBystanders(parent, count) {- for (let i = 0; i < count; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `bystander ${i + 4}`;- parent.appendChild(bystander);- }- }-- test(() => {- const target = document.getElementById("target");- addBystanders(document.body, 25);- const sheet = document.getElementById("style-sheet").sheet;- settleAndReset(target);- sheet.insertRule("@keyframes fade { from { opacity: 0; } to { opacity: 1; } }", sheet.cssRules.length);- getComputedStyle(target).animationName;- println(`keyframes insertRule only restyles animation users, styled <= 2: ${internals.styleCounters().styledElements <= 2}`);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/insert-rule-style-invalidation-counters.html b/Tests/LibWeb/Text/input/css/insert-rule-style-invalidation-counters.htmldeleted file mode 100644index 3f6382b19c9..00000000000--- a/Tests/LibWeb/Text/input/css/insert-rule-style-invalidation-counters.html+++ /dev/null@@ -1,64 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<style id="document-style"></style>-<div id="document-target" class="foo">document target</div>-<div>document bystander 1</div>-<div>document bystander 2</div>-<div>document bystander 3</div>-<div id="shadow-host"></div>-<script>- function settleAndReset(triggerElement) {- // Force style resolution before we observe counters so the subsequent- // mutation is measured in isolation.- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- function addBystanders(parent, prefix, count) {- for (let i = 0; i < count; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `${prefix} bystander ${i}`;- parent.appendChild(bystander);- }- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const documentTarget = document.getElementById("document-target");- // A large set of unrelated bystanders makes it obvious whether the- // invalidation cost scales with the whole subtree or just the match.- addBystanders(document.body, "document", 25);- const documentStyleSheet = document.getElementById("document-style").sheet;- settleAndReset(documentTarget);- documentStyleSheet.insertRule(".foo { color: rgb(255, 0, 0); }", documentStyleSheet.cssRules.length);- getComputedStyle(documentTarget).color;- verifyStyledStaysBounded("document insertRule stays targeted across many bystanders", 1);-- const shadowRoot = document.getElementById("shadow-host").attachShadow({ mode: "open" });- shadowRoot.innerHTML = `- <style id="shadow-style"></style>- <div id="shadow-target" class="foo">shadow target</div>- `;- addBystanders(shadowRoot, "shadow", 25);-- const shadowTarget = shadowRoot.getElementById("shadow-target");- const shadowStyleSheet = shadowRoot.getElementById("shadow-style").sheet;- settleAndReset(shadowTarget);- shadowStyleSheet.insertRule(".foo { color: rgb(0, 128, 0); }", shadowStyleSheet.cssRules.length);- getComputedStyle(shadowTarget).color;- // Shadow-root sheets can legitimately dirty both the matching shadow- // descendant and the host when the sheet gains selectors such as :host.- verifyStyledStaysBounded("shadow insertRule stays targeted across many bystanders", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/invalidation-of-scope-bounds-stays-with-their-roots.html b/Tests/LibWeb/Text/input/css/invalidation-of-scope-bounds-stays-with-their-roots.htmlindex 6c03eef3f84..37b6ec92307 100644--- a/Tests/LibWeb/Text/input/css/invalidation-of-scope-bounds-stays-with-their-roots.html+++ b/Tests/LibWeb/Text/input/css/invalidation-of-scope-bounds-stays-with-their-roots.html@@ -1,5 +1,6 @@<!doctype html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@scope (li:first-child) { .in-first { color: rgb(0, 128, 0); } }@scope (.a + .b) { .in-next { color: rgb(0, 128, 0); } }@@ -17,22 +18,19 @@const unrelated = document.getElementById("unrelated");const list = document.getElementById("list");const link = list.querySelector("a");- const subtreesHinted = change => {- getComputedStyle(unrelated).color;- internals.resetStyleCounters();- change();- getComputedStyle(unrelated).color;- const counters = internals.styleCounters();- return counters.fullPasses === 0 ? counters.hintedSubtrees : "full pass";+ const restyledBy = change => {+ const work = styleWork(change);+ const restyled = `[${work.restyled().map(shortStyleName).join(", ")}]`;+ return work.passes().includes("FULL") ? `full pass, ${restyled}` : restyled;};const newcomer = document.createElement("div");- println(`arrival among children read by a plain rule: ${subtreesHinted(() => unrelated.prepend(newcomer))}`);- println(`departure among children read by a plain rule: ${subtreesHinted(() => newcomer.remove())}`);- println(`a class nothing tests: ${subtreesHinted(() => unrelated.classList.add("untested"))}`);+ println(`arrival among children read by a plain rule: ${restyledBy(() => unrelated.prepend(newcomer))}`);+ println(`departure among children read by a plain rule: ${restyledBy(() => newcomer.remove())}`);+ println(`a class nothing tests: ${restyledBy(() => unrelated.classList.add("untested"))}`);const pushed = document.createElement("li");- println(`arrival moving a root: ${subtreesHinted(() => list.prepend(pushed)) > 0}`);+ println(`arrival moving a root: ${restyledBy(() => list.prepend(pushed))}`);println(`moved root: ${getComputedStyle(link).color}`);pushed.remove();println(`moved back: ${getComputedStyle(link).color}`);diff --git a/Tests/LibWeb/Text/input/css/shadow-media-query-invalidation-stays-scoped.html b/Tests/LibWeb/Text/input/css/shadow-media-query-invalidation-stays-scoped.htmldeleted file mode 100644index dcedf169337..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-media-query-invalidation-stays-scoped.html+++ /dev/null@@ -1,29 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script>- function createShadowTree(styleText, className) {- const host = document.createElement("div");- document.body.appendChild(host);- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = `- <style>${styleText}</style>- <div class="${className}">target</div>- `;- return shadowRoot.querySelector(`.${className}`);- }-- test(() => {- for (let i = 0; i < 20; ++i)- createShadowTree(".bystander { color: rgb(255, 0, 0); }", "bystander");-- getComputedStyle(document.body).color;- internals.updateStyle();- internals.resetStyleCounters();-- const target = createShadowTree("@media (min-width: 1px) { .target { color: rgb(0, 128, 0); } }", "target");- println(`Target color: ${getComputedStyle(target).color}`);-- const styled = internals.styleCounters().styledElements;- println(`shadow media query update stays scoped, styled <= 15: ${styled <= 15}`);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-host-light-dom-trailing-universal-invalidation.html b/Tests/LibWeb/Text/input/css/shadow-root-host-light-dom-trailing-universal-invalidation.htmldeleted file mode 100644index 1f69be1f6cf..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-host-light-dom-trailing-universal-invalidation.html+++ /dev/null@@ -1,136 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host-child"><span id="direct-child" class="light">direct child</span></div>-<div id="host-descendant"><div><span id="nested-descendant" class="light">nested descendant</span></div></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the shadow-scoped rule left the light-DOM target black, and whether the style engine- // styled fewer than 10 elements since its counters were reset, the arriving style element and- // the host among them.- function verifyHostSideWorkStayedScoped(label, actualColor) {- const styled = internals.styleCounters().styledElements;- println(`${label}: color unchanged ${actualColor == "rgb(0, 0, 0)"}, styled < 10: ${styled < 10}`);- }-- function populateShadowBystanders(shadowRoot, prefix) {- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("span");- bystander.textContent = `${prefix} shadow bystander ${i}`;- shadowRoot.appendChild(bystander);- }- }-- test(() => {- const hostChild = document.getElementById("host-child");- const directChild = document.getElementById("direct-child");- const hostDescendant = document.getElementById("host-descendant");- const nestedDescendant = document.getElementById("nested-descendant");-- const childShadowRoot = hostChild.attachShadow({ mode: "open" });- const descendantShadowRoot = hostDescendant.attachShadow({ mode: "open" });- populateShadowBystanders(childShadowRoot, "child");- populateShadowBystanders(descendantShadowRoot, "descendant");-- settleAndReset(directChild);- const directStyle = document.createElement("style");- directStyle.textContent = ":host > .light { color: rgb(0, 128, 0); }";- childShadowRoot.appendChild(directStyle);- const directColor = getComputedStyle(directChild).color;- // A shadow-scoped selector cannot cascade into the host's light-DOM children. StyleEngine- // should therefore settle the rule addition without publishing a style reaction there.- verifyHostSideWorkStayedScoped("host child combinator add keeps work scoped", directColor);-- settleAndReset(nestedDescendant);- const descendantStyle = document.createElement("style");- descendantStyle.textContent = ":host .light { color: rgb(128, 0, 128); }";- descendantShadowRoot.appendChild(descendantStyle);- const descendantColor = getComputedStyle(nestedDescendant).color;- verifyHostSideWorkStayedScoped("host descendant combinator add keeps work scoped", descendantColor);-- const broadHost = document.createElement("div");- broadHost.innerHTML = "<span id='broad-target'>broad target</span>";- document.body.appendChild(broadHost);- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("span");- bystander.textContent = `document bystander ${i}`;- document.body.appendChild(bystander);- }-- const broadTarget = document.getElementById("broad-target");- const broadShadowRoot = broadHost.attachShadow({ mode: "open" });- settleAndReset(broadTarget);- const broadStyle = document.createElement("style");- broadStyle.textContent = `- @keyframes shadow-root-host-side-broad-invalidation {- from { opacity: 1; }- to { opacity: 1; }- }- :host * { color: rgb(0, 0, 255); }- `;- broadShadowRoot.appendChild(broadStyle);- const broadColor = getComputedStyle(broadTarget).color;- verifyHostSideWorkStayedScoped("broad host-side stylesheet add avoids document-wide work", broadColor);-- const siblingEscapeHost = document.createElement("div");- document.body.appendChild(siblingEscapeHost);- const siblingEscapeTarget = document.createElement("div");- siblingEscapeTarget.innerHTML = "<span>sibling escape target</span>";- document.body.appendChild(siblingEscapeTarget);- const siblingEscapeShadowRoot = siblingEscapeHost.attachShadow({ mode: "open" });- settleAndReset(siblingEscapeTarget);- const siblingEscapeStyle = document.createElement("style");- siblingEscapeStyle.textContent = `- @keyframes shadow-root-host-side-sibling-escape-invalidation {- from { opacity: 1; }- to { opacity: 1; }- }- :host + :has(*) { color: rgb(255, 0, 0); }- `;- siblingEscapeShadowRoot.appendChild(siblingEscapeStyle);- const siblingEscapeColor = getComputedStyle(siblingEscapeTarget).color;- verifyHostSideWorkStayedScoped("broad host-side sibling escape avoids root-side work", siblingEscapeColor);-- const functionalHost = document.createElement("div");- functionalHost.innerHTML = "<span id='functional-host-target'>functional host target</span>";- document.body.appendChild(functionalHost);- const functionalHostTarget = document.getElementById("functional-host-target");- const functionalHostShadowRoot = functionalHost.attachShadow({ mode: "open" });- settleAndReset(functionalHostTarget);- const functionalHostStyle = document.createElement("style");- functionalHostStyle.textContent = `- @keyframes shadow-root-functional-host-side-invalidation {- from { opacity: 1; }- to { opacity: 1; }- }- :is(:host) * { color: rgb(0, 0, 255); }- `;- functionalHostShadowRoot.appendChild(functionalHostStyle);- const functionalHostColor = getComputedStyle(functionalHostTarget).color;- verifyHostSideWorkStayedScoped("broad functional host-side selector avoids document-wide work", functionalHostColor);-- const functionalSiblingEscapeHost = document.createElement("div");- document.body.appendChild(functionalSiblingEscapeHost);- const functionalSiblingEscapeTarget = document.createElement("div");- functionalSiblingEscapeTarget.innerHTML = "<span>functional sibling escape target</span>";- document.body.appendChild(functionalSiblingEscapeTarget);- const functionalSiblingEscapeShadowRoot = functionalSiblingEscapeHost.attachShadow({ mode: "open" });- settleAndReset(functionalSiblingEscapeTarget);- const functionalSiblingEscapeStyle = document.createElement("style");- functionalSiblingEscapeStyle.textContent = `- @keyframes shadow-root-functional-sibling-escape-invalidation {- from { opacity: 1; }- to { opacity: 1; }- }- :is(:host) + :has(*) { color: rgb(255, 0, 0); }- `;- functionalSiblingEscapeShadowRoot.appendChild(functionalSiblingEscapeStyle);- const functionalSiblingEscapeColor = getComputedStyle(functionalSiblingEscapeTarget).color;- verifyHostSideWorkStayedScoped("broad functional host-side sibling escape avoids root-side work", functionalSiblingEscapeColor);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-keyframes-shadow-local-invalidation-counters.html b/Tests/LibWeb/Text/input/css/shadow-root-keyframes-shadow-local-invalidation-counters.htmldeleted file mode 100644index 15f983a7155..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-keyframes-shadow-local-invalidation-counters.html+++ /dev/null@@ -1,61 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host"></div>-<div id="bystanders"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).opacity;- getComputedStyle(triggerElement).opacity;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const host = document.getElementById("host");- const bystanders = document.getElementById("bystanders");-- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `bystander ${i}`;- bystander.style.animationName = "fade";- bystander.style.animationDuration = "1s";- bystander.style.animationFillMode = "both";- bystanders.appendChild(bystander);- }-- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = `- <style>- #target {- animation-name: fade;- animation-duration: 1s;- animation-fill-mode: both;- }- </style>- <div id="target">shadow target</div>- `;-- const target = shadowRoot.getElementById("target");- const sheet = shadowRoot.querySelector("style").sheet;-- settleAndReset(target);- sheet.insertRule(`- @keyframes fade {- from { opacity: 0.25; }- to { opacity: 0.25; }- }- `, sheet.cssRules.length);- getComputedStyle(target).opacity;- verifyStyledStaysBounded("shadow-local keyframes insert ignores matching light-DOM bystanders", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-layer-order-shadow-local-invalidation.html b/Tests/LibWeb/Text/input/css/shadow-root-layer-order-shadow-local-invalidation.htmldeleted file mode 100644index 40db5b71760..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-layer-order-shadow-local-invalidation.html+++ /dev/null@@ -1,60 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const host = document.getElementById("host");- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("span");- bystander.className = "shadow-target";- bystander.textContent = `bystander ${i}`;- document.body.appendChild(bystander);- }-- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = `<div id="target" class="shadow-target">target</div>`;- const target = shadowRoot.getElementById("target");-- const baseStyle = document.createElement("style");- baseStyle.textContent = `- @layer alpha {- .shadow-target { color: rgb(255, 0, 0); }- }-- @layer beta {- .shadow-target { color: rgb(0, 128, 0); }- }- `;- shadowRoot.appendChild(baseStyle);-- const layerOrderStyle = document.createElement("style");- layerOrderStyle.textContent = "@layer beta, alpha;";-- settleAndReset(target);- shadowRoot.appendChild(layerOrderStyle);- getComputedStyle(target).color;- verifyStyledStaysBounded("shadow-local layer-order add stays inside the shadow root", 4);-- settleAndReset(target);- layerOrderStyle.remove();- getComputedStyle(target).color;- verifyStyledStaysBounded("shadow-local layer-order remove stays inside the shadow root", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-replacesync-shadow-local-invalidation-counters.html b/Tests/LibWeb/Text/input/css/shadow-root-replacesync-shadow-local-invalidation-counters.htmldeleted file mode 100644index 4a3fa94f34f..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-replacesync-shadow-local-invalidation-counters.html+++ /dev/null@@ -1,53 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const host = document.getElementById("host");- for (let i = 0; i < 25; ++i) {- const lightDomBystander = document.createElement("span");- lightDomBystander.className = "foo";- lightDomBystander.textContent = `light bystander ${i}`;- host.appendChild(lightDomBystander);- }-- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = `<div id="shadow-target" class="foo">shadow target</div>`;- const shadowTarget = shadowRoot.getElementById("shadow-target");-- const sheet = new CSSStyleSheet();- shadowRoot.adoptedStyleSheets = [sheet];-- settleAndReset(shadowTarget);- sheet.replaceSync(".foo { color: rgb(0, 128, 0); }");- getComputedStyle(shadowTarget).color;- verifyStyledStaysBounded("shadow-local replaceSync ignores matching light-DOM bystanders", 2);-- settleAndReset(shadowTarget);- sheet.replaceSync(".foo { color: rgb(255, 0, 0); }");- getComputedStyle(shadowTarget).color;- verifyStyledStaysBounded("shadow-local replaceSync stays bounded on subsequent updates", 2);-- settleAndReset(shadowTarget);- sheet.replaceSync("");- getComputedStyle(shadowTarget).color;- verifyStyledStaysBounded("shadow-local replaceSync clearing the sheet stays bounded", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-replacesync-slot-only-invalidation-counters.html b/Tests/LibWeb/Text/input/css/shadow-root-replacesync-slot-only-invalidation-counters.htmldeleted file mode 100644index 3ce1fb71bf0..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-replacesync-slot-only-invalidation-counters.html+++ /dev/null@@ -1,52 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host-a"><span id="target">target</span></div>-<div id="host-b"><span>other host</span></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const hostA = document.getElementById("host-a");- const target = document.getElementById("target");- const hostB = document.getElementById("host-b");-- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("span");- bystander.textContent = `bystander ${i}`;- document.body.appendChild(bystander);- }-- const shadowRootA = hostA.attachShadow({ mode: "open" });- shadowRootA.innerHTML = "<slot></slot>";- const shadowRootB = hostB.attachShadow({ mode: "open" });- shadowRootB.innerHTML = "<slot></slot>";-- const sheet = new CSSStyleSheet();- shadowRootA.adoptedStyleSheets = [sheet];-- settleAndReset(target);- sheet.replaceSync("slot { color: rgb(255, 0, 0); }");- getComputedStyle(target).color;- verifyStyledStaysBounded("slot-only replaceSync stays scoped to the current host subtree", 4);-- settleAndReset(target);- sheet.replaceSync("");- getComputedStyle(target).color;- verifyStyledStaysBounded("slot-only replaceSync removal stays scoped to the current host subtree", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-slot-style-add-remove-invalidation-counters.html b/Tests/LibWeb/Text/input/css/shadow-root-slot-style-add-remove-invalidation-counters.htmldeleted file mode 100644index bfeea04d5d0..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-slot-style-add-remove-invalidation-counters.html+++ /dev/null@@ -1,57 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host-a"><span class="item">target</span></div>-<div id="host-b"><span class="item">other host target</span></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- function attachSlotShadowRoot(host) {- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = "<slot></slot>";- return shadowRoot;- }-- test(() => {- const hostA = document.getElementById("host-a");- const target = hostA.firstElementChild;- const hostB = document.getElementById("host-b");-- for (let i = 0; i < 25; ++i) {- const bystander = document.createElement("span");- bystander.className = "item";- bystander.textContent = `bystander ${i}`;- document.body.appendChild(bystander);- }-- const shadowRootA = attachSlotShadowRoot(hostA);- attachSlotShadowRoot(hostB);-- const shadowStyle = document.createElement("style");- shadowStyle.textContent = "::slotted(.item) { color: rgb(0, 0, 255); }";-- settleAndReset(target);- shadowRootA.appendChild(shadowStyle);- getComputedStyle(target).color;- verifyStyledStaysBounded("slotted stylesheet add ignores matching bystanders outside the current host", 4);-- settleAndReset(target);- shadowStyle.remove();- getComputedStyle(target).color;- verifyStyledStaysBounded("slotted stylesheet remove ignores matching bystanders outside the current host", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.html b/Tests/LibWeb/Text/input/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.htmldeleted file mode 100644index 033c10e3795..00000000000--- a/Tests/LibWeb/Text/input/css/shadow-root-stylesheet-add-remove-shadow-local-invalidation-counters.html+++ /dev/null@@ -1,48 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="host"></div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const host = document.getElementById("host");- for (let i = 0; i < 25; ++i) {- const lightDomBystander = document.createElement("span");- lightDomBystander.className = "shadow-target-class";- lightDomBystander.textContent = `light bystander ${i}`;- host.appendChild(lightDomBystander);- }-- const shadowRoot = host.attachShadow({ mode: "open" });- shadowRoot.innerHTML = `<div id="shadow-target" class="shadow-target-class">shadow target</div>`;- const shadowTarget = shadowRoot.getElementById("shadow-target");-- const shadowStyle = document.createElement("style");- shadowStyle.textContent = ".shadow-target-class { color: rgb(0, 128, 0); }";-- settleAndReset(shadowTarget);- shadowRoot.appendChild(shadowStyle);- getComputedStyle(shadowTarget).color;- verifyStyledStaysBounded("shadow-local stylesheet add ignores matching light-DOM bystanders", 4);-- settleAndReset(shadowTarget);- shadowStyle.remove();- getComputedStyle(shadowTarget).color;- verifyStyledStaysBounded("shadow-local stylesheet remove ignores matching light-DOM bystanders", 4);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-attribute-no-op-invalidation-counters.html b/Tests/LibWeb/Text/input/css/style-attribute-no-op-invalidation-counters.htmldeleted file mode 100644index b8bfd1bccd2..00000000000--- a/Tests/LibWeb/Text/input/css/style-attribute-no-op-invalidation-counters.html+++ /dev/null@@ -1,53 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<style>- #custom-property-target {- height: var(--vh);- }-</style>-<div id="target">target</div>-<div id="custom-property-target"></div>-<script>- function settleAndReset() {- internals.updateStyle();- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function report(label, maximum) {- internals.updateStyle();- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const target = document.getElementById("target");-- target.setAttribute("style", "color: red");- settleAndReset();-- target.setAttribute("style", "color: red");- report("setting identical style text", 0);-- settleAndReset();- target.setAttribute("style", "color: green");- report("setting changed style text", 1);-- document.documentElement.style.setProperty("--vh", "9px");- settleAndReset();-- document.documentElement.style.setProperty("--vh", "9px");- report("setting identical custom property", 0);-- settleAndReset();- document.documentElement.style.setProperty("--vh", "10px");- // Only the root and the element reading --vh are styled; the others take the moved custom- // property without computing again.- report("setting changed custom property", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/animated-slot-style-propagation.html b/Tests/LibWeb/Text/input/css/style-engine/animated-slot-style-propagation.htmlindex fbb7d664def..e52a32e1a5c 100644--- a/Tests/LibWeb/Text/input/css/style-engine/animated-slot-style-propagation.html+++ b/Tests/LibWeb/Text/input/css/style-engine/animated-slot-style-propagation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>test(() => {for (const mode of ["named", "manual"]) {@@ -48,11 +49,8 @@}animation.pause();animation.currentTime = 500000;- internals.updateStyle();- internals.resetStyleCounters();- animation.currentTime = 750000;- internals.updateStyle();- println(`${prefix} paint avoids descendant style work: ${internals.styleCounters().styledElements <= 1}`);+ const work = styleWork(() => animation.currentTime = 750000);+ println(`${prefix} paint restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);println(`${prefix} slot sample: ${getComputedStyle(slot).backgroundColor}`);println(`${prefix} assigned background: ${getComputedStyle(children[39]).backgroundColor}`);children[0].style.backgroundColor = "inherit";diff --git a/Tests/LibWeb/Text/input/css/style-engine/broad-sheet-change-with-element-input.html b/Tests/LibWeb/Text/input/css/style-engine/broad-sheet-change-with-element-input.htmlindex 20dc5c5b70b..23aeebde9ad 100644--- a/Tests/LibWeb/Text/input/css/style-engine/broad-sheet-change-with-element-input.html+++ b/Tests/LibWeb/Text/input/css/style-engine/broad-sheet-change-with-element-input.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="container"></div><script>test(() => {@@ -13,11 +14,9 @@internals.updateStyle();function mutate(label, mutation) {- internals.resetStyleCounters();- mutation();- internals.updateStyle();- const counters = internals.styleCounters();- println(`${label} stays selective: ${counters.styledElements < 8}`);+ const work = styleWork(mutation);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label} restyled: [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);println(`${label} target opacity: ${getComputedStyle(target).opacity}`);println(`${label} other opacity: ${getComputedStyle(other).opacity}`);}diff --git a/Tests/LibWeb/Text/input/css/style-engine/cascade-topology-mutations.html b/Tests/LibWeb/Text/input/css/style-engine/cascade-topology-mutations.htmlindex 6f52b91d5b8..bfa665b4812 100644--- a/Tests/LibWeb/Text/input/css/style-engine/cascade-topology-mutations.html+++ b/Tests/LibWeb/Text/input/css/style-engine/cascade-topology-mutations.html@@ -48,6 +48,23 @@plan("declare the layers in the other order", () => sheet.insertRule("@layer theme, base;", 0));plan("take that statement away again", () => sheet.deleteRule(0));+ const item = document.getElementById("item");+ const printItem = () => println(` item color: ${getComputedStyle(item).color}`);+ const gatedStatement = document.createElement("style");+ gatedStatement.media = "print";+ gatedStatement.textContent = "@layer theme, base;";+ plan("attach a layer statement reversing the layers, behind a media attribute that does not match", () => head.insertBefore(gatedStatement, first));+ printItem();+ plan("ungate it", () => gatedStatement.removeAttribute("media"));+ printItem();+ plan("detach it", () => gatedStatement.remove());+ printItem();++ const emptyStatement = document.createElement("style");+ emptyStatement.textContent = "@layer unused-b, unused-a;";+ plan("attach a sheet declaring only layers nothing is in", () => head.appendChild(emptyStatement));+ plan("detach that sheet", () => emptyStatement.remove());+// An important declaration reverses the layer ordering it participates in, so adding one// changes the winner in the opposite direction from a normal declaration.plan("make a layered declaration important", () => {diff --git a/Tests/LibWeb/Text/input/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.html b/Tests/LibWeb/Text/input/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.htmlindex b0634c1cb23..ca5ad8e9ef5 100644--- a/Tests/LibWeb/Text/input/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.html+++ b/Tests/LibWeb/Text/input/css/style-engine/child-combinator-rule-bounded-to-its-shadow-tree.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><ul id="list"></ul><div id="host"></div><script>@@ -13,23 +14,20 @@const target = item.appendChild(document.createElement("div")).appendChild(document.createElement("button"));internals.updateStyle();- function recomputationsForSheet(cssText) {+ function restyledForSheet(cssText) {const sheet = new CSSStyleSheet();sheet.replaceSync(cssText);- internals.resetStyleCounters();- shadow.adoptedStyleSheets = [sheet];- internals.updateStyle();- const count = internals.styleCounters().styledElements;+ const work = styleWork(() => shadow.adoptedStyleSheets = [sheet]);shadow.adoptedStyleSheets = [];internals.updateStyle();- return count;+ return `[${work.restyled().map(shortStyleName).join(", ")}]`;}// A sheet adopted by the shadow root restyles only the shadow tree elements its rules can match, so// none for :focus while nothing is focused, and none of the 50 list items outside it.- println(`li > div > :focus: ${recomputationsForSheet("li > div > :focus { color: red }")}`);- println(`li > div > *: ${recomputationsForSheet("li > div > * { color: red }")}`);- println(`li :focus: ${recomputationsForSheet("li :focus { color: red }")}`);+ println(`li > div > :focus: ${restyledForSheet("li > div > :focus { color: red }")}`);+ println(`li > div > *: ${restyledForSheet("li > div > * { color: red }")}`);+ println(`li :focus: ${restyledForSheet("li :focus { color: red }")}`);const sheet = new CSSStyleSheet();sheet.replaceSync("li > div > :focus { color: rgb(1, 2, 3) }");diff --git a/Tests/LibWeb/Text/input/css/style-engine/converging-style-input-shares-style.html b/Tests/LibWeb/Text/input/css/style-engine/converging-style-input-shares-style.htmlindex a1e9b1b24b8..2d98f7ac143 100644--- a/Tests/LibWeb/Text/input/css/style-engine/converging-style-input-shares-style.html+++ b/Tests/LibWeb/Text/input/css/style-engine/converging-style-input-shares-style.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>.old-a {color: red;@@ -21,15 +22,12 @@<script>test(() => {const items = document.querySelectorAll("span");- internals.updateStyle();+ const work = styleWork(() => {+ for (const item of items)+ item.className = "new";+ });- internals.resetStyleCounters();- for (const item of items)- item.className = "new";- internals.updateStyle();-- const counters = internals.styleCounters();- println(`shared converging style: ${counters.sharedElements + counters.reusedElements >= 1}`);+ println(work.text.trimEnd());println(`colors became green: ${[...items].every(item => getComputedStyle(item).color === "rgb(0, 128, 0)")}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-does-not-restyle-children.html b/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-does-not-restyle-children.htmlindex 5ed40a54267..58a13ff9f23 100644--- a/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-does-not-restyle-children.html+++ b/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-does-not-restyle-children.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style id="sheet">@counter-style stars { system: cyclic; symbols: '*'; }#list { display: list-item; list-style: stars inside; width: max-content; }@@ -17,19 +18,19 @@internals.updateStyle();const listWidth = list.getBoundingClientRect().width;const generatedWidth = generated.getBoundingClientRect().width;- internals.resetStyleCounters();- document.getElementById("sheet").sheet.cssRules[0].symbols = "'++++'";- internals.updateStyle();- const markerRebuilt = list.getBoundingClientRect().width > listWidth;- const generatedRebuilt = generated.getBoundingClientRect().width > generatedWidth;- const counters = internals.styleCounters();- const elements = document.getElementsByTagName("*").length;- println(`elements: ${elements}`);+ let markerRebuilt;+ let generatedRebuilt;+ const work = styleWork(() => {+ document.getElementById("sheet").sheet.cssRules[0].symbols = "'++++'";+ internals.updateStyle();+ markerRebuilt = list.getBoundingClientRect().width > listWidth;+ generatedRebuilt = generated.getBoundingClientRect().width > generatedWidth;+ });// FIXME: The change should restyle at most the two elements resolving the counter style, and none of- // their children (styled <= 2), but the style engine also restyles the children whose records name- // the counter-style registry through the list-style-type they inherit.- println(`styled: ${counters.styledElements}, full passes: ${counters.fullPasses}`);- println(`rebuilding the boxes restyles nothing again: ${counters.passes === 1}`);+ // their children (restyled: [list, generated]), but the style engine also restyles the children+ // of #list, whose records name the counter-style registry through the list-style-type they inherit.+ println(`restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);+ println(`rebuilding the boxes restyles nothing again: passes [${work.passes().join(", ")}]`);println(`marker rebuilt: ${markerRebuilt}`);println(`generated content rebuilt: ${generatedRebuilt}`);});diff --git a/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-spares-unrelated-records.html b/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-spares-unrelated-records.htmlindex f35fdd78f19..eee8be2cc9e 100644--- a/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-spares-unrelated-records.html+++ b/Tests/LibWeb/Text/input/css/style-engine/counter-style-change-spares-unrelated-records.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style id="sheet">ol { list-style-type: stars; }.moved { color: rgb(0, 128, 0); }@@ -10,13 +11,12 @@// A counter style reaches only the records that resolved one. An unrelated rule change in the// same update still reaches its element, as does the change to the list item naming the style.test(() => {- internals.updateStyle();- const plainRecordBefore = internals.styleRecordIdentity(plain);- document.getElementById("sheet").sheet.insertRule("@counter-style stars { system: cyclic; symbols: '*'; }");- plain.classList.add("moved");- item.classList.add("moved");- internals.updateStyle();- println(`plain received a new style record: ${internals.styleRecordIdentity(plain) !== plainRecordBefore}`);+ const work = styleWork(() => {+ document.getElementById("sheet").sheet.insertRule("@counter-style stars { system: cyclic; symbols: '*'; }");+ plain.classList.add("moved");+ item.classList.add("moved");+ });+ println(`changed records: [${work.changed().map(shortStyleName).join(", ")}]`);println(`plain color: ${getComputedStyle(plain).color}`);println(`item color: ${getComputedStyle(item).color}`);});diff --git a/Tests/LibWeb/Text/input/css/style-engine/custom-function-input-precision.html b/Tests/LibWeb/Text/input/css/style-engine/custom-function-input-precision.htmlindex 2e370005efc..8c3d59b0d35 100644--- a/Tests/LibWeb/Text/input/css/style-engine/custom-function-input-precision.html+++ b/Tests/LibWeb/Text/input/css/style-engine/custom-function-input-precision.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style id="definitions">@function --size() { result: 10px; }</style><style>#target { width: --size(); }</style><div id="container" style="width: 100px"><div id="target"></div></div>@@ -15,12 +16,10 @@// Each change stays selective: only the element calling the custom function restyles.function change(label, callback) {- internals.resetStyleCounters();- callback();- internals.updateStyle();- const counters = internals.styleCounters();+ const work = styleWork(callback);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";println(`${label} width: ${getComputedStyle(target).width}`);- println(`${label} styled: ${counters.styledElements}, full passes: ${counters.fullPasses}`);+ println(`${label} restyled: [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}change("delete", () => sheet.deleteRule(0));diff --git a/Tests/LibWeb/Text/input/css/style-engine/declaration-mutations.html b/Tests/LibWeb/Text/input/css/style-engine/declaration-mutations.htmlindex 0d501093c20..eeece5e5f53 100644--- a/Tests/LibWeb/Text/input/css/style-engine/declaration-mutations.html+++ b/Tests/LibWeb/Text/input/css/style-engine/declaration-mutations.html@@ -5,12 +5,16 @@<style>.item { color: green }</style>+<style>+ #reader { height: var(--vh) }+</style><div id="guard"><span id="item" class="item"></span><span id="sibling" class="item"></span></div><table id="table"><tr><td id="cell">x</td></tr></table><svg id="svg"><circle id="circle" cx="5" cy="5" r="4"></circle></svg>+<div id="reader"></div><script>test(() => {const item = document.getElementById("item");@@ -49,5 +53,12 @@item.setAttribute("style", "color: red");const rewrite = styleWork(() => item.setAttribute("style", "color: red"));println(`rewrite the same inline style: [${rewrite.restyled().map(shortStyleName).join(", ")}]`);++ const root = document.documentElement;+ root.style.setProperty("--vh", "9px");+ plan("set a root custom property to the value it has", () => root.style.setProperty("--vh", "9px"));+ const moved = styleWork(() => root.style.setProperty("--vh", "10px"));+ println(`move a root custom property one element reads: computed [${moved.restyled().map(shortStyleName).join(", ")}]`);+ println(` reader height: ${getComputedStyle(document.getElementById("reader")).height}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/early-sharing-context-dependencies.html b/Tests/LibWeb/Text/input/css/style-engine/early-sharing-context-dependencies.htmlindex 90f5c9b74e8..f63b39add29 100644--- a/Tests/LibWeb/Text/input/css/style-engine/early-sharing-context-dependencies.html+++ b/Tests/LibWeb/Text/input/css/style-engine/early-sharing-context-dependencies.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>.random { width: random(1px, 100px); }.shared-random { width: random(--shared-test element-shared, 1px, 100px); }@@ -12,35 +13,34 @@<div id="imageRoot"></div><script>test(() => {- internals.updateStyle();- internals.resetStyleCounters();- const randomNodes = Array.from({ length: 8 }, () => {- const node = document.createElement("div");- node.className = "random";- randomRoot.append(node);- return node;+ const outcomes = work => work.events.filter(event => event.event === "restyle").map(event => `${event.element} ${event.outcome}`).join(", ");+ let randomNodes;+ const randomWork = styleWork(() => {+ randomNodes = Array.from({ length: 8 }, () => {+ const node = document.createElement("div");+ node.className = "random";+ randomRoot.append(node);+ return node;+ });});- internals.updateStyle();- const randomCounters = internals.styleCounters();- println(`random() computations share no record: ${randomCounters.sharedElements + randomCounters.reusedElements === 0}`);+ println(`random() computations: ${outcomes(randomWork)}`);const widths = randomNodes.map(node => getComputedStyle(node).width);randomRoot.style.color = "red";println(`random values survive inherited changes: ${randomNodes.every((node, index) => getComputedStyle(node).width === widths[index])}`);for (const [holder, className] of [[sharedRandomRoot, "shared-random"], [fixedRandomRoot, "fixed-random"]]) {- internals.resetStyleCounters();- const nodes = Array.from({ length: 8 }, () => {- const node = document.createElement("div");- node.className = className;- holder.append(node);- return node;+ let nodes;+ const work = styleWork(() => {+ nodes = Array.from({ length: 8 }, () => {+ const node = document.createElement("div");+ node.className = className;+ holder.append(node);+ return node;+ });});- internals.updateStyle();- // FIXME: Elements with an element-shared or fixed random() should share records- // (sharedElements + reusedElements > 0), but the style engine shares none of the records of- // elements computing random().- const counters = internals.styleCounters();- println(`${className} computations share: ${counters.sharedElements + counters.reusedElements}`);+ // FIXME: Elements with an element-shared or fixed random() should share records, but the style engine+ // shares none of the records of elements computing random().+ println(`${className} computations: ${outcomes(work)}`);const width = getComputedStyle(nodes[0]).width;println(`${className} computations agree: ${nodes.every(node => getComputedStyle(node).width === width)}`);}diff --git a/Tests/LibWeb/Text/input/css/style-engine/equivalent-cascade-input-shares-style.html b/Tests/LibWeb/Text/input/css/style-engine/equivalent-cascade-input-shares-style.htmlindex 337847dcbad..3ce956ff2bb 100644--- a/Tests/LibWeb/Text/input/css/style-engine/equivalent-cascade-input-shares-style.html+++ b/Tests/LibWeb/Text/input/css/style-engine/equivalent-cascade-input-shares-style.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>.winner {color: green !important;@@ -16,17 +17,13 @@<div id="container"></div><script>test(() => {- internals.updateStyle();- internals.resetStyleCounters();const first = document.createElement("span");first.className = "winner loser-a";const second = document.createElement("span");second.className = "winner loser-b";- document.getElementById("container").append(first, second);- document.body.offsetWidth;+ const work = styleWork(() => document.getElementById("container").append(first, second));- const counters = internals.styleCounters();- println(`shared equivalent cascade: ${counters.sharedElements + counters.reusedElements >= 1}`);+ println(work.text.trimEnd());println(`first color: ${getComputedStyle(first).color}`);println(`second color: ${getComputedStyle(second).color}`);});diff --git a/Tests/LibWeb/Text/input/css-has-invalidation/has-featureless-and-concrete-child-list-coalescing.html b/Tests/LibWeb/Text/input/css/style-engine/has-featureless-and-concrete-child-list-coalescing.htmlsimilarity index 95%rename from Tests/LibWeb/Text/input/css-has-invalidation/has-featureless-and-concrete-child-list-coalescing.htmlrename to Tests/LibWeb/Text/input/css/style-engine/has-featureless-and-concrete-child-list-coalescing.htmlindex 43d0fdc0e1a..ae6db482a9e 100644--- a/Tests/LibWeb/Text/input/css-has-invalidation/has-featureless-and-concrete-child-list-coalescing.html+++ b/Tests/LibWeb/Text/input/css/style-engine/has-featureless-and-concrete-child-list-coalescing.html@@ -1,6 +1,5 @@<!DOCTYPE html>-<script src="../include.js"></script>-<script src="_helpers.js"></script>+<script src="../../include.js"></script><style>.other:has(*) .watched { color: green; }.class-case:has(.target-class) .watched { color: red; }@@ -56,7 +55,7 @@},];- settleAndReset(document.getElementById("class-case"));+ internals.updateStyle();for (let testCase of cases) {let container = document.getElementById(testCase.id);diff --git a/Tests/LibWeb/Text/input/css/style-engine/has-reach.html b/Tests/LibWeb/Text/input/css/style-engine/has-reach.htmlnew file mode 100644index 00000000000..476b839ee4f--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/has-reach.html@@ -0,0 +1,88 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="../../work-test.js"></script>+<script src="plan.js"></script>+<style>+ .child-anchor:has(> .child-witness) { color: green }+ .two-rules:has(.colored) { color: green }+ .two-rules:has(.painted) { background-color: green }+ .deep-anchor:has(.deep-witness) { color: green }+ .negated:not(:has(.excluded)) { color: green }+ .later:has(~ .later-witness) { color: green }+ .attributed:has([data-witness]) { color: green }+ .outside-anchor:has(.outside-witness) { color: green }+</style>+<div id="child-anchor" class="child-anchor"><div id="child"><span id="grandchild"></span></div></div>+<div id="two-rules" class="two-rules"><span id="two-rules-witness"></span></div>+<div id="d1"><div id="d2"><div id="d3"><div id="d4"><div id="deep-anchor" class="deep-anchor"><div id="d6"><div id="d7"><div id="d8"><div id="d9"><span id="deep-witness"></span></div></div></div></div></div></div></div></div></div>+<div id="negated" class="negated"><div id="negated-middle"><span id="negated-witness"></span></div></div>+<div><span id="later" class="later"></span><span id="between"></span><span id="later-witness"></span></div>+<div id="attributed" class="attributed"><span id="attributed-witness"></span></div>+<div id="outside-anchor" class="outside-anchor"><span class="outside-witness"></span></div>+<div id="outside"><div><span id="outside-target"></span></div></div>+<div id="unstyled-host"></div>+<div id="text-parent"><div id="text-target"></div></div>+<script>+ test(() => {+ const $ = id => document.getElementById(id);+ const print = (element, property = "color") =>+ println(` ${element.id} ${property}: ${getComputedStyle(element).getPropertyValue(property)}`);++ plan("a grandchild gains the class a child query names", () => $("grandchild").classList.add("child-witness"));+ print($("child-anchor"));+ plan("the child gains it", () => $("child").classList.add("child-witness"));+ print($("child-anchor"));++ plan("a witness of the first of two :has() rules on one anchor", () => $("two-rules-witness").classList.add("colored"));+ plan("a witness of the second, whose property does not inherit", () => $("two-rules-witness").classList.add("painted"));+ print($("two-rules"));+ print($("two-rules"), "background-color");++ plan("a witness under an anchor halfway down a deep tree", () => $("deep-witness").classList.add("deep-witness"));+ print($("deep-anchor"));++ plan("a witness of a negated :has() arrives", () => $("negated-witness").classList.add("excluded"));+ print($("negated"));+ plan("and leaves", () => $("negated-witness").classList.remove("excluded"));+ print($("negated"));++ plan("a later sibling past the adjacent one becomes a witness", () => $("later-witness").classList.add("later-witness"));+ print($("later"));++ plan("a witness gains the argument's attribute", () => $("attributed-witness").setAttribute("data-witness", ""));+ print($("attributed"));+ plan("and loses it", () => $("attributed-witness").removeAttribute("data-witness"));+ print($("attributed"));++ plan("an element outside every anchor gains a class no rule names", () => $("outside-target").classList.add("unnamed"));+ plan("and a class a :has() argument names", () => $("outside-target").classList.add("outside-witness"));+ print($("outside-anchor"));++ const unstyledRoot = $("unstyled-host").attachShadow({ mode: "open" });+ plan("a witness class arrives in a shadow root with no sheets", () =>+ unstyledRoot.appendChild(make("span", "shadow-witness", { className: "outside-witness" })));++ plan("text arrives where no rule asks about emptiness", () => $("text-target").appendChild(document.createTextNode("x")));++ const plainSheet = new CSSStyleSheet();+ plainSheet.replaceSync(".cold-target { color: green }");+ plan("fill new shadow roots whose sheet has no :has()", () => {+ for (const index of [0, 1]) {+ const host = make("div", `cold-host-${index}`);+ document.body.insertBefore(host, __outputElement);+ const root = host.attachShadow({ mode: "open" });+ root.adoptedStyleSheets = [plainSheet];+ root.appendChild(make("span", `cold-target-${index}`, { className: "cold-target" }));+ }+ });+ const hostHasSheet = new CSSStyleSheet();+ hostHasSheet.replaceSync(":host(:has(.cold-target)) { color: green }");+ plan("a new host whose :host(:has()) rule its new light-DOM child answers", () => {+ const host = make("div", "has-host");+ document.body.insertBefore(host, __outputElement);+ host.attachShadow({ mode: "open" }).adoptedStyleSheets = [hostHasSheet];+ host.appendChild(make("span", "light-target", { className: "cold-target" }));+ });+ print($("has-host"));+ });+</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.html b/Tests/LibWeb/Text/input/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.htmlindex 3daad7a66a3..c3efa286940 100644--- a/Tests/LibWeb/Text/input/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.html+++ b/Tests/LibWeb/Text/input/css/style-engine/host-guarded-rule-bounded-to-its-shadow-tree.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><ul id="list"></ul><div id="host"></div><script>@@ -11,25 +12,22 @@shadow.appendChild(item);internals.updateStyle();- function recomputationsForSheet(cssText) {+ function restyledForSheet(cssText) {const sheet = new CSSStyleSheet();sheet.replaceSync(cssText);- internals.resetStyleCounters();- shadow.adoptedStyleSheets = [sheet];- internals.updateStyle();- const count = internals.styleCounters().styledElements;+ const work = styleWork(() => shadow.adoptedStyleSheets = [sheet]);shadow.adoptedStyleSheets = [];internals.updateStyle();- return count;+ return `[${work.restyled().map(shortStyleName).join(", ")}]`;}// A sheet adopted by the shadow root restyles only what its rules can match, so nothing for rules// guarded by a host state the host does not have, and none of the 50 list items outside it.- println(`li: ${recomputationsForSheet("li { color: red }")}`);- println(`:host > li: ${recomputationsForSheet(":host > li { color: red }")}`);- println(`:host(.a) li: ${recomputationsForSheet(":host(.a) li { color: red }")}`);- println(`:host([data-priority]) > li: ${recomputationsForSheet(":host([data-priority]) > li { color: red }")}`);- println(`:host: ${recomputationsForSheet(":host { color: red }")}`);+ println(`li: ${restyledForSheet("li { color: red }")}`);+ println(`:host > li: ${restyledForSheet(":host > li { color: red }")}`);+ println(`:host(.a) li: ${restyledForSheet(":host(.a) li { color: red }")}`);+ println(`:host([data-priority]) > li: ${restyledForSheet(":host([data-priority]) > li { color: red }")}`);+ println(`:host: ${restyledForSheet(":host { color: red }")}`);const sheet = new CSSStyleSheet();sheet.replaceSync(":host([data-priority]) > li { color: rgb(1, 2, 3) }");diff --git a/Tests/LibWeb/Text/input/css/style-engine/keyframes-input-precision.html b/Tests/LibWeb/Text/input/css/style-engine/keyframes-input-precision.htmlindex 89012b6127a..b7ce307f282 100644--- a/Tests/LibWeb/Text/input/css/style-engine/keyframes-input-precision.html+++ b/Tests/LibWeb/Text/input/css/style-engine/keyframes-input-precision.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>#target { animation: arriving 1000s paused both; }</style>@@ -12,11 +13,9 @@internals.updateStyle();function mutate(label, mutation) {- internals.resetStyleCounters();- mutation();- internals.updateStyle();- const counters = internals.styleCounters();- println(`${label} stays selective: ${counters.styledElements < 8}`);+ const work = styleWork(mutation);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label} restyled: [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);println(`${label} opacity: ${getComputedStyle(target).opacity}`);}diff --git a/Tests/LibWeb/Text/input/css/style-engine/manual-slot-style-propagation.html b/Tests/LibWeb/Text/input/css/style-engine/manual-slot-style-propagation.htmlindex 16132ffe0b6..26ecf3bbb51 100644--- a/Tests/LibWeb/Text/input/css/style-engine/manual-slot-style-propagation.html+++ b/Tests/LibWeb/Text/input/css/style-engine/manual-slot-style-propagation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="host"></div><script>test(() => {@@ -26,18 +27,13 @@first.assign(...children, text);internals.updateStyle();- internals.resetStyleCounters();- first.style.backgroundColor = "red";- internals.updateStyle();- println(`manual slot paint change only reaches slot: ${internals.styleCounters().styledElements === 1}`);+ const paintWork = styleWork(() => first.style.backgroundColor = "red");+ println(`manual slot paint change restyled: [${paintWork.restyled().map(shortStyleName).join(", ")}]`);println(`child background: ${getComputedStyle(children[0]).backgroundColor}`);println(`text remains assigned: ${first.assignedNodes().includes(text)}`);- internals.updateStyle();- internals.resetStyleCounters();- second.assign(children[0]);- internals.updateStyle();- println(`manual reassignment only reaches moved subtree: ${internals.styleCounters().styledElements <= 2}`);+ const reassignmentWork = styleWork(() => second.assign(children[0]));+ println(`manual reassignment restyled: [${reassignmentWork.restyled().map(shortStyleName).join(", ")}]`);println(`moved child assigned to second: ${children[0].assignedSlot === second}`);println(`remaining child stays assigned to first: ${children[1].assignedSlot === first}`);println(`moved child color: ${getComputedStyle(children[0]).color}`);diff --git a/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-media-mutations.html b/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-media-mutations.htmlnew file mode 100644index 00000000000..94374b43d13--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-media-mutations.html@@ -0,0 +1,160 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="../../work-test.js"></script>+<script src="plan.js"></script>+<script>+ const activeColor = "rgb(1, 2, 3)";+ const activeBackground = "rgb(4, 5, 6)";++ function makeShadowFixture(options) {+ const fixture = make("section", "fixture", { className: options.fixtureClass || "" });+ const wrapper = make("div", "wrapper", { className: options.wrapperClass || "" });+ const host = make("x-media-host", "host", { className: options.hostClass || "", attributes: options.hostAttributes || {} });+ const assigned = make(options.assignedTag || "span", "assigned", {+ className: "assigned",+ attributes: options.assignedAttributes || {},+ });+ if (options.slotName) assigned.setAttribute("slot", options.slotName);+ wrapper.appendChild(host);+ fixture.appendChild(wrapper);+ document.body.insertBefore(fixture, __outputElement);++ const shadowRoot = host.attachShadow({ mode: "open" });+ const shadowWrapper = make("div", "shadow-wrapper", { className: options.shadowWrapperClass || "" });+ const slot = make("slot", "slot", { className: options.slotClass || "" });+ if (options.slotName) slot.name = options.slotName;+ const inner = make("span", "inner", { className: "inner" });+ shadowWrapper.append(slot, inner);+ shadowRoot.appendChild(shadowWrapper);+ host.appendChild(assigned);+ return { fixture, host, shadowRoot, assigned, inner };+ }++ function mediaCase(name, options) {+ const fixture = makeShadowFixture(options);+ const target = fixture[options.target];+ const property = options.property || "color";+ const sheet = new CSSStyleSheet({ media: options.initialMedia || "print" });+ sheet.replaceSync(options.cssText);+ fixture.shadowRoot.adoptedStyleSheets = [sheet];+ const before = getComputedStyle(target).getPropertyValue(property);+ plan(name, () => {+ if (options.mutate) options.mutate(sheet);+ else sheet.media.mediaText = options.afterMedia || "screen";+ });+ println(` ${target.id} ${property}: ${before} -> ${getComputedStyle(target).getPropertyValue(property)}`);+ fixture.fixture.remove();+ }++ test(() => {+ mediaCase("activate a bare :host rule", { cssText: `:host { color: ${activeColor} }`, target: "host" });+ mediaCase("activate a :host() rule with a class", {+ hostClass: "active",+ cssText: `:host(.active) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("activate a :host() rule with an attribute", {+ hostAttributes: { "data-state": "on" },+ cssText: `:host([data-state="on"]) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("activate a :host() rule with a negation", { cssText: `:host(:not(.disabled)) { color: ${activeColor} }`, target: "host" });+ mediaCase("activate a :host() rule with :is()", {+ hostClass: "active",+ cssText: `:host(:is(.active, [data-state])) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("activate a :host() rule with :where()", {+ hostAttributes: { "data-state": "on" },+ cssText: `:host(:where(.active, [data-state])) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("deactivate a :host() rule with a class", {+ hostClass: "active",+ initialMedia: "screen",+ afterMedia: "print",+ cssText: `:host(.active) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("activate a :host rule with appendMedium()", {+ cssText: `:host { color: ${activeColor} }`,+ mutate: sheet => sheet.media.appendMedium("screen"),+ target: "host",+ });+ mediaCase("deactivate a :host rule with deleteMedium()", {+ initialMedia: "screen, print",+ cssText: `:host { color: ${activeColor} }`,+ mutate: sheet => sheet.media.deleteMedium("screen"),+ target: "host",+ });+ mediaCase("activate a rule inside the tree guarded by :host()", {+ hostClass: "active",+ cssText: `:host(.active) .inner { color: ${activeColor} }`,+ target: "inner",+ });+ mediaCase("activate a ::slotted() rule with a class", { cssText: `::slotted(.assigned) { color: ${activeColor} }`, target: "assigned" });+ mediaCase("activate a ::slotted() rule with a type and a class", {+ cssText: `::slotted(span.assigned) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a ::slotted() rule with an attribute", {+ assignedAttributes: { "data-kind": "primary" },+ cssText: `::slotted([data-kind="primary"]) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a ::slotted() rule with :is()", {+ cssText: `::slotted(:is(.assigned, [data-kind])) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a ::slotted() rule with a negation", {+ cssText: `::slotted(:not(.missing)) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a ::slotted() rule for a named slot", {+ slotName: "main",+ cssText: `::slotted(.assigned) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a ::slotted() rule for a property that does not inherit", {+ cssText: `::slotted(.assigned) { background-color: ${activeBackground} }`,+ target: "assigned",+ property: "background-color",+ });+ mediaCase("activate a rule for a bare slot the assigned element inherits from", {+ cssText: `slot { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a rule for a named slot the assigned element inherits from", {+ slotName: "main",+ slotClass: "main-slot",+ cssText: `slot.main-slot { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a descendant rule for a slot the assigned element inherits from", {+ shadowWrapperClass: "themed",+ cssText: `.themed slot { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a :host() rule for a host nested in a classed wrapper", {+ wrapperClass: "outer-wrapper",+ hostClass: "active",+ cssText: `:host(.active) { color: ${activeColor} }`,+ target: "host",+ });+ mediaCase("activate a ::slotted() rule for an assigned paragraph", {+ assignedTag: "p",+ cssText: `::slotted(p.assigned) { color: ${activeColor} }`,+ target: "assigned",+ });+ mediaCase("activate a :host() rule and a ::slotted() rule together", {+ hostClass: "active",+ cssText: `:host(.active) { color: ${activeColor} } ::slotted(.assigned) { background-color: ${activeBackground} }`,+ target: "assigned",+ property: "background-color",+ });+ mediaCase("activate a rule inside the tree and a ::slotted() rule together", {+ cssText: `.inner { background-color: ${activeBackground} } ::slotted(.assigned) { color: ${activeColor} }`,+ target: "assigned",+ });+ });+</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-reach.html b/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-reach.htmlnew file mode 100644index 00000000000..93b5db35f9d--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/shadow-sheet-reach.html@@ -0,0 +1,124 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="../../work-test.js"></script>+<script src="plan.js"></script>+<div id="local-host"><span id="light-local" class="local"></span></div>+<span id="layered-bystander" class="layered"></span>+<div id="layer-host"><span id="light-layered" class="layered"></span></div>+<div id="keyframes-bystander" style="animation: fade 1000s paused both"></div>+<div id="keyframes-host"></div>+<div id="animated-host"></div>+<span id="slotted-bystander" class="slotted-item"></span>+<div id="slot-host-a"><span id="slotted-a" class="slotted-item"></span></div>+<div id="slot-host-b"><span id="slotted-b" class="slotted-item"></span></div>+<div id="escape-host"><span id="escape-child" class="light"></span><div><span id="escape-nested" class="light"></span></div></div>+<div id="escape-sibling"><span id="escape-sibling-child"></span></div>+<div id="media-bystander-host"></div>+<script>+ test(() => {+ const $ = id => document.getElementById(id);+ const print = (element, property = "color") =>+ println(` ${element.id} ${property}: ${getComputedStyle(element).getPropertyValue(property)}`);+ const makeStyle = cssText => {+ const style = document.createElement("style");+ style.textContent = cssText;+ return style;+ };++ const localRoot = $("local-host").attachShadow({ mode: "open" });+ localRoot.innerHTML = "<style id='local-style'></style><div id='local-target' class='local'></div>";+ const localTarget = localRoot.getElementById("local-target");+ const localSheet = localRoot.getElementById("local-style").sheet;+ plan("insert a rule into a shadow root's style element", () => localSheet.insertRule(".local { color: green }", 0));+ print(localTarget);+ plan("delete it", () => localSheet.deleteRule(0));+ const localStyle = makeStyle(".local { color: green }");+ plan("attach a style element to a shadow root", () => localRoot.appendChild(localStyle));+ print(localTarget);+ plan("detach it", () => localStyle.remove());+ const adopted = new CSSStyleSheet();+ localRoot.adoptedStyleSheets = [adopted];+ plan("replaceSync an adopted shadow sheet onto the class", () => adopted.replaceSync(".local { color: green }"));+ plan("replaceSync it onto another value", () => adopted.replaceSync(".local { color: blue }"));+ print(localTarget);+ plan("replaceSync it empty", () => adopted.replaceSync(""));+ print($("light-local"));++ const layerRoot = $("layer-host").attachShadow({ mode: "open" });+ layerRoot.innerHTML = "<style>@layer alpha { .layered { color: red } } @layer beta { .layered { color: green } }</style>"+ + "<span id='layer-target' class='layered'></span>";+ const layerTarget = layerRoot.getElementById("layer-target");+ const layerStatement = makeStyle("@layer beta, alpha;");+ plan("attach a layer statement ahead of a shadow root's layers, reversing them", () => {+ layerRoot.insertBefore(layerStatement, layerRoot.firstChild);+ });+ print(layerTarget);+ plan("detach it", () => layerStatement.remove());+ print(layerTarget);++ const keyframesRoot = $("keyframes-host").attachShadow({ mode: "open" });+ keyframesRoot.innerHTML = "<style id='keyframes-style'>#keyframes-target { animation: fade 1000s paused both }</style>"+ + "<div id='keyframes-target'></div>";+ const keyframesSheet = keyframesRoot.getElementById("keyframes-style").sheet;+ plan("insert @keyframes a light-DOM element also names into a shadow root's style element", () => {+ keyframesSheet.insertRule("@keyframes fade { from, to { opacity: 0.25 } }", keyframesSheet.cssRules.length);+ });+ print(keyframesRoot.getElementById("keyframes-target"), "opacity");+ print($("keyframes-bystander"), "opacity");++ const hostAnimationSheet = new CSSStyleSheet();+ hostAnimationSheet.replaceSync(":host { animation: host-fade 1000s paused both }");+ $("animated-host").attachShadow({ mode: "open" }).adoptedStyleSheets = [hostAnimationSheet];+ plan("insert the @keyframes a :host rule names into its adopted sheet", () => {+ hostAnimationSheet.insertRule("@keyframes host-fade { from, to { opacity: 0.25 } }", hostAnimationSheet.cssRules.length);+ });+ print($("animated-host"), "opacity");++ const slotRoot = $("slot-host-a").attachShadow({ mode: "open" });+ slotRoot.innerHTML = "<slot id='slot-a'></slot>";+ $("slot-host-b").attachShadow({ mode: "open" }).innerHTML = "<slot id='slot-b'></slot>";+ const slottedStyle = makeStyle("::slotted(.slotted-item) { color: blue }");+ plan("attach a ::slotted() style element to one of two shadow roots", () => slotRoot.appendChild(slottedStyle));+ print($("slotted-a"));+ print($("slotted-b"));+ plan("detach it", () => slottedStyle.remove());+ const slotSheet = new CSSStyleSheet();+ slotRoot.adoptedStyleSheets = [slotSheet];+ plan("replaceSync an adopted sheet onto the slot", () => slotSheet.replaceSync("slot { color: green }"));+ print($("slotted-a"));+ print($("slotted-b"));+ plan("replaceSync it empty", () => slotSheet.replaceSync(""));++ const escapeRoot = $("escape-host").attachShadow({ mode: "open" });+ escapeRoot.innerHTML = "<span id='escape-inside'></span>";+ const keyframes = "@keyframes unused { from, to { opacity: 1 } }";+ const escapes = [+ ["attach :host > .light to a shadow root", ":host > .light { color: red }"],+ ["attach :host .light", ":host .light { color: red }"],+ ["attach :host * beside keyframes", `${keyframes} :host * { color: blue }`],+ ["attach :host + :has(*) beside keyframes", `${keyframes} :host + :has(*) { color: red }`],+ ["attach :is(:host) * beside keyframes", `${keyframes} :is(:host) * { color: blue }`],+ ["attach :is(:host) + :has(*) beside keyframes", `${keyframes} :is(:host) + :has(*) { color: red }`],+ ];+ const lightColors = () =>+ ["escape-child", "escape-nested", "escape-sibling"].map(id => getComputedStyle($(id)).color).join(", ");+ for (const [name, cssText] of escapes) {+ const style = makeStyle(cssText);+ plan(name, () => escapeRoot.appendChild(style));+ println(` light DOM colors: ${lightColors()}`);+ style.remove();+ }++ $("media-bystander-host").attachShadow({ mode: "open" }).innerHTML =+ "<style>.media-bystander { color: red }</style><span id='media-bystander' class='media-bystander'></span>";+ let mediaRoot;+ plan("insert a host whose new shadow tree has a sheet behind a matching media query", () => {+ const host = make("div", "media-host");+ document.body.insertBefore(host, __outputElement);+ mediaRoot = host.attachShadow({ mode: "open" });+ mediaRoot.innerHTML = "<style>@media (min-width: 1px) { .media-target { color: green } }</style>"+ + "<span id='media-target' class='media-target'></span>";+ });+ print(mediaRoot.getElementById("media-target"));+ });+</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/sheet-mutations.html b/Tests/LibWeb/Text/input/css/style-engine/sheet-mutations.htmlindex 88e8912a3a3..b42a056885a 100644--- a/Tests/LibWeb/Text/input/css/style-engine/sheet-mutations.html+++ b/Tests/LibWeb/Text/input/css/style-engine/sheet-mutations.html@@ -114,6 +114,39 @@plan("replaceSync it back", () => constructed.replaceSync(".item { font-style: italic }"));plan("unadopt it", () => document.adoptedStyleSheets = []);+ const item = document.getElementById("item");+ const printItem = (property, pseudo) =>+ println(` item${pseudo ?? ""} ${property}: ${getComputedStyle(item, pseudo).getPropertyValue(property)}`);+ const printGated = new CSSStyleSheet({ media: "print" });+ printGated.replaceSync(".item { font-style: italic }");+ plan("adopt a constructed sheet whose media list does not match", () => document.adoptedStyleSheets = [printGated]);+ printItem("font-style");+ plan("unadopt the gated sheet", () => document.adoptedStyleSheets = []);+ const wrapped = new CSSStyleSheet({ media: "print" });+ wrapped.replaceSync("@media (min-width: 1px) { .item { font-style: italic } }");+ plan("adopt one whose media list does not match around a matching @media", () => document.adoptedStyleSheets = [wrapped]);+ printItem("font-style");+ plan("unadopt the wrapped sheet", () => document.adoptedStyleSheets = []);+ const widthGated = new CSSStyleSheet({ media: "(min-width: 1px)" });+ widthGated.replaceSync(".item { font-style: italic }");+ plan("adopt one whose media list matches", () => document.adoptedStyleSheets = [widthGated]);+ printItem("font-style");+ plan("unadopt the matching sheet", () => document.adoptedStyleSheets = []);++ plan("attach a style element whose media attribute does not match", () => {+ added = addStyleSheet(".item { font-weight: bold }");+ added.media = "print";+ });+ printItem("font-weight");+ plan("detach the gated style element", () => added.remove());++ plan("attach a sheet whose only rule styles .item::before", () => {+ added = addStyleSheet(".item::before { content: ''; color: blue }");+ });+ printItem("content", "::before");+ plan("detach the pseudo-element sheet", () => added.remove());+ printItem("content", "::before");+// Re-inserting a `<style>` element builds a whole new sheet rather than reattaching the old// one, so a subtree holding one that leaves and comes back in a single transaction leaves a// detached sheet behind with all its rules still recorded as having arrived. What those rulesdiff --git a/Tests/LibWeb/Text/input/css/style-engine/slot-reassignment-keeps-unmoved-siblings.html b/Tests/LibWeb/Text/input/css/style-engine/slot-reassignment-keeps-unmoved-siblings.htmlindex f8c93dcfce1..b6a4dd85128 100644--- a/Tests/LibWeb/Text/input/css/style-engine/slot-reassignment-keeps-unmoved-siblings.html+++ b/Tests/LibWeb/Text/input/css/style-engine/slot-reassignment-keeps-unmoved-siblings.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="host"></div><script>test(() => {@@ -22,11 +23,8 @@const moved = host.children[10];const unmoved = host.children[11];function moveTo(slot) {- internals.updateStyle();- internals.resetStyleCounters();- moved.slot = slot;- internals.updateStyle();- println(`move to ${slot}: only moved subtree reached: ${internals.styleCounters().styledElements <= 2}`);+ const work = styleWork(() => moved.slot = slot);+ println(`move to ${slot} restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);println(`moved color: ${getComputedStyle(moved).color}`);println(`child color: ${getComputedStyle(moved.firstElementChild).color}`);println(`unmoved color: ${getComputedStyle(unmoved).color}`);diff --git a/Tests/LibWeb/Text/input/css/style-engine/slot-style-propagation.html b/Tests/LibWeb/Text/input/css/style-engine/slot-style-propagation.htmlindex 801df00bf64..ef8e9605e3d 100644--- a/Tests/LibWeb/Text/input/css/style-engine/slot-style-propagation.html+++ b/Tests/LibWeb/Text/input/css/style-engine/slot-style-propagation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="host"></div><script>test(() => {@@ -24,17 +25,12 @@}const childShadow = host.firstElementChild.attachShadow({ mode: "open" });childShadow.innerHTML = "<span>shadow child</span>";- internals.updateStyle();- internals.resetStyleCounters();- slot.style.backgroundColor = "red";- internals.updateStyle();- println(`background change only reaches slot: ${internals.styleCounters().styledElements === 1}`);+ const backgroundWork = styleWork(() => slot.style.backgroundColor = "red");+ println(`background change restyled: [${backgroundWork.restyled().map(shortStyleName).join(", ")}]`);println(`child background: ${getComputedStyle(host.firstElementChild).backgroundColor}`);- internals.resetStyleCounters();- slot.style.color = "green";- internals.updateStyle();- println(`inherited color avoids full passes: ${internals.styleCounters().fullPasses === 0}`);+ const colorWork = styleWork(() => slot.style.color = "green");+ println(`inherited color passes: [${colorWork.passes().join(", ")}]`);println(`inherited color: ${getComputedStyle(host.firstElementChild).color}`);println(`last child color: ${getComputedStyle(host.lastElementChild).color}`);println(`shadow descendant color: ${getComputedStyle(childShadow.firstElementChild).color}`);diff --git a/Tests/LibWeb/Text/input/css/style-engine/typing-selection-style-invalidation.html b/Tests/LibWeb/Text/input/css/style-engine/typing-selection-style-invalidation.htmlindex 7590e64f4dd..046550687bf 100644--- a/Tests/LibWeb/Text/input/css/style-engine/typing-selection-style-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-engine/typing-selection-style-invalidation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>::selection { color: rgb(10, 20, 30); background-color: rgb(40, 50, 60); }</style>@@ -16,11 +17,11 @@selection.collapse(editor.firstChild, 4);internals.updateStyle();+ const restyledNames = work => `[${work.restyled().map(shortStyleName).join(", ")}]`;+function type(label, text) {- internals.resetStyleCounters();- internals.sendText(editor, text);- internals.updateStyle();- println(`${label} stays local: ${internals.styleCounters().styledElements < 16}`);+ const work = styleWork(() => internals.sendText(editor, text));+ println(`${label} restyled: ${restyledNames(work)}`);println(`${label} leaves a caret: ${selection.isCollapsed}`);}@@ -32,15 +33,15 @@println(`formatting preserved: ${getComputedStyle(selection.anchorNode.parentElement).fontWeight}`);println(`selection query: ${getComputedStyle(editor, "::selection").color}`);- internals.resetStyleCounters();+ let inputHandlerSelection;editor.addEventListener("input", () => {selection.selectAllChildren(editor);internals.updateStyle();- println(`input handler selection: ${getComputedStyle(editor, "::selection").backgroundColor}`);+ inputHandlerSelection = getComputedStyle(editor, "::selection").backgroundColor;}, { once: true });- internals.sendText(editor, "d");+ const selectionWork = styleWork(() => internals.sendText(editor, "d"), internals, { flush: false });+ println(`input handler selection: ${inputHandlerSelection}`);println(`input handler leaves a selection: ${!selection.isCollapsed}`);- const activated = internals.styleCounters().styledElements;- println(`selection styles activated locally: ${activated > 0 && activated < 16}`);+ println(`selection styles activated: ${restyledNames(selectionWork)}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/unfocused-subject-skips-descendants.html b/Tests/LibWeb/Text/input/css/style-engine/unfocused-subject-skips-descendants.htmlindex bd18b3d8db5..91d9bbd2af1 100644--- a/Tests/LibWeb/Text/input/css/style-engine/unfocused-subject-skips-descendants.html+++ b/Tests/LibWeb/Text/input/css/style-engine/unfocused-subject-skips-descendants.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>.item.completed > div > :focus {color: rgb(0, 128, 0);@@ -20,22 +21,28 @@const probe = list.children[3].firstChild.children[2];internals.updateStyle();- internals.resetStyleCounters();- for (const item of list.children)- item.classList.add("completed");- println(`unfocused probe: ${getComputedStyle(probe).color}`);- println(`styled with no focused element: ${internals.styleCounters().styledElements}`);+ const restyledNames = work => `[${work.restyled().map(shortStyleName).join(", ")}]`;+ let probeColor;+ const unfocusedWork = styleWork(() => {+ for (const item of list.children)+ item.classList.add("completed");+ probeColor = getComputedStyle(probe).color;+ }, internals, { flush: false });+ println(`unfocused probe: ${probeColor}`);+ println(`styled with no focused element: ${restyledNames(unfocusedWork)}`);for (const item of list.children)item.classList.remove("completed");probe.focus();getComputedStyle(probe).color;- internals.resetStyleCounters();- for (const item of list.children)- item.classList.add("completed");- println(`focused probe: ${getComputedStyle(probe).color}`);+ const focusedWork = styleWork(() => {+ for (const item of list.children)+ item.classList.add("completed");+ probeColor = getComputedStyle(probe).color;+ }, internals, { flush: false });+ println(`focused probe: ${probeColor}`);// The focused probe restyles with the elements of its user-agent shadow tree, which inherit its color.- println(`styled with one focused element: ${internals.styleCounters().styledElements}`);+ println(`styled with one focused element: ${restyledNames(focusedWork)}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/where-is-subject-class-invalidation.html b/Tests/LibWeb/Text/input/css/style-engine/where-is-subject-class-invalidation.htmlindex fcc0debaabe..71a8f27e0a8 100644--- a/Tests/LibWeb/Text/input/css/style-engine/where-is-subject-class-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-engine/where-is-subject-class-invalidation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>.prose :where(.one) { color: rgb(0, 128, 0) }.prose :is(.two):not(:where(.skip)) { color: rgb(0, 0, 255) }@@ -25,12 +26,10 @@function measure() {toggleProse(true);toggleProse(false);- internals.resetStyleCounters();- toggleProse(true);- const counters = internals.styleCounters();+ const work = styleWork(() => root.classList.toggle("prose", true));const colors = ["one", "two"].map(id => getComputedStyle(document.getElementById(id)).color);toggleProse(false);- return { tests: counters.invalidationTests, colors: colors.join(" ") };+ return { restyled: work.restyled().map(shortStyleName).join(", "), colors: colors.join(" ") };}function growTo(size) {@@ -49,7 +48,8 @@}println(`colors with .prose: ${measurements[0].colors}`);- println(`invalidation tests don't grow with unrelated elements: ${measurements[1].tests === measurements[0].tests}`);+ println(`restyled among 64 children: [${measurements[0].restyled}]`);+ println(`restyled among 1024 children: [${measurements[1].restyled}]`);toggleProse(false);println(`color without .prose: ${getComputedStyle(document.getElementById("one")).color}`);diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/active-state-featureless-has-targeted-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/active-state-featureless-has-targeted-invalidation.htmlindex 8f376ea2e26..ab2301fcdb7 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/active-state-featureless-has-targeted-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/active-state-featureless-has-targeted-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>body {margin: 0;@@ -43,16 +44,11 @@internals.updateStyle();internals.mouseMove(x, y);- internals.updateStyle();- internals.resetStyleCounters();- internals.clickAndHold(x, y);- internals.updateStyle();+ const work = styleWork(() => internals.clickAndHold(x, y));println(`active color: ${getComputedStyle(activeTarget).color}`);-- const counters = internals.styleCounters();- println(`:active state change styled fewer than 50: ${counters.styledElements < 50}, full passes: ${counters.fullPasses}`);+ println(`:active state change passes: [${work.passes().join(", ")}], restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);internals.mouseUp(x, y);});diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/animated-custom-property-skips-restyle.html b/Tests/LibWeb/Text/input/css/style-invalidation/animated-custom-property-skips-restyle.htmlindex f369b2b4c6f..103e67624a5 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/animated-custom-property-skips-restyle.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/animated-custom-property-skips-restyle.html@@ -1,5 +1,6 @@<!doctype html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>div {--rotation: rotate(var(--turn));@@ -28,15 +29,14 @@const animation = target.animate({ "--turn": ["0deg", "360deg"], easing: "linear" }, 1000);animation.pause();animation.currentTime = 125;- internals.updateStyle();- internals.resetStyleCounters();- for (const time of [375, 625, 125]) {- animation.currentTime = time;- internals.updateStyle();- }- const recomputations = internals.styleCounters().styledElements;+ const work = styleWork(() => {+ for (const time of [375, 625, 125]) {+ animation.currentTime = time;+ internals.updateStyle();+ }+ });const rotation = getComputedStyle(target).getPropertyValue("--rotation");- results.push(`${id}: ${recomputations === 0 ? "skipped" : "recomputed"}, ${rotation}`);+ results.push(`${id}: restyled [${work.restyled().map(shortStyleName).join(", ")}], ${rotation}`);}results.forEach(println);});diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/child-list-featureless-has-targeted-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/child-list-featureless-has-targeted-invalidation.htmlindex f3326e27a6c..e3abf95ce00 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/child-list-featureless-has-targeted-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/child-list-featureless-has-targeted-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>/* A :has() selector with a featureless-sensitive argument. Its presencemust not force conservative :has() invalidation for child-list mutations@@ -30,21 +31,26 @@big.appendChild(leaf);}const stream = document.getElementById("stream");- internals.updateStyle();- internals.resetStyleCounters();+ const work = styleWork(() => {+ // Simulate response streaming: append plain paragraphs one at a time,+ // flushing style after each append. No :has() argument anchored at an+ // ancestor of #stream can match a plain <p>, so the appends must not+ // fan out into a restyle of the wrapper subtree.+ for (let i = 0; i < 10; ++i) {+ const p = document.createElement("p");+ p.textContent = `chunk ${i}`;+ stream.appendChild(p);+ internals.updateStyle();+ }+ });- // Simulate response streaming: append plain paragraphs one at a time,- // flushing style after each append. No :has() argument anchored at an- // ancestor of #stream can match a plain <p>, so the appends must not- // fan out into a restyle of the wrapper subtree.- for (let i = 0; i < 10; ++i) {- const p = document.createElement("p");- p.textContent = `chunk ${i}`;- stream.appendChild(p);- internals.updateStyle();+ const passes = [];+ for (const event of work.events) {+ if (event.event === "pass")+ passes.push({ kind: event.kind, restyled: [] });+ else+ passes.at(-1).restyled.push(shortStyleName(event.element));}-- const counters = internals.styleCounters();- println(`streamed appends styled fewer than 100: ${counters.styledElements < 100}, full passes: ${counters.fullPasses}`);+ println(`streamed appends restyled per pass: ${passes.map(pass => `${pass.kind} [${pass.restyled.join(", ")}]`).join(", ")}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.htmlindex 4e66ae1c5b3..ff169c0d713 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/complex-has-descendant-does-not-poison-has-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>:is(:where(.group):has(.flag) *) {@@ -29,11 +30,9 @@internals.updateStyle();assertEqual("target initially has base color", getComputedStyle(target).color, "rgb(4, 5, 6)");- resetStyleCounters();- document.getElementById("toggle").classList.add("toggle");- internals.updateStyle();+ const work = styleWork(() => document.getElementById("toggle").classList.add("toggle"));assertEqual("target matches after :has() mutation", getComputedStyle(target).color, "rgb(1, 2, 3)");- printPassWithStyleCounters("descendant-only complex :has() keeps later :has() invalidation targeted", 9);+ printPassWithStyleWork("descendant-only complex :has() keeps later :has() invalidation targeted", work);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.htmlindex 5f8219c702e..cc44fdb7fdb 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/compound-pseudo-class-guarded-descendant-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>body {@@ -76,15 +77,6 @@internals.mouseMove(Math.floor(rect.left + rect.width / 2), Math.floor(rect.top + rect.height / 2));}- function settleAndReset() {- internals.updateStyle();- resetStyleCounters();- }-- function assertNoSubtreeRestyle(label, maxStyledElements) {- printPassWithStyleCounters(label, maxStyledElements);- }-function assertColor(label, element, expected) {assertEqual(label, getComputedStyle(element).color, expected);}@@ -105,12 +97,10 @@internals.updateStyle();assertColor(`${label} initial`, state.target, expectedInitial);- resetStyleCounters();- mutate(state);- internals.updateStyle();+ const work = styleWork(() => mutate(state));assertColor(`${label} after mutation`, state.target, expectedAfter);// Only the mutated guard and its target should be styled.- printPassWithStyleCounters(label, 2);+ printPassWithStyleWork(label, work);}function runHoverColorInvalidationCase(label, className, build, expectedAfter = MATCH_COLOR) {@@ -121,12 +111,10 @@internals.updateStyle();assertColor(`${label} initial`, state.target, BASE_COLOR);- resetStyleCounters();- hover(state.hoverTarget);- internals.updateStyle();+ const work = styleWork(() => hover(state.hoverTarget));assertColor(`${label} after hover`, state.target, expectedAfter);// Only the hovered element and the target should be styled.- printPassWithStyleCounters(label, 2);+ printPassWithStyleWork(label, work);}function appendSvgHoverTarget(container, svgAttributes) {@@ -186,19 +174,15 @@fixture.appendChild(hitArea);assertEqual("action target initial", readProbe(actionTarget), BASE);- settleAndReset();- hover(hitArea);- internals.updateStyle();+ const unrelatedHoverWork = styleWork(() => hover(hitArea));assertEqual("action target after unrelated hover", readProbe(actionTarget), BASE);assertEqual("bystander after unrelated hover", readProbe(bystanders[0]), BASE);- assertNoSubtreeRestyle("compound :hover descendant invalidation ignores unrelated hover", 6);+ printPassWithStyleWork("compound :hover descendant invalidation ignores unrelated hover", unrelatedHoverWork);- resetStyleCounters();- hover(actionTarget);- internals.updateStyle();+ const guardedHoverWork = styleWork(() => hover(actionTarget));assertEqual("action target after guarded hover", readProbe(actionTarget), MATCH);- printPassWithStyleCounters("compound :hover descendant invalidation applies to matching guard", 2);+ printPassWithStyleWork("compound :hover descendant invalidation applies to matching guard", guardedHoverWork);runColorInvalidationCase("co-invalidated pseudo-class guard updates descendant",@@ -255,11 +239,8 @@tagHoverGuard.appendChild(unrelatedHoverTarget);fixture.appendChild(tagHoverGuard);- internals.updateStyle();- resetStyleCounters();- hover(unrelatedHoverTarget);- internals.updateStyle();- assertNoSubtreeRestyle("tag-only :hover descendant invalidation ignores unrelated hover", 3);+ printPassWithStyleWork("tag-only :hover descendant invalidation ignores unrelated hover",+ styleWork(() => hover(unrelatedHoverTarget)));runHoverColorInvalidationCase("case-sensitive SVG tag guard updates descendant",diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.html b/Tests/LibWeb/Text/input/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.htmlindex 5e06e4fa43a..b4a4f49b8ee 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/computed-style-read-does-not-recompute-unrelated-dirty-elements.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -13,12 +14,17 @@// Reading computed style of one element must resolve pending invalidations, but it should not have to// recompute style for every dirty element in the document.- resetStyleCounters();- box.classList.add("hot");- assertEqual("probe outside the dirty subtree", readProbe(probe), BASE);- // FIXME: Reading the probe should style nothing of the dirty subtree (styled: 0), but the style engine+ const work = styleWork(+ () => {+ box.classList.add("hot");+ assertEqual("probe outside the dirty subtree", readProbe(probe), BASE);+ },+ internals,+ { flush: false }+ );+ // FIXME: Reading the probe should style nothing of the dirty subtree (restyled: []), but the style engine// runs the whole pending pass for it.- printPassWithStyleCounters("computed style read outside a dirty subtree");+ printPassWithStyleWork("computed style read outside a dirty subtree", work);// Reading inside the dirty subtree must still see fresh style.assertEqual("leaf inside the dirty subtree", readProbe(box.firstChild), MATCH);diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/container-size-query-targeted-restyle.html b/Tests/LibWeb/Text/input/css/style-invalidation/container-size-query-targeted-restyle.htmlindex 762b98a7288..8d93c5a40d7 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/container-size-query-targeted-restyle.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/container-size-query-targeted-restyle.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>function addBystanders(parent, count) {for (let i = 0; i < count; ++i) {@@ -10,14 +11,6 @@}}- function counterSummary() {- const counters = internals.styleCounters();- return {- styledElements: counters.styledElements,- unchangedElements: counters.styledElements - counters.changedElements,- };- }-test(() => {const style = document.createElement("style");style.textContent = `@@ -51,24 +44,22 @@addBystanders(container, 30);addBystanders(document.body, 30);- // Settle everything the page setup left pending before measuring, or what this counts- // depends on how much of that was still outstanding when the first read arrived.- internals.updateStyle();- internals.resetStyleCounters();- getComputedStyle(target).color;+ const readWork = mutate => styleWork(() => {+ mutate();+ getComputedStyle(target).color;+ }, internals, { flush: false });+ const names = elements => `[${elements.map(shortStyleName).join(", ")}]`;+ const unchanged = work => work.restyled().filter(element => !work.changed().includes(element));- const initialCounters = counterSummary();- const initialElementCount = document.querySelectorAll("*").length;+ // styleWork() settles everything the page setup left pending before measuring, or what this+ // traces would depend on how much of that was still outstanding when the first read arrived.+ const initialWork = readWork(() => {});println(`initial target color: ${getComputedStyle(target).color}`);- println(`initial recomputations bounded: ${initialCounters.styledElements < initialElementCount + 5}`);-- internals.resetStyleCounters();- container.style.width = "300px";- getComputedStyle(target).color;+ println(`initial read restyled: ${names(initialWork.restyled())}`);- const dynamicCounters = counterSummary();+ const dynamicWork = readWork(() => container.style.width = "300px");println(`dynamic target color: ${getComputedStyle(target).color}`);- println(`dynamic recomputations bounded: ${dynamicCounters.styledElements <= 4}`);- println(`dynamic noop recomputations bounded: ${dynamicCounters.unchangedElements <= 2}`);+ println(`dynamic read restyled: ${names(dynamicWork.restyled())}`);+ println(`dynamic read restyled without change: ${names(unchanged(dynamicWork))}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.htmlindex 3cf7af89c13..a9aa0a3fb8f 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-first-child-target-does-not-poison-has-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>.menu:has(> .flag) > :first-child {@@ -24,11 +25,9 @@internals.updateStyle();assertEqual("target initially has base color", getComputedStyle(target).color, "rgb(4, 5, 6)");- resetStyleCounters();- document.getElementById("flag").classList.add("flag");- internals.updateStyle();+ const work = styleWork(() => document.getElementById("flag").classList.add("flag"));assertEqual("target matches after child class mutation", getComputedStyle(target).color, "rgb(1, 2, 3)");- printPassWithStyleCounters(":has() with a :first-child target stays targeted", 9);+ printPassWithStyleWork(":has() with a :first-child target stays targeted", work);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.htmlindex 47cb5f85bd7..5d4489430a8 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-interaction-pseudo-insertion-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>/* :has() with an interaction pseudo-class argument, anchored innon-subject position at an ancestor of the streaming container. Plain@@ -32,18 +33,23 @@big.appendChild(leaf);}const stream = document.getElementById("stream");- internals.updateStyle();- internals.resetStyleCounters();+ const work = styleWork(() => {+ for (let i = 0; i < 10; ++i) {+ const p = document.createElement("p");+ p.textContent = `chunk ${i}`;+ stream.appendChild(p);+ internals.updateStyle();+ }+ });- for (let i = 0; i < 10; ++i) {- const p = document.createElement("p");- p.textContent = `chunk ${i}`;- stream.appendChild(p);- internals.updateStyle();+ const passes = [];+ for (const event of work.events) {+ if (event.event === "pass")+ passes.push({ kind: event.kind, restyled: [] });+ else+ passes.at(-1).restyled.push(shortStyleName(event.element));}-- const counters = internals.styleCounters();- println(`appends near interaction :has() styled fewer than 100: ${counters.styledElements < 100}, full passes: ${counters.fullPasses}`);+ println(`appends near interaction :has() restyled per pass: ${passes.map(pass => `${pass.kind} [${pass.restyled.join(", ")}]`).join(", ")}`);// Focus changes and removal of a focused element must still invalidate// the :has(:focus) anchor.diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-mutation-root-filter.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-mutation-root-filter.htmlindex ddd51e418fb..0d624a0651f 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-mutation-root-filter.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-mutation-root-filter.html@@ -1,12 +1,12 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>// A mutation that cannot change what a :has() argument matches should style nothing but what it- // inserts, and one that can should style only that and the anchor with what its rules reach. The- // cases insert different numbers of elements, so the counts are printed.- // FIXME: Appending the <strong> of the tag argument case styles one element more than it inserts.+ // inserts, and one that can should style only that and the anchor with what its rules reach. Each+ // case names what the read after the mutation restyled beyond what the mutation inserted.function runMutationRootCase(name, selector, unrelatedMutation, relatedMutation) {const style = addStyle(document.head, `:root:has(.flag) .subgrid:has(${selector}) { ${MATCH_DECLARATION} }`);@@ -23,15 +23,15 @@fixture.appendChild(makeElement("div"));document.body.offsetWidth;- resetStyleCounters();- unrelatedMutation({ fixture, subgrid });- assertEqual(`${name} after unrelated mutation`, readProbe(subgrid), BASE);- printPassWithStyleCounters(`actual mutation root skips unrelated :has anchor: ${name}`);+ printPassWithStyleWorkBeyondInsertion(`actual mutation root skips unrelated :has anchor: ${name}`, styleWorkBeyondInsertion(() => {+ unrelatedMutation({ fixture, subgrid });+ assertEqual(`${name} after unrelated mutation`, readProbe(subgrid), BASE);+ }, { flush: false }));- resetStyleCounters();- relatedMutation({ subgrid });- assertEqual(`${name} after related mutation`, readProbe(subgrid), MATCH);- printPassWithStyleCounters(`actual mutation root keeps related :has anchor: ${name}`);+ printPassWithStyleWorkBeyondInsertion(`actual mutation root keeps related :has anchor: ${name}`, styleWorkBeyondInsertion(() => {+ relatedMutation({ subgrid });+ assertEqual(`${name} after related mutation`, readProbe(subgrid), MATCH);+ }, { flush: false }));style.remove();fixture.remove();@@ -136,15 +136,15 @@assertEqual("sibling combinator argument initial", readProbe(subgrid), MATCH);- resetStyleCounters();- unrelated.classList.add("show");- assertEqual("sibling combinator argument after unrelated class mutation", readProbe(subgrid), MATCH);- printPassWithStyleCounters("actual mutation root skips unrelated sibling-combinator :has anchor");+ printPassWithStyleWorkBeyondInsertion("actual mutation root skips unrelated sibling-combinator :has anchor", styleWorkBeyondInsertion(() => {+ unrelated.classList.add("show");+ assertEqual("sibling combinator argument after unrelated class mutation", readProbe(subgrid), MATCH);+ }, { flush: false }));- resetStyleCounters();- right.remove();- assertEqual("sibling combinator argument after sibling relationship mutation", readProbe(subgrid), BASE);- printPassWithStyleCounters("actual mutation root keeps sibling-combinator :has anchor for child removal");+ printPassWithStyleWorkBeyondInsertion("actual mutation root keeps sibling-combinator :has anchor for child removal", styleWorkBeyondInsertion(() => {+ right.remove();+ assertEqual("sibling combinator argument after sibling relationship mutation", readProbe(subgrid), BASE);+ }, { flush: false }));style.remove();fixture.remove();@@ -163,15 +163,15 @@assertEqual(`${name} initial`, readProbe(subgrid), BASE);- resetStyleCounters();- right.classList.add("unrelated");- assertEqual(`${name} after unrelated RHS class mutation`, readProbe(subgrid), BASE);- printPassWithStyleCounters(`actual mutation root skips unrelated RHS sibling-combinator :has anchor: ${name}`);+ printPassWithStyleWorkBeyondInsertion(`actual mutation root skips unrelated RHS sibling-combinator :has anchor: ${name}`, styleWorkBeyondInsertion(() => {+ right.classList.add("unrelated");+ assertEqual(`${name} after unrelated RHS class mutation`, readProbe(subgrid), BASE);+ }, { flush: false }));- resetStyleCounters();- right.classList.add("right");- assertEqual(`${name} after matching RHS class mutation`, readProbe(subgrid), MATCH);- printPassWithStyleCounters(`actual mutation root keeps RHS sibling-combinator :has anchor: ${name}`);+ printPassWithStyleWorkBeyondInsertion(`actual mutation root keeps RHS sibling-combinator :has anchor: ${name}`, styleWorkBeyondInsertion(() => {+ right.classList.add("right");+ assertEqual(`${name} after matching RHS class mutation`, readProbe(subgrid), MATCH);+ }, { flush: false }));style.remove();fixture.remove();@@ -220,10 +220,10 @@assertEqual(`${name} initial`, readProbe(target), MATCH);document.body.offsetWidth;- resetStyleCounters();- subgrid.classList.add("unrelated");- assertEqual(`${name} after unrelated mixed-rule mutation`, readProbe(target), MATCH);- printPassWithStyleCounters(`mixed-rule sibling scan preserves feature-filter skip: ${name}`);+ printPassWithStyleWorkBeyondInsertion(`mixed-rule sibling scan preserves feature-filter skip: ${name}`, styleWorkBeyondInsertion(() => {+ subgrid.classList.add("unrelated");+ assertEqual(`${name} after unrelated mixed-rule mutation`, readProbe(target), MATCH);+ }, { flush: false }));style.remove();fixture.remove();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-non-subject-universal-argument-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-non-subject-universal-argument-invalidation.htmlindex 3e890a07ce1..d89a55ce6b0 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-non-subject-universal-argument-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-non-subject-universal-argument-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>/* A universal selector in non-subject position inside a :has() argument.With only descendant and child combinators, a mutation can only change@@ -28,18 +29,23 @@big.appendChild(leaf);}const stream = document.getElementById("stream");- internals.updateStyle();- internals.resetStyleCounters();+ const work = styleWork(() => {+ for (let i = 0; i < 10; ++i) {+ const p = document.createElement("p");+ p.textContent = `chunk ${i}`;+ stream.appendChild(p);+ internals.updateStyle();+ }+ });- for (let i = 0; i < 10; ++i) {- const p = document.createElement("p");- p.textContent = `chunk ${i}`;- stream.appendChild(p);- internals.updateStyle();+ const passes = [];+ for (const event of work.events) {+ if (event.event === "pass")+ passes.push({ kind: event.kind, restyled: [] });+ else+ passes.at(-1).restyled.push(shortStyleName(event.element));}-- const counters = internals.styleCounters();- println(`appends without list items styled fewer than 100: ${counters.styledElements < 100}, full passes: ${counters.fullPasses}`);+ println(`appends without list items restyled per pass: ${passes.map(pass => `${pass.kind} [${pass.restyled.join(", ")}]`).join(", ")}`);// Inserting a subtree that does contain a list item must invalidate// the anchor and apply the rule.diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-structural-feature-filter.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-structural-feature-filter.htmlindex 99d08ed4c7c..f30369ba657 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-structural-feature-filter.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-structural-feature-filter.html@@ -1,12 +1,12 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>// A mutation that cannot change what a :has() argument matches should style nothing but what it- // inserts, and one that can should style only that and the anchor with what its rules reach. The- // cases insert different numbers of elements, so the counts are printed.- // FIXME: Appending the <strong> of the class case styles one element more than it inserts.+ // inserts, and one that can should style only that and the anchor with what its rules reach. Each+ // case names what the read after the mutation restyled beyond what the mutation inserted.function settle(anchor) {readProbe(anchor);@@ -133,13 +133,14 @@settle(anchor);const existing = mutationCase.before?.({ fixture, anchor, unrelated });- internals.updateStyle();- resetStyleCounters();- const cleanup = mutationCase.mutate({ fixture, anchor, unrelated, existing });- assertEqual(`${featureCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), BASE);- printPassWithStyleCounters(`unrelated structural mutation skips :has walk: ${featureCase.name} / ${mutationCase.name}`);- if (typeof cleanup === "function")- cleanup();+ const work = styleWorkBeyondInsertion(() => {+ const cleanup = mutationCase.mutate({ fixture, anchor, unrelated, existing });+ assertEqual(`${featureCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), BASE);+ return cleanup;+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`unrelated structural mutation skips :has walk: ${featureCase.name} / ${mutationCase.name}`, work);+ if (typeof work.returned === "function")+ work.returned();} finally {style.remove();fixture.remove();@@ -199,10 +200,11 @@try {assertEqual(`${featureCase.name} / ${mutationCase.name} initial`, readProbe(anchor), BASE);const existing = mutationCase.before?.({ fixture, anchor, featureCase });- resetStyleCounters();- mutationCase.mutate({ fixture, anchor, existing, featureCase });- assertEqual(`${featureCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), MATCH);- printPassWithStyleCounters(`related structural mutation keeps :has walk: ${featureCase.name} / ${mutationCase.name}`);+ const work = styleWorkBeyondInsertion(() => {+ mutationCase.mutate({ fixture, anchor, existing, featureCase });+ assertEqual(`${featureCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), MATCH);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`related structural mutation keeps :has walk: ${featureCase.name} / ${mutationCase.name}`, work);} finally {style.remove();fixture.remove();@@ -262,10 +264,11 @@try {assertEqual(`${selectorCase.name} / ${mutationCase.name} initial`, readProbe(anchor), BASE);const existing = mutationCase.before?.({ fixture, anchor });- resetStyleCounters();- mutationCase.mutate({ fixture, anchor, existing });- assertEqual(`${selectorCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), BASE);- printPassWithStyleCounters(`concrete :has argument keeps featureless mutation filtered: ${selectorCase.name} / ${mutationCase.name}`);+ const work = styleWorkBeyondInsertion(() => {+ mutationCase.mutate({ fixture, anchor, existing });+ assertEqual(`${selectorCase.name} / ${mutationCase.name} after mutation`, readProbe(anchor), BASE);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`concrete :has argument keeps featureless mutation filtered: ${selectorCase.name} / ${mutationCase.name}`, work);} finally {style.remove();fixture.remove();@@ -486,10 +489,11 @@try {const context = caseData.setup({ fixture, anchor });assertEqual(`${caseData.name} initial`, readProbe(anchor), caseData.expectedInitial);- resetStyleCounters();- caseData.mutate({ fixture, anchor, ...context });- assertEqual(`${caseData.name} after mutation`, readProbe(anchor), caseData.expectedAfter);- printPassWithStyleCounters(`featureless-sensitive structural mutation keeps :has walk: ${caseData.name}`);+ const work = styleWorkBeyondInsertion(() => {+ caseData.mutate({ fixture, anchor, ...context });+ assertEqual(`${caseData.name} after mutation`, readProbe(anchor), caseData.expectedAfter);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`featureless-sensitive structural mutation keeps :has walk: ${caseData.name}`, work);} finally {style.remove();fixture.remove();@@ -624,10 +628,11 @@try {const context = caseData.setup({ fixture, anchor });assertEqual(`${caseData.name} initial`, readProbe(anchor), BASE);- resetStyleCounters();- caseData.mutate({ fixture, anchor, ...context });- assertEqual(`${caseData.name} after mutation`, readProbe(anchor), MATCH);- printPassWithStyleCounters(`unprobeable pseudo structural mutation keeps :has walk: ${caseData.name}`);+ const work = styleWorkBeyondInsertion(() => {+ caseData.mutate({ fixture, anchor, ...context });+ assertEqual(`${caseData.name} after mutation`, readProbe(anchor), MATCH);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`unprobeable pseudo structural mutation keeps :has walk: ${caseData.name}`, work);} finally {if (document.activeElement instanceof HTMLElement)document.activeElement.blur();@@ -702,10 +707,11 @@try {assertEqual(`${caseData.name} initial`, readProbe(anchor), BASE);- resetStyleCounters();- caseData.mutate({ fixture, anchor });- assertEqual(`${caseData.name} after mutation`, readProbe(anchor), caseData.expectedAfter);- printPassWithStyleCounters(`case-sensitive name structural mutation keeps :has walk: ${caseData.name}`);+ const work = styleWorkBeyondInsertion(() => {+ caseData.mutate({ fixture, anchor });+ assertEqual(`${caseData.name} after mutation`, readProbe(anchor), caseData.expectedAfter);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`case-sensitive name structural mutation keeps :has walk: ${caseData.name}`, work);} finally {style.remove();fixture.remove();@@ -811,10 +817,11 @@try {const context = caseData.setup({ fixture, anchor });assertEqual(`${caseData.name} initial`, readProbe(context.target), caseData.expectedInitial);- resetStyleCounters();- caseData.mutate({ fixture, anchor, ...context });- assertEqual(`${caseData.name} after mutation`, readProbe(context.target), caseData.expectedAfter);- printPassWithStyleCounters(`sibling relationship mutation keeps sibling-aware :has updates: ${caseData.name}`);+ const work = styleWorkBeyondInsertion(() => {+ caseData.mutate({ fixture, anchor, ...context });+ assertEqual(`${caseData.name} after mutation`, readProbe(context.target), caseData.expectedAfter);+ }, { flush: false });+ printPassWithStyleWorkBeyondInsertion(`sibling relationship mutation keeps sibling-aware :has updates: ${caseData.name}`, work);} finally {style.remove();fixture.remove();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/has-subject-hover-skips-descendant-fanout.html b/Tests/LibWeb/Text/input/css/style-invalidation/has-subject-hover-skips-descendant-fanout.htmlindex 15f11b02b53..9fe63c61eb7 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/has-subject-hover-skips-descendant-fanout.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/has-subject-hover-skips-descendant-fanout.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>body {@@ -63,10 +64,9 @@assertEqual("subject :has() rule matches", getComputedStyle(wrapper).color, "rgb(1, 2, 3)");assertEqual("descendant :has() rule does not match", readProbe(wrapper.querySelector(".target")), BASE);- resetStyleCounters();- hover(hoverSource);-- printPassWithStyleCounters("subject :has() hover skips descendant fanout", 19);+ const work = styleWork(() => hover(hoverSource));+ assertEqual("hover source after hover", getComputedStyle(hoverSource).backgroundColor, "rgb(4, 5, 6)");+ printPassWithStyleWork("subject :has() hover skips descendant fanout", work);}{@@ -82,14 +82,18 @@assertEqual("subject :has() rule matches before batched mutations", getComputedStyle(wrapper).color, "rgb(1, 2, 3)");assertEqual("descendant :has() rule does not match before batched mutations", readProbe(target), BASE);- resetStyleCounters();- unrelated.classList.add("unrelated");- needle.classList.add("needle");-// Reading the target's style resolves the pending :has() fanout for the inheritance chain that leads// to it, so the descendant rule matches without recomputing every dirty element in the document.- assertEqual("descendant :has() rule matches after batched mutations", readProbe(target), MATCH);- println(`PASS: batched subject-only :has() invalidation upgrades to descendant fanout (styled >= 1: ${internals.styleCounters().styledElements >= 1})`);+ const work = styleWork(+ () => {+ unrelated.classList.add("unrelated");+ needle.classList.add("needle");+ assertEqual("descendant :has() rule matches after batched mutations", readProbe(target), MATCH);+ },+ internals,+ { flush: false }+ );+ printPassWithStyleWork("batched subject-only :has() invalidation upgrades to descendant fanout", work);}{@@ -102,7 +106,6 @@internals.updateStyle();assertEqual("descendant :has(:focus) rule does not match before focus", readProbe(target), BASE);- resetStyleCounters();input.focus();internals.updateStyle();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/identical-elements-share-one-computed-style.html b/Tests/LibWeb/Text/input/css/style-invalidation/identical-elements-share-one-computed-style.htmlindex 13672bf7e9b..bfcecd2c946 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/identical-elements-share-one-computed-style.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/identical-elements-share-one-computed-style.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -8,35 +9,34 @@internals.updateStyle();- function sharedWhileAdding(build) {+ function leafOutcomesWhileAdding(build) {const box = makeElement("section");build(box);- document.body.append(box);- resetStyleCounters();- internals.updateStyle();- const shared = internals.styleCounters().sharedElements;+ const work = styleWork(() => document.body.append(box));+ const leaves = work.events.filter(event => event.event === "restyle" && event.element.includes(".leaf"));+ const outcomes = ["computed", "shared", "reused"]+ .map(outcome => `${outcome} ${leaves.filter(event => event.outcome === outcome).length}`)+ .join(", ");const probe = readProbe(box.firstChild);box.remove();internals.updateStyle();- return { shared, probe };+ return { outcomes, probe };}// Ten siblings with the same rules, the same parent and nothing of their own to say: one of- // them computes a style and the other nine take it. The bound is printed rather than the- // count, since anything else the same pass recomputes may share as well.- const alike = sharedWhileAdding(box => {+ // them computes a style and the other nine take it.+ const alike = leafOutcomesWhileAdding(box => {for (let i = 0; i < 10; i++) box.appendChild(makeElement("div", { className: "leaf" }));});- println(`PASS: alike siblings compute one style between them: ${alike.shared >= 9}`);+ println(`alike siblings: ${alike.outcomes}`);assertEqual("the shared style is the matched one", alike.probe, MATCH);- // Ten siblings whose own declarations all differ share nothing with each other, so the same- // page adding the same number of elements stays below the bound above.- const differing = sharedWhileAdding(box => {+ // Ten siblings whose own declarations all differ share nothing with each other.+ const differing = leafOutcomesWhileAdding(box => {for (let i = 0; i < 10; i++)box.appendChild(makeElement("div", { className: "leaf", attributes: { style: `--i: ${i}` } }));});- println(`PASS: an element's own declaration keeps its style its own: ${differing.shared < 9}`);+ println(`siblings with declarations of their own: ${differing.outcomes}`);assertEqual("an unshared style is still the matched one", differing.probe, MATCH);style.remove();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.html b/Tests/LibWeb/Text/input/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.htmlindex 88a15c48c52..05ef1afb0f1 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/identical-pseudo-elements-share-one-computed-style.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>li {color: rgb(12, 34, 56);@@ -8,24 +9,21 @@<ul id="list"></ul><script>test(() => {- internals.updateStyle();const list = document.getElementById("list");- for (let i = 0; i < 10; ++i) {- const item = document.createElement("li");- // Keep the originating styles distinct while leaving their inherited- // groups identical, which gives every marker the same complete input.- item.style.width = `${i}px`;- item.textContent = `item ${i}`;- list.appendChild(item);- }+ const work = styleWork(() => {+ for (let i = 0; i < 10; ++i) {+ const item = document.createElement("li");+ // Keep the originating styles distinct while leaving their inherited+ // groups identical, which gives every marker the same complete input.+ item.style.width = `${i}px`;+ item.textContent = `item ${i}`;+ list.appendChild(item);+ }+ });- internals.resetStyleCounters();- internals.updateStyle();-- // FIXME: Nine of the ten identical markers should take the first one's record- // (sharedElements >= 9), but the style engine counts no shared or reused pseudo-element.- const counters = internals.styleCounters();- println(`identical markers: shared: ${counters.sharedElements}, reused: ${counters.reusedElements}`);+ // FIXME: Nine of the ten identical markers should take the first one's record, but the style engine+ // shares no pseudo-element record. The style trace lists the items, not their markers.+ println(work.text.trimEnd());println(`PASS: every marker inherited its color: ${[...list.children].every(item => getComputedStyle(item, "::marker").color === "rgb(12, 34, 56)")}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/input-type-same-state-no-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/input-type-same-state-no-invalidation.htmlindex ca40a81e830..5f993bcbf14 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/input-type-same-state-no-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/input-type-same-state-no-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>/* A never-matching :has() argument scans the whole wrapper subtree andleaves every element in it inside the :has() scope, with #wrapper as an@@ -30,20 +31,11 @@}const input = document.getElementById("file-input");- internals.updateStyle();- internals.resetStyleCounters();-// Re-setting the type attribute to a value that parses to the same// state must not rebuild the input's internal shadow tree. If it does,// the internal child-list mutations take the conservative :has() path// above and fan out into a restyle of the whole wrapper subtree.- input.setAttribute("type", "file");- internals.updateStyle();-- const styled = internals.styleCounters().styledElements;- if (styled < 10)- println("PASS: same-state type set stayed targeted");- else- println(`FAIL: same-state type set styled ${styled} elements`);+ const work = styleWork(() => input.setAttribute("type", "file"));+ println(`same-state type set restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-adopted-sheet-counters.html b/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-adopted-sheet-counters.htmldeleted file mode 100644index e0c11d89333..00000000000--- a/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-adopted-sheet-counters.html+++ /dev/null@@ -1,177 +0,0 @@-<!DOCTYPE html>-<meta charset="utf-8">-<script src="../../include.js"></script>-<script src="structural-matrix.js"></script>-<script>- // Counters lock in targeted adoptedStyleSheets invalidation across outer/inner @media combinations.- //- // Adopting a sheet styles only the elements its rules apply to: .subject where a rule for it- // applies, nothing otherwise.-- function setupFixture() {- const fixture = makeElement("section");- fixture.appendChild(makeElement("div", { className: "subject" }));- fixture.appendChild(makeElement("div", { className: "bystander" }));- fixture.appendChild(makeElement("div", { className: "bystander" }));- document.body.appendChild(fixture);- return fixture;- }-- function settleAndReset() {- document.body.offsetWidth;- document.body.offsetWidth;- resetStyleCounters();- }-- function adoptOnce(name, options, cssText, bound) {- const fixture = setupFixture();- settleAndReset();-- const sheet = new CSSStyleSheet(options);- sheet.replaceSync(cssText);- document.adoptedStyleSheets = [sheet];- document.body.offsetWidth;-- printPassWithStyleCounters(name, bound);-- document.adoptedStyleSheets = [];- fixture.remove();- }-- test(() => {- internals.updateStyle();- // Outer MediaList: empty (defaults to "all"), matches by default.- adoptOnce(- "adopt sheet with empty outer media",- {},- ".subject { color: rgb(1, 2, 3); }",- 1- );-- adoptOnce(- "adopt sheet with outer media=all",- { media: "all" },- ".subject { color: rgb(1, 2, 3); }",- 1- );-- adoptOnce(- "adopt sheet with outer media=screen (matches)",- { media: "screen" },- ".subject { color: rgb(1, 2, 3); }",- 1- );-- adoptOnce(- "adopt sheet with outer media=print (does not match)",- { media: "print" },- ".subject { color: rgb(1, 2, 3); }",- 0- );-- adoptOnce(- "adopt sheet with outer width media that matches",- { media: "(min-width: 1px)" },- ".subject { color: rgb(1, 2, 3); }",- 1- );-- adoptOnce(- "adopt sheet with outer width media that does not match",- { media: "(min-width: 100000px)" },- ".subject { color: rgb(1, 2, 3); }",- 0- );-- // Targeted invalidation: the rule selector matches no element in the document,- // so AdoptedStyleSheetsList by itself produces a small targeted walk. The- // residual recompute work is dominated by the first-eval MediaQueryChangedMatchState.- adoptOnce(- "adopt sheet with rule that matches no element",- {},- ".no-such-element { color: rgb(1, 2, 3); }",- 0- );-- // Inner @media rule: first eval flips m_matches false -> true.- adoptOnce(- "adopt sheet with inner @media that matches",- {},- "@media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }",- 1- );-- // Inner @media that does not match: m_matches starts at false and stays false- // on first eval, so no inner flip is recorded.- adoptOnce(- "adopt sheet with inner @media that does not match",- {},- "@media (min-width: 100000px) { .subject { color: rgb(1, 2, 3); } }",- 0- );-- // Inner @media that matches but is wrapped in a non-matching outer media.- adoptOnce(- "adopt sheet with non-matching outer media wrapping a matching inner @media",- { media: "print" },- "@media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }",- 0- );-- adoptOnce(- "adopt sheet with multiple inner @media rules, all matching",- {},- `- @media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }- @media all { .subject { background-color: rgb(4, 5, 6); } }- `,- 1- );-- adoptOnce(- "adopt sheet with multiple inner @media rules, none matching",- {},- `- @media (min-width: 100000px) { .subject { color: rgb(1, 2, 3); } }- @media print { .subject { background-color: rgb(4, 5, 6); } }- `,- 0- );-- adoptOnce(- "adopt sheet with mixed matching and non-matching inner @media rules",- {},- `- @media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }- @media print { .subject { background-color: rgb(4, 5, 6); } }- `,- 1- );-- adoptOnce(- "adopt sheet with nested inner @media rules",- {},- `- @media (min-width: 1px) {- @media all {- .subject { color: rgb(1, 2, 3); }- }- }- `,- 1- );-- adoptOnce(- "adopt sheet with @supports wrapping an inner @media",- {},- `- @supports (color: red) {- @media (min-width: 1px) {- .subject { color: rgb(1, 2, 3); }- }- }- `,- 1- );- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-style-element-counters.html b/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-style-element-counters.htmldeleted file mode 100644index 432c4415110..00000000000--- a/Tests/LibWeb/Text/input/css/style-invalidation/media-eval-style-element-counters.html+++ /dev/null@@ -1,146 +0,0 @@-<!DOCTYPE html>-<meta charset="utf-8">-<script src="../../include.js"></script>-<script src="structural-matrix.js"></script>-<script>- // Adding a <style> or <link> sheet flows through StyleSheetList::add_sheet, which- // eagerly calls CSSStyleSheet::evaluate_media_queries before the next style update.- // That eager call absorbs the first-evaluation match-state change, so the next- // update_style does not double-invalidate even with the current code.- //- // These tests pin that behavior so the optimization commits don't regress it.- //- // Adding a <style> styles only the elements its rules apply to, beside the arriving <style>- // element: .subject where a rule for it applies, nothing else.-- function setupFixture() {- const fixture = makeElement("section");- fixture.appendChild(makeElement("div", { className: "subject" }));- fixture.appendChild(makeElement("div", { className: "bystander" }));- fixture.appendChild(makeElement("div", { className: "bystander" }));- document.body.appendChild(fixture);- return fixture;- }-- function settleAndReset() {- document.body.offsetWidth;- document.body.offsetWidth;- resetStyleCounters();- }-- function addStyleOnce(name, attributes, cssText, bound) {- const fixture = setupFixture();- settleAndReset();-- const style = document.createElement("style");- for (const [key, value] of Object.entries(attributes))- style.setAttribute(key, value);- style.textContent = cssText;- document.head.appendChild(style);- document.body.offsetWidth;-- printPassWithStyleCounters(name, bound);-- style.remove();- fixture.remove();- }-- test(() => {- internals.updateStyle();- addStyleOnce(- "<style> with empty outer media",- {},- ".subject { color: rgb(1, 2, 3); }",- 2- );-- addStyleOnce(- "<style> with outer media=all",- { media: "all" },- ".subject { color: rgb(1, 2, 3); }",- 2- );-- addStyleOnce(- "<style> with outer media=screen (matches)",- { media: "screen" },- ".subject { color: rgb(1, 2, 3); }",- 2- );-- addStyleOnce(- "<style> with outer media=print (does not match)",- { media: "print" },- ".subject { color: rgb(1, 2, 3); }",- 1- );-- addStyleOnce(- "<style> with outer width media that matches",- { media: "(min-width: 1px)" },- ".subject { color: rgb(1, 2, 3); }",- 2- );-- addStyleOnce(- "<style> with outer width media that does not match",- { media: "(min-width: 100000px)" },- ".subject { color: rgb(1, 2, 3); }",- 1- );-- addStyleOnce(- "<style> with rule that matches no element",- {},- ".no-such-element { color: rgb(1, 2, 3); }",- 1- );-- addStyleOnce(- "<style> with inner @media that matches",- {},- "@media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }",- 2- );-- addStyleOnce(- "<style> with inner @media that does not match",- {},- "@media (min-width: 100000px) { .subject { color: rgb(1, 2, 3); } }",- 1- );-- addStyleOnce(- "<style> with multiple inner @media rules, all matching",- {},- `- @media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }- @media all { .subject { background-color: rgb(4, 5, 6); } }- `,- 2- );-- addStyleOnce(- "<style> with mixed matching and non-matching inner @media rules",- {},- `- @media (min-width: 1px) { .subject { color: rgb(1, 2, 3); } }- @media print { .subject { background-color: rgb(4, 5, 6); } }- `,- 2- );-- addStyleOnce(- "<style> with nested inner @media rules",- {},- `- @media (min-width: 1px) {- @media all {- .subject { color: rgb(1, 2, 3); }- }- }- `,- 2- );- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/media-list-shadow-mutation-counters.html b/Tests/LibWeb/Text/input/css/style-invalidation/media-list-shadow-mutation-counters.htmldeleted file mode 100644index c0a38a2eb5b..00000000000--- a/Tests/LibWeb/Text/input/css/style-invalidation/media-list-shadow-mutation-counters.html+++ /dev/null@@ -1,307 +0,0 @@-<!DOCTYPE html>-<meta charset="utf-8">-<script src="../../include.js"></script>-<script src="structural-matrix.js"></script>-<script>- const ACTIVE_COLOR = "rgb(1, 2, 3)";- const ACTIVE_BACKGROUND = "rgb(4, 5, 6)";-- function settleAndReset() {- document.body.offsetWidth;- document.body.offsetWidth;- resetStyleCounters();- }-- function makeShadowFixture(options = {}) {- const fixture = makeElement("section", { className: options.fixtureClass || "" });- const wrapper = makeElement("div", { className: options.wrapperClass || "" });- const host = makeElement("x-media-host", {- className: options.hostClass || "",- attributes: options.hostAttributes || {},- });- const assigned = makeElement(options.assignedTag || "span", {- className: options.assignedClass || "assigned",- attributes: options.assignedAttributes || {},- text: "assigned",- });-- if (options.slotName)- assigned.setAttribute("slot", options.slotName);-- wrapper.appendChild(host);- fixture.appendChild(wrapper);- document.body.appendChild(fixture);-- const shadowRoot = host.attachShadow({ mode: "open" });- const shadowWrapper = makeElement("div", { className: options.shadowWrapperClass || "shadow-wrapper" });- const slot = document.createElement("slot");- if (options.slotName)- slot.name = options.slotName;- if (options.slotClass)- slot.className = options.slotClass;-- const inner = makeElement("span", { className: "inner", text: "inner" });- shadowWrapper.appendChild(slot);- shadowWrapper.appendChild(inner);- shadowRoot.appendChild(shadowWrapper);- host.appendChild(assigned);-- return { fixture, host, shadowRoot, assigned, inner, slot };- }-- function readProperty(target, property) {- return getComputedStyle(target).getPropertyValue(property).trim();- }-- function runMediaMutationCase(caseData) {- const fixture = makeShadowFixture(caseData);- const target = caseData.target(fixture);- const sheet = new CSSStyleSheet({ media: caseData.initialMedia || "print" });- sheet.replaceSync(caseData.cssText);- fixture.shadowRoot.adoptedStyleSheets = [sheet];-- document.body.offsetWidth;- assertEqual(`${caseData.name} before`, readProperty(target, caseData.property), caseData.before);- settleAndReset();-- if (caseData.mutate)- caseData.mutate(sheet);- else- sheet.media.mediaText = caseData.afterMedia || "screen";-- document.body.offsetWidth;- assertEqual(`${caseData.name} after`, readProperty(target, caseData.property), caseData.after);- // Only the host, its shadow tree and the element assigned to its slot should be styled.- printPassWithStyleCounters(caseData.name, 5);-- fixture.fixture.remove();- }-- test(() => {- internals.updateStyle();- const cases = [- {- name: "shadow media mutation activates bare :host selector",- cssText: `:host { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates classed :host selector",- hostClass: "active",- cssText: `:host(.active) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates attributed :host selector",- hostAttributes: { "data-state": "on" },- cssText: `:host([data-state="on"]) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates negated :host selector",- cssText: `:host(:not(.disabled)) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates :host :is selector",- hostClass: "active",- cssText: `:host(:is(.active, [data-state])) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates :host :where selector",- hostAttributes: { "data-state": "on" },- cssText: `:host(:where(.active, [data-state])) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation deactivates classed :host selector",- hostClass: "active",- initialMedia: "screen",- afterMedia: "print",- cssText: `:host(.active) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: ACTIVE_COLOR,- after: "rgb(0, 0, 0)",- },- {- name: "shadow media appendMedium activates :host selector",- cssText: `:host { color: ${ACTIVE_COLOR}; }`,- mutate: sheet => sheet.media.appendMedium("screen"),- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media deleteMedium deactivates :host selector",- initialMedia: "screen, print",- cssText: `:host { color: ${ACTIVE_COLOR}; }`,- mutate: sheet => sheet.media.deleteMedium("screen"),- target: fixture => fixture.host,- property: "color",- before: ACTIVE_COLOR,- after: "rgb(0, 0, 0)",- },- {- name: "shadow media mutation activates internal rule guarded by :host",- hostClass: "active",- cssText: `:host(.active) .inner { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.inner,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates ::slotted class selector",- cssText: `::slotted(.assigned) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates ::slotted type and class selector",- assignedTag: "span",- cssText: `::slotted(span.assigned) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates ::slotted attribute selector",- assignedAttributes: { "data-kind": "primary" },- cssText: `::slotted([data-kind="primary"]) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates ::slotted :is selector",- cssText: `::slotted(:is(.assigned, [data-kind])) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates ::slotted :not selector",- cssText: `::slotted(:not(.missing)) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates named-slot ::slotted selector",- slotName: "main",- cssText: `::slotted(.assigned) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates slotted background style",- cssText: `::slotted(.assigned) { background-color: ${ACTIVE_BACKGROUND}; }`,- target: fixture => fixture.assigned,- property: "background-color",- before: "rgba(0, 0, 0, 0)",- after: ACTIVE_BACKGROUND,- },- {- name: "shadow media mutation activates bare slot inheritance",- cssText: `slot { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates named slot inheritance",- slotName: "main",- slotClass: "main-slot",- cssText: `slot.main-slot { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates descendant slot inheritance",- shadowWrapperClass: "shadow-wrapper themed",- cssText: `.themed slot { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates nested host structure",- wrapperClass: "outer-wrapper",- hostClass: "active",- cssText: `:host(.active) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.host,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates paragraph assigned node",- assignedTag: "p",- cssText: `::slotted(p.assigned) { color: ${ACTIVE_COLOR}; }`,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- {- name: "shadow media mutation activates compound host and slotted selectors",- hostClass: "active",- cssText: `- :host(.active) { color: ${ACTIVE_COLOR}; }- ::slotted(.assigned) { background-color: ${ACTIVE_BACKGROUND}; }- `,- target: fixture => fixture.assigned,- property: "background-color",- before: "rgba(0, 0, 0, 0)",- after: ACTIVE_BACKGROUND,- },- {- name: "shadow media mutation activates inner and slotted selectors together",- cssText: `- .inner { background-color: ${ACTIVE_BACKGROUND}; }- ::slotted(.assigned) { color: ${ACTIVE_COLOR}; }- `,- target: fixture => fixture.assigned,- property: "color",- before: "rgb(0, 0, 0)",- after: ACTIVE_COLOR,- },- ];-- for (const caseData of cases)- runMediaMutationCase(caseData);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/non-inherited-change-stops-above-children.html b/Tests/LibWeb/Text/input/css/style-invalidation/non-inherited-change-stops-above-children.htmlindex 58c0afadbd6..32728a13762 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/non-inherited-change-stops-above-children.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/non-inherited-change-stops-above-children.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>#plain.changed { background-color: blue }@@ -17,22 +18,20 @@// What a child reads of its parent is the inherited half of the parent's style, so a change// confined to non-inherited properties has nothing a child can see and the walk stops at the// parent. `inherit` on a non-inherited property is the one way a child reaches past that.- const measure = (id, label, bound, read) => {- internals.updateStyle();- resetStyleCounters();- document.getElementById(id).classList.add("changed");- internals.updateStyle();- printPassWithStyleCounters(label, bound);+ const measure = (id, label, read) => {+ const work = styleWork(() => document.getElementById(id).classList.add("changed"));+ printPassWithStyleWork(label, work);if (read)println(read());};const firstChildOf = id => document.getElementById(id).firstElementChild;- measure("plain", "a non-inherited change reaches no child", 1);- measure("inheriting", "a child explicitly inheriting a non-inherited property is reached", 4,+ measure("plain", "a non-inherited change reaches no child",+ () => `background-color: ${getComputedStyle(document.getElementById("plain")).backgroundColor}`);+ measure("inheriting", "a child explicitly inheriting a non-inherited property is reached",() => `explicitly inherited margin-left: ${getComputedStyle(firstChildOf("inheriting")).marginLeft}`);- measure("color-source", "an inherited change reaches every child", 4,+ measure("color-source", "an inherited change reaches every child",() => `inherited color: ${getComputedStyle(firstChildOf("color-source")).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/opaque-selectors-restyle-around-the-change.html b/Tests/LibWeb/Text/input/css/style-invalidation/opaque-selectors-restyle-around-the-change.htmlindex 96474c6d4db..377ad0204be 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/opaque-selectors-restyle-around-the-change.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/opaque-selectors-restyle-around-the-change.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>li:nth-child(2 of .counted) { color: rgb(0, 128, 0); }@scope (.scope-root) to (.scope-limit) {@@ -20,15 +21,10 @@}}- function settle() {- internals.updateStyle();- internals.resetStyleCounters();- }-- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}, full passes ${c.fullPasses}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}function color(id, root = document) {@@ -42,35 +38,27 @@shadowRoot.innerHTML = `<style>:is(:host(.on), .wrapper) > span { color: rgb(255, 0, 0); }</style><span id="shadow-child"></span>`;- settle();// A class no selector tests in a way the invalidation map does not follow restyles one element.- document.getElementById("unrelated").classList.add("whatever");- dumpCounters("unrelated class", 1);+ dumpWork("unrelated class", () => document.getElementById("unrelated").classList.add("whatever"));// A sibling an :nth-child(… of S) counts restyles its parent's children.- settle();- document.getElementById("first").classList.add("counted");- document.getElementById("third").classList.add("counted");- dumpCounters(":nth-child(… of S) sibling", 6);+ dumpWork(":nth-child(… of S) sibling", () => {+ document.getElementById("first").classList.add("counted");+ document.getElementById("third").classList.add("counted");+ });println(`second: ${color("second")}, third: ${color("third")}`);// A scope root restyles its subtree.- settle();- document.getElementById("scope").classList.add("scope-root");- dumpCounters("@scope root", 4);+ dumpWork("@scope root", () => document.getElementById("scope").classList.add("scope-root"));println(`scoped: ${color("scoped")}`);// A scope limit restyles its subtree.- settle();- document.getElementById("limit").classList.add("scope-limit");- dumpCounters("@scope limit", 2);+ dumpWork("@scope limit", () => document.getElementById("limit").classList.add("scope-limit"));println(`limited: ${color("limited")}`);// A compound that may or may not be the host restyles the subtree, shadow tree included, of the element carrying the fact.- settle();- host.classList.add("on");- dumpCounters("host or ancestor", 3);+ dumpWork("host or ancestor", () => host.classList.add("on"));println(`shadow child: ${color("shadow-child", shadowRoot)}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/recomputed-elements-still-share-one-computed-style.html b/Tests/LibWeb/Text/input/css/style-invalidation/recomputed-elements-still-share-one-computed-style.htmlindex 32b9f08b573..b20c00711cd 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/recomputed-elements-still-share-one-computed-style.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/recomputed-elements-still-share-one-computed-style.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -14,11 +15,10 @@// The ten leaves have each computed a style once and none of them declares an animation or a// transition. Recomputing them all decides the same thing about each, so one of them derives// a style and the other nine take it, exactly as on their first pass.- resetStyleCounters();- const second = addStyle(document.head, `.leaf { color: rgb(1, 2, 3); }`);- internals.updateStyle();- const shared = internals.styleCounters().sharedElements;- println(`PASS: alike siblings share a recomputed style too: ${shared >= 9}`);+ let second;+ const work = styleWork(() => (second = addStyle(document.head, `.leaf { color: rgb(1, 2, 3); }`)));+ const leaves = work.events.filter(event => event.event === "restyle" && event.element.includes(".leaf"));+ println(`recomputed siblings: ${["computed", "shared", "reused"].map(outcome => `${outcome} ${leaves.filter(event => event.outcome === outcome).length}`).join(", ")}`);assertEqual("the shared style is the matched one", readProbe(box.firstChild), MATCH);box.remove();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/same-parent-move-root-only.html b/Tests/LibWeb/Text/input/css/style-invalidation/same-parent-move-root-only.htmlindex 502d761f275..9822dc217ee 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/same-parent-move-root-only.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/same-parent-move-root-only.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -23,15 +24,16 @@fixture.append(before, moved);document.body.offsetWidth;- resetStyleCounters();-- fixture.moveBefore(moved, before);- assertEqual("moved root became first child", getComputedStyle(moved).getPropertyValue("--root-position").trim(), "first");- assertEqual("moved root non-inherited style changed", getComputedStyle(moved).borderTopWidth, "3px");- assertEqual("descendant style stayed valid", getComputedStyle(moved.lastChild).color, "rgb(1, 2, 3)");+ const work = styleWorkBeyondInsertion(() => {+ fixture.moveBefore(moved, before);+ assertEqual("moved root became first child", getComputedStyle(moved).getPropertyValue("--root-position").trim(), "first");+ assertEqual("moved root non-inherited style changed", getComputedStyle(moved).borderTopWidth, "3px");+ assertEqual("descendant style stayed valid", getComputedStyle(moved.lastChild).color, "rgb(1, 2, 3)");+ }, { flush: false });// The move styles the moved root and its 50 descendants, which inherit --root-position from// it, and nothing else.- printPassWithStyleCounters("same-parent move preserves unchanged descendant styles", 51);+ const restyledInMovedSubtree = work.restyled().length - work.beyondInsertion.length;+ printPassWithStyleWorkBeyondInsertion(`same-parent move preserves unchanged descendant styles: ${restyledInMovedSubtree} of the 51 moved elements restyled`, work);style.remove();fixture.remove();@@ -43,7 +45,6 @@const context = setup(fixture);document.body.offsetWidth;- resetStyleCounters();mutate(context, fixture);assertEqual(name, readProbe(context.target), expectedAfter);@@ -267,7 +268,6 @@readProbe(context.target);document.body.offsetWidth;- resetStyleCounters();mutate(context, fixture);assertEqual(name, readProbe(context.target), expectedAfter);@@ -609,7 +609,6 @@readProbe(context.target);document.body.offsetWidth;- resetStyleCounters();mutate(context, fixture);assertEqual(name, readProbe(context.target), expectedAfter);@@ -993,7 +992,6 @@readProbe(context.target);document.body.offsetWidth;- resetStyleCounters();dirty(context, fixture);mutate(context, fixture);diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/scroll-state-container-move-scans.html b/Tests/LibWeb/Text/input/css/style-invalidation/scroll-state-container-move-scans.htmlindex cf4532b849c..85a1ad6c73b 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/scroll-state-container-move-scans.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/scroll-state-container-move-scans.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>#scroller { container-type: scroll-state; overflow: auto; width: 100px; height: 100px }#filler { height: 300px }@@ -25,11 +26,13 @@// container, the filler and the two spans left in it.dependent.remove();document.getElementById("to").appendChild(scroller);- internals.resetStyleCounters();+ internals.beginStyleTrace();await animationFrame();await animationFrame();internals.updateStyle();- println(`elements styled after moving the container <= 4: ${internals.styleCounters().styledElements <= 4}`);+ const events = parseStyleTrace(internals.takeStyleTrace(), { stylePassesOnly: true });+ const restyled = [...new Set(events.filter(event => event.event === "restyle" && event.outcome !== "kept").map(event => shortStyleName(event.element)))];+ println(`elements styled after moving the container: [${restyled.join(", ")}]`);// A query asking about the container now reads the state published under its new identity.filler.appendChild(dependent);diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.html b/Tests/LibWeb/Text/input/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.htmlindex a10d8f4592b..b3fbc7c85fd 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/setting-radialgradient-cx-shouldnt-invalidate-style.html@@ -5,15 +5,10 @@</defs></svg><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>test(() => {- internals.updateStyle();- internals.resetStyleCounters();-- gradient.setAttribute("cx", "75%");-- internals.updateStyle();- const styled = internals.styleCounters().styledElements;- println(styled == 0 ? "PASS" : `FAIL: styled ${styled} elements`);+ const work = styleWork(() => gradient.setAttribute("cx", "75%"));+ println(`restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-first-child-pseudo-only.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-first-child-pseudo-only.htmldeleted file mode 100644index d936c6123ab..00000000000--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-first-child-pseudo-only.html+++ /dev/null@@ -1,53 +0,0 @@-<!DOCTYPE html>-<meta charset="utf-8">-<script src="../../include.js"></script>-<div id="container">- <div class="kid">first</div>- <div class="kid">second</div>- <div class="kid">third</div>-</div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- function addBystanders(parent, count) {- for (let i = 0; i < count; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `bystander ${i}`;- parent.appendChild(bystander);- }- }-- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- if (bound === undefined)- println(`${label}: styled ${c.styledElements}, full passes ${c.fullPasses}`);- else- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}`);- }-- test(() => {- const container = document.getElementById("container");- addBystanders(document.body, 25);- const firstKid = container.firstElementChild;- settleAndReset(firstKid);-- // Adding a sheet whose only rule's rightmost compound is :first-child- // (no class/tag/id/attr feature) should target boundary children only,- // not fall back to publishing a selector reaction for every element.- const firstChildStyle = document.createElement("style");- firstChildStyle.textContent = ":first-child { color: rgb(0, 0, 128); }";- document.head.appendChild(firstChildStyle);- getComputedStyle(firstKid).color;-- // This styles the elements that are a first child, in a pass that is not full. The document- // element is one of them, and every element inherits the color it takes, so the count is- // every element's.- dumpCounters(":first-child-only sheet add");- });-</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-face-only.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-face-only.htmlindex 52799ae5b8b..702e1a5d175 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-face-only.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-face-only.html@@ -1,13 +1,13 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="trigger"></div><script>- function settleAndReset(triggerElement) {+ function settle(triggerElement) {getComputedStyle(triggerElement).color;getComputedStyle(triggerElement).color;internals.updateStyle();- internals.resetStyleCounters();}function addBystanders(parent, count) {@@ -18,29 +18,26 @@}}- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- if (bound === undefined)- println(`${label}: styled ${c.styledElements}, full passes ${c.fullPasses}`);- else- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}test(() => {const trigger = document.getElementById("trigger");addBystanders(document.body, 25);- settleAndReset(trigger);+ settle(trigger);// Adding a sheet that only declares @font-face does not change any// element's computed style at the at-rule's declaration time. The font// resource takes effect later, via CSSFontLoaded.- const fontFaceStyle = document.createElement("style");- fontFaceStyle.textContent = `@font-face { font-family: "test-font"; src: url(/test-font.woff); }`;- document.head.appendChild(fontFaceStyle);- getComputedStyle(trigger).color;-- // Nothing but the arriving style element.- dumpCounters("@font-face only sheet add", 1);+ // Nothing, not even the arriving style element.+ dumpWork("@font-face only sheet add", () => {+ const fontFaceStyle = document.createElement("style");+ fontFaceStyle.textContent = `@font-face { font-family: "test-font"; src: url(/test-font.woff); }`;+ document.head.appendChild(fontFaceStyle);+ getComputedStyle(trigger).color;+ });});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-feature-values-targeted.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-feature-values-targeted.htmlindex dc9f674690f..d5444b71919 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-feature-values-targeted.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-font-feature-values-targeted.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="fancy" style="font-family: FancyFamily; font-variant-alternates: styleset(fancy)">fancy</div><script>function addBystanders(parent, count) {@@ -11,11 +12,6 @@}}- function settle() {- internals.updateStyle();- internals.resetStyleCounters();- }-function addSheet(text) {const style = document.createElement("style");style.textContent = text;@@ -23,27 +19,24 @@return style;}- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}, full passes ${c.fullPasses}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}test(() => {addBystanders(document.body, 25);- settle();- // Feature values for a family nobody uses restyle nothing but the arriving style element.- addSheet(`@font-feature-values UnusedFamily { @styleset { fancy: 1; } }`);- dumpCounters("@font-feature-values nobody uses", 1);+ // Feature values for a family nobody uses restyle nothing, not even the arriving style element.+ dumpWork("@font-feature-values nobody uses", () => addSheet(`@font-feature-values UnusedFamily { @styleset { fancy: 1; } }`));// Feature values restyle the elements whose fonts name their family.- settle();- const sheet = addSheet(`@font-feature-values FancyFamily { @styleset { fancy: 2; } }`);- dumpCounters("@font-feature-values one element uses", 2);+ let sheet;+ dumpWork("@font-feature-values one element uses", () => {+ sheet = addSheet(`@font-feature-values FancyFamily { @styleset { fancy: 2; } }`);+ });- settle();- sheet.remove();- dumpCounters("@font-feature-values removed", 2);+ dumpWork("@font-feature-values removed", () => sheet.remove());});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-hover-pseudo-only.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-hover-pseudo-only.htmlindex ee67bb928c7..a941c09d375 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-hover-pseudo-only.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-hover-pseudo-only.html@@ -1,13 +1,13 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="trigger"></div><script>- function settleAndReset(triggerElement) {+ function settle(triggerElement) {getComputedStyle(triggerElement).color;getComputedStyle(triggerElement).color;internals.updateStyle();- internals.resetStyleCounters();}function addBystanders(parent, count) {@@ -18,31 +18,28 @@}}- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- if (bound === undefined)- println(`${label}: styled ${c.styledElements}, full passes ${c.fullPasses}`);- else- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}test(() => {const trigger = document.getElementById("trigger");addBystanders(document.body, 25);- settleAndReset(trigger);+ settle(trigger);// Adding a sheet whose only rule's rightmost compound is :hover// should be targeted to the hovered element, of which there are at// most a handful at any moment. Without an interaction-state pseudo// optimization, the walk falls back to a whole-subtree invalidation// that recomputes every element.- const hoverStyle = document.createElement("style");- hoverStyle.textContent = ":hover { color: rgb(0, 128, 0); }";- document.head.appendChild(hoverStyle);- getComputedStyle(trigger).color;-- // Nothing but the arriving style element, as nothing is hovered.- dumpCounters(":hover-only sheet add", 1);+ // Nothing, not even the arriving style element, as nothing is hovered.+ dumpWork(":hover-only sheet add", () => {+ const hoverStyle = document.createElement("style");+ hoverStyle.textContent = ":hover { color: rgb(0, 128, 0); }";+ document.head.appendChild(hoverStyle);+ getComputedStyle(trigger).color;+ });});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-keyframes-only-shadow-host.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-keyframes-only-shadow-host.htmlindex ed80edf3b3c..05af19b971f 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-keyframes-only-shadow-host.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-keyframes-only-shadow-host.html@@ -1,13 +1,13 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="host"></div><script>- function settleAndReset(triggerElement) {+ function settle(triggerElement) {getComputedStyle(triggerElement).animationName;getComputedStyle(triggerElement).animationName;internals.updateStyle();- internals.resetStyleCounters();}function addBystanders(parent, count) {@@ -18,13 +18,10 @@}}- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- if (bound === undefined)- println(`${label}: styled ${c.styledElements}, full passes ${c.fullPasses}`);- else- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}test(() => {@@ -40,18 +37,19 @@// (which lives outside the shadow subtree, but matches via :host)// actually depends on the new keyframes.addBystanders(shadowRoot, 25);- settleAndReset(host);+ settle(host);// Adding a sheet whose only effect is declaring @keyframes fade should// dirty just the host, whose computed animation-name is "fade" via// the earlier :host rule.- const keyframesStyle = document.createElement("style");- keyframesStyle.textContent = "@keyframes fade { from { opacity: 0.25; } to { opacity: 0.25; } }";- shadowRoot.appendChild(keyframesStyle);- getComputedStyle(host).animationName;-- // At most one element, the arriving style element: the host's animation is planned again- // without a restyle.- dumpCounters("@keyframes only sheet add (host animation-name via :host)", 1);+ // Nothing but the arriving style element: the host's animation is planned again without a+ // restyle.+ dumpWork("@keyframes only sheet add (host animation-name via :host)", () => {+ const keyframesStyle = document.createElement("style");+ keyframesStyle.textContent = "@keyframes fade { from { opacity: 0.25; } to { opacity: 0.25; } }";+ shadowRoot.appendChild(keyframesStyle);+ getComputedStyle(host).animationName;+ });+ println(`host opacity: ${getComputedStyle(host).opacity}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-registration-rules-targeted.html b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-registration-rules-targeted.htmlindex db89980b05e..f83036c53c6 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-registration-rules-targeted.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sheet-add-registration-rules-targeted.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><div id="parent" style="--declared: 10px"><div id="inheritor"></div><div id="reader" style="color: var(--registered-later, rgb(1, 2, 3))"></div>@@ -15,21 +16,16 @@}}- function settle() {- internals.updateStyle();- internals.resetStyleCounters();- }-function addSheet(text) {const style = document.createElement("style");style.textContent = text;document.head.appendChild(style);}- function dumpCounters(label, bound) {- internals.updateStyle();- const c = internals.styleCounters();- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}, full passes ${c.fullPasses}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}test(() => {@@ -38,33 +34,27 @@const inheritor = document.getElementById("inheritor");const reader = document.getElementById("reader");const caller = document.getElementById("caller");- settle();- // A registration nobody declares or reads restyles nothing but the arriving style element.- addSheet(`@property --unused { syntax: "<length>"; inherits: false; initial-value: 0px; }`);- dumpCounters("@property nobody uses", 1);+ // A registration nobody declares or reads restyles nothing, not even the arriving style element.+ // FIXME: Every registration also restyles #caller, which calls a custom function.+ dumpWork("@property nobody uses", () => addSheet(`@property --unused { syntax: "<length>"; inherits: false; initial-value: 0px; }`));// A registration restyles the elements holding its name, whose children follow.- addSheet(`@property --declared { syntax: "<length>"; inherits: false; initial-value: 3px; }`);- dumpCounters("@property a parent declares", 6);+ dumpWork("@property a parent declares", () => addSheet(`@property --declared { syntax: "<length>"; inherits: false; initial-value: 3px; }`));println(`parent: ${getComputedStyle(parent).getPropertyValue("--declared")}`);println(`inheritor: ${getComputedStyle(inheritor).getPropertyValue("--declared")}`);- // A registration through script restyles the elements reading its name.- settle();- CSS.registerProperty({ name: "--registered-later", syntax: "<color>", inherits: false, initialValue: "rgb(0, 128, 0)" });- dumpCounters("CSS.registerProperty() one element reads", 2);+ // A registration through script restyles the elements reading its name (and #caller, as above).+ dumpWork("CSS.registerProperty() one element reads", () => {+ CSS.registerProperty({ name: "--registered-later", syntax: "<color>", inherits: false, initialValue: "rgb(0, 128, 0)" });+ });println(`reader: ${getComputedStyle(reader).color}`);// A counter style restyles only the elements naming its scope's registry.- settle();- addSheet(`@counter-style unused-style { system: cyclic; symbols: "*"; }`);- dumpCounters("@counter-style nobody uses", 1);+ dumpWork("@counter-style nobody uses", () => addSheet(`@counter-style unused-style { system: cyclic; symbols: "*"; }`));// A custom function restyles the elements calling one.- settle();- addSheet(`@function --double(--value) { result: calc(var(--value) * 2); }`);- dumpCounters("@function one element calls", 2);+ dumpWork("@function one element calls", () => addSheet(`@function --double(--value) { result: calc(var(--value) * 2); }`));println(`caller: ${getComputedStyle(caller).width}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/sibling-structural-invalidation-root-only.html b/Tests/LibWeb/Text/input/css/style-invalidation/sibling-structural-invalidation-root-only.htmlindex 9da3ae1e0e8..c1f77150b88 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/sibling-structural-invalidation-root-only.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/sibling-structural-invalidation-root-only.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>// Inserting or removing a sibling can flip whether the previous/next sibling matches@@ -52,11 +53,10 @@return { fixture, host, lightLeaf, lightChildShadowLeaf, nestedLightChildShadowLeaf, shadowLeaf, nestedLeaf };}- function settleAndReset() {+ function settle() {document.body.offsetWidth;document.body.offsetWidth;internals.updateStyle();- resetStyleCounters();}function assertColor(testName, element, expected) {@@ -77,7 +77,7 @@const fixtureParts = setupShadowHostFixture();try {setup?.(fixtureParts);- settleAndReset();+ settle();mutate(fixtureParts);internals.updateStyle();@@ -107,11 +107,13 @@{const style = addStyle(document.head, ".watcher:first-child { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(8, "watcher");- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div"), sibling);- assertColor(":first-child loses on prepend", sibling, "rgb(0, 0, 0)");- printPassWithStyleCounters("prepend before :first-child sibling does not recompute its descendants", 10);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div"), sibling);+ assertColor(":first-child loses on prepend", sibling, "rgb(0, 0, 0)");+ });+ printPassWithStyleWork("prepend before :first-child sibling does not recompute its descendants", work);style.remove();fixture.remove();@@ -120,11 +122,13 @@{const style = addStyle(document.head, ".watcher:first-child .leaf { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(8, "watcher");- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div"), sibling);- assertColor(":first-child .leaf loses on prepend", sibling.firstChild, "rgb(0, 0, 0)");- printPassWithStyleCounters("prepend before :first-child sibling recomputes descendants when a descendant selector depends on it", 9);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div"), sibling);+ assertColor(":first-child .leaf loses on prepend", sibling.firstChild, "rgb(0, 0, 0)");+ });+ printPassWithStyleWork("prepend before :first-child sibling recomputes descendants when a descendant selector depends on it", work);style.remove();fixture.remove();@@ -133,11 +137,13 @@{const style = addStyle(document.head, ".watcher:last-child { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(8, "watcher");- settleAndReset();+ settle();- fixture.appendChild(makeElement("div"));- assertColor(":last-child loses on append", sibling, "rgb(0, 0, 0)");- printPassWithStyleCounters("append after :last-child sibling does not recompute its descendants", 10);+ const work = styleWork(() => {+ fixture.appendChild(makeElement("div"));+ assertColor(":last-child loses on append", sibling, "rgb(0, 0, 0)");+ });+ printPassWithStyleWork("append after :last-child sibling does not recompute its descendants", work);style.remove();fixture.remove();@@ -152,11 +158,13 @@watcher.appendChild(makeElement("span", { className: "leaf", text: `leaf ${i}` }));fixture.append(anchor, watcher);document.body.appendChild(fixture);- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div"), watcher);- assertColor(".anchor + .watcher loses on insert between", watcher, "rgb(0, 0, 0)");- printPassWithStyleCounters("breaking adjacent sibling combinator does not recompute descendants", 10);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div"), watcher);+ assertColor(".anchor + .watcher loses on insert between", watcher, "rgb(0, 0, 0)");+ });+ printPassWithStyleWork("breaking adjacent sibling combinator does not recompute descendants", work);style.remove();fixture.remove();@@ -165,11 +173,13 @@{const style = addStyle(document.head, ".anchor + .watcher .leaf { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(1, "watcher");- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div", { className: "anchor" }), sibling);- assertColor("initially unmatched adjacent sibling descendant gains on prepend", sibling.firstChild, "rgb(1, 2, 3)");- printPassWithStyleCounters("starting adjacent sibling descendant match recomputes descendants", 2);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div", { className: "anchor" }), sibling);+ assertColor("initially unmatched adjacent sibling descendant gains on prepend", sibling.firstChild, "rgb(1, 2, 3)");+ });+ printPassWithStyleWork("starting adjacent sibling descendant match recomputes descendants", work);style.remove();fixture.remove();@@ -178,11 +188,13 @@{const style = addStyle(document.head, ".anchor ~ .watcher .leaf { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(1, "watcher");- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div", { className: "anchor" }), sibling);- assertColor("initially unmatched general sibling descendant gains on prepend", sibling.firstChild, "rgb(1, 2, 3)");- printPassWithStyleCounters("starting general sibling descendant match recomputes descendants", 2);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div", { className: "anchor" }), sibling);+ assertColor("initially unmatched general sibling descendant gains on prepend", sibling.firstChild, "rgb(1, 2, 3)");+ });+ printPassWithStyleWork("starting general sibling descendant match recomputes descendants", work);style.remove();fixture.remove();@@ -191,11 +203,13 @@{const style = addStyle(document.head, ".watcher:nth-child(1) { color: rgb(1, 2, 3); }");const { fixture, sibling } = setupFixture(8, "watcher");- settleAndReset();+ settle();- fixture.insertBefore(makeElement("div"), sibling);- assertColor(":nth-child(1) loses on prepend", sibling, "rgb(0, 0, 0)");- printPassWithStyleCounters("prepend before :nth-child(1) sibling does not recompute its descendants", 10);+ const work = styleWork(() => {+ fixture.insertBefore(makeElement("div"), sibling);+ assertColor(":nth-child(1) loses on prepend", sibling, "rgb(0, 0, 0)");+ });+ printPassWithStyleWork("prepend before :nth-child(1) sibling does not recompute its descendants", work);style.remove();fixture.remove();diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/size-query-container-scans.html b/Tests/LibWeb/Text/input/css/style-invalidation/size-query-container-scans.htmlindex 1535055b7c9..e52633a5f1d 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/size-query-container-scans.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/size-query-container-scans.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>#queried, #unqueried { container-type: inline-size; width: 200px }@@ -24,27 +25,23 @@println(`dependent before: ${getComputedStyle(dependent).color}`);internals.updateStyle();- document.body.offsetWidth;- resetStyleCounters();- queried.style.height = "20px";- document.body.offsetWidth;- printPassWithStyleCounters("a block-size-only container relayout styles only the container", 1);+ const resizeWork = (container, property, value) => {+ document.body.offsetWidth;+ return styleWork(() => {+ container.style[property] = value;+ internals.updateStyle();+ document.body.offsetWidth;+ });+ };- document.body.offsetWidth;- resetStyleCounters();- unqueried.style.width = "400px";- internals.updateStyle();- document.body.offsetWidth;- internals.updateStyle();- printPassWithStyleCounters("resizing a container no query names styles only the container", 1);-- document.body.offsetWidth;- resetStyleCounters();- queried.style.width = "400px";- internals.updateStyle();- document.body.offsetWidth;- internals.updateStyle();- printPassWithStyleCounters("resizing the query container styles it and its dependent", 2);+ printPassWithStyleWork("a block-size-only container relayout styles only the container",+ resizeWork(queried, "height", "20px"));+ println(`queried height: ${getComputedStyle(queried).height}`);+ printPassWithStyleWork("resizing a container no query names styles only the container",+ resizeWork(unqueried, "width", "400px"));+ println(`unqueried width: ${getComputedStyle(unqueried).width}`);+ printPassWithStyleWork("resizing the query container styles it and its dependent",+ resizeWork(queried, "width", "400px"));println(`dependent after: ${getComputedStyle(dependent).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/slotted-argument-slot-early-out.html b/Tests/LibWeb/Text/input/css/style-invalidation/slotted-argument-slot-early-out.htmlindex 06cad421edc..e6c837a18fb 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/slotted-argument-slot-early-out.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/slotted-argument-slot-early-out.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -15,17 +16,15 @@internals.updateStyle();// Matching a selector answers from the styles the elements have and styles nothing.- resetStyleCounters();- assertEqual("slot matches ::slotted", slot.matches("::slotted(:has(.hit))"), false);- printPassWithStyleCounters("matching ::slotted() against a shadow tree slot", 0);+ const matchWork = (name, element, selector) =>+ styleWork(() => assertEqual(name, element.matches(selector), false), internals, { flush: false });- resetStyleCounters();- assertEqual("slotted element matches ::slotted", slotted.matches("::slotted(:has(.hit))"), false);- printPassWithStyleCounters("matching ::slotted() against a slotted element", 0);-- resetStyleCounters();- assertEqual("slotted element matches simple ::slotted", slotted.matches("::slotted(div)"), false);- printPassWithStyleCounters("matching simple ::slotted() against a slotted element", 0);+ printPassWithStyleWork("matching ::slotted() against a shadow tree slot",+ matchWork("slot matches ::slotted", slot, "::slotted(:has(.hit))"));+ printPassWithStyleWork("matching ::slotted() against a slotted element",+ matchWork("slotted element matches ::slotted", slotted, "::slotted(:has(.hit))"));+ printPassWithStyleWork("matching simple ::slotted() against a slotted element",+ matchWork("slotted element matches simple ::slotted", slotted, "::slotted(div)"));host.remove();});diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/structural-matrix.js b/Tests/LibWeb/Text/input/css/style-invalidation/structural-matrix.jsindex a7e571f73eb..6bb48d2e8ef 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/structural-matrix.js+++ b/Tests/LibWeb/Text/input/css/style-invalidation/structural-matrix.js@@ -7,38 +7,75 @@ function assertEqual(testName, actual, expected) {if (actual !== expected) throw new Error(`${testName}: expected ${expected}, got ${actual}`);}-function resetStyleCounters() {- internals.resetStyleInvalidationCounters();-}-function flushPendingStyleWork() {internals.updateStyle();- resetStyleCounters();-}--function styleCounters() {- return internals.getStyleInvalidationCounters();}function printPass(testName) {println(`PASS: ${testName}`);}-// Tests that count what the style engine does update style through internals.updateStyle(), and-// forget what it counted with resetStyleCounters().-function resetStyleCounters() {- internals.resetStyleCounters();+// Like printPass(), but also names the elements the style passes of `work`, from styleWork() in work-test.js,+// restyled. A full pass names only the elements it changed.+function printPassWithStyleWork(testName, work) {+ const restyled = `restyled: [${work.restyled().map(shortStyleName).join(", ")}]`;+ println(`PASS: ${testName} (${work.passes().includes("FULL") ? `full pass, ${restyled}` : restyled})`);}-// Like printPass(), but also prints how many elements the style engine styled since its counters were last-// reset, and in how many full passes. With a bound, prints only whether the count stays within it.-function printPassWithStyleCounters(testName, bound) {- const counters = internals.styleCounters();- if (bound === undefined) {- println(`PASS: ${testName} (styled: ${counters.styledElements}, full passes: ${counters.fullPasses})`);- } else {- println(`PASS: ${testName} (styled <= ${bound}: ${counters.styledElements <= bound})`);+function styleTraceName(element) {+ const id = element.id ? `#${element.id}` : "";+ return `${element.nodeName.toLowerCase()}${id}${[...element.classList].map(name => `.${name}`).join("")}`;+}++function subtreeElementsWithShadowTrees(element) {+ return [element, ...element.querySelectorAll("*")].flatMap(inner => {+ const shadowRoot = internals.getShadowRoot(inner);+ if (!shadowRoot) return [inner];+ return [inner, ...[...shadowRoot.children].flatMap(subtreeElementsWithShadowTrees)];+ });+}++// Runs `mutate` under styleWork() and answers the work with `beyondInsertion`: what its passes restyled, less one+// element of the same name for each element the mutation inserted or moved, user agent shadow trees included.+function styleWorkBeyondInsertion(mutate, options = {}) {+ const observer = new MutationObserver(() => {});+ observer.observe(document, { childList: true, subtree: true });+ let returned;+ let work;+ let records;+ try {+ work = styleWork(+ () => {+ returned = mutate();+ },+ internals,+ options+ );+ } finally {+ records = observer.takeRecords();+ observer.disconnect();}+ const insertedCounts = new Map();+ for (const node of records.flatMap(record => [...record.addedNodes])) {+ if (node.nodeType !== Node.ELEMENT_NODE) continue;+ for (const element of subtreeElementsWithShadowTrees(node)) {+ const name = styleTraceName(element);+ insertedCounts.set(name, (insertedCounts.get(name) ?? 0) + 1);+ }+ }+ const beyondInsertion = work.restyled().filter(name => {+ const unnumbered = name.replace(/@\d+$/, "");+ const inserted = insertedCounts.get(unnumbered) ?? 0;+ if (!inserted) return true;+ insertedCounts.set(unnumbered, inserted - 1);+ return false;+ });+ return { ...work, returned, beyondInsertion };+}++function printPassWithStyleWorkBeyondInsertion(testName, work) {+ const beyond = `restyled beyond the insertion: [${work.beyondInsertion.map(shortStyleName).join(", ")}]`;+ println(`PASS: ${testName} (${work.passes().includes("FULL") ? `full pass, ${beyond}` : beyond})`);}function makeElement(tagName, options = {}) {diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/style-query-container-scans.html b/Tests/LibWeb/Text/input/css/style-invalidation/style-query-container-scans.htmlindex 43f8ff4422b..636e62d769d 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/style-query-container-scans.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/style-query-container-scans.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>#queried { --state: off }@@ -22,16 +23,13 @@println(`dependent before: ${getComputedStyle(dependent).color}`);internals.updateStyle();- resetStyleCounters();- unqueried.classList.add("changed");- internals.updateStyle();- printPassWithStyleCounters("a change on an element no query names styles only that element", 1);+ printPassWithStyleWork("a change on an element no query names styles only that element",+ styleWork(() => unqueried.classList.add("changed")));+ println(`unqueried background-color: ${getComputedStyle(unqueried).backgroundColor}`);println(`dependent after unrelated change: ${getComputedStyle(dependent).color}`);- resetStyleCounters();- queried.classList.add("changed");- internals.updateStyle();- printPassWithStyleCounters("a change on the query container styles its subtree", 3);+ printPassWithStyleWork("a change on the query container styles its subtree",+ styleWork(() => queried.classList.add("changed")));println(`dependent after: ${getComputedStyle(dependent).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.html b/Tests/LibWeb/Text/input/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.htmlindex e2686d55b38..53a7e6287bc 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/targeted-read-non-inherited-change-stops-above-children.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><style>#hidden { display: none }@@ -24,19 +25,28 @@// on a non-inherited property is the one way a child reaches past that.//// FIXME: The read after a non-inherited change should style only the element. The style engine- // styles its three children with it, so that count is printed.- const measure = (id, label, bound) => {+ // styles its three children with it, so they are named.+ const measure = (id, label, read) => {const element = document.getElementById(id);getComputedStyle(element).color;- internals.updateStyle();- resetStyleCounters();- element.classList.add("changed");- getComputedStyle(element).color;- printPassWithStyleCounters(label, bound);+ const work = styleWork(+ () => {+ element.classList.add("changed");+ getComputedStyle(element).color;+ },+ internals,+ { flush: false }+ );+ printPassWithStyleWork(label, work);+ println(`${read.name}: ${read.value(element)}`);};- measure("plain", "a read after a non-inherited change marks no child");- measure("inheriting", "a read marks a child explicitly inheriting a non-inherited property", 4);- measure("color-source", "a read after an inherited change marks every child", 4);+ const firstChildStyle = element => getComputedStyle(element.firstElementChild);+ measure("plain", "a read after a non-inherited change marks no child",+ { name: "background-color", value: element => getComputedStyle(element).backgroundColor });+ measure("inheriting", "a read marks a child explicitly inheriting a non-inherited property",+ { name: "explicitly inherited margin-left", value: element => firstChildStyle(element).marginLeft });+ measure("color-source", "a read after an inherited change marks every child",+ { name: "inherited color", value: element => firstChildStyle(element).color });});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/url-change-skips-full-document-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/url-change-skips-full-document-invalidation.htmlindex d9b9d739cc8..044dcbc5866 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/url-change-skips-full-document-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/url-change-skips-full-document-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script src="structural-matrix.js"></script><script>test(() => {@@ -15,26 +16,21 @@internals.updateStyle();// Without any :local-link rule, a URL change should produce no invalidation work at all.- resetStyleCounters();- history.pushState({}, "", "#initial");- internals.updateStyle();- printPassWithStyleCounters("no :local-link rule", 0);+ printPassWithStyleWork("no :local-link rule", styleWork(() => history.pushState({}, "", "#initial")));const documentStyle = addStyle(document.head, `a:local-link { color: rgb(0, 128, 0); }`);internals.updateStyle();// With a :local-link rule, navigating to the targeted fragment must restyle only the matching anchor, the// other 50 anchors and the rest of the document are untouched.- resetStyleCounters();- history.pushState({}, "", "#target");- internals.updateStyle();- printPassWithStyleCounters(":local-link rule, anchor flips", 1);+ printPassWithStyleWork(":local-link rule, anchor flips", styleWork(() => history.pushState({}, "", "#target")));+ println(`same-doc color: ${getComputedStyle(document.getElementById("same-doc")).color}`);// A :local-link rule that lives only inside a shadow root must still trigger invalidation for shadow// anchors when their match state flips on URL change.//// FIXME: This should style only the shadow anchor. The style engine also styles #same-doc, whose- // :local-link state flips back though no rule for it remains, so the count is printed.+ // :local-link state flips back though no rule for it remains, so it is named.documentStyle.remove();const host = makeElement("div");document.body.appendChild(host);@@ -43,9 +39,8 @@shadowRoot.appendChild(makeElement("a", { id: "shadow-anchor", attributes: { href: "#shadow-target" } }));internals.updateStyle();- resetStyleCounters();- history.pushState({}, "", "#shadow-target");- internals.updateStyle();- printPassWithStyleCounters("shadow-only :local-link rule, shadow anchor flips");+ printPassWithStyleWork("shadow-only :local-link rule, shadow anchor flips",+ styleWork(() => history.pushState({}, "", "#shadow-target")));+ println(`shadow-anchor color: ${getComputedStyle(shadowRoot.getElementById("shadow-anchor")).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.htmlindex a7b8e5533e9..e56c112da29 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/user-action-pseudo-class-targeted-invalidation.html@@ -1,6 +1,7 @@<!DOCTYPE html><meta charset="utf-8"><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>body {margin: 0;@@ -50,12 +51,10 @@internals.updateStyle();}- function dumpCounters(label, bound) {- const c = internals.styleCounters();- if (bound === undefined)- println(`${label}: styled ${c.styledElements}, full passes ${c.fullPasses}`);- else- println(`${label}: styled <= ${bound}: ${c.styledElements <= bound}`);+ function dumpWork(label, mutate) {+ const work = styleWork(mutate);+ const fullPass = work.passes().includes("FULL") ? " (full pass)" : "";+ println(`${label}: restyled [${work.restyled().map(shortStyleName).join(", ")}]${fullPass}`);}function appendUnaffectedSubtree(parent, count) {@@ -79,24 +78,18 @@const activeTarget = document.getElementById("active-target");getComputedStyle(plain).color;- internals.updateStyle();- internals.resetStyleCounters();- moveTo(plain);- dumpCounters("plain text hover", 0);+ dumpWork("plain text hover", () => moveTo(plain));- internals.resetStyleCounters();- moveTo(link);- dumpCounters("link hover", 1);+ dumpWork("link hover", () => moveTo(link));println(`link color: ${getComputedStyle(link).color}`);appendUnaffectedSubtree(activeContainer, 100);getComputedStyle(activeContainer).color;- internals.updateStyle();- internals.resetStyleCounters();- clickAndHold(activeTarget);- // The target, its container and the two elements their :active rules reach, not the 100- // unaffected leaves.- dumpCounters("active state", 4);+ // The target, the two elements its :active rules reach and the link the pointer left, not the+ // 100 unaffected leaves.+ dumpWork("active state", () => clickAndHold(activeTarget));+ for (const id of ["active-target", "active-sibling", "active-ancestor-descendant"])+ println(`${id} color: ${getComputedStyle(document.getElementById(id)).color}`);internals.mouseUp(0, 0);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-animation-targeted-restyle.html b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-animation-targeted-restyle.htmlindex c17cec43ef1..a504726729d 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-animation-targeted-restyle.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-animation-targeted-restyle.html@@ -1,10 +1,23 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>function animationFrame() {return new Promise(resolve => requestAnimationFrame(resolve));}+ // The passes of a style trace, each as its kind and the elements it restyled.+ function summarizeStyleTrace(text) {+ const passes = [];+ for (const event of parseStyleTrace(text, { stylePassesOnly: true })) {+ if (event.event === "pass")+ passes.push({ kind: event.kind, restyled: [] });+ else if (event.outcome !== "kept")+ passes.at(-1).restyled.push(shortStyleName(event.element));+ }+ return passes.map(pass => `${pass.kind} [${pass.restyled.join(", ")}]`).join(", ") || "none";+ }+promiseTest(async () => {const iframe = document.createElement("iframe");iframe.style.border = "0";@@ -96,7 +109,7 @@pendingOutlineAnimation.pause();pendingOutlineAnimation.currentTime = 500;- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();iframe.style.width = "500px";document.body.offsetWidth;child.internals.updateStyle();@@ -105,17 +118,16 @@child.document.body.offsetWidth;child.internals.updateStyle();- const counters = child.internals.styleCounters();- const elementCount = child.document.querySelectorAll("*").length;+ const resizeWork = summarizeStyleTrace(child.internals.takeStyleTrace());println(`resized viewport animated width: ${child.getComputedStyle(viewportTarget).width}`);println(`resized inherited-font animated width: ${child.getComputedStyle(inheritedFontTarget).width}`);println(`resized root-font animated width: ${child.getComputedStyle(rootFontTarget).width}`);println(`resized animated font size: ${child.getComputedStyle(animatedFontSource).fontSize}`);println(`resized animated inherited-font width: ${child.getComputedStyle(animatedInheritedFontTarget).width}`);println(`resized post-style animated width: ${child.getComputedStyle(postStyleAnimationTarget).width}`);- // FIXME: The root font size reads the viewport, so every element is restyled, but each should- // be styled once. The style engine styles #animated-inherited-font-target again in a pass of- // its own after its parent's animated font size moved, so the counts are printed.- println(`resize restyle: styled ${counters.styledElements} of ${elementCount} elements`);+ // FIXME: The root font size reads the viewport, so every element is restyled, and all of them+ // should be in one pass. The style engine styles #animated-inherited-font-target in a pass of+ // its own after its parent's animated font size moved.+ println(`resize restyle passes: ${resizeWork}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.htmlindex fc724c3c781..ba4b94637ec 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-device-pixel-ratio-invalidation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><style>#target {border: 0.75px solid black;@@ -18,15 +19,11 @@println(`initial border width: ${getComputedStyle(target).borderTopWidth}`);println(`initial outline width: ${getComputedStyle(target).outlineWidth}`);- internals.resetStyleCounters();- internals.setDevicePixelRatio(2);- internals.updateStyle();+ const work = styleWork(() => internals.setDevicePixelRatio(2));- const counters = internals.styleCounters();println(`updated device pixel ratio: ${devicePixelRatio}`);println(`updated border width: ${getComputedStyle(target).borderTopWidth}`);println(`updated outline width: ${getComputedStyle(target).outlineWidth}`);- println(`target restyled: ${counters.styledElements >= 1}`);- println(`every element restyled: ${counters.fullPasses >= 1}`);+ println(`passes: [${work.passes().join(", ")}], restyled: [${work.restyled().map(shortStyleName).join(", ")}]`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-media-query-evaluation.html b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-media-query-evaluation.htmlindex 8499219fa27..edc2f7eb350 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-media-query-evaluation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-media-query-evaluation.html@@ -1,10 +1,23 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>function animationFrame() {return new Promise(resolve => requestAnimationFrame(resolve));}+ // The passes of a style trace, each as its kind and the elements it restyled.+ function summarizeStyleTrace(text) {+ const passes = [];+ for (const event of parseStyleTrace(text, { stylePassesOnly: true })) {+ if (event.event === "pass")+ passes.push({ kind: event.kind, restyled: [] });+ else if (event.outcome !== "kept")+ passes.at(-1).restyled.push(shortStyleName(event.element));+ }+ return passes.map(pass => `${pass.kind} [${pass.restyled.join(", ")}]`).join(", ") || "none";+ }+promiseTest(async () => {const iframe = document.createElement("iframe");iframe.style.border = "0";@@ -73,7 +86,7 @@println(`initial canvas fill style: ${context.fillStyle}`);println(`initial nested color: ${child.getComputedStyle(nestedTarget).color}`);- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();iframe.style.width = "500px";document.body.offsetWidth;context.fillStyle = "currentColor";@@ -83,23 +96,22 @@child.document.body.offsetWidth;child.internals.updateStyle();- // A media query flip styles fewer than half of the elements: the ones its rules apply to.- const counters = child.internals.styleCounters();- const elementCount = child.document.querySelectorAll("*").length;+ // A media query flip styles the elements its rules apply to.+ const resizeWork = summarizeStyleTrace(child.internals.takeStyleTrace());println(`resized color: ${child.getComputedStyle(target).color}`);println(`resized nested color: ${child.getComputedStyle(nestedTarget).color}`);- println(`media query restyle stays targeted: ${counters.styledElements < elementCount / 2}`);+ println(`media query restyle passes: ${resizeWork}`);- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();iframe.style.width = "300px";document.body.offsetWidth;await animationFrame();child.document.body.offsetWidth;child.internals.updateStyle();- const resizedBackCounters = child.internals.styleCounters();+ const resizeBackWork = summarizeStyleTrace(child.internals.takeStyleTrace());println(`resized back color: ${child.getComputedStyle(target).color}`);println(`resized back nested color: ${child.getComputedStyle(nestedTarget).color}`);- println(`media query restyle after resize back stays targeted: ${resizedBackCounters.styledElements < elementCount / 2}`);+ println(`media query restyle passes after resize back: ${resizeBackWork}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-shadow-broad-invalidation.html b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-shadow-broad-invalidation.htmlindex 08dc45ce5a9..563eaadbdbb 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-shadow-broad-invalidation.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-shadow-broad-invalidation.html@@ -1,10 +1,18 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>function animationFrame() {return new Promise(resolve => requestAnimationFrame(resolve));}+ function summarizeStyleTrace(text) {+ const events = parseStyleTrace(text, { stylePassesOnly: true });+ const passes = events.filter(event => event.event === "pass").map(event => event.kind);+ const restyled = [...new Set(events.filter(event => event.event === "restyle" && event.outcome !== "kept").map(event => shortStyleName(event.element)))];+ return `passes [${passes.join(", ")}], restyled [${restyled.join(", ")}]`;+ }+async function resizeIframe(iframe, child, width) {iframe.style.width = `${width}px`;document.body.offsetWidth;@@ -52,16 +60,16 @@// A media query flip in the shadow tree's sheet that only changes what an @property rule// registers styles at most the host.- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();await resizeIframe(iframe, child, 500);- let counters = child.internals.styleCounters();+ const resized = summarizeStyleTrace(child.internals.takeStyleTrace());println(`resized shadow host color: ${child.getComputedStyle(host).color}`);- println(`resized: styled ${counters.styledElements}, full passes: ${counters.fullPasses}`);+ println(`resized: ${resized}`);- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();await resizeIframe(iframe, child, 300);- counters = child.internals.styleCounters();+ const resizedBack = summarizeStyleTrace(child.internals.takeStyleTrace());println(`resized back shadow host color: ${child.getComputedStyle(host).color}`);- println(`resized back: styled ${counters.styledElements}, full passes: ${counters.fullPasses}`);+ println(`resized back: ${resizedBack}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-targeted-restyle.html b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-targeted-restyle.htmlindex a36c074622f..f39f06a7585 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-targeted-restyle.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/viewport-resize-targeted-restyle.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../../include.js"></script>+<script src="../../work-test.js"></script><script>function animationFrame() {return new Promise(resolve => requestAnimationFrame(resolve));@@ -100,6 +101,26 @@`;}+ // The kinds of the passes of a style trace, and the elements of `document` none of them restyled.+ function summarizeStyleTrace(text, document) {+ const events = parseStyleTrace(text, { stylePassesOnly: true });+ const passes = events.filter(event => event.event === "pass").map(event => event.kind);+ const restyled = events+ .filter(event => event.event === "restyle" && event.outcome !== "kept")+ .map(event => event.element.replace(/@\d+$/, ""));+ const notRestyled = [];+ for (const element of document.querySelectorAll("*")) {+ const id = element.id ? `#${element.id}` : "";+ const name = `${element.nodeName.toLowerCase()}${id}${[...element.classList].map(name => `.${name}`).join("")}`;+ const index = restyled.indexOf(name);+ if (index < 0)+ notRestyled.push(shortStyleName(name));+ else+ restyled.splice(index, 1);+ }+ return `passes [${passes.join(", ")}], elements not restyled [${notRestyled.join(", ")}]`;+ }+promiseTest(async () => {const iframe = document.createElement("iframe");iframe.style.border = "0";@@ -115,15 +136,14 @@child.internals.updateStyle();child.document.body.offsetWidth;- child.internals.resetStyleCounters();+ child.internals.beginStyleTrace();iframe.style.width = "500px";document.body.offsetWidth;await animationFrame();child.document.body.offsetWidth;child.internals.updateStyle();- const counters = child.internals.styleCounters();- const elementCount = child.document.querySelectorAll("*").length;+ const resizeWork = summarizeStyleTrace(child.internals.takeStyleTrace(), child.document);println(`viewport width: ${child.getComputedStyle(child.document.getElementById("viewport")).width}`);println(`inherited font size: ${child.getComputedStyle(child.document.getElementById("font-child")).fontSize}`);@@ -136,6 +156,6 @@println(`pseudo width: ${child.getComputedStyle(child.document.getElementById("pseudo"), "::before").width}`);println(`pseudo originating font size: ${child.getComputedStyle(child.document.getElementById("pseudo-font-target")).fontSize}`);println(`pseudo inherited font size: ${child.getComputedStyle(child.document.getElementById("pseudo-font-target"), "::before").fontSize}`);- println(`root font metrics recompute descendants: ${counters.styledElements >= elementCount / 2}`);+ println(`resize restyle: ${resizeWork}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-sharing-across-shadow-roots-with-same-font.html b/Tests/LibWeb/Text/input/css/style-sharing-across-shadow-roots-with-same-font.htmlindex f03037c8c7b..09fdefb17f7 100644--- a/Tests/LibWeb/Text/input/css/style-sharing-across-shadow-roots-with-same-font.html+++ b/Tests/LibWeb/Text/input/css/style-sharing-across-shadow-roots-with-same-font.html@@ -1,6 +1,7 @@<!DOCTYPE html><div id="container"></div><script src="../include.js"></script>+<script src="../work-test.js"></script><script>test(() => {const container = document.getElementById("container");@@ -15,16 +16,22 @@ test(() => {addShadowTree();document.body.offsetWidth;internals.updateStyle();- internals.resetStyleCounters();- for (let i = 0; i < 20; ++i)- addShadowTree();- document.body.offsetWidth;- const after = internals.styleCounters();- println(`full passes for 20 more shadow trees: ${after.fullPasses}`);+ const work = styleWork(() => {+ for (let i = 0; i < 20; ++i)+ addShadowTree();+ });+ println(`passes for 20 more shadow trees: ${work.passes().join(", ")}`);// FIXME: The paragraphs and spans of the 20 trees added after the first should take their records- // from the first tree's, so that at least 60 elements are shared, but the style engine shares records- // only within a shadow tree, whose rules come from a sheet of its own.- println(`shared elements: ${after.sharedElements}`);+ // from the first tree's, but the style engine shares records only within a shadow tree, whose rules come+ // from a sheet of its own.+ for (const outcome of ["computed", "shared", "reused"]) {+ const counts = new Map();+ for (const event of work.events.filter(event => event.event === "restyle" && event.outcome === outcome)) {+ const name = event.element.replace(/@\d+$/, "");+ counts.set(name, (counts.get(name) ?? 0) + 1);+ }+ println(`${outcome}: ${[...counts].map(([name, count]) => `${name} x${count}`).join(", ")}`);+ }const spans = [...container.children].map(host => host.shadowRoot.querySelector("span"));println(`span font: ${getComputedStyle(spans[0]).fontSize} ${getComputedStyle(spans[0]).fontWeight}`);diff --git a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.html b/Tests/LibWeb/Text/input/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.htmldeleted file mode 100644index 2a59f696b9b..00000000000--- a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-inactive-media-no-broad-invalidation.html+++ /dev/null@@ -1,43 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="target">target</div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const target = document.getElementById("target");- settleAndReset(target);-- const inactiveStyle = document.createElement("style");- // This sheet still contains a non-style rule that would publish broad- // reactions if it were active, so keeping the counter at zero proves we- // only consider effective rules after media evaluation.- inactiveStyle.media = "print";- inactiveStyle.textContent = "@layer B, A;";- document.head.appendChild(inactiveStyle);-- getComputedStyle(target).color;- verifyStyledStaysBounded("inactive media stylesheet add publishes no broad reactions", 1);-- settleAndReset(target);- inactiveStyle.remove();-- getComputedStyle(target).color;- verifyStyledStaysBounded("inactive media stylesheet remove publishes no broad reactions", 1);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-layer-order-invalidation.html b/Tests/LibWeb/Text/input/css/stylesheet-add-remove-layer-order-invalidation.htmldeleted file mode 100644index dadd4ed251a..00000000000--- a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-layer-order-invalidation.html+++ /dev/null@@ -1,66 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="target">target</div>-<script>- function settleAndReset(triggerElement) {- getComputedStyle(triggerElement).color;- getComputedStyle(triggerElement).color;- internals.updateStyle();- internals.updateStyle();- internals.resetStyleCounters();- }-- // A `<style>` element arriving or leaving is itself an element whose style is computed, so the- // narrowest a layer-only sheet can be is that one element and nothing else.- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- function verifyRestyledTheLayeredElement(label) {- const color = getComputedStyle(document.getElementById("target")).color;- if (color === "rgb(0, 128, 0)")- println(`PASS: ${label}`);- else- println(`FAIL: ${label} (${color})`);- }-- test(() => {- const target = document.getElementById("target");- settleAndReset(target);-- // A layer order change can only move a declaration that sits in a layer, and nothing here- // does, so a layer-only sheet arriving or leaving restyles nothing at all.- const layerOrderStyle = document.createElement("style");- layerOrderStyle.textContent = "@layer B, A;";- document.head.appendChild(layerOrderStyle);-- getComputedStyle(target).color;- verifyStyledStaysBounded("layer-only stylesheet add restyles nothing but itself", 1);-- settleAndReset(target);- layerOrderStyle.remove();-- getComputedStyle(target).color;- verifyStyledStaysBounded("layer-only stylesheet remove restyles nothing but itself", 1);-- // With a declaration in a layer, a reorder that actually moves the layers has to reach- // the element it decides for - and still not the whole document. The statement sheet is- // inserted before the block sheet so its "@layer B, A" wins first occurrence and really- // flips the order; appended after, it would re-declare the existing order and correctly- // reach nothing.- const layered = document.createElement("style");- layered.textContent = "@layer A, B; @layer A { #target { color: green } } @layer B { #target { color: blue } }";- document.head.appendChild(layered);- settleAndReset(target);-- document.head.insertBefore(layerOrderStyle, layered);- getComputedStyle(target).color;- verifyRestyledTheLayeredElement("layer reorder reaches the layered element");- });-</script>diff --git a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-style-invalidation-counters.html b/Tests/LibWeb/Text/input/css/stylesheet-add-remove-style-invalidation-counters.htmldeleted file mode 100644index 3f82bfc249b..00000000000--- a/Tests/LibWeb/Text/input/css/stylesheet-add-remove-style-invalidation-counters.html+++ /dev/null@@ -1,80 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<div id="add-target" class="add-target-class">add target</div>-<div>add bystander 1</div>-<div>add bystander 2</div>-<div>add bystander 3</div>-<div id="shadow-host"></div>-<div id="remove-target" class="remove-target-class">remove target</div>-<div>remove bystander 1</div>-<div>remove bystander 2</div>-<div>remove bystander 3</div>-<script>- function settleAndReset(triggerElement, pseudoElement) {- // Force style resolution before we observe counters so the add/remove- // operation is measured in isolation.- getComputedStyle(triggerElement, pseudoElement).color;- getComputedStyle(triggerElement, pseudoElement).color;- internals.updateStyle();- internals.resetStyleCounters();- }-- function addBystanders(parent, prefix, count) {- for (let i = 0; i < count; ++i) {- const bystander = document.createElement("div");- bystander.textContent = `${prefix} bystander ${i + 4}`;- parent.appendChild(bystander);- }- }-- // Print whether the style engine styled at most `maximum` elements since its counters were reset, or,- // without a bound, how many it styled.- function verifyStyledStaysBounded(label, maximum) {- const styled = internals.styleCounters().styledElements;- if (maximum === undefined)- println(`${label}, styled: ${styled}`);- else- println(`${label}, styled <= ${maximum}: ${styled <= maximum}`);- }-- test(() => {- const addTarget = document.getElementById("add-target");- addBystanders(document.body, "document add", 25);- settleAndReset(addTarget);-- const addStyle = document.createElement("style");- addStyle.textContent = ".add-target-class { color: rgb(255, 0, 0); }";- document.head.appendChild(addStyle);- getComputedStyle(addTarget).color;- verifyStyledStaysBounded("document stylesheet add stays bounded", 4);-- const shadowRoot = document.getElementById("shadow-host").attachShadow({ mode: "open" });- shadowRoot.innerHTML = `- <div id="shadow-target" class="shadow-target-class">shadow target</div>- `;- addBystanders(shadowRoot, "shadow add", 25);-- const shadowTarget = shadowRoot.getElementById("shadow-target");- settleAndReset(shadowTarget);-- const shadowStyle = document.createElement("style");- shadowStyle.textContent = ".shadow-target-class { color: rgb(0, 128, 0); }";- shadowRoot.appendChild(shadowStyle);- getComputedStyle(shadowTarget).color;- // Shadow-root sheet mutations can legitimately dirty the matching- // descendant, the shadow host, and a small fixed amount of plumbing,- // but must still stay constant as unrelated bystanders grow.- verifyStyledStaysBounded("shadow stylesheet add stays bounded", 4);-- const removeTarget = document.getElementById("remove-target");- addBystanders(document.body, "document remove", 25);- const removeStyle = document.createElement("style");- removeStyle.textContent = ".remove-target-class::before { content: ''; color: rgb(0, 0, 255); }";- document.head.appendChild(removeStyle);- getComputedStyle(removeTarget, "::before").color;- settleAndReset(removeTarget, "::before");- removeStyle.remove();- getComputedStyle(removeTarget, "::before").color;- verifyStyledStaysBounded("pseudo-only stylesheet removal stays bounded", 2);- });-</script>diff --git a/Tests/LibWeb/Text/input/css/text-decoration-line-style-sharing.html b/Tests/LibWeb/Text/input/css/text-decoration-line-style-sharing.htmlindex 16d738741a2..741f62f7787 100644--- a/Tests/LibWeb/Text/input/css/text-decoration-line-style-sharing.html+++ b/Tests/LibWeb/Text/input/css/text-decoration-line-style-sharing.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>.underline { text-decoration-line: underline; }.overline { text-decoration-line: overline; }@@ -7,21 +8,19 @@</style><script>test(() => {- internals.updateStyle();- internals.resetStyleCounters();- for (const decoration of ["underline", "overline", "line-through"]) {- const parent = document.createElement("div");- parent.className = decoration;- parent.append(document.createElement("span"));- document.body.append(parent);- }- internals.updateStyle();- // Spans under differently decorated parents have the same style, so all but the first take- // the record of another, shared without matching or reused after matching.- const counters = internals.styleCounters();+ const work = styleWork(() => {+ for (const decoration of ["underline", "overline", "line-through"]) {+ const parent = document.createElement("div");+ parent.className = decoration;+ parent.append(document.createElement("span"));+ document.body.append(parent);+ }+ });for (const child of document.querySelectorAll("span"))println(getComputedStyle(child).textDecorationLine);- println(`spans taking another's record >= 2: ${counters.sharedElements + counters.reusedElements >= 2}`);+ // Spans under differently decorated parents have the same style, so all but the first take+ // the record of another, shared without matching or reused after matching.+ println(work.text.trimEnd());});</script>diff --git a/Tests/LibWeb/Text/input/css/user-agent-selectors-compile-once-per-process.html b/Tests/LibWeb/Text/input/css/user-agent-selectors-compile-once-per-process.htmlindex 15818eb7041..ae476b2ba59 100644--- a/Tests/LibWeb/Text/input/css/user-agent-selectors-compile-once-per-process.html+++ b/Tests/LibWeb/Text/input/css/user-agent-selectors-compile-once-per-process.html@@ -1,6 +1,7 @@<!DOCTYPE html><script src="../include.js"></script>-<iframe srcdoc="<p>x</p>"></iframe>+<script src="../work-test.js"></script>+<iframe srcdoc="<script>internals.beginStyleTrace()</script><p>x</p>"></iframe><script>// Have the style engine own this document, which builds its rule index before the frame's.internals.updateStyle();@@ -9,22 +10,20 @@iframe.onload = () => {// This document was styled first, so the user-agent selectors were compiled and indexed for it. The frame's// rule index shares the user-agent rule index this document built, which needs no selector compiled again.+ const frameInternals = iframe.contentWindow.internals;const p = iframe.contentDocument.querySelector("p");println(`margin-top from the user-agent sheet: ${iframe.contentWindow.getComputedStyle(p).marginTop}`);- iframe.contentWindow.internals.updateStyle();- const counters = iframe.contentWindow.internals.styleCounters();- println(`user-agent rule index shared, not built: ${counters.indexBuilds > 0 && counters.userAgentIndexBuilds === 0}`);- println(`no user-agent selector compiled again: ${counters.compiledSelectors === 0}`);+ frameInternals.updateStyle();+ const program = parseStyleTrace(frameInternals.takeStyleTrace()).filter(event => event.event === "program");+ println(`what the frame did to its rules: [${program.map(event => (event.times > 1 ? `${event.name} x${event.times}` : event.name)).join(", ")}]`);// A rule the frame adds compiles its own selectors, and only those.- iframe.contentWindow.internals.resetStyleCounters();- const style = iframe.contentDocument.createElement("style");- style.textContent = ".compiled-once-per-process-a, .compiled-once-per-process-b > p { color: green; }";- iframe.contentDocument.head.appendChild(style);- iframe.contentWindow.internals.updateStyle();- const added = iframe.contentWindow.internals.styleCounters();- println(`index builds for the added rule: ${added.indexBuilds}`);- println(`selectors compiled for the added rule, at most its two: ${added.compiledSelectors <= 2}`);+ const added = styleWork(() => {+ const style = iframe.contentDocument.createElement("style");+ style.textContent = ".compiled-once-per-process-a, .compiled-once-per-process-b > p { color: green; }";+ iframe.contentDocument.head.appendChild(style);+ }, frameInternals);+ println(`what the added rule did to the rule index: [${added.program().filter(event => /^(rule index|user agent rule index|selectors)/.test(event)).join(", ")}]`);done();};});