mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Derive ToCss for CounterBound
This commit is contained in:
parent
0b3a5b42ba
commit
fb8b6fc0a5
1 changed files with 3 additions and 14 deletions
|
@ -447,7 +447,7 @@ impl Parse for Negative {
|
|||
pub struct Ranges(pub Vec<Range<CounterBound>>);
|
||||
|
||||
/// A bound found in `Ranges`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, ToCss)]
|
||||
pub enum CounterBound {
|
||||
/// An integer bound.
|
||||
///
|
||||
|
@ -514,20 +514,9 @@ fn range_to_css<W>(range: &Range<CounterBound>, dest: &mut CssWriter<W>) -> fmt:
|
|||
where
|
||||
W: Write,
|
||||
{
|
||||
bound_to_css(range.start, dest)?;
|
||||
range.start.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
bound_to_css(range.end, dest)
|
||||
}
|
||||
|
||||
fn bound_to_css<W>(range: CounterBound, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
if let CounterBound::Integer(finite) = range {
|
||||
finite.to_css(dest)
|
||||
} else {
|
||||
dest.write_str("infinite")
|
||||
}
|
||||
range.end.to_css(dest)
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue