RESOLVED FIXED309822
Remove duplicate checks in CSSFontFaceSet::fontFace
https://bugs.webkit.org/show_bug.cgi?id=309822
Summary Remove duplicate checks in CSSFontFaceSet::fontFace
Brent Fulgham
Reported 2026-03-12 12:11:56 PDT
The changes in Bug 120499 brought WebKit's font selection logic in alignment with the web standard. This allows us to make two further improvements: 1. We no longer need the `isItalic` pre-filter lines that were used when considering candidate font faces. These filters were a shortcut that unconditionally excluded italic-only faces whenever the request was non-italic. But eliminatedCapabilities() already handles this correctly via the full CSS 5.2.6 matching algorithm, so this is now redundant. 2. We can make the search for "best match" font work in linear time (rather than O(n log n) time) by precomputing the width/style/weight distances for each candidate face once, then sort the resulting values instead of repeated redundant calls in each comparison.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-03-12 12:12:15 PDT
Brent Fulgham
Comment 2 2026-03-12 12:17:44 PDT
Brent Fulgham
Comment 3 2026-03-13 10:15:01 PDT
The worksets involved in font matching are too small to benefit from Idea #2, so I'll revise the patch to remove that.
EWS
Comment 4 2026-03-16 15:23:49 PDT
Committed 309352@main (1eb20f29b046): <https://commits.webkit.org/309352@main> Reviewed commits have been landed. Closing PR #60497 and removing active labels.
Brent Fulgham
Comment 5 2026-03-16 20:56:35 PDT
*** Bug 63492 has been marked as a duplicate of this bug. ***
EWS
Comment 6 2026-03-19 23:28:30 PDT
Committed 305413.536@safari-7624-branch (1b2a1094c86c): <https://commits.webkit.org/305413.536@safari-7624-branch> Reviewed commits have been landed. Closing PR #4754 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.