mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Store selectors in matching order, rather than parse order.
We add a slow in-place reverse during parsing to achieve this for now, which gets fixed up later on. MozReview-Commit-ID: 42QkOzSgV3T
This commit is contained in:
parent
fac5aeb092
commit
1d242ad760
4 changed files with 42 additions and 31 deletions
|
@ -310,7 +310,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
Selector::parse(self, input)
|
||||
})?;
|
||||
// Selectors inside `:-moz-any` may not include combinators.
|
||||
if selectors.iter().flat_map(|x| x.iter_raw()).any(|s| s.is_combinator()) {
|
||||
if selectors.iter().flat_map(|x| x.iter_raw_match_order()).any(|s| s.is_combinator()) {
|
||||
return Err(SelectorParseError::UnexpectedIdent("-moz-any".into()).into())
|
||||
}
|
||||
NonTSPseudoClass::MozAny(selectors.into_boxed_slice())
|
||||
|
|
|
@ -53,7 +53,7 @@ impl fmt::Debug for Invalidation {
|
|||
use cssparser::ToCss;
|
||||
|
||||
f.write_str("Invalidation(")?;
|
||||
for component in self.selector.iter_raw_rev_from(self.offset - 1) {
|
||||
for component in self.selector.iter_raw_parse_order_from(self.offset - 1) {
|
||||
if matches!(*component, Component::Combinator(..)) {
|
||||
break;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
|||
if matches!(next_combinator, Combinator::PseudoElement) {
|
||||
let pseudo_selector =
|
||||
invalidation.selector
|
||||
.iter_raw_rev_from(next_combinator_offset - 1)
|
||||
.iter_raw_parse_order_from(next_combinator_offset - 1)
|
||||
.next()
|
||||
.unwrap();
|
||||
let pseudo = match *pseudo_selector {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue