mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
Derive ToCss for MozImageRect
This commit is contained in:
parent
44eb8c8e4f
commit
fe19c3810c
5 changed files with 21 additions and 39 deletions
|
@ -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, ImageRect> {
|
||||
pub enum Image<Gradient, MozImageRect> {
|
||||
/// A `<url()>` image.
|
||||
Url(SpecifiedUrl),
|
||||
/// A `<gradient>` image.
|
||||
Gradient(Gradient),
|
||||
/// A `-moz-image-rect` image
|
||||
Rect(ImageRect),
|
||||
Rect(MozImageRect),
|
||||
/// A `-moz-element(# <element-id>)`
|
||||
Element(Atom),
|
||||
/// A paint worklet image.
|
||||
|
@ -151,11 +151,12 @@ 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))]
|
||||
/// `-moz-image-rect(<uri>, top, right, bottom, left)`
|
||||
#[allow(missing_docs)]
|
||||
pub struct ImageRect<NumberOrPercentage> {
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[css(function)]
|
||||
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||
pub struct MozImageRect<NumberOrPercentage> {
|
||||
pub url: SpecifiedUrl,
|
||||
pub top: NumberOrPercentage,
|
||||
pub bottom: NumberOrPercentage,
|
||||
|
@ -337,21 +338,3 @@ 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(")")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue