style: [css-nesting] Do a first pass at parsing nested rules mixed with declarations

Plumb everything up. This factors out declaration and rule parsing so
we share the code with the regular declaration parser.

This could be made a bit nicer in the future. We need to decide what to
do for @page and @keyframe (it seems conditional rules inside ought to
work, but that's not so easy because per spec we create a nested style
rule).

But this is a first pass that passes a good chunk of the tests. There
are other fixups to cssom, and I think some of the tests we fail are
actually wrong...

Differential Revision: https://phabricator.services.mozilla.com/D178266
This commit is contained in:
Emilio Cobos Álvarez 2023-05-17 18:18:29 +00:00 committed by Martin Robinson
parent b92440ef7c
commit 7c4ec6e9cc
13 changed files with 523 additions and 286 deletions

View file

@ -121,8 +121,6 @@ pub enum StyleParseErrorKind<'i> {
DisallowedImportRule,
/// Unexpected @charset rule encountered.
UnexpectedCharsetRule,
/// Unsupported @ rule
UnsupportedAtRule(CowRcStr<'i>),
/// A placeholder for many sources of errors that require more specific variants.
UnspecifiedError,
/// An unexpected token was found within a namespace rule.