Bug 1244049 - Part 1: Define scoped enum for CSSPseudoElement type. r=dbaron
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 16 Feb 2016 23:07:00 +0100
changeset 307704 4a020e2e4acec77f56e1ccea319765a7e18c74c9
parent 307703 e00a022829518b51d16563eba05bc06a5e0a73e8
child 307705 248497c0c18dea01a6b076483b9cd1f85621e2e8
push id9214
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:25:21 +0000
treeherdermozilla-aurora@8849dd1a4a79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1244049
milestone47.0a1
Bug 1244049 - Part 1: Define scoped enum for CSSPseudoElement type. r=dbaron
dom/animation/CSSPseudoElement.cpp
dom/animation/EffectCompositor.cpp
dom/animation/EffectSet.cpp
dom/animation/KeyframeEffect.cpp
dom/animation/PseudoElementHashEntry.h
dom/base/Element.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsNodeUtils.cpp
dom/smil/nsSMILCSSValueType.cpp
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSRendering.cpp
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsColorControlFrame.cpp
layout/forms/nsMeterFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsProgressFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsTextFrame.cpp
layout/inspector/inDOMUtils.cpp
layout/mathml/nsMathMLFrame.cpp
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/StyleAnimationValue.cpp
layout/style/StyleRule.cpp
layout/style/StyleRule.h
layout/style/nsCSSParser.cpp
layout/style/nsCSSPseudoElements.cpp
layout/style/nsCSSPseudoElements.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsRuleProcessorData.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleSet.cpp
layout/style/nsTransitionManager.cpp
--- a/dom/animation/CSSPseudoElement.cpp
+++ b/dom/animation/CSSPseudoElement.cpp
@@ -17,18 +17,18 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CSS
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CSSPseudoElement, Release)
 
 CSSPseudoElement::CSSPseudoElement(Element* aElement,
                                    nsCSSPseudoElements::Type aType)
   : mParentElement(aElement)
   , mPseudoType(aType)
 {
   MOZ_ASSERT(aElement);
-  MOZ_ASSERT(aType == nsCSSPseudoElements::ePseudo_after ||
-             aType == nsCSSPseudoElements::ePseudo_before,
+  MOZ_ASSERT(aType == CSSPseudoElementType::after ||
+             aType == CSSPseudoElementType::before,
              "Unexpected Pseudo Type");
 }
 
 CSSPseudoElement::~CSSPseudoElement()
 {
   // Element might have been unlinked already, so we have to do null check.
   if (mParentElement) {
     mParentElement->DeleteProperty(
@@ -95,20 +95,20 @@ CSSPseudoElement::GetCSSPseudoElement(El
   return pseudo.forget();
 }
 
 /* static */ nsIAtom*
 CSSPseudoElement::GetCSSPseudoElementPropertyAtom(
     nsCSSPseudoElements::Type aType)
 {
   switch (aType) {
-    case nsCSSPseudoElements::ePseudo_before:
+    case CSSPseudoElementType::before:
       return nsGkAtoms::cssPseudoElementBeforeProperty;
 
-    case nsCSSPseudoElements::ePseudo_after:
+    case CSSPseudoElementType::after:
       return nsGkAtoms::cssPseudoElementAfterProperty;
 
     default:
       NS_NOTREACHED("Should not try to get CSSPseudoElement "
                     "other than ::before or ::after");
       return nullptr;
   }
 }
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -278,28 +278,28 @@ EffectCompositor::GetAnimationRule(dom::
 
   return effectSet->AnimationRule(aCascadeLevel);
 }
 
 /* static */ dom::Element*
 EffectCompositor::GetElementToRestyle(dom::Element* aElement,
                                       nsCSSPseudoElements::Type aPseudoType)
 {
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+  if (aPseudoType == CSSPseudoElementType::NotPseudo) {
     return aElement;
   }
 
   nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
   if (!primaryFrame) {
     return nullptr;
   }
   nsIFrame* pseudoFrame;
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
+  if (aPseudoType == CSSPseudoElementType::before) {
     pseudoFrame = nsLayoutUtils::GetBeforeFrame(primaryFrame);
-  } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
+  } else if (aPseudoType == CSSPseudoElementType::after) {
     pseudoFrame = nsLayoutUtils::GetAfterFrame(primaryFrame);
   } else {
     NS_NOTREACHED("Should not try to get the element to restyle for a pseudo "
                   "other that :before or :after");
     return nullptr;
   }
   if (!pseudoFrame) {
     return nullptr;
@@ -492,28 +492,28 @@ EffectCompositor::GetAnimationElementAnd
   Maybe<Pair<Element*, nsCSSPseudoElements::Type>> result;
 
   nsIContent* content = aFrame->GetContent();
   if (!content) {
     return result;
   }
 
   nsCSSPseudoElements::Type pseudoType =
-    nsCSSPseudoElements::ePseudo_NotPseudoElement;
+    CSSPseudoElementType::NotPseudo;
 
   if (aFrame->IsGeneratedContentFrame()) {
     nsIFrame* parent = aFrame->GetParent();
     if (parent->IsGeneratedContentFrame()) {
       return result;
     }
     nsIAtom* name = content->NodeInfo()->NameAtom();
     if (name == nsGkAtoms::mozgeneratedcontentbefore) {
-      pseudoType = nsCSSPseudoElements::ePseudo_before;
+      pseudoType = CSSPseudoElementType::before;
     } else if (name == nsGkAtoms::mozgeneratedcontentafter) {
-      pseudoType = nsCSSPseudoElements::ePseudo_after;
+      pseudoType = CSSPseudoElementType::after;
     } else {
       return result;
     }
     content = content->GetParent();
     if (!content) {
       return result;
     }
   } else {
@@ -758,30 +758,30 @@ EffectCompositor::AnimationStyleRuleProc
 }
 
 void
 EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
   ElementRuleProcessorData* aData)
 {
   nsIStyleRule *rule =
     mCompositor->GetAnimationRule(aData->mElement,
-                                  nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                                  CSSPseudoElementType::NotPseudo,
                                   mCascadeLevel);
   if (rule) {
     aData->mRuleWalker->Forward(rule);
     aData->mRuleWalker->CurrentNode()->SetIsAnimationRule();
   }
 }
 
 void
 EffectCompositor::AnimationStyleRuleProcessor::RulesMatching(
   PseudoElementRuleProcessorData* aData)
 {
-  if (aData->mPseudoType != nsCSSPseudoElements::ePseudo_before &&
-      aData->mPseudoType != nsCSSPseudoElements::ePseudo_after) {
+  if (aData->mPseudoType != CSSPseudoElementType::before &&
+      aData->mPseudoType != CSSPseudoElementType::after) {
     return;
   }
 
   nsIStyleRule *rule =
     mCompositor->GetAnimationRule(aData->mElement,
                                   aData->mPseudoType,
                                   mCascadeLevel);
   if (rule) {
--- a/dom/animation/EffectSet.cpp
+++ b/dom/animation/EffectSet.cpp
@@ -150,23 +150,23 @@ EffectSet::GetEffectSetPropertyAtoms()
 
   return effectSetPropertyAtoms;
 }
 
 /* static */ nsIAtom*
 EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
 {
   switch (aPseudoType) {
-    case nsCSSPseudoElements::ePseudo_NotPseudoElement:
+    case CSSPseudoElementType::NotPseudo:
       return nsGkAtoms::animationEffectsProperty;
 
-    case nsCSSPseudoElements::ePseudo_before:
+    case CSSPseudoElementType::before:
       return nsGkAtoms::animationEffectsForBeforeProperty;
 
-    case nsCSSPseudoElements::ePseudo_after:
+    case CSSPseudoElementType::after:
       return nsGkAtoms::animationEffectsForAfterProperty;
 
     default:
       NS_NOTREACHED("Should not try to get animation effects for a pseudo "
                     "other that :before or :after");
       return nullptr;
   }
 }
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -619,18 +619,17 @@ KeyframeEffectReadOnly::ConstructKeyfram
     return nullptr;
   }
 
   const ElementOrCSSPseudoElement& target = aTarget.Value();
   MOZ_ASSERT(target.IsElement() || target.IsCSSPseudoElement(),
              "Uninitialized target");
 
   RefPtr<Element> targetElement;
-  nsCSSPseudoElements::Type pseudoType =
-    nsCSSPseudoElements::ePseudo_NotPseudoElement;
+  nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::NotPseudo;
   if (target.IsElement()) {
     targetElement = &target.GetAsElement();
   } else {
     targetElement = target.GetAsCSSPseudoElement().ParentElement();
     pseudoType = target.GetAsCSSPseudoElement().GetType();
   }
 
   if (!targetElement->GetComposedDoc()) {
@@ -1716,23 +1715,23 @@ KeyframeEffectReadOnly::GetTarget(
     Nullable<OwningElementOrCSSPseudoElement>& aRv) const
 {
   if (!mTarget) {
     aRv.SetNull();
     return;
   }
 
   switch (mPseudoType) {
-    case nsCSSPseudoElements::ePseudo_before:
-    case nsCSSPseudoElements::ePseudo_after:
+    case CSSPseudoElementType::before:
+    case CSSPseudoElementType::after:
       aRv.SetValue().SetAsCSSPseudoElement() =
         CSSPseudoElement::GetCSSPseudoElement(mTarget, mPseudoType);
       break;
 
-    case nsCSSPseudoElements::ePseudo_NotPseudoElement:
+    case CSSPseudoElementType::NotPseudo:
       aRv.SetValue().SetAsElement() = mTarget;
       break;
 
     default:
       NS_NOTREACHED("Animation of unsupported pseudo-type");
       aRv.SetNull();
   }
 }
@@ -1970,22 +1969,22 @@ KeyframeEffectReadOnly::GetAnimationFram
     return nullptr;
   }
 
   nsIFrame* frame = mTarget->GetPrimaryFrame();
   if (!frame) {
     return nullptr;
   }
 
-  if (mPseudoType == nsCSSPseudoElements::ePseudo_before) {
+  if (mPseudoType == CSSPseudoElementType::before) {
     frame = nsLayoutUtils::GetBeforeFrame(frame);
-  } else if (mPseudoType == nsCSSPseudoElements::ePseudo_after) {
+  } else if (mPseudoType == CSSPseudoElementType::after) {
     frame = nsLayoutUtils::GetAfterFrame(frame);
   } else {
-    MOZ_ASSERT(mPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
+    MOZ_ASSERT(mPseudoType == CSSPseudoElementType::NotPseudo,
                "unknown mPseudoType");
   }
   if (!frame) {
     return nullptr;
   }
 
   return nsLayoutUtils::GetStyleFrame(frame);
 }
--- a/dom/animation/PseudoElementHashEntry.h
+++ b/dom/animation/PseudoElementHashEntry.h
@@ -42,17 +42,19 @@ public:
   }
 
   static KeyTypePointer KeyToPointer(KeyType& aKey) { return &aKey; }
   static PLDHashNumber HashKey(KeyTypePointer aKey)
   {
     if (!aKey)
       return 0;
 
-    return mozilla::HashGeneric(aKey->mElement, aKey->mPseudoType);
+    // Convert the scoped enum into an integer while adding it to hash.
+    return mozilla::HashGeneric(aKey->mElement,
+                                static_cast<uint8_t>(aKey->mPseudoType));
   }
   enum { ALLOW_MEMMOVE = true };
 
   RefPtr<dom::Element> mElement;
   nsCSSPseudoElements::Type mPseudoType;
 };
 
 } // namespace mozilla
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3363,17 +3363,17 @@ Element::GetAnimations(nsTArray<RefPtr<A
   GetAnimationsUnsorted(aAnimations);
   aAnimations.Sort(AnimationPtrComparator<RefPtr<Animation>>());
 }
 
 void
 Element::GetAnimationsUnsorted(nsTArray<RefPtr<Animation>>& aAnimations)
 {
   EffectSet* effects = EffectSet::GetEffectSet(this,
-                         nsCSSPseudoElements::ePseudo_NotPseudoElement);
+                                               CSSPseudoElementType::NotPseudo);
   if (!effects) {
     return;
   }
 
   for (KeyframeEffectReadOnly* effect : *effects) {
     MOZ_ASSERT(effect && effect->GetAnimation(),
                "Only effects associated with an animation should be "
                "added to an element's effect set");
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2242,23 +2242,22 @@ nsDOMWindowUtils::BeginTabSwitch()
 
 static bool
 ComputeAnimationValue(nsCSSProperty aProperty,
                       Element* aElement,
                       const nsAString& aInput,
                       StyleAnimationValue& aOutput)
 {
 
-  if (!StyleAnimationValue::ComputeValue(
-        aProperty,
-        aElement,
-        nsCSSPseudoElements::ePseudo_NotPseudoElement,
-        aInput,
-        false,
-        aOutput)) {
+  if (!StyleAnimationValue::ComputeValue(aProperty,
+                                         aElement,
+                                         CSSPseudoElementType::NotPseudo,
+                                         aInput,
+                                         false,
+                                         aOutput)) {
     return false;
   }
 
   // This matches TransExtractComputedValue in nsTransitionManager.cpp.
   if (aProperty == eCSSProperty_visibility) {
     MOZ_ASSERT(aOutput.GetUnit() == StyleAnimationValue::eUnit_Enumerated,
                "unexpected unit");
     aOutput.SetIntValue(aOutput.GetIntValue(),
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -236,17 +236,17 @@ nsNodeUtils::GetTargetForAnimation(const
 
   Element* target;
   nsCSSPseudoElements::Type pseudoType;
   effect->GetTarget(target, pseudoType);
 
   // If the animation targets a pseudo-element, we don't dispatch
   // notifications for it.  (In the future we will have PseudoElement
   // objects we can use as the target of the notifications.)
-  if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+  if (pseudoType != CSSPseudoElementType::NotPseudo) {
     return nullptr;
   }
 
   return target;
 }
 
 void
 nsNodeUtils::AnimationAdded(Animation* aAnimation)
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -355,24 +355,23 @@ ValueFromStringHelper(nsCSSProperty aPro
   if (aPropID != eCSSProperty_stroke_dasharray) {
     int32_t absValuePos = nsSMILParserUtils::CheckForNegativeNumber(aString);
     if (absValuePos > 0) {
       isNegative = true;
       subStringBegin = (uint32_t)absValuePos; // Start parsing after '-' sign
     }
   }
   nsDependentSubstring subString(aString, subStringBegin);
-  if (!StyleAnimationValue::ComputeValue(
-        aPropID,
-        aTargetElement,
-        nsCSSPseudoElements::ePseudo_NotPseudoElement,
-        subString,
-        true,
-        aStyleAnimValue,
-        aIsContextSensitive)) {
+  if (!StyleAnimationValue::ComputeValue(aPropID,
+                                         aTargetElement,
+                                         CSSPseudoElementType::NotPseudo,
+                                         subString,
+                                         true,
+                                         aStyleAnimValue,
+                                         aIsContextSensitive)) {
     return false;
   }
   if (isNegative) {
     InvertSign(aStyleAnimValue);
   }
 
   if (aPropID == eCSSProperty_font_size) {
     // Divide out text-zoom, since SVG is supposed to ignore it
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1100,21 +1100,21 @@ RestyleManager::AnimationsWithDestroyedF
              "shouldn't construct recursively");
   mRestyleManager->mAnimationsWithDestroyedFrame = this;
 }
 
 void
 RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsForElementsWithoutFrames()
 {
   StopAnimationsWithoutFrame(mContents,
-    nsCSSPseudoElements::ePseudo_NotPseudoElement);
+    CSSPseudoElementType::NotPseudo);
   StopAnimationsWithoutFrame(mBeforeContents,
-    nsCSSPseudoElements::ePseudo_before);
+    CSSPseudoElementType::before);
   StopAnimationsWithoutFrame(mAfterContents,
-    nsCSSPseudoElements::ePseudo_after);
+    CSSPseudoElementType::after);
 }
 
 void
 RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsWithoutFrame(
   nsTArray<RefPtr<nsIContent>>& aArray,
   nsCSSPseudoElements::Type aPseudoType)
 {
   nsAnimationManager* animationManager =
@@ -1155,17 +1155,17 @@ RestyleManager::ContentStateChanged(nsIC
   // Any change to a content state that affects which frames we construct
   // must lead to a frame reconstruct here if we already have a frame.
   // Note that we never decide through non-CSS means to not create frames
   // based on content states, so if we already don't have a frame we don't
   // need to force a reframe -- if it's needed, the HasStateDependentStyle
   // call will handle things.
   nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
   nsCSSPseudoElements::Type pseudoType =
-    nsCSSPseudoElements::ePseudo_NotPseudoElement;
+    CSSPseudoElementType::NotPseudo;
   if (primaryFrame) {
     // If it's generated content, ignore LOADING/etc state changes on it.
     if (!primaryFrame->IsGeneratedContentFrame() &&
         aStateMask.HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
                                          NS_EVENT_STATE_USERDISABLED |
                                          NS_EVENT_STATE_SUPPRESSED |
                                          NS_EVENT_STATE_LOADING)) {
       hint = nsChangeHint_ReconstructFrame;
@@ -1187,17 +1187,17 @@ RestyleManager::ContentStateChanged(nsIC
     pseudoType = primaryFrame->StyleContext()->GetPseudoType();
 
     primaryFrame->ContentStatesChanged(aStateMask);
   }
 
 
   nsRestyleHint rshint;
 
-  if (pseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
+  if (pseudoType >= CSSPseudoElementType::Count) {
     rshint = styleSet->HasStateDependentStyle(aElement, aStateMask);
   } else if (nsCSSPseudoElements::PseudoElementSupportsUserActionState(
                                                                   pseudoType)) {
     // If aElement is a pseudo-element, we want to check to see whether there
     // are any state-dependent rules applying to that pseudo.
     Element* ancestor = ElementForStyleContext(nullptr, primaryFrame,
                                                pseudoType);
     rshint = styleSet->HasStateDependentStyle(ancestor, pseudoType, aElement,
@@ -2127,54 +2127,54 @@ RestyleManager::TryStartingTransition(ns
 }
 
 static dom::Element*
 ElementForStyleContext(nsIContent* aParentContent,
                        nsIFrame* aFrame,
                        nsCSSPseudoElements::Type aPseudoType)
 {
   // We don't expect XUL tree stuff here.
-  NS_PRECONDITION(aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-                  aPseudoType == nsCSSPseudoElements::ePseudo_AnonBox ||
-                  aPseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
+  NS_PRECONDITION(aPseudoType == CSSPseudoElementType::NotPseudo ||
+                  aPseudoType == CSSPseudoElementType::AnonBox ||
+                  aPseudoType < CSSPseudoElementType::Count,
                   "Unexpected pseudo");
   // XXX see the comments about the various element confusion in
   // ElementRestyler::Restyle.
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+  if (aPseudoType == CSSPseudoElementType::NotPseudo) {
     return aFrame->GetContent()->AsElement();
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
+  if (aPseudoType == CSSPseudoElementType::AnonBox) {
     return nullptr;
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter) {
+  if (aPseudoType == CSSPseudoElementType::firstLetter) {
     NS_ASSERTION(aFrame->GetType() == nsGkAtoms::letterFrame,
                  "firstLetter pseudoTag without a nsFirstLetterFrame");
     nsBlockFrame* block = nsBlockFrame::GetNearestAncestorBlock(aFrame);
     return block->GetContent()->AsElement();
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_mozColorSwatch) {
+  if (aPseudoType == CSSPseudoElementType::mozColorSwatch) {
     MOZ_ASSERT(aFrame->GetParent() &&
                aFrame->GetParent()->GetParent(),
                "Color swatch frame should have a parent & grandparent");
 
     nsIFrame* grandparentFrame = aFrame->GetParent()->GetParent();
     MOZ_ASSERT(grandparentFrame->GetType() == nsGkAtoms::colorControlFrame,
                "Color swatch's grandparent should be nsColorControlFrame");
 
     return grandparentFrame->GetContent()->AsElement();
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberText ||
-      aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberWrapper ||
-      aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox ||
-      aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp ||
-      aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown) {
+  if (aPseudoType == CSSPseudoElementType::mozNumberText ||
+      aPseudoType == CSSPseudoElementType::mozNumberWrapper ||
+      aPseudoType == CSSPseudoElementType::mozNumberSpinBox ||
+      aPseudoType == CSSPseudoElementType::mozNumberSpinUp ||
+      aPseudoType == CSSPseudoElementType::mozNumberSpinDown) {
     // Get content for nearest nsNumberControlFrame:
     nsIFrame* f = aFrame->GetParent();
     MOZ_ASSERT(f);
     while (f->GetType() != nsGkAtoms::numberControlFrame) {
       f = f->GetParent();
       MOZ_ASSERT(f);
     }
     return f->GetContent()->AsElement();
@@ -2198,17 +2198,17 @@ ElementForStyleContext(nsIContent* aPare
  * addition to the element that the pseudo-element is for; in other
  * cases we should pass null instead.  This function returns the
  * pseudo-element content that we should pass.
  */
 static dom::Element*
 PseudoElementForStyleContext(nsIFrame* aFrame,
                              nsCSSPseudoElements::Type aPseudoType)
 {
-  if (aPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
+  if (aPseudoType >= CSSPseudoElementType::Count) {
     return nullptr;
   }
 
   if (nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
       nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType)) {
     return aFrame->GetContent()->AsElement();
   }
 
@@ -3937,17 +3937,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
                    "not the real element");
         LOG_RESTYLE("resolving style with replacement");
         nsRestyleHint rshint = aRestyleHint & ~eRestyle_SomeDescendants;
         newContext =
           styleSet->ResolveStyleWithReplacement(element, pseudoElement,
                                                 parentContext, oldContext,
                                                 rshint);
       }
-    } else if (pseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
+    } else if (pseudoType == CSSPseudoElementType::AnonBox) {
       newContext = styleSet->ResolveAnonymousBoxStyle(pseudoTag,
                                                       parentContext);
     }
     else {
       if (pseudoTag) {
         if (pseudoTag == nsCSSPseudoElements::before ||
             pseudoTag == nsCSSPseudoElements::after) {
           // XXX what other pseudos do we need to treat like this?
@@ -3972,17 +3972,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
               oldContext->AddStyleBit(NS_STYLE_IS_GOING_AWAY);
             }
 #endif
           }
         } else {
           // Don't expect XUL tree stuff here, since it needs a comparator and
           // all.
           NS_ASSERTION(pseudoType <
-                         nsCSSPseudoElements::ePseudo_PseudoElementCount,
+                         CSSPseudoElementType::Count,
                        "Unexpected pseudo type");
           Element* pseudoElement =
             PseudoElementForStyleContext(aSelf, pseudoType);
           MOZ_ASSERT(element != pseudoElement,
                      "pseudo-element for selector matching should be "
                      "the anonymous content node that we create, "
                      "not the real element");
           newContext = styleSet->ResolvePseudoElementStyle(element,
@@ -4258,17 +4258,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
     LOG_RESTYLE_INDENT();
     RefPtr<nsStyleContext> newExtraContext;
     nsIAtom* const extraPseudoTag = oldExtraContext->GetPseudo();
     const nsCSSPseudoElements::Type extraPseudoType =
       oldExtraContext->GetPseudoType();
     NS_ASSERTION(extraPseudoTag &&
                  extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
                  "extra style context is not pseudo element");
-    Element* element = extraPseudoType != nsCSSPseudoElements::ePseudo_AnonBox
+    Element* element = extraPseudoType != CSSPseudoElementType::AnonBox
                          ? mContent->AsElement() : nullptr;
     if (!MustRestyleSelf(aRestyleHint, element)) {
       if (CanReparentStyleContext(aRestyleHint)) {
         newExtraContext =
           styleSet->ReparentStyleContext(oldExtraContext, newContext, element);
       } else {
         // Use ResolveStyleWithReplacement as a substitute for
         // ReparentStyleContext that rebuilds the path in the rule tree
@@ -4280,24 +4280,23 @@ ElementRestyler::RestyleSelf(nsIFrame* a
                    "pseudo-element for selector matching should be "
                    "the anonymous content node that we create, "
                    "not the real element");
         newExtraContext =
           styleSet->ResolveStyleWithReplacement(element, pseudoElement,
                                                 newContext, oldExtraContext,
                                                 nsRestyleHint(0));
       }
-    } else if (extraPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
+    } else if (extraPseudoType == CSSPseudoElementType::AnonBox) {
       newExtraContext = styleSet->ResolveAnonymousBoxStyle(extraPseudoTag,
                                                            newContext);
     } else {
       // Don't expect XUL tree stuff here, since it needs a comparator and
       // all.
-      NS_ASSERTION(extraPseudoType <
-                     nsCSSPseudoElements::ePseudo_PseudoElementCount,
+      NS_ASSERTION(extraPseudoType < CSSPseudoElementType::Count,
                    "Unexpected type");
       newExtraContext = styleSet->ResolvePseudoElementStyle(mContent->AsElement(),
                                                             extraPseudoType,
                                                             newContext,
                                                             nullptr);
     }
 
     MOZ_ASSERT(newExtraContext);
@@ -4396,21 +4395,21 @@ ElementRestyler::RestyleChildrenOfDispla
   nsRestyleHint          aRestyleHint,
   const RestyleHintData& aRestyleHintData)
 {
   MOZ_ASSERT(!(mHintsHandled & nsChangeHint_ReconstructFrame), "why call me?");
 
   const bool mightReframePseudos = aRestyleHint & eRestyle_Subtree;
   DoRestyleUndisplayedDescendants(nsRestyleHint(0), mContent, aNewContext);
   if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
-    MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
+    MaybeReframeForPseudo(CSSPseudoElementType::before,
                           aParentFrame, nullptr, mContent, aNewContext);
   }
   if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
-    MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
+    MaybeReframeForPseudo(CSSPseudoElementType::after,
                           aParentFrame, nullptr, mContent, aNewContext);
   }
   if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
     InitializeAccessibilityNotifications(aNewContext);
 
     // Then process child frames for content that is a descendant of mContent.
     // XXX perhaps it's better to walk child frames (before reresolving
     // XXX undisplayed contexts above) and mark those that has a stylecontext
@@ -4641,48 +4640,48 @@ ElementRestyler::RestyleUndisplayedNodes
       }
     }
   }
 }
 
 void
 ElementRestyler::MaybeReframeForBeforePseudo()
 {
-  MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
+  MaybeReframeForPseudo(CSSPseudoElementType::before,
                         mFrame, mFrame, mFrame->GetContent(),
                         mFrame->StyleContext());
 }
 
 /**
  * aFrame is the last continuation or block-in-inline sibling that this
  * ElementRestyler is restyling.
  */
 void
 ElementRestyler::MaybeReframeForAfterPseudo(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame);
-  MaybeReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
+  MaybeReframeForPseudo(CSSPseudoElementType::after,
                         aFrame, aFrame, aFrame->GetContent(),
                         aFrame->StyleContext());
 }
 
 #ifdef DEBUG
 bool
 ElementRestyler::MustReframeForBeforePseudo()
 {
-  return MustReframeForPseudo(nsCSSPseudoElements::ePseudo_before,
+  return MustReframeForPseudo(CSSPseudoElementType::before,
                               mFrame, mFrame, mFrame->GetContent(),
                               mFrame->StyleContext());
 }
 
 bool
 ElementRestyler::MustReframeForAfterPseudo(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame);
-  return MustReframeForPseudo(nsCSSPseudoElements::ePseudo_after,
+  return MustReframeForPseudo(CSSPseudoElementType::after,
                               aFrame, aFrame, aFrame->GetContent(),
                               aFrame->StyleContext());
 }
 #endif
 
 void
 ElementRestyler::MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
                                        nsIFrame* aGenConParentFrame,
@@ -4702,34 +4701,34 @@ ElementRestyler::MaybeReframeForPseudo(n
 
 bool
 ElementRestyler::MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
                                       nsIFrame* aGenConParentFrame,
                                       nsIFrame* aFrame,
                                       nsIContent* aContent,
                                       nsStyleContext* aStyleContext)
 {
-  MOZ_ASSERT(aPseudoType == nsCSSPseudoElements::ePseudo_before ||
-             aPseudoType == nsCSSPseudoElements::ePseudo_after);
+  MOZ_ASSERT(aPseudoType == CSSPseudoElementType::before ||
+             aPseudoType == CSSPseudoElementType::after);
 
   // Make sure not to do this for pseudo-frames...
   if (aStyleContext->GetPseudo()) {
     return false;
   }
 
   // ... or frames that can't have generated content.
   if (!(aGenConParentFrame->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)) {
     // Our content insertion frame might have gotten flagged.
     nsContainerFrame* cif = aGenConParentFrame->GetContentInsertionFrame();
     if (!cif || !(cif->GetStateBits() & NS_FRAME_MAY_HAVE_GENERATED_CONTENT)) {
       return false;
     }
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
+  if (aPseudoType == CSSPseudoElementType::before) {
     // Check for a ::before pseudo style and the absence of a ::before content,
     // but only if aFrame is null or is the first continuation/ib-split.
     if ((aFrame && !nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) ||
         nsLayoutUtils::GetBeforeFrameForContent(aGenConParentFrame, aContent)) {
       return false;
     }
   } else {
     // Similarly for ::after, but check for being the last continuation/
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -187,38 +187,38 @@ public:
      * method of RestyleManager.)
      */
     explicit ReframingStyleContexts(RestyleManager* aRestyleManager);
     ~ReframingStyleContexts();
 
     void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
       MOZ_ASSERT(aContent);
       nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
-      if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+      if (pseudoType == CSSPseudoElementType::NotPseudo) {
         mElementContexts.Put(aContent, aStyleContext);
-      } else if (pseudoType == nsCSSPseudoElements::ePseudo_before) {
+      } else if (pseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         mBeforePseudoContexts.Put(aContent->GetParent(), aStyleContext);
-      } else if (pseudoType == nsCSSPseudoElements::ePseudo_after) {
+      } else if (pseudoType == CSSPseudoElementType::after) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
         mAfterPseudoContexts.Put(aContent->GetParent(), aStyleContext);
       }
     }
 
     nsStyleContext* Get(nsIContent* aContent,
                         nsCSSPseudoElements::Type aPseudoType) {
       MOZ_ASSERT(aContent);
-      if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+      if (aPseudoType == CSSPseudoElementType::NotPseudo) {
         return mElementContexts.GetWeak(aContent);
       }
-      if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
+      if (aPseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         return mBeforePseudoContexts.GetWeak(aContent->GetParent());
       }
-      if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
+      if (aPseudoType == CSSPseudoElementType::after) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
         return mAfterPseudoContexts.GetWeak(aContent->GetParent());
       }
       MOZ_ASSERT(false, "unexpected aPseudoType");
       return nullptr;
     }
   private:
     RestyleManager* mRestyleManager;
@@ -265,22 +265,22 @@ public:
     }
 
     // This method takes the content node for the generated content for
     // animation on ::before and ::after, rather than the content node for
     // the real element.
     void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
       MOZ_ASSERT(aContent);
       nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
-      if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+      if (pseudoType == CSSPseudoElementType::NotPseudo) {
         mContents.AppendElement(aContent);
-      } else if (pseudoType == nsCSSPseudoElements::ePseudo_before) {
+      } else if (pseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         mBeforeContents.AppendElement(aContent->GetParent());
-      } else if (pseudoType == nsCSSPseudoElements::ePseudo_after) {
+      } else if (pseudoType == CSSPseudoElementType::after) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
         mAfterContents.AppendElement(aContent->GetParent());
       }
     }
 
     void StopAnimationsForElementsWithoutFrames();
 
   private:
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1755,18 +1755,18 @@ nsCSSFrameConstructor::CreateGeneratedCo
 void
 nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aState,
                                                   nsContainerFrame* aParentFrame,
                                                   nsIContent*      aParentContent,
                                                   nsStyleContext*  aStyleContext,
                                                   nsCSSPseudoElements::Type aPseudoElement,
                                                   FrameConstructionItemList& aItems)
 {
-  MOZ_ASSERT(aPseudoElement == nsCSSPseudoElements::ePseudo_before ||
-             aPseudoElement == nsCSSPseudoElements::ePseudo_after,
+  MOZ_ASSERT(aPseudoElement == CSSPseudoElementType::before ||
+             aPseudoElement == CSSPseudoElementType::after,
              "unexpected aPseudoElement");
 
   // XXXbz is this ever true?
   if (!aParentContent->IsElement()) {
     NS_ERROR("Bogus generated content parent");
     return;
   }
 
@@ -1777,17 +1777,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
   pseudoStyleContext =
     styleSet->ProbePseudoElementStyle(aParentContent->AsElement(),
                                       aPseudoElement,
                                       aStyleContext,
                                       aState.mTreeMatchContext);
   if (!pseudoStyleContext)
     return;
 
-  bool isBefore = aPseudoElement == nsCSSPseudoElements::ePseudo_before;
+  bool isBefore = aPseudoElement == CSSPseudoElementType::before;
 
   // |ProbePseudoStyleFor| checked the 'display' property and the
   // |ContentCount()| of the 'content' property for us.
   RefPtr<NodeInfo> nodeInfo;
   nsIAtom* elemName = isBefore ?
     nsGkAtoms::mozgeneratedcontentbefore : nsGkAtoms::mozgeneratedcontentafter;
   nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(elemName, nullptr,
                                                        kNameSpaceID_None,
@@ -2956,17 +2956,17 @@ nsCSSFrameConstructor::CreateBackdropFra
   nsContainerFrame* frame = do_QueryFrame(aFrame);
   if (!frame) {
     NS_WARNING("Cannot create backdrop frame for non-container frame");
     return nullptr;
   }
 
   RefPtr<nsStyleContext> style = aPresShell->StyleSet()->
     ResolvePseudoElementStyle(aContent->AsElement(),
-                              nsCSSPseudoElements::ePseudo_backdrop,
+                              CSSPseudoElementType::backdrop,
                               /* aParentStyleContext */ nullptr,
                               /* aPseudoElement */ nullptr);
   nsBackdropFrame* backdropFrame = new (aPresShell) nsBackdropFrame(style);
   backdropFrame->Init(aContent, aParentFrame, nullptr);
 
   nsIFrame* placeholder = CreatePlaceholderFrameFor(aPresShell, aContent,
                                                     backdropFrame,
                                                     frame->StyleContext(),
@@ -4917,25 +4917,25 @@ nsCSSFrameConstructor::ResolveStyleConte
                  "comments and processing instructions");
     result = styleSet->ResolveStyleForNonElement(aParentStyleContext);
   }
 
   RestyleManager::ReframingStyleContexts* rsc =
     RestyleManager()->GetReframingStyleContexts();
   if (rsc) {
     nsStyleContext* oldStyleContext =
-      rsc->Get(aContent, nsCSSPseudoElements::ePseudo_NotPseudoElement);
+      rsc->Get(aContent, CSSPseudoElementType::NotPseudo);
     nsPresContext* presContext = mPresShell->GetPresContext();
     if (oldStyleContext) {
       RestyleManager::TryStartingTransition(presContext, aContent,
                                             oldStyleContext, &result);
     } else if (aContent->IsElement()) {
       presContext->TransitionManager()->
         PruneCompletedTransitions(aContent->AsElement(),
-          nsCSSPseudoElements::ePseudo_NotPseudoElement, result);
+          CSSPseudoElementType::NotPseudo, result);
     }
   }
 
   return result.forget();
 }
 
 // MathML Mod - RBS
 void
@@ -5758,17 +5758,17 @@ nsCSSFrameConstructor::AddFrameConstruct
     } else {
       ancestorPusher.PushStyleScope(aContent->AsElement());
     }
 
     if (aParentFrame) {
       aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
     }
     CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
-                               nsCSSPseudoElements::ePseudo_before, aItems);
+                               CSSPseudoElementType::before, aItems);
 
     FlattenedChildIterator iter(aContent);
     for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
       if (!ShouldCreateItemsForChild(aState, child, aParentFrame)) {
         continue;
       }
 
       // Get the parent of the content and check if it is a XBL children element
@@ -5791,17 +5791,17 @@ nsCSSFrameConstructor::AddFrameConstruct
         ResolveStyleContext(styleContext, child, &aState);
       DoAddFrameConstructionItems(aState, child, childContext,
                                   aSuppressWhiteSpaceOptimizations,
                                   aParentFrame, aAnonChildren, aItems);
     }
     aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved());
 
     CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext,
-                               nsCSSPseudoElements::ePseudo_after, aItems);
+                               CSSPseudoElementType::after, aItems);
     if (canHavePageBreak && display->mBreakAfter) {
       AddPageBreakItem(aContent, aStyleContext, aItems);
     }
     return;
   }
 
   FrameConstructionItem* item =
     aItems.AppendItem(data, aContent, aTag, aNameSpaceID,
@@ -6165,17 +6165,17 @@ AdjustAppendParentForAfterContent(nsFram
 {
   // If the parent frame has any pseudo-elements or aContainer is a
   // display:contents node then we need to walk through the child
   // frames to find the first one that is either a ::after frame for an
   // ancestor of aChild or a frame that is for a node later in the
   // document than aChild and return that in aAfterFrame.
   if (aParentFrame->GetGenConPseudos() ||
       nsLayoutUtils::HasPseudoStyle(aContainer, aParentFrame->StyleContext(),
-                                    nsCSSPseudoElements::ePseudo_after,
+                                    CSSPseudoElementType::after,
                                     aParentFrame->PresContext()) ||
       aFrameManager->GetDisplayContentsStyleFor(aContainer)) {
     nsIFrame* afterFrame = nullptr;
     nsContainerFrame* parent =
       static_cast<nsContainerFrame*>(aParentFrame->LastContinuation());
     bool done = false;
     while (!done && parent) {
       // Ensure that all normal flow children are on the principal child list.
@@ -9551,45 +9551,45 @@ nsCSSFrameConstructor::DestroyFramesFor(
 
 already_AddRefed<nsStyleContext>
 nsCSSFrameConstructor::GetFirstLetterStyle(nsIContent* aContent,
                                            nsStyleContext* aStyleContext)
 {
   if (aContent) {
     return mPresShell->StyleSet()->
       ResolvePseudoElementStyle(aContent->AsElement(),
-                                nsCSSPseudoElements::ePseudo_firstLetter,
+                                CSSPseudoElementType::firstLetter,
                                 aStyleContext,
                                 nullptr);
   }
   return nullptr;
 }
 
 already_AddRefed<nsStyleContext>
 nsCSSFrameConstructor::GetFirstLineStyle(nsIContent* aContent,
                                          nsStyleContext* aStyleContext)
 {
   if (aContent) {
     return mPresShell->StyleSet()->
       ResolvePseudoElementStyle(aContent->AsElement(),
-                                nsCSSPseudoElements::ePseudo_firstLine,
+                                CSSPseudoElementType::firstLine,
                                 aStyleContext,
                                 nullptr);
   }
   return nullptr;
 }
 
 // Predicate to see if a given content (block element) has
 // first-letter style applied to it.
 bool
 nsCSSFrameConstructor::ShouldHaveFirstLetterStyle(nsIContent* aContent,
                                                   nsStyleContext* aStyleContext)
 {
   return nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
-                                       nsCSSPseudoElements::ePseudo_firstLetter,
+                                       CSSPseudoElementType::firstLetter,
                                        mPresShell->GetPresContext());
 }
 
 bool
 nsCSSFrameConstructor::HasFirstLetterStyle(nsIFrame* aBlockFrame)
 {
   NS_PRECONDITION(aBlockFrame, "Need a frame");
   NS_ASSERTION(nsLayoutUtils::GetAsBlock(aBlockFrame),
@@ -9599,17 +9599,17 @@ nsCSSFrameConstructor::HasFirstLetterSty
 }
 
 bool
 nsCSSFrameConstructor::ShouldHaveFirstLineStyle(nsIContent* aContent,
                                                 nsStyleContext* aStyleContext)
 {
   bool hasFirstLine =
     nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
-                                  nsCSSPseudoElements::ePseudo_firstLine,
+                                  CSSPseudoElementType::firstLine,
                                   mPresShell->GetPresContext());
   if (hasFirstLine) {
     // But disable for fieldsets
     int32_t namespaceID;
     nsIAtom* tag = mDocument->BindingManager()->ResolveTag(aContent,
                                                            &namespaceID);
     // This check must match the one in FindHTMLData.
     hasFirstLine = tag != nsGkAtoms::fieldset ||
@@ -10527,17 +10527,17 @@ nsCSSFrameConstructor::ProcessChildren(n
     nsStyleContext* styleContext;
 
     if (aCanHaveGeneratedContent) {
       aFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
       styleContext =
         nsFrame::CorrectStyleParentFrame(aFrame, nullptr)->StyleContext();
       // Probe for generated content before
       CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
-                                 nsCSSPseudoElements::ePseudo_before,
+                                 CSSPseudoElementType::before,
                                  itemsToConstruct);
     }
 
     const bool addChildItems = MOZ_LIKELY(mCurrentDepth < kMaxDepth);
     if (!addChildItems) {
       NS_WARNING("ProcessChildren max depth exceeded");
     }
 
@@ -10575,17 +10575,17 @@ nsCSSFrameConstructor::ProcessChildren(n
         ClearLazyBits(child, child->GetNextSibling());
       }
     }
     itemsToConstruct.SetParentHasNoXBLChildren(!iter.XBLInvolved());
 
     if (aCanHaveGeneratedContent) {
       // Probe for generated content after
       CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
-                                 nsCSSPseudoElements::ePseudo_after,
+                                 CSSPseudoElementType::after,
                                  itemsToConstruct);
     }
   } else {
     ClearLazyBits(aContent->GetFirstChild(), nullptr);
   }
 
   ConstructFramesFromItemList(aState, itemsToConstruct, aFrame, aFrameItems);
 
@@ -11825,17 +11825,17 @@ nsCSSFrameConstructor::BuildInlineChildI
     ancestorPusher.PushAncestorAndStyleScope(parentContent->AsElement());
   } else {
     ancestorPusher.PushStyleScope(parentContent->AsElement());
   }
 
   if (!aItemIsWithinSVGText) {
     // Probe for generated content before
     CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
-                               nsCSSPseudoElements::ePseudo_before,
+                               CSSPseudoElementType::before,
                                aParentItem.mChildItems);
   }
 
   uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK;
   if (aItemIsWithinSVGText) {
     flags |= ITEM_IS_WITHIN_SVG_TEXT;
   }
   if (aItemAllowsTextPathChild && aParentItem.mIsForSVGAElement) {
@@ -11895,17 +11895,17 @@ nsCSSFrameConstructor::BuildInlineChildI
                                         flags, nullptr,
                                         aParentItem.mChildItems);
     }
   }
 
   if (!aItemIsWithinSVGText) {
     // Probe for generated content after
     CreateGeneratedContentItem(aState, nullptr, parentContent, parentStyleContext,
-                               nsCSSPseudoElements::ePseudo_after,
+                               CSSPseudoElementType::after,
                                aParentItem.mChildItems);
   }
 
   aParentItem.mIsAllInline = aParentItem.mChildItems.AreAllItemsInline();
 }
 
 // return whether it's ok to append (in the AppendFrames sense) to
 // aParentFrame if our nextSibling is aNextSibling.  aParentFrame must
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -852,17 +852,17 @@ nsCSSRendering::PaintOutline(nsPresConte
     (aForFrame, false);
   nsStyleContext* bgContext = bgFrame->StyleContext();
   nscolor bgColor =
     bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
 
   nsRect innerRect;
   if (
 #ifdef MOZ_XUL
-      aStyleContext->GetPseudoType() == nsCSSPseudoElements::ePseudo_XULTree
+      aStyleContext->GetPseudoType() == CSSPseudoElementType::XULTree
 #else
       false
 #endif
      ) {
     innerRect = aBorderArea;
   } else {
     innerRect = GetOutlineInnerRect(aForFrame) + aBorderArea.TopLeft();
   }
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -460,23 +460,23 @@ nsButtonFrameRenderer::ReResolveStyles(n
   if (mOuterFocusStyle) {
     mOuterFocusStyle->FrameRelease();
   }
 #endif
 
   // style for the inner such as a dotted line (Windows)
   mInnerFocusStyle =
     styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
-                                      nsCSSPseudoElements::ePseudo_mozFocusInner,
+                                      CSSPseudoElementType::mozFocusInner,
                                       context);
 
   // style for outer focus like a ridged border (MAC).
   mOuterFocusStyle =
     styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
-                                      nsCSSPseudoElements::ePseudo_mozFocusOuter,
+                                      CSSPseudoElementType::mozFocusOuter,
                                       context);
 
 #ifdef DEBUG
   if (mInnerFocusStyle) {
     mInnerFocusStyle->FrameAddRef();
   }
   if (mOuterFocusStyle) {
     mOuterFocusStyle->FrameAddRef();
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -67,17 +67,17 @@ nsColorControlFrame::CreateAnonymousCont
   mColorContent = doc->CreateHTMLElement(nsGkAtoms::div);
 
   // Mark the element to be native anonymous before setting any attributes.
   mColorContent->SetIsNativeAnonymousRoot();
 
   nsresult rv = UpdateColor();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozColorSwatch;
+  nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozColorSwatch;
   RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
     ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                               StyleContext(), mColorContent->AsElement());
   if (!aElements.AppendElement(ContentInfo(mColorContent, newStyleContext))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
@@ -132,14 +132,14 @@ nsContainerFrame*
 nsColorControlFrame::GetContentInsertionFrame()
 {
   return this;
 }
 
 Element*
 nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozColorSwatch) {
+  if (aType == CSSPseudoElementType::mozColorSwatch) {
     return mColorContent;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -61,17 +61,17 @@ nsMeterFrame::CreateAnonymousContent(nsT
 {
   // Get the NodeInfoManager and tag necessary to create the meter bar div.
   nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
 
   // Create the div.
   mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
 
   // Associate ::-moz-meter-bar pseudo-element to the anonymous child.
-  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozMeterBar;
+  nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozMeterBar;
   RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
     ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                               StyleContext(), mBarDiv->AsElement());
 
   if (!aElements.AppendElement(ContentInfo(mBarDiv, newStyleContext))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
@@ -278,14 +278,14 @@ nsMeterFrame::ShouldUseNativeStyle() con
          barFrame->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK &&
          !PresContext()->HasAuthorSpecifiedRules(barFrame,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
 
 Element*
 nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozMeterBar) {
+  if (aType == CSSPseudoElementType::mozMeterBar) {
     return mBarDiv;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -329,31 +329,31 @@ nsNumberControlFrame::MakeAnonymousEleme
   // Get the NodeInfoManager and tag necessary to create the anonymous divs.
   nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
   RefPtr<Element> resultElement = doc->CreateHTMLElement(aTagName);
 
   // If we legitimately fail this assertion and need to allow
   // non-pseudo-element anonymous children, then we'll need to add a branch
   // that calls ResolveStyleFor((*aResult)->AsElement(), aParentContext)") to
   // set newStyleContext.
-  NS_ASSERTION(aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement,
+  NS_ASSERTION(aPseudoType != CSSPseudoElementType::NotPseudo,
                "Expecting anonymous children to all be pseudo-elements");
   // Associate the pseudo-element with the anonymous child
   RefPtr<nsStyleContext> newStyleContext =
     PresContext()->StyleSet()->ResolvePseudoElementStyle(mContent->AsElement(),
                                                          aPseudoType,
                                                          aParentContext,
                                                          resultElement);
 
   if (!aElements.AppendElement(ContentInfo(resultElement, newStyleContext))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown ||
-      aPseudoType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp) {
+  if (aPseudoType == CSSPseudoElementType::mozNumberSpinDown ||
+      aPseudoType == CSSPseudoElementType::mozNumberSpinUp) {
     resultElement->SetAttr(kNameSpaceID_None, nsGkAtoms::role,
                            NS_LITERAL_STRING("button"), false);
   }
 
   resultElement.forget(aResult);
   return NS_OK;
 }
 
@@ -375,27 +375,27 @@ nsNumberControlFrame::CreateAnonymousCon
   // If you change this, be careful to change the destruction order in
   // nsNumberControlFrame::DestroyFrom.
 
 
   // Create the anonymous outer wrapper:
   rv = MakeAnonymousElement(getter_AddRefs(mOuterWrapper),
                             aElements,
                             nsGkAtoms::div,
-                            nsCSSPseudoElements::ePseudo_mozNumberWrapper,
+                            CSSPseudoElementType::mozNumberWrapper,
                             mStyleContext);
   NS_ENSURE_SUCCESS(rv, rv);
 
   ContentInfo& outerWrapperCI = aElements.LastElement();
 
   // Create the ::-moz-number-text pseudo-element:
   rv = MakeAnonymousElement(getter_AddRefs(mTextField),
                             outerWrapperCI.mChildren,
                             nsGkAtoms::input,
-                            nsCSSPseudoElements::ePseudo_mozNumberText,
+                            CSSPseudoElementType::mozNumberText,
                             outerWrapperCI.mStyleContext);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                       NS_LITERAL_STRING("text"), PR_FALSE);
 
   HTMLInputElement* content = HTMLInputElement::FromContent(mContent);
   HTMLInputElement* textField = HTMLInputElement::FromContent(mTextField);
@@ -433,35 +433,35 @@ nsNumberControlFrame::CreateAnonymousCon
     // -moz-appearance. We will reframe if it changes.
     return rv;
   }
 
   // Create the ::-moz-number-spin-box pseudo-element:
   rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
                             outerWrapperCI.mChildren,
                             nsGkAtoms::div,
-                            nsCSSPseudoElements::ePseudo_mozNumberSpinBox,
+                            CSSPseudoElementType::mozNumberSpinBox,
                             outerWrapperCI.mStyleContext);
   NS_ENSURE_SUCCESS(rv, rv);
 
   ContentInfo& spinBoxCI = outerWrapperCI.mChildren.LastElement();
 
   // Create the ::-moz-number-spin-up pseudo-element:
   rv = MakeAnonymousElement(getter_AddRefs(mSpinUp),
                             spinBoxCI.mChildren,
                             nsGkAtoms::div,
-                            nsCSSPseudoElements::ePseudo_mozNumberSpinUp,
+                            CSSPseudoElementType::mozNumberSpinUp,
                             spinBoxCI.mStyleContext);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Create the ::-moz-number-spin-down pseudo-element:
   rv = MakeAnonymousElement(getter_AddRefs(mSpinDown),
                             spinBoxCI.mChildren,
                             nsGkAtoms::div,
-                            nsCSSPseudoElements::ePseudo_mozNumberSpinDown,
+                            CSSPseudoElementType::mozNumberSpinDown,
                             spinBoxCI.mStyleContext);
 
   SyncDisabledState();
 
   return rv;
 }
 
 nsIAtom*
@@ -821,35 +821,35 @@ nsNumberControlFrame::AnonTextControlIsE
   nsAutoString value;
   HTMLInputElement::FromContent(mTextField)->GetValue(value);
   return value.IsEmpty();
 }
 
 Element*
 nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozNumberWrapper) {
+  if (aType == CSSPseudoElementType::mozNumberWrapper) {
     return mOuterWrapper;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozNumberText) {
+  if (aType == CSSPseudoElementType::mozNumberText) {
     return mTextField;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox) {
+  if (aType == CSSPseudoElementType::mozNumberSpinBox) {
     // Might be null.
     return mSpinBox;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp) {
+  if (aType == CSSPseudoElementType::mozNumberSpinUp) {
     // Might be null.
     return mSpinUp;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown) {
+  if (aType == CSSPseudoElementType::mozNumberSpinDown) {
     // Might be null.
     return mSpinDown;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
 
 #ifdef ACCESSIBILITY
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -58,17 +58,17 @@ nsProgressFrame::DestroyFrom(nsIFrame* a
 nsresult
 nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
   // Create the progress bar div.
   nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
   mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
 
   // Associate ::-moz-progress-bar pseudo-element to the anonymous child.
-  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
+  nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozProgressBar;
   RefPtr<nsStyleContext> newStyleContext = PresContext()->StyleSet()->
     ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                               StyleContext(), mBarDiv->AsElement());
 
   if (!aElements.AppendElement(ContentInfo(mBarDiv, newStyleContext))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
@@ -284,14 +284,14 @@ nsProgressFrame::ShouldUseNativeStyle() 
          barFrame->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
          !PresContext()->HasAuthorSpecifiedRules(barFrame,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
 
 Element*
 nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozProgressBar) {
+  if (aType == CSSPseudoElementType::mozProgressBar) {
     return mBarDiv;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -81,17 +81,17 @@ nsRangeFrame::Init(nsIContent*       aCo
     mDummyTouchListener = new DummyTouchListener();
   }
   aContent->AddEventListener(NS_LITERAL_STRING("touchstart"), mDummyTouchListener, false);
 
   nsStyleSet *styleSet = PresContext()->StyleSet();
 
   mOuterFocusStyle =
     styleSet->ProbePseudoElementStyle(aContent->AsElement(),
-                                      nsCSSPseudoElements::ePseudo_mozFocusOuter,
+                                      CSSPseudoElementType::mozFocusOuter,
                                       StyleContext());
 
   return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
 }
 
 void
 nsRangeFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
@@ -133,29 +133,29 @@ nsRangeFrame::MakeAnonymousDiv(Element**
 
 nsresult
 nsRangeFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
   nsresult rv;
 
   // Create the ::-moz-range-track pseuto-element (a div):
   rv = MakeAnonymousDiv(getter_AddRefs(mTrackDiv),
-                        nsCSSPseudoElements::ePseudo_mozRangeTrack,
+                        CSSPseudoElementType::mozRangeTrack,
                         aElements);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Create the ::-moz-range-progress pseudo-element (a div):
   rv = MakeAnonymousDiv(getter_AddRefs(mProgressDiv),
-                        nsCSSPseudoElements::ePseudo_mozRangeProgress,
+                        CSSPseudoElementType::mozRangeProgress,
                         aElements);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Create the ::-moz-range-thumb pseudo-element (a div):
   rv = MakeAnonymousDiv(getter_AddRefs(mThumbDiv),
-                        nsCSSPseudoElements::ePseudo_mozRangeThumb,
+                        CSSPseudoElementType::mozRangeThumb,
                         aElements);
   return rv;
 }
 
 void
 nsRangeFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
                                        uint32_t aFilter)
 {
@@ -891,25 +891,25 @@ nsRangeFrame::ShouldUseNativeStyle() con
          thumbFrame &&
          !PresContext()->HasAuthorSpecifiedRules(thumbFrame,
                                                  STYLES_DISABLING_NATIVE_THEMING);
 }
 
 Element*
 nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozRangeTrack) {
+  if (aType == CSSPseudoElementType::mozRangeTrack) {
     return mTrackDiv;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozRangeThumb) {
+  if (aType == CSSPseudoElementType::mozRangeThumb) {
     return mThumbDiv;
   }
 
-  if (aType == nsCSSPseudoElements::ePseudo_mozRangeProgress) {
+  if (aType == CSSPseudoElementType::mozRangeProgress) {
     return mProgressDiv;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
 
 nsStyleContext*
 nsRangeFrame::GetAdditionalStyleContext(int32_t aIndex) const
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -341,18 +341,17 @@ nsTextControlFrame::CreateAnonymousConte
   mUsePlaceholder = !placeholderTxt.IsEmpty();
 
   // Create the placeholder anonymous content if needed.
   if (mUsePlaceholder) {
     nsIContent* placeholderNode = txtCtrl->CreatePlaceholderNode();
     NS_ENSURE_TRUE(placeholderNode, NS_ERROR_OUT_OF_MEMORY);
 
     // Associate ::-moz-placeholder pseudo-element with the placeholder node.
-    nsCSSPseudoElements::Type pseudoType =
-      nsCSSPseudoElements::ePseudo_mozPlaceholder;
+    nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::mozPlaceholder;
 
     RefPtr<nsStyleContext> placeholderStyleContext =
       PresContext()->StyleSet()->ResolvePseudoElementStyle(
           mContent->AsElement(), pseudoType, StyleContext(),
           placeholderNode->AsElement());
 
     if (!aElements.AppendElement(ContentInfo(placeholderNode,
                                  placeholderStyleContext))) {
@@ -1441,17 +1440,17 @@ nsTextControlFrame::BuildDisplayList(nsD
     }
     kid = kid->GetNextSibling();
   }
 }
 
 mozilla::dom::Element*
 nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
-  if (aType == nsCSSPseudoElements::ePseudo_mozPlaceholder) {
+  if (aType == CSSPseudoElementType::mozPlaceholder) {
     nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
     return txtCtrl->GetPlaceholderNode();
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
 
 NS_IMETHODIMP
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6892,19 +6892,19 @@ nsBlockFrame::SetInitialChildList(ChildL
 }
 
 void
 nsBlockFrame::CreateBulletFrameForListItem(bool aCreateBulletList,
                                            bool aListStylePositionInside)
 {
   nsIPresShell* shell = PresContext()->PresShell();
 
-  nsCSSPseudoElements::Type pseudoType = aCreateBulletList ?
-    nsCSSPseudoElements::ePseudo_mozListBullet :
-    nsCSSPseudoElements::ePseudo_mozListNumber;
+  CSSPseudoElementType pseudoType = aCreateBulletList ?
+    CSSPseudoElementType::mozListBullet :
+    CSSPseudoElementType::mozListNumber;
 
   nsStyleContext* parentStyle =
     CorrectStyleParentFrame(this,
                             nsCSSPseudoElements::GetPseudoAtom(pseudoType))->
     StyleContext();
 
   RefPtr<nsStyleContext> kidSC = shell->StyleSet()->
     ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -362,17 +362,17 @@ protected:
   }
   virtual ~nsBlockFrame();
 
 #ifdef DEBUG
   already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsPresContext* aPresContext)
   {
     return aPresContext->StyleSet()->
       ProbePseudoElementStyle(mContent->AsElement(),
-                              nsCSSPseudoElements::ePseudo_firstLetter,
+                              mozilla::CSSPseudoElementType::firstLetter,
                               mStyleContext);
   }
 #endif
 
   NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(LineCursorProperty, nsLineBox)
   nsLineBox* GetLineCursor() {
     return (GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR) ?
       Properties().Get(LineCursorProperty()) : nullptr;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9120,29 +9120,29 @@ nsIFrame::IsPseudoStackingContextFromSty
          (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_STACKING_CONTEXT);
 }
 
 Element*
 nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
 {
   nsIFrame* frame = nullptr;
 
-  if (aType == nsCSSPseudoElements::ePseudo_before) {
+  if (aType == CSSPseudoElementType::before) {
     frame = nsLayoutUtils::GetBeforeFrame(this);
-  } else if (aType == nsCSSPseudoElements::ePseudo_after) {
+  } else if (aType == CSSPseudoElementType::after) {
     frame = nsLayoutUtils::GetAfterFrame(this);
   }
 
   if (frame) {
     nsIContent* content = frame->GetContent();
     if (content->IsElement()) {
       return content->AsElement();
     }
   }
-  
+
   return nullptr;
 }
 
 nsIFrame::CaretPosition::CaretPosition()
   : mContentOffset(0)
 {
 }
 
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -3802,17 +3802,17 @@ nsTextPaintStyle::InitSelectionColorsAnd
   Element* selectionElement =
     FindElementAncestorForMozSelection(nonGeneratedAncestor->GetContent());
 
   if (selectionElement &&
       selectionStatus == nsISelectionController::SELECTION_ON) {
     RefPtr<nsStyleContext> sc = nullptr;
     sc = mPresContext->StyleSet()->
       ProbePseudoElementStyle(selectionElement,
-                              nsCSSPseudoElements::ePseudo_mozSelection,
+                              CSSPseudoElementType::mozSelection,
                               mFrame->StyleContext());
     // Use -moz-selection pseudo class.
     if (sc) {
       mSelectionBGColor =
         sc->GetVisitedDependentColor(eCSSProperty_background_color);
       mSelectionTextColor = sc->GetVisitedDependentColor(eCSSProperty_color);
       mHasSelectionShadow =
         nsRuleNode::HasAuthorSpecifiedRules(sc,
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -1189,17 +1189,18 @@ GetStatesForPseudoClass(const nsAString&
   return sPseudoClassStates[nsCSSPseudoClasses::GetPseudoType(atom)];
 }
 
 NS_IMETHODIMP
 inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
 {
   nsTArray<nsIAtom*> array;
 
-  for (int i = 0; i < nsCSSPseudoElements::ePseudo_PseudoElementCount; ++i) {
+  const uint8_t pseudoCount = static_cast<uint8_t>(CSSPseudoElementType::Count);
+  for (uint8_t i = 0; i < pseudoCount; ++i) {
     nsCSSPseudoElements::Type type = static_cast<nsCSSPseudoElements::Type>(i);
     if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
       nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
       array.AppendElement(atom);
     }
   }
 
   *aLength = array.Length();
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -94,17 +94,17 @@ nsMathMLFrame::UpdatePresentationData(ui
 // the Style System via the Get/Set AdditionalStyleContext() APIs.
 /* static */ void
 nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext*  aPresContext,
                                       nsIContent*      aContent,
                                       nsStyleContext*  aParentStyleContext,
                                       nsMathMLChar*    aMathMLChar)
 {
   nsCSSPseudoElements::Type pseudoType =
-    nsCSSPseudoElements::ePseudo_mozMathAnonymous; // savings
+    CSSPseudoElementType::mozMathAnonymous; // savings
   RefPtr<nsStyleContext> newStyleContext;
   newStyleContext = aPresContext->StyleSet()->
     ResolvePseudoElementStyle(aContent->AsElement(), pseudoType,
                               aParentStyleContext, nullptr);
 
   aMathMLChar->SetStyleContext(newStyleContext);
 }
 
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -73,21 +73,21 @@ CommonAnimationManager::GetAnimationColl
                                                bool aCreateIfNeeded)
 {
   if (!aCreateIfNeeded && mElementCollections.isEmpty()) {
     // Early return for the most common case.
     return nullptr;
   }
 
   nsIAtom *propName;
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+  if (aPseudoType == CSSPseudoElementType::NotPseudo) {
     propName = GetAnimationsAtom();
-  } else if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
+  } else if (aPseudoType == CSSPseudoElementType::before) {
     propName = GetAnimationsBeforeAtom();
-  } else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
+  } else if (aPseudoType == CSSPseudoElementType::after) {
     propName = GetAnimationsAfterAtom();
   } else {
     NS_ASSERTION(!aCreateIfNeeded,
                  "should never try to create transitions for pseudo "
                  "other than :before or :after");
     return nullptr;
   }
   AnimationCollection* collection =
@@ -150,22 +150,22 @@ CommonAnimationManager::ExtractComputedV
   }
   return result;
 }
 
 /*static*/ nsString
 AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
 {
   switch (aPseudoType) {
-    case nsCSSPseudoElements::ePseudo_before:
+    case CSSPseudoElementType::before:
       return NS_LITERAL_STRING("::before");
-    case nsCSSPseudoElements::ePseudo_after:
+    case CSSPseudoElementType::after:
       return NS_LITERAL_STRING("::after");
     default:
-      MOZ_ASSERT(aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
+      MOZ_ASSERT(aPseudoType == CSSPseudoElementType::NotPseudo,
                  "Unexpected pseudo type");
       return EmptyString();
   }
 }
 
 /*static*/ void
 AnimationCollection::PropertyDtor(void *aObject, nsIAtom *aPropertyName,
                                   void *aPropertyValue, void *aData)
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -172,24 +172,24 @@ public:
     return mElementProperty == nsGkAtoms::animationsProperty ||
            mElementProperty == nsGkAtoms::animationsOfBeforeProperty ||
            mElementProperty == nsGkAtoms::animationsOfAfterProperty;
   }
 
   nsCSSPseudoElements::Type PseudoElementType() const
   {
     if (IsForElement()) {
-      return nsCSSPseudoElements::ePseudo_NotPseudoElement;
+      return CSSPseudoElementType::NotPseudo;
     }
     if (IsForBeforePseudo()) {
-      return nsCSSPseudoElements::ePseudo_before;
+      return CSSPseudoElementType::before;
     }
     MOZ_ASSERT(IsForAfterPseudo(),
                "::before & ::after should be the only pseudo-elements here");
-    return nsCSSPseudoElements::ePseudo_after;
+    return CSSPseudoElementType::after;
   }
 
   static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
 
   dom::Element* GetElementToRestyle() const;
 
   dom::Element *mElement;
 
@@ -230,17 +230,17 @@ private:
  * call the getter on CSSAnimation/CSSTransition OwningElement() without
  * clashing with this object's contructor.)
  */
 class OwningElementRef final
 {
 public:
   OwningElementRef()
     : mElement(nullptr)
-    , mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
+    , mPseudoType(CSSPseudoElementType::NotPseudo)
   { }
 
   OwningElementRef(dom::Element& aElement,
                    nsCSSPseudoElements::Type aPseudoType)
     : mElement(&aElement)
     , mPseudoType(aPseudoType)
   { }
 
@@ -254,19 +254,19 @@ public:
   {
     MOZ_ASSERT(mElement && aOther.mElement,
                "Elements to compare should not be null");
 
     if (mElement != aOther.mElement) {
       return nsContentUtils::PositionIsBefore(mElement, aOther.mElement);
     }
 
-    return mPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-          (mPseudoType == nsCSSPseudoElements::ePseudo_before &&
-           aOther.mPseudoType == nsCSSPseudoElements::ePseudo_after);
+    return mPseudoType == CSSPseudoElementType::NotPseudo ||
+          (mPseudoType == CSSPseudoElementType::before &&
+           aOther.mPseudoType == CSSPseudoElementType::after);
   }
 
   bool IsSet() const { return !!mElement; }
 
   void GetElement(dom::Element*& aElement,
                   nsCSSPseudoElements::Type& aPseudoType) const {
     aElement = mElement;
     aPseudoType = mPseudoType;
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -2530,17 +2530,17 @@ LookupStyleContext(dom::Element* aElemen
 {
   nsIDocument* doc = aElement->GetCurrentDoc();
   nsIPresShell* shell = doc->GetShell();
   if (!shell) {
     return nullptr;
   }
 
   nsIAtom* pseudo =
-    aPseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount ?
+    aPseudoType < CSSPseudoElementType::Count ?
     nsCSSPseudoElements::GetPseudoAtom(aPseudoType) : nullptr;
   return nsComputedDOMStyle::GetStyleContextForElement(aElement, pseudo, shell);
 }
 
 /* static */ bool
 StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
                                   dom::Element* aTargetElement,
                                   nsCSSPseudoElements::Type aPseudoType,
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -310,20 +310,20 @@ nsCSSSelector::nsCSSSelector(void)
     mIDList(nullptr),
     mClassList(nullptr),
     mPseudoClassList(nullptr),
     mAttrList(nullptr),
     mNegations(nullptr),
     mNext(nullptr),
     mNameSpace(kNameSpaceID_Unknown),
     mOperator(0),
-    mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
+    mPseudoType(static_cast<int16_t>(CSSPseudoElementType::NotPseudo))
 {
   MOZ_COUNT_CTOR(nsCSSSelector);
-  static_assert(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
+  static_assert(static_cast<int16_t>(CSSPseudoElementType::MAX) < INT16_MAX,
                 "nsCSSPseudoElements::Type values overflow mPseudoType");
 }
 
 nsCSSSelector*
 nsCSSSelector::Clone(bool aDeepNext, bool aDeepNegations) const
 {
   nsCSSSelector *result = new nsCSSSelector();
   if (!result)
@@ -487,17 +487,17 @@ void nsCSSSelector::SetOperator(char16_t
 }
 
 int32_t nsCSSSelector::CalcWeightWithoutNegations() const
 {
   int32_t weight = 0;
 
 #ifdef MOZ_XUL
   MOZ_ASSERT(!(IsPseudoElement() &&
-               PseudoType() != nsCSSPseudoElements::ePseudo_XULTree &&
+               PseudoType() != CSSPseudoElementType::XULTree &&
                mClassList),
              "If non-XUL-tree pseudo-elements can have class selectors "
              "after them, specificity calculation must be updated");
 #else
   MOZ_ASSERT(!(IsPseudoElement() && mClassList),
              "If pseudo-elements can have class selectors "
              "after them, specificity calculation must be updated");
 #endif
@@ -512,17 +512,17 @@ int32_t nsCSSSelector::CalcWeightWithout
   while (nullptr != list) {
     weight += 0x010000;
     list = list->mNext;
   }
   list = mClassList;
 #ifdef MOZ_XUL
   // XUL tree pseudo-elements abuse mClassList to store some private
   // data; ignore that.
-  if (PseudoType() == nsCSSPseudoElements::ePseudo_XULTree) {
+  if (PseudoType() == CSSPseudoElementType::XULTree) {
     list = nullptr;
   }
 #endif
   while (nullptr != list) {
     weight += 0x000100;
     list = list->mNext;
   }
   // FIXME (bug 561154):  This is incorrect for :-moz-any(), which isn't
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -173,17 +173,17 @@ public:
 
   // Calculate the specificity of this selector (not including its mNext!).
   int32_t CalcWeight() const;
 
   void ToString(nsAString& aString, mozilla::CSSStyleSheet* aSheet,
                 bool aAppend = false) const;
 
   bool IsRestrictedSelector() const {
-    return PseudoType() == nsCSSPseudoElements::ePseudo_NotPseudoElement;
+    return PseudoType() == mozilla::CSSPseudoElementType::NotPseudo;
   }
 
 #ifdef DEBUG
   nsCString RestrictedSelectorToString() const;
 #endif
 
 private:
   void AddPseudoClassInternal(nsPseudoClassList *aPseudoClass);
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -5870,60 +5870,59 @@ CSSParserImpl::ParsePseudoSelector(int32
   nsCSSPseudoElements::Type pseudoElementType =
     nsCSSPseudoElements::GetPseudoType(pseudo);
   nsCSSPseudoClasses::Type pseudoClassType =
     nsCSSPseudoClasses::GetPseudoType(pseudo);
   bool pseudoClassIsUserAction =
     nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
 
   if (!AgentRulesEnabled() &&
-      ((pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount &&
+      ((pseudoElementType < CSSPseudoElementType::Count &&
         nsCSSPseudoElements::PseudoElementIsUASheetOnly(pseudoElementType)) ||
        (pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass &&
         nsCSSPseudoClasses::PseudoClassIsUASheetOnly(pseudoClassType)))) {
     // This pseudo-element or pseudo-class is not exposed to content.
     REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);
     UngetToken();
     return eSelectorParsingStatus_Error;
   }
 
   // We currently allow :-moz-placeholder and ::-moz-placeholder. We have to
   // be a bit stricter regarding the pseudo-element parsing rules.
-  if (pseudoElementType == nsCSSPseudoElements::ePseudo_mozPlaceholder &&
+  if (pseudoElementType == CSSPseudoElementType::mozPlaceholder &&
       pseudoClassType == nsCSSPseudoClasses::ePseudoClass_mozPlaceholder) {
     if (parsingPseudoElement) {
       pseudoClassType = nsCSSPseudoClasses::ePseudoClass_NotPseudoClass;
     } else {
-      pseudoElementType = nsCSSPseudoElements::ePseudo_NotPseudoElement;
+      pseudoElementType = CSSPseudoElementType::NotPseudo;
     }
   }
 
 #ifdef MOZ_XUL
-  isTreePseudo = (pseudoElementType == nsCSSPseudoElements::ePseudo_XULTree);
+  isTreePseudo = (pseudoElementType == CSSPseudoElementType::XULTree);
   // If a tree pseudo-element is using the function syntax, it will
   // get isTree set here and will pass the check below that only
   // allows functions if they are in our list of things allowed to be
   // functions.  If it is _not_ using the function syntax, isTree will
   // be false, and it will still pass that check.  So the tree
   // pseudo-elements are allowed to be either functions or not, as
   // desired.
   bool isTree = (eCSSToken_Function == mToken.mType) && isTreePseudo;
 #endif
-  bool isPseudoElement =
-    (pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount);
+  bool isPseudoElement = (pseudoElementType < CSSPseudoElementType::Count);
   // anonymous boxes are only allowed if they're the tree boxes or we have
   // enabled agent rules
   bool isAnonBox = isTreePseudo ||
-    (pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox &&
+    (pseudoElementType == CSSPseudoElementType::AnonBox &&
      AgentRulesEnabled());
   bool isPseudoClass =
     (pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
 
   NS_ASSERTION(!isPseudoClass ||
-               pseudoElementType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
+               pseudoElementType == CSSPseudoElementType::NotPseudo,
                "Why is this atom both a pseudo-class and a pseudo-element?");
   NS_ASSERTION(isPseudoClass + isPseudoElement + isAnonBox <= 1,
                "Shouldn't be more than one of these");
 
   if (!isPseudoClass && !isPseudoElement && !isAnonBox) {
     // Not a pseudo-class, not a pseudo-element.... forget it
     REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);
     UngetToken();
@@ -6408,18 +6407,17 @@ CSSParserImpl::ParseSelector(nsCSSSelect
   if (! GetToken(true)) {
     REPORT_UNEXPECTED_EOF(PESelectorEOF);
     return false;
   }
 
   nsCSSSelector* selector = aList->AddSelector(aPrevCombinator);
   nsCOMPtr<nsIAtom> pseudoElement;
   nsAutoPtr<nsAtomList> pseudoElementArgs;
-  nsCSSPseudoElements::Type pseudoElementType =
-    nsCSSPseudoElements::ePseudo_NotPseudoElement;
+  nsCSSPseudoElements::Type pseudoElementType = CSSPseudoElementType::NotPseudo;
 
   int32_t dataMask = 0;
   nsSelectorParsingStatus parsingStatus =
     ParseTypeOrUniversalSelector(dataMask, *selector, false);
 
   while (parsingStatus == eSelectorParsingStatus_Continue) {
     if (eCSSToken_ID == mToken.mType) { // #id
       parsingStatus = ParseIDSelector(dataMask, *selector);
@@ -6428,17 +6426,17 @@ CSSParserImpl::ParseSelector(nsCSSSelect
       parsingStatus = ParseClassSelector(dataMask, *selector);
     }
     else if (mToken.IsSymbol(':')) {    // :pseudo
       parsingStatus = ParsePseudoSelector(dataMask, *selector, false,
                                           getter_AddRefs(pseudoElement),
                                           getter_Transfers(pseudoElementArgs),
                                           &pseudoElementType);
       if (pseudoElement &&
-          pseudoElementType != nsCSSPseudoElements::ePseudo_AnonBox) {
+          pseudoElementType != CSSPseudoElementType::AnonBox) {
         // Pseudo-elements other than anonymous boxes are represented with
         // a special ':' combinator.
 
         aList->mWeight += selector->CalcWeight();
 
         selector = aList->AddSelector(':');
 
         selector->mLowercaseTag.swap(pseudoElement);
@@ -6476,17 +6474,17 @@ CSSParserImpl::ParseSelector(nsCSSSelect
     if (selector->mNext) {
       REPORT_UNEXPECTED(PESelectorGroupExtraCombinator);
     } else {
       REPORT_UNEXPECTED(PESelectorGroupNoSelector);
     }
     return false;
   }
 
-  if (pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox) {
+  if (pseudoElementType == CSSPseudoElementType::AnonBox) {
     // We got an anonymous box pseudo-element; it must be the only
     // thing in this selector group.
     if (selector->mNext || !IsUniversalSelector(*selector)) {
       REPORT_UNEXPECTED(PEAnonBoxNotAlone);
       return false;
     }
 
     // Rewrite the current selector as this pseudo-element.
--- a/layout/style/nsCSSPseudoElements.cpp
+++ b/layout/style/nsCSSPseudoElements.cpp
@@ -68,44 +68,44 @@ nsCSSPseudoElements::IsCSS2PseudoElement
                   aAtom == nsCSSPseudoElements::firstLine;
   NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
                result ==
                  PseudoElementHasFlags(GetPseudoType(aAtom), CSS_PSEUDO_ELEMENT_IS_CSS2),
                "result doesn't match flags");
   return result;
 }
 
-/* static */ nsCSSPseudoElements::Type
+/* static */ CSSPseudoElementType
 nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
 {
   for (uint32_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
     if (*CSSPseudoElements_info[i].mAtom == aAtom) {
       return Type(i);
     }
   }
 
   if (nsCSSAnonBoxes::IsAnonBox(aAtom)) {
 #ifdef MOZ_XUL
     if (nsCSSAnonBoxes::IsTreePseudoElement(aAtom)) {
-      return ePseudo_XULTree;
+      return Type::XULTree;
     }
 #endif
 
-    return ePseudo_AnonBox;
+    return Type::AnonBox;
   }
 
-  return ePseudo_NotPseudoElement;
+  return Type::NotPseudo;
 }
 
 /* static */ nsIAtom*
 nsCSSPseudoElements::GetPseudoAtom(Type aType)
 {
-  NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
+  NS_ASSERTION(aType < Type::Count,
                "Unexpected type");
-  return *CSSPseudoElements_info[aType].mAtom;
+  return *CSSPseudoElements_info[static_cast<uint8_t>(aType)].mAtom;
 }
 
 /* static */ uint32_t
 nsCSSPseudoElements::FlagsForPseudoElement(const Type aType)
 {
   size_t index = static_cast<size_t>(aType);
   NS_ASSERTION(index < ArrayLength(CSSPseudoElements_flags),
                "argument must be a pseudo-element");
--- a/layout/style/nsCSSPseudoElements.h
+++ b/layout/style/nsCSSPseudoElements.h
@@ -30,68 +30,76 @@
 // following it, such as :active or :hover.  This would normally correspond
 // to whether the pseudo-element is tree-like, but we don't support these
 // pseudo-classes on ::before and ::after generated content yet.  See
 // http://dev.w3.org/csswg/selectors4/#pseudo-elements.
 #define CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE  (1<<3)
 // Is content prevented from parsing selectors containing this pseudo-element?
 #define CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY               (1<<4)
 
+namespace mozilla {
+
+// The total count of CSSPseudoElement is less than 256,
+// so use uint8_t as its underlying type.
+enum class CSSPseudoElementType : uint8_t {
+  // If the actual pseudo-elements stop being first here, change
+  // GetPseudoType.
+#define CSS_PSEUDO_ELEMENT(_name, _value_, _flags) \
+  _name,
+#include "nsCSSPseudoElementList.h"
+#undef CSS_PSEUDO_ELEMENT
+  Count,
+  AnonBox = Count,
+#ifdef MOZ_XUL
+  XULTree,
+#endif
+  NotPseudo,
+  MAX
+};
+
+} // namespace mozilla
+
 // Empty class derived from nsIAtom so that function signatures can
 // require an atom from this atom list.
 class nsICSSPseudoElement : public nsIAtom {};
 
 class nsCSSPseudoElements {
 public:
+  // FIXME: Remove this in later patch
+  using Type = mozilla::CSSPseudoElementType;
 
   static void AddRefAtoms();
 
   static bool IsPseudoElement(nsIAtom *aAtom);
 
   static bool IsCSS2PseudoElement(nsIAtom *aAtom);
 
 #define CSS_PSEUDO_ELEMENT(_name, _value, _flags) \
   static nsICSSPseudoElement* _name;
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 
-  enum Type {
-    // If the actual pseudo-elements stop being first here, change
-    // GetPseudoType.
-#define CSS_PSEUDO_ELEMENT(_name, _value_, _flags) \
-    ePseudo_##_name,
-#include "nsCSSPseudoElementList.h"
-#undef CSS_PSEUDO_ELEMENT
-    ePseudo_PseudoElementCount,
-    ePseudo_AnonBox = ePseudo_PseudoElementCount,
-#ifdef MOZ_XUL
-    ePseudo_XULTree,
-#endif
-    ePseudo_NotPseudoElement,
-    ePseudo_MAX
-  };
-
   static Type GetPseudoType(nsIAtom* aAtom);
 
-  // Get the atom for a given Type.  aType must be < ePseudo_PseudoElementCount
+  // Get the atom for a given Type.  aType must be < Type::Count
   static nsIAtom* GetPseudoAtom(Type aType);
 
   static bool PseudoElementContainsElements(const Type aType) {
     return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS);
   }
 
   static bool PseudoElementSupportsStyleAttribute(const Type aType) {
-    MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
+    MOZ_ASSERT(aType < Type::Count);
     return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
   }
 
   static bool PseudoElementSupportsUserActionState(const Type aType);
 
   static bool PseudoElementIsUASheetOnly(const Type aType) {
-    MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
+    MOZ_ASSERT(aType < Type::Count);
     return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
   }
 
 private:
   static uint32_t FlagsForPseudoElement(const Type aType);
 
   // Does the given pseudo-element have all of the flags given?
   static bool PseudoElementHasFlags(const Type aType, uint32_t aFlags)
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -906,17 +906,17 @@ struct RuleCascadeData {
       delete mPseudoElementRuleHashes[i];
     }
   }
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 
   RuleHash                 mRuleHash;
   RuleHash*
-    mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount];
+    mPseudoElementRuleHashes[static_cast<uint8_t>(CSSPseudoElementType::Count)];
   nsTArray<nsCSSRuleProcessor::StateSelector>  mStateSelectors;
   EventStates              mSelectorDocumentStates;
   PLDHashTable             mClassSelectors;
   PLDHashTable             mIdSelectors;
   nsTArray<nsCSSSelector*> mPossiblyNegatedClassSelectors;
   nsTArray<nsCSSSelector*> mPossiblyNegatedIDSelectors;
   PLDHashTable             mAttributeSelectors;
   PLDHashTable             mAnonBoxRules;
@@ -2639,17 +2639,19 @@ nsCSSRuleProcessor::RulesMatching(Elemen
 }
 
 /* virtual */ void
 nsCSSRuleProcessor::RulesMatching(PseudoElementRuleProcessorData* aData)
 {
   RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
 
   if (cascade) {
-    RuleHash* ruleHash = cascade->mPseudoElementRuleHashes[aData->mPseudoType];
+    RuleHash* ruleHash =
+      cascade->mPseudoElementRuleHashes[static_cast<uint8_t>(
+        aData->mPseudoType)];
     if (ruleHash) {
       NodeMatchContext nodeContext(EventStates(),
                                    nsCSSRuleProcessor::IsLink(aData->mElement));
       ruleHash->EnumerateAllRules(aData->mElement, aData, nodeContext);
     }
   }
 }
 
@@ -2717,17 +2719,17 @@ nsCSSRuleProcessor::HasStateDependentSty
                                            nsCSSPseudoElements::Type aPseudoType,
                                            EventStates aStateMask)
 {
   MOZ_ASSERT(!aData->mTreeMatchContext.mForScopedStyle,
              "mCurrentStyleScope will need to be saved and restored after the "
              "SelectorMatchesTree call");
 
   bool isPseudoElement =
-    aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement;
+    aPseudoType != CSSPseudoElementType::NotPseudo;
 
   RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
 
   // Look up the content node in the state rule list, which points to
   // any (CSS2 definition) simple selector (whether or not it is the
   // subject) that has a state pseudo-class on it.  This means that this
   // code will be matching selectors that aren't real selectors in any
   // stylesheet (e.g., if there is a selector "body > p:hover > a", then
@@ -2801,17 +2803,17 @@ nsCSSRuleProcessor::HasStateDependentSty
   return hint;
 }
 
 nsRestyleHint
 nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
 {
   return HasStateDependentStyle(aData,
                                 aData->mElement,
-                                nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                                CSSPseudoElementType::NotPseudo,
                                 aData->mStateMask);
 }
 
 nsRestyleHint
 nsCSSRuleProcessor::HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData)
 {
   return HasStateDependentStyle(aData,
                                 aData->mPseudoElement,
@@ -2883,17 +2885,17 @@ RestyleHintForSelectorWithAttributeChang
     // We also don't support pseudo-elements on any of the selectors
     // between aRightmostSelector and aSelector.
     // XXX Can we lift this restriction, so that we don't have to loop
     // over all the selectors?
     for (nsCSSSelector* sel = aRightmostSelector->mNext;
          sel != aSelector;
          sel = sel->mNext) {
       MOZ_ASSERT(sel, "aSelector must be reachable from aRightmostSelector");
-      if (sel->PseudoType() != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+      if (sel->PseudoType() != CSSPseudoElementType::NotPseudo) {
         return eRestyle_Subtree;
       }
     }
 
     return eRestyle_SomeDescendants;
   }
 
   return eRestyle_Self;
@@ -3405,33 +3407,34 @@ AddSelector(RuleCascadeData* aCascade,
 
 static bool
 AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
 {
   RuleCascadeData * const cascade = aCascade;
 
   // Build the rule hash.
   nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
-  if (MOZ_LIKELY(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement)) {
+  if (MOZ_LIKELY(pseudoType == CSSPseudoElementType::NotPseudo)) {
     cascade->mRuleHash.AppendRule(*aRuleInfo);
-  } else if (pseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount) {
-    RuleHash*& ruleHash = cascade->mPseudoElementRuleHashes[pseudoType];
+  } else if (pseudoType < CSSPseudoElementType::Count) {
+    RuleHash*& ruleHash =
+      cascade->mPseudoElementRuleHashes[static_cast<uint8_t>(pseudoType)];
     if (!ruleHash) {
       ruleHash = new RuleHash(cascade->mQuirksMode);
       if (!ruleHash) {
         // Out of memory; give up
         return false;
       }
     }
     NS_ASSERTION(aRuleInfo->mSelector->mNext,
                  "Must have mNext; parser screwed up");
     NS_ASSERTION(aRuleInfo->mSelector->mNext->mOperator == ':',
                  "Unexpected mNext combinator");
     ruleHash->AppendRule(*aRuleInfo);
-  } else if (pseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
+  } else if (pseudoType == CSSPseudoElementType::AnonBox) {
     NS_ASSERTION(!aRuleInfo->mSelector->mCasedTag &&
                  !aRuleInfo->mSelector->mIDList &&
                  !aRuleInfo->mSelector->mClassList &&
                  !aRuleInfo->mSelector->mPseudoClassList &&
                  !aRuleInfo->mSelector->mAttrList &&
                  !aRuleInfo->mSelector->mNegations &&
                  !aRuleInfo->mSelector->mNext &&
                  aRuleInfo->mSelector->mNameSpace == kNameSpaceID_Unknown,
@@ -3439,33 +3442,33 @@ AddRule(RuleSelectorPair* aRuleInfo, Rul
 
     // Index doesn't matter here, since we'll just be walking these
     // rules in order; just pass 0.
     AppendRuleToTagTable(&cascade->mAnonBoxRules,
                          aRuleInfo->mSelector->mLowercaseTag,
                          RuleValue(*aRuleInfo, 0, aCascade->mQuirksMode));
   } else {
 #ifdef MOZ_XUL
-    NS_ASSERTION(pseudoType == nsCSSPseudoElements::ePseudo_XULTree,
+    NS_ASSERTION(pseudoType == CSSPseudoElementType::XULTree,
                  "Unexpected pseudo type");
     // Index doesn't matter here, since we'll just be walking these
     // rules in order; just pass 0.
     AppendRuleToTagTable(&cascade->mXULTreeRules,
                          aRuleInfo->mSelector->mLowercaseTag,
                          RuleValue(*aRuleInfo, 0, aCascade->mQuirksMode));
 #else
     NS_NOTREACHED("Unexpected pseudo type");
 #endif
   }
 
   for (nsCSSSelector* selector = aRuleInfo->mSelector;
            selector; selector = selector->mNext) {
     if (selector->IsPseudoElement()) {
       nsCSSPseudoElements::Type pseudo = selector->PseudoType();
-      if (pseudo >= nsCSSPseudoElements::ePseudo_PseudoElementCount ||
+      if (pseudo >= CSSPseudoElementType::Count ||
           !nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudo)) {
         NS_ASSERTION(!selector->mNegations, "Shouldn't have negations");
         // We do store selectors ending with pseudo-elements that allow :hover
         // and :active after them in the hashtables corresponding to that
         // selector's mNext (i.e. the thing that matches against the element),
         // but we want to make sure that selectors for any other kinds of
         // pseudo-elements don't end up in the hashtables.  In particular, tree
         // pseudos store strange things in mPseudoClassList that we don't want
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -484,17 +484,17 @@ nsComputedDOMStyle::GetStyleContextForEl
   if (!presContext)
     return nullptr;
 
   nsStyleSet *styleSet = presShell->StyleSet();
 
   RefPtr<nsStyleContext> sc;
   if (aPseudo) {
     nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
-    if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
+    if (type >= CSSPseudoElementType::Count) {
       return nullptr;
     }
     nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
     Element* pseudoElement =
       frame && inDocWithShell ? frame->GetPseudoElement(type) : nullptr;
     sc = styleSet->ResolvePseudoElementStyle(aElement, type, parentContext,
                                              pseudoElement);
   } else {
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -473,18 +473,17 @@ struct MOZ_STACK_CLASS PseudoElementRule
                                  nsCSSPseudoElements::Type aPseudoType,
                                  TreeMatchContext& aTreeMatchContext,
                                  mozilla::dom::Element* aPseudoElement)
     : ElementDependentRuleProcessorData(aPresContext, aParentElement, aRuleWalker,
                                         aTreeMatchContext),
       mPseudoType(aPseudoType),
       mPseudoElement(aPseudoElement)
   {
-    NS_PRECONDITION(aPseudoType <
-                      nsCSSPseudoElements::ePseudo_PseudoElementCount,
+    NS_PRECONDITION(aPseudoType < mozilla::CSSPseudoElementType::Count,
                     "invalid aPseudoType value");
     NS_PRECONDITION(aTreeMatchContext.mForStyling, "Styling here!");
     NS_PRECONDITION(aRuleWalker, "Must have rule walker");
   }
 
   nsCSSPseudoElements::Type mPseudoType;
   mozilla::dom::Element* const mPseudoElement; // weak ref
 };
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -84,17 +84,17 @@ nsStyleContext::nsStyleContext(nsStyleCo
 #ifdef DEBUG
   , mFrameRefCnt(0)
   , mComputingStruct(nsStyleStructID_None)
 #endif
 {
   // This check has to be done "backward", because if it were written the
   // more natural way it wouldn't fail even when it needed to.
   static_assert((UINT64_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
-                nsCSSPseudoElements::ePseudo_MAX,
+                 static_cast<uint8_t>(CSSPseudoElementType::MAX),
                 "pseudo element bits no longer fit in a uint64_t");
   MOZ_ASSERT(aRuleNode);
 
 #ifdef DEBUG
   static_assert(MOZ_ARRAY_LENGTH(nsStyleContext::sDependencyTable)
                   == nsStyleStructID_Length,
                 "Number of items in dependency table doesn't match IDs");
 #endif
@@ -521,17 +521,17 @@ ShouldSuppressLineBreak(const nsStyleCon
   if (aDisplay->IsOutOfFlowStyle()) {
     return false;
   }
   // Display value of any anonymous box should not be touched. In most
   // cases, anonymous boxes are actually not in ruby frame, but instead,
   // some other frame with a ruby display value. Non-element pseudos
   // which represents text frames, as well as ruby pseudos are excluded
   // because we still want to set the flag for them.
-  if (aContext->GetPseudoType() == nsCSSPseudoElements::ePseudo_AnonBox &&
+  if (aContext->GetPseudoType() == CSSPseudoElementType::AnonBox &&
       aContext->GetPseudo() != nsCSSAnonBoxes::mozNonElement &&
       !RubyUtils::IsRubyPseudo(aContext->GetPseudo())) {
     return false;
   }
   if (aParentContext->ShouldSuppressLineBreak()) {
     // Line break suppressing bit is propagated to any children of
     // line participants, which include inline, contents, and inline
     // ruby boxes.
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -886,17 +886,17 @@ nsStyleSet::GetContext(nsStyleContext* a
                        nsRuleNode* aVisitedRuleNode,
                        nsIAtom* aPseudoTag,
                        nsCSSPseudoElements::Type aPseudoType,
                        Element* aElementForAnimation,
                        uint32_t aFlags)
 {
   NS_PRECONDITION((!aPseudoTag &&
                    aPseudoType ==
-                     nsCSSPseudoElements::ePseudo_NotPseudoElement) ||
+                     CSSPseudoElementType::NotPseudo) ||
                   (aPseudoTag &&
                    nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
                      aPseudoType),
                   "Pseudo mismatch");
 
   if (aVisitedRuleNode == aRuleNode) {
     // No need to force creation of a visited style in this case.
     aVisitedRuleNode = nullptr;
@@ -1011,17 +1011,17 @@ nsStyleSet::GetContext(nsStyleContext* a
       result = GetContext(aParentContext, ruleNode, visitedRuleNode,
                           aPseudoTag, aPseudoType, nullptr,
                           aFlags & ~eDoAnimation);
     }
   }
 
   if (aElementForAnimation &&
       aElementForAnimation->IsHTMLElement(nsGkAtoms::body) &&
-      aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement &&
+      aPseudoType == CSSPseudoElementType::NotPseudo &&
       PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) {
     nsIDocument* doc = aElementForAnimation->GetCurrentDoc();
     if (doc && doc->GetBodyElement() == aElementForAnimation) {
       // Update the prescontext's body color
       PresContext()->SetBodyTextColor(result->StyleColor()->mColor);
     }
   }
 
@@ -1390,17 +1390,17 @@ nsStyleSet::ResolveStyleFor(Element* aEl
                             HasState(NS_EVENT_STATE_VISITED)) {
     flags |= eIsVisitedLink;
   }
   if (aTreeMatchContext.mSkippingParentDisplayBasedStyleFixup) {
     flags |= eSkipParentDisplayBasedStyleFixup;
   }
 
   return GetContext(aParentContext, ruleNode, visitedRuleNode,
-                    nullptr, nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                    nullptr, CSSPseudoElementType::NotPseudo,
                     aElement, flags);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
                                  const nsTArray< nsCOMPtr<nsIStyleRule> > &aRules)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
@@ -1409,17 +1409,17 @@ nsStyleSet::ResolveStyleForRules(nsStyle
   // FIXME: Perhaps this should be passed in, but it probably doesn't
   // matter.
   ruleWalker.SetLevel(SheetType::Doc, false, false);
   for (uint32_t i = 0; i < aRules.Length(); i++) {
     ruleWalker.ForwardOnPossiblyCSSRule(aRules.ElementAt(i));
   }
 
   return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
-                    nullptr, nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                    nullptr, CSSPseudoElementType::NotPseudo,
                     nullptr, eNoFlags);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
                                       const nsCOMArray<nsIStyleRule> &aRules)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
@@ -1505,17 +1505,17 @@ nsStyleSet::RuleNodeWithReplacement(Elem
                                     Element* aPseudoElement,
                                     nsRuleNode* aOldRuleNode,
                                     nsCSSPseudoElements::Type aPseudoType,
                                     nsRestyleHint aReplacements)
 {
   NS_ASSERTION(mBatching == 0, "rule processors out of date");
 
   MOZ_ASSERT(!aPseudoElement ==
-             (aPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount ||
+             (aPseudoType >= CSSPseudoElementType::Count ||
               !(nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
                 nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType))),
              "should have aPseudoElement only for certain pseudo elements");
 
   MOZ_ASSERT(!(aReplacements & ~(eRestyle_CSSTransitions |
                                  eRestyle_CSSAnimations |
                                  eRestyle_SVGAttrAnimations |
                                  eRestyle_StyleAttribute |
@@ -1560,68 +1560,68 @@ nsStyleSet::RuleNodeWithReplacement(Elem
     bool doReplace = level->mLevelReplacementHint & aReplacements;
 
     ruleWalker.SetLevel(level->mLevel, level->mIsImportant,
                         level->mCheckForImportantRules && doReplace);
 
     if (doReplace) {
       switch (level->mLevel) {
         case SheetType::Animation: {
-          if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-              aPseudoType == nsCSSPseudoElements::ePseudo_before ||
-              aPseudoType == nsCSSPseudoElements::ePseudo_after) {
+          if (aPseudoType == CSSPseudoElementType::NotPseudo ||
+              aPseudoType == CSSPseudoElementType::before ||
+              aPseudoType == CSSPseudoElementType::after) {
             nsIStyleRule* rule = PresContext()->EffectCompositor()->
               GetAnimationRule(aElement, aPseudoType,
                                EffectCompositor::CascadeLevel::Animations);
             if (rule) {
               ruleWalker.ForwardOnPossiblyCSSRule(rule);
               ruleWalker.CurrentNode()->SetIsAnimationRule();
             }
           }
           break;
         }
         case SheetType::Transition: {
-          if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-              aPseudoType == nsCSSPseudoElements::ePseudo_before ||
-              aPseudoType == nsCSSPseudoElements::ePseudo_after) {
+          if (aPseudoType == CSSPseudoElementType::NotPseudo ||
+              aPseudoType == CSSPseudoElementType::before ||
+              aPseudoType == CSSPseudoElementType::after) {
             nsIStyleRule* rule = PresContext()->EffectCompositor()->
               GetAnimationRule(aElement, aPseudoType,
                                EffectCompositor::CascadeLevel::Transitions);
             if (rule) {
               ruleWalker.ForwardOnPossiblyCSSRule(rule);
               ruleWalker.CurrentNode()->SetIsAnimationRule();
             }
           }
           break;
         }
         case SheetType::SVGAttrAnimation: {
           SVGAttrAnimationRuleProcessor* ruleProcessor =
             static_cast<SVGAttrAnimationRuleProcessor*>(
               mRuleProcessors[SheetType::SVGAttrAnimation].get());
           if (ruleProcessor &&
-              aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+              aPseudoType == CSSPseudoElementType::NotPseudo) {
             ruleProcessor->ElementRulesMatching(aElement, &ruleWalker);
           }
           break;
         }
         case SheetType::StyleAttr: {
           if (!level->mIsImportant) {
             // First time through, we handle the non-!important rule.
             nsHTMLCSSStyleSheet* ruleProcessor =
               static_cast<nsHTMLCSSStyleSheet*>(
                 mRuleProcessors[SheetType::StyleAttr].get());
             if (ruleProcessor) {
               lastScopedRN = ruleWalker.CurrentNode();
               if (aPseudoType ==
-                    nsCSSPseudoElements::ePseudo_NotPseudoElement) {
+                    CSSPseudoElementType::NotPseudo) {
                 ruleProcessor->ElementRulesMatching(PresContext(),
                                                     aElement,
                                                     &ruleWalker);
               } else if (aPseudoType <
-                           nsCSSPseudoElements::ePseudo_PseudoElementCount &&
+                           CSSPseudoElementType::Count &&
                          nsCSSPseudoElements::
                            PseudoElementSupportsStyleAttribute(aPseudoType)) {
                 ruleProcessor->PseudoElementRulesMatching(aPseudoElement,
                                                           aPseudoType,
                                                           &ruleWalker);
               }
               lastStyleAttrRN = ruleWalker.CurrentNode();
               haveImportantStyleAttrRules =
@@ -1704,40 +1704,39 @@ nsStyleSet::ResolveStyleWithReplacement(
     if (aOldStyleContext->RelevantLinkVisited()) {
       flags |= eIsVisitedLink;
     }
   }
 
   nsCSSPseudoElements::Type pseudoType = aOldStyleContext->GetPseudoType();
   Element* elementForAnimation = nullptr;
   if (!(aFlags & eSkipStartingAnimations) &&
-      (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-       pseudoType == nsCSSPseudoElements::ePseudo_before ||
-       pseudoType == nsCSSPseudoElements::ePseudo_after)) {
+      (pseudoType == CSSPseudoElementType::NotPseudo ||
+       pseudoType == CSSPseudoElementType::before ||
+       pseudoType == CSSPseudoElementType::after)) {
     // We want to compute a correct elementForAnimation to pass in
     // because at this point the parameter is more than just the element
     // for animation; it's also used for the SetBodyTextColor call when
     // it's the body element.
     // However, we only want to set the flag to call CheckAnimationRule
     // if we're dealing with a replacement (such as style attribute
     // replacement) that could lead to the animation property changing,
     // and we explicitly do NOT want to call CheckAnimationRule when
     // we're trying to do an animation-only update.
     if (aReplacements & ~(eRestyle_CSSTransitions | eRestyle_CSSAnimations)) {
       flags |= eDoAnimation;
     }
     elementForAnimation = aElement;
 #ifdef DEBUG
     {
       nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(elementForAnimation);
-      NS_ASSERTION(pseudoType ==
-                     nsCSSPseudoElements::ePseudo_NotPseudoElement ||
+      NS_ASSERTION(pseudoType == CSSPseudoElementType::NotPseudo ||
                    !styleFrame ||
                    styleFrame->StyleContext()->GetPseudoType() ==
-                     nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                     CSSPseudoElementType::NotPseudo,
                    "aElement should be the element and not the pseudo-element");
     }
 #endif
   }
 
   if (aElement && aElement->IsRootOfAnonymousSubtree()) {
     // For anonymous subtree roots, don't tweak "display" value based on whether
     // or not the parent is styled as a flex/grid container. (If the parent
@@ -1754,19 +1753,19 @@ nsStyleSet::ResolveStyleWithReplacement(
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
                                          nsStyleContext* aStyleContext,
                                          nsRestyleHint aWhichToRemove)
 {
 #ifdef DEBUG
   nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
 #endif
-  MOZ_ASSERT(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-             pseudoType == nsCSSPseudoElements::ePseudo_before ||
-             pseudoType == nsCSSPseudoElements::ePseudo_after,
+  MOZ_ASSERT(pseudoType == CSSPseudoElementType::NotPseudo ||
+             pseudoType == CSSPseudoElementType::before ||
+             pseudoType == CSSPseudoElementType::after,
              "unexpected type for animations");
   RestyleManager* restyleManager = PresContext()->RestyleManager();
 
   bool oldSkipAnimationRules = restyleManager->SkipAnimationRules();
   restyleManager->SetSkipAnimationRules(true);
 
   RefPtr<nsStyleContext> result =
     ResolveStyleWithReplacement(aTarget, nullptr, aStyleContext->GetParent(),
@@ -1778,31 +1777,31 @@ nsStyleSet::ResolveStyleWithoutAnimation
   return result.forget();
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
 {
   return GetContext(aParentContext, mRuleTree, nullptr,
                     nsCSSAnonBoxes::mozNonElement,
-                    nsCSSPseudoElements::ePseudo_AnonBox, nullptr,
+                    CSSPseudoElementType::AnonBox, nullptr,
                     eNoFlags);
 }
 
 void
 nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
                                 nsRuleWalker* aRuleWalker)
 {
   // This needs to match GetPseudoRestriction in nsRuleNode.cpp.
   aRuleWalker->SetLevel(SheetType::Agent, false, false);
-  if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter)
+  if (aPseudoType == CSSPseudoElementType::firstLetter)
     aRuleWalker->Forward(mFirstLetterRule);
-  else if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLine)
+  else if (aPseudoType == CSSPseudoElementType::firstLine)
     aRuleWalker->Forward(mFirstLineRule);
-  else if (aPseudoType == nsCSSPseudoElements::ePseudo_mozPlaceholder)
+  else if (aPseudoType == CSSPseudoElementType::mozPlaceholder)
     aRuleWalker->Forward(mPlaceholderRule);
 }
 
 void
 nsStyleSet::WalkDisableTextZoomRule(Element* aElement, nsRuleWalker* aRuleWalker)
 {
   aRuleWalker->SetLevel(SheetType::Agent, false, false);
   if (aElement->IsSVGElement(nsGkAtoms::text))
@@ -1812,17 +1811,17 @@ nsStyleSet::WalkDisableTextZoomRule(Elem
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
                                       nsCSSPseudoElements::Type aType,
                                       nsStyleContext* aParentContext,
                                       Element* aPseudoElement)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
 
-  NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
+  NS_ASSERTION(aType < CSSPseudoElementType::Count,
                "must have pseudo element type");
   NS_ASSERTION(aParentElement, "Must have parent element");
 
   nsRuleWalker ruleWalker(mRuleTree, mAuthorStyleDisabled);
   TreeMatchContext treeContext(true, nsRuleWalker::eRelevantLinkUnvisited,
                                aParentElement->OwnerDoc());
   InitStyleScopes(treeContext, aParentElement);
   PseudoElementRuleProcessorData data(PresContext(), aParentElement,
@@ -1842,18 +1841,18 @@ nsStyleSet::ResolvePseudoElementStyle(El
     FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
               aParentElement, &ruleWalker);
     visitedRuleNode = ruleWalker.CurrentNode();
   }
 
   // For pseudos, |data.IsLink()| being true means that
   // our parent node is a link.
   uint32_t flags = eNoFlags;
-  if (aType == nsCSSPseudoElements::ePseudo_before ||
-      aType == nsCSSPseudoElements::ePseudo_after) {
+  if (aType == CSSPseudoElementType::before ||
+      aType == CSSPseudoElementType::after) {
     flags |= eDoAnimation;
   } else {
     // Flex and grid containers don't expect to have any pseudo-element children
     // aside from ::before and ::after.  So if we have such a child, we're not
     // actually in a flex/grid container, and we should skip flex/grid item
     // style fixup.
     flags |= eSkipParentDisplayBasedStyleFixup;
   }
@@ -1879,17 +1878,17 @@ already_AddRefed<nsStyleContext>
 nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
                                     nsCSSPseudoElements::Type aType,
                                     nsStyleContext* aParentContext,
                                     TreeMatchContext& aTreeMatchContext,
                                     Element* aPseudoElement)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
 
-  NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
+  NS_ASSERTION(aType < CSSPseudoElementType::Count,
                "must have pseudo element type");
   NS_ASSERTION(aParentElement, "aParentElement must not be null");
 
   nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
   nsRuleWalker ruleWalker(mRuleTree, mAuthorStyleDisabled);
   aTreeMatchContext.ResetForUnvisitedMatching();
   PseudoElementRuleProcessorData data(PresContext(), aParentElement,
                                       &ruleWalker, aType, aTreeMatchContext,
@@ -1914,18 +1913,18 @@ nsStyleSet::ProbePseudoElementStyle(Elem
     FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
               aParentElement, &ruleWalker);
     visitedRuleNode = ruleWalker.CurrentNode();
   }
 
   // For pseudos, |data.IsLink()| being true means that
   // our parent node is a link.
   uint32_t flags = eNoFlags;
-  if (aType == nsCSSPseudoElements::ePseudo_before ||
-      aType == nsCSSPseudoElements::ePseudo_after) {
+  if (aType == CSSPseudoElementType::before ||
+      aType == CSSPseudoElementType::after) {
     flags |= eDoAnimation;
   } else {
     // Flex and grid containers don't expect to have any pseudo-element children
     // aside from ::before and ::after.  So if we have such a child, we're not
     // actually in a flex/grid container, and we should skip flex/grid item
     // style fixup.
     flags |= eSkipParentDisplayBasedStyleFixup;
   }
@@ -1990,17 +1989,17 @@ nsStyleSet::ResolveAnonymousBoxStyle(nsI
       }
     }
     for (uint32_t i = 0, i_end = importantRules.Length(); i != i_end; ++i) {
       ruleWalker.Forward(importantRules[i]);
     }
   }
 
   return GetContext(aParentContext, ruleWalker.CurrentNode(), nullptr,
-                    aPseudoTag, nsCSSPseudoElements::ePseudo_AnonBox,
+                    aPseudoTag, CSSPseudoElementType::AnonBox,
                     nullptr, aFlags);
 }
 
 #ifdef MOZ_XUL
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveXULTreePseudoStyle(Element* aParentElement,
                                       nsIAtom* aPseudoTag,
                                       nsStyleContext* aParentContext,
@@ -2030,17 +2029,17 @@ nsStyleSet::ResolveXULTreePseudoStyle(El
     FileRules(EnumRulesMatching<XULTreeRuleProcessorData>, &data,
               aParentElement, &ruleWalker);
     visitedRuleNode = ruleWalker.CurrentNode();
   }
 
   return GetContext(aParentContext, ruleNode, visitedRuleNode,
                     // For pseudos, |data.IsLink()| being true means that
                     // our parent node is a link.
-                    aPseudoTag, nsCSSPseudoElements::ePseudo_XULTree,
+                    aPseudoTag, CSSPseudoElementType::XULTree,
                     nullptr, eNoFlags);
 }
 #endif
 
 bool
 nsStyleSet::AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
 {
   NS_ENSURE_FALSE(mInShutdown, false);
@@ -2289,19 +2288,19 @@ nsStyleSet::ReparentStyleContext(nsStyle
     // GetContext handles propagating RelevantLinkVisited state from the
     // parent in non-link cases; all we need to pass in is if this link
     // is visited.
     if (aStyleContext->RelevantLinkVisited()) {
       flags |= eIsVisitedLink;
     }
   }
 
-  if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-      pseudoType == nsCSSPseudoElements::ePseudo_before ||
-      pseudoType == nsCSSPseudoElements::ePseudo_after) {
+  if (pseudoType == CSSPseudoElementType::NotPseudo ||
+      pseudoType == CSSPseudoElementType::before ||
+      pseudoType == CSSPseudoElementType::after) {
     flags |= eDoAnimation;
   }
 
   if (aElement && aElement->IsRootOfAnonymousSubtree()) {
     // For anonymous subtree roots, don't tweak "display" value based on whether
     // or not the parent is styled as a flex/grid container. (If the parent
     // has anonymous-subtree kids, then we know it's not actually going to get
     // a flex/grid container frame, anyway.)
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -257,25 +257,25 @@ nsTransitionManager::StyleContextChanged
   // NOTE: Things in this function (and ConsiderStartingTransition)
   // should never call PeekStyleData because we don't preserve gotten
   // structs across reframes.
 
   // Return sooner (before the startedAny check below) for the most
   // common case: no transitions specified or running.
   const nsStyleDisplay *disp = newStyleContext->StyleDisplay();
   nsCSSPseudoElements::Type pseudoType = newStyleContext->GetPseudoType();
-  if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
-    if (pseudoType != nsCSSPseudoElements::ePseudo_before &&
-        pseudoType != nsCSSPseudoElements::ePseudo_after) {
+  if (pseudoType != CSSPseudoElementType::NotPseudo) {
+    if (pseudoType != CSSPseudoElementType::before &&
+        pseudoType != CSSPseudoElementType::after) {
       return;
     }
 
-    NS_ASSERTION((pseudoType == nsCSSPseudoElements::ePseudo_before &&
+    NS_ASSERTION((pseudoType == CSSPseudoElementType::before &&
                   aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore) ||
-                 (pseudoType == nsCSSPseudoElements::ePseudo_after &&
+                 (pseudoType == CSSPseudoElementType::after &&
                   aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter),
                  "Unexpected aElement coming through");
 
     // Else the element we want to use from now on is the element the
     // :before or :after is attached to.
     aElement = aElement->GetParent()->AsElement();
   }