style: Represent FirstChild, FirstOfType, LastChild, LastOfType, OnlyChild, and OnlyOfType as functionless Nth variants

Like bug 1808226, this doesn't change any behavior, it just simplifies matching.

I also added a WPT JavaScript test for :only-of-type, since dedicated WPT
JavScript tests already exist for the other pseudo-classes this patch
touches.

Differential Revision: https://phabricator.services.mozilla.com/D165859
This commit is contained in:
Zach Hoffman 2023-01-03 15:30:19 +00:00 committed by Martin Robinson
parent dc225e0b2f
commit 211761ad88
5 changed files with 76 additions and 74 deletions

View file

@ -1918,13 +1918,7 @@ fn component_needs_revalidation(
Component::AttributeInNoNamespace { .. } |
Component::AttributeOther(_) |
Component::Empty |
Component::FirstChild |
Component::LastChild |
Component::OnlyChild |
Component::Nth(..) |
Component::FirstOfType |
Component::LastOfType |
Component::OnlyOfType => true,
Component::Nth(..) => true,
Component::NonTSPseudoClass(ref p) => p.needs_cache_revalidation(),
_ => false,
}