Bug 1646811 - servo: Implement CanvasRenderingContext2D.font property.
authorUtsav Oza <utsavoza96@gmail.com>
Thu, 18 Jun 2020 18:12:46 +0000
changeset 536350 366e36da6a7a77057a479b8bd20c246d78435d1f
parent 536349 023935dbbdd66d3d5f78c82a48306ab79879188d
child 536351 086c24ae56898b5c785099e433ce81d59917297e
push id37520
push userdluca@mozilla.com
push dateFri, 19 Jun 2020 04:04:08 +0000
treeherdermozilla-central@d1a4f9157858 [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: Implement CanvasRenderingContext2D.font property. Depends on D80237 Differential Revision: https://phabricator.services.mozilla.com/D80238
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,17 @@ 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)]
+        #[derive(Clone, Debug, MallocSizeOf, 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
@@ -75,16 +75,18 @@ impl ToAnimatedValue for FontWeight {
     ComputeSquaredDistance,
     Copy,
     Debug,
     MallocSizeOf,
     PartialEq,
     ToAnimatedZero,
     ToCss,
     ToResolvedValue,
+    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,
@@ -174,17 +176,17 @@ impl ToAnimatedValue for FontSize {
         FontSize {
             size: NonNegative(animated.clamp_to_non_negative()),
             keyword_info: KeywordInfo::none(),
         }
     }
 }
 
 #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToResolvedValue)]
-#[cfg_attr(feature = "servo", derive(Hash, MallocSizeOf))]
+#[cfg_attr(feature = "servo", derive(Hash, MallocSizeOf, Serialize, Deserialize))]
 /// Specifies a prioritized list of font family names or generic family names.
 pub struct FontFamily {
     /// The actual list of family names.
     pub families: FontFamilyList,
     /// Whether this font-family came from a specified system-font.
     pub is_system_font: bool,
 }
 
@@ -440,17 +442,27 @@ impl SingleFontFamily {
             name,
             syntax: family.mSyntax,
         })
     }
 }
 
 #[cfg(feature = "servo")]
 #[derive(
-    Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem,
+    Clone,
+    Debug,
+    Eq,
+    Hash,
+    MallocSizeOf,
+    PartialEq,
+    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
@@ -493,16 +493,18 @@ impl ToComputedValue for FontStretch {
     PartialEq,
     SpecifiedValueInfo,
     ToAnimatedValue,
     ToAnimatedZero,
     ToComputedValue,
     ToCss,
     ToResolvedValue,
     ToShmem,
+    Serialize,
+    Deserialize,
 )]
 #[allow(missing_docs)]
 #[repr(u8)]
 pub enum FontSizeKeyword {
     #[css(keyword = "xx-small")]
     XXSmall,
     XSmall,
     Small,
@@ -540,16 +542,18 @@ impl Default for FontSizeKeyword {
     MallocSizeOf,
     PartialEq,
     ToAnimatedValue,
     ToAnimatedZero,
     ToComputedValue,
     ToCss,
     ToResolvedValue,
     ToShmem,
+    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,