style: Implement parsing and serialization for nth-child(An+B of selector list) and :nth-last-child(An+B of selector list)

:nth-{,last-}child parsing is disabled by default for now by pref
layout.css.nth-child-of.enabled.

Differential Revision: https://phabricator.services.mozilla.com/D165895
This commit is contained in:
Zach Hoffman 2023-01-07 14:32:42 +00:00 committed by Martin Robinson
parent b7d64ee6a4
commit 1c8408e97e
6 changed files with 123 additions and 11 deletions

View file

@ -318,6 +318,11 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
true
}
#[inline]
fn parse_nth_child_of(&self) -> bool {
static_prefs::pref!("layout.css.nth-child-of.enabled")
}
#[inline]
fn parse_is_and_where(&self) -> bool {
true

View file

@ -1918,7 +1918,8 @@ fn component_needs_revalidation(
Component::AttributeInNoNamespace { .. } |
Component::AttributeOther(_) |
Component::Empty |
Component::Nth(..) => true,
Component::Nth(_) |
Component::NthOf(_) => true,
Component::NonTSPseudoClass(ref p) => p.needs_cache_revalidation(),
_ => false,
}