Repository navigation
Limit dimension-only CSS variable recalculation to affected elements - #51
Conversation
|
The optimization looks beneficial and complements #50, but I found a correctness regression that should be fixed before merging. At <style>
:root { --size: 100px; }
.parent { width: var(--size); height: var(--size); }
.child { width: inherit; height: inherit; }
</style>
<div class="parent" id="parent"><div class="child" id="child"></div></div>After an initial geometry read, run: document.documentElement.style.setProperty('--size', '200px');Observed
Both Please add isolated regressions for stylesheet and inline inheritance, multiple inheritance levels, and variable updates through Performance evidence is encouraging: one local macOS run of the included 1,000-item benchmark measured a median of 17.62 ms on the baseline versus 1.56 ms with this PR, across 60 samples after warm-up. This is a single synchronous style/layout microbenchmark comparison, not an application FPS measurement. |
Dragging Kestrel’s properties divider updates the root
--right-widthvariable, but currently rebuilds styles throughout the root subtree. Limit recalculation to the mutation root and dimension consumers when dependencies are safe. Preserve style batching and synchronous CSSOM barriers; mixed mutations, aliases, inherited properties, pseudo-elements, shadow DOM, and style-attribute dependencies retain the full path.Explicit dimension inheritance also retains ancestor-first subtree recalculation, including
var()fallbacks resolving toinherit. Replay inline width/height inheritance during a full cascade so descendants follow their parent while preserving stylesheet priority.The full-subtree setter exists on main and dates to commit 869f1a0 (July 20), predating the recent Windows work. This identifies a longstanding invalidation bottleneck; it does not claim a complete historical frame-rate bisect.
After the review correction, three alternating Windows runs of the included 1,000-item DOM benchmark measured 29.92 ms baseline versus 3.17 ms fixed median synchronous resize time (about 89% less). This measures style/layout, not full Kestrel FPS or physical presentation.
Validation:
iframe preparation did not overlap discovery with outer script workassertion; that unrelated test remains unchanged.Commands, history, and raw results are in
docs/validation/css-variable-resize.md. This PR is based directly on main and includes no Windows WebGPU, pacing, font-cache, or Kestrel fixture changes.