Repository navigation
Description
Proven gap
WebScene's current owner-backed stylesheet adapter supports a stable top-level cssRules list, insertRule, deleteRule, declaration mutation, media enablement, detach/reattach, and bounded staged publication. A top-level @media rule is parsed and applied, but it is exposed as a generic rule object without the CSSGroupingRule surface: cssRules, insertRule, and deleteRule are absent, nested child identity/parent links cannot be inspected, and nested mutation is impossible.
A Chromium control for @media (min-width: 1px) { .x { display:block } } proves:
- the grouping rule is a
CSSMediaRulewith type 4 and normalizedconditionText; mediaRule.cssRuleshas stableCSSRuleListidentity;- children expose
parentRule === mediaRuleandparentStyleSheet === sheet; mediaRule.insertRule('.x { display:grid }', length)updates computed style synchronously;- deleting the inserted child restores style and clears that removed child's parent links;
- out-of-range nested insert throws
IndexSizeError, and missing delete index throwsTypeError.
Focused scope
- Represent nested
@mediachildren as live rule objects with stable list/rule identity and browser-shaped parent links. - Implement nested
insertRule/deleteRulevalidation and synchronous observable recascade through the existing bounded owner publication path. - Preserve top-level behavior, owner DOM text topology, media activation, detach/reattach, navigation teardown, and the 32 MiB/256-owner staging bounds.
- Keep
@import,@namespace, constructed/adopted sheets,replace/replaceSync, other grouping-rule types, cascade/global-keyword work, and selector metadata outside this slice.
Ownership and non-overlap
Planned implementation and gates are limited to:
experiments/WebScene.NativeEngine.Probe/native/webscene_stylesheet_cssom_compatibility.h;experiments/WebScene.NativeEngine.Probe/tests/native_v8_runtime_browser_dom_tests.inc;- a new
tests/WebPlatformSubset/contracts/cssom-grouping-rule-mutation.html; - a new dedicated CSSOM grouping profile/evidence file.
Do not touch #292/#245 structural DOM/listener paths, #322 generated line-height paths, #329 stream/service-worker paths, open PR #326 selector metadata, or draft #76.
Acceptance
- Chromium/native contract matches constructor/type/condition serialization, stable rule-list identity, parent links, exceptions, synchronous computed style, and removed-child detachment.
- Main and iframe documents preserve rule identity/order across nested insert/delete, stylesheet disable/media changes, owner detach/reattach, and navigation/teardown.
- Nested mutation targets only the owning cascade root; unrelated nodes/rules do not receive stale or cross-document style.
- A product-shaped nested lookup/update workload reports 20-cycle p95/max within the focused budget and bounded publication/queue counts.
- A 100-cycle create/mutate/detach/navigation lifecycle retains <= 8 MiB V8 heap and <= 64 MiB RSS after warm-up, with no retained owners/rules/pending replacements.
Activity
wieslawsoltes commentedon Sep 17, 2026
Implemented and qualified on exact WebScene
8c792eedcc1bd7120455cdf589ef64fbfeec47edin local commit0ff4dbe4a6bcc66bd882b62510e71073e785a7d6.The reduced native baseline failed at the first missing semantic with
TypeError: Cannot read properties of undefined (reading 'length')forCSSMediaRule.cssRules. The focused change adds live nested@mediarule lists and insert/delete mutation without changing parser, cascade, runtime-task, line-height, service-worker, selector-metadata, or shared-profile paths.Validation:
CSSMediaRule/CSSRuleList, type 4, stable list identity, parent links, synchronous block→grid→block invalidation,IndexSizeError, and missing-indexTypeErrorall match.