servo: Merge #20073 - Remove some useless manual layout optimisation for KeywordSize (from servo:keywordsize); r=emilio
authorAnthony Ramine <n.oxyde@gmail.com>
Mon, 19 Feb 2018 07:02:45 -0500
changeset 404402 673079f35a2fc57b87e202255e9bc5f45d728f1f
parent 404401 387d87eb05f8a5917657e2a42f21d56dc735e6d3
child 404403 25c8cf91317569de5e92207417073ffb057b2fe6
push id100000
push userncsoregi@mozilla.com
push dateMon, 19 Feb 2018 16:46:49 +0000
treeherdermozilla-inbound@176fb0d46b64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #20073 - Remove some useless manual layout optimisation for KeywordSize (from servo:keywordsize); r=emilio Source-Repo: https://github.com/servo/servo Source-Revision: be902d56c022cbfed2aef7a816de80d139718235
servo/components/style/values/generics/font.rs
--- a/servo/components/style/values/generics/font.rs
+++ b/servo/components/style/values/generics/font.rs
@@ -192,47 +192,37 @@ where
             kw: x,
             factor: 1.,
             offset: Au(0).into(),
         }
     }
 }
 
 /// CSS font keywords
-#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)]
-#[derive(Clone, Copy, Debug, PartialEq)]
+#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
+#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero)]
 #[allow(missing_docs)]
 pub enum KeywordSize {
-    XXSmall = 1, // This is to enable the NonZero optimization
-                 // which simplifies the representation of Option<KeywordSize>
-                 // in bindgen
+    XXSmall,
     XSmall,
     Small,
     Medium,
     Large,
     XLarge,
     XXLarge,
     // This is not a real font keyword and will not parse
     // HTML font-size 7 corresponds to this value
     XXXLarge,
 }
 
 impl KeywordSize {
     /// Convert to an HTML <font size> value
-    pub fn html_size(&self) -> u8 {
-        match *self {
-            KeywordSize::XXSmall => 0,
-            KeywordSize::XSmall => 1,
-            KeywordSize::Small => 2,
-            KeywordSize::Medium => 3,
-            KeywordSize::Large => 4,
-            KeywordSize::XLarge => 5,
-            KeywordSize::XXLarge => 6,
-            KeywordSize::XXXLarge => 7,
-        }
+    #[inline]
+    pub fn html_size(self) -> u8 {
+        self as u8
     }
 }
 
 impl Default for KeywordSize {
     fn default() -> Self {
         KeywordSize::Medium
     }
 }