Skip to main content

Module styling

Module styling 

Source
Expand description

Styling system — powered by Mozilla’s Stylo CSS engine.

This is the ONLY module that imports Stylo types. All other code (dom, layout, paint, public API) uses re-exports from here.

Modules§

builder
Type-safe style API — zero CSS parsing, direct PropertyDeclaration.
style_structs
Property struct groups — access computed values by category. Usage: computed_values.get_box().clone_display() The module where all the style structs are defined.
taffy_bridge
Stylo ↔ Taffy bridge — converts ComputedValues to Taffy layout styles.
units
CSS unit helpers — px(100.0), pct(50.0), em(1.5), etc.
values
Computed value types that exist as standalone re-exports.

Structs§

AbsoluteColor
Stylo color type — used by bg(), border_color(), etc. An absolutely specified color, using either rgb(), rgba(), lab(), lch(), oklab(), oklch() or color().
Arc
Arc wrapper used by Stylo. An atomically reference counted shared pointer
ComputedValues
Computed style values for an element. All CSS properties accessible via property struct getters (e.g. cv.get_box().clone_display()). The struct that Servo uses to represent computed values.
PropertyDeclarationBlock
A parsed CSS declaration block (inline styles, stylesheet rules). Overridden declarations are skipped.
SharedRwLock
Stylo’s shared lock — needed to read locked declarations. A shared read/write lock that can protect multiple objects.
SharedRwLockReadGuard
Stylo’s shared lock — needed to read locked declarations. Proof that a shared lock was obtained for reading (servo).

Enums§

BorderStyle
CSS border-style keyword — Solid, Dashed, Dotted, None, etc. A specified value for a single side of a border-style property.

Functions§

initial_values_arc
Returns initial (default) computed values wrapped in Arc. Stylo equivalent of the old ComputedStyle::default(). Uses a static cache to avoid repeated allocation.