Expand description
Shared value parsers used by both the HTML and CSS parsers.
Each returns Result<T, ParseError>; on failure ParseError::BadAttribute
carries the calling context (tag-name in HTML, selector text in CSS),
the property name, and the raw value, so error messages are useful
either side of the parser boundary.
Structs§
- Border
Shorthand - Parsed result of a
border:-family shorthand.
Functions§
- bad
- Construct a
BadAttributeerror. - parse_
bg - Parse a
bg=value: a hex color, a gradient function, or an image named withurl(...). Gradient stops accept the CSS forms<color>(auto-distributed) or<color> <offset%>(explicit). Parsed stops are sorted by offset ascending so the renderer can hand them straight to peniko. - parse_
border_ shorthand - CSS
bordershorthand:<width> || <style> || <color>in any order (e.g.1px solid #444).border: noneclears the border. - parse_
border_ style border-stylekeyword:none|solid(v1 subset). Other CSS styles (dashed,dotted, …) are rejected so the declaration is skipped with a warning instead of silently misrendering.- parse_
border_ width_ edges - CSS
border-widthshorthand - 1-4 keyword/length terms in the standard top-right-bottom-left rotation. - parse_
border_ width_ term - CSS border-width keyword / length term:
thin(1px),medium(3px),thick(5px), or a px length. Percent is not valid CSS for border widths and is rejected. - parse_
color #rrggbbor#rrggbbaa.- parse_
corner_ radii - CSS
border-radiusmulti-value shorthand -> per-corner radii[top-left, top-right, bottom-right, bottom-left]: - parse_
edges - Parse a CSS-style spacing shorthand, top-right-bottom-left.
- parse_
f32 - Parse a plain
f32. - parse_
font_ weight - CSS
font-weight:normal(400),bold(700), or a number in1..=1000(CSS Fonts 4). The relative keywordslighter/bolderneed the parent’s computed weight and are rejected. - parse_
i32 - Parse a plain
i32. - parse_
image_ fit - An image fit:
fill,cover,contain,none, orscale-down. Thefitof an<image>and thebg-fitof a background image take the same values. - parse_
inset_ edges parse_edgesforinset, where a term may also beauto(stored asNaN, the sentinel the layout backend reads asauto).- parse_
inset_ term - One
insetlonghand term: a px number, orauto(NaN). - parse_
length - Length:
auto|<n>|<n>px|<n>%. - parse_
url - The path inside a CSS
url(...), orNonewhenvalueis not aurl()at all. The path may be double-quoted, single-quoted, or bare; an empty one is an error.