RESOLVED FIXED 237236
Fix typo in StyleSharingResolver
https://bugs.webkit.org/show_bug.cgi?id=237236
Summary Fix typo in StyleSharingResolver
Tim Nguyen (:ntim)
Reported 2022-02-26 08:10:44 PST
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.
Attachments
Patch (1.66 KB, patch)
2022-02-28 00:46 PST, Tim Nguyen (:ntim)
koivisto: review+
Patch (1.68 KB, patch)
2022-02-28 05:37 PST, Tim Nguyen (:ntim)
ews-feeder: commit-queue-
Patch (3.96 KB, patch)
2022-02-28 11:45 PST, Tim Nguyen (:ntim)
ews-feeder: commit-queue-
Patch (4.12 KB, patch)
2022-02-28 12:53 PST, Tim Nguyen (:ntim)
ews-feeder: commit-queue-
Patch (4.30 KB, patch)
2022-02-28 15:11 PST, Tim Nguyen (:ntim)
no flags
[fast-cq] Patch (4.48 KB, patch)
2022-02-28 15:16 PST, Tim Nguyen (:ntim)
no flags
Tim Nguyen (:ntim)
Comment 1 2022-02-28 00:46:56 PST
Antti Koivisto
Comment 2 2022-02-28 04:14:16 PST
Comment on attachment 453372 [details] Patch test would be nice
Antti Koivisto
Comment 3 2022-02-28 04:16:03 PST
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.
Antti Koivisto
Comment 4 2022-02-28 04:22:16 PST
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.
Tim Nguyen (:ntim)
Comment 5 2022-02-28 05:37:33 PST
Tim Nguyen (:ntim)
Comment 6 2022-02-28 11:45:11 PST
Tim Nguyen (:ntim)
Comment 7 2022-02-28 12:53:32 PST
Darin Adler
Comment 8 2022-02-28 13:51:26 PST
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.
Tim Nguyen (:ntim)
Comment 9 2022-02-28 15:11:13 PST
Tim Nguyen (:ntim)
Comment 10 2022-02-28 15:16:53 PST
Created attachment 453441 [details] [fast-cq] Patch
EWS
Comment 11 2022-03-01 03:26:10 PST
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].
Radar WebKit Bug Importer
Comment 12 2022-03-01 03:27:18 PST
Note You need to log in before you can comment on or make changes to this bug.