diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index 192d43ef5a1..bafab1c31d9 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -5,6 +5,7 @@ //! Common handling for the specified value CSS url() values. use gecko_bindings::structs::{ServoBundledURI, URLExtraData}; +use gecko_bindings::structs::mozilla::css::URLValueData; use gecko_bindings::structs::root::mozilla::css::ImageValue; use gecko_bindings::sugar::refptr::RefPtr; use parser::ParserContext; @@ -51,6 +52,16 @@ impl SpecifiedUrl { false } + /// Convert from URLValueData to SpecifiedUrl. + pub unsafe fn from_url_value_data(url: &URLValueData) + -> Result { + Ok(SpecifiedUrl { + serialization: Arc::new(url.mString.to_string()), + extra_data: url.mExtraData.to_safe(), + image_value: None, + }) + } + /// Returns true if this URL looks like a fragment. /// See https://drafts.csswg.org/css-values/#local-urls pub fn is_fragment(&self) -> bool {