Bug 309822

Summary: Remove duplicate checks in CSSFontFaceSet::fontFace
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: New BugsAssignee: Brent Fulgham <bfulgham>
Status: NEW    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 120499    
Bug Blocks:    

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.
Note You need to log in before you can comment on or make changes to this bug.