Closed
Bug 1289710
Opened 8 years ago
Closed 8 years ago
allow KTableEntry objects to be initialized with enum values
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla50
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: heycam, Assigned: heycam)
References
Details
Attachments
(1 file)
From bug 1277133 comment 3.
Assignee | ||
Comment 1•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/67400/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/67400/
Attachment #8775080 -
Flags: review?(xidorn+moz)
Assignee | ||
Comment 2•8 years ago
|
||
Building: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a01ecc81e67b Failing when using an inappropriately sized enum: https://treeherder.mozilla.org/#/jobs?repo=try&revision=5f3911de9e6b&selectedJob=24592340
Assignee | ||
Comment 3•8 years ago
|
||
I notice that, for example, nsCSSProps::ValueToKeywordEnum takes an int32_t, even though all valid keywords must fit within an int16_t. ValueToKeywordEnum then asserts that the value will fit. Should we do the same for the KTableEntry constructor that takes the integer type?
Comment 4•8 years ago
|
||
Comment on attachment 8775080 [details] Bug 1289710 - Allow KTableEntry objects to be initialized with enum values of appropriate size. https://reviewboard.mozilla.org/r/67400/#review64434 Looks good. Thanks. ::: layout/style/nsCSSProps.h:359 (Diff revision 1) > +struct IsEnumFittingWithin > + : std::conditional<std::is_enum<T>::value, > + detail::IsEnumFittingWithinHelper<T, Storage>, > + std::false_type>::type Given you call it "IsEnumFittingWithin", how about just static_assert that T is an enum, and get rid of the std::conditional wrap and just make this struct inherit IsIntegralFittingWithin directly?
Attachment #8775080 -
Flags: review?(xidorn+moz) → review+
Comment 5•8 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #3) > I notice that, for example, nsCSSProps::ValueToKeywordEnum takes an int32_t, > even though all valid keywords must fit within an int16_t. > ValueToKeywordEnum then asserts that the value will fit. Should we do the > same for the KTableEntry constructor that takes the integer type? I don't think that matters. It doesn't seem to me the assertion in nsCSSProps::ValueToKeywordEnum makes any sense actually.
Assignee | ||
Comment 6•8 years ago
|
||
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #4) > Given you call it "IsEnumFittingWithin", how about just static_assert that T > is an enum, and get rid of the std::conditional wrap and just make this > struct inherit IsIntegralFittingWithin directly? I can do that, although std::underlying_type seems to cause compilation failures that are no good for SFINAE when passed a non-enum type. But since I need to use std::enable_if<std::is_enum<...>> on the constructor anyway, that isn't a problem.
Assignee | ||
Comment 7•8 years ago
|
||
Comment on attachment 8775080 [details] Bug 1289710 - Allow KTableEntry objects to be initialized with enum values of appropriate size. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67400/diff/1-2/
Assignee | ||
Comment 8•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=76a64989d218
Pushed by cmccormack@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5e41e5886c0f Allow KTableEntry objects to be initialized with enum values of appropriate size. r=xidorn
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5e41e5886c0f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in
before you can comment on or make changes to this bug.
Description
•