mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fix the serialization of TrackRepeat
It was printing `repeat(n, <line-names>)` for number TrackRepeat. But it should just print n times <line-names> instead. MozReview-Commit-ID: FEmL8O2osVb
This commit is contained in:
parent
9d9d99ec25
commit
5eb33bac8f
1 changed files with 32 additions and 13 deletions
|
@ -380,9 +380,22 @@ pub struct TrackRepeat<L> {
|
|||
|
||||
impl<L: ToCss> ToCss for TrackRepeat<L> {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
// If repeat count is an integer instead of a keyword, it should'n serialized
|
||||
// with `repeat` function. It should serialized with `N` repeated form.
|
||||
let repeat_count = match self.count {
|
||||
RepeatCount::Number(integer) => integer.value(),
|
||||
_ => {
|
||||
dest.write_str("repeat(")?;
|
||||
self.count.to_css(dest)?;
|
||||
dest.write_str(", ")?;
|
||||
1
|
||||
},
|
||||
};
|
||||
|
||||
for i in 0..repeat_count {
|
||||
if i != 0 {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
|
||||
let mut line_names_iter = self.line_names.iter();
|
||||
for (i, (ref size, ref names)) in self.track_sizes.iter()
|
||||
|
@ -398,8 +411,14 @@ impl<L: ToCss> ToCss for TrackRepeat<L> {
|
|||
if let Some(line_names_last) = line_names_iter.next() {
|
||||
concat_serialize_idents(" [", "]", line_names_last, " ", dest)?;
|
||||
}
|
||||
}
|
||||
|
||||
match self.count {
|
||||
RepeatCount::AutoFill | RepeatCount::AutoFit => {
|
||||
dest.write_str(")")?;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue