mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Support unit variants when deriving ToCss
This commit is contained in:
parent
7d09ce0495
commit
45e8b0e8c7
14 changed files with 71 additions and 242 deletions
|
@ -329,8 +329,8 @@ pub fn concat_serialize_idents<W>(prefix: &str, suffix: &str,
|
|||
/// The initial argument of the `repeat` function.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-grid/#typedef-track-repeat
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
|
||||
pub enum RepeatCount {
|
||||
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
|
||||
Number(Integer),
|
||||
|
@ -340,16 +340,6 @@ pub enum RepeatCount {
|
|||
AutoFit,
|
||||
}
|
||||
|
||||
impl ToCss for RepeatCount {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
RepeatCount::Number(ref c) => c.to_css(dest),
|
||||
RepeatCount::AutoFill => dest.write_str("auto-fill"),
|
||||
RepeatCount::AutoFit => dest.write_str("auto-fit"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for RepeatCount {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
if let Ok(i) = input.try(|i| Integer::parse(context, i)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue