mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Support unit variants when deriving ToCss
This commit is contained in:
parent
7d09ce0495
commit
45e8b0e8c7
14 changed files with 71 additions and 242 deletions
|
@ -11,7 +11,7 @@ use values::generics::rect::Rect;
|
|||
|
||||
/// A generic value for a single side of a `border-image-width` property.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
|
||||
/// `<length-or-percentage>`
|
||||
Length(LengthOrPercentage),
|
||||
|
@ -52,20 +52,6 @@ pub struct BorderRadius<LengthOrPercentage> {
|
|||
/// A generic value for `border-*-radius` longhand properties.
|
||||
pub struct BorderCornerRadius<L>(pub Size2D<L>);
|
||||
|
||||
impl<L, N> ToCss for BorderImageSideWidth<L, N>
|
||||
where L: ToCss, N: ToCss,
|
||||
{
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write
|
||||
{
|
||||
match *self {
|
||||
BorderImageSideWidth::Length(ref length) => length.to_css(dest),
|
||||
BorderImageSideWidth::Number(ref number) => number.to_css(dest),
|
||||
BorderImageSideWidth::Auto => dest.write_str("auto"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> From<N> for BorderImageSlice<N>
|
||||
where N: Clone,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue