Skip to content

Commit

Permalink
Derive ToCss for MozImageRect<Color>
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jul 12, 2017
1 parent 907d629 commit c2e7460
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions components/style/values/generics/image.rs
Expand Up @@ -154,14 +154,15 @@ impl ToCss for PaintWorklet {
/// Values for `moz-image-rect`.
///
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[css(comma, function)]
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
pub struct MozImageRect<NumberOrPercentage> {
pub url: SpecifiedUrl,
pub top: NumberOrPercentage,
pub bottom: NumberOrPercentage,
pub right: NumberOrPercentage,
pub bottom: NumberOrPercentage,
pub left: NumberOrPercentage,
}

Expand Down Expand Up @@ -329,21 +330,3 @@ impl<C, L> fmt::Debug for ColorStop<C, L>
Ok(())
}
}

impl<C> ToCss for MozImageRect<C>
where C: ToCss,
{
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_str("-moz-image-rect(")?;
self.url.to_css(dest)?;
dest.write_str(", ")?;
self.top.to_css(dest)?;
dest.write_str(", ")?;
self.right.to_css(dest)?;
dest.write_str(", ")?;
self.bottom.to_css(dest)?;
dest.write_str(", ")?;
self.left.to_css(dest)?;
dest.write_str(")")
}
}

0 comments on commit c2e7460

Please sign in to comment.