LibWeb/CSS: Prepare pseudo-classes for multiple An+B patterns

The upcoming `:heading()` pseudo-class takes multiple comma-separated
An+Bs. Also rename this field as the `:nth-[last-]child()`
pseudo-classes are only a subset of the users.
This commit is contained in:
Sam Atkins 2025-08-12 10:28:05 +01:00
commit a59c15481f
Notes: github-actions[bot] 2025-08-13 08:49:02 +00:00
5 changed files with 15 additions and 14 deletions

View file

@ -670,8 +670,9 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
case CSS::PseudoClass::NthLastChild:
case CSS::PseudoClass::NthOfType:
case CSS::PseudoClass::NthLastOfType: {
auto const step_size = pseudo_class.nth_child_pattern.step_size;
auto const offset = pseudo_class.nth_child_pattern.offset;
auto& an_plus_b = pseudo_class.an_plus_b_patterns.first();
auto const step_size = an_plus_b.step_size;
auto const offset = an_plus_b.offset;
if (step_size == 0 && offset == 0)
return false; // "If both a and b are equal to zero, the pseudo-class represents no element in the document tree."