Skip to content

Implement live CSSSupportsRule grouping mutation #381

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

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/plannedPlanned for the AppScene/WebScene VS Code OSS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions