Remove some useless manual layout optimisation for KeywordSize

This commit is contained in:
Anthony Ramine 2018-02-19 12:14:37 +01:00
parent d423e54d58
commit e976955634

View file

@ -197,13 +197,11 @@ where
} }
/// CSS font keywords /// CSS font keywords
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)] #[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(PartialEq, ToAnimatedValue, ToAnimatedZero)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum KeywordSize { pub enum KeywordSize {
XXSmall = 1, // This is to enable the NonZero optimization XXSmall,
// which simplifies the representation of Option<KeywordSize>
// in bindgen
XSmall, XSmall,
Small, Small,
Medium, Medium,
@ -217,17 +215,9 @@ pub enum KeywordSize {
impl KeywordSize { impl KeywordSize {
/// Convert to an HTML <font size> value /// Convert to an HTML <font size> value
pub fn html_size(&self) -> u8 { #[inline]
match *self { pub fn html_size(self) -> u8 {
KeywordSize::XXSmall => 0, self as u8
KeywordSize::XSmall => 1,
KeywordSize::Small => 2,
KeywordSize::Medium => 3,
KeywordSize::Large => 4,
KeywordSize::XLarge => 5,
KeywordSize::XXLarge => 6,
KeywordSize::XXXLarge => 7,
}
} }
} }