Integrate font-variation-settings descriptor with stylo

This commit is contained in:
Xidorn Quan 2018-02-14 10:37:13 +11:00
parent 4c3f1756da
commit 6ffa888dd6
6 changed files with 82 additions and 18 deletions

View file

@ -205,6 +205,11 @@ impl nsCSSValue {
self.set_int_internal(value.into(), nsCSSUnit::eCSSUnit_Enumerated);
}
/// Set to a number value
pub fn set_number(&mut self, number: f32) {
unsafe { bindings::Gecko_CSSValue_SetFloat(self, number, nsCSSUnit::eCSSUnit_Number) }
}
/// Set to a url value
pub fn set_url(&mut self, url: &SpecifiedUrl) {
unsafe { bindings::Gecko_CSSValue_SetURL(self, url.for_ffi()) }
@ -408,3 +413,11 @@ pub trait ToNsCssValue {
/// Convert
fn convert(self, nscssvalue: &mut nsCSSValue);
}
impl<T: ToNsCssValue> From<T> for nsCSSValue {
fn from(value: T) -> nsCSSValue {
let mut result = nsCSSValue::null();
value.convert(&mut result);
result
}
}