mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Stop parsing @supports rules before Delimeter::Bang
This commit is contained in:
parent
b584944f17
commit
4ad3224ba8
1 changed files with 5 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)
|
//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)
|
||||||
|
|
||||||
use cssparser::{parse_important, Parser, SourceLocation, Token};
|
use cssparser::{Delimiter, parse_important, Parser, SourceLocation, Token};
|
||||||
use parser::ParserContext;
|
use parser::ParserContext;
|
||||||
use properties::{PropertyId, PropertyDeclaration, SourcePropertyDeclaration};
|
use properties::{PropertyId, PropertyDeclaration, SourcePropertyDeclaration};
|
||||||
use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||||
|
@ -263,7 +263,10 @@ impl Declaration {
|
||||||
let mut input = Parser::new(&self.val);
|
let mut input = Parser::new(&self.val);
|
||||||
let context = ParserContext::new_with_rule_type(cx, Some(CssRuleType::Style));
|
let context = ParserContext::new_with_rule_type(cx, Some(CssRuleType::Style));
|
||||||
let mut declarations = SourcePropertyDeclaration::new();
|
let mut declarations = SourcePropertyDeclaration::new();
|
||||||
let res = PropertyDeclaration::parse_into(&mut declarations, id, &context, &mut input);
|
let res = input.parse_until_before(Delimiter::Bang, |input| {
|
||||||
|
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||||
|
.map_err(|_| ())
|
||||||
|
});
|
||||||
let _ = input.try(parse_important);
|
let _ = input.try(parse_important);
|
||||||
res.is_ok() && input.is_exhausted()
|
res.is_ok() && input.is_exhausted()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue