Bug 1297306 - part5:create enum constructors for EnumTable. r=baku

Enable nsAttrValue::EnumTable to be initialized with enum. So, we could get rid
of the castings in EnumTable. Fix EnumTable initialization comment.

For those untyped enumerations, declare them with uint8_t, as to other typed
enumerations with type size larger than int16_t, force casting to int16_t.

Use {nullptr,0} instead of {0} to represent the last entry.

MozReview-Commit-ID: 7Dma3Apkmxj
This commit is contained in:
Jeremy Chen
2016-09-07 10:20:17 +08:00
parent 43a4f4efc9
commit c22b72adf2
26 changed files with 76 additions and 54 deletions

View File

@@ -24,8 +24,8 @@ namespace dom {
#define NS_MENUITEM_TYPE(bits) ((bits) & ~( \
NS_CHECKED_IS_TOGGLED | NS_ORIGINAL_CHECKED_VALUE))
enum CmdType
{
enum CmdType : uint8_t
{
CMD_TYPE_MENUITEM = 1,
CMD_TYPE_CHECKBOX,
CMD_TYPE_RADIO
@@ -35,7 +35,7 @@ static const nsAttrValue::EnumTable kMenuItemTypeTable[] = {
{ "menuitem", CMD_TYPE_MENUITEM },
{ "checkbox", CMD_TYPE_CHECKBOX },
{ "radio", CMD_TYPE_RADIO },
{ 0 }
{ nullptr, 0 }
};
static const nsAttrValue::EnumTable* kMenuItemDefaultType =