Bug 142456

Summary: Shrink the CSSPropertyID enum type
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Zan Dobersek 2015-03-08 12:08:36 PDT
Shrink the CSSPropertyID enum type
Comment 1 Zan Dobersek 2015-03-08 12:18:13 PDT
Created attachment 248194 [details]
Patch
Comment 2 Sam Weinig 2015-03-08 13:40:04 PDT
Comment on attachment 248194 [details]
Patch

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

> Source/WebCore/css/makeprop.pl:279
> +enum CSSPropertyID : uint16_t {

Can you generate a static_assert (in CSSPropertyNames.cpp or somewhere similar) that asserts that the largest generated CSSPropertyID fits in 16bits?
Comment 3 Zan Dobersek 2015-03-09 06:50:53 PDT
Created attachment 248243 [details]
Patch
Comment 4 Darin Adler 2015-03-09 13:23:55 PDT
Comment on attachment 248243 [details]
Patch

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

> Source/WebCore/css/makeprop.pl:137
> +static_assert(numCSSProperties + 1 <= std::numeric_limits<uint16_t>::max(), "CSSPropertyID should fit into uint16_t.");

Windows compiler doesn’t seem to be able to handle assertions that involve the numeric_limits max function; insufficient constexpr implementation perhaps?

> Source/WebCore/css/makeprop.pl:283
> +enum CSSPropertyID : uint16_t {

Need to remove the "< 0" check in CSSPrimitiveValue.cpp to make the compiler happy. Not sure why that < 0 was there.
Comment 5 Zan Dobersek 2015-03-09 13:47:28 PDT
Comment on attachment 248243 [details]
Patch

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

>> Source/WebCore/css/makeprop.pl:137
>> +static_assert(numCSSProperties + 1 <= std::numeric_limits<uint16_t>::max(), "CSSPropertyID should fit into uint16_t.");
> 
> Windows compiler doesn’t seem to be able to handle assertions that involve the numeric_limits max function; insufficient constexpr implementation perhaps?

constexpr support in MSVC 2013 is non-existent.
Comment 6 Zan Dobersek 2015-03-09 14:01:49 PDT
Created attachment 248273 [details]
Patch
Comment 7 Zan Dobersek 2015-03-10 02:21:47 PDT
Comment on attachment 248273 [details]
Patch

Clearing flags on attachment: 248273

Committed r181320: <http://trac.webkit.org/changeset/181320>
Comment 8 Zan Dobersek 2015-03-10 02:21:56 PDT
All reviewed patches have been landed.  Closing bug.