Split CssUrl from SpecifiedUrl for non-value URLs. r?emilio
draft
Split CssUrl from SpecifiedUrl for non-value URLs. r?emilio
MozReview-Commit-ID: AQ3SKRVoq8G
--- a/servo/components/script/stylesheet_loader.rs
+++ b/servo/components/script/stylesheet_loader.rs
@@ -29,17 +29,17 @@ use std::mem;
use std::sync::Mutex;
use std::sync::atomic::AtomicBool;
use style::media_queries::MediaList;
use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::{CssRules, ImportRule, Namespaces, Stylesheet, StylesheetContents, Origin};
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use style::stylesheets::import_rule::ImportSheet;
-use style::values::specified::url::SpecifiedUrl;
+use style::values::CssUrl;
pub trait StylesheetOwner {
/// Returns whether this element was inserted by the parser (i.e., it should
/// trigger a document-load-blocking load).
fn parser_inserted(&self) -> bool;
/// Which referrer policy should loads triggered by this owner follow, or
/// `None` for the default.
@@ -271,17 +271,17 @@ impl<'a> StylesheetLoader<'a> {
}
}
impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> {
/// Request a stylesheet after parsing a given `@import` rule, and return
/// the constructed `@import` rule.
fn request_stylesheet(
&self,
- url: SpecifiedUrl,
+ url: CssUrl,
source_location: SourceLocation,
context: &ParserContext,
lock: &SharedRwLock,
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> {
let sheet = Arc::new(Stylesheet {
contents: StylesheetContents {
rules: CssRules::new(Vec::new(), lock),
--- a/servo/components/style/gecko/url.rs
+++ b/servo/components/style/gecko/url.rs
@@ -12,57 +12,55 @@ use gecko_bindings::structs::root::{nsSt
use gecko_bindings::structs::root::mozilla::css::ImageValue;
use gecko_bindings::sugar::refptr::RefPtr;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use parser::{Parse, ParserContext};
use servo_arc::{Arc, RawOffsetArc};
use std::mem;
use style_traits::ParseError;
-/// A specified url() value for gecko. Gecko does not eagerly resolve SpecifiedUrls.
+/// A CSS url() value for gecko.
#[css(function = "url")]
#[derive(Clone, Debug, PartialEq, ToCss)]
-pub struct SpecifiedUrl {
+pub struct CssUrl {
/// The URL in unresolved string form.
///
/// Refcounted since cloning this should be cheap and data: uris can be
/// really large.
serialization: Arc<String>,
/// The URL extra data.
#[css(skip)]
pub extra_data: RefPtr<URLExtraData>,
}
-trivial_to_computed_value!(SpecifiedUrl);
-impl SpecifiedUrl {
+impl CssUrl {
/// Try to parse a URL from a string value that is a valid CSS token for a
/// URL.
///
/// Returns `Err` in the case that extra_data is incomplete.
pub fn parse_from_string<'a>(url: String,
context: &ParserContext)
-> Result<Self, ParseError<'a>> {
- Ok(SpecifiedUrl {
+ Ok(CssUrl {
serialization: Arc::new(url),
extra_data: context.url_data.clone(),
})
}
/// Returns true if the URL is definitely invalid. We don't eagerly resolve
/// URLs in gecko, so we just return false here.
/// use its |resolved| status.
pub fn is_invalid(&self) -> bool {
false
}
/// Convert from URLValueData to SpecifiedUrl.
- pub unsafe fn from_url_value_data(url: &URLValueData)
- -> Result<SpecifiedUrl, ()> {
- Ok(SpecifiedUrl {
+ unsafe fn from_url_value_data(url: &URLValueData) -> Result<Self, ()> {
+ Ok(CssUrl {
serialization: if url.mUsingRustString {
let arc_type = url.mStrings.mRustString.as_ref()
as *const _ as
*const RawOffsetArc<String>;
Arc::from_raw_offset((*arc_type).clone())
} else {
Arc::new(url.mStrings.mString.as_ref().to_string())
},
@@ -97,89 +95,123 @@ impl SpecifiedUrl {
mURLString: unsafe {
mem::transmute::<_, RawOffsetArc<RustString>>(arc_offset)
},
mExtraData: self.extra_data.get(),
}
}
}
-impl Parse for SpecifiedUrl {
+impl Parse for CssUrl {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
let url = input.expect_url()?;
Self::parse_from_string(url.as_ref().to_owned(), context)
}
}
-impl Eq for SpecifiedUrl {}
+impl Eq for CssUrl {}
-impl MallocSizeOf for SpecifiedUrl {
+impl MallocSizeOf for CssUrl {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
// XXX: measure `serialization` once bug 1397971 lands
// We ignore `extra_data`, because RefPtr is tricky, and there aren't
// many of them in practise (sharing is common).
0
}
}
+/// A specified url() value for general usage.
+#[derive(Clone, Debug, PartialEq, Eq, MallocSizeOf, ToCss)]
+pub struct SpecifiedUrl {
+ /// The specified url value.
+ pub url: CssUrl,
+}
+trivial_to_computed_value!(SpecifiedUrl);
+
+impl SpecifiedUrl {
+ fn from_css_url(url: CssUrl) -> Self {
+ SpecifiedUrl { url }
+ }
+
+ /// Convert from URLValueData to SpecifiedUrl.
+ pub unsafe fn from_url_value_data(url: &URLValueData) -> Result<Self, ()> {
+ CssUrl::from_url_value_data(url).map(Self::from_css_url)
+ }
+
+ /// Create a bundled URI suitable for sending to Gecko
+ /// to be constructed into a css::URLValue.
+ ///
+ /// XXX This is added temporially. It would be removed once we store
+ /// URLValue in SpecifiedUrl directly.
+ pub fn for_ffi(&self) -> ServoBundledURI {
+ self.url.for_ffi()
+ }
+}
+
+impl Parse for SpecifiedUrl {
+ fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
+ CssUrl::parse(context, input).map(Self::from_css_url)
+ }
+}
+
/// A specified url() value for image.
///
/// This exists so that we can construct `ImageValue` and reuse it.
#[derive(Clone, Debug, ToCss)]
pub struct SpecifiedImageUrl {
/// The specified url value.
- pub url: SpecifiedUrl,
+ pub url: CssUrl,
/// Gecko's ImageValue so that we can reuse it while rematching a
/// property with this specified value.
#[css(skip)]
pub image_value: RefPtr<ImageValue>,
}
trivial_to_computed_value!(SpecifiedImageUrl);
impl SpecifiedImageUrl {
- fn from_specified_url(url: SpecifiedUrl) -> Self {
+ fn from_css_url(url: CssUrl) -> Self {
let image_value = unsafe {
let ptr = bindings::Gecko_ImageValue_Create(url.for_ffi());
// We do not expect Gecko_ImageValue_Create returns null.
debug_assert!(!ptr.is_null());
RefPtr::from_addrefed(ptr)
};
SpecifiedImageUrl { url, image_value }
}
/// Parse a URL from a string value. See SpecifiedUrl::parse_from_string.
pub fn parse_from_string<'a>(
url: String,
context: &ParserContext
) -> Result<Self, ParseError<'a>> {
- SpecifiedUrl::parse_from_string(url, context).map(Self::from_specified_url)
+ CssUrl::parse_from_string(url, context).map(Self::from_css_url)
}
/// Convert from URLValueData to SpecifiedUrl.
pub unsafe fn from_url_value_data(url: &URLValueData) -> Result<Self, ()> {
- SpecifiedUrl::from_url_value_data(url).map(Self::from_specified_url)
+ CssUrl::from_url_value_data(url).map(Self::from_css_url)
}
/// Convert from nsStyleImageRequest to SpecifiedUrl.
pub unsafe fn from_image_request(image_request: &nsStyleImageRequest) -> Result<Self, ()> {
if image_request.mImageValue.mRawPtr.is_null() {
return Err(());
}
let image_value = image_request.mImageValue.mRawPtr.as_ref().unwrap();
let url_value_data = &image_value._base;
Self::from_url_value_data(url_value_data)
}
}
impl Parse for SpecifiedImageUrl {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
- SpecifiedUrl::parse(context, input).map(Self::from_specified_url)
+ CssUrl::parse(context, input).map(Self::from_css_url)
}
}
impl PartialEq for SpecifiedImageUrl {
fn eq(&self, other: &Self) -> bool {
self.url.eq(&other.url)
}
}
--- a/servo/components/style/servo/url.rs
+++ b/servo/components/style/servo/url.rs
@@ -10,49 +10,49 @@ 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 std::sync::Arc;
use style_traits::{CssWriter, ParseError, ToCss};
use values::computed::{Context, ToComputedValue};
-/// A specified url() value for servo.
+/// A CSS url() value for servo.
///
/// Servo eagerly resolves SpecifiedUrls, which it can then take advantage of
/// when computing values. In contrast, Gecko uses a different URL backend, so
/// eagerly resolving with rust-url would be duplicated work.
///
/// However, this approach is still not necessarily optimal: See
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6>
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
-pub struct SpecifiedUrl {
+pub struct CssUrl {
/// The original URI. This might be optional since we may insert computed
/// values of images into the cascade directly, and we don't bother to
/// convert their serialization.
///
/// Refcounted since cloning this should be cheap and data: uris can be
/// really large.
#[ignore_malloc_size_of = "Arc"]
original: Option<Arc<String>>,
/// The resolved value for the url, if valid.
resolved: Option<ServoUrl>,
}
-impl SpecifiedUrl {
+impl CssUrl {
/// Try to parse a URL from a string value that is a valid CSS token for a
/// URL. Never fails - the API is only fallible to be compatible with the
/// gecko version.
pub fn parse_from_string<'a>(url: String,
context: &ParserContext)
-> Result<Self, ParseError<'a>> {
let serialization = Arc::new(url);
let resolved = context.url_data.join(&serialization).ok();
- Ok(SpecifiedUrl {
+ Ok(CssUrl {
original: Some(serialization),
resolved: resolved,
})
}
/// Returns true if the URL is definitely invalid. For Servo URLs, we can
/// use its |resolved| status.
pub fn is_invalid(&self) -> bool {
@@ -83,49 +83,49 @@ impl SpecifiedUrl {
Some(ref url) => url.as_str(),
None => "",
}
}
/// Creates an already specified url value from an already resolved URL
/// for insertion in the cascade.
pub fn for_cascade(url: ServoUrl) -> Self {
- SpecifiedUrl {
+ CssUrl {
original: None,
resolved: Some(url),
}
}
/// Gets a new url from a string for unit tests.
pub fn new_for_testing(url: &str) -> Self {
- SpecifiedUrl {
+ CssUrl {
original: Some(Arc::new(url.into())),
resolved: ServoUrl::parse(url).ok(),
}
}
}
-impl Parse for SpecifiedUrl {
+impl Parse for CssUrl {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
let url = input.expect_url()?;
Self::parse_from_string(url.as_ref().to_owned(), context)
}
}
-impl PartialEq for SpecifiedUrl {
+impl PartialEq for CssUrl {
fn eq(&self, other: &Self) -> bool {
// TODO(emilio): maybe we care about equality of the specified values if
// present? Seems not.
self.resolved == other.resolved
}
}
-impl Eq for SpecifiedUrl {}
+impl Eq for CssUrl {}
-impl ToCss for SpecifiedUrl {
+impl ToCss for CssUrl {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
let string = match self.original {
Some(ref original) => &**original,
None => match self.resolved {
Some(ref url) => url.as_str(),
@@ -137,16 +137,19 @@ impl ToCss for SpecifiedUrl {
};
dest.write_str("url(")?;
string.to_css(dest)?;
dest.write_str(")")
}
}
+/// A specified url() value for servo.
+pub type SpecifiedUrl = CssUrl;
+
impl ToComputedValue for SpecifiedUrl {
type ComputedValue = ComputedUrl;
// If we can't resolve the URL from the specified one, we fall back to the original
// but still return it as a ComputedUrl::Invalid
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
match self.resolved {
Some(ref url) => ComputedUrl::Valid(url.clone()),
@@ -169,17 +172,17 @@ impl ToComputedValue for SpecifiedUrl {
original: Some(url.clone()),
resolved: None,
}
}
}
}
/// A specified image url() value for servo.
-pub type SpecifiedImageUrl = SpecifiedUrl;
+pub type SpecifiedImageUrl = CssUrl;
/// The computed value of a CSS `url()`, resolved relative to the stylesheet URL.
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum ComputedUrl {
/// The `url()` was invalid or it wasn't specified by the user.
Invalid(#[ignore_malloc_size_of = "Arc"] Arc<String>),
/// The resolved `url()` relative to the stylesheet URL.
Valid(ServoUrl),
--- a/servo/components/style/stylesheets/document_rule.rs
+++ b/servo/components/style/stylesheets/document_rule.rs
@@ -12,17 +12,17 @@ use malloc_size_of::{MallocSizeOfOps, Ma
use media_queries::Device;
use parser::{Parse, ParserContext};
use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use stylesheets::CssRules;
-use values::specified::url::SpecifiedUrl;
+use values::CssUrl;
#[derive(Debug)]
/// A @-moz-document rule
pub struct DocumentRule {
/// The parsed condition
pub condition: DocumentCondition,
/// Child rules
pub rules: Arc<Locked<CssRules>>,
@@ -70,17 +70,17 @@ impl DeepCloneWithLock for DocumentRule
}
}
/// A URL matching function for a `@document` rule's condition.
#[derive(Clone, Debug, ToCss)]
pub enum UrlMatchingFunction {
/// Exact URL matching function. It evaluates to true whenever the
/// URL of the document being styled is exactly the URL given.
- Url(SpecifiedUrl),
+ Url(CssUrl),
/// URL prefix matching function. It evaluates to true whenever the
/// URL of the document being styled has the argument to the
/// function as an initial substring (which is true when the two
/// strings are equal). When the argument is the empty string,
/// it evaluates to true for all documents.
#[css(function)]
UrlPrefix(String),
/// Domain matching function. It evaluates to true whenever the URL
@@ -125,17 +125,17 @@ impl UrlMatchingFunction {
if input.try(|input| input.expect_function_matching("url-prefix")).is_ok() {
parse_quoted_or_unquoted_string!(input, UrlMatchingFunction::UrlPrefix)
} else if input.try(|input| input.expect_function_matching("domain")).is_ok() {
parse_quoted_or_unquoted_string!(input, UrlMatchingFunction::Domain)
} else if input.try(|input| input.expect_function_matching("regexp")).is_ok() {
input.parse_nested_block(|input| {
Ok(UrlMatchingFunction::Regexp(input.expect_string()?.as_ref().to_owned()))
})
- } else if let Ok(url) = input.try(|input| SpecifiedUrl::parse(context, input)) {
+ } else if let Ok(url) = input.try(|input| CssUrl::parse(context, input)) {
Ok(UrlMatchingFunction::Url(url))
} else {
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
}
#[cfg(feature = "gecko")]
/// Evaluate a URL matching function.
--- a/servo/components/style/stylesheets/import_rule.rs
+++ b/servo/components/style/stylesheets/import_rule.rs
@@ -8,17 +8,17 @@
use cssparser::SourceLocation;
use media_queries::MediaList;
use shared_lock::{DeepCloneWithLock, DeepCloneParams, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ToCss};
use stylesheets::{StylesheetContents, StylesheetInDocument};
-use values::specified::url::SpecifiedUrl;
+use values::CssUrl;
/// A sheet that is held from an import rule.
#[cfg(feature = "gecko")]
#[derive(Debug)]
pub struct ImportSheet(pub ::gecko::data::GeckoStyleSheet);
#[cfg(feature = "gecko")]
impl DeepCloneWithLock for ImportSheet {
@@ -75,17 +75,17 @@ impl DeepCloneWithLock for ImportSheet {
}
/// The [`@import`][import] at-rule.
///
/// [import]: https://drafts.csswg.org/css-cascade-3/#at-import
#[derive(Debug)]
pub struct ImportRule {
/// The `<url>` this `@import` rule is loading.
- pub url: SpecifiedUrl,
+ pub url: CssUrl,
/// The stylesheet is always present.
///
/// It contains an empty list of rules and namespace set that is updated
/// when it loads.
pub stylesheet: ImportSheet,
/// The line and column of the rule's source code.
--- a/servo/components/style/stylesheets/loader.rs
+++ b/servo/components/style/stylesheets/loader.rs
@@ -6,24 +6,24 @@
//! for `@import` rules.
use cssparser::SourceLocation;
use media_queries::MediaList;
use parser::ParserContext;
use servo_arc::Arc;
use shared_lock::{Locked, SharedRwLock};
use stylesheets::import_rule::ImportRule;
-use values::specified::url::SpecifiedUrl;
+use values::CssUrl;
/// The stylesheet loader is the abstraction used to trigger network requests
/// for `@import` rules.
pub trait StylesheetLoader {
/// Request a stylesheet after parsing a given `@import` rule, and return
/// the constructed `@import` rule.
fn request_stylesheet(
&self,
- url: SpecifiedUrl,
+ url: CssUrl,
location: SourceLocation,
context: &ParserContext,
lock: &SharedRwLock,
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>>;
}
--- a/servo/components/style/stylesheets/rule_parser.rs
+++ b/servo/components/style/stylesheets/rule_parser.rs
@@ -23,20 +23,18 @@ use stylesheets::{CssRule, CssRules, Css
use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
use stylesheets::document_rule::DocumentCondition;
use stylesheets::font_feature_values_rule::parse_family_name_list;
use stylesheets::keyframes_rule::parse_keyframe_list;
use stylesheets::stylesheet::Namespaces;
use stylesheets::supports_rule::SupportsCondition;
use stylesheets::viewport_rule;
-use values::CustomIdent;
-use values::KeyframesName;
+use values::{CssUrl, CustomIdent, KeyframesName};
use values::computed::font::FamilyName;
-use values::specified::url::SpecifiedUrl;
/// The parser for the top-level rules in a stylesheet.
pub struct TopLevelRuleParser<'a, R: 'a> {
/// The origin of the stylesheet we're parsing.
pub stylesheet_origin: Origin,
/// A reference to the lock we need to use to create rules.
pub shared_lock: &'a SharedRwLock,
/// A reference to a stylesheet loader if applicable, for `@import` rules.
@@ -129,17 +127,17 @@ pub enum AtRuleBlockPrelude {
Page(SourceLocation),
/// A @document rule, with its conditional.
Document(DocumentCondition, SourceLocation),
}
/// A rule prelude for at-rule without block.
pub enum AtRuleNonBlockPrelude {
/// A @import rule prelude.
- Import(SpecifiedUrl, Arc<Locked<MediaList>>, SourceLocation),
+ Import(CssUrl, Arc<Locked<MediaList>>, SourceLocation),
/// A @namespace rule prelude.
Namespace(Option<Prefix>, Namespace, SourceLocation),
}
#[cfg(feature = "gecko")]
fn register_namespace(ns: &Namespace) -> i32 {
use gecko_bindings::bindings;
@@ -169,23 +167,23 @@ impl<'a, 'i, R: ParseErrorReporter> AtRu
"import" => {
if self.state > State::Imports {
// "@import must be before any rule but @charset"
self.had_hierarchy_error = true;
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedImportRule))
}
let url_string = input.expect_url_or_string()?.as_ref().to_owned();
- let specified_url = SpecifiedUrl::parse_from_string(url_string, &self.context)?;
+ let url = CssUrl::parse_from_string(url_string, &self.context)?;
let media = parse_media_query_list(&self.context, input,
self.error_context.error_reporter);
let media = Arc::new(self.shared_lock.wrap(media));
- let prelude = AtRuleNonBlockPrelude::Import(specified_url, media, location);
+ let prelude = AtRuleNonBlockPrelude::Import(url, media, location);
return Ok(AtRuleType::WithoutBlock(prelude));
},
"namespace" => {
if self.state > State::Namespaces {
// "@namespace must be before any rule but @charset and @import"
self.had_hierarchy_error = true;
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedNamespaceRule))
}
@@ -223,22 +221,22 @@ impl<'a, 'i, R: ParseErrorReporter> AtRu
) -> Result<CssRule, ParseError<'i>> {
AtRuleParser::parse_block(&mut self.nested(), prelude, input)
.map(|rule| { self.state = State::Body; rule })
}
#[inline]
fn rule_without_block(&mut self, prelude: AtRuleNonBlockPrelude) -> CssRule {
match prelude {
- AtRuleNonBlockPrelude::Import(specified_url, media, location) => {
+ AtRuleNonBlockPrelude::Import(url, media, location) => {
let loader =
self.loader.expect("Expected a stylesheet loader for @import");
let import_rule = loader.request_stylesheet(
- specified_url,
+ url,
location,
&self.context,
&self.shared_lock,
media,
);
self.state = State::Imports;
CssRule::Import(import_rule)
--- a/servo/components/style/values/mod.rs
+++ b/servo/components/style/values/mod.rs
@@ -12,16 +12,21 @@ use Atom;
pub use cssparser::{RGBA, Token, Parser, serialize_identifier, CowRcStr, SourceLocation};
use parser::{Parse, ParserContext};
use selectors::parser::SelectorParseErrorKind;
use std::fmt::{self, Debug, Write};
use std::hash;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
+#[cfg(feature = "servo")]
+pub use servo::url::CssUrl;
+#[cfg(feature = "gecko")]
+pub use gecko::url::CssUrl;
+
pub mod animated;
pub mod computed;
pub mod distance;
pub mod generics;
pub mod specified;
/// A CSS float value.
pub type CSSFloat = f32;
--- a/servo/components/style/values/specified/image.rs
+++ b/servo/components/style/values/specified/image.rs
@@ -147,17 +147,17 @@ impl Parse for Image {
}
}
impl Image {
/// Creates an already specified image value from an already resolved URL
/// for insertion in the cascade.
#[cfg(feature = "servo")]
pub fn for_cascade(url: ServoUrl) -> Self {
- GenericImage::Url(SpecifiedUrl::for_cascade(url))
+ GenericImage::Url(CssUrl::for_cascade(url))
}
/// Parses a `-moz-element(# <element-id>)`.
fn parse_element<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Atom, ParseError<'i>> {
input.try(|i| i.expect_function_matching("-moz-element"))?;
let location = input.current_source_location();
input.parse_nested_block(|i| {
match *i.next()? {
--- a/servo/ports/geckolib/stylesheet_loader.rs
+++ b/servo/ports/geckolib/stylesheet_loader.rs
@@ -8,33 +8,33 @@ use style::gecko::data::GeckoStyleSheet;
use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
use style::gecko_bindings::structs::{Loader, ServoStyleSheet, SheetLoadData, LoaderReusableStyleSheets};
use style::gecko_bindings::sugar::ownership::FFIArcHelpers;
use style::media_queries::MediaList;
use style::parser::ParserContext;
use style::shared_lock::{Locked, SharedRwLock};
use style::stylesheets::{ImportRule, StylesheetLoader as StyleStylesheetLoader};
use style::stylesheets::import_rule::ImportSheet;
-use style::values::specified::url::SpecifiedUrl;
+use style::values::CssUrl;
pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);
impl StylesheetLoader {
pub fn new(loader: *mut Loader,
parent: *mut ServoStyleSheet,
parent_load_data: *mut SheetLoadData,
reusable_sheets: *mut LoaderReusableStyleSheets) -> Self {
StylesheetLoader(loader, parent, parent_load_data, reusable_sheets)
}
}
impl StyleStylesheetLoader for StylesheetLoader {
fn request_stylesheet(
&self,
- url: SpecifiedUrl,
+ url: CssUrl,
source_location: SourceLocation,
_context: &ParserContext,
lock: &SharedRwLock,
media: Arc<Locked<MediaList>>,
) -> Arc<Locked<ImportRule>> {
// After we get this raw pointer ImportRule will be moved into a lock and Arc
// and so the Arc<Url> pointer inside will also move,
// but the Url it points to or the allocating backing the String inside that Url won’t,