Expand description
sk-css: lightningcss parses stylesheets, parcel_selectors matches them against the retained
tree, and the cascade folds matched rules into per-state gpui::StyleRefinements that the
renderer installs into gpui’s state ladder (base / focus / focus-visible / hover / active).
- The cascade runs once per tree mutation, never inside gpui’s per-frame style computation; interaction states never round-trip through JS.
:disabled/:checkedare not ladder states: the element property is the state, so they fold into the base bucket.- Selectors the matcher cannot run (
:has(), unflattened nesting,:nth-child(.. of S)) panic inside parcel_selectors, so they are probed and rejected at compile time with a diagnostic. Selectors it can run but could only answer “no” for (:visited, …) are reported by [audit_selector], never compiled into a rule that silently never matches.
Modules§
- catalog
- What CSS Skathi supports, property by property: the one list
CSS.supports,@supportsand the docs answer from. Each entry’s sample values run through the mapper in the tests below, so an entry that disagrees with what the mapper does fails the build. - container
@containerconditions and the container query length units (cqw…cqmax), answered from the query containers above the element being cascaded and the content-box sizes the host’s last layout gave them.- perf
- Counters for what the cascade does: selectors the matcher ran, and how
compute_node’s time divides between matching, custom properties and folding. Accumulated percompute_nodecall and drained by the host’s phase reporter. - snap
- CSS Scroll Snap:
scroll-snap-type,scroll-snap-align,scroll-snap-stop,scroll-paddingandscroll-margin, carried to the renderer (sk_tree::snap) that applies them. Writing mode is always horizontal-tb, left to right: block is y, inline is x. - view_
transition - View transition pseudo-elements as selectors over stand-in elements. A rule for
::view-transition-old(card)is rewritten to match an elementsk-vt-old[sk-vt-name="card"]undersk-vt-image-pair,sk-vt-groupandsk-vt, whose parent is the document element; the renderer builds those elements while a transition runs (MatchDom::is_view_transition_pseudo).
Structs§
- Anim
Event - Animation
Patch animation-*longhands without a list: a loneanimation-play-state: pausedoranimation-fill-mode: forwards(reka-ui’sPresencewrites it) must not delete the animation the sheet started, so it applies as a patch over the winning list.- Animation
Spec - Animator
- Background
Layer - Background
Url - Computed
States - Control
Pseudo - Current
Color Targets - Delay
- A signed
transition-delay/animation-delay: a negative one starts the timeline that far in. - Dynamic
Range Limit - The computed
dynamic-range-limit: the weights ofstandard,constrainedandno-limit, summing to 1. The initial value isno-limit. - Engine
- Env
- Extras
- Font
Relative Metrics - Group
Focus - Inherited
Radii - Inline
Motion - Inline
Priority - Inline
Style - Keyframe
- Keyframes
- Mask
Patch - The
mask-*longhands Skathi paints, cascaded apart and folded into layers after the cascade as thebackground-*ones are. - Mask
Stack - The layers of a
mask, bottom first, and whether they mask by luminance. - Matched
Rule - Pseudo
Box - Query
Result - Radius
Inherit - Which corners’
border-*-radiusisinherit, in cascade order.border-radiusdoes not inherit, soinheritasks for the PARENT’s computed radius, which the mapper cannot know. The high four bits are the corners’corner-*-shape. - Script
Clock - Script
Frame - Script
Keyframe Notes - Script
Sample - Script
Timing - Transition
Spec - Vars
Eqmatters:Rc<T>equality short-circuits on pointer identity forT: Eq, and a node with no custom properties shares its parent’sRc, keeping the change test O(1).
Enums§
- Anim
Event Kind - Animation
Direction - Background
Size - Display
Mode - Easing
- Fill
Mode - Interaction
- List
Marker - Mask
Clips - Mask
Compositing - Mask
Images - Object
Fit - CSS
object-fit. A local mirror ofgpui::ObjectFit(which derives neitherClonenorPartialEq); the initial value isfillwhile gpui’s image default isContain, so the renderer must stateFillexplicitly. - Overscroll
Behavior - Paint
Layer - Play
State - Pseudo
Element - RgbSpace
- An RGB space a color can be read into with
crate::parse_color_in. - Scrollbar
Width - Step
Position - SvgPaint
- Text
Fill - Text
Transform - Tile
Length - Transition
Property - User
Select - White
Space Mode - Window
Control - CSS
--window-control: tells Windows 11 which element is the maximize button (snap layouts). A custom property because a browser ignores those, while an unknown value of a known property would drop and fall back to the inheritedmove. - Window
Drag - The CSSWG resolved on 2026-01-21 to standardise Electron’s
-webkit-app-regionaswindow-drag: none | move, and separately that the property is INHERITED.
Constants§
- ANIMATABLE_
COUNT - COLOR_
SCHEME - The name
color-schemeis carried under among the inherited custom properties. - CONSTRAINED_
HEADROOM - The headroom
constrainedallows: one stop above SDR white. - INITIAL_
REM_ BASIS - INITIAL_
VIEWPORT_ BASIS - Must be non-zero: 0 would collapse every
vhbefore the firstset_env.
Traits§
Functions§
- accepts_
declaration - Does the engine apply
name: value? WhatCSS.supports,@supportsand the:stylearray form answer. - color_
scheme - An element’s used color scheme from its computed
color-scheme(inherited invars):Noneundernormal, else whether it is dark, the environment’s preference winning when both are listed. - convert_
rgb - Converts RGB components between the spaces, unclipped. Display P3 shares sRGB’s transfer.
- corner_
shape_ css - A shape as CSS: its keyword when it has one.
- covered
- from_
linear - match_
media Erris the reason a prelude was rejected; a browser treats an invalid media list asnot all, so callers reportmatches: falsewith the advisory.- parse_
color - A CSS
<color>as sRGB channels,Nonefor anything else,currentColorand system colours. - parse_
color_ in - A CSS
<color>inspace, unclipped: out-of-gamut and HDR components survive. - parse_
easing Nonefor anythinganimation-timing-functionwould not take either, includinglinear(...), which the lightningcss in use does not parse.- parse_
inline - parse_
inline_ full - parse_
inline_ style - parse_
inline_ with_ transitions - query_
all - An unsupported selector is
Err(advisory), not a silent empty match. Takes candidates becauseMatchDomhas no child accessor; a scopedquerySelectorusesquery_all_in. - query_
all_ in scopeis the:scoperoot; without it:scope > divwould ask about the document root.Nonematches the document element, as in the cascade.- rem_
basis - resolve_
inherited_ radii - script_
keyframes - set_
capture_ rule_ text - Turns rule-text capture on (or off) for every sheet compiled AFTER this call — the sheet already installed keeps whatever it was compiled with.
- set_
composed_ font_ families - set_
font_ metric_ source - Installs the host’s font metrics. Replacing the source invalidates cached folds, so a style computed before host setup cannot retain fallback widths.
- set_
font_ source - Read lazily on the first
font-family: enumerating installed families is costly. Without a source every named family counts as installed. - set_
rem_ basis - Sets the px value of
1rem, reporting a change.remis flattened at parse time, so already-compiled sheets do not move; out-of-range values (0.0 during boot) are refused. - set_
viewport_ basis - set_
web_ font_ families - spec_
for - strip_
transitioned - supports_
condition_ text CSS.supports(conditionText): a@supportscondition, or a bare declaration as browsers also take.- take_
font_ misses - take_
unreached_ fonts - text_
shadow_ css - A
text-shadowlist asgetComputedStylewrites it: colour first, every length,nonewhen empty. - to_
linear - sRGB’s transfer function, extended past 0 and 1 by symmetry as CSS does.
- transform_
css - used_
dark - Whether
light-dark()takes its dark half:normalis light, as in a browser. - uses_
viewport_ units - viewport_
basis
Type Aliases§
- Decls
(name, raw value text)pairs for what cannot be mapped at sheet-compile time:--xdeclarations and known properties whose value usedvar(), both resolved per element.