diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 77e038e83ec..b330a5c33d6 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -321,12 +321,7 @@ struct LayoutFontGroupCacheKey { impl PartialEq for LayoutFontGroupCacheKey { fn eq(&self, other: &LayoutFontGroupCacheKey) -> bool { - self.pointer.font_family == other.pointer.font_family && - self.pointer.font_stretch == other.pointer.font_stretch && - self.pointer.font_style == other.pointer.font_style && - self.pointer.font_weight as u16 == other.pointer.font_weight as u16 && - self.pointer.font_variant == other.pointer.font_variant && - self.size == other.size + self.pointer == other.pointer && self.size == other.size } } diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index 86d553871b8..5391e8d32be 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -6029,7 +6029,11 @@ pub mod style_structs { use super::longhands; % for style_struct in STYLE_STRUCTS: + % if style_struct.name == "Font": + #[derive(Clone, HeapSizeOf)] + % else: #[derive(PartialEq, Clone, HeapSizeOf)] + % endif pub struct ${style_struct.name} { % for longhand in style_struct.longhands: pub ${longhand.ident}: longhands::${longhand.ident}::computed_value::T, @@ -6038,6 +6042,18 @@ pub mod style_structs { pub hash: u64, % endif } + % if style_struct.name == "Font": + + impl PartialEq for ${style_struct.name} { + fn eq(&self, other: &${style_struct.name}) -> bool { + self.hash == other.hash + % for longhand in style_struct.longhands: + && self.${longhand.ident} == other.${longhand.ident} + % endfor + } + } + % endif + % endfor }