Bug 1646811 - servo: Derive Serialize and Deserialize traits for font styles.
authorUtsav Oza <utsavoza96@gmail.com>
Thu, 18 Jun 2020 18:13:56 +0000
changeset 536369 82715114ac5bfa857f871162685409cb763c12fc
parent 536368 086c24ae56898b5c785099e433ce81d59917297e
child 536370 cb3a0bb7571a752bb87866cdc721e75f9314416a
push id119420
push userealvarez@mozilla.com
push dateThu, 18 Jun 2020 18:18:12 +0000
treeherderautoland@206011a5cc20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1646811
milestone79.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
Bug 1646811 - servo: Derive Serialize and Deserialize traits for font styles. Depends on D80239 Differential Revision: https://phabricator.services.mozilla.com/D80240
servo/components/style/properties/properties.mako.rs
servo/components/style/values/computed/font.rs
servo/components/style/values/specified/font.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -2597,17 +2597,18 @@ pub mod style_structs {
     use super::longhands;
     use std::hash::{Hash, Hasher};
     use crate::logical_geometry::WritingMode;
     use crate::media_queries::Device;
     use crate::values::computed::NonNegativeLength;
 
     % for style_struct in data.active_style_structs():
         % if style_struct.name == "Font":
-        #[derive(Clone, Debug, MallocSizeOf, Serialize, Deserialize)]
+        #[derive(Clone, Debug, MallocSizeOf)]
+        #[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
         % else:
         #[derive(Clone, Debug, MallocSizeOf, PartialEq)]
         % endif
         /// The ${style_struct.name} style struct.
         pub struct ${style_struct.name} {
             % for longhand in style_struct.longhands:
                 % if not longhand.logical:
                     /// The ${longhand.name} computed value.
--- a/servo/components/style/values/computed/font.rs
+++ b/servo/components/style/values/computed/font.rs
@@ -88,19 +88,18 @@ impl From<FontWeight> for FontKitFontWei
     ComputeSquaredDistance,
     Copy,
     Debug,
     MallocSizeOf,
     PartialEq,
     ToAnimatedZero,
     ToCss,
     ToResolvedValue,
-    Serialize,
-    Deserialize,
 )]
+#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
 /// The computed value of font-size
 pub struct FontSize {
     /// The size.
     pub size: NonNegativeLength,
     /// If derived from a keyword, the keyword and additional transformations applied to it
     #[css(skip)]
     pub keyword_info: KeywordInfo,
 }
@@ -477,25 +476,25 @@ impl From<&SingleFontFamily> for FontKit
         }
     }
 }
 
 #[cfg(feature = "servo")]
 #[derive(
     Clone,
     Debug,
+    Deserialize,
     Eq,
     Hash,
     MallocSizeOf,
     PartialEq,
+    Serialize,
     ToComputedValue,
     ToResolvedValue,
     ToShmem,
-    Serialize,
-    Deserialize,
 )]
 /// A list of SingleFontFamily
 pub struct FontFamilyList(Box<[SingleFontFamily]>);
 
 #[cfg(feature = "gecko")]
 #[derive(Clone, Debug, ToComputedValue, ToResolvedValue)]
 /// A list of SingleFontFamily
 pub enum FontFamilyList {
--- a/servo/components/style/values/specified/font.rs
+++ b/servo/components/style/values/specified/font.rs
@@ -542,19 +542,18 @@ impl Default for FontSizeKeyword {
     MallocSizeOf,
     PartialEq,
     ToAnimatedValue,
     ToAnimatedZero,
     ToComputedValue,
     ToCss,
     ToResolvedValue,
     ToShmem,
-    Serialize,
-    Deserialize,
 )]
+#[cfg_attr(feature = "servo", derive(Serialize, Deserialize))]
 /// Additional information for keyword-derived font sizes.
 pub struct KeywordInfo {
     /// The keyword used
     pub kw: FontSizeKeyword,
     /// A factor to be multiplied by the computed size of the keyword
     #[css(skip)]
     pub factor: f32,
     /// An additional fixed offset to add to the kw * factor in the case of