Skip to content

Implement live CSSSupportsRule grouping mutation #381

Closed

Description

@wieslawsoltes

Problem

The native parser and cascade already evaluate authored @supports blocks, but the owner-backed CSSOM compatibility layer exposes each block as a generic CSSRule. Scripts cannot observe CSSSupportsRule / CSSConditionRule / CSSGroupingRule branding, a live stable child rule list, parent links, or nested mutation.

This is the next bounded dynamic CSSOM gap after #366. It does not require the owner-independent stylesheet identity and per-root adoption registries that still block successful constructed/adopted stylesheet replacement.

Browser and WPT-derived authority

Chrome 153 establishes this focused contract:

  • CSSSupportsRule instanceof CSSConditionRule instanceof CSSGroupingRule instanceof CSSRule;
  • type === CSSRule.SUPPORTS_RULE === 12;
  • readonly conditionText keeps the authored normalized condition;
  • cssRules is SameObject and children retain parentRule / parentStyleSheet;
  • nested insertRule / deleteRule synchronously update serialization and computed style;
  • deletion clears both parent links on the removed child;
  • missing arguments throw TypeError; out-of-range insertion throws IndexSizeError; multiple rules throw SyntaxError; nested @import throws HierarchyRequestError;
  • a supports group nested inside a media group stays live and publishes immediately.

The behavior follows the CSSOM grouping-rule algorithms and the CSS Conditional Rules CSSSupportsRule interface, reduced to the already supported owner-backed stylesheet path.

Scope and ownership

Exact audited base: b89b0de5cc4ba3aa6b1e359854566082cb42ad62.

Owned paths:

  • experiments/WebScene.NativeEngine.Probe/native/webscene_stylesheet_cssom_compatibility.h
  • experiments/WebScene.NativeEngine.Probe/tests/native_v8_runtime_browser_dom_tests.inc
  • one new dedicated tests/WebPlatformSubset/contracts/cssom-supports-rule-mutation.html
  • one new dedicated tests/WebPlatformSubset/webscene-cssom-supports-rule-mutation-profile.json

The slice is disjoint from open docs consolidation PR #76, #377 / PR #380 File System Access paths, #379 parser-resource work, AppScene, and vscode-demo. It will not modify parser/cascade internals, resource loading, imports/namespaces, constructed/adopted ownership, or successful replacement.

Acceptance gates

  • Chrome/native exact contract parity for interface identity, constants, condition reflection, live child identity, errors, detach behavior, serialization, nested media/supports, and synchronous computed style.
  • Explicit cascade, layout, staged-publication, scene-build, native-rule, wrapper, and pending-scene counter assertions.
  • A 64-rule / 20-cycle mutation gate with recorded p95/max.
  • V8 heap and process RSS bounds with no retained rule/wrapper growth.
  • 100 main-document/iframe create-mutate-detach/teardown cycles with drained queues.
  • Direct exact-head native correctness and dedicated WebPlatformSubset runs before merge.

Completion boundary

This issue completes live CSSSupportsRule grouping reflection and mutation only for existing owner-backed stylesheets. Constructed/adopted sheets, imports/namespaces, other conditional grouping interfaces, and full CSS conditional grammar remain under #239.

Activity

  1. added
    vscode-oss/planned
    on Sep 18, 2026
  2. wieslawsoltes commented on Sep 18, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Implementation starts from fresh current-main worktree at exact base b89b0de5cc4ba3aa6b1e359854566082cb42ad62 after disjoint File System Access PR #380 merged. Native hierarchy verified: #381 parent is #239; #239 remains parented by #235. GitHub permits one native parent, so this is the intended #235 → #239 → #381 chain.

  3. wieslawsoltes commented on Sep 18, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Completed through PR #384 at merge 5a6ab1aa56bca25ad1e056dfc302364924d6481c from exact head 19f66f07e36dbd6895a8b89992c35a29b6930e32 on base b5b51017ab1888ecdadbb638590afa645ee5f62a.

    Owner-backed authored and inserted @supports blocks now expose live CSSSupportsRule → CSSConditionRule → CSSGroupingRule → CSSRule identity, type / SUPPORTS_RULE 12, readonly conditionText, stable child lists and parent links, nested insertion/deletion, correct detach behavior, and recursive containing-group serialization with synchronous cascade/layout/scene publication. The implementation retains the native parser as condition authority and does not claim broader conditional grammar.

    Final evidence:

    • Chrome 153 and native dedicated contracts: 6/6 each;
    • adjacent native grouping/media contracts: 4/4 and 6/6;
    • exact-head portable V8 run 35346594834: pass;
    • exact-head native Linux document run 35346594873: pass;
    • exact-head CI run 35346594874: Linux, macOS, and both NativeAOT jobs pass;
    • 64-rule / 20-cycle supports mutation p95/max: 0.517/0.760 ms;
    • 100 main plus 100 iframe lifecycle cycles: flat V8 heap, peak RSS +17.20 MiB, native rules returned to baseline, wrapper/node bounds retained, layout +3, scene publication +1, pending scenes bounded.

    The child is closed and remains natively attached to #239. Post-merge CI/NuGet tails were cancelled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vscode-oss/planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions