Bug 180340 - Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
Summary: Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-03 15:57 PST by Darin Adler
Modified: 2017-12-12 03:08 PST (History)
9 users (show)

See Also:


Attachments
Patch (37.10 KB, patch)
2017-12-06 20:01 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.11 KB, patch)
2017-12-08 08:58 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (2.57 MB, application/zip)
2017-12-08 10:26 PST, EWS Watchlist
no flags Details
Patch (37.25 KB, patch)
2017-12-09 14:36 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.27 KB, patch)
2017-12-11 01:23 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.29 KB, patch)
2017-12-11 01:25 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.31 KB, patch)
2017-12-11 09:12 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.41 KB, patch)
2017-12-11 09:13 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (37.41 KB, patch)
2017-12-11 19:21 PST, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2017-12-03 15:57:36 PST
Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
Comment 1 Darin Adler 2017-12-06 20:01:24 PST Comment hidden (obsolete)
Comment 2 EWS Watchlist 2017-12-06 20:03:29 PST Comment hidden (obsolete)
Comment 3 Darin Adler 2017-12-08 08:58:36 PST Comment hidden (obsolete)
Comment 4 EWS Watchlist 2017-12-08 10:26:14 PST Comment hidden (obsolete)
Comment 5 EWS Watchlist 2017-12-08 10:26:17 PST Comment hidden (obsolete)
Comment 6 Darin Adler 2017-12-09 14:33:41 PST
The mac-wk2 test failure looks like service worker and storage process problems unrelated to this patch.
Comment 7 Darin Adler 2017-12-09 14:36:30 PST
Created attachment 328917 [details]
Patch
Comment 8 Darin Adler 2017-12-09 15:43:32 PST
OK, this time tests passed on all bots. Ready for review.
Comment 9 Daniel Bates 2017-12-09 18:50:52 PST
Comment on attachment 328917 [details]
Patch

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

> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:46
> +    FontSelectionValue() { }

This is minor. I prefer using = default. Although there is not much benefit here, I prefer using = default for consistency and because the defaulted default ccnstructor is considered a trivial constructor and allows the type to be aggregate initialized.

> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:98
> +    static const FontSelectionValue result(std::numeric_limits<BackingType>::max(), RawTag::RawTag);

No love for uniform initializer syntax?
Comment 10 Darin Adler 2017-12-09 23:56:59 PST
Comment on attachment 328917 [details]
Patch

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

>> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:46
>> +    FontSelectionValue() { }
> 
> This is minor. I prefer using = default. Although there is not much benefit here, I prefer using = default for consistency and because the defaulted default ccnstructor is considered a trivial constructor and allows the type to be aggregate initialized.

I used brace here to work around a bug in some compilers; otherwise I get a warning below in the normalItalicValue function. It warns that I am defining a constant object with no initialization in a class using the default constructor. I could try to find a workaround in the normalItalicValue function instead, perhaps passing a zero will make it work better.

>> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:98
>> +    static const FontSelectionValue result(std::numeric_limits<BackingType>::max(), RawTag::RawTag);
> 
> No love for uniform initializer syntax?

I’ll try switching to that. In this case there might be a problem because RawTag takes an int and the value of expression is a short.
Comment 11 Daniel Bates 2017-12-10 00:34:14 PST
Comment on attachment 328917 [details]
Patch

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

I like this patch, including the improved naming, comments and use of “using “ to make this code more readable and hackable.

>>> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:98
>>> +    static const FontSelectionValue result(std::numeric_limits<BackingType>::max(), RawTag::RawTag);
>> 
>> No love for uniform initializer syntax?
> 
> I’ll try switching to that. In this case there might be a problem because RawTag takes an int and the value of expression is a short.

If we made RawTag a regular enum as opposed to an enum class then we could drop the enum class name qualifier :/

> Source/WebCore/platform/graphics/FontSelectionAlgorithm.h:334
> +    // FIXME: This name is no so great. Move this into the add function below

no  => not
Comment 12 Darin Adler 2017-12-11 01:23:29 PST
Created attachment 328953 [details]
Patch
Comment 13 Darin Adler 2017-12-11 01:25:21 PST
Created attachment 328954 [details]
Patch
Comment 14 Darin Adler 2017-12-11 09:12:39 PST
Created attachment 328982 [details]
Patch
Comment 15 Darin Adler 2017-12-11 09:13:14 PST
Created attachment 328983 [details]
Patch
Comment 16 Darin Adler 2017-12-11 19:21:21 PST
Created attachment 329077 [details]
Patch
Comment 17 Darin Adler 2017-12-11 19:50:14 PST
Committed r225769: <https://trac.webkit.org/changeset/225769>
Comment 18 Radar WebKit Bug Importer 2017-12-11 19:51:46 PST
<rdar://problem/35985791>
Comment 19 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-12-12 03:08:42 PST
Broke older gcc builds: https://bugs.webkit.org/show_bug.cgi?id=180692