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
.
Re-exports§
Modules§
- applicable_
declarations - Applicable declarations management.
- author_
styles - A set of author stylesheets and their computed representation, such as the ones used for ShadowRoot.
- bezier
- Parametric Bézier curves.
- bloom
- The style bloom filter is used as an optimization when matching deep descendant selectors.
- color
- Color support functions.
- computed_
value_ flags - Misc information about a given computed style.
- computed_
values - Types for computed values.
- context
- The context within which style is calculated.
- counter_
style - The
@counter-style
at-rule. - custom_
properties - Support for custom properties for cascading variables.
- custom_
properties_ map - The structure that contains the custom properties of a given element.
- data
- Per-node data used in style calculation.
- dom
- Types and traits used to access the DOM from style calculation.
- dom_
apis - Generic implementations of some DOM APIs so they can be shared between Servo and Gecko.
- driver
- Implements traversal over the DOM tree. The traversal starts in sequential mode, and optionally parallelizes as it discovers work.
- error_
reporting - Types used to report parsing errors.
- font_
face - The
@font-face
at-rule. - font_
metrics - Access to font metrics from the style system.
- global_
style_ data - Global style data
- invalidation
- Different bits of code related to invalidating style.
- logical_
geometry - Geometry in flow-relative space.
- macros 🔒
- Various macro helpers.
- matching
- High-level interface to CSS selector matching.
- media_
queries - Media queries.
- parallel
- Implements parallel traversal over the DOM tree.
- parser
- The context within which CSS code is parsed.
- piecewise_
linear - A piecewise linear function, following CSS linear easing
- properties
- Supported CSS properties and the cascade.
- properties_
and_ values - Properties and Values
- queries
- Code shared between media queries and container queries.
- rule_
cache - A cache from rule node to computed values, in order to cache reset properties.
- rule_
collector - Collects a series of applicable rules for a given element.
- rule_
tree - The rule tree.
- scoped_
tls - Stack-scoped thread-local storage for rayon thread pools.
- selector_
map - A data structure to efficiently index structs containing selectors by local name, ids and hash.
- selector_
parser - The pseudo-classes and pseudo-elements supported by the style system.
- servo
- Servo-specific bits of the style system.
- shared_
lock - Different objects protected by the same lock
- sharing
- Code related to the style sharing cache, an optimization that allows similar nodes to share style without having to run selector matching twice.
- simple_
buckets_ 🔒map - str
- String utils for attributes and similar stuff.
- style_
adjuster - 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_
resolver - Style resolution for a given element or pseudo-element.
- stylesheet_
set - A centralized set of stylesheets for a document.
- stylesheets
- Style sheets and their CSS rules.
- stylist
- Selector matching.
- thread_
state - Supports dynamic assertions about what sort of thread is running and what state it’s in.
- traversal
- Traversing the DOM tree; the bloom filter.
- traversal_
flags - Flags that control the traversal process.
- use_
counters - Various stuff for CSS property use counters.
- values
- Common values used in CSS.
Macros§
- css_
properties_ accessors - Call the given macro with tokens like this for each longhand and shorthand properties that is enabled in content:
- longhand_
properties_ idents - Call the given macro with tokens like this for each longhand properties:
- reexport_
computed_ 🔒values
Structs§
- Alloc
Err - An allocation error.
- ArcSlice
- A wrapper type for a refcounted slice using ThinArc.
- Owned
Slice - A struct that basically replaces a
Box<[T]>
, but which cbindgen can understand. - Owned
Str - A struct that basically replaces a Box
, but with a defined layout, suitable for FFI.
Traits§
- Case
Sensitivity Ext - Extension methods for selectors::attr::CaseSensitivity
- One
- A trait pretty much similar to num_traits::One, but without the need of
implementing
Mul
. - Shrink
IfNeeded 🔒 - Shrink the capacity of the collection if needed.
- Zero
- A trait pretty much similar to num_traits::Zero, but without the need of
implementing
Add
. - Zero
NoPercent - A trait implementing a function to tell if the number is zero without a percent
Functions§
- should_
shrink 🔒 - We shrink the capacity of a collection if we’re wasting more than a 25% of its capacity, and if the collection is arbitrarily big enough (>= CAPACITY_THRESHOLD entries).