Skip to content

Commit

Permalink
Make use of existing codegen methods for font-*
Browse files Browse the repository at this point in the history
  • Loading branch information
wafflespeanut committed Oct 26, 2016
1 parent af8899e commit 1c34162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
18 changes: 1 addition & 17 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -765,7 +765,7 @@ fn static_assert() {
</%self:impl_trait>

<%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) {
Expand Down Expand Up @@ -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)"></%call>

// 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.
Expand All @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions components/style/properties/longhand/font.mako.rs
Expand Up @@ -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)}
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1c34162

Please sign in to comment.