mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -7,8 +7,6 @@
|
|||
use app_units::Au;
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
||||
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
|
||||
|
@ -20,7 +18,7 @@ use values::specified::length::{Length, LengthOrPercentage};
|
|||
|
||||
/// A specified value for a single side of the `border-width` property.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
|
||||
#[derive(Clone, Debug, HasViewportPercentage, PartialEq, ToCss)]
|
||||
pub enum BorderSideWidth {
|
||||
/// `thin`
|
||||
Thin,
|
||||
|
@ -73,17 +71,6 @@ impl Parse for BorderSideWidth {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for BorderSideWidth {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
BorderSideWidth::Thin => dest.write_str("thin"),
|
||||
BorderSideWidth::Medium => dest.write_str("medium"),
|
||||
BorderSideWidth::Thick => dest.write_str("thick"),
|
||||
BorderSideWidth::Length(ref length) => length.to_css(dest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for BorderSideWidth {
|
||||
type ComputedValue = Au;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue