Bug 1554433 - Move system colors to values::specified::color. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 26 May 2019 13:10:00 +0000
changeset 475600 3415f556123b167f1bcde81e76d18037db3b2cb7
parent 475599 3939ab8e1d2454ebfafeb3ba706fcb3ab06537bc
child 475601 bc404207024e09688db6eea62137cf500ae247cc
push id36067
push userccoroiu@mozilla.com
push dateSun, 26 May 2019 21:12:53 +0000
treeherdermozilla-central@0ee76c4d554c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1554433
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1554433 - Move system colors to values::specified::color. r=xidorn This should be an idempotent patch. The way to come up with this patch has been: * Run the first script attached to the bug and pipe it to xclip, then paste it in color.rs * Add the relevant #[derive] annotations and remove the color.mako.rs definition. * Reorder the values to match the ColorID definition, on which some widget prefs and caching stuff relies on. * Manually port some documentation from nsLookAndFeel.h * Run `rg 'eColorID_' | cut -d : -f 1 | sort | uniq >files` * Run the second script attached to the bug. * Manually fix usage of `LAST_COLOR` (adding the `End` variant), and adding casts to integer as needed. * Add an static assert so that people remember to update the prefs, rather than a comment on the definition :) Differential Revision: https://phabricator.services.mozilla.com/D32610
layout/forms/nsListControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsTextFrame.cpp
layout/mathml/nsMathMLChar.cpp
layout/style/PreferenceSheet.cpp
layout/style/ServoBindings.toml
layout/tables/nsTableCellFrame.cpp
servo/components/style/properties/longhands/color.mako.rs
servo/components/style/values/specified/color.rs
servo/ports/geckolib/cbindgen.toml
toolkit/components/browser/nsWebBrowser.cpp
widget/LookAndFeel.h
widget/android/nsLookAndFeel.cpp
widget/cocoa/nsLookAndFeel.mm
widget/gtk/IMContextWrapper.cpp
widget/gtk/nsLookAndFeel.cpp
widget/gtk/nsNativeThemeGTK.cpp
widget/headless/HeadlessLookAndFeelGTK.cpp
widget/nsXPLookAndFeel.cpp
widget/nsXPLookAndFeel.h
widget/uikit/nsLookAndFeel.mm
widget/windows/nsLookAndFeel.cpp
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -225,18 +225,18 @@ void nsListControlFrame::PaintFocus(Draw
   bool lastItemIsSelected = false;
   HTMLOptionElement* domOpt = HTMLOptionElement::FromNodeOrNull(focusedContent);
   if (domOpt) {
     lastItemIsSelected = domOpt->Selected();
   }
 
   // set up back stop colors and then ask L&F service for the real colors
   nscolor color = LookAndFeel::GetColor(
-      lastItemIsSelected ? LookAndFeel::eColorID_WidgetSelectForeground
-                         : LookAndFeel::eColorID_WidgetSelectBackground);
+      lastItemIsSelected ? LookAndFeel::ColorID::WidgetSelectForeground
+                         : LookAndFeel::ColorID::WidgetSelectBackground);
 
   nsCSSRendering::PaintFocus(presContext, aDrawTarget, fRect, color);
 }
 
 void nsListControlFrame::InvalidateFocus() {
   if (mFocused != this) return;
 
   nsIFrame* containerFrame = GetOptionsContainer();
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2224,21 +2224,21 @@ Color nsDisplaySelectionOverlay::Compute
 
 Color nsDisplaySelectionOverlay::ComputeColor() const {
   LookAndFeel::ColorID colorID;
   if (RefPtr<ComputedStyle> style =
           mFrame->ComputeSelectionStyle(mSelectionValue)) {
     return ComputeColorFromSelectionStyle(*style);
   }
   if (mSelectionValue == nsISelectionController::SELECTION_ON) {
-    colorID = LookAndFeel::eColorID_TextSelectBackground;
+    colorID = LookAndFeel::ColorID::TextSelectBackground;
   } else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
-    colorID = LookAndFeel::eColorID_TextSelectBackgroundAttention;
+    colorID = LookAndFeel::ColorID::TextSelectBackgroundAttention;
   } else {
-    colorID = LookAndFeel::eColorID_TextSelectBackgroundDisabled;
+    colorID = LookAndFeel::ColorID::TextSelectBackgroundDisabled;
   }
 
   return ApplyTransparencyIfNecessary(
       LookAndFeel::GetColor(colorID, NS_RGB(255, 255, 255)));
 }
 
 void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
                                       gfxContext* aCtx) {
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1366,26 +1366,26 @@ void nsHTMLFramesetBorderFrame::BuildDis
 void nsHTMLFramesetBorderFrame::PaintBorder(DrawTarget* aDrawTarget,
                                             nsPoint aPt) {
   nscoord widthInPixels = nsPresContext::AppUnitsToIntCSSPixels(mWidth);
   nscoord pixelWidth = nsPresContext::CSSPixelsToAppUnits(1);
 
   if (widthInPixels <= 0) return;
 
   ColorPattern bgColor(ToDeviceColor(LookAndFeel::GetColor(
-      LookAndFeel::eColorID_WidgetBackground, NS_RGB(200, 200, 200))));
+      LookAndFeel::ColorID::WidgetBackground, NS_RGB(200, 200, 200))));
 
   ColorPattern fgColor(ToDeviceColor(LookAndFeel::GetColor(
-      LookAndFeel::eColorID_WidgetForeground, NS_RGB(0, 0, 0))));
+      LookAndFeel::ColorID::WidgetForeground, NS_RGB(0, 0, 0))));
 
   ColorPattern hltColor(ToDeviceColor(LookAndFeel::GetColor(
-      LookAndFeel::eColorID_Widget3DHighlight, NS_RGB(255, 255, 255))));
+      LookAndFeel::ColorID::Widget3DHighlight, NS_RGB(255, 255, 255))));
 
   ColorPattern sdwColor(ToDeviceColor(LookAndFeel::GetColor(
-      LookAndFeel::eColorID_Widget3DShadow, NS_RGB(128, 128, 128))));
+      LookAndFeel::ColorID::Widget3DShadow, NS_RGB(128, 128, 128))));
 
   ColorPattern color(ToDeviceColor(NS_RGB(255, 255, 255)));  // default to white
   if (mVisibility) {
     color =
         (NO_COLOR == mColor) ? bgColor : ColorPattern(ToDeviceColor(mColor));
   }
 
   int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -3898,19 +3898,19 @@ void nsTextPaintStyle::GetHighlightColor
       frameSelection->GetSelection(SelectionType::eFind);
   const SelectionCustomColors* customColors = nullptr;
   if (selection) {
     customColors = selection->GetCustomColors();
   }
 
   if (!customColors) {
     nscolor backColor =
-        LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
+        LookAndFeel::GetColor(LookAndFeel::ColorID::TextHighlightBackground);
     nscolor foreColor =
-        LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightForeground);
+        LookAndFeel::GetColor(LookAndFeel::ColorID::TextHighlightForeground);
     EnsureSufficientContrast(&foreColor, &backColor);
     *aForeColor = foreColor;
     *aBackColor = backColor;
 
     return;
   }
 
   if (customColors->mForegroundColor && customColors->mBackgroundColor) {
@@ -4032,36 +4032,36 @@ void nsTextPaintStyle::InitCommonColors(
   NS_ASSERTION(bgFrame, "Cannot find NonTransparentBackgroundFrame.");
   nscolor bgColor =
       bgFrame->GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
 
   nscolor defaultBgColor = mPresContext->DefaultBackgroundColor();
   mFrameBackgroundColor = NS_ComposeColors(defaultBgColor, bgColor);
 
   mSystemFieldForegroundColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID__moz_fieldtext);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::MozFieldtext);
   mSystemFieldBackgroundColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID__moz_field);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::MozField);
 
   if (bgFrame->IsThemed()) {
     // Assume a native widget has sufficient contrast always
     mSufficientContrast = 0;
     mInitCommonColors = true;
     return;
   }
 
   NS_ASSERTION(NS_GET_A(defaultBgColor) == 255,
                "default background color is not opaque");
 
   nscolor defaultWindowBackgroundColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::WindowBackground);
   nscolor selectionTextColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground);
   nscolor selectionBGColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
 
   mSufficientContrast = std::min(
       std::min(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
                NS_LUMINOSITY_DIFFERENCE(selectionTextColor, selectionBGColor)),
       NS_LUMINOSITY_DIFFERENCE(defaultWindowBackgroundColor, selectionBGColor));
 
   mInitCommonColors = true;
 }
@@ -4099,34 +4099,34 @@ bool nsTextPaintStyle::InitSelectionColo
         style->GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
     mSelectionTextColor =
         style->GetVisitedDependentColor(&nsStyleText::mWebkitTextFillColor);
     mSelectionPseudoStyle = style.forget();
     return true;
   }
 
   nscolor selectionBGColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
 
   if (selectionStatus == nsISelectionController::SELECTION_ATTENTION) {
     mSelectionBGColor = LookAndFeel::GetColor(
-        LookAndFeel::eColorID_TextSelectBackgroundAttention);
+        LookAndFeel::ColorID::TextSelectBackgroundAttention);
     mSelectionBGColor =
         EnsureDifferentColors(mSelectionBGColor, selectionBGColor);
   } else if (selectionStatus != nsISelectionController::SELECTION_ON) {
     mSelectionBGColor = LookAndFeel::GetColor(
-        LookAndFeel::eColorID_TextSelectBackgroundDisabled);
+        LookAndFeel::ColorID::TextSelectBackgroundDisabled);
     mSelectionBGColor =
         EnsureDifferentColors(mSelectionBGColor, selectionBGColor);
   } else {
     mSelectionBGColor = selectionBGColor;
   }
 
   mSelectionTextColor =
-      LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
+      LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground);
 
   if (mResolveColors) {
     // On MacOS X, only the background color gets set,
     // the text color remains intact.
     if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
       nscolor frameColor =
           nsSVGUtils::IsInSVGTextSubtree(mFrame)
               ? mFrame->GetVisitedDependentColor(&nsStyleSVG::mFill)
@@ -4137,17 +4137,17 @@ bool nsTextPaintStyle::InitSelectionColo
     } else if (mSelectionTextColor == NS_CHANGE_COLOR_IF_SAME_AS_BG) {
       nscolor frameColor =
           nsSVGUtils::IsInSVGTextSubtree(mFrame)
               ? mFrame->GetVisitedDependentColor(&nsStyleSVG::mFill)
               : mFrame->GetVisitedDependentColor(
                     &nsStyleText::mWebkitTextFillColor);
       if (frameColor == mSelectionBGColor) {
         mSelectionTextColor = LookAndFeel::GetColor(
-            LookAndFeel::eColorID_TextSelectForegroundCustom);
+            LookAndFeel::ColorID::TextSelectForegroundCustom);
       }
     } else {
       EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor);
     }
   } else {
     if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
       mSelectionTextColor = NS_SAME_AS_FOREGROUND_COLOR;
     }
@@ -4162,55 +4162,55 @@ nsTextPaintStyle::nsSelectionStyle* nsTe
 }
 
 struct StyleIDs {
   LookAndFeel::ColorID mForeground, mBackground, mLine;
   LookAndFeel::IntID mLineStyle;
   LookAndFeel::FloatID mLineRelativeSize;
 };
 static StyleIDs SelectionStyleIDs[] = {
-    {LookAndFeel::eColorID_IMERawInputForeground,
-     LookAndFeel::eColorID_IMERawInputBackground,
-     LookAndFeel::eColorID_IMERawInputUnderline,
+    {LookAndFeel::ColorID::IMERawInputForeground,
+     LookAndFeel::ColorID::IMERawInputBackground,
+     LookAndFeel::ColorID::IMERawInputUnderline,
      LookAndFeel::eIntID_IMERawInputUnderlineStyle,
      LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
-    {LookAndFeel::eColorID_IMESelectedRawTextForeground,
-     LookAndFeel::eColorID_IMESelectedRawTextBackground,
-     LookAndFeel::eColorID_IMESelectedRawTextUnderline,
+    {LookAndFeel::ColorID::IMESelectedRawTextForeground,
+     LookAndFeel::ColorID::IMESelectedRawTextBackground,
+     LookAndFeel::ColorID::IMESelectedRawTextUnderline,
      LookAndFeel::eIntID_IMESelectedRawTextUnderlineStyle,
      LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
-    {LookAndFeel::eColorID_IMEConvertedTextForeground,
-     LookAndFeel::eColorID_IMEConvertedTextBackground,
-     LookAndFeel::eColorID_IMEConvertedTextUnderline,
+    {LookAndFeel::ColorID::IMEConvertedTextForeground,
+     LookAndFeel::ColorID::IMEConvertedTextBackground,
+     LookAndFeel::ColorID::IMEConvertedTextUnderline,
      LookAndFeel::eIntID_IMEConvertedTextUnderlineStyle,
      LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
-    {LookAndFeel::eColorID_IMESelectedConvertedTextForeground,
-     LookAndFeel::eColorID_IMESelectedConvertedTextBackground,
-     LookAndFeel::eColorID_IMESelectedConvertedTextUnderline,
+    {LookAndFeel::ColorID::IMESelectedConvertedTextForeground,
+     LookAndFeel::ColorID::IMESelectedConvertedTextBackground,
+     LookAndFeel::ColorID::IMESelectedConvertedTextUnderline,
      LookAndFeel::eIntID_IMESelectedConvertedTextUnderline,
      LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
-    {LookAndFeel::eColorID_LAST_COLOR, LookAndFeel::eColorID_LAST_COLOR,
-     LookAndFeel::eColorID_SpellCheckerUnderline,
+    {LookAndFeel::ColorID::End, LookAndFeel::ColorID::End,
+     LookAndFeel::ColorID::SpellCheckerUnderline,
      LookAndFeel::eIntID_SpellCheckerUnderlineStyle,
      LookAndFeel::eFloatID_SpellCheckerUnderlineRelativeSize}};
 
 void nsTextPaintStyle::InitSelectionStyle(int32_t aIndex) {
   NS_ASSERTION(aIndex >= 0 && aIndex < 5, "aIndex is invalid");
   nsSelectionStyle* selectionStyle = &mSelectionStyle[aIndex];
   if (selectionStyle->mInit) return;
 
   StyleIDs* styleIDs = &SelectionStyleIDs[aIndex];
 
   nscolor foreColor, backColor;
-  if (styleIDs->mForeground == LookAndFeel::eColorID_LAST_COLOR) {
+  if (styleIDs->mForeground == LookAndFeel::ColorID::End) {
     foreColor = NS_SAME_AS_FOREGROUND_COLOR;
   } else {
     foreColor = LookAndFeel::GetColor(styleIDs->mForeground);
   }
-  if (styleIDs->mBackground == LookAndFeel::eColorID_LAST_COLOR) {
+  if (styleIDs->mBackground == LookAndFeel::ColorID::End) {
     backColor = NS_TRANSPARENT;
   } else {
     backColor = LookAndFeel::GetColor(styleIDs->mBackground);
   }
 
   // Convert special color to actual color
   NS_ASSERTION(foreColor != NS_TRANSPARENT,
                "foreColor cannot be NS_TRANSPARENT");
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1704,17 +1704,17 @@ class nsDisplayMathMLSelectionRect final
 void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
                                          gfxContext* aCtx) {
   DrawTarget* drawTarget = aCtx->GetDrawTarget();
   Rect rect = NSRectToSnappedRect(mRect + ToReferenceFrame(),
                                   mFrame->PresContext()->AppUnitsPerDevPixel(),
                                   *drawTarget);
   // get color to use for selection from the look&feel object
   nscolor bgColor = LookAndFeel::GetColor(
-      LookAndFeel::eColorID_TextSelectBackground, NS_RGB(0, 0, 0));
+      LookAndFeel::ColorID::TextSelectBackground, NS_RGB(0, 0, 0));
   drawTarget->FillRect(rect, ColorPattern(ToDeviceColor(bgColor)));
 }
 
 class nsDisplayMathMLCharForeground final : public nsPaintedDisplayItem {
  public:
   nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
                                 nsIFrame* aFrame, nsMathMLChar* aChar,
                                 uint16_t aIndex, bool aIsSelected)
@@ -1892,17 +1892,17 @@ void nsMathMLChar::PaintForeground(nsIFr
     computedStyle = aForFrame->Style();
   }
 
   // Set color ...
   nscolor fgColor = computedStyle->GetVisitedDependentColor(
       &nsStyleText::mWebkitTextFillColor);
   if (aIsSelected) {
     // get color to use for selection from the look&feel object
-    fgColor = LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
+    fgColor = LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground,
                                     fgColor);
   }
   aRenderingContext.SetColor(Color::FromABGR(fgColor));
   aRenderingContext.Save();
   nsRect r = mRect + aPt;
   ApplyTransforms(&aRenderingContext,
                   aForFrame->PresContext()->AppUnitsPerDevPixel(), r);
 
--- a/layout/style/PreferenceSheet.cpp
+++ b/layout/style/PreferenceSheet.cpp
@@ -57,27 +57,27 @@ void PreferenceSheet::Prefs::Load(bool a
   mFocusRingStyle = StaticPrefs::browser_display_focus_ring_style();
   mFocusRingOnAnything = StaticPrefs::browser_display_focus_ring_on_anything();
 
   const bool usePrefColors = !aIsChrome && !mUseAccessibilityTheme &&
                              !StaticPrefs::browser_display_use_system_colors();
 
   if (nsContentUtils::UseStandinsForNativeColors()) {
     mDefaultColor = LookAndFeel::GetColorUsingStandins(
-        LookAndFeel::eColorID_windowtext, mDefaultColor);
+        LookAndFeel::ColorID::Windowtext, mDefaultColor);
     mDefaultBackgroundColor = LookAndFeel::GetColorUsingStandins(
-        LookAndFeel::eColorID_window, mDefaultBackgroundColor);
+        LookAndFeel::ColorID::Window, mDefaultBackgroundColor);
   } else if (usePrefColors) {
     GetColor("browser.display.background_color", mDefaultBackgroundColor);
     GetColor("browser.display.foreground_color", mDefaultColor);
   } else {
     mDefaultColor = LookAndFeel::GetColor(
-        LookAndFeel::eColorID_WindowForeground, mDefaultColor);
+        LookAndFeel::ColorID::WindowForeground, mDefaultColor);
     mDefaultBackgroundColor = LookAndFeel::GetColor(
-        LookAndFeel::eColorID_WindowBackground, mDefaultBackgroundColor);
+        LookAndFeel::ColorID::WindowBackground, mDefaultBackgroundColor);
   }
 
   GetColor("browser.anchor_color", mLinkColor);
   GetColor("browser.active_color", mActiveLinkColor);
   GetColor("browser.visited_color", mVisitedLinkColor);
 
   GetColor("browser.display.focus_text_color", mFocusTextColor);
   GetColor("browser.display.focus_background_color", mFocusBackgroundColor);
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -471,16 +471,17 @@ cbindgen-types = [
     { gecko = "StyleTextTransform", servo = "values::computed::TextTransform" },
     { gecko = "StyleMozListReversed", servo = "values::computed::MozListReversed" },
     { gecko = "StyleOwned", servo = "gecko_bindings::sugar::ownership::Owned" },
     { gecko = "StyleOwnedOrNull", servo = "gecko_bindings::sugar::ownership::OwnedOrNull" },
     { gecko = "StyleStrong", servo = "gecko_bindings::sugar::ownership::Strong" },
     { gecko = "StyleGenericFontFamily", servo = "values::computed::font::GenericFontFamily" },
     { gecko = "StyleFontFamilyNameSyntax", servo = "values::computed::font::FontFamilyNameSyntax" },
     { gecko = "StyleGenericColor", servo = "values::generics::color::Color" },
+    { gecko = "StyleSystemColor", servo = "values::specified::color::SystemColor" },
     { gecko = "StyleGenericColorOrAuto", servo = "values::generics::color::ColorOrAuto" },
     { gecko = "StyleGenericScrollbarColor", servo = "values::generics::ui::ScrollbarColor" },
     { gecko = "StyleRGBA", servo = "cssparser::RGBA" },
     { gecko = "StyleOrigin", servo = "stylesheets::Origin" },
     { gecko = "StyleGenericGradientItem", servo = "values::generics::image::GradientItem" },
     { gecko = "StyleGenericVerticalAlign", servo = "values::generics::box_::VerticalAlign" },
     { gecko = "StyleVerticalAlignKeyword", servo = "values::generics::box_::VerticalAlignKeyword" },
     { gecko = "StyleGenericBasicShape", servo = "values::generics::basic_shape::BasicShape" },
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -276,17 +276,17 @@ void nsTableCellFrame::DecorateForSelect
         presContext->PresShell()->FrameSelection();
 
     if (frameSelection->GetTableCellSelection()) {
       nscolor bordercolor;
       if (displaySelection == nsISelectionController::SELECTION_DISABLED) {
         bordercolor = NS_RGB(176, 176, 176);  // disabled color
       } else {
         bordercolor =
-            LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
+            LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
       }
       nscoord threePx = nsPresContext::CSSPixelsToAppUnits(3);
       if ((mRect.width > threePx) && (mRect.height > threePx)) {
         // compare bordercolor to background-color
         bordercolor = EnsureDifferentColors(
             bordercolor, StyleBackground()->BackgroundColor(this));
 
         int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
--- a/servo/components/style/properties/longhands/color.mako.rs
+++ b/servo/components/style/properties/longhands/color.mako.rs
@@ -12,119 +12,8 @@
     "color",
     "ColorPropertyValue",
     "::cssparser::RGBA::new(0, 0, 0, 255)",
     animation_value_type="AnimatedRGBA",
     flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
     ignored_when_colors_disabled="True",
     spec="https://drafts.csswg.org/css-color/#color",
 )}
-
-// FIXME(#15973): Add servo support for system colors
-//
-// FIXME(emilio): Move outside of mako.
-% if product == "gecko":
-pub mod system_colors {
-    <%
-        # These are actually parsed. See nsCSSProps::kColorKTable
-        system_colors = """activeborder activecaption appworkspace background buttonface
-                           buttonhighlight buttonshadow buttontext captiontext graytext highlight
-                           highlighttext inactiveborder inactivecaption inactivecaptiontext
-                           infobackground infotext menu menutext scrollbar threeddarkshadow
-                           threedface threedhighlight threedlightshadow threedshadow window
-                           windowframe windowtext -moz-buttondefault -moz-buttonhoverface
-                           -moz-buttonhovertext -moz-cellhighlight -moz-cellhighlighttext
-                           -moz-eventreerow -moz-field -moz-fieldtext -moz-dialog -moz-dialogtext
-                           -moz-dragtargetzone -moz-gtk-info-bar-text -moz-html-cellhighlight
-                           -moz-html-cellhighlighttext -moz-mac-buttonactivetext
-                           -moz-gtk-buttonactivetext
-                           -moz-mac-chrome-active -moz-mac-chrome-inactive
-                           -moz-mac-defaultbuttontext -moz-mac-focusring -moz-mac-menuselect
-                           -moz-mac-menushadow -moz-mac-menutextdisable -moz-mac-menutextselect
-                           -moz-mac-disabledtoolbartext -moz-mac-secondaryhighlight
-                           -moz-mac-vibrancy-light -moz-mac-vibrancy-dark
-                           -moz-mac-vibrant-titlebar-light -moz-mac-vibrant-titlebar-dark
-                           -moz-mac-menupopup
-                           -moz-mac-menuitem -moz-mac-active-menuitem -moz-mac-source-list
-                           -moz-mac-source-list-selection -moz-mac-active-source-list-selection
-                           -moz-mac-tooltip
-                           -moz-menuhover -moz-menuhovertext -moz-menubartext -moz-menubarhovertext
-                           -moz-oddtreerow -moz-win-mediatext -moz-win-communicationstext
-                           -moz-win-accentcolor -moz-win-accentcolortext
-                           -moz-nativehyperlinktext -moz-comboboxtext -moz-combobox""".split()
-
-        # These are not parsed but must be serialized
-        # They are only ever set directly by Gecko
-        extra_colors = """WindowBackground WindowForeground WidgetBackground WidgetForeground
-                          WidgetSelectBackground WidgetSelectForeground Widget3DHighlight Widget3DShadow
-                          TextBackground TextForeground TextSelectBackground TextSelectForeground
-                          TextSelectForegroundCustom TextSelectBackgroundDisabled TextSelectBackgroundAttention
-                          TextHighlightBackground TextHighlightForeground IMERawInputBackground
-                          IMERawInputForeground IMERawInputUnderline IMESelectedRawTextBackground
-                          IMESelectedRawTextForeground IMESelectedRawTextUnderline
-                          IMEConvertedTextBackground IMEConvertedTextForeground IMEConvertedTextUnderline
-                          IMESelectedConvertedTextBackground IMESelectedConvertedTextForeground
-                          IMESelectedConvertedTextUnderline SpellCheckerUnderline""".split()
-    %>
-    use crate::gecko_bindings::bindings::Gecko_GetLookAndFeelSystemColor;
-    use crate::gecko_bindings::structs::root::mozilla::LookAndFeel_ColorID;
-    use std::fmt::{self, Write};
-    use style_traits::{CssWriter, ToCss};
-    use to_shmem::impl_trivial_to_shmem;
-    use crate::values::computed::{Context, ToComputedValue};
-
-    pub type SystemColor = LookAndFeel_ColorID;
-
-    // It's hard to implement MallocSizeOf for LookAndFeel_ColorID because it
-    // is a bindgen type. So we implement it on the typedef instead.
-    malloc_size_of_is_0!(SystemColor);
-
-    impl_trivial_to_shmem!(SystemColor);
-
-    impl ToCss for SystemColor {
-        fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
-        where
-            W: Write,
-        {
-            let s = match *self {
-                % for color in system_colors + extra_colors:
-                    LookAndFeel_ColorID::eColorID_${to_rust_ident(color)} => "${color}",
-                % endfor
-                LookAndFeel_ColorID::eColorID_LAST_COLOR => unreachable!(),
-            };
-            dest.write_str(s)
-        }
-    }
-
-    impl ToComputedValue for SystemColor {
-        type ComputedValue = u32; // nscolor
-
-        #[inline]
-        fn to_computed_value(&self, cx: &Context) -> Self::ComputedValue {
-            unsafe {
-                Gecko_GetLookAndFeelSystemColor(
-                    *self as i32,
-                    cx.device().document(),
-                )
-            }
-        }
-
-        #[inline]
-        fn from_computed_value(_: &Self::ComputedValue) -> Self {
-            unreachable!()
-        }
-    }
-
-    impl SystemColor {
-        pub fn from_ident<'i, 't>(ident: &str) -> Result<Self, ()> {
-            ascii_case_insensitive_phf_map! {
-                color_name -> SystemColor = {
-                    % for color in system_colors:
-                        "${color}" => LookAndFeel_ColorID::eColorID_${to_rust_ident(color)},
-                    % endfor
-                }
-            }
-
-            color_name(ident).cloned().ok_or(())
-        }
-    }
-}
-% endif
--- a/servo/components/style/values/specified/color.rs
+++ b/servo/components/style/values/specified/color.rs
@@ -3,18 +3,16 @@
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 //! Specified color values.
 
 use super::AllowQuirks;
 #[cfg(feature = "gecko")]
 use crate::gecko_bindings::structs::nscolor;
 use crate::parser::{Parse, ParserContext};
-#[cfg(feature = "gecko")]
-use crate::properties::longhands::system_colors::SystemColor;
 use crate::values::computed::{Color as ComputedColor, Context, ToComputedValue};
 use crate::values::generics::color::{Color as GenericColor, ColorOrAuto as GenericColorOrAuto};
 use crate::values::specified::calc::CalcNode;
 use cssparser::{AngleOrNumber, Color as CSSParserColor, Parser, Token, RGBA};
 use cssparser::{BasicParseErrorKind, NumberOrPercentage, ParseErrorKind};
 use itoa;
 use std::fmt::{self, Write};
 use std::io::Write as IoWrite;
@@ -30,28 +28,236 @@ pub enum Color {
     Numeric {
         /// Parsed RGBA color
         parsed: RGBA,
         /// Authored representation
         authored: Option<Box<str>>,
     },
     /// A complex color value from computed value
     Complex(ComputedColor),
-
     /// A system color
     #[cfg(feature = "gecko")]
     System(SystemColor),
     /// A special color keyword value used in Gecko
     #[cfg(feature = "gecko")]
     Special(gecko::SpecialColorKeyword),
     /// Quirksmode-only rule for inheriting color from the body
     #[cfg(feature = "gecko")]
     InheritFromBodyQuirk,
 }
 
+/// System colors.
+#[allow(missing_docs)]
+#[cfg(feature = "gecko")]
+#[derive(Copy, Clone, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
+#[repr(u8)]
+pub enum SystemColor {
+    #[css(skip)]
+    WindowBackground,
+    #[css(skip)]
+    WindowForeground,
+    #[css(skip)]
+    WidgetBackground,
+    #[css(skip)]
+    WidgetForeground,
+    #[css(skip)]
+    WidgetSelectBackground,
+    #[css(skip)]
+    WidgetSelectForeground,
+    #[css(skip)]
+    Widget3DHighlight,
+    #[css(skip)]
+    Widget3DShadow,
+    #[css(skip)]
+    TextBackground,
+    #[css(skip)]
+    TextForeground,
+    #[css(skip)]
+    TextSelectBackground,
+    #[css(skip)]
+    TextSelectForeground,
+    #[css(skip)]
+    TextSelectForegroundCustom,
+    #[css(skip)]
+    TextSelectBackgroundDisabled,
+    #[css(skip)]
+    TextSelectBackgroundAttention,
+    #[css(skip)]
+    TextHighlightBackground,
+    #[css(skip)]
+    TextHighlightForeground,
+    #[css(skip)]
+    IMERawInputBackground,
+    #[css(skip)]
+    IMERawInputForeground,
+    #[css(skip)]
+    IMERawInputUnderline,
+    #[css(skip)]
+    IMESelectedRawTextBackground,
+    #[css(skip)]
+    IMESelectedRawTextForeground,
+    #[css(skip)]
+    IMESelectedRawTextUnderline,
+    #[css(skip)]
+    IMEConvertedTextBackground,
+    #[css(skip)]
+    IMEConvertedTextForeground,
+    #[css(skip)]
+    IMEConvertedTextUnderline,
+    #[css(skip)]
+    IMESelectedConvertedTextBackground,
+    #[css(skip)]
+    IMESelectedConvertedTextForeground,
+    #[css(skip)]
+    IMESelectedConvertedTextUnderline,
+    #[css(skip)]
+    SpellCheckerUnderline,
+    Activeborder,
+    Activecaption,
+    Appworkspace,
+    Background,
+    Buttonface,
+    Buttonhighlight,
+    Buttonshadow,
+    Buttontext,
+    Captiontext,
+    Graytext,
+    Highlight,
+    Highlighttext,
+    Inactiveborder,
+    Inactivecaption,
+    Inactivecaptiontext,
+    Infobackground,
+    Infotext,
+    Menu,
+    Menutext,
+    Scrollbar,
+    Threeddarkshadow,
+    Threedface,
+    Threedhighlight,
+    Threedlightshadow,
+    Threedshadow,
+    Window,
+    Windowframe,
+    Windowtext,
+    MozButtondefault,
+    MozField,
+    MozFieldtext,
+    MozDialog,
+    MozDialogtext,
+    /// Used to highlight valid regions to drop something onto.
+    MozDragtargetzone,
+    /// Used for selected but not focused cell backgrounds.
+    MozCellhighlight,
+    /// Used for selected but not focused cell text.
+    MozCellhighlighttext,
+    /// Used for selected but not focused html cell backgrounds.
+    MozHtmlCellhighlight,
+    /// Used for selected but not focused html cell text.
+    MozHtmlCellhighlighttext,
+    /// Used to button text background when hovered.
+    MozButtonhoverface,
+    /// Used to button text color when hovered.
+    MozButtonhovertext,
+    /// Used for menu item backgrounds when hovered.
+    MozMenuhover,
+    /// Used for menu item text when hovered.
+    MozMenuhovertext,
+    /// Used for menubar item text.
+    MozMenubartext,
+    /// Used for menubar item text when hovered.
+    MozMenubarhovertext,
+
+    /// On platforms where these colors are the same as -moz-field, use
+    /// -moz-fieldtext as foreground color
+    MozEventreerow,
+    MozOddtreerow,
+
+    /// Used for button text when pressed.
+    MozGtkButtonactivetext,
+
+    /// Used for button text when pressed.
+    MozMacButtonactivetext,
+    /// Background color of chrome toolbars in active windows.
+    MozMacChromeActive,
+    /// Background color of chrome toolbars in inactive windows.
+    MozMacChromeInactive,
+    /// Foreground color of default buttons.
+    MozMacDefaultbuttontext,
+    /// Ring color around text fields and lists.
+    MozMacFocusring,
+    /// Color used when mouse is over a menu item.
+    MozMacMenuselect,
+    /// Color used to do shadows on menu items.
+    MozMacMenushadow,
+    /// Color used to display text for disabled menu items.
+    MozMacMenutextdisable,
+    /// Color used to display text while mouse is over a menu item.
+    MozMacMenutextselect,
+    /// Text color of disabled text on toolbars.
+    MozMacDisabledtoolbartext,
+    /// Inactive light hightlight
+    MozMacSecondaryhighlight,
+
+    /// Font smoothing background colors needed by the Mac OS X theme, based on
+    /// -moz-appearance names.
+    MozMacVibrancyLight,
+    MozMacVibrancyDark,
+    MozMacVibrantTitlebarLight,
+    MozMacVibrantTitlebarDark,
+    MozMacMenupopup,
+    MozMacMenuitem,
+    MozMacActiveMenuitem,
+    MozMacSourceList,
+    MozMacSourceListSelection,
+    MozMacActiveSourceListSelection,
+    MozMacTooltip,
+
+    /// Accent color for title bar.
+    MozWinAccentcolor,
+    /// Color from drawing text over the accent color.
+    MozWinAccentcolortext,
+    /// Media rebar text.
+    MozWinMediatext,
+    /// Communications rebar text.
+    MozWinCommunicationstext,
+
+    /// Hyperlink color extracted from the system, not affected by the
+    /// browser.anchor_color user pref.
+    ///
+    /// There is no OS-specified safe background color for this text, but it is
+    /// used regularly within Windows and the Gnome DE on Dialog and Window
+    /// colors.
+    MozNativehyperlinktext,
+
+    /// Combobox widgets
+    MozComboboxtext,
+    MozCombobox,
+
+    MozGtkInfoBarText,
+
+    #[css(skip)]
+    End, // Just for array-indexing purposes.
+}
+
+#[cfg(feature = "gecko")]
+impl SystemColor {
+    #[inline]
+    fn compute(&self, cx: &Context) -> ComputedColor {
+        use crate::gecko_bindings::bindings;
+        unsafe {
+            convert_nscolor_to_computedcolor(bindings::Gecko_GetLookAndFeelSystemColor(
+                *self as i32,
+                cx.device().document(),
+            ))
+        }
+    }
+}
+
+
 #[cfg(feature = "gecko")]
 mod gecko {
     #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
     pub enum SpecialColorKeyword {
         MozDefaultColor,
         MozDefaultBackgroundColor,
         MozHyperlinktext,
         MozActivehyperlinktext,
@@ -335,42 +541,39 @@ fn convert_nscolor_to_computedcolor(colo
 }
 
 impl Color {
     /// Converts this Color into a ComputedColor.
     ///
     /// If `context` is `None`, and the specified color requires data from
     /// the context to resolve, then `None` is returned.
     pub fn to_computed_color(&self, _context: Option<&Context>) -> Option<ComputedColor> {
-        match *self {
-            Color::CurrentColor => Some(ComputedColor::currentcolor()),
-            Color::Numeric { ref parsed, .. } => Some(ComputedColor::rgba(*parsed)),
-            Color::Complex(ref complex) => Some(*complex),
+        Some(match *self {
+            Color::CurrentColor => ComputedColor::currentcolor(),
+            Color::Numeric { ref parsed, .. } => ComputedColor::rgba(*parsed),
+            Color::Complex(ref complex) => *complex,
             #[cfg(feature = "gecko")]
-            Color::System(system) => _context
-                .map(|context| convert_nscolor_to_computedcolor(system.to_computed_value(context))),
+            Color::System(system) => system.compute(_context?),
             #[cfg(feature = "gecko")]
             Color::Special(special) => {
                 use self::gecko::SpecialColorKeyword as Keyword;
-                _context.map(|context| {
-                    let prefs = context.device().pref_sheet_prefs();
-                    convert_nscolor_to_computedcolor(match special {
-                        Keyword::MozDefaultColor => prefs.mDefaultColor,
-                        Keyword::MozDefaultBackgroundColor => prefs.mDefaultBackgroundColor,
-                        Keyword::MozHyperlinktext => prefs.mLinkColor,
-                        Keyword::MozActivehyperlinktext => prefs.mActiveLinkColor,
-                        Keyword::MozVisitedhyperlinktext => prefs.mVisitedLinkColor,
-                    })
+                let prefs = _context?.device().pref_sheet_prefs();
+                convert_nscolor_to_computedcolor(match special {
+                    Keyword::MozDefaultColor => prefs.mDefaultColor,
+                    Keyword::MozDefaultBackgroundColor => prefs.mDefaultBackgroundColor,
+                    Keyword::MozHyperlinktext => prefs.mLinkColor,
+                    Keyword::MozActivehyperlinktext => prefs.mActiveLinkColor,
+                    Keyword::MozVisitedhyperlinktext => prefs.mVisitedLinkColor,
                 })
             },
             #[cfg(feature = "gecko")]
             Color::InheritFromBodyQuirk => {
-                _context.map(|context| ComputedColor::rgba(context.device().body_text_color()))
+                ComputedColor::rgba(_context?.device().body_text_color())
             },
-        }
+        })
     }
 }
 
 impl ToComputedValue for Color {
     type ComputedValue = ComputedColor;
 
     fn to_computed_value(&self, context: &Context) -> ComputedColor {
         self.to_computed_color(Some(context)).unwrap()
--- a/servo/ports/geckolib/cbindgen.toml
+++ b/servo/ports/geckolib/cbindgen.toml
@@ -118,16 +118,17 @@ include = [
   "TextOverflow",
   "MozListReversed",
   "Owned",
   "OwnedOrNull",
   "Strong",
   "ScrollbarColor",
   "Color",
   "ColorOrAuto",
+  "SystemColor",
   "GradientItem",
   "VerticalAlign",
   "BasicShape",
   "ShapeRadius",
   "ArcSlice",
   "ForgottenArcSlicePtr",
   "HeaderWithLength",
   "MozContextProperties",
--- a/toolkit/components/browser/nsWebBrowser.cpp
+++ b/toolkit/components/browser/nsWebBrowser.cpp
@@ -119,17 +119,17 @@ already_AddRefed<nsWebBrowser> nsWebBrow
   RefPtr<nsDocShell> docShell = nsDocShell::Create(aBrowsingContext);
   if (NS_WARN_IF(!docShell)) {
     return nullptr;
   }
   docShell->SetOriginAttributes(aOriginAttributes);
   browser->SetDocShell(docShell);
 
   // get the system default window background colour
-  LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground,
+  LookAndFeel::GetColor(LookAndFeel::ColorID::WindowBackground,
                         &browser->mBackgroundColor);
 
   // HACK ALERT - this registration registers the nsDocShellTreeOwner as a
   // nsIWebBrowserListener so it can setup its MouseListener in one of the
   // progress callbacks. If we can register the MouseListener another way, this
   // registration can go away, and nsDocShellTreeOwner can stop implementing
   // nsIWebProgressListener.
   RefPtr<nsDocShellTreeOwner> docShellTreeOwner = browser->mDocShellTreeOwner;
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -21,196 +21,21 @@ struct LookAndFeelInt {
   union {
     int32_t value;
     nscolor colorValue;
   };
 };
 
 namespace mozilla {
 
+enum class StyleSystemColor : uint8_t;
+
 class LookAndFeel {
  public:
-  // When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
-  // in widget/xpwidgts/nsXPLookAndFeel.cpp.
-  enum ColorID : uint8_t {
-
-    // WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
-    // see patch in bug 57757 for more information
-
-    eColorID_WindowBackground,
-    eColorID_WindowForeground,
-    eColorID_WidgetBackground,
-    eColorID_WidgetForeground,
-    eColorID_WidgetSelectBackground,
-    eColorID_WidgetSelectForeground,
-    eColorID_Widget3DHighlight,
-    eColorID_Widget3DShadow,
-    eColorID_TextBackground,
-    eColorID_TextForeground,
-    eColorID_TextSelectBackground,
-    eColorID_TextSelectForeground,
-    eColorID_TextSelectForegroundCustom,
-    eColorID_TextSelectBackgroundDisabled,
-    eColorID_TextSelectBackgroundAttention,
-    eColorID_TextHighlightBackground,
-    eColorID_TextHighlightForeground,
-
-    eColorID_IMERawInputBackground,
-    eColorID_IMERawInputForeground,
-    eColorID_IMERawInputUnderline,
-    eColorID_IMESelectedRawTextBackground,
-    eColorID_IMESelectedRawTextForeground,
-    eColorID_IMESelectedRawTextUnderline,
-    eColorID_IMEConvertedTextBackground,
-    eColorID_IMEConvertedTextForeground,
-    eColorID_IMEConvertedTextUnderline,
-    eColorID_IMESelectedConvertedTextBackground,
-    eColorID_IMESelectedConvertedTextForeground,
-    eColorID_IMESelectedConvertedTextUnderline,
-
-    eColorID_SpellCheckerUnderline,
-
-    // New CSS 2 color definitions
-    eColorID_activeborder,
-    eColorID_activecaption,
-    eColorID_appworkspace,
-    eColorID_background,
-    eColorID_buttonface,
-    eColorID_buttonhighlight,
-    eColorID_buttonshadow,
-    eColorID_buttontext,
-    eColorID_captiontext,
-    eColorID_graytext,
-    eColorID_highlight,
-    eColorID_highlighttext,
-    eColorID_inactiveborder,
-    eColorID_inactivecaption,
-    eColorID_inactivecaptiontext,
-    eColorID_infobackground,
-    eColorID_infotext,
-    eColorID_menu,
-    eColorID_menutext,
-    eColorID_scrollbar,
-    eColorID_threeddarkshadow,
-    eColorID_threedface,
-    eColorID_threedhighlight,
-    eColorID_threedlightshadow,
-    eColorID_threedshadow,
-    eColorID_window,
-    eColorID_windowframe,
-    eColorID_windowtext,
-
-    eColorID__moz_buttondefault,
-    // Colors which will hopefully become CSS3
-    eColorID__moz_field,
-    eColorID__moz_fieldtext,
-    eColorID__moz_dialog,
-    eColorID__moz_dialogtext,
-    // used to highlight valid regions to drop something onto
-    eColorID__moz_dragtargetzone,
-
-    // used to cell text background, selected but not focus.
-    // It is not necessarily a system color, but it is
-    // distinct from -moz-appearance: listbox; and Highlight
-    eColorID__moz_cellhighlight,
-    // used to cell text, selected but not focus
-    eColorID__moz_cellhighlighttext,
-    // used to html select cell text background, selected but not focus
-    eColorID__moz_html_cellhighlight,
-    // used to html select cell text, selected but not focus
-    eColorID__moz_html_cellhighlighttext,
-    // used to button text background, when mouse is over
-    eColorID__moz_buttonhoverface,
-    // used to button text, when mouse is over
-    eColorID__moz_buttonhovertext,
-    // used to menu item background, when mouse is over
-    eColorID__moz_menuhover,
-    // used to menu item text, when mouse is over
-    eColorID__moz_menuhovertext,
-    // used to menu bar item text
-    eColorID__moz_menubartext,
-    // used to menu bar item text, when mouse is over
-    eColorID__moz_menubarhovertext,
-    // On platforms where these colors are the same as
-    // -moz-field, use -moz-fieldtext as foreground color
-    eColorID__moz_eventreerow,
-    eColorID__moz_oddtreerow,
-
-    // colors needed by the Linux Gtk theme
-
-    // used to button text, when button is pressed
-    eColorID__moz_gtk_buttonactivetext,
-
-    // colors needed by the Mac OS X theme
-
-    // foreground color of :hover:active buttons
-    eColorID__moz_mac_buttonactivetext,
-    // background color of chrome toolbars in active windows
-    eColorID__moz_mac_chrome_active,
-    // background color of chrome toolbars in inactive windows
-    eColorID__moz_mac_chrome_inactive,
-    // foreground color of default buttons
-    eColorID__moz_mac_defaultbuttontext,
-    // ring around text fields and lists
-    eColorID__moz_mac_focusring,
-    // colour used when mouse is over a menu item
-    eColorID__moz_mac_menuselect,
-    // colour used to do shadows on menu items
-    eColorID__moz_mac_menushadow,
-    // color used to display text for disabled menu items
-    eColorID__moz_mac_menutextdisable,
-    // colour used to display text while mouse is over a menu item
-    eColorID__moz_mac_menutextselect,
-    // text color of disabled text on toolbars
-    eColorID__moz_mac_disabledtoolbartext,
-    // inactive light hightlight
-    eColorID__moz_mac_secondaryhighlight,
-
-    // Font smoothing background colors needed by the Mac OS X theme, based
-    // on -moz-appearance names
-    eColorID__moz_mac_vibrancy_light,
-    eColorID__moz_mac_vibrancy_dark,
-    eColorID__moz_mac_vibrant_titlebar_light,
-    eColorID__moz_mac_vibrant_titlebar_dark,
-    eColorID__moz_mac_menupopup,
-    eColorID__moz_mac_menuitem,
-    eColorID__moz_mac_active_menuitem,
-    eColorID__moz_mac_source_list,
-    eColorID__moz_mac_source_list_selection,
-    eColorID__moz_mac_active_source_list_selection,
-    eColorID__moz_mac_tooltip,
-
-    // vista rebars
-
-    // accent color for title bar
-    eColorID__moz_win_accentcolor,
-    // color from drawing text over the accent color
-    eColorID__moz_win_accentcolortext,
-    // media rebar text
-    eColorID__moz_win_mediatext,
-    // communications rebar text
-    eColorID__moz_win_communicationstext,
-
-    // Hyperlink color extracted from the system, not affected by the
-    // browser.anchor_color user pref.
-    // There is no OS-specified safe background color for this text,
-    // but it is used regularly within Windows and the Gnome DE on Dialog and
-    // Window colors.
-    eColorID__moz_nativehyperlinktext,
-
-    // Combo box widgets
-    eColorID__moz_comboboxtext,
-    eColorID__moz_combobox,
-
-    // GtkInfoBar
-    eColorID__moz_gtk_info_bar_text,
-
-    // keep this one last, please
-    eColorID_LAST_COLOR
-  };
+  using ColorID = StyleSystemColor;
 
   // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
   // in widget/xpwidgts/nsXPLookAndFeel.cpp.
   enum IntID {
     // default, may be overriden by OS
     eIntID_CaretBlinkTime,
     // pixel width of caret
     eIntID_CaretWidth,
@@ -582,18 +407,18 @@ class LookAndFeel {
    * GetColor() return a native color value (might be overwritten by prefs) for
    * aID.  Some platforms don't return an error even if the index doesn't
    * match any system colors.  And also some platforms may initialize the
    * return value even when it returns an error.  Therefore, if you want to
    * use a color for the default value, you should use the other GetColor()
    * which returns nscolor directly.
    *
    * NOTE:
-   *   eColorID_TextSelectForeground might return NS_DONT_CHANGE_COLOR.
-   *   eColorID_IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
+   *   ColorID::TextSelectForeground might return NS_DONT_CHANGE_COLOR.
+   *   ColorID::IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
    *   NS_40PERCENT_FOREGROUND_COLOR.
    *   These values have particular meaning.  Then, they are not an actual
    *   color value.
    */
   static nsresult GetColor(ColorID aID, nscolor* aResult);
 
   /**
    * This variant of GetColor() takes an extra Boolean parameter that allows
@@ -708,30 +533,30 @@ class LookAndFeel {
    * Set a flag indicating whether the cache should be cleared in RefreshImpl()
    * or not.
    */
   static void SetShouldRetainCacheForTest(bool aValue);
 };
 
 }  // namespace mozilla
 
-// On the Mac, GetColor(eColorID_TextSelectForeground, color) returns this
+// On the Mac, GetColor(ColorID::TextSelectForeground, color) returns this
 // constant to specify that the foreground color should not be changed
 // (ie. a colored text keeps its colors  when selected).
 // Of course if other plaforms work like the Mac, they can use it too.
 #define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
 
 // Similar with NS_DONT_CHANGE_COLOR, except NS_DONT_CHANGE_COLOR would returns
 // complementary color if fg color is same as bg color.
 // NS_CHANGE_COLOR_IF_SAME_AS_BG would returns
-// eColorID_TextSelectForegroundCustom if fg and bg color are the same.
+// ColorID::TextSelectForegroundCustom if fg and bg color are the same.
 #define NS_CHANGE_COLOR_IF_SAME_AS_BG NS_RGB(0x02, 0x02, 0x02)
 
 // ---------------------------------------------------------------------
-//  Special colors for eColorID_IME* and eColorID_SpellCheckerUnderline
+//  Special colors for ColorID::IME* and ColorID::SpellCheckerUnderline
 // ---------------------------------------------------------------------
 
 // For background color only.
 #define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
 // For foreground color only.
 #define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
 #define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
 
--- a/widget/android/nsLookAndFeel.cpp
+++ b/widget/android/nsLookAndFeel.cpp
@@ -68,246 +68,246 @@ nsresult nsLookAndFeel::NativeGetColor(C
 
   // XXX we'll want to use context.obtainStyledAttributes on the java side to
   // get all of these; see TextView.java for a good exmaple.
 
   switch (aID) {
       // These colors don't seem to be used for anything anymore in Mozilla
       // (except here at least TextSelectBackground and TextSelectForeground)
       // The CSS2 colors below are used.
-    case eColorID_WindowBackground:
+    case ColorID::WindowBackground:
       aColor = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_WindowForeground:
+    case ColorID::WindowForeground:
       aColor = mSystemColors.textColorPrimary;
       break;
-    case eColorID_WidgetBackground:
+    case ColorID::WidgetBackground:
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_WidgetForeground:
+    case ColorID::WidgetForeground:
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID_WidgetSelectBackground:
+    case ColorID::WidgetSelectBackground:
       aColor = mSystemColors.textColorHighlight;
       break;
-    case eColorID_WidgetSelectForeground:
+    case ColorID::WidgetSelectForeground:
       aColor = mSystemColors.textColorPrimaryInverse;
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       aColor = LIGHT_GRAY_COLOR;
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       aColor = DARK_GRAY_COLOR;
       break;
-    case eColorID_TextBackground:
+    case ColorID::TextBackground:
       // not used?
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_TextForeground:
+    case ColorID::TextForeground:
       // not used?
       aColor = mSystemColors.textColorPrimary;
       break;
-    case eColorID_TextSelectBackground:
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
+    case ColorID::TextSelectBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
       // still used
       aColor = mSystemColors.textColorHighlight;
       break;
-    case eColorID_TextSelectForeground:
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
+    case ColorID::TextSelectForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
       // still used
       aColor = mSystemColors.textColorPrimaryInverse;
       break;
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aColor = RED_COLOR;
       break;
 
       // css2  http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       // active window border
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_activecaption:
+    case ColorID::Activecaption:
       // active window caption background
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_appworkspace:
+    case ColorID::Appworkspace:
       // MDI background color
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_background:
+    case ColorID::Background:
       // desktop background
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_captiontext:
+    case ColorID::Captiontext:
       // text in active window caption, size box, and scrollbar arrow box (!)
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID_graytext:
+    case ColorID::Graytext:
       // disabled text in windows, menus, etc.
       aColor = mSystemColors.textColorTertiary;
       break;
-    case eColorID_highlight:
+    case ColorID::Highlight:
       // background of selected item
       aColor = mSystemColors.textColorHighlight;
       break;
-    case eColorID_highlighttext:
+    case ColorID::Highlighttext:
       // text of selected item
       aColor = mSystemColors.textColorPrimaryInverse;
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       // inactive window border
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       // inactive window caption
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_inactivecaptiontext:
+    case ColorID::Inactivecaptiontext:
       // text in inactive window caption
       aColor = mSystemColors.textColorTertiary;
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       // tooltip background color
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_infotext:
+    case ColorID::Infotext:
       // tooltip text color
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       // menu background
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID_menutext:
+    case ColorID::Menutext:
       // menu text
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       // scrollbar gray area
       aColor = mSystemColors.colorBackground;
       break;
 
-    case eColorID_threedface:
-    case eColorID_buttonface:
+    case ColorID::Threedface:
+    case ColorID::Buttonface:
       // 3-D face color
       aColor = mSystemColors.colorBackground;
       break;
 
-    case eColorID_buttontext:
+    case ColorID::Buttontext:
       // text on push buttons
       aColor = mSystemColors.colorForeground;
       break;
 
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       // 3-D highlighted edge color
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       // 3-D highlighted outer edge color
       aColor = LIGHT_GRAY_COLOR;
       break;
 
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       // 3-D highlighted inner edge color
       aColor = mSystemColors.colorBackground;
       break;
 
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       // 3-D shadow edge color
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       // 3-D shadow inner edge color
       aColor = GRAY_COLOR;
       break;
 
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       // 3-D shadow outer edge color
       aColor = BLACK_COLOR;
       break;
 
-    case eColorID_window:
-    case eColorID_windowframe:
+    case ColorID::Window:
+    case ColorID::Windowframe:
       aColor = mSystemColors.colorBackground;
       break;
 
-    case eColorID_windowtext:
+    case ColorID::Windowtext:
       aColor = mSystemColors.textColorPrimary;
       break;
 
-    case eColorID__moz_eventreerow:
-    case eColorID__moz_field:
+    case ColorID::MozEventreerow:
+    case ColorID::MozField:
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID__moz_fieldtext:
+    case ColorID::MozFieldtext:
       aColor = mSystemColors.textColorPrimary;
       break;
-    case eColorID__moz_dialog:
+    case ColorID::MozDialog:
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID__moz_dialogtext:
+    case ColorID::MozDialogtext:
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID__moz_dragtargetzone:
+    case ColorID::MozDragtargetzone:
       aColor = mSystemColors.textColorHighlight;
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       // default button border color
       aColor = BLACK_COLOR;
       break;
-    case eColorID__moz_buttonhoverface:
+    case ColorID::MozButtonhoverface:
       aColor = BG_PRELIGHT_COLOR;
       break;
-    case eColorID__moz_buttonhovertext:
+    case ColorID::MozButtonhovertext:
       aColor = FG_PRELIGHT_COLOR;
       break;
-    case eColorID__moz_cellhighlight:
-    case eColorID__moz_html_cellhighlight:
+    case ColorID::MozCellhighlight:
+    case ColorID::MozHtmlCellhighlight:
       aColor = mSystemColors.textColorHighlight;
       break;
-    case eColorID__moz_cellhighlighttext:
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::MozCellhighlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       aColor = mSystemColors.textColorPrimaryInverse;
       break;
-    case eColorID__moz_menuhover:
+    case ColorID::MozMenuhover:
       aColor = BG_PRELIGHT_COLOR;
       break;
-    case eColorID__moz_menuhovertext:
+    case ColorID::MozMenuhovertext:
       aColor = FG_PRELIGHT_COLOR;
       break;
-    case eColorID__moz_oddtreerow:
+    case ColorID::MozOddtreerow:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozComboboxtext:
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID__moz_combobox:
+    case ColorID::MozCombobox:
       aColor = mSystemColors.colorBackground;
       break;
-    case eColorID__moz_menubartext:
+    case ColorID::MozMenubartext:
       aColor = mSystemColors.colorForeground;
       break;
-    case eColorID__moz_menubarhovertext:
+    case ColorID::MozMenubarhovertext:
       aColor = FG_PRELIGHT_COLOR;
       break;
     default:
       /* default color is BLACK */
       aColor = 0;
       rv = NS_ERROR_FAILURE;
       break;
   }
@@ -496,75 +496,75 @@ nsTArray<LookAndFeelInt> nsLookAndFeel::
   EnsureInitSystemColors();
   MOZ_ASSERT(mInitializedSystemColors);
 
   nsTArray<LookAndFeelInt> lookAndFeelCache =
       nsXPLookAndFeel::GetIntCacheImpl();
   lookAndFeelCache.SetCapacity(sizeof(AndroidSystemColors) / sizeof(nscolor));
 
   LookAndFeelInt laf;
-  laf.id = eColorID_WindowForeground;
+  laf.id = int32_t(ColorID::WindowForeground);
   laf.colorValue = mSystemColors.textColorPrimary;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_WidgetBackground;
+  laf.id = int32_t(ColorID::WidgetBackground);
   laf.colorValue = mSystemColors.colorBackground;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_WidgetForeground;
+  laf.id = int32_t(ColorID::WidgetForeground);
   laf.colorValue = mSystemColors.colorForeground;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_WidgetSelectBackground;
+  laf.id = int32_t(ColorID::WidgetSelectBackground);
   laf.colorValue = mSystemColors.textColorHighlight;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_WidgetSelectForeground;
+  laf.id = int32_t(ColorID::WidgetSelectForeground);
   laf.colorValue = mSystemColors.textColorPrimaryInverse;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_inactivecaptiontext;
+  laf.id = int32_t(ColorID::Inactivecaptiontext);
   laf.colorValue = mSystemColors.textColorTertiary;
   lookAndFeelCache.AppendElement(laf);
 
-  laf.id = eColorID_windowtext;
+  laf.id = int32_t(ColorID::Windowtext);
   laf.colorValue = mSystemColors.textColorPrimary;
   lookAndFeelCache.AppendElement(laf);
 
   // XXX The following colors are unused.
   // - textColorTertiaryInverse
   // - panelColorForeground
   // - panelColorBackground
 
   return lookAndFeelCache;
 }
 
 void nsLookAndFeel::SetIntCacheImpl(
     const nsTArray<LookAndFeelInt>& aLookAndFeelCache) {
   for (auto entry : aLookAndFeelCache) {
-    switch (entry.id) {
-      case eColorID_WindowForeground:
+    switch (ColorID(entry.id)) {
+      case ColorID::WindowForeground:
         mSystemColors.textColorPrimary = entry.colorValue;
         break;
-      case eColorID_WidgetBackground:
+      case ColorID::WidgetBackground:
         mSystemColors.colorBackground = entry.colorValue;
         break;
-      case eColorID_WidgetForeground:
+      case ColorID::WidgetForeground:
         mSystemColors.colorForeground = entry.colorValue;
         break;
-      case eColorID_WidgetSelectBackground:
+      case ColorID::WidgetSelectBackground:
         mSystemColors.textColorHighlight = entry.colorValue;
         break;
-      case eColorID_WidgetSelectForeground:
+      case ColorID::WidgetSelectForeground:
         mSystemColors.textColorPrimaryInverse = entry.colorValue;
         break;
-      case eColorID_inactivecaptiontext:
+      case ColorID::Inactivecaptiontext:
         mSystemColors.textColorTertiary = entry.colorValue;
         break;
-      case eColorID_windowtext:
+      case ColorID::Windowtext:
         mSystemColors.textColorPrimary = entry.colorValue;
         break;
       default:
         MOZ_ASSERT(false);
     }
   }
   mInitializedSystemColors = true;
 }
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -154,276 +154,276 @@ nscolor nsLookAndFeel::ProcessSelectionB
 }
 
 nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
   EnsureInit();
 
   nsresult res = NS_OK;
 
   switch (aID) {
-    case eColorID_WindowBackground:
+    case ColorID::WindowBackground:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_WindowForeground:
+    case ColorID::WindowForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_WidgetBackground:
+    case ColorID::WidgetBackground:
       aColor = NS_RGB(0xdd, 0xdd, 0xdd);
       break;
-    case eColorID_WidgetForeground:
+    case ColorID::WidgetForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_WidgetSelectBackground:
+    case ColorID::WidgetSelectBackground:
       aColor = NS_RGB(0x80, 0x80, 0x80);
       break;
-    case eColorID_WidgetSelectForeground:
+    case ColorID::WidgetSelectForeground:
       aColor = NS_RGB(0x00, 0x00, 0x80);
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       aColor = NS_RGB(0xa0, 0xa0, 0xa0);
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       aColor = NS_RGB(0x40, 0x40, 0x40);
       break;
-    case eColorID_TextBackground:
+    case ColorID::TextBackground:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_TextForeground:
+    case ColorID::TextForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_TextSelectBackground:
+    case ColorID::TextSelectBackground:
       aColor = ProcessSelectionBackground(mColorTextSelectBackground);
       break;
     // This is used to gray out the selection when it's not focused. Used with
     // nsISelectionController::SELECTION_DISABLED.
-    case eColorID_TextSelectBackgroundDisabled:
+    case ColorID::TextSelectBackgroundDisabled:
       aColor = ProcessSelectionBackground(mColorTextSelectBackgroundDisabled);
       break;
-    case eColorID_highlight:  // CSS2 color
+    case ColorID::Highlight:  // CSS2 color
       aColor = mColorHighlight;
       break;
-    case eColorID__moz_menuhover:
+    case ColorID::MozMenuhover:
       aColor = mColorMenuHover;
       break;
-    case eColorID_TextSelectForeground:
+    case ColorID::TextSelectForeground:
       aColor = mColorTextSelectForeground;
       break;
-    case eColorID_highlighttext:  // CSS2 color
-    case eColorID__moz_menuhovertext:
+    case ColorID::Highlighttext:  // CSS2 color
+    case ColorID::MozMenuhovertext:
       aColor = mColorMenuHoverText;
       break;
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aColor = NS_40PERCENT_FOREGROUND_COLOR;
       break;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aColor = NS_RGB(0xff, 0, 0);
       break;
 
       //
       // css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
       //
       // It's really hard to effectively map these to the Appearance Manager properly,
       // since they are modeled word for word after the win32 system colors and don't have any
       // real counterparts in the Mac world. I'm sure we'll be tweaking these for
       // years to come.
       //
       // Thanks to mpt26@student.canterbury.ac.nz for the hardcoded values that form the defaults
       //  if querying the Appearance Manager fails ;)
       //
-    case eColorID__moz_mac_buttonactivetext:
-    case eColorID__moz_mac_defaultbuttontext:
+    case ColorID::MozMacButtonactivetext:
+    case ColorID::MozMacDefaultbuttontext:
       if (mHasColorButtonText) {
         aColor = mColorButtonText;
         break;
       }
       // Otherwise fall through and return the regular button text:
       MOZ_FALLTHROUGH;
-    case eColorID_buttontext:
-    case eColorID__moz_buttonhovertext:
+    case ColorID::Buttontext:
+    case ColorID::MozButtonhovertext:
       aColor = mColorButtonHoverText;
       break;
-    case eColorID_captiontext:
-    case eColorID_menutext:
-    case eColorID_infotext:
-    case eColorID__moz_menubartext:
+    case ColorID::Captiontext:
+    case ColorID::Menutext:
+    case ColorID::Infotext:
+    case ColorID::MozMenubartext:
       aColor = mColorText;
       break;
-    case eColorID_windowtext:
+    case ColorID::Windowtext:
       aColor = mColorWindowText;
       break;
-    case eColorID_activecaption:
+    case ColorID::Activecaption:
       aColor = mColorActiveCaption;
       break;
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       aColor = mColorActiveBorder;
       break;
-    case eColorID_appworkspace:
+    case ColorID::Appworkspace:
       aColor = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_background:
+    case ColorID::Background:
       aColor = NS_RGB(0x63, 0x63, 0xCE);
       break;
-    case eColorID_buttonface:
-    case eColorID__moz_buttonhoverface:
+    case ColorID::Buttonface:
+    case ColorID::MozButtonhoverface:
       aColor = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       aColor = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       aColor = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID_graytext:
+    case ColorID::Graytext:
       aColor = mColorGrayText;
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       aColor = mColorInactiveBorder;
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       aColor = mColorInactiveCaption;
       break;
-    case eColorID_inactivecaptiontext:
+    case ColorID::Inactivecaptiontext:
       aColor = NS_RGB(0x45, 0x45, 0x45);
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       aColor = mColorScrollbar;
       break;
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       aColor = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       aColor = NS_RGB(0xE0, 0xE0, 0xE0);
       break;
-    case eColorID_threedface:
+    case ColorID::Threedface:
       aColor = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       aColor = mColorThreeDHighlight;
       break;
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       aColor = NS_RGB(0xDA, 0xDA, 0xDA);
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       aColor = mColorMenu;
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       aColor = NS_RGB(0xFF, 0xFF, 0xC7);
       break;
-    case eColorID_windowframe:
+    case ColorID::Windowframe:
       aColor = mColorWindowFrame;
       break;
-    case eColorID_window:
-    case eColorID__moz_field:
-    case eColorID__moz_combobox:
+    case ColorID::Window:
+    case ColorID::MozField:
+    case ColorID::MozCombobox:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID__moz_fieldtext:
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozFieldtext:
+    case ColorID::MozComboboxtext:
       aColor = mColorFieldText;
       break;
-    case eColorID__moz_dialog:
+    case ColorID::MozDialog:
       aColor = mColorDialog;
       break;
-    case eColorID__moz_dialogtext:
-    case eColorID__moz_cellhighlighttext:
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::MozDialogtext:
+    case ColorID::MozCellhighlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       aColor = mColorDialogText;
       break;
-    case eColorID__moz_dragtargetzone:
+    case ColorID::MozDragtargetzone:
       aColor = mColorDragTargetZone;
       break;
-    case eColorID__moz_mac_chrome_active:
+    case ColorID::MozMacChromeActive:
       aColor = mColorChromeActive;
       break;
-    case eColorID__moz_mac_chrome_inactive:
+    case ColorID::MozMacChromeInactive:
       aColor = mColorChromeInactive;
       break;
-    case eColorID__moz_mac_focusring:
+    case ColorID::MozMacFocusring:
       aColor = mColorFocusRing;
       break;
-    case eColorID__moz_mac_menushadow:
+    case ColorID::MozMacMenushadow:
       aColor = NS_RGB(0xA3, 0xA3, 0xA3);
       break;
-    case eColorID__moz_mac_menutextdisable:
+    case ColorID::MozMacMenutextdisable:
       aColor = NS_RGB(0x98, 0x98, 0x98);
       break;
-    case eColorID__moz_mac_menutextselect:
+    case ColorID::MozMacMenutextselect:
       aColor = mColorTextSelect;
       break;
-    case eColorID__moz_mac_disabledtoolbartext:
+    case ColorID::MozMacDisabledtoolbartext:
       aColor = mColorDisabledToolbarText;
       break;
-    case eColorID__moz_mac_menuselect:
+    case ColorID::MozMacMenuselect:
       aColor = mColorMenuSelect;
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       aColor = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID__moz_cellhighlight:
-    case eColorID__moz_html_cellhighlight:
-    case eColorID__moz_mac_secondaryhighlight:
+    case ColorID::MozCellhighlight:
+    case ColorID::MozHtmlCellhighlight:
+    case ColorID::MozMacSecondaryhighlight:
       // For inactive list selection
       aColor = mColorCellHighlight;
       break;
-    case eColorID__moz_eventreerow:
+    case ColorID::MozEventreerow:
       // Background color of even list rows.
       aColor = mColorEvenTreeRow;
       break;
-    case eColorID__moz_oddtreerow:
+    case ColorID::MozOddtreerow:
       // Background color of odd list rows.
       aColor = mColorOddTreeRow;
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       // There appears to be no available system defined color. HARDCODING to the appropriate color.
       aColor = NS_RGB(0x14, 0x4F, 0xAE);
       break;
     // The following colors are supposed to be used as font-smoothing background
     // colors, in the chrome-only -moz-font-smoothing-background-color property.
     // This property is used for text on "vibrant" -moz-appearances.
     // The colors have been obtained from the system on 10.12.6 using the
     // program at https://bugzilla.mozilla.org/attachment.cgi?id=8907533 .
     // We could obtain them at runtime, but doing so may be expensive and
     // requires the use of the private API
     // -[NSVisualEffectView fontSmoothingBackgroundColor].
-    case eColorID__moz_mac_vibrancy_light:
-    case eColorID__moz_mac_vibrant_titlebar_light:
-    case eColorID__moz_mac_source_list:
-    case eColorID__moz_mac_tooltip:
+    case ColorID::MozMacVibrancyLight:
+    case ColorID::MozMacVibrantTitlebarLight:
+    case ColorID::MozMacSourceList:
+    case ColorID::MozMacTooltip:
       aColor = NS_RGB(0xf7, 0xf7, 0xf7);
       break;
-    case eColorID__moz_mac_vibrancy_dark:
-    case eColorID__moz_mac_vibrant_titlebar_dark:
+    case ColorID::MozMacVibrancyDark:
+    case ColorID::MozMacVibrantTitlebarDark:
       aColor = NS_RGB(0x28, 0x28, 0x28);
       break;
-    case eColorID__moz_mac_menupopup:
-    case eColorID__moz_mac_menuitem:
+    case ColorID::MozMacMenupopup:
+    case ColorID::MozMacMenuitem:
       aColor = NS_RGB(0xe6, 0xe6, 0xe6);
       break;
-    case eColorID__moz_mac_source_list_selection:
+    case ColorID::MozMacSourceListSelection:
       aColor = NS_RGB(0xc8, 0xc8, 0xc8);
       break;
-    case eColorID__moz_mac_active_menuitem:
-    case eColorID__moz_mac_active_source_list_selection:
+    case ColorID::MozMacActiveMenuitem:
+    case ColorID::MozMacActiveSourceListSelection:
       aColor = mColorActiveSourceListSelection;
       break;
     default:
       NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about");
       aColor = NS_RGB(0xff, 0xff, 0xff);
       res = NS_ERROR_FAILURE;
       break;
   }
@@ -719,17 +719,17 @@ void nsLookAndFeel::EnsureInit() {
   nscolor color;
 
   mColorTextSelectBackground = GetColorFromNSColor([NSColor selectedTextBackgroundColor]);
   mColorTextSelectBackgroundDisabled = GetColorFromNSColor([NSColor secondarySelectedControlColor]);
 
   mColorHighlight = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
   mColorMenuHover = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
 
-  GetColor(eColorID_TextSelectBackground, color);
+  GetColor(ColorID::TextSelectBackground, color);
   if (color == 0x000000) {
     mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
   } else {
     mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
   }
 
   mColorMenuHoverText = GetColorFromNSColor([NSColor alternateSelectedControlTextColor]);
 
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -262,32 +262,32 @@ class SelectionStyleProvider final {
     // GtkStyle::bg[GTK_STATE_SELECTED] (although pair of text and *base*
     // or *fg* and bg is correct).  gtk_style_update_from_context() will
     // set these colors using the widget's GtkStyleContext and so the
     // colors can be controlled by a ":selected" CSS rule.
     nsAutoCString style(":selected{");
     // FYI: LookAndFeel always returns selection colors of GtkTextView.
     nscolor selectionForegroundColor;
     if (NS_SUCCEEDED(
-            LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
+            LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground,
                                   &selectionForegroundColor))) {
       double alpha =
           static_cast<double>(NS_GET_A(selectionForegroundColor)) / 0xFF;
       style.AppendPrintf("color:rgba(%u,%u,%u,",
                          NS_GET_R(selectionForegroundColor),
                          NS_GET_G(selectionForegroundColor),
                          NS_GET_B(selectionForegroundColor));
       // We can't use AppendPrintf here, because it does locale-specific
       // formatting of floating-point values.
       style.AppendFloat(alpha);
       style.AppendPrintf(");");
     }
     nscolor selectionBackgroundColor;
     if (NS_SUCCEEDED(
-            LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground,
+            LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground,
                                   &selectionBackgroundColor))) {
       double alpha =
           static_cast<double>(NS_GET_A(selectionBackgroundColor)) / 0xFF;
       style.AppendPrintf("background-color:rgba(%u,%u,%u,",
                          NS_GET_R(selectionBackgroundColor),
                          NS_GET_G(selectionBackgroundColor),
                          NS_GET_B(selectionBackgroundColor));
       style.AppendFloat(alpha);
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -266,199 +266,199 @@ nsresult nsLookAndFeel::NativeGetColor(C
   EnsureInit();
 
   nsresult res = NS_OK;
 
   switch (aID) {
       // These colors don't seem to be used for anything anymore in Mozilla
       // (except here at least TextSelectBackground and TextSelectForeground)
       // The CSS2 colors below are used.
-    case eColorID_WindowBackground:
-    case eColorID_WidgetBackground:
-    case eColorID_TextBackground:
-    case eColorID_activecaption:  // active window caption background
-    case eColorID_appworkspace:   // MDI background color
-    case eColorID_background:     // desktop background
-    case eColorID_window:
-    case eColorID_windowframe:
-    case eColorID__moz_dialog:
-    case eColorID__moz_combobox:
+    case ColorID::WindowBackground:
+    case ColorID::WidgetBackground:
+    case ColorID::TextBackground:
+    case ColorID::Activecaption:  // active window caption background
+    case ColorID::Appworkspace:   // MDI background color
+    case ColorID::Background:     // desktop background
+    case ColorID::Window:
+    case ColorID::Windowframe:
+    case ColorID::MozDialog:
+    case ColorID::MozCombobox:
       aColor = mMozWindowBackground;
       break;
-    case eColorID_WindowForeground:
-    case eColorID_WidgetForeground:
-    case eColorID_TextForeground:
-    case eColorID_captiontext:  // text in active window caption, size box, and
+    case ColorID::WindowForeground:
+    case ColorID::WidgetForeground:
+    case ColorID::TextForeground:
+    case ColorID::Captiontext:  // text in active window caption, size box, and
                                 // scrollbar arrow box (!)
-    case eColorID_windowtext:
-    case eColorID__moz_dialogtext:
+    case ColorID::Windowtext:
+    case ColorID::MozDialogtext:
       aColor = mMozWindowText;
       break;
-    case eColorID_WidgetSelectBackground:
-    case eColorID_TextSelectBackground:
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID__moz_dragtargetzone:
-    case eColorID__moz_html_cellhighlight:
-    case eColorID_highlight:  // preference selected item,
+    case ColorID::WidgetSelectBackground:
+    case ColorID::TextSelectBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::MozDragtargetzone:
+    case ColorID::MozHtmlCellhighlight:
+    case ColorID::Highlight:  // preference selected item,
       aColor = mTextSelectedBackground;
       break;
-    case eColorID_WidgetSelectForeground:
-    case eColorID_TextSelectForeground:
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_highlighttext:
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::WidgetSelectForeground:
+    case ColorID::TextSelectForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::Highlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       aColor = mTextSelectedText;
       break;
-    case eColorID__moz_cellhighlight:
+    case ColorID::MozCellhighlight:
       aColor = mMozCellHighlightBackground;
       break;
-    case eColorID__moz_cellhighlighttext:
+    case ColorID::MozCellhighlighttext:
       aColor = mMozCellHighlightText;
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       aColor = NS_RGB(0xa0, 0xa0, 0xa0);
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       aColor = NS_RGB(0x40, 0x40, 0x40);
       break;
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aColor = NS_RGB(0xff, 0, 0);
       break;
 
       // css2  http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       // active window border
       aColor = mMozWindowActiveBorder;
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       // inactive window border
       aColor = mMozWindowInactiveBorder;
       break;
-    case eColorID_graytext:             // disabled text in windows, menus, etc.
-    case eColorID_inactivecaptiontext:  // text in inactive window caption
+    case ColorID::Graytext:             // disabled text in windows, menus, etc.
+    case ColorID::Inactivecaptiontext:  // text in inactive window caption
       aColor = mMenuTextInactive;
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       // inactive window caption
       aColor = mMozWindowInactiveCaption;
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       // tooltip background color
       aColor = mInfoBackground;
       break;
-    case eColorID_infotext:
+    case ColorID::Infotext:
       // tooltip text color
       aColor = mInfoText;
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       // menu background
       aColor = mMenuBackground;
       break;
-    case eColorID_menutext:
+    case ColorID::Menutext:
       // menu text
       aColor = mMenuText;
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       // scrollbar gray area
       aColor = mMozScrollbar;
       break;
 
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       // 3-D highlighted inner edge color
       // always same as background in GTK code
-    case eColorID_threedface:
-    case eColorID_buttonface:
+    case ColorID::Threedface:
+    case ColorID::Buttonface:
       // 3-D face color
       aColor = mMozWindowBackground;
       break;
 
-    case eColorID_buttontext:
+    case ColorID::Buttontext:
       // text on push buttons
       aColor = mButtonText;
       break;
 
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       // 3-D highlighted edge color
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       // 3-D highlighted outer edge color
       aColor = mFrameOuterLightBorder;
       break;
 
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       // 3-D shadow edge color
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       // 3-D shadow inner edge color
       aColor = mFrameInnerDarkBorder;
       break;
 
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       // Hardcode to black
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
 
-    case eColorID__moz_eventreerow:
-    case eColorID__moz_field:
+    case ColorID::MozEventreerow:
+    case ColorID::MozField:
       aColor = mMozFieldBackground;
       break;
-    case eColorID__moz_fieldtext:
+    case ColorID::MozFieldtext:
       aColor = mMozFieldText;
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       // default button border color
       aColor = mButtonDefault;
       break;
-    case eColorID__moz_buttonhoverface:
+    case ColorID::MozButtonhoverface:
       aColor = mButtonHoverFace;
       break;
-    case eColorID__moz_buttonhovertext:
+    case ColorID::MozButtonhovertext:
       aColor = mButtonHoverText;
       break;
-    case eColorID__moz_gtk_buttonactivetext:
+    case ColorID::MozGtkButtonactivetext:
       aColor = mButtonActiveText;
       break;
-    case eColorID__moz_menuhover:
+    case ColorID::MozMenuhover:
       aColor = mMenuHover;
       break;
-    case eColorID__moz_menuhovertext:
+    case ColorID::MozMenuhovertext:
       aColor = mMenuHoverText;
       break;
-    case eColorID__moz_oddtreerow:
+    case ColorID::MozOddtreerow:
       aColor = mOddCellBackground;
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       aColor = mNativeHyperLinkText;
       break;
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozComboboxtext:
       aColor = mComboBoxText;
       break;
-    case eColorID__moz_menubartext:
+    case ColorID::MozMenubartext:
       aColor = mMenuBarText;
       break;
-    case eColorID__moz_menubarhovertext:
+    case ColorID::MozMenubarhovertext:
       aColor = mMenuBarHoverText;
       break;
-    case eColorID__moz_gtk_info_bar_text:
+    case ColorID::MozGtkInfoBarText:
       aColor = mInfoBarText;
       break;
     default:
       /* default color is BLACK */
       aColor = 0;
       res = NS_ERROR_FAILURE;
       break;
   }
@@ -699,18 +699,18 @@ nsresult nsLookAndFeel::GetIntImpl(IntID
       aResult = enableAnimations ? 0 : 1;
       break;
     }
     case eIntID_SystemUsesDarkTheme: {
       // It seems GTK doesn't have an API to query if the current theme is
       // "light" or "dark", so we synthesize it from the CSS2 Window/WindowText
       // colors instead, by comparing their luminosity.
       nscolor fg, bg;
-      if (NS_SUCCEEDED(NativeGetColor(eColorID_windowtext, fg)) &&
-          NS_SUCCEEDED(NativeGetColor(eColorID_window, bg))) {
+      if (NS_SUCCEEDED(NativeGetColor(ColorID::Windowtext, fg)) &&
+          NS_SUCCEEDED(NativeGetColor(ColorID::Window, bg))) {
         aResult = (RelativeLuminanceUtils::Compute(bg) <
                    RelativeLuminanceUtils::Compute(fg))
                       ? 1
                       : 0;
         break;
       }
       MOZ_FALLTHROUGH;
     }
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -1247,17 +1247,17 @@ bool nsNativeThemeGTK::CreateWebRenderCo
           aRect, presContext->AppUnitsPerDevPixel()));
 
   switch (aAppearance) {
     case StyleAppearance::Window:
     case StyleAppearance::Dialog:
       aBuilder.PushRect(
           bounds, bounds, true,
           wr::ToColorF(Color::FromABGR(LookAndFeel::GetColor(
-              LookAndFeel::eColorID_WindowBackground, NS_RGBA(0, 0, 0, 0)))));
+              LookAndFeel::ColorID::WindowBackground, NS_RGBA(0, 0, 0, 0)))));
       return true;
 
     default:
       return false;
   }
 }
 
 WidgetNodeType nsNativeThemeGTK::NativeThemeToGtkTheme(
--- a/widget/headless/HeadlessLookAndFeelGTK.cpp
+++ b/widget/headless/HeadlessLookAndFeelGTK.cpp
@@ -23,104 +23,104 @@ nsresult HeadlessLookAndFeel::NativeGetC
   // For headless mode, we use GetStandinForNativeColor for everything we can,
   // and hardcoded values for everything else.
 
   nsresult res = NS_OK;
 
   switch (aID) {
     // Override the solid black that GetStandinForNativeColor provides for
     // -moz-FieldText, to match our behavior under the real GTK.
-    case eColorID__moz_fieldtext:
+    case ColorID::MozFieldtext:
       aColor = NS_RGB(0x21, 0x21, 0x21);
       break;
 
     // The rest are not provided by GetStandinForNativeColor.
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aColor = NS_40PERCENT_FOREGROUND_COLOR;
       break;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID__moz_eventreerow:
+    case ColorID::MozEventreerow:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID__moz_gtk_info_bar_text:
+    case ColorID::MozGtkInfoBarText:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_mac_buttonactivetext:
-    case eColorID__moz_mac_defaultbuttontext:
+    case ColorID::MozMacButtonactivetext:
+    case ColorID::MozMacDefaultbuttontext:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aColor = NS_RGB(0xff, 0x00, 0x00);
       break;
-    case eColorID_TextBackground:
+    case ColorID::TextBackground:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_TextForeground:
+    case ColorID::TextForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_TextHighlightBackground:
+    case ColorID::TextHighlightBackground:
       aColor = NS_RGB(0xef, 0x0f, 0xff);
       break;
-    case eColorID_TextHighlightForeground:
+    case ColorID::TextHighlightForeground:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_TextSelectBackground:
+    case ColorID::TextSelectBackground:
       aColor = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID_TextSelectBackgroundAttention:
+    case ColorID::TextSelectBackgroundAttention:
       aColor = NS_TRANSPARENT;
       break;
-    case eColorID_TextSelectBackgroundDisabled:
+    case ColorID::TextSelectBackgroundDisabled:
       aColor = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID_TextSelectForeground:
-      GetColor(eColorID_TextSelectBackground, aColor);
+    case ColorID::TextSelectForeground:
+      GetColor(ColorID::TextSelectBackground, aColor);
       if (aColor == 0x000000)
         aColor = NS_RGB(0xff, 0xff, 0xff);
       else
         aColor = NS_DONT_CHANGE_COLOR;
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       aColor = NS_RGB(0xa0, 0xa0, 0xa0);
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       aColor = NS_RGB(0x40, 0x40, 0x40);
       break;
-    case eColorID_WidgetBackground:
+    case ColorID::WidgetBackground:
       aColor = NS_RGB(0xdd, 0xdd, 0xdd);
       break;
-    case eColorID_WidgetForeground:
+    case ColorID::WidgetForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_WidgetSelectBackground:
+    case ColorID::WidgetSelectBackground:
       aColor = NS_RGB(0x80, 0x80, 0x80);
       break;
-    case eColorID_WidgetSelectForeground:
+    case ColorID::WidgetSelectForeground:
       aColor = NS_RGB(0x00, 0x00, 0x80);
       break;
-    case eColorID_WindowBackground:
+    case ColorID::WindowBackground:
       aColor = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_WindowForeground:
+    case ColorID::WindowForeground:
       aColor = NS_RGB(0x00, 0x00, 0x00);
       break;
     default:
       aColor = GetStandinForNativeColor(aID);
       break;
   }
 
   return res;
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -89,17 +89,18 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sI
 nsLookAndFeelFloatPref nsXPLookAndFeel::sFloatPrefs[] = {
     {"ui.IMEUnderlineRelativeSize", eFloatID_IMEUnderlineRelativeSize, false,
      0},
     {"ui.SpellCheckerUnderlineRelativeSize",
      eFloatID_SpellCheckerUnderlineRelativeSize, false, 0},
     {"ui.caretAspectRatio", eFloatID_CaretAspectRatio, false, 0},
 };
 
-// This array MUST be kept in the same order as the color list in LookAndFeel.h.
+// This array MUST be kept in the same order as the color list in
+// specified/color.rs
 /* XXX If you add any strings longer than
  * "ui.-moz-mac-active-source-list-selection"
  * to the following array then you MUST update the
  * sizes of the sColorPrefs array in nsXPLookAndFeel.h
  */
 const char nsXPLookAndFeel::sColorPrefs[][41] = {
     "ui.windowBackground",
     "ui.windowForeground",
@@ -204,17 +205,17 @@ const char nsXPLookAndFeel::sColorPrefs[
     "ui.-moz-win-accentcolortext",
     "ui.-moz-win-mediatext",
     "ui.-moz-win-communicationstext",
     "ui.-moz-nativehyperlinktext",
     "ui.-moz-comboboxtext",
     "ui.-moz-combobox",
     "ui.-moz-gtk-info-bar-text"};
 
-int32_t nsXPLookAndFeel::sCachedColors[LookAndFeel::eColorID_LAST_COLOR] = {0};
+int32_t nsXPLookAndFeel::sCachedColors[size_t(LookAndFeel::ColorID::End)] = {0};
 int32_t nsXPLookAndFeel::sCachedColorBits[COLOR_CACHE_SIZE] = {0};
 
 bool nsXPLookAndFeel::sInitialized = false;
 bool nsXPLookAndFeel::sUseNativeColors = true;
 bool nsXPLookAndFeel::sFindbarModalHighlight = false;
 bool nsXPLookAndFeel::sIsInPrefersReducedMotionForTest = false;
 bool nsXPLookAndFeel::sPrefersReducedMotionForTest = false;
 
@@ -331,16 +332,19 @@ void nsXPLookAndFeel::InitFromPref(nsLoo
   nsresult rv = Preferences::GetInt(aPref->name, &intpref);
   if (NS_SUCCEEDED(rv)) {
     aPref->isSet = true;
     aPref->floatVar = (float)intpref / 100.0f;
   }
 }
 
 void nsXPLookAndFeel::InitColorFromPref(int32_t i) {
+  static_assert(ArrayLength(sColorPrefs) == size_t(ColorID::End),
+                "Should have a pref for each color value");
+
   nsAutoString colorStr;
   nsresult rv = Preferences::GetString(sColorPrefs[i], colorStr);
   if (NS_FAILED(rv) || colorStr.IsEmpty()) {
     return;
   }
   nscolor thecolor;
   if (colorStr[0] == char16_t('#')) {
     nsAutoString hexString;
@@ -434,303 +438,303 @@ void nsXPLookAndFeel::Init() {
 nsXPLookAndFeel::~nsXPLookAndFeel() {
   NS_ASSERTION(sInstance == this,
                "This destroying instance isn't the singleton instance");
   sInstance = nullptr;
 }
 
 bool nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor& aColor) {
   switch (aID) {
-    case eColorID_TextSelectForeground:
+    case ColorID::TextSelectForeground:
       return (aColor == NS_DONT_CHANGE_COLOR);
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
+    case ColorID::SpellCheckerUnderline:
       return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
     default:
       /*
        * In GetColor(), every color that is not a special color is color
        * corrected. Use false to make other colors color corrected.
        */
       return false;
   }
   return false;
 }
 
 bool nsXPLookAndFeel::ColorIsNotCSSAccessible(ColorID aID) {
   bool result = false;
 
   switch (aID) {
-    case eColorID_WindowBackground:
-    case eColorID_WindowForeground:
-    case eColorID_WidgetBackground:
-    case eColorID_WidgetForeground:
-    case eColorID_WidgetSelectBackground:
-    case eColorID_WidgetSelectForeground:
-    case eColorID_Widget3DHighlight:
-    case eColorID_Widget3DShadow:
-    case eColorID_TextBackground:
-    case eColorID_TextForeground:
-    case eColorID_TextSelectBackground:
-    case eColorID_TextSelectForeground:
-    case eColorID_TextSelectBackgroundDisabled:
-    case eColorID_TextSelectBackgroundAttention:
-    case eColorID_TextHighlightBackground:
-    case eColorID_TextHighlightForeground:
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMEConvertedTextBackground:
-    case eColorID_IMEConvertedTextForeground:
-    case eColorID_IMEConvertedTextUnderline:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_IMESelectedConvertedTextUnderline:
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::WindowBackground:
+    case ColorID::WindowForeground:
+    case ColorID::WidgetBackground:
+    case ColorID::WidgetForeground:
+    case ColorID::WidgetSelectBackground:
+    case ColorID::WidgetSelectForeground:
+    case ColorID::Widget3DHighlight:
+    case ColorID::Widget3DShadow:
+    case ColorID::TextBackground:
+    case ColorID::TextForeground:
+    case ColorID::TextSelectBackground:
+    case ColorID::TextSelectForeground:
+    case ColorID::TextSelectBackgroundDisabled:
+    case ColorID::TextSelectBackgroundAttention:
+    case ColorID::TextHighlightBackground:
+    case ColorID::TextHighlightForeground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMEConvertedTextBackground:
+    case ColorID::IMEConvertedTextForeground:
+    case ColorID::IMEConvertedTextUnderline:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::IMESelectedConvertedTextUnderline:
+    case ColorID::SpellCheckerUnderline:
       result = true;
       break;
     default:
       break;
   }
 
   return result;
 }
 
 nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
   nscolor result = NS_RGB(0xFF, 0xFF, 0xFF);
 
   // The stand-in colors are taken from the Windows 7 Aero theme
   // except Mac-specific colors which are taken from Mac OS 10.7.
   switch (aID) {
     // CSS 2 colors:
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       result = NS_RGB(0xB4, 0xB4, 0xB4);
       break;
-    case eColorID_activecaption:
+    case ColorID::Activecaption:
       result = NS_RGB(0x99, 0xB4, 0xD1);
       break;
-    case eColorID_appworkspace:
+    case ColorID::Appworkspace:
       result = NS_RGB(0xAB, 0xAB, 0xAB);
       break;
-    case eColorID_background:
+    case ColorID::Background:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_buttonface:
+    case ColorID::Buttonface:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       result = NS_RGB(0xA0, 0xA0, 0xA0);
       break;
-    case eColorID_buttontext:
+    case ColorID::Buttontext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_captiontext:
+    case ColorID::Captiontext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_graytext:
+    case ColorID::Graytext:
       result = NS_RGB(0x6D, 0x6D, 0x6D);
       break;
-    case eColorID_highlight:
+    case ColorID::Highlight:
       result = NS_RGB(0x33, 0x99, 0xFF);
       break;
-    case eColorID_highlighttext:
+    case ColorID::Highlighttext:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       result = NS_RGB(0xF4, 0xF7, 0xFC);
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       result = NS_RGB(0xBF, 0xCD, 0xDB);
       break;
-    case eColorID_inactivecaptiontext:
+    case ColorID::Inactivecaptiontext:
       result = NS_RGB(0x43, 0x4E, 0x54);
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       result = NS_RGB(0xFF, 0xFF, 0xE1);
       break;
-    case eColorID_infotext:
+    case ColorID::Infotext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_menutext:
+    case ColorID::Menutext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       result = NS_RGB(0xC8, 0xC8, 0xC8);
       break;
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       result = NS_RGB(0x69, 0x69, 0x69);
       break;
-    case eColorID_threedface:
+    case ColorID::Threedface:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       result = NS_RGB(0xE3, 0xE3, 0xE3);
       break;
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       result = NS_RGB(0xA0, 0xA0, 0xA0);
       break;
-    case eColorID_window:
+    case ColorID::Window:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_windowframe:
+    case ColorID::Windowframe:
       result = NS_RGB(0x64, 0x64, 0x64);
       break;
-    case eColorID_windowtext:
+    case ColorID::Windowtext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       result = NS_RGB(0x69, 0x69, 0x69);
       break;
-    case eColorID__moz_field:
+    case ColorID::MozField:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_fieldtext:
+    case ColorID::MozFieldtext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_dialog:
+    case ColorID::MozDialog:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID__moz_dialogtext:
+    case ColorID::MozDialogtext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_dragtargetzone:
+    case ColorID::MozDragtargetzone:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_cellhighlight:
+    case ColorID::MozCellhighlight:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID__moz_cellhighlighttext:
+    case ColorID::MozCellhighlighttext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_html_cellhighlight:
+    case ColorID::MozHtmlCellhighlight:
       result = NS_RGB(0x33, 0x99, 0xFF);
       break;
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_buttonhoverface:
+    case ColorID::MozButtonhoverface:
       result = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID__moz_buttonhovertext:
+    case ColorID::MozButtonhovertext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_menuhover:
+    case ColorID::MozMenuhover:
       result = NS_RGB(0x33, 0x99, 0xFF);
       break;
-    case eColorID__moz_menuhovertext:
+    case ColorID::MozMenuhovertext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_menubartext:
+    case ColorID::MozMenubartext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_menubarhovertext:
+    case ColorID::MozMenubarhovertext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_oddtreerow:
-    case eColorID__moz_gtk_buttonactivetext:
+    case ColorID::MozOddtreerow:
+    case ColorID::MozGtkButtonactivetext:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_mac_chrome_active:
+    case ColorID::MozMacChromeActive:
       result = NS_RGB(0xB2, 0xB2, 0xB2);
       break;
-    case eColorID__moz_mac_chrome_inactive:
+    case ColorID::MozMacChromeInactive:
       result = NS_RGB(0xE1, 0xE1, 0xE1);
       break;
-    case eColorID__moz_mac_focusring:
+    case ColorID::MozMacFocusring:
       result = NS_RGB(0x60, 0x9D, 0xD7);
       break;
-    case eColorID__moz_mac_menuselect:
+    case ColorID::MozMacMenuselect:
       result = NS_RGB(0x38, 0x75, 0xD7);
       break;
-    case eColorID__moz_mac_menushadow:
+    case ColorID::MozMacMenushadow:
       result = NS_RGB(0xA3, 0xA3, 0xA3);
       break;
-    case eColorID__moz_mac_menutextdisable:
+    case ColorID::MozMacMenutextdisable:
       result = NS_RGB(0x88, 0x88, 0x88);
       break;
-    case eColorID__moz_mac_menutextselect:
+    case ColorID::MozMacMenutextselect:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_mac_disabledtoolbartext:
+    case ColorID::MozMacDisabledtoolbartext:
       result = NS_RGB(0x3F, 0x3F, 0x3F);
       break;
-    case eColorID__moz_mac_secondaryhighlight:
+    case ColorID::MozMacSecondaryhighlight:
       result = NS_RGB(0xD4, 0xD4, 0xD4);
       break;
-    case eColorID__moz_mac_vibrancy_light:
-    case eColorID__moz_mac_vibrant_titlebar_light:
+    case ColorID::MozMacVibrancyLight:
+    case ColorID::MozMacVibrantTitlebarLight:
       result = NS_RGB(0xf7, 0xf7, 0xf7);
       break;
-    case eColorID__moz_mac_vibrancy_dark:
-    case eColorID__moz_mac_vibrant_titlebar_dark:
+    case ColorID::MozMacVibrancyDark:
+    case ColorID::MozMacVibrantTitlebarDark:
       result = NS_RGB(0x28, 0x28, 0x28);
       break;
-    case eColorID__moz_mac_menupopup:
+    case ColorID::MozMacMenupopup:
       result = NS_RGB(0xe6, 0xe6, 0xe6);
       break;
-    case eColorID__moz_mac_menuitem:
+    case ColorID::MozMacMenuitem:
       result = NS_RGB(0xe6, 0xe6, 0xe6);
       break;
-    case eColorID__moz_mac_active_menuitem:
+    case ColorID::MozMacActiveMenuitem:
       result = NS_RGB(0x0a, 0x64, 0xdc);
       break;
-    case eColorID__moz_mac_source_list:
+    case ColorID::MozMacSourceList:
       result = NS_RGB(0xf7, 0xf7, 0xf7);
       break;
-    case eColorID__moz_mac_source_list_selection:
+    case ColorID::MozMacSourceListSelection:
       result = NS_RGB(0xc8, 0xc8, 0xc8);
       break;
-    case eColorID__moz_mac_active_source_list_selection:
+    case ColorID::MozMacActiveSourceListSelection:
       result = NS_RGB(0x0a, 0x64, 0xdc);
       break;
-    case eColorID__moz_mac_tooltip:
+    case ColorID::MozMacTooltip:
       result = NS_RGB(0xf7, 0xf7, 0xf7);
       break;
-    case eColorID__moz_win_accentcolor:
+    case ColorID::MozWinAccentcolor:
       // Seems to be the default color (hardcoded because of bug 1065998)
       result = NS_RGB(0x9E, 0x9E, 0x9E);
       break;
-    case eColorID__moz_win_accentcolortext:
+    case ColorID::MozWinAccentcolortext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_win_mediatext:
+    case ColorID::MozWinMediatext:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_win_communicationstext:
+    case ColorID::MozWinCommunicationstext:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       result = NS_RGB(0x00, 0x66, 0xCC);
       break;
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozComboboxtext:
       result = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID__moz_combobox:
+    case ColorID::MozCombobox:
       result = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
     default:
       break;
   }
 
   return result;
 }
@@ -753,74 +757,74 @@ nsresult nsXPLookAndFeel::GetColorImpl(C
     // correctly you will not be able to see *any* text.
 #undef DEBUG_SYSTEM_COLOR_USE
 
 #ifdef DEBUG_SYSTEM_COLOR_USE
   {
     nsresult rv = NS_OK;
     switch (aID) {
         // css2  http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
-      case eColorID_activecaption:
+      case ColorID::Activecaption:
         // active window caption background
-      case eColorID_captiontext:
+      case ColorID::Captiontext:
         // text in active window caption
         aResult = NS_RGB(0xff, 0x00, 0x00);
         break;
 
-      case eColorID_highlight:
+      case ColorID::Highlight:
         // background of selected item
-      case eColorID_highlighttext:
+      case ColorID::Highlighttext:
         // text of selected item
         aResult = NS_RGB(0xff, 0xff, 0x00);
         break;
 
-      case eColorID_inactivecaption:
+      case ColorID::Inactivecaption:
         // inactive window caption
-      case eColorID_inactivecaptiontext:
+      case ColorID::Inactivecaptiontext:
         // text in inactive window caption
         aResult = NS_RGB(0x66, 0x66, 0x00);
         break;
 
-      case eColorID_infobackground:
+      case ColorID::Infobackground:
         // tooltip background color
-      case eColorID_infotext:
+      case ColorID::Infotext:
         // tooltip text color
         aResult = NS_RGB(0x00, 0xff, 0x00);
         break;
 
-      case eColorID_menu:
+      case ColorID::Menu:
         // menu background
-      case eColorID_menutext:
+      case ColorID::Menutext:
         // menu text
         aResult = NS_RGB(0x00, 0xff, 0xff);
         break;
 
-      case eColorID_threedface:
-      case eColorID_buttonface:
+      case ColorID::Threedface:
+      case ColorID::Buttonface:
         // 3-D face color
-      case eColorID_buttontext:
+      case ColorID::Buttontext:
         // text on push buttons
         aResult = NS_RGB(0x00, 0x66, 0x66);
         break;
 
-      case eColorID_window:
-      case eColorID_windowtext:
+      case ColorID::Window:
+      case ColorID::Windowtext:
         aResult = NS_RGB(0x00, 0x00, 0xff);
         break;
 
         // from the CSS3 working draft (not yet finalized)
         // http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
 
-      case eColorID__moz_field:
-      case eColorID__moz_fieldtext:
+      case ColorID::MozField:
+      case ColorID::MozFieldtext:
         aResult = NS_RGB(0xff, 0x00, 0xff);
         break;
 
-      case eColorID__moz_dialog:
-      case eColorID__moz_dialogtext:
+      case ColorID::MozDialog:
+      case ColorID::MozDialogtext:
         aResult = NS_RGB(0x66, 0x00, 0x66);
         break;
 
       default:
         rv = NS_ERROR_NOT_AVAILABLE;
     }
     if (NS_SUCCEEDED(rv)) return rv;
   }
@@ -828,50 +832,50 @@ nsresult nsXPLookAndFeel::GetColorImpl(C
 
   if (aUseStandinsForNativeColors &&
       (ColorIsNotCSSAccessible(aID) ||
        !nsContentUtils::UseStandinsForNativeColors())) {
     aUseStandinsForNativeColors = false;
   }
 
   if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
-    aResult = sCachedColors[aID];
+    aResult = sCachedColors[uint32_t(aID)];
     return NS_OK;
   }
 
   // There are no system color settings for these, so set them manually
 #ifndef XP_MACOSX
-  if (aID == eColorID_TextSelectBackgroundDisabled) {
+  if (aID == ColorID::TextSelectBackgroundDisabled) {
     // This is used to gray out the selection when it's not focused
     // Used with nsISelectionController::SELECTION_DISABLED
     aResult = NS_RGB(0xb0, 0xb0, 0xb0);
     return NS_OK;
   }
 #endif
 
-  if (aID == eColorID_TextSelectBackgroundAttention) {
+  if (aID == ColorID::TextSelectBackgroundAttention) {
     if (sFindbarModalHighlight) {
       aResult = NS_RGBA(0, 0, 0, 0);
       return NS_OK;
     }
 
     // This makes the selection stand out when typeaheadfind is on
     // Used with nsISelectionController::SELECTION_ATTENTION
     aResult = NS_RGB(0x38, 0xd8, 0x78);
     return NS_OK;
   }
 
-  if (aID == eColorID_TextHighlightBackground) {
+  if (aID == ColorID::TextHighlightBackground) {
     // This makes the matched text stand out when findbar highlighting is on
     // Used with nsISelectionController::SELECTION_FIND
     aResult = NS_RGB(0xef, 0x0f, 0xff);
     return NS_OK;
   }
 
-  if (aID == eColorID_TextHighlightForeground) {
+  if (aID == ColorID::TextHighlightForeground) {
     // The foreground color for the matched text in findbar highlighting
     // Used with nsISelectionController::SELECTION_FIND
     aResult = NS_RGB(0xff, 0xff, 0xff);
     return NS_OK;
   }
 
   if (sUseNativeColors && aUseStandinsForNativeColors) {
     aResult = GetStandinForNativeColor(aID);
@@ -950,17 +954,17 @@ nsresult nsXPLookAndFeel::GetFloatImpl(F
   }
 
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 void nsXPLookAndFeel::RefreshImpl() {
   // Wipe out our color cache.
   uint32_t i;
-  for (i = 0; i < eColorID_LAST_COLOR; i++) sCachedColors[i] = 0;
+  for (i = 0; i < uint32_t(ColorID::End); i++) sCachedColors[i] = 0;
   for (i = 0; i < COLOR_CACHE_SIZE; i++) sCachedColorBits[i] = 0;
 }
 
 nsTArray<LookAndFeelInt> nsXPLookAndFeel::GetIntCacheImpl() {
   return nsTArray<LookAndFeelInt>();
 }
 
 namespace mozilla {
--- a/widget/nsXPLookAndFeel.h
+++ b/widget/nsXPLookAndFeel.h
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __nsXPLookAndFeel
 #define __nsXPLookAndFeel
 
 #include "mozilla/LookAndFeel.h"
+#include "mozilla/ServoStyleConsts.h"
 #include "nsTArray.h"
 
 class nsLookAndFeel;
 
 struct nsLookAndFeelIntPref {
   const char* name;
   mozilla::LookAndFeel::IntID id;
   bool isSet;
@@ -20,27 +21,27 @@ struct nsLookAndFeelIntPref {
 
 struct nsLookAndFeelFloatPref {
   const char* name;
   mozilla::LookAndFeel::FloatID id;
   bool isSet;
   float floatVar;
 };
 
-#define CACHE_BLOCK(x) ((x) >> 5)
-#define CACHE_BIT(x) (1 << ((x)&31))
+#define CACHE_BLOCK(x) (uint32_t(x) >> 5)
+#define CACHE_BIT(x) (1 << (uint32_t(x) & 31))
 
-#define COLOR_CACHE_SIZE (CACHE_BLOCK(LookAndFeel::eColorID_LAST_COLOR) + 1)
+#define COLOR_CACHE_SIZE (CACHE_BLOCK(uint32_t(LookAndFeel::ColorID::End)) + 1)
 #define IS_COLOR_CACHED(x) \
   (CACHE_BIT(x) & nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)])
-#define CLEAR_COLOR_CACHE(x)               \
-  nsXPLookAndFeel::sCachedColors[(x)] = 0; \
+#define CLEAR_COLOR_CACHE(x)                       \
+  nsXPLookAndFeel::sCachedColors[uint32_t(x)] = 0; \
   nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)] &= ~(CACHE_BIT(x));
-#define CACHE_COLOR(x, y)                  \
-  nsXPLookAndFeel::sCachedColors[(x)] = y; \
+#define CACHE_COLOR(x, y)                          \
+  nsXPLookAndFeel::sCachedColors[uint32_t(x)] = y; \
   nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)] |= CACHE_BIT(x);
 
 class nsXPLookAndFeel : public mozilla::LookAndFeel {
  public:
   virtual ~nsXPLookAndFeel();
 
   static nsXPLookAndFeel* GetInstance();
   static void Shutdown();
@@ -107,17 +108,17 @@ class nsXPLookAndFeel : public mozilla::
 
   static bool sInitialized;
   static nsLookAndFeelIntPref sIntPrefs[];
   static nsLookAndFeelFloatPref sFloatPrefs[];
   /* this length must not be shorter than the length of the longest string in
    * the array see nsXPLookAndFeel.cpp
    */
   static const char sColorPrefs[][41];
-  static int32_t sCachedColors[LookAndFeel::eColorID_LAST_COLOR];
+  static int32_t sCachedColors[size_t(LookAndFeel::ColorID::End)];
   static int32_t sCachedColorBits[COLOR_CACHE_SIZE];
   static bool sUseNativeColors;
   static bool sFindbarModalHighlight;
 
   static nsXPLookAndFeel* sInstance;
   static bool sShutdown;
 
   static bool sIsInPrefersReducedMotionForTest;
--- a/widget/uikit/nsLookAndFeel.mm
+++ b/widget/uikit/nsLookAndFeel.mm
@@ -41,213 +41,213 @@ void nsLookAndFeel::RefreshImpl() {
 }
 
 nsresult nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor& aResult) {
   EnsureInit();
 
   nsresult res = NS_OK;
 
   switch (aID) {
-    case eColorID_WindowBackground:
+    case ColorID::WindowBackground:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_WindowForeground:
+    case ColorID::WindowForeground:
       aResult = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_WidgetBackground:
+    case ColorID::WidgetBackground:
       aResult = NS_RGB(0xdd, 0xdd, 0xdd);
       break;
-    case eColorID_WidgetForeground:
+    case ColorID::WidgetForeground:
       aResult = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_WidgetSelectBackground:
+    case ColorID::WidgetSelectBackground:
       aResult = NS_RGB(0x80, 0x80, 0x80);
       break;
-    case eColorID_WidgetSelectForeground:
+    case ColorID::WidgetSelectForeground:
       aResult = NS_RGB(0x00, 0x00, 0x80);
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       aResult = NS_RGB(0xa0, 0xa0, 0xa0);
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       aResult = NS_RGB(0x40, 0x40, 0x40);
       break;
-    case eColorID_TextBackground:
+    case ColorID::TextBackground:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_TextForeground:
+    case ColorID::TextForeground:
       aResult = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_TextSelectBackground:
-    case eColorID_highlight:  // CSS2 color
+    case ColorID::TextSelectBackground:
+    case ColorID::Highlight:  // CSS2 color
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_menuhover:
+    case ColorID::MozMenuhover:
       aResult = NS_RGB(0xee, 0xee, 0xee);
       break;
-    case eColorID_TextSelectForeground:
-    case eColorID_highlighttext:  // CSS2 color
-    case eColorID__moz_menuhovertext:
+    case ColorID::TextSelectForeground:
+    case ColorID::Highlighttext:  // CSS2 color
+    case ColorID::MozMenuhovertext:
       aResult = mColorTextSelectForeground;
       break;
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aResult = NS_TRANSPARENT;
       break;
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aResult = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aResult = NS_40PERCENT_FOREGROUND_COLOR;
       break;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aResult = NS_SAME_AS_FOREGROUND_COLOR;
       break;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aResult = NS_RGB(0xff, 0, 0);
       break;
 
     //
     // css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
     //
-    case eColorID_buttontext:
-    case eColorID__moz_buttonhovertext:
-    case eColorID_captiontext:
-    case eColorID_menutext:
-    case eColorID_infotext:
-    case eColorID__moz_menubartext:
-    case eColorID_windowtext:
+    case ColorID::Buttontext:
+    case ColorID::MozButtonhovertext:
+    case ColorID::Captiontext:
+    case ColorID::Menutext:
+    case ColorID::Infotext:
+    case ColorID::MozMenubartext:
+    case ColorID::Windowtext:
       aResult = mColorDarkText;
       break;
-    case eColorID_activecaption:
+    case ColorID::Activecaption:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       aResult = NS_RGB(0x00, 0x00, 0x00);
       break;
-    case eColorID_appworkspace:
+    case ColorID::Appworkspace:
       aResult = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_background:
+    case ColorID::Background:
       aResult = NS_RGB(0x63, 0x63, 0xCE);
       break;
-    case eColorID_buttonface:
-    case eColorID__moz_buttonhoverface:
+    case ColorID::Buttonface:
+    case ColorID::MozButtonhoverface:
       aResult = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       aResult = NS_RGB(0xFF, 0xFF, 0xFF);
       break;
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       aResult = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID_graytext:
+    case ColorID::Graytext:
       aResult = NS_RGB(0x44, 0x44, 0x44);
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID_inactivecaptiontext:
+    case ColorID::Inactivecaptiontext:
       aResult = NS_RGB(0x45, 0x45, 0x45);
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       aResult = NS_RGB(0, 0, 0);  // XXX
       break;
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       aResult = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       aResult = NS_RGB(0xE0, 0xE0, 0xE0);
       break;
-    case eColorID_threedface:
+    case ColorID::Threedface:
       aResult = NS_RGB(0xF0, 0xF0, 0xF0);
       break;
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       aResult = NS_RGB(0xDA, 0xDA, 0xDA);
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       aResult = NS_RGB(0xFF, 0xFF, 0xC7);
       break;
-    case eColorID_windowframe:
+    case ColorID::Windowframe:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID_window:
-    case eColorID__moz_field:
-    case eColorID__moz_combobox:
+    case ColorID::Window:
+    case ColorID::MozField:
+    case ColorID::MozCombobox:
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID__moz_fieldtext:
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozFieldtext:
+    case ColorID::MozComboboxtext:
       aResult = mColorDarkText;
       break;
-    case eColorID__moz_dialog:
+    case ColorID::MozDialog:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_dialogtext:
-    case eColorID__moz_cellhighlighttext:
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::MozDialogtext:
+    case ColorID::MozCellhighlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       aResult = mColorDarkText;
       break;
-    case eColorID__moz_dragtargetzone:
-    case eColorID__moz_mac_chrome_active:
-    case eColorID__moz_mac_chrome_inactive:
+    case ColorID::MozDragtargetzone:
+    case ColorID::MozMacChromeActive:
+    case ColorID::MozMacChromeInactive:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_mac_focusring:
+    case ColorID::MozMacFocusring:
       aResult = NS_RGB(0x3F, 0x98, 0xDD);
       break;
-    case eColorID__moz_mac_menushadow:
+    case ColorID::MozMacMenushadow:
       aResult = NS_RGB(0xA3, 0xA3, 0xA3);
       break;
-    case eColorID__moz_mac_menutextdisable:
+    case ColorID::MozMacMenutextdisable:
       aResult = NS_RGB(0x88, 0x88, 0x88);
       break;
-    case eColorID__moz_mac_menutextselect:
+    case ColorID::MozMacMenutextselect:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_mac_disabledtoolbartext:
+    case ColorID::MozMacDisabledtoolbartext:
       aResult = NS_RGB(0x3F, 0x3F, 0x3F);
       break;
-    case eColorID__moz_mac_menuselect:
+    case ColorID::MozMacMenuselect:
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       aResult = NS_RGB(0xDC, 0xDC, 0xDC);
       break;
-    case eColorID__moz_cellhighlight:
-    case eColorID__moz_html_cellhighlight:
-    case eColorID__moz_mac_secondaryhighlight:
+    case ColorID::MozCellhighlight:
+    case ColorID::MozHtmlCellhighlight:
+    case ColorID::MozMacSecondaryhighlight:
       // For inactive list selection
       aResult = NS_RGB(0xaa, 0xaa, 0xaa);
       break;
-    case eColorID__moz_eventreerow:
+    case ColorID::MozEventreerow:
       // Background color of even list rows.
       aResult = NS_RGB(0xff, 0xff, 0xff);
       break;
-    case eColorID__moz_oddtreerow:
+    case ColorID::MozOddtreerow:
       // Background color of odd list rows.
       aResult = NS_TRANSPARENT;
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       // There appears to be no available system defined color. HARDCODING to the appropriate color.
       aResult = NS_RGB(0x14, 0x4F, 0xAE);
       break;
     default:
       NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about");
       aResult = NS_RGB(0xff, 0xff, 0xff);
       res = NS_ERROR_FAILURE;
       break;
@@ -391,17 +391,17 @@ bool nsLookAndFeel::GetFontImpl(FontID a
 
 void nsLookAndFeel::EnsureInit() {
   if (mInitialized) {
     return;
   }
   mInitialized = true;
 
   nscolor color;
-  GetColor(eColorID_TextSelectBackground, color);
+  GetColor(ColorID::TextSelectBackground, color);
   if (color == 0x000000) {
     mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
   } else {
     mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
   }
 
   mColorDarkText = GetColorFromUIColor([UIColor darkTextColor]);
 }
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -122,235 +122,235 @@ void nsLookAndFeel::RefreshImpl() {
 
 nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
   EnsureInit();
 
   nsresult res = NS_OK;
 
   int idx;
   switch (aID) {
-    case eColorID_WindowBackground:
+    case ColorID::WindowBackground:
       idx = COLOR_WINDOW;
       break;
-    case eColorID_WindowForeground:
+    case ColorID::WindowForeground:
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID_WidgetBackground:
+    case ColorID::WidgetBackground:
       idx = COLOR_BTNFACE;
       break;
-    case eColorID_WidgetForeground:
+    case ColorID::WidgetForeground:
       idx = COLOR_BTNTEXT;
       break;
-    case eColorID_WidgetSelectBackground:
+    case ColorID::WidgetSelectBackground:
       idx = COLOR_HIGHLIGHT;
       break;
-    case eColorID_WidgetSelectForeground:
+    case ColorID::WidgetSelectForeground:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
-    case eColorID_Widget3DHighlight:
+    case ColorID::Widget3DHighlight:
       idx = COLOR_BTNHIGHLIGHT;
       break;
-    case eColorID_Widget3DShadow:
+    case ColorID::Widget3DShadow:
       idx = COLOR_BTNSHADOW;
       break;
-    case eColorID_TextBackground:
+    case ColorID::TextBackground:
       idx = COLOR_WINDOW;
       break;
-    case eColorID_TextForeground:
+    case ColorID::TextForeground:
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID_TextSelectBackground:
-    case eColorID_IMESelectedRawTextBackground:
-    case eColorID_IMESelectedConvertedTextBackground:
+    case ColorID::TextSelectBackground:
+    case ColorID::IMESelectedRawTextBackground:
+    case ColorID::IMESelectedConvertedTextBackground:
       idx = COLOR_HIGHLIGHT;
       break;
-    case eColorID_TextSelectForeground:
-    case eColorID_IMESelectedRawTextForeground:
-    case eColorID_IMESelectedConvertedTextForeground:
+    case ColorID::TextSelectForeground:
+    case ColorID::IMESelectedRawTextForeground:
+    case ColorID::IMESelectedConvertedTextForeground:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
-    case eColorID_IMERawInputBackground:
-    case eColorID_IMEConvertedTextBackground:
+    case ColorID::IMERawInputBackground:
+    case ColorID::IMEConvertedTextBackground:
       aColor = NS_TRANSPARENT;
       return NS_OK;
-    case eColorID_IMERawInputForeground:
-    case eColorID_IMEConvertedTextForeground:
+    case ColorID::IMERawInputForeground:
+    case ColorID::IMEConvertedTextForeground:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       return NS_OK;
-    case eColorID_IMERawInputUnderline:
-    case eColorID_IMEConvertedTextUnderline:
+    case ColorID::IMERawInputUnderline:
+    case ColorID::IMEConvertedTextUnderline:
       aColor = NS_SAME_AS_FOREGROUND_COLOR;
       return NS_OK;
-    case eColorID_IMESelectedRawTextUnderline:
-    case eColorID_IMESelectedConvertedTextUnderline:
+    case ColorID::IMESelectedRawTextUnderline:
+    case ColorID::IMESelectedConvertedTextUnderline:
       aColor = NS_TRANSPARENT;
       return NS_OK;
-    case eColorID_SpellCheckerUnderline:
+    case ColorID::SpellCheckerUnderline:
       aColor = NS_RGB(0xff, 0, 0);
       return NS_OK;
 
     // New CSS 2 Color definitions
-    case eColorID_activeborder:
+    case ColorID::Activeborder:
       idx = COLOR_ACTIVEBORDER;
       break;
-    case eColorID_activecaption:
+    case ColorID::Activecaption:
       idx = COLOR_ACTIVECAPTION;
       break;
-    case eColorID_appworkspace:
+    case ColorID::Appworkspace:
       idx = COLOR_APPWORKSPACE;
       break;
-    case eColorID_background:
+    case ColorID::Background:
       idx = COLOR_BACKGROUND;
       break;
-    case eColorID_buttonface:
-    case eColorID__moz_buttonhoverface:
+    case ColorID::Buttonface:
+    case ColorID::MozButtonhoverface:
       idx = COLOR_BTNFACE;
       break;
-    case eColorID_buttonhighlight:
+    case ColorID::Buttonhighlight:
       idx = COLOR_BTNHIGHLIGHT;
       break;
-    case eColorID_buttonshadow:
+    case ColorID::Buttonshadow:
       idx = COLOR_BTNSHADOW;
       break;
-    case eColorID_buttontext:
-    case eColorID__moz_buttonhovertext:
+    case ColorID::Buttontext:
+    case ColorID::MozButtonhovertext:
       idx = COLOR_BTNTEXT;
       break;
-    case eColorID_captiontext:
+    case ColorID::Captiontext:
       idx = COLOR_CAPTIONTEXT;
       break;
-    case eColorID_graytext:
+    case ColorID::Graytext:
       idx = COLOR_GRAYTEXT;
       break;
-    case eColorID_highlight:
-    case eColorID__moz_html_cellhighlight:
-    case eColorID__moz_menuhover:
+    case ColorID::Highlight:
+    case ColorID::MozHtmlCellhighlight:
+    case ColorID::MozMenuhover:
       idx = COLOR_HIGHLIGHT;
       break;
-    case eColorID__moz_menubarhovertext:
+    case ColorID::MozMenubarhovertext:
       if (!IsAppThemed()) {
         idx = nsUXThemeData::sFlatMenus ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT;
         break;
       }
       // Fall through
-    case eColorID__moz_menuhovertext:
+    case ColorID::MozMenuhovertext:
       if (mHasColorMenuHoverText) {
         aColor = mColorMenuHoverText;
         return NS_OK;
       }
       // Fall through
-    case eColorID_highlighttext:
-    case eColorID__moz_html_cellhighlighttext:
+    case ColorID::Highlighttext:
+    case ColorID::MozHtmlCellhighlighttext:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
-    case eColorID_inactiveborder:
+    case ColorID::Inactiveborder:
       idx = COLOR_INACTIVEBORDER;
       break;
-    case eColorID_inactivecaption:
+    case ColorID::Inactivecaption:
       idx = COLOR_INACTIVECAPTION;
       break;
-    case eColorID_inactivecaptiontext:
+    case ColorID::Inactivecaptiontext:
       idx = COLOR_INACTIVECAPTIONTEXT;
       break;
-    case eColorID_infobackground:
+    case ColorID::Infobackground:
       idx = COLOR_INFOBK;
       break;
-    case eColorID_infotext:
+    case ColorID::Infotext:
       idx = COLOR_INFOTEXT;
       break;
-    case eColorID_menu:
+    case ColorID::Menu:
       idx = COLOR_MENU;
       break;
-    case eColorID_menutext:
-    case eColorID__moz_menubartext:
+    case ColorID::Menutext:
+    case ColorID::MozMenubartext:
       idx = COLOR_MENUTEXT;
       break;
-    case eColorID_scrollbar:
+    case ColorID::Scrollbar:
       idx = COLOR_SCROLLBAR;
       break;
-    case eColorID_threeddarkshadow:
+    case ColorID::Threeddarkshadow:
       idx = COLOR_3DDKSHADOW;
       break;
-    case eColorID_threedface:
+    case ColorID::Threedface:
       idx = COLOR_3DFACE;
       break;
-    case eColorID_threedhighlight:
+    case ColorID::Threedhighlight:
       idx = COLOR_3DHIGHLIGHT;
       break;
-    case eColorID_threedlightshadow:
+    case ColorID::Threedlightshadow:
       idx = COLOR_3DLIGHT;
       break;
-    case eColorID_threedshadow:
+    case ColorID::Threedshadow:
       idx = COLOR_3DSHADOW;
       break;
-    case eColorID_window:
+    case ColorID::Window:
       idx = COLOR_WINDOW;
       break;
-    case eColorID_windowframe:
+    case ColorID::Windowframe:
       idx = COLOR_WINDOWFRAME;
       break;
-    case eColorID_windowtext:
+    case ColorID::Windowtext:
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID__moz_eventreerow:
-    case eColorID__moz_oddtreerow:
-    case eColorID__moz_field:
-    case eColorID__moz_combobox:
+    case ColorID::MozEventreerow:
+    case ColorID::MozOddtreerow:
+    case ColorID::MozField:
+    case ColorID::MozCombobox:
       idx = COLOR_WINDOW;
       break;
-    case eColorID__moz_fieldtext:
-    case eColorID__moz_comboboxtext:
+    case ColorID::MozFieldtext:
+    case ColorID::MozComboboxtext:
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID__moz_dialog:
-    case eColorID__moz_cellhighlight:
+    case ColorID::MozDialog:
+    case ColorID::MozCellhighlight:
       idx = COLOR_3DFACE;
       break;
-    case eColorID__moz_win_accentcolor:
+    case ColorID::MozWinAccentcolor:
       if (mHasColorAccent) {
         aColor = mColorAccent;
       } else {
         // Seems to be the default color (hardcoded because of bug 1065998)
         aColor = NS_RGB(158, 158, 158);
       }
       return NS_OK;
-    case eColorID__moz_win_accentcolortext:
+    case ColorID::MozWinAccentcolortext:
       if (mHasColorAccentText) {
         aColor = mColorAccentText;
       } else {
         aColor = NS_RGB(0, 0, 0);
       }
       return NS_OK;
-    case eColorID__moz_win_mediatext:
+    case ColorID::MozWinMediatext:
       if (mHasColorMediaText) {
         aColor = mColorMediaText;
         return NS_OK;
       }
       // if we've gotten here just return -moz-dialogtext instead
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID__moz_win_communicationstext:
+    case ColorID::MozWinCommunicationstext:
       if (mHasColorCommunicationsText) {
         aColor = mColorCommunicationsText;
         return NS_OK;
       }
       // if we've gotten here just return -moz-dialogtext instead
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID__moz_dialogtext:
-    case eColorID__moz_cellhighlighttext:
+    case ColorID::MozDialogtext:
+    case ColorID::MozCellhighlighttext:
       idx = COLOR_WINDOWTEXT;
       break;
-    case eColorID__moz_dragtargetzone:
+    case ColorID::MozDragtargetzone:
       idx = COLOR_HIGHLIGHTTEXT;
       break;
-    case eColorID__moz_buttondefault:
+    case ColorID::MozButtondefault:
       idx = COLOR_3DDKSHADOW;
       break;
-    case eColorID__moz_nativehyperlinktext:
+    case ColorID::MozNativehyperlinktext:
       idx = COLOR_HOTLIGHT;
       break;
     default:
       NS_WARNING("Unknown color for nsLookAndFeel");
       idx = COLOR_WINDOW;
       res = NS_ERROR_FAILURE;
       break;
   }