diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index eff22c710d7..2a7700faa6d 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1563,6 +1563,23 @@ fn static_assert() { } } + pub fn clone_font_feature_settings(&self) -> longhands::font_feature_settings::computed_value::T { + use values::generics::{FontSettings, FontSettingTag, FontSettingTagInt} ; + + if self.gecko.mFont.fontFeatureSettings.len() == 0 { + FontSettings::Normal + } else { + FontSettings::Tag( + self.gecko.mFont.fontFeatureSettings.iter().map(|gecko_font_feature_setting| { + FontSettingTag { + tag: gecko_font_feature_setting.mTag, + value: FontSettingTagInt(gecko_font_feature_setting.mValue), + } + }).collect() + ) + } + } + pub fn set_font_variation_settings(&mut self, v: longhands::font_variation_settings::computed_value::T) { use values::generics::FontSettings; @@ -1640,6 +1657,34 @@ fn static_assert() { self.gecko.mGenericID = other.gecko.mGenericID; } + pub fn clone_font_family(&self) -> longhands::font_family::computed_value::T { + use properties::longhands::font_family::computed_value::{FontFamily, FamilyName}; + use gecko_bindings::structs::FontFamilyType; + use gecko_string_cache::Atom; + + ::properties::longhands::font_family::computed_value::T( + self.gecko.mFont.fontlist.mFontlist.iter().map(|gecko_font_family_name| { + match gecko_font_family_name.mType { + FontFamilyType::eFamily_serif => FontFamily::Generic(atom!("serif")), + FontFamilyType::eFamily_sans_serif => FontFamily::Generic(atom!("sans-serif")), + FontFamilyType::eFamily_monospace => FontFamily::Generic(atom!("monospace")), + FontFamilyType::eFamily_cursive => FontFamily::Generic(atom!("cursive")), + FontFamilyType::eFamily_fantasy => FontFamily::Generic(atom!("fantasy")), + FontFamilyType::eFamily_moz_fixed => FontFamily::Generic(Atom::from("-moz-fixed")), + FontFamilyType::eFamily_named => FontFamily::FamilyName(FamilyName { + name: (&*gecko_font_family_name.mName).into(), + quoted: false + }), + FontFamilyType::eFamily_named_quoted => FontFamily::FamilyName(FamilyName { + name: (&*gecko_font_family_name.mName).into(), + quoted: true + }), + x => panic!("Found unexpected font FontFamilyType: {:?}", x), + } + }).collect() + ) + } + // FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the // actual computed size, and the other of which (mFont.size) is the 'display // size' which takes font zooming into account. We don't handle font zooming yet. diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 1202d5fdced..d0a66f006f2 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -78,7 +78,7 @@ macro_rules! impl_gecko_keyword_from_trait { } -<%helpers:longhand name="font-family" animation_value_type="none" need_index="True" boxed="${product == 'gecko'}" +<%helpers:longhand name="font-family" animation_value_type="discrete" need_index="True" boxed="${product == 'gecko'}" spec="https://drafts.csswg.org/css-fonts/#propdef-font-family"> use properties::longhands::system_font::SystemFont; use self::computed_value::{FontFamily, FamilyName}; @@ -1941,7 +1941,7 @@ ${helpers.single_keyword_system("font-variant-position", spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-position", animation_value_type="discrete")} -<%helpers:longhand name="font-feature-settings" products="gecko" animation_value_type="none" +<%helpers:longhand name="font-feature-settings" products="gecko" animation_value_type="discrete" extra_prefixes="moz" boxed="True" spec="https://drafts.csswg.org/css-fonts/#propdef-font-feature-settings"> use properties::longhands::system_font::SystemFont;