mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #19536 - emilio:compound-selector-list, r=mbrubeck
style: Move the code to parse a list of compound selectors. I'll need this for ::slotted(). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19536) <!-- Reviewable:end -->
This commit is contained in:
commit
c6bf85eca9
2 changed files with 35 additions and 11 deletions
|
@ -11,7 +11,7 @@ use gecko_bindings::structs::RawServoSelectorList;
|
|||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use selector_parser::{Direction, SelectorParser};
|
||||
use selectors::SelectorList;
|
||||
use selectors::parser::{Selector, SelectorMethods, SelectorParseErrorKind};
|
||||
use selectors::parser::{self as selector_parser, Selector, SelectorMethods, SelectorParseErrorKind};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use std::fmt;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
|
@ -400,16 +400,12 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
NonTSPseudoClass::Dir(Box::new(direction))
|
||||
},
|
||||
"-moz-any" => {
|
||||
let selectors = parser.parse_comma_separated(|input| {
|
||||
Selector::parse(self, input)
|
||||
})?;
|
||||
// Selectors inside `:-moz-any` may not include combinators.
|
||||
if selectors.iter().flat_map(|x| x.iter_raw_match_order()).any(|s| s.is_combinator()) {
|
||||
return Err(parser.new_custom_error(
|
||||
SelectorParseErrorKind::UnexpectedIdent("-moz-any".into())
|
||||
))
|
||||
}
|
||||
NonTSPseudoClass::MozAny(selectors.into_boxed_slice())
|
||||
NonTSPseudoClass::MozAny(
|
||||
selector_parser::parse_compound_selector_list(
|
||||
self,
|
||||
parser,
|
||||
)?
|
||||
)
|
||||
}
|
||||
_ => return Err(parser.new_custom_error(
|
||||
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name.clone())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue