Bug 142456 - Shrink the CSSPropertyID enum type
Summary: Shrink the CSSPropertyID enum type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-08 12:08 PDT by Zan Dobersek
Modified: 2015-03-10 02:21 PDT (History)
0 users

See Also:


Attachments
Patch (1.31 KB, patch)
2015-03-08 12:18 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (1.81 KB, patch)
2015-03-09 06:50 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (2.46 KB, patch)
2015-03-09 14:01 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

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