Bug 224981

Summary: Refactor ValueRange from enum to enum class
Product: WebKit Reporter: Tyler Wilcock <twilco.o>
Component: CSSAssignee: Tyler Wilcock <twilco.o>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, macpherson, menard, philipj, sam, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Tyler Wilcock
Reported 2021-04-23 09:08:56 PDT
ValueRange looks like this: enum ValueRange { ValueRangeAll, ValueRangeNonNegative } It should be an `enum class : uint8_t`. This would make it smaller (one byte versus four) and harder to misuse.
Attachments
Patch (78.27 KB, patch)
2021-04-23 09:19 PDT, Tyler Wilcock
no flags
Tyler Wilcock
Comment 1 2021-04-23 09:19:42 PDT
Tyler Wilcock
Comment 2 2021-04-23 17:50:57 PDT
Darin, here's one follow-up from https://bugs.webkit.org/show_bug.cgi?id=224718#c24 (parsing @counter-style descriptors).
EWS
Comment 3 2021-04-24 09:02:16 PDT
Committed r276550 (236990@main): <https://commits.webkit.org/236990@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 426915 [details].
Radar WebKit Bug Importer
Comment 4 2021-04-24 09:03:14 PDT
Darin Adler
Comment 5 2021-04-24 10:11:58 PDT
Comment on attachment 426915 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426915&action=review > Source/WebCore/ChangeLog:23 > + making it smaller (one byte versus four) and harder to misuse (no > + auto-coercion to number types). Seems like a great change. For future reference, adding the underlying type of uint8_t is independent of changing from enum to enum class. Both are good ideas. I believe that for two-value enumerations, bool is an even better underlying type than uint8_t, and on the modern compilers we are compiling with both will use a single byte for storage.
Note You need to log in before you can comment on or make changes to this bug.