diff --git a/jirs-css/src/prop/mod.rs b/jirs-css/src/prop/mod.rs index de3351ee..9ae759ad 100644 --- a/jirs-css/src/prop/mod.rs +++ b/jirs-css/src/prop/mod.rs @@ -371,7 +371,7 @@ impl CssParser { // "clip" => Property::Clip, // "clip-path" => Property::ClipPath, "color" => Property::Color(self.parse_full_token()?), - // "column-count" => Property::ColumnCount, + "column-count" => Property::ColumnCount(self.parse_full_token()?), // "column-fill" => Property::ColumnFill, // "column-gap" => Property::ColumnGap, // "column-rule" => Property::ColumnRule, @@ -956,6 +956,27 @@ impl ParseToken for CssParser { } } +#[derive(Debug, PartialEq)] +pub enum ColumnCountProperty { + Auto, + Number(u32), +} + +impl Token for ColumnCountProperty {} + +impl ParseToken for CssParser { + fn parse_token(&mut self) -> ValueResult { + let p = match self.expect_consume()?.as_str() { + "auto" => ColumnCountProperty::Auto, + s @ _ => ColumnCountProperty::Number( + s.parse::() + .map_err(|_| format!("invalid column count"))?, + ), + }; + Ok(PropertyValue::Other(p)) + } +} + #[derive(Debug, PartialEq)] pub enum JustifyContentProperty { FlexStart, @@ -1418,7 +1439,7 @@ pub enum Property { Clip(String), ClipPath(String), Color(PropertyValue), - ColumnCount(String), + ColumnCount(PropertyValue), ColumnFill(String), ColumnGap(String), ColumnRule(String),