stylo: Add mako template for URLOrNone, use for marker-* properties

MozReview-Commit-ID: 4QKKzJ1DVYP
This commit is contained in:
Manish Goregaokar 2017-02-09 17:43:52 -08:00 committed by Manish Goregaokar
parent 3b0840d187
commit fa9881b829
7 changed files with 92 additions and 39 deletions

View file

@ -173,20 +173,19 @@ impl SpecifiedUrl {
/// Create a bundled URI suitable for sending to Gecko
/// to be constructed into a css::URLValue
#[cfg(feature = "gecko")]
pub fn for_ffi(&self) -> ServoBundledURI {
use std::ptr;
pub fn for_ffi(&self) -> Option<ServoBundledURI> {
let extra_data = self.extra_data();
let (ptr, len) = match self.as_slice_components() {
Ok(value) => value,
Err(_) => (ptr::null(), 0),
Err(_) => return None,
};
ServoBundledURI {
Some(ServoBundledURI {
mURLString: ptr,
mURLStringLength: len as u32,
mBaseURI: extra_data.base.get(),
mReferrer: extra_data.referrer.get(),
mPrincipal: extra_data.principal.get(),
}
})
}
}