https://webkit-search.igalia.com/webkit/rev/d9fb961816b603d071c05f5fbc2754c061adabaa/Source/WebCore/style/StyleSharingResolver.cpp#300-301 ``` if (element.matchesInvalidPseudoClass() != element.matchesValidPseudoClass()) return false; ``` This essentially is `if (true) return false` in most cases. This typo was introduced in bug 153768, before that it was: ``` if (element->matchesInvalidPseudoClass() != state.element()->matchesValidPseudoClass()) return false; ``` That version was introduced in bug 138769, which I also doubt is correct, since it says if both elements are invalid, then do not share. I think the version that we want is: ``` if (candidateElement.matchesInvalidPseudoClass() != element.matchesInvalidPseudoClass()) return false; ``` which is sort of redundant with `if (candidateElement.matchesValidPseudoClass() != element.matchesValidPseudoClass())` above, so maybe this should just be an ASSERT checking that valid is the exact opposite of invalid.
Created attachment 453372 [details] Patch
Comment on attachment 453372 [details] Patch test would be nice
Comment on attachment 453372 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453372&action=review > Source/WebCore/ChangeLog:9 > + The typo was introduced in bug 153768 and bug 138769. This essentially disables > + style sharing completely for many elements which isn't great. I think it only really affected form controls.
Another option would be to disable it more robustly as it is probably not a super valuable optimization. I'd like to eliminate style sharing completely at some point as it doesn't work well with things like :has() and container queries.
Created attachment 453386 [details] Patch
Created attachment 453412 [details] Patch
Created attachment 453416 [details] Patch
Comment on attachment 453416 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453416&action=review > Source/WebCore/ChangeLog:3 > + Explicitely disable style sharing for form controls Spelling error here "Explicitly". > Source/WebCore/ChangeLog:6 > + Reviewed by Antti Koivisto. If this is already reviewed, then I guess I won’t. Antti does seem like the best reviewer for a style sharing change.
Created attachment 453438 [details] Patch
Created attachment 453441 [details] [fast-cq] Patch
Committed r290640 (247913@main): <https://commits.webkit.org/247913@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453441 [details].
<rdar://problem/89611152>