Bug 224266

Summary: Wasted vector capacity under CSSFontFace::setUnicodeRange()
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: CSSAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, hi, macpherson, menard, mmaxfield, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch hi: review+

Description Simon Fraser (smfr) 2021-04-06 21:10:35 PDT
Wasted vector capacity under CSSFontFace::setUnicodeRange()
Comment 1 Simon Fraser (smfr) 2021-04-06 21:11:06 PDT
Created attachment 425352 [details]
Patch
Comment 2 Devin Rousso 2021-04-07 09:54:30 PDT
Comment on attachment 425352 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=425352&action=review

r=me

> Source/WebCore/css/CSSFontFace.cpp:274
>      auto& list = downcast<CSSValueList>(unicodeRange);

What about using `map` instead?
```
auto ranges = WTF::map(downcast<CSSValueList>(unicodeRange), [] (auto& rangeValue) -> UnicodeRange {
    return { range.from(), range.to() };
});
```
Comment 3 Simon Fraser (smfr) 2021-04-07 15:33:58 PDT
(In reply to Devin Rousso from comment #2)
> Comment on attachment 425352 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=425352&action=review
> 
> r=me
> 
> > Source/WebCore/css/CSSFontFace.cpp:274
> >      auto& list = downcast<CSSValueList>(unicodeRange);
> 
> What about using `map` instead?
> ```
> auto ranges = WTF::map(downcast<CSSValueList>(unicodeRange), [] (auto&
> rangeValue) -> UnicodeRange {
>     return { range.from(), range.to() };
> });
> ```

CSSValueList doesn't quite allow map() to work.
Comment 4 Simon Fraser (smfr) 2021-04-07 15:47:36 PDT
https://trac.webkit.org/changeset/275638/webkit
Comment 5 Radar WebKit Bug Importer 2021-04-07 15:48:33 PDT
<rdar://problem/76369477>