From 1c34162220e2555454a30bd26680e2fdf9c5da1e Mon Sep 17 00:00:00 2001 From: Ravi Shankar Date: Mon, 24 Oct 2016 13:51:39 +0530 Subject: [PATCH] Make use of existing codegen methods for font-* --- components/style/properties/gecko.mako.rs | 18 +----------------- .../style/properties/longhand/font.mako.rs | 7 +++++++ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 46bcd37d534c..289a545925f5 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -765,7 +765,7 @@ fn static_assert() { <%self:impl_trait style_struct_name="Font" - skip_longhands="font-family font-kerning font-stretch font-style font-size font-weight" + skip_longhands="font-family font-size font-weight" skip_additionals="*"> pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) { @@ -798,9 +798,6 @@ fn static_assert() { unsafe { Gecko_CopyFontFamilyFrom(&mut self.gecko.mFont, &other.gecko.mFont); } } - <%call expr="impl_keyword('font_style', 'mFont.style', - data.longhands_by_name['font-style'].keyword, need_clone=False)"> - // 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. @@ -816,19 +813,6 @@ fn static_assert() { Au(self.gecko.mSize) } - <% kerning_keyword = Keyword("font-kerning", "auto normal none", - gecko_constant_prefix='NS_FONT_KERNING') %> - - ${impl_keyword('font_kerning', 'mFont.kerning', kerning_keyword, need_clone=False)} - - <% stretch_keyword = Keyword("font-stretch", - "normal ultra-condensed extra-condensed condensed " + - "semi-condensed semi-expanded expanded " + - "extra-expanded ultra-expanded", - gecko_constant_prefix='NS_FONT_STRETCH') %> - - ${impl_keyword('font_stretch', 'mFont.stretch', stretch_keyword, need_clone=False, cast_type='i16')} - pub fn set_font_weight(&mut self, v: longhands::font_weight::computed_value::T) { self.gecko.mFont.weight = v as u16; } diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 28594f8fe39c..0733e83d82e9 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -123,7 +123,9 @@ ${helpers.single_keyword("font-style", "normal italic oblique", gecko_constant_prefix="NS_FONT_STYLE", + gecko_ffi_name="mFont.style", animatable=False)} + ${helpers.single_keyword("font-variant", "normal small-caps", animatable=False)} @@ -347,11 +349,16 @@ ${helpers.single_keyword("font-stretch", "normal ultra-condensed extra-condensed condensed \ semi-condensed semi-expanded expanded extra-expanded \ ultra-expanded", + gecko_ffi_name="mFont.stretch", + gecko_constant_prefix="NS_FONT_STRETCH", + cast_type='i16', animatable=False)} ${helpers.single_keyword("font-kerning", "auto none normal", products="gecko", + gecko_ffi_name="mFont.kerning", + gecko_constant_prefix="NS_FONT_KERNING", animatable=False)} ${helpers.single_keyword("font-variant-position",