Crate float_pigment_css

Source
Expand description

CSS parser with a style sheet manager.

Note: it is not a full web-compatible CSS parser because it supports a subset of CSS selectors and properties.

§Main Workflow

The CSS parser is designed to be used in high-level UI frameworks. The main workflow:

  1. Create a StyleSheetGroup.
  2. Parsing CSS text into a StyleSheet and added to the StyleSheetGroup.
  3. Create a StyleQuery.
  4. Run the StyleQuery with StyleSheetGroup::query_matched_rules and get a MatchedRuleList.
  5. Create a NodeProperties with NodeProperties::new.
  6. Merge the MatchedRuleList into NodeProperties with MatchedRuleList::merge_node_properties.

The result NodeProperties contains all supported CSS properties.

§The Binary Format

The StyleSheet can be serialized into a specialized “bincode” format. (Note that it is not the same format as the bincode crate.) This binary format can be deserialized with great performance, so it can be used as the cache of static style sheet text. It also has compatibilities across different versions of this crate.

Re-exports§

Modules§

  • General length type utilities.
  • The CSS parser module.
  • The list of supported CSS properties.
  • Utilities for style queries.
  • The style sheet data structures.
  • CSS value types for each CSS property.

Structs§

Constants§

Functions§