Bug 1244049 - Part 2: Replace nsCSSPseudoElements::Type with CSSPseudoElementType. r=dbaron
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 17 Feb 2016 21:37:00 +0100
changeset 307705 248497c0c18dea01a6b076483b9cd1f85621e2e8
parent 307704 4a020e2e4acec77f56e1ccea319765a7e18c74c9
child 307706 1f67b24cbb75f685cde5a156adac09d532aab003
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 2: Replace nsCSSPseudoElements::Type with CSSPseudoElementType. r=dbaron Also, try to use forward declaraions for CSSPseudoElementType;
dom/animation/Animation.cpp
dom/animation/CSSPseudoElement.cpp
dom/animation/CSSPseudoElement.h
dom/animation/EffectCompositor.cpp
dom/animation/EffectCompositor.h
dom/animation/EffectSet.cpp
dom/animation/EffectSet.h
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
dom/animation/PseudoElementHashEntry.h
dom/base/nsDOMMutationObserver.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsNodeUtils.cpp
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/forms/nsColorControlFrame.cpp
layout/forms/nsColorControlFrame.h
layout/forms/nsMeterFrame.cpp
layout/forms/nsMeterFrame.h
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsNumberControlFrame.h
layout/forms/nsProgressFrame.cpp
layout/forms/nsProgressFrame.h
layout/forms/nsRangeFrame.cpp
layout/forms/nsRangeFrame.h
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsIFrame.h
layout/inspector/inDOMUtils.cpp
layout/mathml/nsMathMLFrame.cpp
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/StyleAnimationValue.cpp
layout/style/StyleAnimationValue.h
layout/style/StyleRule.cpp
layout/style/StyleRule.h
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsCSSParser.cpp
layout/style/nsCSSPseudoElements.cpp
layout/style/nsCSSPseudoElements.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsCSSRuleProcessor.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsHTMLCSSStyleSheet.h
layout/style/nsRuleProcessorData.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
layout/style/nsStyleSet.cpp
layout/style/nsStyleSet.h
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1102,17 +1102,17 @@ void
 Animation::PostUpdate()
 {
   nsPresContext* presContext = GetPresContext();
   if (!presContext) {
     return;
   }
 
   Element* targetElement;
-  nsCSSPseudoElements::Type targetPseudoType;
+  CSSPseudoElementType targetPseudoType;
   mEffect->GetTarget(targetElement, targetPseudoType);
   if (!targetElement) {
     return;
   }
 
   presContext->EffectCompositor()
              ->RequestRestyle(targetElement,
                               targetPseudoType,
--- a/dom/animation/CSSPseudoElement.cpp
+++ b/dom/animation/CSSPseudoElement.cpp
@@ -12,17 +12,17 @@ namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CSSPseudoElement, mParentElement)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CSSPseudoElement, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CSSPseudoElement, Release)
 
 CSSPseudoElement::CSSPseudoElement(Element* aElement,
-                                   nsCSSPseudoElements::Type aType)
+                                   CSSPseudoElementType aType)
   : mParentElement(aElement)
   , mPseudoType(aType)
 {
   MOZ_ASSERT(aElement);
   MOZ_ASSERT(aType == CSSPseudoElementType::after ||
              aType == CSSPseudoElementType::before,
              "Unexpected Pseudo Type");
 }
@@ -64,17 +64,17 @@ CSSPseudoElement::Animate(
 {
   // Bug 1241784: Implement this API.
   NS_NOTREACHED("CSSPseudoElement::Animate() is not implemented yet.");
   return nullptr;
 }
 
 /* static */ already_AddRefed<CSSPseudoElement>
 CSSPseudoElement::GetCSSPseudoElement(Element* aElement,
-                                      nsCSSPseudoElements::Type aType)
+                                      CSSPseudoElementType aType)
 {
   if (!aElement) {
     return nullptr;
   }
 
   nsIAtom* propName = CSSPseudoElement::GetCSSPseudoElementPropertyAtom(aType);
   RefPtr<CSSPseudoElement> pseudo =
     static_cast<CSSPseudoElement*>(aElement->GetProperty(propName));
@@ -91,18 +91,17 @@ CSSPseudoElement::GetCSSPseudoElement(El
   if (NS_FAILED(rv)) {
     NS_WARNING("SetProperty failed");
     return nullptr;
   }
   return pseudo.forget();
 }
 
 /* static */ nsIAtom*
-CSSPseudoElement::GetCSSPseudoElementPropertyAtom(
-    nsCSSPseudoElements::Type aType)
+CSSPseudoElement::GetCSSPseudoElementPropertyAtom(CSSPseudoElementType aType)
 {
   switch (aType) {
     case CSSPseudoElementType::before:
       return nsGkAtoms::cssPseudoElementBeforeProperty;
 
     case CSSPseudoElementType::after:
       return nsGkAtoms::cssPseudoElementAfterProperty;
 
--- a/dom/animation/CSSPseudoElement.h
+++ b/dom/animation/CSSPseudoElement.h
@@ -33,17 +33,17 @@ protected:
   virtual ~CSSPseudoElement();
 
 public:
   ParentObject GetParentObject() const;
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
-  nsCSSPseudoElements::Type GetType() const { return mPseudoType; }
+  CSSPseudoElementType GetType() const { return mPseudoType; }
   void GetType(nsString& aRetVal) const
   {
     MOZ_ASSERT(nsCSSPseudoElements::GetPseudoAtom(mPseudoType),
                "All pseudo-types allowed by this class should have a"
                " corresponding atom");
     nsCSSPseudoElements::GetPseudoAtom(mPseudoType)->ToString(aRetVal);
   }
   already_AddRefed<Element> ParentElement() const
@@ -59,28 +59,27 @@ public:
             const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
             ErrorResult& aError);
 
   // Given an element:pseudoType pair, returns the CSSPseudoElement stored as a
   // property on |aElement|. If there is no CSSPseudoElement for the specified
   // pseudo-type on element, a new CSSPseudoElement will be created and stored
   // on the element.
   static already_AddRefed<CSSPseudoElement>
-    GetCSSPseudoElement(Element* aElement, nsCSSPseudoElements::Type aType);
+    GetCSSPseudoElement(Element* aElement, CSSPseudoElementType aType);
 
 private:
   // Only ::before and ::after are supported.
-  CSSPseudoElement(Element* aElement, nsCSSPseudoElements::Type aType);
+  CSSPseudoElement(Element* aElement, CSSPseudoElementType aType);
 
-  static nsIAtom*
-  GetCSSPseudoElementPropertyAtom(nsCSSPseudoElements::Type aType);
+  static nsIAtom* GetCSSPseudoElementPropertyAtom(CSSPseudoElementType aType);
 
   // mParentElement needs to be an owning reference since if script is holding
   // on to the pseudo-element, it needs to continue to be able to refer to
   // the parent element.
   RefPtr<Element> mParentElement;
-  nsCSSPseudoElements::Type mPseudoType;
+  CSSPseudoElementType mPseudoType;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_CSSPseudoElement_h
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -11,16 +11,17 @@
 #include "mozilla/dom/KeyframeEffect.h" // For KeyframeEffectReadOnly
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/InitializerList.h"
 #include "mozilla/LayerAnimationInfo.h"
 #include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent
 #include "nsCSSPropertySet.h"
 #include "nsCSSProps.h"
+#include "nsCSSPseudoElements.h"
 #include "nsIPresShell.h"
 #include "nsLayoutUtils.h"
 #include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
 #include "nsRuleProcessorData.h" // For ElementRuleProcessorData etc.
 #include "nsTArray.h"
 #include "RestyleManager.h"
 
 using mozilla::dom::Animation;
@@ -75,17 +76,17 @@ FindAnimationsForCompositor(const nsIFra
 
   // The animation cascade will almost always be up-to-date by this point
   // but there are some cases such as when we are restoring the refresh driver
   // from test control after seeking where it might not be the case.
   //
   // Those cases are probably not important but just to be safe, let's make
   // sure the cascade is up to date since if it *is* up to date, this is
   // basically a no-op.
-  Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>> pseudoElement =
+  Maybe<Pair<dom::Element*, CSSPseudoElementType>> pseudoElement =
     EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
   if (pseudoElement) {
     EffectCompositor::MaybeUpdateCascadeResults(pseudoElement->first(),
                                                 pseudoElement->second(),
                                                 aFrame->StyleContext());
   }
 
   if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
@@ -126,17 +127,17 @@ FindAnimationsForCompositor(const nsIFra
 
   MOZ_ASSERT(!foundSome || !aMatches || !aMatches->IsEmpty(),
              "If return value is true, matches array should be non-empty");
   return foundSome;
 }
 
 void
 EffectCompositor::RequestRestyle(dom::Element* aElement,
-                                 nsCSSPseudoElements::Type aPseudoType,
+                                 CSSPseudoElementType aPseudoType,
                                  RestyleType aRestyleType,
                                  CascadeLevel aCascadeLevel)
 {
   if (!mPresContext) {
     // Pres context will be null after the effect compositor is disconnected.
     return;
   }
 
@@ -166,17 +167,17 @@ EffectCompositor::RequestRestyle(dom::El
     if (effectSet) {
       effectSet->UpdateAnimationGeneration(mPresContext);
     }
   }
 }
 
 void
 EffectCompositor::PostRestyleForAnimation(dom::Element* aElement,
-                                          nsCSSPseudoElements::Type aPseudoType,
+                                          CSSPseudoElementType aPseudoType,
                                           CascadeLevel aCascadeLevel)
 {
   if (!mPresContext) {
     return;
   }
 
   dom::Element* element = GetElementToRestyle(aElement, aPseudoType);
   if (!element) {
@@ -207,18 +208,17 @@ EffectCompositor::PostRestyleForThrottle
                               cascadeLevel);
       postedRestyle = true;
     }
   }
 }
 
 void
 EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
-                                           nsCSSPseudoElements::Type
-                                             aPseudoType,
+                                           CSSPseudoElementType aPseudoType,
                                            CascadeLevel aCascadeLevel)
 {
   // First update cascade results since that may cause some elements to
   // be marked as needing a restyle.
   MaybeUpdateCascadeResults(aElement, aPseudoType);
 
   auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
   PseudoElementHashKey key = { aElement, aPseudoType };
@@ -230,17 +230,17 @@ EffectCompositor::MaybeUpdateAnimationRu
   ComposeAnimationRule(aElement, aPseudoType, aCascadeLevel,
                        mPresContext->RefreshDriver()->MostRecentRefresh());
 
   elementsToRestyle.Remove(key);
 }
 
 nsIStyleRule*
 EffectCompositor::GetAnimationRule(dom::Element* aElement,
-                                   nsCSSPseudoElements::Type aPseudoType,
+                                   CSSPseudoElementType aPseudoType,
                                    CascadeLevel aCascadeLevel)
 {
   // NOTE: We need to be careful about early returns in this method where
   // we *don't* update mElementsToRestyle. When we get a call to
   // RequestRestyle that results in a call to PostRestyleForAnimation, we
   // will set a bool flag in mElementsToRestyle indicating that we've
   // called PostRestyleForAnimation so we don't need to call it again
   // until that restyle happens. During that restyle, if we arrive here
@@ -276,17 +276,17 @@ EffectCompositor::GetAnimationRule(dom::
     return nullptr;
   }
 
   return effectSet->AnimationRule(aCascadeLevel);
 }
 
 /* static */ dom::Element*
 EffectCompositor::GetElementToRestyle(dom::Element* aElement,
-                                      nsCSSPseudoElements::Type aPseudoType)
+                                      CSSPseudoElementType aPseudoType)
 {
   if (aPseudoType == CSSPseudoElementType::NotPseudo) {
     return aElement;
   }
 
   nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
   if (!primaryFrame) {
     return nullptr;
@@ -412,34 +412,32 @@ EffectCompositor::ClearIsRunningOnCompos
 
   for (KeyframeEffectReadOnly* effect : *effects) {
     effect->SetIsRunningOnCompositor(aProperty, false);
   }
 }
 
 /* static */ void
 EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
-                                            nsCSSPseudoElements::Type
-                                              aPseudoType,
+                                            CSSPseudoElementType aPseudoType,
                                             nsStyleContext* aStyleContext)
 {
   EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
   if (!effects || !effects->CascadeNeedsUpdate()) {
     return;
   }
 
   UpdateCascadeResults(*effects, aElement, aPseudoType, aStyleContext);
 
   MOZ_ASSERT(!effects->CascadeNeedsUpdate(), "Failed to update cascade state");
 }
 
 /* static */ void
 EffectCompositor::MaybeUpdateCascadeResults(Element* aElement,
-                                            nsCSSPseudoElements::Type
-                                              aPseudoType)
+                                            CSSPseudoElementType aPseudoType)
 {
   nsStyleContext* styleContext = nullptr;
   {
     dom::Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
     if (elementToRestyle) {
       nsIFrame* frame = elementToRestyle->GetPrimaryFrame();
       if (frame) {
         styleContext = frame->StyleContext();
@@ -469,40 +467,39 @@ namespace {
           b->GetAnimation()->HasLowerCompositeOrderThan(*a->GetAnimation()));
       return a->GetAnimation()->HasLowerCompositeOrderThan(*b->GetAnimation());
     }
   };
 }
 
 /* static */ void
 EffectCompositor::UpdateCascadeResults(Element* aElement,
-                                       nsCSSPseudoElements::Type aPseudoType,
+                                       CSSPseudoElementType aPseudoType,
                                        nsStyleContext* aStyleContext)
 {
   EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
   if (!effects) {
     return;
   }
 
   UpdateCascadeResults(*effects, aElement, aPseudoType, aStyleContext);
 }
 
-/* static */ Maybe<Pair<Element*, nsCSSPseudoElements::Type>>
+/* static */ Maybe<Pair<Element*, CSSPseudoElementType>>
 EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
 {
   // Always return the same object to benefit from return-value optimization.
-  Maybe<Pair<Element*, nsCSSPseudoElements::Type>> result;
+  Maybe<Pair<Element*, CSSPseudoElementType>> result;
 
   nsIContent* content = aFrame->GetContent();
   if (!content) {
     return result;
   }
 
-  nsCSSPseudoElements::Type pseudoType =
-    CSSPseudoElementType::NotPseudo;
+  CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
 
   if (aFrame->IsGeneratedContentFrame()) {
     nsIFrame* parent = aFrame->GetParent();
     if (parent->IsGeneratedContentFrame()) {
       return result;
     }
     nsIAtom* name = content->NodeInfo()->NameAtom();
     if (name == nsGkAtoms::mozgeneratedcontentbefore) {
@@ -529,17 +526,17 @@ EffectCompositor::GetAnimationElementAnd
 
   result = Some(MakePair(content->AsElement(), pseudoType));
 
   return result;
 }
 
 /* static */ void
 EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
-                                       nsCSSPseudoElements::Type aPseudoType,
+                                       CSSPseudoElementType aPseudoType,
                                        CascadeLevel aCascadeLevel,
                                        TimeStamp aRefreshTime)
 {
   EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
   if (!effects) {
     return;
   }
 
@@ -610,17 +607,17 @@ EffectCompositor::GetOverriddenPropertie
   nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack,
                                                    aStyleContext,
                                                    aPropertiesOverridden);
 }
 
 /* static */ void
 EffectCompositor::UpdateCascadeResults(EffectSet& aEffectSet,
                                        Element* aElement,
-                                       nsCSSPseudoElements::Type aPseudoType,
+                                       CSSPseudoElementType aPseudoType,
                                        nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(EffectSet::GetEffectSet(aElement, aPseudoType) == &aEffectSet,
              "Effect set should correspond to the specified (pseudo-)element");
   if (aEffectSet.IsEmpty()) {
     aEffectSet.MarkCascadeUpdated();
     return;
   }
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -9,32 +9,32 @@
 
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/Pair.h"
 #include "mozilla/PseudoElementHashEntry.h"
 #include "mozilla/RefPtr.h"
 #include "nsCSSProperty.h"
-#include "nsCSSPseudoElements.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDataHashtable.h"
 #include "nsIStyleRuleProcessor.h"
 #include "nsTArray.h"
 
 class nsCSSPropertySet;
 class nsIFrame;
 class nsIStyleRule;
 class nsPresContext;
 class nsStyleContext;
 
 namespace mozilla {
 
 class EffectSet;
 class RestyleTracker;
+enum class CSSPseudoElementType : uint8_t;
 
 namespace dom {
 class Animation;
 class Element;
 }
 
 class EffectCompositor
 {
@@ -89,43 +89,43 @@ public:
     Layer
   };
 
   // Notifies the compositor that the animation rule for the specified
   // (pseudo-)element at the specified cascade level needs to be updated.
   // The specified steps taken to update the animation rule depend on
   // |aRestyleType| whose values are described above.
   void RequestRestyle(dom::Element* aElement,
-                      nsCSSPseudoElements::Type aPseudoType,
+                      CSSPseudoElementType aPseudoType,
                       RestyleType aRestyleType,
                       CascadeLevel aCascadeLevel);
 
   // Schedule an animation restyle. This is called automatically by
   // RequestRestyle when necessary. However, it is exposed here since we also
   // need to perform this step when triggering transitions *without* also
   // invalidating the animation style rule (which RequestRestyle would do).
   void PostRestyleForAnimation(dom::Element* aElement,
-                               nsCSSPseudoElements::Type aPseudoType,
+                               CSSPseudoElementType aPseudoType,
                                CascadeLevel aCascadeLevel);
 
   // Posts an animation restyle for any elements whose animation style rule
   // is out of date but for which an animation restyle has not yet been
   // posted because updates on the main thread are throttled.
   void PostRestyleForThrottledAnimations();
 
   // Updates the animation rule stored on the EffectSet for the
   // specified (pseudo-)element for cascade level |aLevel|.
   // If the animation rule is not marked as needing an update,
   // no work is done.
   void MaybeUpdateAnimationRule(dom::Element* aElement,
-                                nsCSSPseudoElements::Type aPseudoType,
+                                CSSPseudoElementType aPseudoType,
                                 CascadeLevel aCascadeLevel);
 
   nsIStyleRule* GetAnimationRule(dom::Element* aElement,
-                                 nsCSSPseudoElements::Type aPseudoType,
+                                 CSSPseudoElementType aPseudoType,
                                  CascadeLevel aCascadeLevel);
 
   bool HasPendingStyleUpdates() const;
   bool HasThrottledStyleUpdates() const;
 
   // Tell the restyle tracker about all the animated styles that have
   // pending updates so that it can update the animation rule for these
   // elements.
@@ -150,74 +150,74 @@ public:
   // but only if we have marked the cascade as needing an update due a
   // the change in the set of effects or a change in one of the effects'
   // "in effect" state.
   //
   // This method does NOT detect if other styles that apply above the
   // animation level of the cascade have changed.
   static void
   MaybeUpdateCascadeResults(dom::Element* aElement,
-                            nsCSSPseudoElements::Type aPseudoType,
+                            CSSPseudoElementType aPseudoType,
                             nsStyleContext* aStyleContext);
 
   // An overload of MaybeUpdateCascadeResults that uses the style context
   // of the primary frame of the specified (pseudo-)element, when available.
   static void
   MaybeUpdateCascadeResults(dom::Element* aElement,
-                            nsCSSPseudoElements::Type aPseudoType);
+                            CSSPseudoElementType aPseudoType);
 
   // Update the mWinsInCascade member for each property in effects targetting
   // the specified (pseudo-)element.
   //
   // This can be expensive so we should only call it if styles that apply
   // above the animation level of the cascade might have changed. For all
   // other cases we should call MaybeUpdateCascadeResults.
   static void
   UpdateCascadeResults(dom::Element* aElement,
-                       nsCSSPseudoElements::Type aPseudoType,
+                       CSSPseudoElementType aPseudoType,
                        nsStyleContext* aStyleContext);
 
   // Helper to fetch the corresponding element and pseudo-type from a frame.
   //
   // For frames corresponding to pseudo-elements, the returned element is the
   // element on which we store the animations (i.e. the EffectSet and/or
   // AnimationCollection), *not* the generated content.
   //
   // Returns an empty result when a suitable element cannot be found including
   // when the frame represents a pseudo-element on which we do not support
   // animations.
-  static Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>>
+  static Maybe<Pair<dom::Element*, CSSPseudoElementType>>
   GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame);
 
 private:
   ~EffectCompositor() = default;
 
   // Rebuilds the animation rule corresponding to |aCascadeLevel| on the
   // EffectSet associated with the specified (pseudo-)element.
   static void ComposeAnimationRule(dom::Element* aElement,
-                                   nsCSSPseudoElements::Type aPseudoType,
+                                   CSSPseudoElementType aPseudoType,
                                    CascadeLevel aCascadeLevel,
                                    TimeStamp aRefreshTime);
 
   static dom::Element* GetElementToRestyle(dom::Element* aElement,
-                                           nsCSSPseudoElements::Type
+                                           CSSPseudoElementType
                                              aPseudoType);
 
   // Get the properties in |aEffectSet| that we are able to animate on the
   // compositor but which are also specified at a higher level in the cascade
   // than the animations level in |aStyleContext|.
   static void
   GetOverriddenProperties(nsStyleContext* aStyleContext,
                           EffectSet& aEffectSet,
                           nsCSSPropertySet& aPropertiesOverridden);
 
   static void
   UpdateCascadeResults(EffectSet& aEffectSet,
                        dom::Element* aElement,
-                       nsCSSPseudoElements::Type aPseudoType,
+                       CSSPseudoElementType aPseudoType,
                        nsStyleContext* aStyleContext);
 
   static nsPresContext* GetPresContext(dom::Element* aElement);
 
   nsPresContext* mPresContext;
 
   // Elements with a pending animation restyle. The associated bool value is
   // true if a pending animation restyle has also been dispatched. For
--- a/dom/animation/EffectSet.cpp
+++ b/dom/animation/EffectSet.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "EffectSet.h"
 #include "mozilla/dom/Element.h" // For Element
 #include "RestyleManager.h"
+#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
 #include "nsCycleCollectionNoteChild.h" // For CycleCollectionNoteChild
 #include "nsPresContext.h"
 #include "nsLayoutUtils.h"
 
 namespace mozilla {
 
 /* static */ void
 EffectSet::PropertyDtor(void* aObject, nsIAtom* aPropertyName,
@@ -33,17 +34,17 @@ EffectSet::Traverse(nsCycleCollectionTra
   for (auto iter = mEffects.Iter(); !iter.Done(); iter.Next()) {
     CycleCollectionNoteChild(aCallback, iter.Get()->GetKey(),
                              "EffectSet::mEffects[]", aCallback.Flags());
   }
 }
 
 /* static */ EffectSet*
 EffectSet::GetEffectSet(dom::Element* aElement,
-                        nsCSSPseudoElements::Type aPseudoType)
+                        CSSPseudoElementType aPseudoType)
 {
   nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
   return static_cast<EffectSet*>(aElement->GetProperty(propName));
 }
 
 /* static */ EffectSet*
 EffectSet::GetEffectSet(const nsIFrame* aFrame)
 {
@@ -82,17 +83,17 @@ EffectSet::GetEffectSet(const nsIFrame* 
     return nullptr;
   }
 
   return static_cast<EffectSet*>(content->GetProperty(propName));
 }
 
 /* static */ EffectSet*
 EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
-                                nsCSSPseudoElements::Type aPseudoType)
+                                CSSPseudoElementType aPseudoType)
 {
   EffectSet* effectSet = GetEffectSet(aElement, aPseudoType);
   if (effectSet) {
     return effectSet;
   }
 
   nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
   effectSet = new EffectSet();
@@ -109,17 +110,17 @@ EffectSet::GetOrCreateEffectSet(dom::Ele
 
   aElement->SetMayHaveAnimations();
 
   return effectSet;
 }
 
 /* static */ void
 EffectSet::DestroyEffectSet(dom::Element* aElement,
-                            nsCSSPseudoElements::Type aPseudoType)
+                            CSSPseudoElementType aPseudoType)
 {
   nsIAtom* propName = GetEffectSetPropertyAtom(aPseudoType);
   EffectSet* effectSet =
     static_cast<EffectSet*>(aElement->GetProperty(propName));
   if (!effectSet) {
     return;
   }
 
@@ -147,17 +148,17 @@ EffectSet::GetEffectSetPropertyAtoms()
       nsGkAtoms::animationEffectsForAfterProperty,
       nullptr
     };
 
   return effectSetPropertyAtoms;
 }
 
 /* static */ nsIAtom*
-EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
+EffectSet::GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType)
 {
   switch (aPseudoType) {
     case CSSPseudoElementType::NotPseudo:
       return nsGkAtoms::animationEffectsProperty;
 
     case CSSPseudoElementType::before:
       return nsGkAtoms::animationEffectsForBeforeProperty;
 
--- a/dom/animation/EffectSet.h
+++ b/dom/animation/EffectSet.h
@@ -7,29 +7,30 @@
 #ifndef mozilla_EffectSet_h
 #define mozilla_EffectSet_h
 
 #include "mozilla/AnimValuesStyleRule.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/TimeStamp.h"
-#include "nsCSSPseudoElements.h" // For nsCSSPseudoElements::Type
 #include "nsHashKeys.h" // For nsPtrHashKey
 #include "nsTHashtable.h" // For nsTHashtable
 
 class nsPresContext;
 
 namespace mozilla {
 
 namespace dom {
 class Element;
 class KeyframeEffectReadOnly;
 } // namespace dom
 
+enum class CSSPseudoElementType : uint8_t;
+
 // A wrapper around a hashset of AnimationEffect objects to handle
 // storing the set as a property of an element.
 class EffectSet
 {
 public:
   EffectSet()
     : mCascadeNeedsUpdate(false)
     , mAnimationGeneration(0)
@@ -52,22 +53,22 @@ public:
   }
   static void PropertyDtor(void* aObject, nsIAtom* aPropertyName,
                            void* aPropertyValue, void* aData);
 
   // Methods for supporting cycle-collection
   void Traverse(nsCycleCollectionTraversalCallback& aCallback);
 
   static EffectSet* GetEffectSet(dom::Element* aElement,
-                                 nsCSSPseudoElements::Type aPseudoType);
+                                 CSSPseudoElementType aPseudoType);
   static EffectSet* GetEffectSet(const nsIFrame* aFrame);
   static EffectSet* GetOrCreateEffectSet(dom::Element* aElement,
-                                         nsCSSPseudoElements::Type aPseudoType);
+                                         CSSPseudoElementType aPseudoType);
   static void DestroyEffectSet(dom::Element* aElement,
-                               nsCSSPseudoElements::Type aPseudoType);
+                               CSSPseudoElementType aPseudoType);
 
   void AddEffect(dom::KeyframeEffectReadOnly& aEffect);
   void RemoveEffect(dom::KeyframeEffectReadOnly& aEffect);
 
 private:
   typedef nsTHashtable<nsRefPtrHashKey<dom::KeyframeEffectReadOnly>>
     OwningEffectSet;
 
@@ -177,18 +178,17 @@ public:
   void MarkCascadeUpdated() { mCascadeNeedsUpdate = false; }
 
   void UpdateAnimationGeneration(nsPresContext* aPresContext);
   uint64_t GetAnimationGeneration() const { return mAnimationGeneration; }
 
   static nsIAtom** GetEffectSetPropertyAtoms();
 
 private:
-  static nsIAtom* GetEffectSetPropertyAtom(nsCSSPseudoElements::Type
-                                             aPseudoType);
+  static nsIAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
 
   OwningEffectSet mEffects;
 
   // These style rules contain the style data for currently animating
   // values.  They only match when styling with animation.  When we
   // style without animation, we need to not use them so that we can
   // detect any new changes; if necessary we restyle immediately
   // afterwards with animation.
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -12,16 +12,17 @@
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
 #include "mozilla/StyleAnimationValue.h"
 #include "Layers.h" // For Layer
 #include "nsCSSParser.h"
 #include "nsCSSPropertySet.h"
 #include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
+#include "nsCSSPseudoElements.h"
 #include "nsCSSValue.h"
 #include "nsStyleUtil.h"
 #include <algorithm> // For std::max
 
 namespace mozilla {
 
 // Helper functions for generating a ComputedTimingProperties dictionary
 static void
@@ -69,27 +70,27 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_
 NS_INTERFACE_MAP_END_INHERITING(AnimationEffectReadOnly)
 
 NS_IMPL_ADDREF_INHERITED(KeyframeEffectReadOnly, AnimationEffectReadOnly)
 NS_IMPL_RELEASE_INHERITED(KeyframeEffectReadOnly, AnimationEffectReadOnly)
 
 KeyframeEffectReadOnly::KeyframeEffectReadOnly(
   nsIDocument* aDocument,
   Element* aTarget,
-  nsCSSPseudoElements::Type aPseudoType,
+  CSSPseudoElementType aPseudoType,
   const TimingParams& aTiming)
   : KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
                            new AnimationEffectTimingReadOnly(aTiming))
 {
 }
 
 KeyframeEffectReadOnly::KeyframeEffectReadOnly(
   nsIDocument* aDocument,
   Element* aTarget,
-  nsCSSPseudoElements::Type aPseudoType,
+  CSSPseudoElementType aPseudoType,
   AnimationEffectTimingReadOnly* aTiming)
   : AnimationEffectReadOnly(aDocument)
   , mTarget(aTarget)
   , mTiming(*aTiming)
   , mPseudoType(aPseudoType)
   , mInEffectOnLastAnimationTimingUpdate(false)
 {
   MOZ_ASSERT(aTiming);
@@ -619,17 +620,17 @@ KeyframeEffectReadOnly::ConstructKeyfram
     return nullptr;
   }
 
   const ElementOrCSSPseudoElement& target = aTarget.Value();
   MOZ_ASSERT(target.IsElement() || target.IsCSSPseudoElement(),
              "Uninitialized target");
 
   RefPtr<Element> targetElement;
-  nsCSSPseudoElements::Type pseudoType = CSSPseudoElementType::NotPseudo;
+  CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
   if (target.IsElement()) {
     targetElement = &target.GetAsElement();
   } else {
     targetElement = target.GetAsCSSPseudoElement().ParentElement();
     pseudoType = target.GetAsCSSPseudoElement().GetType();
   }
 
   if (!targetElement->GetComposedDoc()) {
@@ -1224,17 +1225,17 @@ ApplyDistributeSpacing(nsTArray<OffsetIn
  * @param aTarget The target of the animation.
  * @param aPseudoType The pseudo type of the target if it is a pseudo element.
  * @param aKeyframes The keyframes to read.
  * @param aResult The array to append the resulting KeyframeValueEntry
  *   objects to.
  */
 static void
 GenerateValueEntries(Element* aTarget,
-                     nsCSSPseudoElements::Type aPseudoType,
+                     CSSPseudoElementType aPseudoType,
                      nsTArray<OffsetIndexedKeyframe>& aKeyframes,
                      nsTArray<KeyframeValueEntry>& aResult,
                      ErrorResult& aRv)
 {
   nsCSSPropertySet properties;              // All properties encountered.
   nsCSSPropertySet propertiesWithFromValue; // Those with a defined 0% value.
   nsCSSPropertySet propertiesWithToValue;   // Those with a defined 100% value.
 
@@ -1428,17 +1429,17 @@ BuildSegmentsFromValueEntries(nsTArray<K
  *   object to iterate over as a sequence.
  * @param aResult The array into which the resulting AnimationProperty
  *   objects will be appended.
  */
 static void
 BuildAnimationPropertyListFromKeyframeSequence(
     JSContext* aCx,
     Element* aTarget,
-    nsCSSPseudoElements::Type aPseudoType,
+    CSSPseudoElementType aPseudoType,
     JS::ForOfIterator& aIterator,
     nsTArray<AnimationProperty>& aResult,
     ErrorResult& aRv)
 {
   // Convert the object in aIterator to sequence<Keyframe>, producing
   // an array of OffsetIndexedKeyframe objects.
   AutoTArray<OffsetIndexedKeyframe,4> keyframes;
   if (!ConvertKeyframeSequence(aCx, aIterator, keyframes)) {
@@ -1486,17 +1487,17 @@ BuildAnimationPropertyListFromKeyframeSe
  * @param aValue The JS object.
  * @param aResult The array into which the resulting AnimationProperty
  *   objects will be appended.
  */
 static void
 BuildAnimationPropertyListFromPropertyIndexedKeyframes(
     JSContext* aCx,
     Element* aTarget,
-    nsCSSPseudoElements::Type aPseudoType,
+    CSSPseudoElementType aPseudoType,
     JS::Handle<JS::Value> aValue,
     InfallibleTArray<AnimationProperty>& aResult,
     ErrorResult& aRv)
 {
   MOZ_ASSERT(aValue.isObject());
 
   // Convert the object to a PropertyIndexedKeyframes dictionary to
   // get its explicit dictionary members.
@@ -1661,17 +1662,17 @@ BuildAnimationPropertyListFromPropertyIn
  *   that is the keyframe list specification.
  * @param aResult The array into which the resulting AnimationProperty
  *   objects will be appended.
  */
 /* static */ void
 KeyframeEffectReadOnly::BuildAnimationPropertyList(
     JSContext* aCx,
     Element* aTarget,
-    nsCSSPseudoElements::Type aPseudoType,
+    CSSPseudoElementType aPseudoType,
     JS::Handle<JSObject*> aFrames,
     InfallibleTArray<AnimationProperty>& aResult,
     ErrorResult& aRv)
 {
   MOZ_ASSERT(aResult.IsEmpty());
 
   // A frame list specification in the IDL is:
   //
@@ -2120,17 +2121,17 @@ KeyframeEffectReadOnly::ShouldBlockCompo
 //---------------------------------------------------------------------
 //
 // KeyframeEffect
 //
 //---------------------------------------------------------------------
 
 KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
                                Element* aTarget,
-                               nsCSSPseudoElements::Type aPseudoType,
+                               CSSPseudoElementType aPseudoType,
                                const TimingParams& aTiming)
   : KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
                            new AnimationEffectTiming(aTiming))
 {
 }
 
 JSObject*
 KeyframeEffect::WrapObject(JSContext* aCx,
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_KeyframeEffect_h
 #define mozilla_dom_KeyframeEffect_h
 
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
-#include "nsCSSPseudoElements.h"
 #include "nsIDocument.h"
 #include "nsWrapperCache.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ComputedTimingFunction.h" // ComputedTimingFunction
 #include "mozilla/LayerAnimationInfo.h"     // LayerAnimations::kRecords
 #include "mozilla/OwningNonNull.h"          // OwningNonNull<...>
 #include "mozilla/StickyTimeDuration.h"
 #include "mozilla/StyleAnimationValue.h"
@@ -33,16 +32,17 @@ class nsIContent;
 class nsIDocument;
 class nsIFrame;
 class nsPresContext;
 
 namespace mozilla {
 
 struct AnimationCollection;
 class AnimValuesStyleRule;
+enum class CSSPseudoElementType : uint8_t;
 
 namespace dom {
 class ElementOrCSSPseudoElement;
 class OwningElementOrCSSPseudoElement;
 class UnrestrictedDoubleOrKeyframeEffectOptions;
 enum class IterationCompositeOperation : uint32_t;
 enum class CompositeOperation : uint32_t;
 }
@@ -167,17 +167,17 @@ namespace dom {
 
 class Animation;
 
 class KeyframeEffectReadOnly : public AnimationEffectReadOnly
 {
 public:
   KeyframeEffectReadOnly(nsIDocument* aDocument,
                          Element* aTarget,
-                         nsCSSPseudoElements::Type aPseudoType,
+                         CSSPseudoElementType aPseudoType,
                          const TimingParams& aTiming);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(KeyframeEffectReadOnly,
                                                         AnimationEffectReadOnly)
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
@@ -204,17 +204,17 @@ public:
   void GetTarget(Nullable<OwningElementOrCSSPseudoElement>& aRv) const;
   void GetFrames(JSContext*& aCx,
                  nsTArray<JSObject*>& aResult,
                  ErrorResult& aRv);
 
   // Temporary workaround to return both the target element and pseudo-type
   // until we implement PseudoElement (bug 1174575).
   void GetTarget(Element*& aTarget,
-                 nsCSSPseudoElements::Type& aPseudoType) const {
+                 CSSPseudoElementType& aPseudoType) const {
     aTarget = mTarget;
     aPseudoType = mPseudoType;
   }
 
   IterationCompositeOperation IterationComposite() const;
   CompositeOperation Composite() const;
   void GetSpacing(nsString& aRetVal) const {
     aRetVal.AssignLiteral("distribute");
@@ -317,17 +317,17 @@ public:
   nsIDocument* GetRenderedDocument() const;
   nsPresContext* GetPresContext() const;
 
   inline AnimationCollection* GetCollection() const;
 
 protected:
   KeyframeEffectReadOnly(nsIDocument* aDocument,
                          Element* aTarget,
-                         nsCSSPseudoElements::Type aPseudoType,
+                         CSSPseudoElementType aPseudoType,
                          AnimationEffectTimingReadOnly* aTiming);
 
   virtual ~KeyframeEffectReadOnly();
 
   template<typename KeyframeEffectType>
   static already_AddRefed<KeyframeEffectType>
   ConstructKeyframeEffect(const GlobalObject& aGlobal,
                           const Nullable<ElementOrCSSPseudoElement>& aTarget,
@@ -346,26 +346,26 @@ protected:
   // As a result, we need to make sure this gets called whenever anything
   // changes with regards to this effects's timing including changes to the
   // owning Animation's timing.
   void UpdateTargetRegistration();
 
   static void BuildAnimationPropertyList(
     JSContext* aCx,
     Element* aTarget,
-    nsCSSPseudoElements::Type aPseudoType,
+    CSSPseudoElementType aPseudoType,
     JS::Handle<JSObject*> aFrames,
     InfallibleTArray<AnimationProperty>& aResult,
     ErrorResult& aRv);
 
   nsCOMPtr<Element> mTarget;
   RefPtr<Animation> mAnimation;
 
   OwningNonNull<AnimationEffectTimingReadOnly> mTiming;
-  nsCSSPseudoElements::Type mPseudoType;
+  CSSPseudoElementType mPseudoType;
 
   InfallibleTArray<AnimationProperty> mProperties;
 
   // The computed progress last time we composed the style rule. This is
   // used to detect when the progress is not changing (e.g. due to a step
   // timing function) so we can avoid unnecessary style updates.
   Nullable<double> mProgressOnLastCompose;
 
@@ -390,17 +390,17 @@ private:
   static const TimeDuration OverflowRegionRefreshInterval();
 };
 
 class KeyframeEffect : public KeyframeEffectReadOnly
 {
 public:
   KeyframeEffect(nsIDocument* aDocument,
                  Element* aTarget,
-                 nsCSSPseudoElements::Type aPseudoType,
+                 CSSPseudoElementType aPseudoType,
                  const TimingParams& aTiming);
 
   JSObject* WrapObject(JSContext* aCx,
                        JS::Handle<JSObject*> aGivenProto) override;
 
   static already_AddRefed<KeyframeEffect>
   Constructor(const GlobalObject& aGlobal,
               const Nullable<ElementOrCSSPseudoElement>& aTarget,
--- a/dom/animation/PseudoElementHashEntry.h
+++ b/dom/animation/PseudoElementHashEntry.h
@@ -4,28 +4,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_PseudoElementHashEntry_h
 #define mozilla_PseudoElementHashEntry_h
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/HashFunctions.h"
-#include "nsCSSPseudoElements.h"
 #include "PLDHashTable.h"
 
 namespace mozilla {
 
+enum class CSSPseudoElementType : uint8_t;
+
 struct PseudoElementHashKey
 {
   dom::Element* mElement;
-  nsCSSPseudoElements::Type mPseudoType;
+  CSSPseudoElementType mPseudoType;
 };
 
-// A hash entry that uses a RefPtr<dom::Element>, nsCSSPseudoElements::Type pair
+// A hash entry that uses a RefPtr<dom::Element>, CSSPseudoElementType pair
 class PseudoElementHashEntry : public PLDHashEntryHdr
 {
 public:
   typedef PseudoElementHashKey KeyType;
   typedef const PseudoElementHashKey* KeyTypePointer;
 
   explicit PseudoElementHashEntry(KeyTypePointer aKey)
     : mElement(aKey->mElement)
@@ -49,14 +50,14 @@ public:
 
     // 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;
+  CSSPseudoElementType mPseudoType;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_PseudoElementHashEntry_h
--- a/dom/base/nsDOMMutationObserver.cpp
+++ b/dom/base/nsDOMMutationObserver.cpp
@@ -384,17 +384,17 @@ nsAnimationReceiver::RecordAnimationMuta
                                              AnimationMutation aMutationType)
 {
   mozilla::dom::KeyframeEffectReadOnly* effect = aAnimation->GetEffect();
   if (!effect) {
     return;
   }
 
   mozilla::dom::Element* animationTarget;
-  nsCSSPseudoElements::Type pseudoType;
+  CSSPseudoElementType pseudoType;
   effect->GetTarget(animationTarget, pseudoType);
   if (!animationTarget) {
     return;
   }
 
   if (!Animations() || !(Subtree() || animationTarget == Target()) ||
       animationTarget->ChromeOnlyAccess()) {
     return;
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -96,16 +96,17 @@
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "GeckoProfiler.h"
 #include "mozilla/Preferences.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsIStyleSheetService.h"
 #include "nsContentPermissionHelper.h"
+#include "nsCSSPseudoElements.h"            // for CSSPseudoElementType
 #include "nsNetUtil.h"
 #include "nsDocument.h"
 #include "HTMLImageElement.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/layers/APZCTreeManager.h" // for layers::ZoomToRectBehavior
 #include "mozilla/dom/Promise.h"
 
 #ifdef XP_WIN
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsNodeUtils.h"
 #include "nsContentUtils.h"
+#include "nsCSSPseudoElements.h"
 #include "nsINode.h"
 #include "nsIContent.h"
 #include "mozilla/dom/Element.h"
 #include "nsIMutationObserver.h"
 #include "nsIDocument.h"
 #include "mozilla/EventListenerManager.h"
 #include "nsIXPConnect.h"
 #include "PLDHashTable.h"
@@ -230,17 +231,17 @@ Element*
 nsNodeUtils::GetTargetForAnimation(const Animation* aAnimation)
 {
   KeyframeEffectReadOnly* effect = aAnimation->GetEffect();
   if (!effect) {
     return nullptr;
   }
 
   Element* target;
-  nsCSSPseudoElements::Type pseudoType;
+  CSSPseudoElementType 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 != CSSPseudoElementType::NotPseudo) {
     return nullptr;
   }
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -16,16 +16,17 @@
 #include "FrameLayerBuilder.h"
 #include "GeckoProfiler.h"
 #include "LayerAnimationInfo.h" // For LayerAnimationInfo::sRecords
 #include "nsStyleChangeList.h"
 #include "nsRuleProcessorData.h"
 #include "nsStyleUtil.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsSVGEffects.h"
+#include "nsCSSPseudoElements.h"
 #include "nsCSSRendering.h"
 #include "nsAnimationManager.h"
 #include "nsTransitionManager.h"
 #include "nsViewManager.h"
 #include "nsRenderingContext.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsContainerFrame.h"
@@ -1099,45 +1100,42 @@ RestyleManager::AnimationsWithDestroyedF
   MOZ_ASSERT(!mRestyleManager->mAnimationsWithDestroyedFrame,
              "shouldn't construct recursively");
   mRestyleManager->mAnimationsWithDestroyedFrame = this;
 }
 
 void
 RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsForElementsWithoutFrames()
 {
-  StopAnimationsWithoutFrame(mContents,
-    CSSPseudoElementType::NotPseudo);
-  StopAnimationsWithoutFrame(mBeforeContents,
-    CSSPseudoElementType::before);
-  StopAnimationsWithoutFrame(mAfterContents,
-    CSSPseudoElementType::after);
+  StopAnimationsWithoutFrame(mContents, CSSPseudoElementType::NotPseudo);
+  StopAnimationsWithoutFrame(mBeforeContents, CSSPseudoElementType::before);
+  StopAnimationsWithoutFrame(mAfterContents, CSSPseudoElementType::after);
 }
 
 void
 RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsWithoutFrame(
   nsTArray<RefPtr<nsIContent>>& aArray,
-  nsCSSPseudoElements::Type aPseudoType)
+  CSSPseudoElementType aPseudoType)
 {
   nsAnimationManager* animationManager =
     mRestyleManager->PresContext()->AnimationManager();
   for (nsIContent* content : aArray) {
     if (content->GetPrimaryFrame()) {
       continue;
     }
     dom::Element* element = content->AsElement();
 
     animationManager->StopAnimationsForElement(element, aPseudoType);
   }
 }
 
 static inline dom::Element*
 ElementForStyleContext(nsIContent* aParentContent,
                        nsIFrame* aFrame,
-                       nsCSSPseudoElements::Type aPseudoType);
+                       CSSPseudoElementType aPseudoType);
 
 // Forwarded nsIDocumentObserver method, to handle restyling (and
 // passing the notification to the frame).
 nsresult
 RestyleManager::ContentStateChanged(nsIContent* aContent,
                                     EventStates aStateMask)
 {
   // XXXbz it would be good if this function only took Elements, but
@@ -1154,18 +1152,17 @@ RestyleManager::ContentStateChanged(nsIC
   nsChangeHint hint = NS_STYLE_HINT_NONE;
   // 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 =
-    CSSPseudoElementType::NotPseudo;
+  CSSPseudoElementType pseudoType = 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;
@@ -2124,17 +2121,17 @@ RestyleManager::TryStartingTransition(ns
   aPresContext->TransitionManager()->StyleContextChanged(
     aContent->AsElement(), aOldStyleContext, aNewStyleContext);
   return *aNewStyleContext != sc;
 }
 
 static dom::Element*
 ElementForStyleContext(nsIContent* aParentContent,
                        nsIFrame* aFrame,
-                       nsCSSPseudoElements::Type aPseudoType)
+                       CSSPseudoElementType aPseudoType)
 {
   // We don't expect XUL tree stuff here.
   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.
@@ -2196,17 +2193,17 @@ ElementForStyleContext(nsIContent* aPare
  * elements.  For those pseudo-elements, we need to pass the
  * anonymous pseudo-element content to selector matching processes in
  * 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)
+                             CSSPseudoElementType aPseudoType)
 {
   if (aPseudoType >= CSSPseudoElementType::Count) {
     return nullptr;
   }
 
   if (nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
       nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType)) {
     return aFrame->GetContent()->AsElement();
@@ -3842,17 +3839,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
   nsStyleSet* styleSet = mPresContext->StyleSet();
 
 #ifdef ACCESSIBILITY
   mWasFrameVisible = nsIPresShell::IsAccessibilityActive() ?
     oldContext->StyleVisibility()->IsVisible() : false;
 #endif
 
   nsIAtom* const pseudoTag = oldContext->GetPseudo();
-  const nsCSSPseudoElements::Type pseudoType = oldContext->GetPseudoType();
+  const CSSPseudoElementType pseudoType = oldContext->GetPseudoType();
 
   // Get the frame providing the parent style context.  If it is a
   // child, then resolve the provider first.
   nsIFrame* providerFrame;
   nsStyleContext* parentContext = aSelf->GetParentStyleContext(&providerFrame);
   bool isChild = providerFrame && providerFrame->GetParent() == aSelf;
   if (isChild) {
     MOZ_ASSERT(providerFrame->GetContent() == aSelf->GetContent(),
@@ -3971,18 +3968,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
             if (oldContext->GetParent() != parentContext) {
               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 <
-                         CSSPseudoElementType::Count,
+          NS_ASSERTION(pseudoType < 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,
@@ -4253,17 +4249,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
   int32_t contextIndex = 0;
   for (nsStyleContext* oldExtraContext;
        (oldExtraContext = aSelf->GetAdditionalStyleContext(contextIndex));
        ++contextIndex) {
     LOG_RESTYLE("extra context %d", contextIndex);
     LOG_RESTYLE_INDENT();
     RefPtr<nsStyleContext> newExtraContext;
     nsIAtom* const extraPseudoTag = oldExtraContext->GetPseudo();
-    const nsCSSPseudoElements::Type extraPseudoType =
+    const CSSPseudoElementType extraPseudoType =
       oldExtraContext->GetPseudoType();
     NS_ASSERTION(extraPseudoTag &&
                  extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
                  "extra style context is not pseudo element");
     Element* element = extraPseudoType != CSSPseudoElementType::AnonBox
                          ? mContent->AsElement() : nullptr;
     if (!MustRestyleSelf(aRestyleHint, element)) {
       if (CanReparentStyleContext(aRestyleHint)) {
@@ -4678,34 +4674,34 @@ ElementRestyler::MustReframeForAfterPseu
   MOZ_ASSERT(aFrame);
   return MustReframeForPseudo(CSSPseudoElementType::after,
                               aFrame, aFrame, aFrame->GetContent(),
                               aFrame->StyleContext());
 }
 #endif
 
 void
-ElementRestyler::MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
+ElementRestyler::MaybeReframeForPseudo(CSSPseudoElementType aPseudoType,
                                        nsIFrame* aGenConParentFrame,
                                        nsIFrame* aFrame,
                                        nsIContent* aContent,
                                        nsStyleContext* aStyleContext)
 {
   if (MustReframeForPseudo(aPseudoType, aGenConParentFrame, aFrame, aContent,
                            aStyleContext)) {
     // Have to create the new ::before/::after frame.
     LOG_RESTYLE("MaybeReframeForPseudo, appending "
                 "nsChangeHint_ReconstructFrame");
     NS_UpdateHint(mHintsHandled, nsChangeHint_ReconstructFrame);
     mChangeList->AppendChange(aFrame, aContent, nsChangeHint_ReconstructFrame);
   }
 }
 
 bool
-ElementRestyler::MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
+ElementRestyler::MustReframeForPseudo(CSSPseudoElementType aPseudoType,
                                       nsIFrame* aGenConParentFrame,
                                       nsIFrame* aFrame,
                                       nsIContent* aContent,
                                       nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(aPseudoType == CSSPseudoElementType::before ||
              aPseudoType == CSSPseudoElementType::after);
 
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -13,24 +13,24 @@
 
 #include "mozilla/RestyleLogging.h"
 #include "nsISupportsImpl.h"
 #include "nsChangeHint.h"
 #include "RestyleTracker.h"
 #include "nsPresContext.h"
 #include "nsRefreshDriver.h"
 #include "nsRefPtrHashtable.h"
-#include "nsCSSPseudoElements.h"
 #include "nsTransitionManager.h"
 
 class nsIFrame;
 class nsStyleChangeList;
 struct TreeMatchContext;
 
 namespace mozilla {
+  enum class CSSPseudoElementType : uint8_t;
   class EventStates;
   struct UndisplayedNode;
 
 namespace dom {
   class Element;
 } // namespace dom
 
 class RestyleManager final
@@ -186,30 +186,30 @@ public:
      * object.  (This is generally easy since the caller is typically a
      * method of RestyleManager.)
      */
     explicit ReframingStyleContexts(RestyleManager* aRestyleManager);
     ~ReframingStyleContexts();
 
     void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
       MOZ_ASSERT(aContent);
-      nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
+      CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
       if (pseudoType == CSSPseudoElementType::NotPseudo) {
         mElementContexts.Put(aContent, aStyleContext);
       } else if (pseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         mBeforePseudoContexts.Put(aContent->GetParent(), aStyleContext);
       } else if (pseudoType == CSSPseudoElementType::after) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
         mAfterPseudoContexts.Put(aContent->GetParent(), aStyleContext);
       }
     }
 
     nsStyleContext* Get(nsIContent* aContent,
-                        nsCSSPseudoElements::Type aPseudoType) {
+                        CSSPseudoElementType aPseudoType) {
       MOZ_ASSERT(aContent);
       if (aPseudoType == CSSPseudoElementType::NotPseudo) {
         return mElementContexts.GetWeak(aContent);
       }
       if (aPseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         return mBeforePseudoContexts.GetWeak(aContent->GetParent());
       }
@@ -264,33 +264,33 @@ 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();
+      CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
       if (pseudoType == CSSPseudoElementType::NotPseudo) {
         mContents.AppendElement(aContent);
       } else if (pseudoType == CSSPseudoElementType::before) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore);
         mBeforeContents.AppendElement(aContent->GetParent());
       } else if (pseudoType == CSSPseudoElementType::after) {
         MOZ_ASSERT(aContent->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter);
         mAfterContents.AppendElement(aContent->GetParent());
       }
     }
 
     void StopAnimationsForElementsWithoutFrames();
 
   private:
     void StopAnimationsWithoutFrame(nsTArray<RefPtr<nsIContent>>& aArray,
-                                    nsCSSPseudoElements::Type aPseudoType);
+                                    CSSPseudoElementType aPseudoType);
 
     RestyleManager* mRestyleManager;
     AutoRestore<AnimationsWithDestroyedFrame*> mRestorePointer;
 
     // Below three arrays might include elements that have already had their
     // animations stopped.
     //
     // mBeforeContents and mAfterContents hold the real element rather than
@@ -787,26 +787,26 @@ private:
                                        nsStyleContext* aParentStyleContext);
   void RestyleUndisplayedNodes(nsRestyleHint    aChildRestyleHint,
                                UndisplayedNode* aUndisplayed,
                                nsIContent*      aUndisplayedParent,
                                nsStyleContext*  aParentStyleContext,
                                const uint8_t    aDisplay);
   void MaybeReframeForBeforePseudo();
   void MaybeReframeForAfterPseudo(nsIFrame* aFrame);
-  void MaybeReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
+  void MaybeReframeForPseudo(CSSPseudoElementType aPseudoType,
                              nsIFrame* aGenConParentFrame,
                              nsIFrame* aFrame,
                              nsIContent* aContent,
                              nsStyleContext* aStyleContext);
 #ifdef DEBUG
   bool MustReframeForBeforePseudo();
   bool MustReframeForAfterPseudo(nsIFrame* aFrame);
 #endif
-  bool MustReframeForPseudo(nsCSSPseudoElements::Type aPseudoType,
+  bool MustReframeForPseudo(CSSPseudoElementType aPseudoType,
                             nsIFrame* aGenConParentFrame,
                             nsIFrame* aFrame,
                             nsIContent* aContent,
                             nsStyleContext* aStyleContext);
   void RestyleContentChildren(nsIFrame* aParent,
                               nsRestyleHint aChildRestyleHint);
   void InitializeAccessibilityNotifications(nsStyleContext* aNewContext);
   void SendAccessibilityNotifications();
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/dom/HTMLDetailsElement.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "mozilla/dom/HTMLSummaryElement.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Likely.h"
 #include "mozilla/LinkedList.h"
 #include "nsAbsoluteContainingBlock.h"
+#include "nsCSSPseudoElements.h"
 #include "nsIAtom.h"
 #include "nsIFrameInlines.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsTableFrame.h"
 #include "nsTableColFrame.h"
 #include "nsTableRowFrame.h"
@@ -1752,17 +1753,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
  * aParentFrame/aParentContent, giving the XML element the ::before or
  * ::after style.
  */
 void
 nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aState,
                                                   nsContainerFrame* aParentFrame,
                                                   nsIContent*      aParentContent,
                                                   nsStyleContext*  aStyleContext,
-                                                  nsCSSPseudoElements::Type aPseudoElement,
+                                                  CSSPseudoElementType aPseudoElement,
                                                   FrameConstructionItemList& aItems)
 {
   MOZ_ASSERT(aPseudoElement == CSSPseudoElementType::before ||
              aPseudoElement == CSSPseudoElementType::after,
              "unexpected aPseudoElement");
 
   // XXXbz is this ever true?
   if (!aParentContent->IsElement()) {
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -12,17 +12,16 @@
 #define nsCSSFrameConstructor_h___
 
 #include "mozilla/Attributes.h"
 
 #include "nsCOMPtr.h"
 #include "nsILayoutHistoryState.h"
 #include "nsQuoteList.h"
 #include "nsCounterManager.h"
-#include "nsCSSPseudoElements.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsFrameManager.h"
 #include "nsIDocument.h"
 #include "ScrollbarStyles.h"
 
 struct nsFrameItems;
 class nsStyleContext;
 struct nsStyleDisplay;
@@ -46,16 +45,17 @@ namespace dom {
 class FlattenedChildIterator;
 
 } // namespace dom
 } // namespace mozilla
 
 class nsCSSFrameConstructor : public nsFrameManager
 {
 public:
+  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
   typedef mozilla::dom::Element Element;
 
   friend class mozilla::RestyleManager;
 
   nsCSSFrameConstructor(nsIDocument* aDocument, nsIPresShell* aPresShell);
   ~nsCSSFrameConstructor(void) {
     NS_ASSERTION(mUpdateCount == 0, "Dying in the middle of our own update?");
   }
@@ -447,17 +447,17 @@ private:
                                                       nsStyleContext* aStyleContext,
                                                       uint32_t        aContentIndex);
 
   // aFrame may be null; this method doesn't use it directly in any case.
   void CreateGeneratedContentItem(nsFrameConstructorState&   aState,
                                   nsContainerFrame*          aFrame,
                                   nsIContent*                aContent,
                                   nsStyleContext*            aStyleContext,
-                                  nsCSSPseudoElements::Type  aPseudoElement,
+                                  CSSPseudoElementType       aPseudoElement,
                                   FrameConstructionItemList& aItems);
 
   // This method can change aFrameList: it can chop off the beginning and put
   // it in aParentFrame while putting the remainder into a ib-split sibling of
   // aParentFrame.  aPrevSibling must be the frame after which aFrameList is to
   // be placed on aParentFrame's principal child list.  It may be null if
   // aFrameList is being added at the beginning of the child list.
   nsresult AppendFramesToParent(nsFrameConstructorState&       aState,
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2030,17 +2030,17 @@ nsLayoutUtils::GetScrolledRect(nsIFrame*
   }
   return nsRect(x1, y1, x2 - x1, y2 - y1);
 }
 
 //static
 bool
 nsLayoutUtils::HasPseudoStyle(nsIContent* aContent,
                               nsStyleContext* aStyleContext,
-                              nsCSSPseudoElements::Type aPseudoElement,
+                              CSSPseudoElementType aPseudoElement,
                               nsPresContext* aPresContext)
 {
   NS_PRECONDITION(aPresContext, "Must have a prescontext");
 
   RefPtr<nsStyleContext> pseudoContext;
   if (aContent) {
     pseudoContext = aPresContext->StyleSet()->
       ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -11,17 +11,16 @@
 #include "mozilla/Maybe.h"
 #include "nsBoundingMetrics.h"
 #include "nsChangeHint.h"
 #include "nsAutoPtr.h"
 #include "nsFrameList.h"
 #include "mozilla/layout/FrameChildList.h"
 #include "nsThreadUtils.h"
 #include "nsIPrincipal.h"
-#include "nsCSSPseudoElements.h"
 #include "FrameMetrics.h"
 #include "nsIWidget.h"
 #include "nsCSSProperty.h"
 #include "nsStyleCoord.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsRuleNode.h"
 #include "imgIContainer.h"
@@ -58,16 +57,17 @@ class nsPIDOMWindowOuter;
 class imgIRequest;
 class nsIDocument;
 struct gfxPoint;
 struct nsStyleFont;
 struct nsStyleImageOrientation;
 struct nsOverflowAreas;
 
 namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
 class EventListenerManager;
 class SVGImageContext;
 struct IntrinsicSize;
 struct ContainerLayerParameters;
 class WritingMode;
 namespace dom {
 class CanvasRenderingContext2D;
 class DOMRectList;
@@ -656,17 +656,17 @@ public:
    * @param aContent the content node we're looking at
    * @param aStyleContext aContent's style context
    * @param aPseudoElement the id of the pseudo style we care about
    * @param aPresContext the presentation context
    * @return whether aContent has aPseudoElement style attached to it
    */
   static bool HasPseudoStyle(nsIContent* aContent,
                                nsStyleContext* aStyleContext,
-                               nsCSSPseudoElements::Type aPseudoElement,
+                               mozilla::CSSPseudoElementType aPseudoElement,
                                nsPresContext* aPresContext);
 
   /**
    * If this frame is a placeholder for a float, then return the float,
    * otherwise return nullptr.  aPlaceholder must be a placeholder frame.
    */
   static nsIFrame* GetFloatFromPlaceholder(nsIFrame* aPlaceholder);
 
@@ -2194,17 +2194,18 @@ public:
    * Given a frame with possibly animated content, finds the content node
    * that contains its animations as well as the frame's pseudo-element type
    * relative to the resulting content node. Returns true if animated content
    * was found, otherwise it returns false and the output parameters are
    * undefined.
    */
   static bool GetAnimationContent(const nsIFrame* aFrame,
                                   nsIContent* &aContentResult,
-                                  nsCSSPseudoElements::Type &aPseudoTypeResult);
+                                  mozilla::CSSPseudoElementType
+                                    &aPseudoTypeResult);
 
   /**
    * Returns true if the frame has current (i.e. running or scheduled-to-run)
    * animations or transitions for the property.
    */
   static bool HasCurrentAnimationOfProperty(const nsIFrame* aFrame,
                                             nsCSSProperty aProperty);
 
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsColorControlFrame.h"
 
 #include "nsContentCreatorFunctions.h"
 #include "nsContentList.h"
 #include "nsContentUtils.h"
+#include "nsCSSPseudoElements.h"
 #include "nsFormControlFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNode.h"
 #include "nsIFormControl.h"
 #include "nsStyleSet.h"
 #include "nsIDocument.h"
 
@@ -67,17 +68,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 = CSSPseudoElementType::mozColorSwatch;
+  CSSPseudoElementType 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;
@@ -130,16 +131,16 @@ nsColorControlFrame::AttributeChanged(in
 
 nsContainerFrame*
 nsColorControlFrame::GetContentInsertionFrame()
 {
   return this;
 }
 
 Element*
-nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsColorControlFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozColorSwatch) {
     return mColorContent;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsColorControlFrame.h
+++ b/layout/forms/nsColorControlFrame.h
@@ -5,23 +5,28 @@
 
 #ifndef nsColorControlFrame_h___
 #define nsColorControlFrame_h___
 
 #include "nsCOMPtr.h"
 #include "nsHTMLButtonControlFrame.h"
 #include "nsIAnonymousContentCreator.h"
 
+namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
+} // namespace mozilla
+
 typedef nsHTMLButtonControlFrame nsColorControlFrameSuper;
 
 // Class which implements the input type=color
 
 class nsColorControlFrame final : public nsColorControlFrameSuper,
                                   public nsIAnonymousContentCreator
 {
+  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
   typedef mozilla::dom::Element Element;
 
 public:
   friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
                                            nsStyleContext* aContext);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
 
@@ -42,17 +47,17 @@ public:
 
   // nsIFrame
   virtual nsresult AttributeChanged(int32_t  aNameSpaceID,
                                     nsIAtom* aAttribute,
                                     int32_t  aModType) override;
   virtual bool IsLeaf() const override { return true; }
   virtual nsContainerFrame* GetContentInsertionFrame() override;
 
-  virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
 
   // Refresh the color swatch, using associated input's value
   nsresult UpdateColor();
 
 private:
   explicit nsColorControlFrame(nsStyleContext* aContext);
 
   nsCOMPtr<Element> mColorContent;
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -14,16 +14,17 @@
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsFormControlFrame.h"
 #include "nsFontMetrics.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLMeterElement.h"
 #include "nsContentList.h"
+#include "nsCSSPseudoElements.h"
 #include "nsStyleSet.h"
 #include "nsThemeConstants.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::dom::Element;
 using mozilla::dom::HTMLMeterElement;
 
@@ -61,17 +62,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 = CSSPseudoElementType::mozMeterBar;
+  CSSPseudoElementType 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;
   }
 
@@ -276,16 +277,16 @@ nsMeterFrame::ShouldUseNativeStyle() con
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
          barFrame &&
          barFrame->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK &&
          !PresContext()->HasAuthorSpecifiedRules(barFrame,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
 
 Element*
-nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsMeterFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozMeterBar) {
     return mBarDiv;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -68,17 +68,17 @@ public:
       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
   /**
    * Returns whether the frame and its child should use the native style.
    */
   bool ShouldUseNativeStyle() const;
 
-  virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
 
 protected:
   // Helper function which reflow the anonymous div frame.
   void ReflowBarFrame(nsIFrame*                aBarFrame,
                       nsPresContext*           aPresContext,
                       const nsHTMLReflowState& aReflowState,
                       nsReflowStatus&          aStatus);
   /**
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -15,16 +15,17 @@
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsThemeConstants.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/EventStates.h"
 #include "nsContentUtils.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentList.h"
+#include "nsCSSPseudoElements.h"
 #include "nsStyleSet.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsThreadUtils.h"
 #include "mozilla/FloatingPoint.h"
 
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/AccTypes.h"
 #endif
@@ -318,17 +319,17 @@ private:
   nsCOMPtr<nsIContent> mNumber;
   nsCOMPtr<nsIContent> mTextField;
 };
 
 nsresult
 nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
                                            nsTArray<ContentInfo>& aElements,
                                            nsIAtom* aTagName,
-                                           nsCSSPseudoElements::Type aPseudoType,
+                                           CSSPseudoElementType aPseudoType,
                                            nsStyleContext* aParentContext)
 {
   // 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
@@ -819,17 +820,17 @@ nsNumberControlFrame::AnonTextControlIsE
     return true;
   }
   nsAutoString value;
   HTMLInputElement::FromContent(mTextField)->GetValue(value);
   return value.IsEmpty();
 }
 
 Element*
-nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsNumberControlFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozNumberWrapper) {
     return mOuterWrapper;
   }
 
   if (aType == CSSPseudoElementType::mozNumberText) {
     return mTextField;
   }
--- a/layout/forms/nsNumberControlFrame.h
+++ b/layout/forms/nsNumberControlFrame.h
@@ -11,16 +11,17 @@
 #include "nsIFormControlFrame.h"
 #include "nsITextControlFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsCOMPtr.h"
 
 class nsPresContext;
 
 namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
 class WidgetEvent;
 class WidgetGUIEvent;
 namespace dom {
 class HTMLInputElement;
 } // namespace dom
 } // namespace mozilla
 
 /**
@@ -28,16 +29,17 @@ class HTMLInputElement;
  */
 class nsNumberControlFrame final : public nsContainerFrame
                                  , public nsIAnonymousContentCreator
                                  , public nsITextControlFrame
 {
   friend nsIFrame*
   NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
+  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
   typedef mozilla::dom::Element Element;
   typedef mozilla::dom::HTMLInputElement HTMLInputElement;
   typedef mozilla::WidgetEvent WidgetEvent;
   typedef mozilla::WidgetGUIEvent WidgetGUIEvent;
 
   explicit nsNumberControlFrame(nsStyleContext* aContext);
 
 public:
@@ -181,27 +183,27 @@ public:
 
   void HandleFocusEvent(WidgetEvent* aEvent);
 
   /**
    * Our element had HTMLInputElement::Select() called on it.
    */
   nsresult HandleSelectCall();
 
-  virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
 
   bool ShouldUseNativeStyleForSpinner() const;
 
 private:
 
   nsITextControlFrame* GetTextFieldFrame();
   nsresult MakeAnonymousElement(Element** aResult,
                                 nsTArray<ContentInfo>& aElements,
                                 nsIAtom* aTagName,
-                                nsCSSPseudoElements::Type aPseudoType,
+                                CSSPseudoElementType aPseudoType,
                                 nsStyleContext* aParentContext);
 
   class SyncDisabledStateEvent;
   friend class SyncDisabledStateEvent;
   class SyncDisabledStateEvent : public nsRunnable
   {
   public:
     explicit SyncDisabledStateEvent(nsNumberControlFrame* aFrame)
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -14,16 +14,17 @@
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsFormControlFrame.h"
 #include "nsFontMetrics.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLProgressElement.h"
 #include "nsContentList.h"
+#include "nsCSSPseudoElements.h"
 #include "nsStyleSet.h"
 #include "nsThemeConstants.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsIFrame*
@@ -58,17 +59,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 = CSSPseudoElementType::mozProgressBar;
+  CSSPseudoElementType 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;
   }
 
@@ -282,16 +283,16 @@ nsProgressFrame::ShouldUseNativeStyle() 
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
          barFrame &&
          barFrame->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
          !PresContext()->HasAuthorSpecifiedRules(barFrame,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
 
 Element*
-nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsProgressFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozProgressBar) {
     return mBarDiv;
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -6,19 +6,24 @@
 #ifndef nsProgressFrame_h___
 #define nsProgressFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsCOMPtr.h"
 
+namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
+} // namespace mozilla
+
 class nsProgressFrame : public nsContainerFrame,
                         public nsIAnonymousContentCreator
 {
+  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
   typedef mozilla::dom::Element Element;
 
 public:
   NS_DECL_QUERYFRAME_TARGET(nsProgressFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   explicit nsProgressFrame(nsStyleContext* aContext);
@@ -71,17 +76,17 @@ public:
       ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
   }
 
   /**
    * Returns whether the frame and its child should use the native style.
    */
   bool ShouldUseNativeStyle() const;
 
-  virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
 
 protected:
   // Helper function which reflow the anonymous div frame.
   void ReflowBarFrame(nsIFrame*                aBarFrame,
                       nsPresContext*           aPresContext,
                       const nsHTMLReflowState& aReflowState,
                       nsReflowStatus&          aStatus);
 
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -6,16 +6,17 @@
 #include "nsRangeFrame.h"
 
 #include "mozilla/EventStates.h"
 #include "mozilla/TouchEvents.h"
 
 #include "nsContentCreatorFunctions.h"
 #include "nsContentList.h"
 #include "nsContentUtils.h"
+#include "nsCSSPseudoElements.h"
 #include "nsCSSRendering.h"
 #include "nsFormControlFrame.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsNameSpaceManager.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "mozilla/dom/HTMLInputElement.h"
@@ -105,17 +106,17 @@ nsRangeFrame::DestroyFrom(nsIFrame* aDes
   nsContentUtils::DestroyAnonymousContent(&mTrackDiv);
   nsContentUtils::DestroyAnonymousContent(&mProgressDiv);
   nsContentUtils::DestroyAnonymousContent(&mThumbDiv);
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 nsresult
 nsRangeFrame::MakeAnonymousDiv(Element** aResult,
-                               nsCSSPseudoElements::Type aPseudoType,
+                               CSSPseudoElementType aPseudoType,
                                nsTArray<ContentInfo>& aElements)
 {
   nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
   RefPtr<Element> resultElement = doc->CreateHTMLElement(nsGkAtoms::div);
 
   // Associate the pseudo-element with the anonymous child.
   RefPtr<nsStyleContext> newStyleContext =
     PresContext()->StyleSet()->ResolvePseudoElementStyle(mContent->AsElement(),
@@ -889,17 +890,17 @@ nsRangeFrame::ShouldUseNativeStyle() con
          !PresContext()->HasAuthorSpecifiedRules(progressFrame,
                                                  STYLES_DISABLING_NATIVE_THEMING) &&
          thumbFrame &&
          !PresContext()->HasAuthorSpecifiedRules(thumbFrame,
                                                  STYLES_DISABLING_NATIVE_THEMING);
 }
 
 Element*
-nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsRangeFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozRangeTrack) {
     return mTrackDiv;
   }
 
   if (aType == CSSPseudoElementType::mozRangeThumb) {
     return mThumbDiv;
   }
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -22,16 +22,17 @@ class nsRangeFrame : public nsContainerF
   friend nsIFrame*
   NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   friend class nsDisplayRangeFocusRing;
 
   explicit nsRangeFrame(nsStyleContext* aContext);
   virtual ~nsRangeFrame();
 
+  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
   typedef mozilla::dom::Element Element;
 
 public:
   NS_DECL_QUERYFRAME_TARGET(nsRangeFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFrame overrides
@@ -142,22 +143,22 @@ public:
    * Helper that's used when the value of the range changes to reposition the
    * thumb, resize the range-progress element, and schedule a repaint. (This
    * does not reflow, since the position and size of the thumb and
    * range-progress element do not affect the position or size of any other
    * frames.)
    */
   void UpdateForValueChange();
 
-  virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
 
 private:
 
   nsresult MakeAnonymousDiv(Element** aResult,
-                            nsCSSPseudoElements::Type aPseudoType,
+                            CSSPseudoElementType aPseudoType,
                             nsTArray<ContentInfo>& aElements);
 
   // Helper function which reflows the anonymous div frames.
   void ReflowAnonymousContent(nsPresContext*           aPresContext,
                               nsHTMLReflowMetrics&     aDesiredSize,
                               const nsHTMLReflowState& aReflowState);
 
   void DoUpdateThumbPosition(nsIFrame* aThumbFrame,
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -5,16 +5,17 @@
 
 #include "mozilla/DebugOnly.h"
 
 #include "nsCOMPtr.h"
 #include "nsFontMetrics.h"
 #include "nsTextControlFrame.h"
 #include "nsIPlaintextEditor.h"
 #include "nsCaret.h"
+#include "nsCSSPseudoElements.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIEditor.h"
 #include "nsIEditorIMESupport.h"
 #include "nsIPhonetic.h"
 #include "nsTextFragment.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsNameSpaceManager.h"
 #include "nsFormControlFrame.h" //for registering accesskeys
@@ -341,17 +342,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 = CSSPseudoElementType::mozPlaceholder;
+    CSSPseudoElementType pseudoType = CSSPseudoElementType::mozPlaceholder;
 
     RefPtr<nsStyleContext> placeholderStyleContext =
       PresContext()->StyleSet()->ResolvePseudoElementStyle(
           mContent->AsElement(), pseudoType, StyleContext(),
           placeholderNode->AsElement());
 
     if (!aElements.AppendElement(ContentInfo(placeholderNode,
                                  placeholderStyleContext))) {
@@ -1438,17 +1439,17 @@ nsTextControlFrame::BuildDisplayList(nsD
         txtCtrl->GetPlaceholderVisibility()) {
       BuildDisplayListForChild(aBuilder, kid, aDirtyRect, set, 0);
     }
     kid = kid->GetNextSibling();
   }
 }
 
 mozilla::dom::Element*
-nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsTextControlFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   if (aType == CSSPseudoElementType::mozPlaceholder) {
     nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
     return txtCtrl->GetPlaceholderNode();
   }
 
   return nsContainerFrame::GetPseudoElement(aType);
 }
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -14,16 +14,17 @@
 #include "nsITextControlElement.h"
 #include "nsIStatefulFrame.h"
 
 class nsISelectionController;
 class EditorInitializerEntryTracker;
 class nsTextEditorState;
 class nsIEditor;
 namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
 
 class nsTextControlFrame final : public nsContainerFrame,
                                  public nsIAnonymousContentCreator,
                                  public nsITextControlFrame,
@@ -93,20 +94,21 @@ public:
 
   virtual void SetInitialChildList(ChildListID     aListID,
                                    nsFrameList&    aChildList) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists) override;
 
-  virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
+  virtual mozilla::dom::Element*
+  GetPseudoElement(mozilla::CSSPseudoElementType aType) override;
 
 //==== BEGIN NSIFORMCONTROLFRAME
-  virtual void SetFocus(bool aOn , bool aRepaint) override; 
+  virtual void SetFocus(bool aOn , bool aRepaint) override;
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
 
 //==== END NSIFORMCONTROLFRAME
 
 //==== NSITEXTCONTROLFRAME
 
   NS_IMETHOD    GetEditor(nsIEditor **aEditor) override;
   NS_IMETHOD    SetSelectionStart(int32_t aSelectionStart) override;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -19,16 +19,17 @@
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/Snprintf.h"
 
 #include "nsCOMPtr.h"
 #include "nsFrameList.h"
 #include "nsPlaceholderFrame.h"
 #include "nsIContent.h"
 #include "nsContentUtils.h"
+#include "nsCSSPseudoElements.h"
 #include "nsIAtom.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsStyleContext.h"
 #include "nsTableOuterFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
@@ -9116,17 +9117,17 @@ nsIFrame::IsPseudoStackingContextFromSty
   // in BuildDisplayListForChild()
   return disp->mOpacity != 1.0f ||
          disp->IsAbsPosContainingBlock(this) ||
          disp->IsFloating(this) ||
          (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_STACKING_CONTEXT);
 }
 
 Element*
-nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
+nsIFrame::GetPseudoElement(CSSPseudoElementType aType)
 {
   nsIFrame* frame = nullptr;
 
   if (aType == CSSPseudoElementType::before) {
     frame = nsLayoutUtils::GetBeforeFrame(this);
   } else if (aType == CSSPseudoElementType::after) {
     frame = nsLayoutUtils::GetAfterFrame(this);
   }
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -85,16 +85,17 @@ struct nsPeekOffsetStruct;
 struct nsPoint;
 struct nsRect;
 struct nsSize;
 struct nsMargin;
 struct CharacterDataChangeInfo;
 
 namespace mozilla {
 
+enum class CSSPseudoElementType : uint8_t;
 class EventStates;
 
 namespace layers {
 class Layer;
 } // namespace layers
 
 namespace gfx {
 class Matrix;
@@ -3089,17 +3090,18 @@ public:
     return !HasAllStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
   }
 
   /**
    * Returns the content node within the anonymous content that this frame
    * generated and which corresponds to the specified pseudo-element type,
    * or nullptr if there is no such anonymous content.
    */
-  virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType);
+  virtual mozilla::dom::Element*
+  GetPseudoElement(mozilla::CSSPseudoElementType aType);
 
   bool BackfaceIsHidden() {
     return StyleDisplay()->BackfaceIsHidden();
   }
 
 protected:
   // Members
   nsRect           mRect;
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -1191,17 +1191,17 @@ GetStatesForPseudoClass(const nsAString&
 
 NS_IMETHODIMP
 inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
 {
   nsTArray<nsIAtom*> array;
 
   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);
+    CSSPseudoElementType type = static_cast<CSSPseudoElementType>(i);
     if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
       nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
       array.AppendElement(atom);
     }
   }
 
   *aLength = array.Length();
   char16_t** ret =
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -93,17 +93,17 @@ nsMathMLFrame::UpdatePresentationData(ui
 // extra leaf style contexts given to the MathMLChars are accessible to
 // the Style System via the Get/Set AdditionalStyleContext() APIs.
 /* static */ void
 nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext*  aPresContext,
                                       nsIContent*      aContent,
                                       nsStyleContext*  aParentStyleContext,
                                       nsMathMLChar*    aMathMLChar)
 {
-  nsCSSPseudoElements::Type pseudoType =
+  CSSPseudoElementType pseudoType =
     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
@@ -63,17 +63,17 @@ CommonAnimationManager::RemoveAllElement
 {
  while (AnimationCollection* head = mElementCollections.getFirst()) {
    head->Destroy(); // Note: this removes 'head' from mElementCollections.
  }
 }
 
 AnimationCollection*
 CommonAnimationManager::GetAnimationCollection(dom::Element *aElement,
-                                               nsCSSPseudoElements::Type
+                                               CSSPseudoElementType
                                                  aPseudoType,
                                                bool aCreateIfNeeded)
 {
   if (!aCreateIfNeeded && mElementCollections.isEmpty()) {
     // Early return for the most common case.
     return nullptr;
   }
 
@@ -112,17 +112,17 @@ CommonAnimationManager::GetAnimationColl
   }
 
   return collection;
 }
 
 AnimationCollection*
 CommonAnimationManager::GetAnimationCollection(const nsIFrame* aFrame)
 {
-  Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>> pseudoElement =
+  Maybe<Pair<dom::Element*, CSSPseudoElementType>> pseudoElement =
     EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
   if (!pseudoElement) {
     return nullptr;
   }
 
   if (!pseudoElement->first()->MayHaveAnimations()) {
     return nullptr;
   }
@@ -147,17 +147,17 @@ CommonAnimationManager::ExtractComputedV
                "unexpected unit");
     aComputedValue.SetIntValue(aComputedValue.GetIntValue(),
                                StyleAnimationValue::eUnit_Visibility);
   }
   return result;
 }
 
 /*static*/ nsString
-AnimationCollection::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
+AnimationCollection::PseudoTypeAsString(CSSPseudoElementType aPseudoType)
 {
   switch (aPseudoType) {
     case CSSPseudoElementType::before:
       return NS_LITERAL_STRING("::before");
     case CSSPseudoElementType::after:
       return NS_LITERAL_STRING("::after");
     default:
       MOZ_ASSERT(aPseudoType == CSSPseudoElementType::NotPseudo,
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -78,17 +78,17 @@ protected:
   virtual nsIAtom* GetAnimationsBeforeAtom() = 0;
   virtual nsIAtom* GetAnimationsAfterAtom() = 0;
 
 public:
   // Get (and optionally create) the collection of animations managed
   // by this class for the given |aElement| and |aPseudoType|.
   AnimationCollection*
   GetAnimationCollection(dom::Element *aElement,
-                         nsCSSPseudoElements::Type aPseudoType,
+                         CSSPseudoElementType aPseudoType,
                          bool aCreateIfNeeded);
 
   // Given the frame |aFrame| with possibly animated content, finds its
   // associated collection of animations. If it is a generated content
   // frame, it may examine the parent frame to search for such animations.
   AnimationCollection*
   GetAnimationCollection(const nsIFrame* aFrame);
 
@@ -169,30 +169,30 @@ public:
   }
 
   bool IsForAnimations() const {
     return mElementProperty == nsGkAtoms::animationsProperty ||
            mElementProperty == nsGkAtoms::animationsOfBeforeProperty ||
            mElementProperty == nsGkAtoms::animationsOfAfterProperty;
   }
 
-  nsCSSPseudoElements::Type PseudoElementType() const
+  CSSPseudoElementType PseudoElementType() const
   {
     if (IsForElement()) {
       return CSSPseudoElementType::NotPseudo;
     }
     if (IsForBeforePseudo()) {
       return CSSPseudoElementType::before;
     }
     MOZ_ASSERT(IsForAfterPseudo(),
                "::before & ::after should be the only pseudo-elements here");
     return CSSPseudoElementType::after;
   }
 
-  static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);
+  static nsString PseudoTypeAsString(CSSPseudoElementType aPseudoType);
 
   dom::Element* GetElementToRestyle() const;
 
   dom::Element *mElement;
 
   // the atom we use in mElement's prop table (must be a static atom,
   // i.e., in an atom list)
   nsIAtom *mElementProperty;
@@ -234,17 +234,17 @@ class OwningElementRef final
 {
 public:
   OwningElementRef()
     : mElement(nullptr)
     , mPseudoType(CSSPseudoElementType::NotPseudo)
   { }
 
   OwningElementRef(dom::Element& aElement,
-                   nsCSSPseudoElements::Type aPseudoType)
+                   CSSPseudoElementType aPseudoType)
     : mElement(&aElement)
     , mPseudoType(aPseudoType)
   { }
 
   bool Equals(const OwningElementRef& aOther) const
   {
     return mElement == aOther.mElement &&
            mPseudoType == aOther.mPseudoType;
@@ -262,26 +262,26 @@ public:
     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 {
+                  CSSPseudoElementType& aPseudoType) const {
     aElement = mElement;
     aPseudoType = mPseudoType;
   }
 
   nsPresContext* GetRenderedPresContext() const;
 
 private:
   dom::Element* MOZ_NON_OWNING_REF mElement;
-  nsCSSPseudoElements::Type        mPseudoType;
+  CSSPseudoElementType             mPseudoType;
 };
 
 template <class EventInfo>
 class DelayedEventDispatcher
 {
 public:
   DelayedEventDispatcher() : mIsSorted(true) { }
 
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -14,16 +14,17 @@
 #include "nsCOMArray.h"
 #include "nsIStyleRule.h"
 #include "mozilla/css/StyleRule.h"
 #include "nsString.h"
 #include "nsStyleContext.h"
 #include "nsStyleSet.h"
 #include "nsComputedDOMStyle.h"
 #include "nsCSSParser.h"
+#include "nsCSSPseudoElements.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Likely.h"
 #include "gfxMatrix.h"
 #include "gfxQuaternion.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
@@ -2521,34 +2522,34 @@ BuildStyleRule(nsCSSProperty aProperty,
                                                      declaration,
                                                      0, 0);
   return rule.forget();
 }
 
 inline
 already_AddRefed<nsStyleContext>
 LookupStyleContext(dom::Element* aElement,
-                   nsCSSPseudoElements::Type aPseudoType)
+                   CSSPseudoElementType aPseudoType)
 {
   nsIDocument* doc = aElement->GetCurrentDoc();
   nsIPresShell* shell = doc->GetShell();
   if (!shell) {
     return nullptr;
   }
 
   nsIAtom* pseudo =
     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,
+                                  CSSPseudoElementType aPseudoType,
                                   const nsAString& aSpecifiedValue,
                                   bool aUseSVGMode,
                                   StyleAnimationValue& aComputedValue,
                                   bool* aIsContextSensitive)
 {
   MOZ_ASSERT(aTargetElement, "null target element");
   MOZ_ASSERT(aTargetElement->GetCurrentDoc(),
              "we should only be able to actively animate nodes that "
@@ -2590,17 +2591,17 @@ StyleAnimationValue::ComputeValue(nsCSSP
   aComputedValue = values[0].mValue;
   return true;
 }
 
 /* static */ bool
 StyleAnimationValue::ComputeValues(nsCSSProperty aProperty,
                                    nsCSSProps::EnabledState aEnabledState,
                                    dom::Element* aTargetElement,
-                                   nsCSSPseudoElements::Type aPseudoType,
+                                   CSSPseudoElementType aPseudoType,
                                    const nsAString& aSpecifiedValue,
                                    bool aUseSVGMode,
                                    nsTArray<PropertyStyleAnimationValuePair>& aResult)
 {
   MOZ_ASSERT(aTargetElement, "null target element");
   MOZ_ASSERT(aTargetElement->GetCurrentDoc(),
              "we should only be able to actively animate nodes that "
              "are in a document");
@@ -2620,17 +2621,17 @@ StyleAnimationValue::ComputeValues(nsCSS
                        styleRule, aResult, /* aIsContextSensitive */ nullptr);
 }
 
 /* static */ bool
 StyleAnimationValue::ComputeValues(
     nsCSSProperty aProperty,
     nsCSSProps::EnabledState aEnabledState,
     dom::Element* aTargetElement,
-    nsCSSPseudoElements::Type aPseudoType,
+    CSSPseudoElementType aPseudoType,
     css::StyleRule* aStyleRule,
     nsTArray<PropertyStyleAnimationValuePair>& aValues,
     bool* aIsContextSensitive)
 {
   if (!nsCSSProps::IsEnabled(aProperty, aEnabledState)) {
     return false;
   }
 
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -9,33 +9,33 @@
 #define mozilla_StyleAnimationValue_h_
 
 #include "mozilla/gfx/MatrixFwd.h"
 #include "nsStringFwd.h"
 #include "nsStringBuffer.h"
 #include "nsCoord.h"
 #include "nsColor.h"
 #include "nsCSSProps.h"
-#include "nsCSSPseudoElements.h"
 #include "nsCSSValue.h"
 
 class nsIFrame;
 class nsStyleContext;
 class gfx3DMatrix;
 
 namespace mozilla {
 
 namespace css {
 class StyleRule;
 } // namespace css
 
 namespace dom {
 class Element;
 } // namespace dom
 
+enum class CSSPseudoElementType : uint8_t;
 struct PropertyStyleAnimationValuePair;
 
 /**
  * Utility class to handle animated style values
  */
 class StyleAnimationValue {
 public:
   // Mathematical methods
@@ -151,17 +151,17 @@ public:
    *                        false otherwise.
    *                        Note that the operation of this method is
    *                        significantly faster when |aIsContextSensitive| is
    *                        nullptr.
    * @return true on success, false on failure.
    */
   static bool ComputeValue(nsCSSProperty aProperty,
                            mozilla::dom::Element* aTargetElement,
-                           nsCSSPseudoElements::Type aPseudoType,
+                           CSSPseudoElementType aPseudoType,
                            const nsAString& aSpecifiedValue,
                            bool aUseSVGMode,
                            StyleAnimationValue& aComputedValue,
                            bool* aIsContextSensitive = nullptr);
 
   /**
    * Like ComputeValue, but returns an array of StyleAnimationValues.
    *
@@ -170,17 +170,17 @@ public:
    * values for all of aProperty's longhand components.  aEnabledState
    * is used to filter the longhand components that will be appended
    * to aResult.  On failure, aResult might still have partial results
    * in it.
    */
   static bool ComputeValues(nsCSSProperty aProperty,
                             nsCSSProps::EnabledState aEnabledState,
                             mozilla::dom::Element* aTargetElement,
-                            nsCSSPseudoElements::Type aPseudoType,
+                            CSSPseudoElementType aPseudoType,
                             const nsAString& aSpecifiedValue,
                             bool aUseSVGMode,
                             nsTArray<PropertyStyleAnimationValuePair>& aResult);
 
   /**
    * Creates a specified value for the given computed value.
    *
    * The first overload fills in an nsCSSValue object; the second
@@ -398,17 +398,17 @@ public:
   bool operator==(const StyleAnimationValue& aOther) const;
   bool operator!=(const StyleAnimationValue& aOther) const
     { return !(*this == aOther); }
 
 private:
   static bool ComputeValues(nsCSSProperty aProperty,
                             nsCSSProps::EnabledState aEnabledState,
                             mozilla::dom::Element* aTargetElement,
-                            nsCSSPseudoElements::Type aPseudoType,
+                            CSSPseudoElementType aPseudoType,
                             mozilla::css::StyleRule* aStyleRule,
                             nsTArray<PropertyStyleAnimationValuePair>& aValues,
                             bool* aIsContextSensitive);
 
   void FreeValue();
 
   static const char16_t* GetBufferValue(nsStringBuffer* aBuffer) {
     return static_cast<char16_t*>(aBuffer->Data());
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -18,17 +18,16 @@
 #include "nsIDocument.h"
 #include "nsIAtom.h"
 #include "nsString.h"
 #include "nsStyleUtil.h"
 #include "nsICSSStyleRuleDOMWrapper.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsNameSpaceManager.h"
 #include "nsXMLNameSpaceMap.h"
-#include "nsCSSPseudoElements.h"
 #include "nsCSSPseudoClasses.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsTArray.h"
 #include "nsDOMClassInfoID.h"
 #include "nsContentUtils.h"
 #include "nsError.h"
 #include "mozAutoDocUpdate.h"
 
@@ -314,17 +313,17 @@ nsCSSSelector::nsCSSSelector(void)
     mNegations(nullptr),
     mNext(nullptr),
     mNameSpace(kNameSpaceID_Unknown),
     mOperator(0),
     mPseudoType(static_cast<int16_t>(CSSPseudoElementType::NotPseudo))
 {
   MOZ_COUNT_CTOR(nsCSSSelector);
   static_assert(static_cast<int16_t>(CSSPseudoElementType::MAX) < INT16_MAX,
-                "nsCSSPseudoElements::Type values overflow mPseudoType");
+                "CSSPseudoElementType values overflow mPseudoType");
 }
 
 nsCSSSelector*
 nsCSSSelector::Clone(bool aDeepNext, bool aDeepNegations) const
 {
   nsCSSSelector *result = new nsCSSSelector();
   if (!result)
     return nullptr;
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -12,18 +12,18 @@
 #define mozilla_css_StyleRule_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/css/Rule.h"
 
 #include "nsString.h"
 #include "nsCOMPtr.h"
+#include "nsCSSPseudoClasses.h"
 #include "nsCSSPseudoElements.h"
-#include "nsCSSPseudoClasses.h"
 #include "nsIStyleRule.h"
 
 class nsIAtom;
 struct nsCSSSelectorList;
 
 namespace mozilla {
 class CSSStyleSheet;
 } // namespace mozilla
@@ -203,23 +203,20 @@ private:
   // selector).
   bool CanBeNamespaced(bool aIsNegated) const;
   // Calculate the specificity of this selector (not including its mNext
   // or its mNegations).
   int32_t CalcWeightWithoutNegations() const;
 
 public:
   // Get and set the selector's pseudo type
-  nsCSSPseudoElements::Type PseudoType() const {
-    return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
+  mozilla::CSSPseudoElementType PseudoType() const {
+    return static_cast<mozilla::CSSPseudoElementType>(mPseudoType);
   }
-  void SetPseudoType(nsCSSPseudoElements::Type aType) {
-    NS_ASSERTION(static_cast<int32_t>(aType) >= INT16_MIN &&
-                 static_cast<int32_t>(aType) <= INT16_MAX,
-                 "Out of bounds - this will overflow mPseudoType");
+  void SetPseudoType(mozilla::CSSPseudoElementType aType) {
     mPseudoType = static_cast<int16_t>(aType);
   }
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   // For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
   // but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
   // Also, for pseudo-elements mCasedTag will be null but mLowercaseTag
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -163,17 +163,17 @@ CSSAnimation::QueueEvents()
   // for these animations to still fire events we should spec the concept
   // of the "original owning element" or "event target" and allow script
   // to set it when creating a CSSAnimation object.
   if (!mOwningElement.IsSet()) {
     return;
   }
 
   dom::Element* owningElement;
-  nsCSSPseudoElements::Type owningPseudoType;
+  CSSPseudoElementType owningPseudoType;
   mOwningElement.GetElement(owningElement, owningPseudoType);
   MOZ_ASSERT(owningElement, "Owning element should be set");
 
   // Get the nsAnimationManager so we can queue events on it
   nsPresContext* presContext = mOwningElement.GetRenderedPresContext();
   if (!presContext) {
     return;
   }
@@ -483,17 +483,17 @@ nsAnimationManager::UpdateAnimations(nsS
   if (mEventDispatcher.HasQueuedEvents()) {
     mPresContext->Document()->SetNeedStyleFlush();
   }
 }
 
 void
 nsAnimationManager::StopAnimationsForElement(
   mozilla::dom::Element* aElement,
-  nsCSSPseudoElements::Type aPseudoType)
+  mozilla::CSSPseudoElementType aPseudoType)
 {
   MOZ_ASSERT(aElement);
   AnimationCollection* collection =
     GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
   if (!collection) {
     return;
   }
 
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -4,41 +4,42 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsAnimationManager_h_
 #define nsAnimationManager_h_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventForwards.h"
 #include "AnimationCommon.h"
-#include "nsCSSPseudoElements.h"
 #include "mozilla/dom/Animation.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/TimeStamp.h"
 
 class nsIGlobalObject;
 class nsStyleContext;
 
 namespace mozilla {
 namespace css {
 class Declaration;
 } /* namespace css */
 namespace dom {
 class KeyframeEffectReadOnly;
 class Promise;
 } /* namespace dom */
 
+enum class CSSPseudoElementType : uint8_t;
+
 struct AnimationEventInfo {
   RefPtr<dom::Element> mElement;
   RefPtr<dom::Animation> mAnimation;
   InternalAnimationEvent mEvent;
   TimeStamp mTimeStamp;
 
   AnimationEventInfo(dom::Element* aElement,
-                     nsCSSPseudoElements::Type aPseudoType,
+                     CSSPseudoElementType aPseudoType,
                      EventMessage aMessage,
                      const nsSubstring& aAnimationName,
                      const StickyTimeDuration& aElapsedTime,
                      const TimeStamp& aTimeStamp,
                      dom::Animation* aAnimation)
     : mElement(aElement)
     , mAnimation(aAnimation)
     , mEvent(true, aMessage)
@@ -317,17 +318,17 @@ public:
   }
   void SortEvents()      { mEventDispatcher.SortEvents(); }
   void ClearEventQueue() { mEventDispatcher.ClearEventQueue(); }
 
   // Stop animations on the element. This method takes the real element
   // rather than the element for the generated content for animations on
   // ::before and ::after.
   void StopAnimationsForElement(mozilla::dom::Element* aElement,
-                                nsCSSPseudoElements::Type aPseudoType);
+                                mozilla::CSSPseudoElementType aPseudoType);
 
   bool IsAnimationManager() override {
     return true;
   }
 
 protected:
   virtual ~nsAnimationManager() {}
 
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -748,17 +748,17 @@ protected:
   // pseudo-elements (as opposed to pseudo-classes) are stored;
   // pseudo-classes are stored on aSelector.  aPseudoElement and
   // aPseudoElementArgs must be non-null iff !aIsNegated.
   nsSelectorParsingStatus ParsePseudoSelector(int32_t&       aDataMask,
                                               nsCSSSelector& aSelector,
                                               bool           aIsNegated,
                                               nsIAtom**      aPseudoElement,
                                               nsAtomList**   aPseudoElementArgs,
-                                              nsCSSPseudoElements::Type* aPseudoElementType);
+                                              CSSPseudoElementType* aPseudoElementType);
 
   nsSelectorParsingStatus ParseAttributeSelector(int32_t&       aDataMask,
                                                  nsCSSSelector& aSelector);
 
   nsSelectorParsingStatus ParseTypeOrUniversalSelector(int32_t&       aDataMask,
                                                        nsCSSSelector& aSelector,
                                                        bool           aIsNegated);
 
@@ -5822,17 +5822,17 @@ CSSParserImpl::ParseAttributeSelector(in
 // Parse pseudo-classes and pseudo-elements
 //
 CSSParserImpl::nsSelectorParsingStatus
 CSSParserImpl::ParsePseudoSelector(int32_t&       aDataMask,
                                    nsCSSSelector& aSelector,
                                    bool           aIsNegated,
                                    nsIAtom**      aPseudoElement,
                                    nsAtomList**   aPseudoElementArgs,
-                                   nsCSSPseudoElements::Type* aPseudoElementType)
+                                   CSSPseudoElementType* aPseudoElementType)
 {
   NS_ASSERTION(aIsNegated || (aPseudoElement && aPseudoElementArgs),
                "expected location to store pseudo element");
   NS_ASSERTION(!aIsNegated || (!aPseudoElement && !aPseudoElementArgs),
                "negated selectors shouldn't have a place to store "
                "pseudo elements");
   if (! GetToken(false)) { // premature eof
     REPORT_UNEXPECTED_EOF(PEPseudoSelEOF);
@@ -5862,17 +5862,17 @@ CSSParserImpl::ParsePseudoSelector(int32
   nsAutoString buffer;
   buffer.Append(char16_t(':'));
   buffer.Append(mToken.mIdent);
   nsContentUtils::ASCIIToLower(buffer);
   nsCOMPtr<nsIAtom> pseudo = do_GetAtom(buffer);
 
   // stash away some info about this pseudo so we only have to get it once.
   bool isTreePseudo = false;
-  nsCSSPseudoElements::Type pseudoElementType =
+  CSSPseudoElementType pseudoElementType =
     nsCSSPseudoElements::GetPseudoType(pseudo);
   nsCSSPseudoClasses::Type pseudoClassType =
     nsCSSPseudoClasses::GetPseudoType(pseudo);
   bool pseudoClassIsUserAction =
     nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
 
   if (!AgentRulesEnabled() &&
       ((pseudoElementType < CSSPseudoElementType::Count &&
@@ -5966,17 +5966,17 @@ CSSParserImpl::ParsePseudoSelector(int32
     nsSelectorParsingStatus parsingStatus =
       ParseNegatedSimpleSelector(aDataMask, aSelector);
     if (eSelectorParsingStatus_Continue != parsingStatus) {
       return parsingStatus;
     }
   }
   else if (!parsingPseudoElement && isPseudoClass) {
     if (aSelector.IsPseudoElement()) {
-      nsCSSPseudoElements::Type type = aSelector.PseudoType();
+      CSSPseudoElementType type = aSelector.PseudoType();
       if (!nsCSSPseudoElements::PseudoElementSupportsUserActionState(type)) {
         // We only allow user action pseudo-classes on certain pseudo-elements.
         REPORT_UNEXPECTED_TOKEN(PEPseudoSelNoUserActionPC);
         UngetToken();
         return eSelectorParsingStatus_Error;
       }
       if (!pseudoClassIsUserAction) {
         // CSS 4 Selectors says that pseudo-elements can only be followed by
@@ -6407,17 +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 = CSSPseudoElementType::NotPseudo;
+  CSSPseudoElementType 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);
--- a/layout/style/nsCSSPseudoElements.cpp
+++ b/layout/style/nsCSSPseudoElements.cpp
@@ -62,28 +62,28 @@ nsCSSPseudoElements::IsCSS2PseudoElement
   NS_ASSERTION(nsCSSPseudoElements::IsPseudoElement(aAtom) ||
                nsCSSAnonBoxes::IsAnonBox(aAtom),
                "must be pseudo element or anon box");
   bool result = aAtom == nsCSSPseudoElements::after ||
                   aAtom == nsCSSPseudoElements::before ||
                   aAtom == nsCSSPseudoElements::firstLetter ||
                   aAtom == nsCSSPseudoElements::firstLine;
   NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aAtom) ||
-               result ==
-                 PseudoElementHasFlags(GetPseudoType(aAtom), CSS_PSEUDO_ELEMENT_IS_CSS2),
+               result == PseudoElementHasFlags(GetPseudoType(aAtom),
+                                               CSS_PSEUDO_ELEMENT_IS_CSS2),
                "result doesn't match flags");
   return result;
 }
 
 /* static */ CSSPseudoElementType
 nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
 {
-  for (uint32_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
+  for (uint8_t i = 0; i < ArrayLength(CSSPseudoElements_info); ++i) {
     if (*CSSPseudoElements_info[i].mAtom == aAtom) {
-      return Type(i);
+      return static_cast<Type>(i);
     }
   }
 
   if (nsCSSAnonBoxes::IsAnonBox(aAtom)) {
 #ifdef MOZ_XUL
     if (nsCSSAnonBoxes::IsTreePseudoElement(aAtom)) {
       return Type::XULTree;
     }
@@ -93,25 +93,24 @@ nsCSSPseudoElements::GetPseudoType(nsIAt
   }
 
   return Type::NotPseudo;
 }
 
 /* static */ nsIAtom*
 nsCSSPseudoElements::GetPseudoAtom(Type aType)
 {
-  NS_ASSERTION(aType < Type::Count,
-               "Unexpected type");
+  NS_ASSERTION(aType < Type::Count, "Unexpected type");
   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);
+  uint8_t index = static_cast<uint8_t>(aType);
   NS_ASSERTION(index < ArrayLength(CSSPseudoElements_flags),
                "argument must be a pseudo-element");
   return CSSPseudoElements_flags[index];
 }
 
 /* static */ bool
 nsCSSPseudoElements::PseudoElementSupportsUserActionState(const Type aType)
 {
--- a/layout/style/nsCSSPseudoElements.h
+++ b/layout/style/nsCSSPseudoElements.h
@@ -56,44 +56,45 @@ enum class CSSPseudoElementType : uint8_
 };
 
 } // 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 {
+class nsCSSPseudoElements
+{
+  typedef mozilla::CSSPseudoElementType Type;
+
 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
 
   static Type GetPseudoType(nsIAtom* aAtom);
 
-  // Get the atom for a given Type.  aType must be < Type::Count
+  // Get the atom for a given Type.  aType must be < CSSPseudoElementType::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 < Type::Count);
-    return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
+    return PseudoElementHasFlags(aType,
+                                 CSS_PSEUDO_ELEMENT_SUPPORTS_STYLE_ATTRIBUTE);
   }
 
   static bool PseudoElementSupportsUserActionState(const Type aType);
 
   static bool PseudoElementIsUASheetOnly(const Type aType) {
     MOZ_ASSERT(aType < Type::Count);
     return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
   }
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -2711,17 +2711,17 @@ static inline nsRestyleHint RestyleHintF
   }
 
   return eRestyle_Self;
 }
 
 nsRestyleHint
 nsCSSRuleProcessor::HasStateDependentStyle(ElementDependentRuleProcessorData* aData,
                                            Element* aStatefulElement,
-                                           nsCSSPseudoElements::Type aPseudoType,
+                                           CSSPseudoElementType aPseudoType,
                                            EventStates aStateMask)
 {
   MOZ_ASSERT(!aData->mTreeMatchContext.mForScopedStyle,
              "mCurrentStyleScope will need to be saved and restored after the "
              "SelectorMatchesTree call");
 
   bool isPseudoElement =
     aPseudoType != CSSPseudoElementType::NotPseudo;
@@ -3406,17 +3406,17 @@ AddSelector(RuleCascadeData* aCascade,
 }
 
 static bool
 AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
 {
   RuleCascadeData * const cascade = aCascade;
 
   // Build the rule hash.
-  nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
+  CSSPseudoElementType pseudoType = aRuleInfo->mSelector->PseudoType();
   if (MOZ_LIKELY(pseudoType == CSSPseudoElementType::NotPseudo)) {
     cascade->mRuleHash.AppendRule(*aRuleInfo);
   } else if (pseudoType < CSSPseudoElementType::Count) {
     RuleHash*& ruleHash =
       cascade->mPseudoElementRuleHashes[static_cast<uint8_t>(pseudoType)];
     if (!ruleHash) {
       ruleHash = new RuleHash(cascade->mQuirksMode);
       if (!ruleHash) {
@@ -3457,17 +3457,17 @@ AddRule(RuleSelectorPair* aRuleInfo, Rul
 #else
     NS_NOTREACHED("Unexpected pseudo type");
 #endif
   }
 
   for (nsCSSSelector* selector = aRuleInfo->mSelector;
            selector; selector = selector->mNext) {
     if (selector->IsPseudoElement()) {
-      nsCSSPseudoElements::Type pseudo = selector->PseudoType();
+      CSSPseudoElementType pseudo = selector->PseudoType();
       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
--- a/layout/style/nsCSSRuleProcessor.h
+++ b/layout/style/nsCSSRuleProcessor.h
@@ -14,17 +14,16 @@
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/RefCountType.h"
 #include "mozilla/SheetType.h"
 #include "mozilla/UniquePtr.h"
 #include "nsAutoPtr.h"
-#include "nsCSSPseudoElements.h"
 #include "nsExpirationTracker.h"
 #include "nsIMediaList.h"
 #include "nsIStyleRuleProcessor.h"
 #include "nsRuleWalker.h"
 #include "nsTArray.h"
 
 struct CascadeEnumData;
 struct ElementDependentRuleProcessorData;
@@ -35,16 +34,17 @@ struct RuleCascadeData;
 struct TreeMatchContext;
 class nsCSSKeyframesRule;
 class nsCSSPageRule;
 class nsCSSFontFeatureValuesRule;
 class nsCSSCounterStyleRule;
 
 namespace mozilla {
 class CSSStyleSheet;
+enum class CSSPseudoElementType : uint8_t;
 namespace css {
 class DocumentRule;
 } // namespace css
 } // namespace mozilla
 
 /**
  * The CSS style rule processor provides a mechanism for sibling style
  * sheets to combine their rule processing in order to allow proper
@@ -229,17 +229,17 @@ private:
   static bool CascadeSheet(mozilla::CSSStyleSheet* aSheet,
                            CascadeEnumData* aData);
 
   RuleCascadeData* GetRuleCascade(nsPresContext* aPresContext);
   void RefreshRuleCascade(nsPresContext* aPresContext);
 
   nsRestyleHint HasStateDependentStyle(ElementDependentRuleProcessorData* aData,
                                        mozilla::dom::Element* aStatefulElement,
-                                       nsCSSPseudoElements::Type aPseudoType,
+                                       mozilla::CSSPseudoElementType aPseudoType,
                                        mozilla::EventStates aStateMask);
 
   void ClearSheets();
 
   // The sheet order here is the same as in nsStyleSet::mSheets
   sheet_array_type mSheets;
 
   // active first, then cached (most recent first)
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -483,17 +483,17 @@ nsComputedDOMStyle::GetStyleContextForEl
   nsPresContext *presContext = presShell->GetPresContext();
   if (!presContext)
     return nullptr;
 
   nsStyleSet *styleSet = presShell->StyleSet();
 
   RefPtr<nsStyleContext> sc;
   if (aPseudo) {
-    nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
+    CSSPseudoElementType type = nsCSSPseudoElements::GetPseudoType(aPseudo);
     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);
@@ -691,18 +691,17 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
       // We want to check that going through this path because of
       // HasPseudoElementData is rare, because it slows us down a good
       // bit.  So check that we're really inside something associated
       // with a pseudo-element that contains elements.
       nsStyleContext* topWithPseudoElementData = mStyleContext;
       while (topWithPseudoElementData->GetParent()->HasPseudoElementData()) {
         topWithPseudoElementData = topWithPseudoElementData->GetParent();
       }
-      nsCSSPseudoElements::Type pseudo =
-        topWithPseudoElementData->GetPseudoType();
+      CSSPseudoElementType pseudo = topWithPseudoElementData->GetPseudoType();
       nsIAtom* pseudoAtom = nsCSSPseudoElements::GetPseudoAtom(pseudo);
       nsAutoString assertMsg(
         NS_LITERAL_STRING("we should be in a pseudo-element that is expected to contain elements ("));
       assertMsg.Append(nsDependentString(pseudoAtom->GetUTF16String()));
       assertMsg.Append(')');
       NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo),
                    NS_LossyConvertUTF16toASCII(assertMsg).get());
     }
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -13,16 +13,17 @@
 #include "mozilla/css/StyleRule.h"
 #include "nsIStyleRuleProcessor.h"
 #include "nsPresContext.h"
 #include "nsRuleWalker.h"
 #include "nsRuleProcessorData.h"
 #include "mozilla/dom/Element.h"
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
+#include "nsCSSPseudoElements.h"
 #include "RestyleManager.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet()
 {
 }
@@ -76,17 +77,17 @@ nsHTMLCSSStyleSheet::ElementRulesMatchin
       declaration->SetImmutable();
       aRuleWalker->Forward(declaration);
     }
   }
 }
 
 void
 nsHTMLCSSStyleSheet::PseudoElementRulesMatching(Element* aPseudoElement,
-                                                nsCSSPseudoElements::Type
+                                                CSSPseudoElementType
                                                   aPseudoType,
                                                 nsRuleWalker* aRuleWalker)
 {
   MOZ_ASSERT(nsCSSPseudoElements::
                PseudoElementSupportsStyleAttribute(aPseudoType));
   MOZ_ASSERT(aPseudoElement);
 
   // just get the one and only style rule from the content's STYLE attribute
--- a/layout/style/nsHTMLCSSStyleSheet.h
+++ b/layout/style/nsHTMLCSSStyleSheet.h
@@ -8,24 +8,24 @@
  */
 
 #ifndef nsHTMLCSSStyleSheet_h_
 #define nsHTMLCSSStyleSheet_h_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 
-#include "nsCSSPseudoElements.h"
 #include "nsDataHashtable.h"
 #include "nsIStyleRuleProcessor.h"
 
 class nsRuleWalker;
 struct MiscContainer;
 
 namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
 
 class nsHTMLCSSStyleSheet final : public nsIStyleRuleProcessor
 {
 public:
@@ -55,17 +55,17 @@ public:
   // Variants of RulesMatching method above that is specific to this
   // rule processor.
   void ElementRulesMatching(nsPresContext* aPresContext,
                             mozilla::dom::Element* aElement,
                             nsRuleWalker* aRuleWalker);
   // aPseudoElement here is the content node for the pseudo-element, not
   // its corresponding real element.
   void PseudoElementRulesMatching(mozilla::dom::Element* aPseudoElement,
-                                  nsCSSPseudoElements::Type aPseudoType,
+                                  mozilla::CSSPseudoElementType aPseudoType,
                                   nsRuleWalker* aRuleWalker);
 
   void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
   void EvictStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
   MiscContainer* LookupStyleAttr(const nsAString& aSerialized);
 
 private: 
   ~nsHTMLCSSStyleSheet();
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -465,31 +465,31 @@ struct MOZ_STACK_CLASS ElementRuleProces
   }
 };
 
 struct MOZ_STACK_CLASS PseudoElementRuleProcessorData :
                           public ElementDependentRuleProcessorData {
   PseudoElementRuleProcessorData(nsPresContext* aPresContext,
                                  mozilla::dom::Element* aParentElement,
                                  nsRuleWalker* aRuleWalker,
-                                 nsCSSPseudoElements::Type aPseudoType,
+                                 mozilla::CSSPseudoElementType aPseudoType,
                                  TreeMatchContext& aTreeMatchContext,
                                  mozilla::dom::Element* aPseudoElement)
     : ElementDependentRuleProcessorData(aPresContext, aParentElement, aRuleWalker,
                                         aTreeMatchContext),
       mPseudoType(aPseudoType),
       mPseudoElement(aPseudoElement)
   {
     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::CSSPseudoElementType mPseudoType;
   mozilla::dom::Element* const mPseudoElement; // weak ref
 };
 
 struct MOZ_STACK_CLASS AnonBoxRuleProcessorData : public RuleProcessorData {
   AnonBoxRuleProcessorData(nsPresContext* aPresContext,
                            nsIAtom* aPseudoTag,
                            nsRuleWalker* aRuleWalker)
     : RuleProcessorData(aPresContext, aRuleWalker),
@@ -544,31 +544,31 @@ struct MOZ_STACK_CLASS StateRuleProcesso
   const mozilla::EventStates mStateMask;
 };
 
 struct MOZ_STACK_CLASS PseudoElementStateRuleProcessorData :
                           public StateRuleProcessorData {
   PseudoElementStateRuleProcessorData(nsPresContext* aPresContext,
                                       mozilla::dom::Element* aElement,
                                       mozilla::EventStates aStateMask,
-                                      nsCSSPseudoElements::Type aPseudoType,
+                                      mozilla::CSSPseudoElementType aPseudoType,
                                       TreeMatchContext& aTreeMatchContext,
                                       mozilla::dom::Element* aPseudoElement)
     : StateRuleProcessorData(aPresContext, aElement, aStateMask,
                              aTreeMatchContext),
       mPseudoType(aPseudoType),
       mPseudoElement(aPseudoElement)
   {
     NS_PRECONDITION(!aTreeMatchContext.mForStyling, "Not styling here!");
   }
 
   // We kind of want to inherit from both StateRuleProcessorData and
   // PseudoElementRuleProcessorData.  Instead we've just copied those
   // members from PseudoElementRuleProcessorData to this struct.
-  nsCSSPseudoElements::Type mPseudoType;
+  mozilla::CSSPseudoElementType mPseudoType;
   mozilla::dom::Element* const mPseudoElement; // weak ref
 };
 
 struct MOZ_STACK_CLASS AttributeRuleProcessorData :
                           public ElementDependentRuleProcessorData {
   AttributeRuleProcessorData(nsPresContext* aPresContext,
                              mozilla::dom::Element* aElement,
                              int32_t aNameSpaceID,
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -1,19 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
+
 /* the interface (to internal code) for retrieving computed style data */
 
 #include "CSSVariableImageTable.h"
 #include "mozilla/DebugOnly.h"
 
 #include "nsCSSAnonBoxes.h"
+#include "nsCSSPseudoElements.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsPresContext.h"
 #include "nsIStyleRule.h"
 
 #include "nsCOMPtr.h"
 #include "nsStyleSet.h"
 #include "nsIPresShell.h"
@@ -65,17 +66,17 @@ const uint32_t nsStyleContext::sDependen
 };
 
 // Whether to perform expensive assertions in the nsStyleContext destructor.
 static bool sExpensiveStyleStructAssertionsEnabled;
 #endif
 
 nsStyleContext::nsStyleContext(nsStyleContext* aParent,
                                nsIAtom* aPseudoTag,
-                               nsCSSPseudoElements::Type aPseudoType,
+                               CSSPseudoElementType aPseudoType,
                                nsRuleNode* aRuleNode,
                                bool aSkipParentDisplayBasedStyleFixup)
   : mParent(aParent)
   , mChild(nullptr)
   , mEmptyChild(nullptr)
   , mPseudoTag(aPseudoTag)
   , mRuleNode(aRuleNode)
   , mCachedResetData(nullptr)
@@ -1211,17 +1212,17 @@ nsStyleContext::Destroy()
   // instead. Don't call the global operator delete.
   presContext->PresShell()->
     FreeByObjectID(eArenaObjectID_nsStyleContext, this);
 }
 
 already_AddRefed<nsStyleContext>
 NS_NewStyleContext(nsStyleContext* aParentContext,
                    nsIAtom* aPseudoTag,
-                   nsCSSPseudoElements::Type aPseudoType,
+                   CSSPseudoElementType aPseudoType,
                    nsRuleNode* aRuleNode,
                    bool aSkipParentDisplayBasedStyleFixup)
 {
   RefPtr<nsStyleContext> context =
     new (aRuleNode->PresContext())
     nsStyleContext(aParentContext, aPseudoTag, aPseudoType, aRuleNode,
                    aSkipParentDisplayBasedStyleFixup);
   return context.forget();
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -6,21 +6,24 @@
 /* the interface (to internal code) for retrieving computed style data */
 
 #ifndef _nsStyleContext_h_
 #define _nsStyleContext_h_
 
 #include "mozilla/RestyleLogging.h"
 #include "mozilla/Assertions.h"
 #include "nsRuleNode.h"
-#include "nsCSSPseudoElements.h"
 
 class nsIAtom;
 class nsPresContext;
 
+namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
+} // namespace mozilla
+
 /**
  * An nsStyleContext represents the computed style data for an element.
  * The computed style data are stored in a set of structs (see
  * nsStyleStruct.h) that are cached either on the style context or in
  * the rule tree (see nsRuleNode.h for a description of this caching and
  * how the cached structs are shared).
  *
  * Since the data in |nsIStyleRule|s and |nsRuleNode|s are immutable
@@ -55,23 +58,23 @@ public:
    *                    this style context is for a normal DOM element.
    * @param aPseudoType  Must match aPseudoTag.
    * @param aRuleNode  A rule node representing the ordered sequence of
    *                   rules that any element, pseudo-element, or
    *                   anonymous box that this style context is for
    *                   matches.  See |nsRuleNode| and |nsIStyleRule|.
    * @param aSkipParentDisplayBasedStyleFixup
    *                 If set, this flag indicates that we should skip
-   *                 the chunk of ApplyStyleFixups() that applies to 
-   *                 special cases where a child element's style may 
-   *                 need to be modified based on its parent's display 
+   *                 the chunk of ApplyStyleFixups() that applies to
+   *                 special cases where a child element's style may
+   *                 need to be modified based on its parent's display
    *                 value.
    */
   nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
-                 nsCSSPseudoElements::Type aPseudoType,
+                 mozilla::CSSPseudoElementType aPseudoType,
                  nsRuleNode* aRuleNode,
                  bool aSkipParentDisplayBasedStyleFixup);
 
   void* operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW;
   void Destroy();
 
   // These two methods are for use by ArenaRefPtr.
   static mozilla::ArenaObjectID ArenaObjectID()
@@ -132,19 +135,19 @@ public:
     return mRefCnt == 1;
   }
 
   nsPresContext* PresContext() const { return mRuleNode->PresContext(); }
 
   nsStyleContext* GetParent() const { return mParent; }
 
   nsIAtom* GetPseudo() const { return mPseudoTag; }
-  nsCSSPseudoElements::Type GetPseudoType() const {
-    return static_cast<nsCSSPseudoElements::Type>(mBits >>
-                                                  NS_STYLE_CONTEXT_TYPE_SHIFT);
+  mozilla::CSSPseudoElementType GetPseudoType() const {
+    return static_cast<mozilla::CSSPseudoElementType>(
+             mBits >> NS_STYLE_CONTEXT_TYPE_SHIFT);
   }
 
   // Find, if it already exists *and is easily findable* (i.e., near the
   // start of the child list), a style context whose:
   //  * GetPseudo() matches aPseudoTag
   //  * RuleNode() matches aRules
   //  * !GetStyleIfVisited() == !aRulesIfVisited, and, if they're
   //    non-null, GetStyleIfVisited()->RuleNode() == aRulesIfVisited
@@ -624,12 +627,12 @@ private:
 
   static const uint32_t sDependencyTable[];
 #endif
 };
 
 already_AddRefed<nsStyleContext>
 NS_NewStyleContext(nsStyleContext* aParentContext,
                    nsIAtom* aPseudoTag,
-                   nsCSSPseudoElements::Type aPseudoType,
+                   mozilla::CSSPseudoElementType aPseudoType,
                    nsRuleNode* aRuleNode,
                    bool aSkipParentDisplayBasedStyleFixup);
 #endif
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -880,17 +880,17 @@ nsStyleSet::GetContext(nsStyleContext* a
                        nsRuleNode* aRuleNode,
                        // aVisitedRuleNode may be null; if it is null
                        // it means that we don't need to force creation
                        // of a StyleIfVisited.  (But if we make one
                        // because aParentContext has one, then aRuleNode
                        // should be used.)
                        nsRuleNode* aVisitedRuleNode,
                        nsIAtom* aPseudoTag,
-                       nsCSSPseudoElements::Type aPseudoType,
+                       CSSPseudoElementType aPseudoType,
                        Element* aElementForAnimation,
                        uint32_t aFlags)
 {
   NS_PRECONDITION((!aPseudoTag &&
                    aPseudoType ==
                      CSSPseudoElementType::NotPseudo) ||
                   (aPseudoTag &&
                    nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
@@ -1499,17 +1499,17 @@ static const CascadeLevel gCascadeLevels
   { SheetType::Agent,            true,  false, nsRestyleHint(0) },
   { SheetType::Transition,       false, false, eRestyle_CSSTransitions },
 };
 
 nsRuleNode*
 nsStyleSet::RuleNodeWithReplacement(Element* aElement,
                                     Element* aPseudoElement,
                                     nsRuleNode* aOldRuleNode,
-                                    nsCSSPseudoElements::Type aPseudoType,
+                                    CSSPseudoElementType aPseudoType,
                                     nsRestyleHint aReplacements)
 {
   NS_ASSERTION(mBatching == 0, "rule processors out of date");
 
   MOZ_ASSERT(!aPseudoElement ==
              (aPseudoType >= CSSPseudoElementType::Count ||
               !(nsCSSPseudoElements::PseudoElementSupportsStyleAttribute(aPseudoType) ||
                 nsCSSPseudoElements::PseudoElementSupportsUserActionState(aPseudoType))),
@@ -1701,17 +1701,17 @@ nsStyleSet::ResolveStyleWithReplacement(
     // 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 (aOldStyleContext->RelevantLinkVisited()) {
       flags |= eIsVisitedLink;
     }
   }
 
-  nsCSSPseudoElements::Type pseudoType = aOldStyleContext->GetPseudoType();
+  CSSPseudoElementType pseudoType = aOldStyleContext->GetPseudoType();
   Element* elementForAnimation = nullptr;
   if (!(aFlags & eSkipStartingAnimations) &&
       (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
@@ -1751,17 +1751,17 @@ nsStyleSet::ResolveStyleWithReplacement(
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolveStyleWithoutAnimation(dom::Element* aTarget,
                                          nsStyleContext* aStyleContext,
                                          nsRestyleHint aWhichToRemove)
 {
 #ifdef DEBUG
-  nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
+  CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
 #endif
   MOZ_ASSERT(pseudoType == CSSPseudoElementType::NotPseudo ||
              pseudoType == CSSPseudoElementType::before ||
              pseudoType == CSSPseudoElementType::after,
              "unexpected type for animations");
   RestyleManager* restyleManager = PresContext()->RestyleManager();
 
   bool oldSkipAnimationRules = restyleManager->SkipAnimationRules();
@@ -1782,17 +1782,17 @@ nsStyleSet::ResolveStyleForNonElement(ns
 {
   return GetContext(aParentContext, mRuleTree, nullptr,
                     nsCSSAnonBoxes::mozNonElement,
                     CSSPseudoElementType::AnonBox, nullptr,
                     eNoFlags);
 }
 
 void
-nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
+nsStyleSet::WalkRestrictionRule(CSSPseudoElementType aPseudoType,
                                 nsRuleWalker* aRuleWalker)
 {
   // This needs to match GetPseudoRestriction in nsRuleNode.cpp.
   aRuleWalker->SetLevel(SheetType::Agent, false, false);
   if (aPseudoType == CSSPseudoElementType::firstLetter)
     aRuleWalker->Forward(mFirstLetterRule);
   else if (aPseudoType == CSSPseudoElementType::firstLine)
     aRuleWalker->Forward(mFirstLineRule);
@@ -1805,17 +1805,17 @@ nsStyleSet::WalkDisableTextZoomRule(Elem
 {
   aRuleWalker->SetLevel(SheetType::Agent, false, false);
   if (aElement->IsSVGElement(nsGkAtoms::text))
     aRuleWalker->Forward(mDisableTextZoomStyleRule);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
-                                      nsCSSPseudoElements::Type aType,
+                                      CSSPseudoElementType aType,
                                       nsStyleContext* aParentContext,
                                       Element* aPseudoElement)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
 
   NS_ASSERTION(aType < CSSPseudoElementType::Count,
                "must have pseudo element type");
   NS_ASSERTION(aParentElement, "Must have parent element");
@@ -1859,29 +1859,29 @@ nsStyleSet::ResolvePseudoElementStyle(El
 
   return GetContext(aParentContext, ruleNode, visitedRuleNode,
                     nsCSSPseudoElements::GetPseudoAtom(aType), aType,
                     aParentElement, flags);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
-                                    nsCSSPseudoElements::Type aType,
+                                    CSSPseudoElementType aType,
                                     nsStyleContext* aParentContext)
 {
   TreeMatchContext treeContext(true, nsRuleWalker::eRelevantLinkUnvisited,
                                aParentElement->OwnerDoc());
   InitStyleScopes(treeContext, aParentElement);
   return ProbePseudoElementStyle(aParentElement, aType, aParentContext,
                                  treeContext);
 }
 
 already_AddRefed<nsStyleContext>
 nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
-                                    nsCSSPseudoElements::Type aType,
+                                    CSSPseudoElementType aType,
                                     nsStyleContext* aParentContext,
                                     TreeMatchContext& aTreeMatchContext,
                                     Element* aPseudoElement)
 {
   NS_ENSURE_FALSE(mInShutdown, nullptr);
 
   NS_ASSERTION(aType < CSSPseudoElementType::Count,
                "must have pseudo element type");
@@ -2260,17 +2260,17 @@ nsStyleSet::ReparentStyleContext(nsStyle
   // This short-circuit is OK because we don't call TryStartingTransition
   // during style reresolution if the style context pointer hasn't changed.
   if (aStyleContext->GetParent() == aNewParentContext) {
     RefPtr<nsStyleContext> ret = aStyleContext;
     return ret.forget();
   }
 
   nsIAtom* pseudoTag = aStyleContext->GetPseudo();
-  nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
+  CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
   nsRuleNode* ruleNode = aStyleContext->RuleNode();
 
   NS_ASSERTION(!PresContext()->RestyleManager()->SkipAnimationRules(),
                "we no longer handle SkipAnimationRules()");
 
   nsRuleNode* visitedRuleNode = nullptr;
   nsStyleContext* visitedContext = aStyleContext->GetStyleIfVisited();
   // Reparenting a style context just changes where we inherit from,
@@ -2319,17 +2319,17 @@ struct MOZ_STACK_CLASS StatefulData : pu
                              aTreeMatchContext),
       mHint(nsRestyleHint(0))
   {}
   nsRestyleHint   mHint;
 };
 
 struct MOZ_STACK_CLASS StatefulPseudoElementData : public PseudoElementStateRuleProcessorData {
   StatefulPseudoElementData(nsPresContext* aPresContext, Element* aElement,
-               EventStates aStateMask, nsCSSPseudoElements::Type aPseudoType,
+               EventStates aStateMask, CSSPseudoElementType aPseudoType,
                TreeMatchContext& aTreeMatchContext, Element* aPseudoElement)
     : PseudoElementStateRuleProcessorData(aPresContext, aElement, aStateMask,
                                           aPseudoType, aTreeMatchContext,
                                           aPseudoElement),
       mHint(nsRestyleHint(0))
   {}
   nsRestyleHint   mHint;
 };
@@ -2390,17 +2390,17 @@ nsStyleSet::HasStateDependentStyle(Eleme
   InitStyleScopes(treeContext, aElement);
   StatefulData data(PresContext(), aElement, aStateMask, treeContext);
   WalkRuleProcessors(SheetHasStatefulStyle, &data, false);
   return data.mHint;
 }
 
 nsRestyleHint
 nsStyleSet::HasStateDependentStyle(Element* aElement,
-                                   nsCSSPseudoElements::Type aPseudoType,
+                                   CSSPseudoElementType aPseudoType,
                                    Element* aPseudoElement,
                                    EventStates aStateMask)
 {
   TreeMatchContext treeContext(false, nsRuleWalker::eLinksVisitedOrUnvisited,
                                aElement->OwnerDoc());
   InitStyleScopes(treeContext, aElement);
   StatefulPseudoElementData data(PresContext(), aElement, aStateMask,
                                  aPseudoType, treeContext, aPseudoElement);
--- a/layout/style/nsStyleSet.h
+++ b/layout/style/nsStyleSet.h
@@ -20,32 +20,32 @@
 
 #include "nsIStyleRuleProcessor.h"
 #include "nsBindingManager.h"
 #include "nsRuleNode.h"
 #include "nsTArray.h"
 #include "nsCOMArray.h"
 #include "nsAutoPtr.h"
 #include "nsIStyleRule.h"
-#include "nsCSSPseudoElements.h"
 
 class gfxFontFeatureValueSet;
 class nsCSSKeyframesRule;
 class nsCSSFontFeatureValuesRule;
 class nsCSSPageRule;
 class nsCSSCounterStyleRule;
 class nsICSSPseudoComparator;
 class nsRuleWalker;
 struct ElementDependentRuleProcessorData;
 struct nsFontFaceRuleContainer;
 struct TreeMatchContext;
 
 namespace mozilla {
 class CSSStyleSheet;
 class EventStates;
+enum class CSSPseudoElementType : uint8_t;
 } // namespace mozilla
 
 class nsEmptyStyleRule final : public nsIStyleRule
 {
 private:
   ~nsEmptyStyleRule() {}
 
 public:
@@ -167,36 +167,36 @@ class nsStyleSet final
   //
   // Perhaps this should go away and we shouldn't even create style
   // contexts for such content nodes.  However, not doing any rule
   // matching for them is a first step.
   already_AddRefed<nsStyleContext>
   ResolveStyleForNonElement(nsStyleContext* aParentContext);
 
   // Get a style context for a pseudo-element.  aParentElement must be
-  // non-null.  aPseudoID is the nsCSSPseudoElements::Type for the
+  // non-null.  aPseudoID is the CSSPseudoElementType for the
   // pseudo-element.  aPseudoElement must be non-null if the pseudo-element
   // type is one that allows user action pseudo-classes after it or allows
   // style attributes; otherwise, it is ignored.
   already_AddRefed<nsStyleContext>
   ResolvePseudoElementStyle(mozilla::dom::Element* aParentElement,
-                            nsCSSPseudoElements::Type aType,
+                            mozilla::CSSPseudoElementType aType,
                             nsStyleContext* aParentContext,
                             mozilla::dom::Element* aPseudoElement);
 
   // This functions just like ResolvePseudoElementStyle except that it will
   // return nullptr if there are no explicit style rules for that
   // pseudo element.
   already_AddRefed<nsStyleContext>
   ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
-                          nsCSSPseudoElements::Type aType,
+                          mozilla::CSSPseudoElementType aType,
                           nsStyleContext* aParentContext);
   already_AddRefed<nsStyleContext>
   ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
-                          nsCSSPseudoElements::Type aType,
+                          mozilla::CSSPseudoElementType aType,
                           nsStyleContext* aParentContext,
                           TreeMatchContext& aTreeMatchContext,
                           mozilla::dom::Element* aPseudoElement = nullptr);
 
   /**
    * Bit-flags that can be passed to ResolveAnonymousBoxStyle and GetContext
    * in their parameter 'aFlags'.
    */
@@ -278,17 +278,17 @@ class nsStyleSet final
   // Test if style is dependent on a document state.
   bool HasDocumentStateDependentStyle(nsIContent*    aContent,
                                       mozilla::EventStates aStateMask);
 
   // Test if style is dependent on content state
   nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
                                        mozilla::EventStates aStateMask);
   nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
-                                       nsCSSPseudoElements::Type aPseudoType,
+                                       mozilla::CSSPseudoElementType aPseudoType,
                                        mozilla::dom::Element* aPseudoElement,
                                        mozilla::EventStates aStateMask);
 
   // Test if style is dependent on the presence of an attribute.
   nsRestyleHint HasAttributeDependentStyle(mozilla::dom::Element* aElement,
                                            int32_t        aNameSpaceID,
                                            nsIAtom*       aAttribute,
                                            int32_t        aModType,
@@ -414,17 +414,17 @@ private:
   nsresult GatherRuleProcessors(mozilla::SheetType aType);
 
   void AddImportantRules(nsRuleNode* aCurrLevelNode,
                          nsRuleNode* aLastPrevLevelNode,
                          nsRuleWalker* aRuleWalker);
 
   // Move aRuleWalker forward by the appropriate rule if we need to add
   // a rule due to property restrictions on pseudo-elements.
-  void WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
+  void WalkRestrictionRule(mozilla::CSSPseudoElementType aPseudoType,
                            nsRuleWalker* aRuleWalker);
 
   void WalkDisableTextZoomRule(mozilla::dom::Element* aElement,
                                nsRuleWalker* aRuleWalker);
 
 #ifdef DEBUG
   // Just like AddImportantRules except it doesn't actually add anything; it
   // just asserts that there are no important rules between aCurrLevelNode and
@@ -455,25 +455,25 @@ private:
                           bool aWalkAllXBLStylesheets);
 
   // Helper for ResolveStyleWithReplacement
   // aPseudoElement must follow the same rules as for
   // ResolvePseudoElementStyle, and be null for non-pseudo-element cases
   nsRuleNode* RuleNodeWithReplacement(mozilla::dom::Element* aElement,
                                       mozilla::dom::Element* aPseudoElement,
                                       nsRuleNode* aOldRuleNode,
-                                      nsCSSPseudoElements::Type aPseudoType,
+                                      mozilla::CSSPseudoElementType aPseudoType,
                                       nsRestyleHint aReplacements);
 
   already_AddRefed<nsStyleContext>
   GetContext(nsStyleContext* aParentContext,
              nsRuleNode* aRuleNode,
              nsRuleNode* aVisitedRuleNode,
              nsIAtom* aPseudoTag,
-             nsCSSPseudoElements::Type aPseudoType,
+             mozilla::CSSPseudoElementType aPseudoType,
              mozilla::dom::Element* aElementForAnimation,
              uint32_t aFlags);
 
   nsPresContext* PresContext() { return mRuleTree->PresContext(); }
 
   // The sheets in each array in mSheets are stored with the most significant
   // sheet last.
   // The arrays for ePresHintSheet, eStyleAttrSheet, eTransitionSheet,
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -23,16 +23,17 @@
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/dom/DocumentTimeline.h"
 #include "mozilla/dom/Element.h"
 #include "nsIFrame.h"
 #include "Layers.h"
 #include "FrameLayerBuilder.h"
 #include "nsCSSProps.h"
+#include "nsCSSPseudoElements.h"
 #include "nsDisplayList.h"
 #include "nsStyleChangeList.h"
 #include "nsStyleSet.h"
 #include "RestyleManager.h"
 #include "nsDOMMutationObserver.h"
 
 using mozilla::TimeStamp;
 using mozilla::TimeDuration;
@@ -124,17 +125,17 @@ CSSTransition::QueueEvents()
                        playState == AnimationPlayState::Finished;
   mWasFinishedOnLastTick = playState == AnimationPlayState::Finished;
 
   if (!newlyFinished || !mEffect || !mOwningElement.IsSet()) {
     return;
   }
 
   dom::Element* owningElement;
-  nsCSSPseudoElements::Type owningPseudoType;
+  CSSPseudoElementType owningPseudoType;
   mOwningElement.GetElement(owningElement, owningPseudoType);
   MOZ_ASSERT(owningElement, "Owning element should be set");
 
   // Do not queue any event for disabled properties. This could happen
   // if the property has a default value which derives value from other
   // property, e.g. color.
   nsCSSProperty property = TransitionProperty();
   if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent) &&
@@ -256,17 +257,17 @@ 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();
+  CSSPseudoElementType pseudoType = newStyleContext->GetPseudoType();
   if (pseudoType != CSSPseudoElementType::NotPseudo) {
     if (pseudoType != CSSPseudoElementType::before &&
         pseudoType != CSSPseudoElementType::after) {
       return;
     }
 
     NS_ASSERTION((pseudoType == CSSPseudoElementType::before &&
                   aElement->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentbefore) ||
@@ -729,18 +730,17 @@ nsTransitionManager::ConsiderStartingTra
   }
 
   *aStartedAny = true;
   aWhichStarted->AddProperty(aProperty);
 }
 
 void
 nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
-                                               nsCSSPseudoElements::Type
-                                                 aPseudoType,
+                                               CSSPseudoElementType aPseudoType,
                                                nsStyleContext* aNewStyleContext)
 {
   AnimationCollection* collection =
     GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
   if (!collection) {
     return;
   }
 
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -11,38 +11,38 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EffectCompositor.h" // For EffectCompositor::CascadeLevel
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/Animation.h"
 #include "mozilla/dom/KeyframeEffect.h"
 #include "AnimationCommon.h"
 #include "nsCSSProps.h"
-#include "nsCSSPseudoElements.h"
 
 class nsIGlobalObject;
 class nsStyleContext;
 class nsPresContext;
 class nsCSSPropertySet;
 
 namespace mozilla {
+enum class CSSPseudoElementType : uint8_t;
 struct StyleTransition;
 } // namespace mozilla
 
 /*****************************************************************************
  * Per-Element data                                                          *
  *****************************************************************************/
 
 namespace mozilla {
 
 struct ElementPropertyTransition : public dom::KeyframeEffectReadOnly
 {
   ElementPropertyTransition(nsIDocument* aDocument,
                             dom::Element* aTarget,
-                            nsCSSPseudoElements::Type aPseudoType,
+                            CSSPseudoElementType aPseudoType,
                             const TimingParams &aTiming,
                             StyleAnimationValue aStartForReversingTest,
                             double aReversePortion)
     : dom::KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType, aTiming)
     , mStartForReversingTest(aStartForReversingTest)
     , mReversePortion(aReversePortion)
   { }
 
@@ -211,17 +211,17 @@ protected:
 
 struct TransitionEventInfo {
   RefPtr<dom::Element> mElement;
   RefPtr<dom::Animation> mAnimation;
   InternalTransitionEvent mEvent;
   TimeStamp mTimeStamp;
 
   TransitionEventInfo(dom::Element* aElement,
-                      nsCSSPseudoElements::Type aPseudoType,
+                      CSSPseudoElementType aPseudoType,
                       nsCSSProperty aProperty,
                       StickyTimeDuration aDuration,
                       const TimeStamp& aTimeStamp,
                       dom::Animation* aAnimation)
     : mElement(aElement)
     , mAnimation(aAnimation)
     , mEvent(true, eTransitionEnd)
     , mTimeStamp(aTimeStamp)
@@ -284,17 +284,17 @@ public:
    * When we're resolving style for an element that previously didn't have
    * style, we might have some old finished transitions for it, if,
    * say, it was display:none for a while, but previously displayed.
    *
    * This method removes any finished transitions that don't match the
    * new style.
    */
   void PruneCompletedTransitions(mozilla::dom::Element* aElement,
-                                 nsCSSPseudoElements::Type aPseudoType,
+                                 mozilla::CSSPseudoElementType aPseudoType,
                                  nsStyleContext* aNewStyleContext);
 
   void SetInAnimationOnlyStyleUpdate(bool aInAnimationOnlyUpdate) {
     mInAnimationOnlyStyleUpdate = aInAnimationOnlyUpdate;
   }
 
   bool InAnimationOnlyStyleUpdate() const {
     return mInAnimationOnlyStyleUpdate;