Crate style

source ·
Expand description

Calculate specified and computed values from a tree of DOM nodes and a set of stylesheets.

In particular, this crate contains the definitions of supported properties, the code to parse them into specified values and calculate the computed values based on the specified values, as well as the code to serialize both specified and computed values.

The main entry point is recalc_style_at.

Major dependencies are the cssparser and selectors crates.


pub use servo_arc;


CSS transitions and animations.
Applicable declarations management.
Parsed representations of DOM attributes.
A set of author stylesheets and their computed representation, such as the ones used for ShadowRoot.
Parametric Bézier curves.
The style bloom filter is used as an optimization when matching deep descendant selectors.
Misc information about a given computed style.
The context within which style is calculated.
Per-node data used in style calculation.
Types and traits used to access the DOM from style calculation.
Generic implementations of some DOM APIs so they can be shared between Servo and Gecko.
Implements traversal over the DOM tree. The traversal starts in sequential mode, and optionally parallelizes as it discovers work.
States elements can be in.
Parsing stylesheets from bytes (not &str).
Types used to report parsing errors.
The @font-face at-rule.
Access to font metrics from the style system.
Global style data
Reexports of hashglobe types in Gecko mode, and stdlib hashmap shims in Servo mode
Different bits of code related to invalidating style.
Geometry in flow-relative space.
macros 🔒
Various macro helpers.
High-level interface to CSS selector matching.
Implements parallel traversal over the DOM tree.
The context within which CSS code is parsed.
The CSS properties supported by the style system. Generated from the template by
A cache from rule node to computed values, in order to cache reset properties.
Collects a series of applicable rules for a given element.
The rule tree.
Stack-scoped thread-local storage for rayon thread pools.
A data structure to efficiently index structs containing selectors by local name, ids and hash.
The pseudo-classes and pseudo-elements supported by the style system.
Servo-specific bits of the style system.
Different objects protected by the same lock
Code related to the style sharing cache, an optimization that allows similar nodes to share style without having to run selector matching twice.
String utils for attributes and similar stuff.
A struct to encapsulate all the style fixups and flags propagations a computed style needs in order for it to adhere to the CSS spec.
Style resolution for a given element or pseudo-element.
A centralized set of stylesheets for a document.
Style sheets and their CSS rules.
Selector matching.
Supports dynamic assertions in about what sort of thread is running and what state it’s in.
Traversing the DOM tree; the bloom filter.
Flags that control the traversal process.
Various stuff for CSS property use counters.
Common values used in CSS.


Call the given macro with tokens like this for each longhand and shorthand properties that is enabled in content:
Call the given macro with tokens like this for each longhand properties:


A wrapper type for a refcounted slice using ThinArc.
A struct that basically replaces a Box<[T]>, but which cbindgen can understand.
A struct that basically replaces a Box, but with a defined layout, suitable for FFI.


Extension methods for selectors::attr::CaseSensitivity
A trait pretty much similar to num_traits::One, but without the need of implementing Mul.
A trait pretty much similar to num_traits::Zero, but without the need of implementing Add.

Type Definitions