From 69070c7592b1c7c84f8c3306a0603fba7ae73dce Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 10 Aug 2017 17:16:36 -0700 Subject: [PATCH] stylo: Don't call fixup_generic_font for system or CSS wide specified fonts --- components/style/properties/gecko.mako.rs | 7 +++++++ components/style/properties/properties.mako.rs | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 352bf0f8ae0..a62d00be52f 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2165,11 +2165,17 @@ fn static_assert() { } pub fn fixup_none_generic(&mut self, device: &Device) { + self.gecko.mFont.systemFont = false; unsafe { bindings::Gecko_nsStyleFont_FixupNoneGeneric(&mut self.gecko, device.pres_context()) } } + pub fn fixup_system(&mut self) { + self.gecko.mFont.systemFont = true; + self.gecko.mGenericID = structs::kGenericFont_NONE; + } + pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) { use properties::longhands::font_family::computed_value::{FontFamily, FamilyNameSyntax}; @@ -2206,6 +2212,7 @@ fn static_assert() { pub fn copy_font_family_from(&mut self, other: &Self) { unsafe { Gecko_CopyFontFamilyFrom(&mut self.gecko.mFont, &other.gecko.mFont); } self.gecko.mGenericID = other.gecko.mGenericID; + self.gecko.mFont.systemFont = other.gecko.mFont.systemFont; } pub fn reset_font_family(&mut self, other: &Self) { diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 4bf430bc48a..8ba3f44df1c 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -3297,7 +3297,13 @@ where &mut cascade_info); % if product == "gecko": let device = context.builder.device; - context.builder.mutate_font().fixup_none_generic(device); + if let PropertyDeclaration::FontFamily(ref val) = **declaration { + if val.get_system().is_some() { + context.builder.mutate_font().fixup_system(); + } else { + context.builder.mutate_font().fixup_none_generic(device); + } + } % endif } }