mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Fix @import supports() parsing position
Fixed @import supports() being parsed in the incorrect position as per spec. Also added more WPT tests for layer and supports in one @import. Differential Revision: https://phabricator.services.mozilla.com/D176193
This commit is contained in:
parent
0c246b0b7c
commit
5671b9f025
1 changed files with 15 additions and 15 deletions
|
@ -241,6 +241,21 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
||||||
let url_string = input.expect_url_or_string()?.as_ref().to_owned();
|
let url_string = input.expect_url_or_string()?.as_ref().to_owned();
|
||||||
let url = CssUrl::parse_from_string(url_string, &self.context, CorsMode::None);
|
let url = CssUrl::parse_from_string(url_string, &self.context, CorsMode::None);
|
||||||
|
|
||||||
|
let layer = if input.try_parse(|input| input.expect_ident_matching("layer")).is_ok() {
|
||||||
|
Some(ImportLayer {
|
||||||
|
name: None,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
input.try_parse(|input| {
|
||||||
|
input.expect_function_matching("layer")?;
|
||||||
|
input.parse_nested_block(|input| {
|
||||||
|
LayerName::parse(&self.context, input)
|
||||||
|
}).map(|name| ImportLayer {
|
||||||
|
name: Some(name),
|
||||||
|
})
|
||||||
|
}).ok()
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
let supports_enabled = static_prefs::pref!("layout.css.import-supports.enabled");
|
let supports_enabled = static_prefs::pref!("layout.css.import-supports.enabled");
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
|
@ -264,21 +279,6 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
||||||
}).ok()
|
}).ok()
|
||||||
};
|
};
|
||||||
|
|
||||||
let layer = if input.try_parse(|input| input.expect_ident_matching("layer")).is_ok() {
|
|
||||||
Some(ImportLayer {
|
|
||||||
name: None,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
input.try_parse(|input| {
|
|
||||||
input.expect_function_matching("layer")?;
|
|
||||||
input.parse_nested_block(|input| {
|
|
||||||
LayerName::parse(&self.context, input)
|
|
||||||
}).map(|name| ImportLayer {
|
|
||||||
name: Some(name),
|
|
||||||
})
|
|
||||||
}).ok()
|
|
||||||
};
|
|
||||||
|
|
||||||
let media = MediaList::parse(&self.context, input);
|
let media = MediaList::parse(&self.context, input);
|
||||||
let media = Arc::new(self.shared_lock.wrap(media));
|
let media = Arc::new(self.shared_lock.wrap(media));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue