Description#
Implement CSS value parsing in the css crate to convert raw token lists into typed property values.
Acceptance Criteria#
- Parse CSS length values:
- Absolute units:
px,pt,cm,mm,in,pc - Font-relative units:
em,rem - Viewport units:
vw,vh,vmin,vmax(store for later resolution) - Percentages:
50% 0(unitless zero)
- Absolute units:
- Parse CSS color values:
- Named colors: at least the 16 basic CSS colors +
transparent - Hex colors:
#rgb,#rrggbb,#rgba,#rrggbbaa rgb()andrgba()functional notationcurrentColorkeyword
- Named colors: at least the 16 basic CSS colors +
- Parse CSS keyword values:
inherit,initial,unset- Display:
block,inline,inline-block,none,flex - Position:
static,relative,absolute,fixed - Text:
left,center,right,justify - Font-weight:
normal,bold, numeric (100-900) - Font-style:
normal,italic - Overflow:
visible,hidden,scroll,auto autokeyword for margins/width/height
- Represent parsed values as a
CssValueenum with typed variants - Parse shorthand properties into longhand (at least
margin,padding,border,background) - Write comprehensive tests
Dependencies#
- CSS tokenizer
Implementation Notes#
- This provides the typed value layer between raw tokens and computed styles
- Shorthand expansion is critical for the cascade to work correctly