зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1737654 - Allow parsing layer statements inside nested rules. r=boris
This fixes https://wpt.live/css/css-cascade/layer-media-query.html once it syncs. Differential Revision: https://phabricator.services.mozilla.com/D129424
This commit is contained in:
Родитель
8b39ce0241
Коммит
f488c2d7b8
|
@ -319,7 +319,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
source_location: start.source_location(),
|
||||
})))
|
||||
},
|
||||
AtRulePrelude::Layer(names) => {
|
||||
AtRulePrelude::Layer(ref names) => {
|
||||
if names.is_empty() {
|
||||
return Err(());
|
||||
}
|
||||
|
@ -328,12 +328,10 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
} else {
|
||||
self.state = State::Body;
|
||||
}
|
||||
CssRule::Layer(Arc::new(self.shared_lock.wrap(LayerRule {
|
||||
kind: LayerRuleKind::Statement { names },
|
||||
source_location: start.source_location(),
|
||||
})))
|
||||
AtRuleParser::rule_without_block(&mut self.nested(), prelude, start)
|
||||
.expect("All validity checks on the nested parser should be done before changing self.state")
|
||||
},
|
||||
_ => return Err(()),
|
||||
_ => AtRuleParser::rule_without_block(&mut self.nested(), prelude, start)?,
|
||||
};
|
||||
|
||||
Ok((start.position(), rule))
|
||||
|
@ -640,6 +638,26 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b> {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn rule_without_block(
|
||||
&mut self,
|
||||
prelude: AtRulePrelude,
|
||||
start: &ParserState,
|
||||
) -> Result<Self::AtRule, ()> {
|
||||
Ok(match prelude {
|
||||
AtRulePrelude::Layer(names) => {
|
||||
if names.is_empty() {
|
||||
return Err(());
|
||||
}
|
||||
CssRule::Layer(Arc::new(self.shared_lock.wrap(LayerRule {
|
||||
kind: LayerRuleKind::Statement { names },
|
||||
source_location: start.source_location(),
|
||||
})))
|
||||
},
|
||||
_ => return Err(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
|
|
Загрузка…
Ссылка в новой задаче