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.

Re-exports§

pub use servo::animation;
pub use servo::attr;
pub use servo_arc;

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§

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

Traits§

CaseSensitivityExt
Extension methods for selectors::attr::CaseSensitivity
One
A trait pretty much similar to num_traits::One, but without the need of implementing Mul.
ShrinkIfNeeded 🔒
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.
ZeroNoPercent
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).

Type Aliases§

Atom
LocalName
Namespace
Prefix