Expand description
Cache for CSS Properties CSS property cache for efficient style resolution and animation.
This module implements a cache layer between the raw CSS stylesheet and the rendered DOM. It resolves CSS properties for each node, handling:
- Cascade resolution: Computes final values from CSS rules, inline styles, and inheritance
- Pseudo-class states: Caches styles for
:hover,:active,:focus, etc. - Animation support: Tracks animating properties for smooth interpolation
- Performance: Avoids re-parsing and re-resolving unchanged properties
§Architecture
The cache is organized per-node and per-property-type. Each property has a dedicated getter method that:
- Checks if the property is cached
- If not, resolves it from CSS rules + inline styles
- Caches the result for subsequent frames
§Thread Safety
Not thread-safe. Each window has its own cache instance.
Structs§
- CssDependency
Chain - A dependency chain for a CSS property value. Example: [10% of node 10, then 1.2em of that, then 1.5em of that]
- CssProperty
Cache - CssProperty
Cache Ptr - CssProperty
With Origin - A CSS property with its origin tracking.
Enums§
- CssDependency
Chain Step - Represents a single step in a CSS property dependency chain. Example: “10% of node 5” or “1.2em of node 3”
- CssProperty
Origin - Tracks the origin of a CSS property value. Used to correctly implement the CSS cascade and inheritance rules.