| 4 | |
| 5 | impl<'a> Parse<'a> for GlyphOrientationVerticalStyleValue { |
| 6 | fn parse<I>(p: &mut Parser<'a, I>) -> ParseResult<Self> |
| 7 | where |
| 8 | I: Iterator<Item = Cursor> + Clone, |
| 9 | { |
| 10 | let c = p.peek_n(1); |
| 11 | if <T![Ident]>::peek(p, c) && p.equals_atom(c, &CssAtomSet::Auto) { |
| 12 | p.parse::<T![Ident]>().map(Self::Auto) |
| 13 | } else { |
| 14 | if let Some(int) = p.parse_if_peek::<CSSInt>()? { |
| 15 | match int.into() { |
| 16 | 0i32 => { |
| 17 | return Ok(Self::Literal0(Exact(int))); |
| 18 | } |
| 19 | 90i32 => { |
| 20 | return Ok(Self::Literal90(Exact(int))); |
| 21 | } |
| 22 | _ => {} |
| 23 | } |
| 24 | } |
| 25 | if let Some(dimension) = p.parse_if_peek::<T![Dimension]>()? { |
| 26 | match (dimension.value(), p.to_atom::<CssAtomSet>(dimension.into())) { |
| 27 | (0f32, CssAtomSet::Deg) => { |
| 28 | return Ok(Self::Literal0deg(Exact(dimension))); |
| 29 | } |
| 30 | (90f32, CssAtomSet::Deg) => { |
| 31 | return Ok(Self::Literal90deg(Exact(dimension))); |
| 32 | } |
| 33 | _ => {} |
| 34 | } |
| 35 | } |
| 36 | Err(Diagnostic::new(p.next(), Diagnostic::unexpected))? |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | #[cfg(test)] |