Macroize conversion of @font-face values to Gecko types

This commit is contained in:
Simon Sapin 2017-04-01 09:48:40 +02:00
parent 61812d4d9d
commit b43e2fb0df
4 changed files with 89 additions and 54 deletions

View file

@ -6,7 +6,7 @@
mod ns_com_ptr;
mod ns_css_shadow_array;
mod ns_css_value;
pub mod ns_css_value;
mod ns_style_auto_array;
pub mod ns_style_coord;
mod ns_t_array;

View file

@ -163,6 +163,11 @@ impl nsCSSValue {
unsafe { bindings::Gecko_CSSValue_SetArray(self, len) }
unsafe { self.mValue.mArray.as_mut().as_mut() }.unwrap()
}
/// Generic set from any value that implements the ToNsCssValue trait.
pub fn set_from<T: ToNsCssValue>(&mut self, value: &T) {
value.convert(self)
}
}
impl Drop for nsCSSValue {
@ -210,3 +215,9 @@ impl IndexMut<usize> for nsCSSValue_Array {
&mut self.as_mut_slice()[i]
}
}
/// Generic conversion to nsCSSValue
pub trait ToNsCssValue {
/// Convert
fn convert(&self, nscssvalue: &mut nsCSSValue);
}