Skip to content

Implement nested style rule CSSOM - #427

Merged
wieslawsoltes merged 1 commit into
mainfrom
feature/cssom-nested-style-rule-425
Sep 18, 2026
Merged

wieslawsoltes merged 1 commit into
mainfrom
feature/cssom-nested-style-rule-425

Conversation

@wieslawsoltes

Copy link
Copy Markdown
Collaborator

Closes #425.

Problem

Pinned unchanged Code OSS recursively walks CSSStyleRule.cssRules in the GPU decoration extractor. Its production CSS uses nested selectors across 36 files, but WebScene exposed only the outer rule declaration and stopped that traversal.

Result

Nested style rules now expose a SameObject live CSSRuleList, browser-shaped nested CSSStyleRule and CSSNestedDeclarations objects, nested grouping reflection, parent links, and insertRule / deleteRule. Selector and declaration mutation reserialize through the existing staged owner publication, recascade synchronously, preserve owner DOM text, and remain isolated after detachment.

The flat style-rule path keeps layer discovery on raw child arrays, avoiding a rule-list synchronization walk for every ordinary rule.

Exact base: f034e70563934b401bf9e0c88d0f29c089366ae8
Exact head: 6cdd985c1a60b8539860895f3b158c2e2713f6d0

Collision boundary

The diff is confined to the CSSOM compatibility adapter, its native browser-DOM/performance tests, and one dedicated contract/profile. It does not touch FileReader/task scheduling, iframe/window-message/cache paths, selector matching/invalidation, docs consolidation, AppScene, or vscode-demo. Imported stylesheet loading/reflection remains separate.

Validation

  • Chrome 153 direct oracle: 6/6 contract groups pass.
  • Native WebPlatformSubset: 1/1 document, 6/6 subtests pass.
  • Focused 20 × 64 nested mutation gate: p95 4.118 ms, max 6.721 ms.
  • Focused 100 main + 100 iframe lifecycle cycles: V8 heap 843,184 → 843,184 bytes; native rules 0 → 0; native nodes 1 → 1; RSS 37,961,728 → 71,434,240 bytes; layout 0 → 43; scenes 1 → 3.
  • Adjacent full stylesheet mutation gate passes: flat 256-rule p95 9.942 ms; constructed, selector, media, supports, layer block/statement, replacement, 100 main and 100 realm lifecycle gates all pass with flat collected heap.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reflect and mutate nested CSS style rules for Code OSS

1 participant