Skip to content

Commit

Permalink
style: Change Gecko_ImageValue_Create to take a CORS mode argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwerth authored and emilio committed Sep 15, 2018
1 parent ca335ba commit b96d44e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/style/gecko/url.rs
Expand Up @@ -9,6 +9,7 @@ use gecko_bindings::bindings;
use gecko_bindings::structs::ServoBundledURI;
use gecko_bindings::structs::mozilla::css::URLValueData;
use gecko_bindings::structs::root::{RustString, nsStyleImageRequest};
use gecko_bindings::structs::root::mozilla::CORSMode;
use gecko_bindings::structs::root::mozilla::css::{ImageValue, URLValue};
use gecko_bindings::sugar::refptr::RefPtr;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
Expand Down Expand Up @@ -186,15 +187,20 @@ impl SpecifiedImageUrl {
Self::from_css_url(CssUrl::parse_from_string(url, context))
}

fn from_css_url(url: CssUrl) -> Self {
fn from_css_url_with_cors(url: CssUrl, cors: CORSMode) -> Self {
let image_value = unsafe {
let ptr = bindings::Gecko_ImageValue_Create(url.for_ffi());
let ptr = bindings::Gecko_ImageValue_Create(url.for_ffi(), cors);
// We do not expect Gecko_ImageValue_Create returns null.
debug_assert!(!ptr.is_null());
RefPtr::from_addrefed(ptr)
};
Self { url, image_value }
}

fn from_css_url(url: CssUrl) -> Self {
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_NONE;
Self::from_css_url_with_cors(url, CORSMode_CORS_NONE)
}
}

impl Parse for SpecifiedImageUrl {
Expand Down

0 comments on commit b96d44e

Please sign in to comment.