Fix up how :empty, :first-child and :last-child invalidation are skipped.
Previous go at optimizing in Bug 1896380 was not quite correct.
For example, given .anchor:has(:first-child)
, when .anchor
has a new child inserted, we need to be able to invalidate (Which
we did not).
Thankfully, we can reason that the previously-optimized pseudo-
classes, i.e. :empty, :first-child, :last-child, can be trivially
rejected from activating the invalidation machinery by by examining
its descendants/siblings - e.g. :has(:first-child)
is irrelevant
to elements we know aren't in the first sibling position.
Differential Revision: https://phabricator.services.mozilla.com/D229670
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1931432
gecko-commit: f8c33cfe2f915b9204a2264f66f5c9d9dd361f29
gecko-reviewers: firefox-style-system-reviewers, emilio