Make use of existing codegen methods for font-*

This commit is contained in:
Ravi Shankar 2016-10-24 13:51:39 +05:30
parent af8899edf0
commit 1c34162220
2 changed files with 8 additions and 17 deletions

View file

@ -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) {
@ -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.
@ -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;
}

View file

@ -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",