Skip to main content

Module prop_cache

Module prop_cache 

Source
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:

  1. Checks if the property is cached
  2. If not, resolves it from CSS rules + inline styles
  3. Caches the result for subsequent frames

§Thread Safety

Not thread-safe. Each window has its own cache instance.

Structs§

CssDependencyChain
A dependency chain for a CSS property value. Example: [10% of node 10, then 1.2em of that, then 1.5em of that]
CssPropertyCache
CssPropertyCachePtr
CssPropertyWithOrigin
A CSS property with its origin tracking.

Enums§

CssDependencyChainStep
Represents a single step in a CSS property dependency chain. Example: “10% of node 5” or “1.2em of node 3”
CssPropertyOrigin
Tracks the origin of a CSS property value. Used to correctly implement the CSS cascade and inheritance rules.