mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
Macroize conversion of @font-face values to Gecko types
This commit is contained in:
parent
61812d4d9d
commit
b43e2fb0df
4 changed files with 89 additions and 54 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue