I think we can use PseudoClassChangeInvalidation here.
<rdar://problem/101325585>
Pull request: https://github.com/WebKit/WebKit/pull/5530
Committed 255748@main (dc6a098a9b7c): <https://commits.webkit.org/255748@main> Reviewed commits have been landed. Closing PR #5530 and removing active labels.