mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Derive ToCss for FontSize
This commit is contained in:
parent
ca45695db1
commit
2aa5f68c92
2 changed files with 4 additions and 17 deletions
|
@ -118,7 +118,7 @@ impl ToComputedValue for FontWeight {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
/// A specified font-size value
|
||||
pub enum FontSize {
|
||||
/// A length; e.g. 10px.
|
||||
|
@ -142,21 +142,6 @@ pub enum FontSize {
|
|||
System(SystemFont)
|
||||
}
|
||||
|
||||
impl ToCss for FontSize {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
match *self {
|
||||
FontSize::Length(ref lop) => lop.to_css(dest),
|
||||
FontSize::Keyword(info) => info.kw.to_css(dest),
|
||||
FontSize::Smaller => dest.write_str("smaller"),
|
||||
FontSize::Larger => dest.write_str("larger"),
|
||||
FontSize::System(sys) => sys.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LengthOrPercentage> for FontSize {
|
||||
fn from(other: LengthOrPercentage) -> Self {
|
||||
FontSize::Length(other)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue