mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Factor out serialize keywoded timing function values.
This will be used for computed timing function as well.
This commit is contained in:
parent
5c321737c6
commit
90ab181a6c
1 changed files with 18 additions and 11 deletions
|
@ -651,6 +651,23 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
||||||
dest.write_str(")")
|
dest.write_str(")")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn serialize_keyword<W>(dest: &mut W, keyword: FunctionKeyword) -> fmt::Result
|
||||||
|
where W: fmt::Write,
|
||||||
|
{
|
||||||
|
match keyword {
|
||||||
|
FunctionKeyword::StepStart => {
|
||||||
|
serialize_steps(dest, specified::Integer::new(1), StartEnd::Start)
|
||||||
|
},
|
||||||
|
FunctionKeyword::StepEnd => {
|
||||||
|
serialize_steps(dest, specified::Integer::new(1), StartEnd::End)
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
keyword.to_css(dest)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// https://drafts.csswg.org/css-transitions/#serializing-a-timing-function
|
// https://drafts.csswg.org/css-transitions/#serializing-a-timing-function
|
||||||
impl ToCss for SpecifiedValue {
|
impl ToCss for SpecifiedValue {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
@ -675,17 +692,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
||||||
dest.write_str(")")
|
dest.write_str(")")
|
||||||
},
|
},
|
||||||
SpecifiedValue::Keyword(keyword) => {
|
SpecifiedValue::Keyword(keyword) => {
|
||||||
match keyword {
|
serialize_keyword(dest, keyword)
|
||||||
FunctionKeyword::StepStart => {
|
|
||||||
serialize_steps(dest, specified::Integer::new(1), StartEnd::Start)
|
|
||||||
},
|
|
||||||
FunctionKeyword::StepEnd => {
|
|
||||||
serialize_steps(dest, specified::Integer::new(1), StartEnd::End)
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
keyword.to_css(dest)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue