Bug 678060: Fix build with clang and c++0x. Need explicit cast from enums to ThemeMenuState in init list, since ThemeMenuState is typedefed to an int type. r=josh
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Thu, 11 Aug 2011 15:23:01 -0700
changeset 74284 059713859dcc43dffa1e4f107de6d8830c971aaa
parent 74283 252957ac3ace28d6e0fbffdc4c87d78c2609d7bc
child 74285 53dd7a930bae8c6366c22dfc6c8716a399172e5c
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjosh
bugs678060
milestone8.0a1
Bug 678060: Fix build with clang and c++0x. Need explicit cast from enums to ThemeMenuState in init list, since ThemeMenuState is typedefed to an int type. r=josh
widget/src/cocoa/nsNativeThemeCocoa.mm
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -1792,18 +1792,19 @@ nsNativeThemeCocoa::DrawWidgetBackground
       HIThemeSetFill(kThemeBrushDialogBackgroundActive, NULL, cgContext, HITHEME_ORIENTATION);
       CGContextFillRect(cgContext, macRect);
     }
       break;
 
     case NS_THEME_MENUPOPUP: {
       HIThemeMenuDrawInfo mdi = {
         version: 0,
-        menuType: IsDisabled(aFrame, eventState) ? kThemeMenuTypeInactive
-                                                 : kThemeMenuTypePopUp
+        menuType: IsDisabled(aFrame, eventState) ?
+            static_cast<ThemeMenuType>(kThemeMenuTypeInactive) :
+            static_cast<ThemeMenuType>(kThemeMenuTypePopUp)
       };
 
       PRBool isLeftOfParent = PR_FALSE;
       if (IsSubmenu(aFrame, &isLeftOfParent) && !isLeftOfParent) {
         mdi.menuType = kThemeMenuTypeHierarchical;
       }
       
       // The rounded corners draw outside the frame.
@@ -1816,19 +1817,20 @@ nsNativeThemeCocoa::DrawWidgetBackground
     case NS_THEME_MENUITEM: {
       // Clear the background to get correct transparency.
       CGContextClearRect(cgContext, macRect);
 
       // maybe use kThemeMenuItemHierBackground or PopUpBackground instead of just Plain?
       HIThemeMenuItemDrawInfo drawInfo = {
         version: 0,
         itemType: kThemeMenuItemPlain,
-        state: (IsDisabled(aFrame, eventState) ? kThemeMenuDisabled :
-                 CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? kThemeMenuSelected :
-                 kThemeMenuActive)
+        state: (IsDisabled(aFrame, eventState) ? static_cast<ThemeMenuState>(kThemeMenuDisabled) :
+                 CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ?
+                    static_cast<ThemeMenuState>(kThemeMenuSelected) :
+                    static_cast<ThemeMenuState>(kThemeMenuActive))
       };
 
       // XXX pass in the menu rect instead of always using the item rect
       HIRect ignored;
       HIThemeDrawMenuItem(&macRect, &macRect, &drawInfo, cgContext, HITHEME_ORIENTATION, &ignored);
     }
       break;