:has() can affect elements outside the subtree so we can't use this optimization if present.
Created attachment 459543 [details] Patch
Created attachment 459544 [details] Patch
Committed r294423 (250706@main): <https://commits.webkit.org/250706@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 459544 [details].
<rdar://problem/93519537>