mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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>>);
|
pub struct Ranges(pub Vec<Range<CounterBound>>);
|
||||||
|
|
||||||
/// A bound found in `Ranges`.
|
/// A bound found in `Ranges`.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, ToCss)]
|
||||||
pub enum CounterBound {
|
pub enum CounterBound {
|
||||||
/// An integer bound.
|
/// An integer bound.
|
||||||
///
|
///
|
||||||
|
@ -514,20 +514,9 @@ fn range_to_css<W>(range: &Range<CounterBound>, dest: &mut CssWriter<W>) -> fmt:
|
||||||
where
|
where
|
||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
bound_to_css(range.start, dest)?;
|
range.start.to_css(dest)?;
|
||||||
dest.write_char(' ')?;
|
dest.write_char(' ')?;
|
||||||
bound_to_css(range.end, dest)
|
range.end.to_css(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")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue