mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Derive ToCss for values::generics::font::KeywordSize.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 9ek3PcqYiU3
This commit is contained in:
parent
54d8863e60
commit
e50847666c
1 changed files with 4 additions and 25 deletions
|
@ -187,18 +187,21 @@ impl<Length> SpecifiedValueInfo for KeywordInfo<Length> {
|
||||||
|
|
||||||
/// CSS font keywords
|
/// CSS font keywords
|
||||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
|
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
|
||||||
ToAnimatedValue, ToAnimatedZero, SpecifiedValueInfo)]
|
SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToCss)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum KeywordSize {
|
pub enum KeywordSize {
|
||||||
|
#[css(keyword = "xx-small")]
|
||||||
XXSmall,
|
XXSmall,
|
||||||
XSmall,
|
XSmall,
|
||||||
Small,
|
Small,
|
||||||
Medium,
|
Medium,
|
||||||
Large,
|
Large,
|
||||||
XLarge,
|
XLarge,
|
||||||
|
#[css(keyword = "xx-large")]
|
||||||
XXLarge,
|
XXLarge,
|
||||||
// This is not a real font keyword and will not parse
|
// This is not a real font keyword and will not parse
|
||||||
// HTML font-size 7 corresponds to this value
|
// HTML font-size 7 corresponds to this value
|
||||||
|
#[css(skip)]
|
||||||
XXXLarge,
|
XXXLarge,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,30 +219,6 @@ impl Default for KeywordSize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for KeywordSize {
|
|
||||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
|
||||||
where
|
|
||||||
W: Write,
|
|
||||||
{
|
|
||||||
dest.write_str(match *self {
|
|
||||||
KeywordSize::XXSmall => "xx-small",
|
|
||||||
KeywordSize::XSmall => "x-small",
|
|
||||||
KeywordSize::Small => "small",
|
|
||||||
KeywordSize::Medium => "medium",
|
|
||||||
KeywordSize::Large => "large",
|
|
||||||
KeywordSize::XLarge => "x-large",
|
|
||||||
KeywordSize::XXLarge => "xx-large",
|
|
||||||
KeywordSize::XXXLarge => {
|
|
||||||
debug_assert!(
|
|
||||||
false,
|
|
||||||
"We should never serialize specified values set via HTML presentation attributes"
|
|
||||||
);
|
|
||||||
"-servo-xxx-large"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A generic value for the `font-style` property.
|
/// A generic value for the `font-style` property.
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-fonts-4/#font-style-prop
|
/// https://drafts.csswg.org/css-fonts-4/#font-style-prop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue