diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index 763e1f891a1..653a25ccc60 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -186,11 +186,18 @@ impl SupportsCondition { } } + /// Parses an `@import` condition as per + /// https://drafts.csswg.org/css-cascade-5/#typedef-import-conditions + pub fn parse_for_import<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { + input.expect_function_matching("supports")?; + input.parse_nested_block(parse_condition_or_declaration) + } + /// fn parse_in_parens<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { - // Whitespace is normally taken care of in `Parser::next`, - // but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases. - while input.try_parse(Parser::expect_whitespace).is_ok() {} + // Whitespace is normally taken care of in `Parser::next`, but we want to not include it in + // `pos` for the SupportsCondition::FutureSyntax cases. + input.skip_whitespace(); let pos = input.position(); let location = input.current_source_location(); match *input.next()? {