style: Use alias for StyleAppearance.

So we could avoid generating it in rust-bindgen and drop transmute.

Differential Revision: https://phabricator.services.mozilla.com/D10304
This commit is contained in:
Boris Chiou 2018-10-31 06:20:00 +00:00 committed by Emilio Cobos Álvarez
parent b00bbb3be7
commit 591a47858b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -368,34 +368,6 @@ def set_gecko_property(ffi_name, expr):
return "self.gecko.%s = %s;" % (ffi_name, expr)
%>
<%def name="impl_cbindgen_keyword(ident, gecko_ffi_name)">
#[allow(non_snake_case)]
#[inline]
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
// unsafe: cbindgen ensures the representations match.
${set_gecko_property(gecko_ffi_name, "unsafe { transmute(v) }")}
}
#[allow(non_snake_case)]
#[inline]
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
// unsafe: cbindgen ensures the representations match.
unsafe { transmute(${get_gecko_property(gecko_ffi_name)}) }
}
#[allow(non_snake_case)]
#[inline]
pub fn copy_${ident}_from(&mut self, other: &Self) {
self.gecko.${gecko_ffi_name} = other.gecko.${gecko_ffi_name};
}
#[allow(non_snake_case)]
#[inline]
pub fn reset_${ident}(&mut self, other: &Self) {
self.copy_${ident}_from(other)
}
</%def>
<%def name="impl_keyword_setter(ident, gecko_ffi_name, keyword, cast_type='u8', on_set=None)">
#[allow(non_snake_case)]
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
@ -3091,7 +3063,7 @@ fn static_assert() {
unsafe { transmute(self.gecko.mDisplay) }
}
${impl_cbindgen_keyword('_moz_appearance', 'mAppearance')}
${impl_simple('_moz_appearance', 'mAppearance')}
<% float_keyword = Keyword("float", "Left Right None", gecko_enum_prefix="StyleFloat") %>
${impl_keyword('float', 'mFloat', float_keyword)}