diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index f8d0f4ec72e..3a53f639afe 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -260,12 +260,8 @@ pub struct SpecifiedImageUrl(pub SpecifiedUrl); impl SpecifiedImageUrl { /// Parse a URL from a string value that is a valid CSS token for a URL. - pub fn parse_from_string(url: String, context: &ParserContext) -> Self { - SpecifiedImageUrl(SpecifiedUrl::parse_from_string( - url, - context, - CorsMode::None, - )) + pub fn parse_from_string(url: String, context: &ParserContext, cors_mode: CorsMode) -> Self { + SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context, cors_mode)) } /// Provides an alternate method for parsing that associates the URL diff --git a/components/style/servo/url.rs b/components/style/servo/url.rs index fd7726289be..8e011796e79 100644 --- a/components/style/servo/url.rs +++ b/components/style/servo/url.rs @@ -5,14 +5,12 @@ //! Common handling for the specified value CSS url() values. use crate::parser::{Parse, ParserContext}; +use crate::stylesheets::CorsMode; +use crate::values::computed::{Context, ToComputedValue}; use cssparser::Parser; +use servo_arc::Arc; use servo_url::ServoUrl; use std::fmt::{self, Write}; -// Note: We use std::sync::Arc rather than servo_arc::Arc here because the -// nonzero optimization is important in keeping the size of SpecifiedUrl below -// the threshold. -use crate::values::computed::{Context, ToComputedValue}; -use servo_arc::Arc; use style_traits::{CssWriter, ParseError, ToCss}; /// A CSS url() value for servo. @@ -44,7 +42,9 @@ pub struct CssUrl { impl CssUrl { /// Try to parse a URL from a string value that is a valid CSS token for a /// URL. - pub fn parse_from_string(url: String, context: &ParserContext) -> Self { + /// + /// FIXME(emilio): Should honor CorsMode. + pub fn parse_from_string(url: String, context: &ParserContext, _: CorsMode) -> Self { let serialization = Arc::new(url); let resolved = context.url_data.join(&serialization).ok(); CssUrl { @@ -121,7 +121,11 @@ impl Parse for CssUrl { input: &mut Parser<'i, 't>, ) -> Result> { let url = input.expect_url()?; - Ok(Self::parse_from_string(url.as_ref().to_owned(), context)) + Ok(Self::parse_from_string( + url.as_ref().to_owned(), + context, + CorsMode::None, + )) } } diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs index a29d97a9814..d46370952d3 100644 --- a/components/style/shared_lock.rs +++ b/components/style/shared_lock.rs @@ -71,6 +71,14 @@ impl SharedRwLock { } } + /// Create a new global shared lock (servo). + #[cfg(feature = "servo")] + pub fn new_leaked() -> Self { + SharedRwLock { + arc: Arc::new_leaked(RwLock::new(())), + } + } + /// Create a new global shared lock (gecko). #[cfg(feature = "gecko")] pub fn new_leaked() -> Self { diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index ad2ecb18086..ca7f687bfea 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -11,6 +11,7 @@ use crate::custom_properties::SpecifiedValue; #[cfg(feature = "gecko")] use crate::gecko_bindings::structs; use crate::parser::{Parse, ParserContext}; +use crate::stylesheets::CorsMode; #[cfg(feature = "gecko")] use crate::values::computed::{Context, Position as ComputedPosition, ToComputedValue}; use crate::values::generics::image::PaintWorklet; @@ -1032,7 +1033,11 @@ impl Parse for MozImageRect { input.try(|i| i.expect_function_matching("-moz-image-rect"))?; input.parse_nested_block(|i| { let string = i.expect_url_or_string()?; - let url = SpecifiedImageUrl::parse_from_string(string.as_ref().to_owned(), context); + let url = SpecifiedImageUrl::parse_from_string( + string.as_ref().to_owned(), + context, + CorsMode::None, + ); i.expect_comma()?; let top = NumberOrPercentage::parse_non_negative(context, i)?; i.expect_comma()?;