Revert "Derive ToCss for MozImageRect"

This reverts commit fe19c3810c.
This commit is contained in:
Anthony Ramine 2017-06-13 18:00:29 +02:00
parent 8c2a7d6787
commit 8eec24cd46
5 changed files with 39 additions and 21 deletions

View file

@ -18,13 +18,13 @@ use values::specified::url::SpecifiedUrl;
/// [image]: https://drafts.csswg.org/css-images/#image-values
#[derive(Clone, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Image<Gradient, MozImageRect> {
pub enum Image<Gradient, ImageRect> {
/// A `<url()>` image.
Url(SpecifiedUrl),
/// A `<gradient>` image.
Gradient(Gradient),
/// A `-moz-image-rect` image
Rect(MozImageRect),
Rect(ImageRect),
/// A `-moz-element(# <element-id>)`
Element(Atom),
/// A paint worklet image.
@ -151,12 +151,11 @@ impl ToCss for PaintWorklet {
/// Values for `moz-image-rect`.
///
/// `-moz-image-rect(<uri>, top, right, bottom, left)`
#[allow(missing_docs)]
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[css(function)]
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
pub struct MozImageRect<NumberOrPercentage> {
#[allow(missing_docs)]
pub struct ImageRect<NumberOrPercentage> {
pub url: SpecifiedUrl,
pub top: NumberOrPercentage,
pub bottom: NumberOrPercentage,
@ -334,3 +333,21 @@ impl<C, L> ToCss for ColorStop<C, L>
Ok(())
}
}
impl<C> ToCss for ImageRect<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(")")
}
}