Bug 1482782 - Part 5: Move CSS anonymous box atoms to nsGkAtoms. r=njn,emilio
authorCameron McCormack <cam@mcc.id.au>
Wed, 15 Aug 2018 15:46:39 +1000
changeset 431603 73c353f1d88fd07830c9034ad67800f333149cee
parent 431602 6605ef249363dcf770e4d07d9753b2252690d1f2
child 431604 c4b64bd53e9266f0116a27d9a41488149455005d
push id106497
push usercmccormack@mozilla.com
push dateWed, 15 Aug 2018 07:46:59 +0000
treeherdermozilla-inbound@e6a44943b177 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn, emilio
bugs1482782
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482782 - Part 5: Move CSS anonymous box atoms to nsGkAtoms. r=njn,emilio Summary: Depends On D3283 Reviewers: njn!, emilio! Tags: #secure-revision Bug #: 1482782 Differential Revision: https://phabricator.services.mozilla.com/D3284
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsLayoutUtils.cpp
layout/build/nsLayoutStatics.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFieldSetFrame.h
layout/forms/nsHTMLButtonControlFrame.cpp
layout/generic/ReflowInput.cpp
layout/generic/RubyUtils.h
layout/generic/TextOverflow.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsIFrameInlines.h
layout/generic/nsImageFrame.cpp
layout/generic/nsInlineFrame.cpp
layout/generic/nsRubyContentFrame.cpp
layout/style/ComputedStyle.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
layout/style/nsCSSAnonBoxes.cpp
layout/style/nsCSSAnonBoxes.h
layout/tables/nsTableFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
servo/components/style/gecko/regen_atoms.py
xpcom/ds/Atom.py
xpcom/ds/StaticAtoms.py
xpcom/ds/nsGkAtoms.cpp
xpcom/ds/nsGkAtoms.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1984,17 +1984,17 @@ ExpectedOwnerForChild(const nsIFrame& aF
 
   parent = FirstContinuationOrPartOfIBSplit(parent);
 
   // We've handled already anon boxes and bullet frames, so now we're looking at
   // a frame of a DOM element or pseudo. Hop through anon and line-boxes
   // generated by our DOM parent, and go find the owner frame for it.
   while (parent && (IsAnonBox(*parent) || parent->IsLineFrame())) {
     auto* pseudo = parent->Style()->GetPseudo();
-    if (pseudo == nsCSSAnonBoxes::tableWrapper) {
+    if (pseudo == nsCSSAnonBoxes::tableWrapper()) {
       const nsIFrame* tableFrame = parent->PrincipalChildList().FirstChild();
       MOZ_ASSERT(tableFrame->IsTableFrame());
       // Handle :-moz-table and :-moz-inline-table.
       parent = IsAnonBox(*tableFrame) ? parent->GetParent() : tableFrame;
     } else {
       // We get the in-flow parent here so that we can handle the OOF anonymous
       // boxed to get the correct parent.
       parent = parent->GetInFlowParent();
@@ -2052,20 +2052,20 @@ ServoRestyleState::AddPendingWrapperRest
 {
   MOZ_ASSERT(aWrapperFrame->Style()->IsWrapperAnonBox(),
              "All our wrappers are anon boxes, and why would we restyle "
              "non-inheriting ones?");
   MOZ_ASSERT(aWrapperFrame->Style()->IsInheritingAnonBox(),
              "All our wrappers are anon boxes, and why would we restyle "
              "non-inheriting ones?");
   MOZ_ASSERT(aWrapperFrame->Style()->GetPseudo() !=
-             nsCSSAnonBoxes::cellContent,
+             nsCSSAnonBoxes::cellContent(),
              "Someone should be using TableAwareParentFor");
   MOZ_ASSERT(aWrapperFrame->Style()->GetPseudo() !=
-             nsCSSAnonBoxes::tableWrapper,
+             nsCSSAnonBoxes::tableWrapper(),
              "Someone should be using TableAwareParentFor");
   // Make sure we only add first continuations.
   aWrapperFrame = aWrapperFrame->FirstContinuation();
   nsIFrame* last = mPendingWrapperRestyles.SafeLastElement(nullptr);
   if (last == aWrapperFrame) {
     // Already queued up, nothing to do.
     return;
   }
@@ -2183,17 +2183,17 @@ ServoRestyleState::TableAwareParentFor(c
   // its table wrapper.
   if (aChild->IsTableFrame()) {
     aChild = aChild->GetParent();
     MOZ_ASSERT(aChild->IsTableWrapperFrame());
   }
 
   nsIFrame* parent = aChild->GetParent();
   // Now if parent is a cell-content frame, we actually want the cellframe.
-  if (parent->Style()->GetPseudo() == nsCSSAnonBoxes::cellContent) {
+  if (parent->Style()->GetPseudo() == nsCSSAnonBoxes::cellContent()) {
     parent = parent->GetParent();
   } else if (parent->IsTableWrapperFrame()) {
     // Must be a caption.  In that case we want the table here.
     MOZ_ASSERT(aChild->StyleDisplay()->mDisplay == StyleDisplay::TableCaption);
     parent = parent->PrincipalChildList().FirstChild();
   }
   return parent;
 }
@@ -2375,24 +2375,24 @@ public:
     return *mStyle;
   }
 
   void ComputeHintIfNeeded(nsIContent* aContent,
                            nsIFrame* aTextFrame,
                            ComputedStyle& aNewStyle)
   {
     MOZ_ASSERT(aTextFrame);
-    MOZ_ASSERT(aNewStyle.GetPseudo() == nsCSSAnonBoxes::mozText);
+    MOZ_ASSERT(aNewStyle.GetPseudo() == nsCSSAnonBoxes::mozText());
 
     if (MOZ_LIKELY(!mShouldPostHints)) {
       return;
     }
 
     ComputedStyle* oldStyle = aTextFrame->Style();
-    MOZ_ASSERT(oldStyle->GetPseudo() == nsCSSAnonBoxes::mozText);
+    MOZ_ASSERT(oldStyle->GetPseudo() == nsCSSAnonBoxes::mozText());
 
     // We rely on the fact that all the text children for the same element share
     // style to avoid recomputing style differences for all of them.
     //
     // TODO(emilio): The above may not be true for ::first-{line,letter}, but
     // we'll cross that bridge when we support those in stylo.
     if (mShouldComputeHints) {
       mShouldComputeHints = false;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -334,18 +334,18 @@ static int32_t FFWC_recursions=0;
 static int32_t FFWC_nextInFlows=0;
 #endif
 
 // Returns true if aFrame is an anonymous flex/grid item.
 static inline bool
 IsAnonymousFlexOrGridItem(const nsIFrame* aFrame)
 {
   const nsAtom* pseudoType = aFrame->Style()->GetPseudo();
-  return pseudoType == nsCSSAnonBoxes::anonymousFlexItem ||
-         pseudoType == nsCSSAnonBoxes::anonymousGridItem;
+  return pseudoType == nsCSSAnonBoxes::anonymousFlexItem() ||
+         pseudoType == nsCSSAnonBoxes::anonymousGridItem();
 }
 
 // Returns true if aFrame is a flex/grid container.
 static inline bool
 IsFlexOrGridContainer(const nsIFrame* aFrame)
 {
   const LayoutFrameType t = aFrame->Type();
   return t == LayoutFrameType::FlexContainer ||
@@ -365,17 +365,17 @@ IsFlexContainerForLegacyBox(const nsIFra
 static void
 AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
                                     const nsIFrame* aParent)
 {
   MOZ_ASSERT(IsAnonymousFlexOrGridItem(aChild),
              "expected an anonymous flex or grid item child frame");
   MOZ_ASSERT(aParent, "expected a parent frame");
   const nsAtom* pseudoType = aChild->Style()->GetPseudo();
-  if (pseudoType == nsCSSAnonBoxes::anonymousFlexItem) {
+  if (pseudoType == nsCSSAnonBoxes::anonymousFlexItem()) {
     MOZ_ASSERT(aParent->IsFlexContainerFrame(),
                "anonymous flex items should only exist as children "
                "of flex container frames");
   } else {
     MOZ_ASSERT(aParent->IsGridContainerFrame(),
                "anonymous grid items should only exist as children "
                "of grid container frames");
   }
@@ -613,17 +613,17 @@ GetIBContainingBlockFor(nsIFrame* aFrame
 }
 
 // This is a bit slow, but sometimes we need it.
 static bool
 ParentIsWrapperAnonBox(nsIFrame* aParent)
 {
   nsIFrame* maybeAnonBox = aParent;
   if (maybeAnonBox->Style()->GetPseudo() ==
-        nsCSSAnonBoxes::cellContent) {
+        nsCSSAnonBoxes::cellContent()) {
     // The thing that would maybe be a wrapper anon box is the cell.
     maybeAnonBox = maybeAnonBox->GetParent();
   }
   return maybeAnonBox->Style()->IsWrapperAnonBox();
 }
 
 //----------------------------------------------------------------------
 
@@ -1940,30 +1940,30 @@ nsCSSFrameConstructor::CreateGeneratedCo
 // frame. In particular, a lone table caption will have a table wrapper as its
 // parent, but will also trigger construction of an empty inner table, which
 // will be the one we can examine to see whether the wrapper was a pseudo-frame.
 static bool
 IsTablePseudo(nsIFrame* aFrame)
 {
   nsAtom* pseudoType = aFrame->Style()->GetPseudo();
   return pseudoType &&
-    (pseudoType == nsCSSAnonBoxes::table ||
-     pseudoType == nsCSSAnonBoxes::inlineTable ||
-     pseudoType == nsCSSAnonBoxes::tableColGroup ||
-     pseudoType == nsCSSAnonBoxes::tableRowGroup ||
-     pseudoType == nsCSSAnonBoxes::tableRow ||
-     pseudoType == nsCSSAnonBoxes::tableCell ||
-     (pseudoType == nsCSSAnonBoxes::cellContent &&
+    (pseudoType == nsCSSAnonBoxes::table() ||
+     pseudoType == nsCSSAnonBoxes::inlineTable() ||
+     pseudoType == nsCSSAnonBoxes::tableColGroup() ||
+     pseudoType == nsCSSAnonBoxes::tableRowGroup() ||
+     pseudoType == nsCSSAnonBoxes::tableRow() ||
+     pseudoType == nsCSSAnonBoxes::tableCell() ||
+     (pseudoType == nsCSSAnonBoxes::cellContent() &&
       aFrame->GetParent()->Style()->GetPseudo() ==
-        nsCSSAnonBoxes::tableCell) ||
-     (pseudoType == nsCSSAnonBoxes::tableWrapper &&
+        nsCSSAnonBoxes::tableCell()) ||
+     (pseudoType == nsCSSAnonBoxes::tableWrapper() &&
       (aFrame->PrincipalChildList().FirstChild()->Style()->GetPseudo() ==
-         nsCSSAnonBoxes::table ||
+         nsCSSAnonBoxes::table() ||
        aFrame->PrincipalChildList().FirstChild()->Style()->GetPseudo() ==
-         nsCSSAnonBoxes::inlineTable)));
+         nsCSSAnonBoxes::inlineTable())));
 }
 
 static bool
 IsRubyPseudo(nsIFrame* aFrame)
 {
   return RubyUtils::IsRubyPseudo(aFrame->Style()->GetPseudo());
 }
 
@@ -2081,17 +2081,17 @@ nsCSSFrameConstructor::ConstructTable(ns
 
   nsIContent* const content = aItem.mContent;
   ComputedStyle* const computedStyle = aItem.mComputedStyle;
   const bool isMathMLContent = content->IsMathMLElement();
 
   // create the pseudo SC for the table wrapper as a child of the inner SC
   RefPtr<ComputedStyle> outerComputedStyle;
   outerComputedStyle = mPresShell->StyleSet()->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper(),
                                        computedStyle);
 
   // Create the table wrapper frame which holds the caption and inner table frame
   nsContainerFrame* newFrame;
   if (isMathMLContent)
     newFrame = NS_NewMathMLmtableOuterFrame(mPresShell, outerComputedStyle);
   else
     newFrame = NS_NewTableWrapperFrame(mPresShell, outerComputedStyle);
@@ -2295,17 +2295,17 @@ nsCSSFrameConstructor::ConstructTableCel
 
   // Initialize the table cell frame
   InitAndRestoreFrame(aState, content, aParentFrame, newFrame);
   newFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
 
   // Resolve pseudo style and initialize the body cell frame
   RefPtr<ComputedStyle> innerPseudoStyle;
   innerPseudoStyle = mPresShell->StyleSet()->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::cellContent,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::cellContent(),
                                        computedStyle);
 
   // Create a block frame that will format the cell's content
   bool isBlock;
   nsContainerFrame* cellInnerFrame;
   if (isMathMLContent) {
     cellInnerFrame = NS_NewMathMLmtdInnerFrame(mPresShell, innerPseudoStyle);
     isBlock = false;
@@ -2400,17 +2400,17 @@ nsCSSFrameConstructor::ConstructDocEleme
              "Shouldn't have a doc element containing block here");
 
   // Resolve a new style for the viewport since it may be affected by a new root
   // element style (e.g. a propagated 'direction').
   //
   // @see ComputedStyle::ApplyStyleFixups
   {
     RefPtr<ComputedStyle> sc = mPresShell->StyleSet()->
-      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport, nullptr);
+      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport(), nullptr);
     GetRootFrame()->SetComputedStyleWithoutNotification(sc);
   }
 
   // Make sure to call UpdateViewportScrollStylesOverride before
   // SetUpDocElementContainingBlock, since it sets up our scrollbar state
   // properly.
   DebugOnly<nsIContent*> propagatedScrollFrom;
   if (nsPresContext* presContext = mPresShell->GetPresContext()) {
@@ -2678,17 +2678,17 @@ nsCSSFrameConstructor::ConstructRootFram
   AUTO_PROFILER_LABEL("nsCSSFrameConstructor::ConstructRootFrame", LAYOUT);
   AUTO_PROFILER_TRACING("Frame Construction", "ConstructRootFrame");
   AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
 
   ServoStyleSet* styleSet = mPresShell->StyleSet();
 
   // --------- BUILD VIEWPORT -----------
   RefPtr<ComputedStyle> viewportPseudoStyle =
-    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport,
+    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport(),
                                                  nullptr);
   ViewportFrame* viewportFrame =
     NS_NewViewportFrame(mPresShell, viewportPseudoStyle);
 
   // XXXbz do we _have_ to pass a null content pointer to that frame?
   // Would it really kill us to pass in the root element or something?
   // What would that break?
   viewportFrame->Init(nullptr, nullptr, nullptr);
@@ -2798,23 +2798,23 @@ nsCSSFrameConstructor::SetUpDocElementCo
     } else
 #endif
     {
       // pass a temporary stylecontext, the correct one will be set later
       rootFrame = NS_NewCanvasFrame(mPresShell, viewportPseudoStyle);
       mHasRootAbsPosContainingBlock = true;
     }
 
-    rootPseudo = nsCSSAnonBoxes::canvas;
+    rootPseudo = nsCSSAnonBoxes::canvas();
     mDocElementContainingBlock = rootFrame;
   } else {
     // Create a page sequence frame
     rootFrame = NS_NewSimplePageSequenceFrame(mPresShell, viewportPseudoStyle);
     mPageSequenceFrame = rootFrame;
-    rootPseudo = nsCSSAnonBoxes::pageSequence;
+    rootPseudo = nsCSSAnonBoxes::pageSequence();
     rootFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
   }
 
 
   // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
 
   // If the device supports scrolling (e.g., in galley mode on the screen and
   // for print-preview, but not when printing), then create a scroll frame that
@@ -2848,32 +2848,32 @@ nsCSSFrameConstructor::SetUpDocElementCo
 
   ServoStyleSet* styleSet = mPresShell->StyleSet();
   // If paginated, make sure we don't put scrollbars in
   if (!isScrollable) {
     rootPseudoStyle =
       styleSet->ResolveInheritingAnonymousBoxStyle(rootPseudo,
                                                    viewportPseudoStyle);
   } else {
-      if (rootPseudo == nsCSSAnonBoxes::canvas) {
-        rootPseudo = nsCSSAnonBoxes::scrolledCanvas;
+      if (rootPseudo == nsCSSAnonBoxes::canvas()) {
+        rootPseudo = nsCSSAnonBoxes::scrolledCanvas();
       } else {
-        NS_ASSERTION(rootPseudo == nsCSSAnonBoxes::pageSequence,
+        NS_ASSERTION(rootPseudo == nsCSSAnonBoxes::pageSequence(),
                      "Unknown root pseudo");
-        rootPseudo = nsCSSAnonBoxes::scrolledPageSequence;
+        rootPseudo = nsCSSAnonBoxes::scrolledPageSequence();
       }
 
       // Build the frame. We give it the content we are wrapping which is the
       // document element, the root frame, the parent view port frame, and we
       // should get back the new frame and the scrollable view if one was
       // created.
 
       // resolve a context for the scrollframe
       RefPtr<ComputedStyle>  computedStyle =
-        styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewportScroll,
+        styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewportScroll(),
                                                      viewportPseudoStyle);
 
       // Note that the viewport scrollframe is always built with
       // overflow:auto style. This forces the scroll frame to create
       // anonymous content for both scrollbars. This is necessary even
       // if the HTML or BODY elements are overriding the viewport
       // scroll style to 'hidden' --- dynamic style changes might put
       // scrollbars back on the viewport and we don't want to have to
@@ -2949,28 +2949,28 @@ nsCSSFrameConstructor::ConstructPageFram
                                           nsIFrame*      aPrevPageFrame,
                                           nsContainerFrame*& aCanvasFrame)
 {
   ComputedStyle* parentComputedStyle = aParentFrame->Style();
   ServoStyleSet* styleSet = aPresShell->StyleSet();
 
   RefPtr<ComputedStyle> pagePseudoStyle;
   pagePseudoStyle =
-    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::page,
+    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::page(),
                                                  parentComputedStyle);
 
   nsContainerFrame* pageFrame = NS_NewPageFrame(aPresShell, pagePseudoStyle);
 
   // Initialize the page frame and force it to have a view. This makes printing of
   // the pages easier and faster.
   pageFrame->Init(nullptr, aParentFrame, aPrevPageFrame);
 
   RefPtr<ComputedStyle> pageContentPseudoStyle;
   pageContentPseudoStyle =
-    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::pageContent,
+    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::pageContent(),
                                                  pagePseudoStyle);
 
   nsContainerFrame* pageContentFrame =
     NS_NewPageContentFrame(aPresShell, pageContentPseudoStyle);
 
   // Initialize the page content frame and force it to have a view. Also make it the
   // containing block for fixed elements which are repeated on every page.
   nsIFrame* prevPageContentFrame = nullptr;
@@ -2984,17 +2984,17 @@ nsCSSFrameConstructor::ConstructPageFram
   }
   SetInitialSingleChild(pageFrame, pageContentFrame);
   // Make it an absolute container for fixed-pos elements
   pageContentFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
   pageContentFrame->MarkAsAbsoluteContainingBlock();
 
   RefPtr<ComputedStyle> canvasPseudoStyle;
   canvasPseudoStyle =
-    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::canvas,
+    styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::canvas(),
                                                  pageContentPseudoStyle);
 
   aCanvasFrame = NS_NewCanvasFrame(aPresShell, canvasPseudoStyle);
 
   nsIFrame* prevCanvasFrame = nullptr;
   if (prevPageContentFrame) {
     prevCanvasFrame = prevPageContentFrame->PrincipalChildList().FirstChild();
     NS_ASSERTION(prevCanvasFrame, "missing canvas frame");
@@ -3084,17 +3084,17 @@ nsCSSFrameConstructor::ConstructSelectFr
 
     comboboxFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
 
     aState.AddChild(comboboxFrame, aFrameItems, content, aParentFrame);
 
     // Resolve pseudo element style for the dropdown list
     RefPtr<ComputedStyle> listStyle;
     listStyle = mPresShell->StyleSet()->
-      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::dropDownList,
+      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::dropDownList(),
                                          computedStyle);
 
     // Create a listbox
     nsContainerFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle);
 
     // Notify the listbox that it is being used as a dropdown list.
     nsIListControlFrame * listControlFrame = do_QueryFrame(listFrame);
     if (listControlFrame) {
@@ -3258,26 +3258,26 @@ nsCSSFrameConstructor::ConstructFieldSet
                       aState.GetGeometricParent(*aStyleDisplay, aParentFrame),
                       fieldsetFrame);
 
   fieldsetFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
 
   // Resolve style and initialize the frame
   RefPtr<ComputedStyle> fieldsetContentStyle;
   fieldsetContentStyle = mPresShell->StyleSet()->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::fieldsetContent,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::fieldsetContent(),
                                        computedStyle);
 
   const nsStyleDisplay* fieldsetContentDisplay = fieldsetContentStyle->StyleDisplay();
   bool isScrollable = fieldsetContentDisplay->IsScrollableOverflow();
   nsContainerFrame* scrollFrame = nullptr;
   if (isScrollable) {
     fieldsetContentStyle =
       BeginBuildingScrollFrame(aState, content, fieldsetContentStyle,
-                               fieldsetFrame, nsCSSAnonBoxes::scrolledContent,
+                               fieldsetFrame, nsCSSAnonBoxes::scrolledContent(),
                                false, scrollFrame);
   }
 
   nsContainerFrame* absPosContainer = nullptr;
   if (fieldsetFrame->IsAbsPosContainingBlock()) {
     absPosContainer = fieldsetFrame;
   }
 
@@ -3533,36 +3533,36 @@ nsCSSFrameConstructor::FindDataByTag(nsA
   { &nsGkAtoms::_tag, FCDATA_DECL(FCDATA_FUNC_IS_DATA_GETTER,  _func) }
 #define COMPLEX_TAG_CREATE(_tag, _func)             \
   { &nsGkAtoms::_tag, FULL_CTOR_FCDATA(0, _func) }
 
 static bool
 IsFrameForFieldSet(nsIFrame* aFrame)
 {
   nsAtom* pseudo = aFrame->Style()->GetPseudo();
-  if (pseudo == nsCSSAnonBoxes::fieldsetContent ||
-      pseudo == nsCSSAnonBoxes::scrolledContent ||
-      pseudo == nsCSSAnonBoxes::columnContent) {
+  if (pseudo == nsCSSAnonBoxes::fieldsetContent() ||
+      pseudo == nsCSSAnonBoxes::scrolledContent() ||
+      pseudo == nsCSSAnonBoxes::columnContent()) {
     return IsFrameForFieldSet(aFrame->GetParent());
   }
   return aFrame->IsFieldSetFrame();
 }
 
 /* static */
 const nsCSSFrameConstructor::FrameConstructionData*
 nsCSSFrameConstructor::FindHTMLData(const Element& aElement,
                                     nsIFrame* aParentFrame,
                                     ComputedStyle& aStyle)
 {
   MOZ_ASSERT(aElement.IsHTMLElement());
 
   nsAtom* tag = aElement.NodeInfo()->NameAtom();
   NS_ASSERTION(!aParentFrame ||
                aParentFrame->Style()->GetPseudo() !=
-                 nsCSSAnonBoxes::fieldsetContent ||
+                 nsCSSAnonBoxes::fieldsetContent() ||
                aParentFrame->GetParent()->IsFieldSetFrame(),
                "Unexpected parent for fieldset content anon box");
   if (tag == nsGkAtoms::legend &&
       (!aParentFrame || !IsFrameForFieldSet(aParentFrame) ||
        aStyle.StyleDisplay()->IsFloatingStyle() ||
        aStyle.StyleDisplay()->IsAbsolutelyPositionedStyle())) {
     // <legend> is only special inside fieldset, we only check the frame tree
     // parent because the content tree parent may not be a <fieldset> due to
@@ -3591,17 +3591,17 @@ nsCSSFrameConstructor::FindHTMLData(cons
       FCDATA_DECL(FCDATA_ALLOW_BLOCK_STYLES | FCDATA_MAY_NEED_SCROLLFRAME,
                   NS_NewLegendFrame) },
     SIMPLE_TAG_CREATE(frameset, NS_NewHTMLFramesetFrame),
     SIMPLE_TAG_CREATE(iframe, NS_NewSubDocumentFrame),
     { &nsGkAtoms::button,
       FCDATA_WITH_WRAPPING_BLOCK(FCDATA_ALLOW_BLOCK_STYLES |
                                  FCDATA_ALLOW_GRID_FLEX_COLUMNSET,
                                  NS_NewHTMLButtonControlFrame,
-                                 nsCSSAnonBoxes::buttonContent) },
+                                 nsCSSAnonBoxes::buttonContent()) },
     SIMPLE_TAG_CHAIN(canvas, nsCSSFrameConstructor::FindCanvasData),
     SIMPLE_TAG_CREATE(video, NS_NewHTMLVideoFrame),
     SIMPLE_TAG_CREATE(audio, NS_NewHTMLVideoFrame),
     SIMPLE_TAG_CREATE(progress, NS_NewProgressFrame),
     SIMPLE_TAG_CREATE(meter, NS_NewMeterFrame),
     COMPLEX_TAG_CREATE(details, &nsCSSFrameConstructor::ConstructDetailsFrame)
   };
 
@@ -3664,36 +3664,36 @@ nsCSSFrameConstructor::FindInputData(con
     SIMPLE_INT_CREATE(NS_FORM_INPUT_SEARCH, NS_NewTextControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_TEXT, NS_NewTextControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_TEL, NS_NewTextControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_URL, NS_NewTextControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_RANGE, NS_NewRangeFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_PASSWORD, NS_NewTextControlFrame),
     { NS_FORM_INPUT_COLOR,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewColorControlFrame,
-                                 nsCSSAnonBoxes::buttonContent) },
+                                 nsCSSAnonBoxes::buttonContent()) },
     // TODO: this is temporary until a frame is written: bug 635240.
     SIMPLE_INT_CREATE(NS_FORM_INPUT_NUMBER, NS_NewNumberControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_TIME, NS_NewDateTimeControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewDateTimeControlFrame),
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_MONTH, NS_NewTextControlFrame),
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_WEEK, NS_NewTextControlFrame),
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_DATETIME_LOCAL, NS_NewTextControlFrame),
     { NS_FORM_INPUT_SUBMIT,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewGfxButtonControlFrame,
-                                 nsCSSAnonBoxes::buttonContent) },
+                                 nsCSSAnonBoxes::buttonContent()) },
     { NS_FORM_INPUT_RESET,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewGfxButtonControlFrame,
-                                 nsCSSAnonBoxes::buttonContent) },
+                                 nsCSSAnonBoxes::buttonContent()) },
     { NS_FORM_INPUT_BUTTON,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewGfxButtonControlFrame,
-                                 nsCSSAnonBoxes::buttonContent) }
+                                 nsCSSAnonBoxes::buttonContent()) }
     // Keeping hidden inputs out of here on purpose for so they get frames by
     // display (in practice, none).
   };
 
 
   auto controlType = HTMLInputElement::FromNode(aElement)->ControlType();
 
   // radio and checkbox inputs with appearance:none should be constructed
@@ -3765,17 +3765,17 @@ nsCSSFrameConstructor::FindCanvasData(co
     doc = doc->GetOriginalDocument();
   }
   if (!doc->IsScriptEnabled()) {
     return nullptr;
   }
 
   static const FrameConstructionData sCanvasData =
     FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewHTMLCanvasFrame,
-                               nsCSSAnonBoxes::htmlCanvasContent);
+                               nsCSSAnonBoxes::htmlCanvasContent());
   return &sCanvasData;
 }
 
 void
 nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aItem,
                                                       nsFrameConstructorState& aState,
                                                       nsContainerFrame* aParentFrame,
                                                       nsFrameItems& aFrameItems)
@@ -4481,17 +4481,17 @@ nsCSSFrameConstructor::BuildScrollFrame(
                                         nsIContent*              aContent,
                                         ComputedStyle*           aContentStyle,
                                         nsIFrame*                aScrolledFrame,
                                         nsContainerFrame*        aParentFrame,
                                         nsContainerFrame*&       aNewFrame)
 {
   RefPtr<ComputedStyle> scrolledContentStyle =
     BeginBuildingScrollFrame(aState, aContent, aContentStyle, aParentFrame,
-                             nsCSSAnonBoxes::scrolledContent,
+                             nsCSSAnonBoxes::scrolledContent(),
                              false, aNewFrame);
 
   aScrolledFrame->SetComputedStyleWithoutNotification(scrolledContentStyle);
   InitAndRestoreFrame(aState, aContent, aNewFrame, aScrolledFrame);
 
   FinishBuildingScrollFrame(aNewFrame, aScrolledFrame);
 }
 
@@ -4726,17 +4726,17 @@ nsCSSFrameConstructor::ConstructScrollab
 {
   nsIContent* const content = aItem.mContent;
   ComputedStyle* const computedStyle = aItem.mComputedStyle;
 
   nsContainerFrame* newFrame = nullptr;
   RefPtr<ComputedStyle> scrolledContentStyle
     = BeginBuildingScrollFrame(aState, content, computedStyle,
                                aState.GetGeometricParent(*aDisplay, aParentFrame),
-                               nsCSSAnonBoxes::scrolledContent,
+                               nsCSSAnonBoxes::scrolledContent(),
                                false, newFrame);
 
   // Create our block frame
   // pass a temporary stylecontext, the correct one will be set later
   nsContainerFrame* scrolledFrame = aConstructor(mPresShell, computedStyle);
 
   // Make sure to AddChild before we call ConstructBlock so that we
   // end up before our descendants in fixed-pos lists as needed.
@@ -4871,17 +4871,17 @@ nsCSSFrameConstructor::FlushAccumulatedB
                                              nsFrameItems& aBlockItems,
                                              nsFrameItems& aNewItems)
 {
   if (aBlockItems.IsEmpty()) {
     // Nothing to do
     return;
   }
 
-  nsAtom* anonPseudo = nsCSSAnonBoxes::mozMathMLAnonymousBlock;
+  nsAtom* anonPseudo = nsCSSAnonBoxes::mozMathMLAnonymousBlock();
 
   ComputedStyle* parentContext =
     nsFrame::CorrectStyleParentFrame(aParentFrame,
                                      anonPseudo)->Style();
   ServoStyleSet* styleSet = mPresShell->StyleSet();
   RefPtr<ComputedStyle> blockContext;
   blockContext = styleSet->
     ResolveInheritingAnonymousBoxStyle(anonPseudo, parentContext);
@@ -5053,30 +5053,30 @@ nsCSSFrameConstructor::ConstructOuterSVG
                                          FrameConstructionItem&   aItem,
                                          nsContainerFrame*        aParentFrame,
                                          const nsStyleDisplay*    aDisplay,
                                          nsFrameItems&            aFrameItems)
 {
   return ConstructFrameWithAnonymousChild(
       aState, aItem, aParentFrame, aFrameItems,
       NS_NewSVGOuterSVGFrame, NS_NewSVGOuterSVGAnonChildFrame,
-      nsCSSAnonBoxes::mozSVGOuterSVGAnonChild, true);
+      nsCSSAnonBoxes::mozSVGOuterSVGAnonChild(), true);
 }
 
 nsIFrame*
 nsCSSFrameConstructor::ConstructMarker(nsFrameConstructorState& aState,
                                        FrameConstructionItem&   aItem,
                                        nsContainerFrame*        aParentFrame,
                                        const nsStyleDisplay*    aDisplay,
                                        nsFrameItems&            aFrameItems)
 {
   return ConstructFrameWithAnonymousChild(
       aState, aItem, aParentFrame, aFrameItems,
       NS_NewSVGMarkerFrame, NS_NewSVGMarkerAnonChildFrame,
-      nsCSSAnonBoxes::mozSVGMarkerAnonChild, false);
+      nsCSSAnonBoxes::mozSVGMarkerAnonChild(), false);
 }
 
 // Only outer <svg> elements can be floated or positioned.  All other SVG
 // should be in-flow.
 #define SIMPLE_SVG_FCDATA(_func)                                        \
   FCDATA_DECL(FCDATA_DISALLOW_OUT_OF_FLOW |                             \
               FCDATA_SKIP_ABSPOS_PUSH |                                 \
               FCDATA_DISALLOW_GENERATED_CONTENT,  _func)
@@ -5264,21 +5264,21 @@ nsCSSFrameConstructor::FindSVGData(const
     SIMPLE_SVG_CREATE(rect, NS_NewSVGGeometryFrame),
     SIMPLE_SVG_CREATE(path, NS_NewSVGGeometryFrame),
     SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame),
     SIMPLE_SVG_CREATE(generic_, NS_NewSVGGenericContainerFrame),
     { &nsGkAtoms::text,
       FCDATA_WITH_WRAPPING_BLOCK(FCDATA_DISALLOW_OUT_OF_FLOW |
                                  FCDATA_ALLOW_BLOCK_STYLES,
                                  NS_NewSVGTextFrame,
-                                 nsCSSAnonBoxes::mozSVGText) },
+                                 nsCSSAnonBoxes::mozSVGText()) },
     { &nsGkAtoms::foreignObject,
       FCDATA_WITH_WRAPPING_BLOCK(FCDATA_DISALLOW_OUT_OF_FLOW,
                                  NS_NewSVGForeignObjectFrame,
-                                 nsCSSAnonBoxes::mozSVGForeignContent) },
+                                 nsCSSAnonBoxes::mozSVGForeignContent()) },
     SIMPLE_SVG_CREATE(a, NS_NewSVGAFrame),
     SIMPLE_SVG_CREATE(linearGradient, NS_NewSVGLinearGradientFrame),
     SIMPLE_SVG_CREATE(radialGradient, NS_NewSVGRadialGradientFrame),
     SIMPLE_SVG_CREATE(stop, NS_NewSVGStopFrame),
     SIMPLE_SVG_CREATE(use, NS_NewSVGUseFrame),
     SIMPLE_SVG_CREATE(view, NS_NewSVGViewFrame),
     SIMPLE_SVG_CREATE(image, NS_NewSVGImageFrame),
     SIMPLE_SVG_CREATE(clipPath, NS_NewSVGClipPathFrame),
@@ -5323,17 +5323,17 @@ nsCSSFrameConstructor::FindSVGData(const
 }
 
 void
 nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
                                         FrameConstructionItemList& aItems)
 {
   RefPtr<ComputedStyle> pseudoStyle =
     mPresShell->StyleSet()->
-      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::pageBreak);
+      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::pageBreak());
 
   MOZ_ASSERT(pseudoStyle->StyleDisplay()->mDisplay == StyleDisplay::Block,
              "Unexpected display");
 
   static const FrameConstructionData sPageBreakData =
     FCDATA_DECL(FCDATA_SKIP_FRAMESET, NS_NewPageBreakFrame);
 
   aItems.AppendItem(this, &sPageBreakData, aContent, nullptr,
@@ -9166,92 +9166,92 @@ nsCSSFrameConstructor::ShouldHaveSpecial
 const nsCSSFrameConstructor::PseudoParentData
 nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
   { // Cell
     FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                      FCDATA_USE_CHILD_ITEMS |
                      FCDATA_IS_WRAPPER_ANON_BOX |
                      FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow),
                      &nsCSSFrameConstructor::ConstructTableCell),
-    &nsCSSAnonBoxes::tableCell
+    &nsCSSAnonBoxes::tableCell()
   },
   { // Row
     FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                      FCDATA_USE_CHILD_ITEMS |
                      FCDATA_IS_WRAPPER_ANON_BOX |
                      FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup),
                      &nsCSSFrameConstructor::ConstructTableRowOrRowGroup),
-    &nsCSSAnonBoxes::tableRow
+    &nsCSSAnonBoxes::tableRow()
   },
   { // Row group
     FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                      FCDATA_USE_CHILD_ITEMS |
                      FCDATA_IS_WRAPPER_ANON_BOX |
                      FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
                      &nsCSSFrameConstructor::ConstructTableRowOrRowGroup),
-    &nsCSSAnonBoxes::tableRowGroup
+    &nsCSSAnonBoxes::tableRowGroup()
   },
   { // Column group
     FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
                 FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS |
                 FCDATA_SKIP_ABSPOS_PUSH |
                 // Not FCDATA_IS_WRAPPER_ANON_BOX, because we don't need to
                 // restyle these: they have non-inheriting styles.
                 FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
                 NS_NewTableColGroupFrame),
-    &nsCSSAnonBoxes::tableColGroup
+    &nsCSSAnonBoxes::tableColGroup()
   },
   { // Table
     FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS |
                      FCDATA_IS_WRAPPER_ANON_BOX,
                      &nsCSSFrameConstructor::ConstructTable),
-    &nsCSSAnonBoxes::table
+    &nsCSSAnonBoxes::table()
   },
   { // Ruby
     FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT |
                 FCDATA_USE_CHILD_ITEMS |
                 FCDATA_IS_WRAPPER_ANON_BOX |
                 FCDATA_SKIP_FRAMESET,
                 NS_NewRubyFrame),
-    &nsCSSAnonBoxes::ruby
+    &nsCSSAnonBoxes::ruby()
   },
   { // Ruby Base
     FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
                 FCDATA_IS_LINE_PARTICIPANT |
                 FCDATA_IS_WRAPPER_ANON_BOX |
                 FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyBaseContainer) |
                 FCDATA_SKIP_FRAMESET,
                 NS_NewRubyBaseFrame),
-    &nsCSSAnonBoxes::rubyBase
+    &nsCSSAnonBoxes::rubyBase()
   },
   { // Ruby Base Container
     FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
                 FCDATA_IS_LINE_PARTICIPANT |
                 FCDATA_IS_WRAPPER_ANON_BOX |
                 FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) |
                 FCDATA_SKIP_FRAMESET,
                 NS_NewRubyBaseContainerFrame),
-    &nsCSSAnonBoxes::rubyBaseContainer
+    &nsCSSAnonBoxes::rubyBaseContainer()
   },
   { // Ruby Text
     FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
                 FCDATA_IS_LINE_PARTICIPANT |
                 FCDATA_IS_WRAPPER_ANON_BOX |
                 FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyTextContainer) |
                 FCDATA_SKIP_FRAMESET,
                 NS_NewRubyTextFrame),
-    &nsCSSAnonBoxes::rubyText
+    &nsCSSAnonBoxes::rubyText()
   },
   { // Ruby Text Container
     FCDATA_DECL(FCDATA_USE_CHILD_ITEMS |
                 FCDATA_IS_WRAPPER_ANON_BOX |
                 FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) |
                 FCDATA_SKIP_FRAMESET,
                 NS_NewRubyTextContainerFrame),
-    &nsCSSAnonBoxes::rubyTextContainer
+    &nsCSSAnonBoxes::rubyTextContainer()
   }
 };
 
 void
 nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
   nsFrameConstructorState& aState,
   FrameConstructionItemList& aItems,
   nsIFrame* aParentFrame)
@@ -9314,18 +9314,18 @@ nsCSSFrameConstructor::CreateNeededAnonF
     endIter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isLegacyBox);
 
     NS_ASSERTION(iter != endIter,
                  "Should've had at least one wrappable child to seek past");
 
     // Now, we create the anonymous flex or grid item to contain the children
     // between |iter| and |endIter|.
     nsAtom* pseudoType = (aParentFrame->IsFlexContainerFrame())
-                            ? nsCSSAnonBoxes::anonymousFlexItem
-                            : nsCSSAnonBoxes::anonymousGridItem;
+                            ? nsCSSAnonBoxes::anonymousFlexItem()
+                            : nsCSSAnonBoxes::anonymousGridItem();
     ComputedStyle* parentStyle = aParentFrame->Style();
     nsIContent* parentContent = aParentFrame->GetContent();
     already_AddRefed<ComputedStyle> wrapperStyle =
       mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(pseudoType,
                                                                  parentStyle);
 
     static const FrameConstructionData sBlockFormattingContextFCData =
       FCDATA_DECL(FCDATA_SKIP_FRAMESET |
@@ -9813,21 +9813,21 @@ nsCSSFrameConstructor::WrapItemsInPseudo
                                                ParentType aWrapperType,
                                                FCItemIterator& aIter,
                                                const FCItemIterator& aEndIter)
 {
   const PseudoParentData& pseudoData = sPseudoParentData[aWrapperType];
   nsAtom* pseudoType = *pseudoData.mPseudoType;
   StyleDisplay parentDisplay = aParentStyle->StyleDisplay()->mDisplay;
 
-  if (pseudoType == nsCSSAnonBoxes::table &&
+  if (pseudoType == nsCSSAnonBoxes::table() &&
       (parentDisplay == StyleDisplay::Inline ||
        parentDisplay == StyleDisplay::RubyBase ||
        parentDisplay == StyleDisplay::RubyText)) {
-    pseudoType = nsCSSAnonBoxes::inlineTable;
+    pseudoType = nsCSSAnonBoxes::inlineTable();
   }
 
   already_AddRefed<ComputedStyle> wrapperStyle;
   if (pseudoData.mFCData.mBits & FCDATA_IS_WRAPPER_ANON_BOX) {
     wrapperStyle =
       mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(pseudoType,
                                                                  aParentStyle);
   } else {
@@ -10209,17 +10209,17 @@ nsCSSFrameConstructor::ProcessChildren(n
                                       NS_LITERAL_CSTRING("Layout: FrameConstructor"),
                                       mDocument,
                                       nsContentUtils::eXUL_PROPERTIES,
                                       message,
                                       params, ArrayLength(params));
     }
 
     RefPtr<ComputedStyle> blockSC = mPresShell->StyleSet()->
-      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock,
+      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock(),
                                          frameComputedStyle);
     nsBlockFrame* blockFrame = NS_NewBlockFrame(mPresShell, blockSC);
     // We might, in theory, want to set NS_BLOCK_FLOAT_MGR and
     // NS_BLOCK_MARGIN_ROOT, but I think it's a bad idea given that
     // a real block placed here wouldn't get those set on it.
 
     InitAndRestoreFrame(aState, aContent, aFrame, blockFrame, false);
 
@@ -10978,17 +10978,17 @@ nsCSSFrameConstructor::InitAndWrapInColu
   // Wrap the block frame in a ColumnSetFrame.
   nsContainerFrame* columnSetFrame =
     NS_NewColumnSetFrame(mPresShell, aComputedStyle,
                          nsFrameState(NS_FRAME_OWNS_ANON_BOXES));
   InitAndRestoreFrame(aState, aContent, aParentFrame, columnSetFrame);
   SetInitialSingleChild(columnSetFrame, aBlockFrame);
 
   RefPtr<ComputedStyle> anonBlockStyle = mPresShell->StyleSet()->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::columnContent,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::columnContent(),
                                        aComputedStyle);
   aBlockFrame->SetComputedStyleWithoutNotification(anonBlockStyle);
   InitAndRestoreFrame(aState, aContent, columnSetFrame, aBlockFrame);
 
   return columnSetFrame;
 }
 
 void
@@ -11190,17 +11190,17 @@ nsCSSFrameConstructor::CreateIBSiblings(
   //
   // The distinction in styles is needed because of CSS 2.1, section
   // 9.2.1.1, which says:
   //
   //   When such an inline box is affected by relative positioning, any
   //   resulting translation also affects the block-level box contained
   //   in the inline box.
   RefPtr<ComputedStyle> blockSC = mPresShell->StyleSet()->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozBlockInsideInlineWrapper(),
                                        computedStyle);
 
   nsContainerFrame* lastNewInline =
     static_cast<nsContainerFrame*>(aInitialInline->FirstContinuation());
   do {
     // On entry to this loop aChildItems is not empty and the first frame in it
     // is block-level.
     MOZ_ASSERT(aChildItems.NotEmpty(), "Should have child items");
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4035,27 +4035,27 @@ nsLayoutUtils::BinarySearchForPosition(D
 }
 
 void
 nsLayoutUtils::AddBoxesForFrame(nsIFrame* aFrame,
                                 nsLayoutUtils::BoxCallback* aCallback)
 {
   nsAtom* pseudoType = aFrame->Style()->GetPseudo();
 
-  if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
+  if (pseudoType == nsCSSAnonBoxes::tableWrapper()) {
     AddBoxesForFrame(aFrame->PrincipalChildList().FirstChild(), aCallback);
     if (aCallback->mIncludeCaptionBoxForTable) {
       nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
       if (kid) {
         AddBoxesForFrame(kid, aCallback);
       }
     }
-  } else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
-             pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
-             pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
+  } else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper() ||
+             pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock() ||
+             pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock()) {
     for (nsIFrame* kid : aFrame->PrincipalChildList()) {
       AddBoxesForFrame(kid, aCallback);
     }
   } else {
     aCallback->AddBox(aFrame);
   }
 }
 
@@ -4069,31 +4069,31 @@ nsLayoutUtils::GetAllInFlowBoxes(nsIFram
 }
 
 nsIFrame*
 nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame)
 {
   while (aFrame) {
     nsAtom* pseudoType = aFrame->Style()->GetPseudo();
 
-    if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
+    if (pseudoType == nsCSSAnonBoxes::tableWrapper()) {
       nsIFrame* f = GetFirstNonAnonymousFrame(aFrame->PrincipalChildList().FirstChild());
       if (f) {
         return f;
       }
       nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
       if (kid) {
         f = GetFirstNonAnonymousFrame(kid);
         if (f) {
           return f;
         }
       }
-    } else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
-               pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
-               pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
+    } else if (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper() ||
+               pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock() ||
+               pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock()) {
       for (nsIFrame* kid : aFrame->PrincipalChildList()) {
         nsIFrame* f = GetFirstNonAnonymousFrame(kid);
         if (f) {
           return f;
         }
       }
     } else {
       return aFrame;
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -129,27 +129,25 @@ nsLayoutStatics::Initialize()
   sLayoutStaticRefcnt = 1;
   NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt,
                 "nsLayoutStatics", 1);
 
   nsresult rv;
 
   ContentParent::StartUp();
 
-  // Register static atoms. Note that nsGkAtoms must be initialized earlier
-  // than here, so it's done in NS_InitAtomTable() instead.
-  nsCSSAnonBoxes::RegisterStaticAtoms();
   nsCSSKeywords::AddRefTable();
   nsCSSProps::AddRefTable();
   nsColorNames::AddRefTable();
 
   NS_SetStaticAtomsDone();
 
 #ifdef DEBUG
   nsCSSPseudoElements::AssertAtoms();
+  nsCSSAnonBoxes::AssertAtoms();
 #endif
 
   StartupJSEnvironment();
   nsJSContext::EnsureStatics();
 
   nsGlobalWindowInner::Init();
   nsGlobalWindowOuter::Init();
   Navigator::Init();
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1389,17 +1389,17 @@ nsComboboxControlFrame::CreateFrameForDi
 
   // Get PresShell
   nsIPresShell *shell = PresShell();
   ServoStyleSet* styleSet = shell->StyleSet();
 
   // create the ComputedStyle for the anonymous block frame and text frame
   RefPtr<ComputedStyle> computedStyle;
   computedStyle = styleSet->
-    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
+    ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame(),
                                        mComputedStyle);
 
   RefPtr<ComputedStyle> textComputedStyle;
   textComputedStyle =
     styleSet->ResolveStyleForText(mDisplayContent, mComputedStyle);
 
   // Start by creating our anonymous block frame
   mDisplayFrame = new (shell) nsComboboxDisplayFrame(computedStyle, this);
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -55,17 +55,17 @@ nsFieldSetFrame::VisualBorderRectRelativ
   return r.GetPhysicalRect(wm, containerSize);
 }
 
 nsIFrame*
 nsFieldSetFrame::GetInner() const
 {
   nsIFrame* last = mFrames.LastChild();
   if (last &&
-      last->Style()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent) {
+      last->Style()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent()) {
     return last;
   }
   MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
   return nullptr;
 }
 
 nsIFrame*
 nsFieldSetFrame::GetLegend() const
--- a/layout/forms/nsFieldSetFrame.h
+++ b/layout/forms/nsFieldSetFrame.h
@@ -84,17 +84,17 @@ public:
   virtual nsresult GetFrameName(nsAString& aResult) const override {
     return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
   }
 #endif
 
   /**
    * Return the anonymous frame that contains all descendants except
    * the legend frame.  This is currently always a block frame with
-   * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the
+   * pseudo nsCSSAnonBoxes::fieldsetContent() -- this may change in the
    * future when we add support for CSS overflow for <fieldset>.  This really
    * can't return null, though callers seem to feel that it can.
    */
   nsIFrame* GetInner() const;
 
   /**
    * Return the frame that represents the legend if any.  This may be
    * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -190,17 +190,17 @@ nsHTMLButtonControlFrame::Reflow(nsPresC
 
   // Reflow the child
   nsIFrame* firstKid = mFrames.FirstChild();
 
   MOZ_ASSERT(firstKid, "Button should have a child frame for its contents");
   MOZ_ASSERT(!firstKid->GetNextSibling(),
              "Button should have exactly one child frame");
   MOZ_ASSERT(firstKid->Style()->GetPseudo() ==
-             nsCSSAnonBoxes::buttonContent,
+             nsCSSAnonBoxes::buttonContent(),
              "Button's child frame has unexpected pseudo type!");
 
   // XXXbz Eventually we may want to check-and-bail if
   // !aReflowInput.ShouldReflowAllKids() &&
   // !NS_SUBTREE_DIRTY(firstKid).
   // We'd need to cache our ascent for that, of course.
 
   // Reflow the contents of the button.
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -2463,17 +2463,17 @@ ReflowInput::InitConstraints(nsPresConte
             ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
         }
       } else {
         // Make sure legend frames with display:block and width:auto still
         // shrink-wrap.
         // Also shrink-wrap blocks that are orthogonal to their container.
         if (isBlock &&
             ((aFrameType == LayoutFrameType::Legend &&
-              mFrame->Style()->GetPseudo() != nsCSSAnonBoxes::scrolledContent) ||
+              mFrame->Style()->GetPseudo() != nsCSSAnonBoxes::scrolledContent()) ||
              (aFrameType == LayoutFrameType::Scroll &&
               mFrame->GetContentInsertionFrame()->IsLegendFrame()) ||
              (mCBReflowInput &&
               mCBReflowInput->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
           computeSizeFlags =
             ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
         }
 
--- a/layout/generic/RubyUtils.h
+++ b/layout/generic/RubyUtils.h
@@ -76,21 +76,21 @@ public:
   static inline bool IsExpandableRubyBox(nsIFrame* aFrame)
   {
     mozilla::LayoutFrameType type = aFrame->Type();
     return IsRubyContentBox(type) || IsRubyContainerBox(type);
   }
 
   static inline bool IsRubyPseudo(nsAtom* aPseudo)
   {
-    return aPseudo == nsCSSAnonBoxes::ruby ||
-           aPseudo == nsCSSAnonBoxes::rubyBase ||
-           aPseudo == nsCSSAnonBoxes::rubyText ||
-           aPseudo == nsCSSAnonBoxes::rubyBaseContainer ||
-           aPseudo == nsCSSAnonBoxes::rubyTextContainer;
+    return aPseudo == nsCSSAnonBoxes::ruby() ||
+           aPseudo == nsCSSAnonBoxes::rubyBase() ||
+           aPseudo == nsCSSAnonBoxes::rubyText() ||
+           aPseudo == nsCSSAnonBoxes::rubyBaseContainer() ||
+           aPseudo == nsCSSAnonBoxes::rubyTextContainer();
   }
 
   static void SetReservedISize(nsIFrame* aFrame, nscoord aISize);
   static void ClearReservedISize(nsIFrame* aFrame);
   static nscoord GetReservedISize(nsIFrame* aFrame);
 };
 
 /**
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -323,17 +323,17 @@ TextOverflow::TextOverflow(nsDisplayList
   , mScrollableFrame(nsLayoutUtils::GetScrollableFrameFor(aBlockFrame))
   , mBlockSize(aBlockFrame->GetSize())
   , mBlockWM(aBlockFrame->GetWritingMode())
   , mAdjustForPixelSnapping(false)
 {
 #ifdef MOZ_XUL
   if (!mScrollableFrame) {
     nsAtom* pseudoType = aBlockFrame->Style()->GetPseudo();
-    if (pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
+    if (pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock()) {
       mScrollableFrame =
         nsLayoutUtils::GetScrollableFrameFor(aBlockFrame->GetParent());
       // nsXULScrollFrame::ClampAndSetBounds rounds to nearest pixels
       // for RTL blocks (also for overflow:hidden), so we need to move
       // the edges 1px outward in ExamineLineFrames to avoid triggering
       // a text-overflow marker in this case.
       mAdjustForPixelSnapping = !mBlockWM.IsBidiLTR();
     }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1839,17 +1839,17 @@ nsBlockFrame::ComputeOverflowAreas(const
                                    const nsStyleDisplay* aDisplay,
                                    nscoord               aBEndEdgeOfChildren,
                                    nsOverflowAreas&      aOverflowAreas)
 {
   // Compute the overflow areas of our children
   // XXX_perf: This can be done incrementally.  It is currently one of
   // the things that makes incremental reflow O(N^2).
   nsOverflowAreas areas(aBounds, aBounds);
-  if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent &&
+  if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent() &&
       mParent->StyleDisplay()->IsContainLayout()) {
     // If we are a scrollframe's inner anonymous box and our parent
     // has layout containment, we want to pass our parent's style to
     // ConsiderBlockEndEdgeOfChildren to make sure all overflow from the
     // layout contained element is processed as ink (visual) overflow.
     aDisplay = mParent->StyleDisplay();
   }
   if (!ShouldApplyOverflowClipping(this, aDisplay)) {
@@ -7126,24 +7126,24 @@ nsBlockFrame::SetInitialChildList(ChildL
     // the block inside a fieldset, button or column set, or a scrolled content
     // block, except for <select>.  Note that this means that blocks which are
     // the anonymous block in {ib} splits do NOT get first-letter frames.
     // Note that NS_BLOCK_HAS_FIRST_LETTER_STYLE gets set on all continuations
     // of the block.
     nsAtom *pseudo = Style()->GetPseudo();
     bool haveFirstLetterStyle =
       (!pseudo ||
-       (pseudo == nsCSSAnonBoxes::cellContent &&
+       (pseudo == nsCSSAnonBoxes::cellContent() &&
         GetParent()->Style()->GetPseudo() == nullptr) ||
-       pseudo == nsCSSAnonBoxes::fieldsetContent ||
-       pseudo == nsCSSAnonBoxes::buttonContent ||
-       pseudo == nsCSSAnonBoxes::columnContent ||
-       (pseudo == nsCSSAnonBoxes::scrolledContent &&
+       pseudo == nsCSSAnonBoxes::fieldsetContent() ||
+       pseudo == nsCSSAnonBoxes::buttonContent() ||
+       pseudo == nsCSSAnonBoxes::columnContent() ||
+       (pseudo == nsCSSAnonBoxes::scrolledContent() &&
         !GetParent()->IsListControlFrame()) ||
-       pseudo == nsCSSAnonBoxes::mozSVGText) &&
+       pseudo == nsCSSAnonBoxes::mozSVGText()) &&
       !IsComboboxControlFrame() &&
       !IsFrameOfType(eMathML) &&
       RefPtr<ComputedStyle>(GetFirstLetterStyle(PresContext())) != nullptr;
     NS_ASSERTION(haveFirstLetterStyle ==
                  ((mState & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0),
                  "NS_BLOCK_HAS_FIRST_LETTER_STYLE state out of sync");
 #endif
 
@@ -7653,17 +7653,17 @@ nsBlockFrame::UpdatePseudoElementStyles(
                    .ResolvePseudoElementStyle(mContent->AsElement(),
                                               CSSPseudoElementType::firstLine,
                                               parentStyle,
                                               nullptr);
 
     // FIXME(bz): Can we make first-line continuations be non-inheriting anon
     // boxes?
     RefPtr<ComputedStyle> continuationStyle = aRestyleState.StyleSet().
-      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozLineFrame,
+      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozLineFrame(),
                                          parentStyle);
 
     UpdateStyleOfOwnedChildFrame(firstLineFrame, firstLineStyle, aRestyleState,
                                  Some(continuationStyle.get()));
 
     // We also want to update the styles of the first-line's descendants.  We
     // don't need to compute a changehint for this, though, since any changes to
     // them are handled by the first-line anyway.
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -1279,17 +1279,17 @@ nsColumnSetFrame::AppendDirectlyOwnedAno
   nsIFrame* column = mFrames.FirstChild();
 
   // We might not have any columns, apparently?
   if (!column) {
     return;
   }
 
   MOZ_ASSERT(column->Style()->GetPseudo() ==
-               nsCSSAnonBoxes::columnContent,
+               nsCSSAnonBoxes::columnContent(),
              "What sort of child is this?");
   aResult.AppendElement(OwnedAnonBox(column));
 }
 
 #ifdef DEBUG
 void
 nsColumnSetFrame::SetInitialChildList(ChildListID     aListID,
                                       nsFrameList&    aChildList)
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -2394,18 +2394,18 @@ nsFlexContainerFrame::Init(nsIContent*  
 
   // If this frame is for a scrollable element, then it will actually have
   // "display:block", and its *parent frame* will have the real
   // flex-flavored display value. So in that case, check the parent frame to
   // find out if we're legacy.
   if (!isLegacyBox && styleDisp->mDisplay == mozilla::StyleDisplay::Block) {
     ComputedStyle* parentComputedStyle = GetParent()->Style();
     NS_ASSERTION(parentComputedStyle &&
-                 (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::buttonContent ||
-                  mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent),
+                 (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::buttonContent() ||
+                  mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent()),
                  "The only way a nsFlexContainerFrame can have 'display:block' "
                  "should be if it's the inner part of a scrollable or button "
                  "element");
     isLegacyBox = IsDisplayValueLegacyBox(parentComputedStyle->StyleDisplay());
   }
 
   if (isLegacyBox) {
     AddStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_BOX);
@@ -3823,18 +3823,18 @@ nsFlexContainerFrame::ShouldUseMozBoxCol
   if (aThisStyleDisp->mDisplay == mozilla::StyleDisplay::MozBox ||
       aThisStyleDisp->mDisplay == mozilla::StyleDisplay::MozInlineBox) {
     return true;
   }
 
   // Check our parent's display value, if we're an anonymous box (with a
   // potentially-untrustworthy display value):
   auto pseudoType = Style()->GetPseudo();
-  if (pseudoType == nsCSSAnonBoxes::scrolledContent ||
-      pseudoType == nsCSSAnonBoxes::buttonContent) {
+  if (pseudoType == nsCSSAnonBoxes::scrolledContent() ||
+      pseudoType == nsCSSAnonBoxes::buttonContent()) {
     const nsStyleDisplay* disp = GetParent()->StyleDisplay();
     if (disp->mDisplay == mozilla::StyleDisplay::MozBox ||
         disp->mDisplay == mozilla::StyleDisplay::MozInlineBox) {
       return true;
     }
   }
 
   return false;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -7580,19 +7580,19 @@ nsFrame::IsFrameTreeTooDeep(const Reflow
   RemoveStateBits(NS_FRAME_TOO_DEEP_IN_FRAME_TREE);
   return false;
 }
 
 bool
 nsIFrame::IsBlockWrapper() const
 {
   nsAtom *pseudoType = Style()->GetPseudo();
-  return (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper ||
-          pseudoType == nsCSSAnonBoxes::buttonContent ||
-          pseudoType == nsCSSAnonBoxes::cellContent);
+  return (pseudoType == nsCSSAnonBoxes::mozBlockInsideInlineWrapper() ||
+          pseudoType == nsCSSAnonBoxes::buttonContent() ||
+          pseudoType == nsCSSAnonBoxes::cellContent());
 }
 
 static nsIFrame*
 GetNearestBlockContainer(nsIFrame* frame)
 {
   // The block wrappers we use to wrap blocks inside inlines aren't
   // described in the CSS spec.  We need to make them not be containing
   // blocks.
@@ -7627,17 +7627,17 @@ nsIFrame::GetContainingBlock(uint32_t aF
   if (IsAbsolutelyPositioned(aStyleDisplay) &&
       (GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
     f = GetParent(); // the parent is always the containing block
   } else {
     f = GetNearestBlockContainer(GetParent());
   }
 
   if (aFlags & SKIP_SCROLLED_FRAME && f &&
-      f->Style()->GetPseudo() == nsCSSAnonBoxes::scrolledContent) {
+      f->Style()->GetPseudo() == nsCSSAnonBoxes::scrolledContent()) {
     f = f->GetParent();
   }
   return f;
 }
 
 #ifdef DEBUG_FRAME_DUMP
 
 int32_t nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
@@ -9329,17 +9329,17 @@ ComputeAndIncludeOutlineArea(nsIFrame* a
   // When the outline property is set on a :-moz-block-inside-inline-wrapper
   // pseudo-element, it inherited that outline from the inline that was broken
   // because it contained a block.  In that case, we don't want a really wide
   // outline if the block inside the inline is narrow, so union the actual
   // contents of the anonymous blocks.
   nsIFrame *frameForArea = aFrame;
   do {
     nsAtom *pseudoType = frameForArea->Style()->GetPseudo();
-    if (pseudoType != nsCSSAnonBoxes::mozBlockInsideInlineWrapper)
+    if (pseudoType != nsCSSAnonBoxes::mozBlockInsideInlineWrapper())
       break;
     // If we're done, we really want it and all its later siblings.
     frameForArea = frameForArea->PrincipalChildList().FirstChild();
     NS_ASSERTION(frameForArea, "anonymous block with no children?");
   } while (frameForArea);
 
   // Find the union of the border boxes of all descendants, or in
   // the block-in-inline case, all descendants we care about.
@@ -9674,17 +9674,17 @@ nsIFrame::GetDepthInFrameTree() const
   return result;
 }
 
 void
 nsFrame::ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
                                nsIFrame* aChildFrame)
 {
   const nsStyleDisplay* display = StyleDisplay();
-  if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent) {
+  if (mComputedStyle->GetPseudo() == nsCSSAnonBoxes::scrolledContent()) {
     // If we are a scrollframe's inner anonymous box, we'll want to check if
     // our parent has contain:layout below, so we change the nsStyleDisplay we
     // read from here.
     display = mParent->StyleDisplay();
   }
   if (display->IsContainLayout() && IsFrameOfType(eSupportsContainLayoutAndPaint)) {
     // If we have layout containment and are not a non-atomic, inline-level
     // principal box (or, if we are a scrollframe's inner anonymous box and
@@ -9727,17 +9727,17 @@ nsFrame::ShouldAvoidBreakInside(const Re
 static nsIFrame*
 GetIBSplitSiblingForAnonymousBlock(const nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame, "Must have a non-null frame!");
   NS_ASSERTION(aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT,
                "GetIBSplitSibling should only be called on ib-split frames");
 
   nsAtom* type = aFrame->Style()->GetPseudo();
-  if (type != nsCSSAnonBoxes::mozBlockInsideInlineWrapper) {
+  if (type != nsCSSAnonBoxes::mozBlockInsideInlineWrapper()) {
     // it's not an anonymous block
     return nullptr;
   }
 
   // Find the first continuation of the frame.  (Ugh.  This ends up
   // being O(N^2) when it is called O(N) times.)
   aFrame = aFrame->FirstContinuation();
 
@@ -9779,17 +9779,17 @@ GetCorrectedParent(const nsIFrame* aFram
       return innerTable;
     }
   }
 
   // Table wrappers are always anon boxes; if we're in here for an outer
   // table, that actually means its the _inner_ table that wants to
   // know its parent. So get the pseudo of the inner in that case.
   nsAtom* pseudo = aFrame->Style()->GetPseudo();
-  if (pseudo == nsCSSAnonBoxes::tableWrapper) {
+  if (pseudo == nsCSSAnonBoxes::tableWrapper()) {
     pseudo = aFrame->PrincipalChildList().FirstChild()->Style()->GetPseudo();
   }
 
   // Prevent a NAC pseudo-element from inheriting from its NAC parent, and
   // inherit from the NAC generator element instead.
   if (pseudo) {
     MOZ_ASSERT(aFrame->GetContent());
     Element* element = Element::FromNode(aFrame->GetContent());
@@ -9821,17 +9821,17 @@ nsFrame::CorrectStyleParentFrame(nsIFram
     if (nsCSSAnonBoxes::IsNonInheritingAnonBox(aChildPseudo)) {
       return nullptr;
     }
 
     // Other anon boxes are parented to their actual parent already, except
     // for non-elements.  Those should not be treated as an anon box.
     if (!nsCSSAnonBoxes::IsNonElement(aChildPseudo) &&
         nsCSSAnonBoxes::IsAnonBox(aChildPseudo)) {
-      NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
+      NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozBlockInsideInlineWrapper(),
                    "Should have dealt with kids that have "
                    "NS_FRAME_PART_OF_IBSPLIT elsewhere");
       return aProspectiveParent;
     }
   }
 
   // Otherwise, walk up out of all anon boxes.  For placeholder frames, walk out
   // of all pseudo-elements as well.  Otherwise ReparentComputedStyle could cause
@@ -9858,17 +9858,17 @@ nsFrame::CorrectStyleParentFrame(nsIFram
          aChildPseudo != nsGkAtoms::placeholderFrame)) {
       return parent;
     }
 
     parent = parent->GetInFlowParent();
   } while (parent);
 
   if (aProspectiveParent->Style()->GetPseudo() ==
-      nsCSSAnonBoxes::viewportScroll) {
+      nsCSSAnonBoxes::viewportScroll()) {
     // aProspectiveParent is the scrollframe for a viewport
     // and the kids are the anonymous scrollbars
     return aProspectiveParent;
   }
 
   // We can get here if the root element is absolutely positioned.
   // We can't test for this very accurately, but it can only happen
   // when the prospective parent is a canvas frame.
@@ -9891,17 +9891,17 @@ nsFrame::DoGetParentComputedStyle(nsIFra
       if (!pseudo || !mContent->IsElement() ||
           (!nsCSSAnonBoxes::IsAnonBox(pseudo) &&
            // Ensure that we don't return the display:contents style
            // of the parent content for pseudos that have the same content
            // as their primary frame (like -moz-list-bullets do):
            IsPrimaryFrame()) ||
           /* if next is true then it's really a request for the table frame's
              parent context, see nsTable[Outer]Frame::GetParentComputedStyle. */
-          pseudo == nsCSSAnonBoxes::tableWrapper) {
+          pseudo == nsCSSAnonBoxes::tableWrapper()) {
         if (Servo_Element_IsDisplayContents(parentElement)) {
           RefPtr<ComputedStyle> style =
             PresShell()->StyleSet()->ResolveServoStyle(*parentElement);
           // NOTE(emilio): we return a weak reference because the element also
           // holds the style context alive. This is a bit silly (we could've
           // returned a weak ref directly), but it's probably not worth
           // optimizing, given this function has just one caller which is rare,
           // and this path is rare itself.
@@ -9990,18 +9990,18 @@ nsIFrame::IsFocusable(int32_t *aTabIndex
 {
   int32_t tabIndex = -1;
   if (aTabIndex) {
     *aTabIndex = -1; // Default for early return is not focusable
   }
   bool isFocusable = false;
 
   if (mContent && mContent->IsElement() && IsVisibleConsideringAncestors() &&
-      Style()->GetPseudo() != nsCSSAnonBoxes::anonymousFlexItem &&
-      Style()->GetPseudo() != nsCSSAnonBoxes::anonymousGridItem) {
+      Style()->GetPseudo() != nsCSSAnonBoxes::anonymousFlexItem() &&
+      Style()->GetPseudo() != nsCSSAnonBoxes::anonymousGridItem()) {
     const nsStyleUI* ui = StyleUI();
     if (ui->mUserFocus != StyleUserFocus::Ignore &&
         ui->mUserFocus != StyleUserFocus::None) {
       // Pass in default tabindex of -1 for nonfocusable and 0 for focusable
       tabIndex = 0;
     }
     isFocusable = mContent->IsFocusable(&tabIndex, aWithMouse);
     if (!isFocusable && !aWithMouse && IsScrollFrame() &&
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -325,17 +325,17 @@ nsHTMLFramesetFrame::Init(nsIContent*   
     mChildCount++;
   }
 
   mNonBlankChildCount = mChildCount;
   // add blank frames for frameset cells that had no content provided
   for (int blankX = mChildCount; blankX < numCells; blankX++) {
     RefPtr<ComputedStyle> pseudoComputedStyle;
     pseudoComputedStyle = shell->StyleSet()->
-      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::framesetBlank);
+      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::framesetBlank());
 
     // XXX the blank frame is using the content of its parent - at some point it
     // should just have null content, if we support that
     nsHTMLFramesetBlankFrame* blankFrame = new (shell) nsHTMLFramesetBlankFrame(pseudoComputedStyle);
 
     blankFrame->Init(mContent, this, nullptr);
 
     mFrames.AppendFrame(nullptr, blankFrame);
@@ -901,17 +901,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
 
     if (lastRow != cellIndex.y) {  // changed to next row
       offset.x = 0;
       offset.y += lastSize.height;
       if (firstTime) { // create horizontal border
 
         RefPtr<ComputedStyle> pseudoComputedStyle;
         pseudoComputedStyle = styleSet->
-          ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::horizontalFramesetBorder);
+          ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::horizontalFramesetBorder());
 
         borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoComputedStyle,
                                                             borderWidth,
                                                             false,
                                                             false);
         borderFrame->Init(mContent, this, nullptr);
         mChildCount++;
         mFrames.AppendFrame(nullptr, borderFrame);
@@ -930,17 +930,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
       offset.y += borderWidth;
     } else {
       if (cellIndex.x > 0) {  // moved to next col in same row
         if (0 == cellIndex.y) { // in 1st row
           if (firstTime) { // create vertical border
 
             RefPtr<ComputedStyle> pseudoComputedStyle;
             pseudoComputedStyle = styleSet->
-              ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::verticalFramesetBorder);
+              ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::verticalFramesetBorder());
 
             borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoComputedStyle,
                                                                 borderWidth,
                                                                 true,
                                                                 false);
             borderFrame->Init(mContent, this, nullptr);
             mChildCount++;
             mFrames.AppendFrame(nullptr, borderFrame);
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -33,17 +33,17 @@ nsIFrame::IsFlexOrGridItem() const
          GetParent() &&
          GetParent()->IsFlexOrGridContainer();
 }
 
 bool
 nsIFrame::IsTableCaption() const
 {
   return StyleDisplay()->mDisplay == mozilla::StyleDisplay::TableCaption &&
-    GetParent()->Style()->GetPseudo() == nsCSSAnonBoxes::tableWrapper;
+    GetParent()->Style()->GetPseudo() == nsCSSAnonBoxes::tableWrapper();
 }
 
 bool
 nsIFrame::IsFloating() const
 {
   return StyleDisplay()->IsFloating(this);
 }
 
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -2544,17 +2544,17 @@ nsImageListener::Notify(imgIRequest *aRe
 
 static bool
 IsInAutoWidthTableCellForQuirk(nsIFrame *aFrame)
 {
   if (eCompatibility_NavQuirks != aFrame->PresContext()->CompatibilityMode())
     return false;
   // Check if the parent of the closest nsBlockFrame has auto width.
   nsBlockFrame *ancestor = nsLayoutUtils::FindNearestBlockAncestor(aFrame);
-  if (ancestor->Style()->GetPseudo() == nsCSSAnonBoxes::cellContent) {
+  if (ancestor->Style()->GetPseudo() == nsCSSAnonBoxes::cellContent()) {
     // Assume direct parent is a table cell frame.
     nsFrame *grandAncestor = static_cast<nsFrame*>(ancestor->GetParent());
     return grandAncestor &&
       grandAncestor->StylePosition()->mWidth.GetUnit() == eStyleUnit_Auto;
   }
   return false;
 }
 
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -954,30 +954,30 @@ nsInlineFrame::UpdateStyleOfOwnedAnonBox
 
   // The later inlines need to get our style.
   ComputedStyle* ourStyle = Style();
 
   // The anonymous block's style inherits from ours, and we already have our new
   // ComputedStyle.
   RefPtr<ComputedStyle> newContext =
     aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(
-      nsCSSAnonBoxes::mozBlockInsideInlineWrapper, ourStyle);
+      nsCSSAnonBoxes::mozBlockInsideInlineWrapper(), ourStyle);
 
   // We're guaranteed that newContext only differs from the old ComputedStyle on
   // the block in things they might inherit from us.  And changehint processing
   // guarantees walking the continuation and ib-sibling chains, so our existing
   // changehint being in aChangeList is good enough.  So we don't need to touch
   // aChangeList at all here.
 
   while (blockFrame) {
     MOZ_ASSERT(!blockFrame->GetPrevContinuation(),
                "Must be first continuation");
 
     MOZ_ASSERT(blockFrame->Style()->GetPseudo() ==
-               nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
+               nsCSSAnonBoxes::mozBlockInsideInlineWrapper(),
                "Unexpected kind of ComputedStyle");
 
     // We don't want to just walk through using GetNextContinuationWithSameStyle
     // here, because we want to set updated ComputedStyles on both our
     // ib-sibling blocks and inlines.
     for (nsIFrame* cont = blockFrame; cont; cont = cont->GetNextContinuation()) {
       cont->SetComputedStyle(newContext);
     }
@@ -1027,23 +1027,23 @@ nsFirstLineFrame::Init(nsIContent*      
   if (aPrevInFlow->Style()->GetPseudo() == nsCSSPseudoElements::firstLine()) {
     MOZ_ASSERT(FirstInFlow() == aPrevInFlow);
     // Create a new ComputedStyle that is a child of the parent
     // ComputedStyle thus removing the ::first-line style. This way
     // we behave as if an anonymous (unstyled) span was the child
     // of the parent frame.
     ComputedStyle* parentContext = aParent->Style();
     RefPtr<ComputedStyle> newSC = PresContext()->StyleSet()->
-      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozLineFrame,
+      ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozLineFrame(),
                                          parentContext);
     SetComputedStyle(newSC);
   } else {
     MOZ_ASSERT(FirstInFlow() != aPrevInFlow);
     MOZ_ASSERT(aPrevInFlow->Style()->GetPseudo() ==
-                 nsCSSAnonBoxes::mozLineFrame);
+                 nsCSSAnonBoxes::mozLineFrame());
   }
 }
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsFirstLineFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Line"), aResult);
--- a/layout/generic/nsRubyContentFrame.cpp
+++ b/layout/generic/nsRubyContentFrame.cpp
@@ -27,16 +27,16 @@ nsRubyContentFrame::IsFrameOfType(uint32
   }
   return nsInlineFrame::IsFrameOfType(aFlags);
 }
 
 bool
 nsRubyContentFrame::IsIntraLevelWhitespace() const
 {
   nsAtom* pseudoType = Style()->GetPseudo();
-  if (pseudoType != nsCSSAnonBoxes::rubyBase &&
-      pseudoType != nsCSSAnonBoxes::rubyText) {
+  if (pseudoType != nsCSSAnonBoxes::rubyBase() &&
+      pseudoType != nsCSSAnonBoxes::rubyText()) {
     return false;
   }
 
   nsIFrame* child = mFrames.OnlyChild();
   return child && child->GetContent()->TextIsOnlyWhitespace();
 }
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -170,17 +170,17 @@ public:
   // NOTE: for nsTextFrame, use nsTextFrame::ShouldSuppressLineBreak()
   // instead of this method.
   bool ShouldSuppressLineBreak() const
   {
     return bool(mBits & Bit::SuppressLineBreak);
   }
 
   // Is this horizontal-in-vertical (tate-chu-yoko) text? This flag is
-  // only set on ComputedStyles whose pseudo is nsCSSAnonBoxes::mozText.
+  // only set on ComputedStyles whose pseudo is nsCSSAnonBoxes::mozText().
   bool IsTextCombined() const
   {
     return bool(mBits & Bit::IsTextCombined);
   }
 
   // Does this ComputedStyle represent the style for a pseudo-element or
   // inherit data from such a ComputedStyle?  Whether this returns true
   // is equivalent to whether it or any of its ancestors returns
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -463,19 +463,19 @@ ServoStyleSet::PreTraverse(ServoTraversa
 }
 
 static inline already_AddRefed<ComputedStyle>
 ResolveStyleForTextOrFirstLetterContinuation(
     RawServoStyleSetBorrowed aStyleSet,
     ComputedStyle& aParent,
     nsAtom* aAnonBox)
 {
-  MOZ_ASSERT(aAnonBox == nsCSSAnonBoxes::mozText ||
-             aAnonBox == nsCSSAnonBoxes::firstLetterContinuation);
-  auto inheritTarget = aAnonBox == nsCSSAnonBoxes::mozText
+  MOZ_ASSERT(aAnonBox == nsCSSAnonBoxes::mozText() ||
+             aAnonBox == nsCSSAnonBoxes::firstLetterContinuation());
+  auto inheritTarget = aAnonBox == nsCSSAnonBoxes::mozText()
     ? InheritTarget::Text
     : InheritTarget::FirstLetterContinuation;
 
   RefPtr<ComputedStyle> style =
     aParent.GetCachedInheritingAnonBoxStyle(aAnonBox);
   if (!style) {
     style = Servo_ComputedValues_Inherit(aStyleSet,
                                          aAnonBox,
@@ -492,41 +492,41 @@ already_AddRefed<ComputedStyle>
 ServoStyleSet::ResolveStyleForText(nsIContent* aTextNode,
                                    ComputedStyle* aParentContext)
 {
   MOZ_ASSERT(aTextNode && aTextNode->IsText());
   MOZ_ASSERT(aTextNode->GetParent());
   MOZ_ASSERT(aParentContext);
 
   return ResolveStyleForTextOrFirstLetterContinuation(
-      mRawSet.get(), *aParentContext, nsCSSAnonBoxes::mozText);
+      mRawSet.get(), *aParentContext, nsCSSAnonBoxes::mozText());
 }
 
 already_AddRefed<ComputedStyle>
 ServoStyleSet::ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentContext)
 {
   MOZ_ASSERT(aParentContext);
 
   return ResolveStyleForTextOrFirstLetterContinuation(
-      mRawSet.get(), *aParentContext, nsCSSAnonBoxes::firstLetterContinuation);
+      mRawSet.get(), *aParentContext, nsCSSAnonBoxes::firstLetterContinuation());
 }
 
 already_AddRefed<ComputedStyle>
 ServoStyleSet::ResolveStyleForPlaceholder()
 {
   RefPtr<ComputedStyle>& cache =
     mNonInheritingComputedStyles[nsCSSAnonBoxes::NonInheriting::oofPlaceholder];
   if (cache) {
     RefPtr<ComputedStyle> retval = cache;
     return retval.forget();
   }
 
   RefPtr<ComputedStyle> computedValues =
     Servo_ComputedValues_Inherit(mRawSet.get(),
-                                 nsCSSAnonBoxes::oofPlaceholder,
+                                 nsCSSAnonBoxes::oofPlaceholder(),
                                  nullptr,
                                  InheritTarget::PlaceholderFrame)
                                  .Consume();
   MOZ_ASSERT(computedValues);
 
   cache = computedValues;
   return computedValues.forget();
 }
@@ -622,18 +622,18 @@ ServoStyleSet::ResolveInheritingAnonymou
   return style.forget();
 }
 
 already_AddRefed<ComputedStyle>
 ServoStyleSet::ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag)
 {
   MOZ_ASSERT(nsCSSAnonBoxes::IsAnonBox(aPseudoTag) &&
              nsCSSAnonBoxes::IsNonInheritingAnonBox(aPseudoTag));
-  MOZ_ASSERT(aPseudoTag != nsCSSAnonBoxes::pageContent,
-             "If nsCSSAnonBoxes::pageContent ends up non-inheriting, check "
+  MOZ_ASSERT(aPseudoTag != nsCSSAnonBoxes::pageContent(),
+             "If nsCSSAnonBoxes::pageContent() ends up non-inheriting, check "
              "whether we need to do anything to move the "
              "@page handling from ResolveInheritingAnonymousBoxStyle to "
              "ResolveNonInheritingAnonymousBoxStyle");
 
   nsCSSAnonBoxes::NonInheriting type =
     nsCSSAnonBoxes::NonInheritingTypeForPseudoTag(aPseudoTag);
   RefPtr<ComputedStyle>& cache = mNonInheritingComputedStyles[type];
   if (cache) {
@@ -642,17 +642,17 @@ ServoStyleSet::ResolveNonInheritingAnony
   }
 
   UpdateStylistIfNeeded();
 
   // We always want to skip parent-based display fixup here.  It never makes
   // sense for non-inheriting anonymous boxes.  (Static assertions in
   // nsCSSAnonBoxes.cpp ensure that all non-inheriting non-anonymous boxes
   // are indeed annotated as skipping this fixup.)
-  MOZ_ASSERT(!nsCSSAnonBoxes::IsNonInheritingAnonBox(nsCSSAnonBoxes::viewport),
+  MOZ_ASSERT(!nsCSSAnonBoxes::IsNonInheritingAnonBox(nsCSSAnonBoxes::viewport()),
              "viewport needs fixup to handle blockifying it");
   RefPtr<ComputedStyle> computedValues =
     Servo_ComputedValues_GetForAnonymousBox(nullptr,
                                             aPseudoTag,
                                             mRawSet.get()).Consume();
 #ifdef DEBUG
   if (!computedValues) {
     nsString pseudo;
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -149,43 +149,43 @@ public:
   // used...
   already_AddRefed<ComputedStyle>
   ResolveStyleFor(dom::Element* aElement,
                   ComputedStyle* aParentContext,
                   LazyComputeBehavior aMayCompute);
 
   // Get a CopmutedStyle for a text node (which no rules will match).
   //
-  // The returned ComputedStyle will have nsCSSAnonBoxes::mozText as its pseudo.
+  // The returned ComputedStyle will have nsCSSAnonBoxes::mozText() as its pseudo.
   //
   // (Perhaps mozText should go away and we shouldn't even create style
   // contexts for such content nodes, when text-combine-upright is not
   // present.  However, not doing any rule matching for them is a first step.)
   already_AddRefed<ComputedStyle>
   ResolveStyleForText(nsIContent* aTextNode, ComputedStyle* aParentContext);
 
   // Get a ComputedStyle for a first-letter continuation (which no rules will
   // match).
   //
   // The returned ComputedStyle will have
-  // nsCSSAnonBoxes::firstLetterContinuation as its pseudo.
+  // nsCSSAnonBoxes::firstLetterContinuation() as its pseudo.
   //
-  // (Perhaps nsCSSAnonBoxes::firstLetterContinuation should go away and we
+  // (Perhaps nsCSSAnonBoxes::firstLetterContinuation() should go away and we
   // shouldn't even create ComputedStyles for such frames.  However, not doing
   // any rule matching for them is a first step.  And right now we do use this
   // ComputedStyle for some things)
   already_AddRefed<ComputedStyle>
   ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentContext);
 
   // Get a ComputedStyle for a placeholder frame (which no rules will match).
   //
-  // The returned ComputedStyle will have nsCSSAnonBoxes::oofPlaceholder as
+  // The returned ComputedStyle will have nsCSSAnonBoxes::oofPlaceholder() as
   // its pseudo.
   //
-  // (Perhaps nsCSSAnonBoxes::oofPaceholder should go away and we shouldn't even
+  // (Perhaps nsCSSAnonBoxes::oofPaceholder() should go away and we shouldn't even
   // create ComputedStyle for placeholders.  However, not doing any rule
   // matching for them is a first step.)
   already_AddRefed<ComputedStyle>
   ResolveStyleForPlaceholder();
 
   // Get a ComputedStyle for a pseudo-element.  aParentElement must be
   // non-null.  aPseudoID is the CSSPseudoElementType for the
   // pseudo-element.  aPseudoElement must be non-null if the pseudo-element
--- a/layout/style/nsCSSAnonBoxes.cpp
+++ b/layout/style/nsCSSAnonBoxes.cpp
@@ -4,73 +4,65 @@
  * 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/. */
 
 /* atom list for CSS anonymous boxes */
 
 #include "mozilla/ArrayUtils.h"
 
 #include "nsCSSAnonBoxes.h"
+#include "nsGkAtomConsts.h"
 
 using namespace mozilla;
 
-namespace mozilla {
-namespace detail {
-
-MOZ_PUSH_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-extern constexpr CSSAnonBoxAtoms gCSSAnonBoxAtoms = {
-  #define CSS_ANON_BOX(name_, value_) \
-    NS_STATIC_ATOM_INIT_STRING(value_)
-  #include "nsCSSAnonBoxList.h"
-  #undef CSS_ANON_BOX
-  {
-    #define CSS_ANON_BOX(name_, value_) \
-      NS_STATIC_ATOM_INIT_ATOM( \
-        nsICSSAnonBoxPseudo, CSSAnonBoxAtoms, name_, value_)
-    #include "nsCSSAnonBoxList.h"
-    #undef CSS_ANON_BOX
-  }
-};
-MOZ_POP_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-
-} // namespace detail
-} // namespace mozilla
-
-// Non-inheriting boxes must come first in nsCSSAnonBoxList.h so that
-// `NonInheriting` values can index into this array and other similar arrays.
-const nsStaticAtom* const nsCSSAnonBoxes::sAtoms =
-  mozilla::detail::gCSSAnonBoxAtoms.mAtoms;
-
-#define CSS_ANON_BOX(name_, value_) \
-  NS_STATIC_ATOM_DEFN_PTR( \
-    nsICSSAnonBoxPseudo, mozilla::detail::CSSAnonBoxAtoms, \
-    mozilla::detail::gCSSAnonBoxAtoms, nsCSSAnonBoxes, name_)
-#include "nsCSSAnonBoxList.h"
-#undef CSS_ANON_BOX
-
-void nsCSSAnonBoxes::RegisterStaticAtoms()
+static nsStaticAtom*
+GetAtomBase()
 {
-  NS_RegisterStaticAtoms(sAtoms, sAtomsLen);
+  return const_cast<nsStaticAtom*>(
+      nsGkAtoms::GetAtomByIndex(kAtomIndex_AnonBoxes));
 }
 
-bool nsCSSAnonBoxes::IsAnonBox(nsAtom *aAtom)
+bool
+nsCSSAnonBoxes::IsAnonBox(nsAtom* aAtom)
 {
-  return nsStaticAtomUtils::IsMember(aAtom, sAtoms, sAtomsLen);
+  return nsStaticAtomUtils::IsMember(aAtom, GetAtomBase(),
+                                     kAtomCount_AnonBoxes);
 }
 
 #ifdef MOZ_XUL
 /* static */ bool
 nsCSSAnonBoxes::IsTreePseudoElement(nsAtom* aPseudo)
 {
   MOZ_ASSERT(nsCSSAnonBoxes::IsAnonBox(aPseudo));
   return StringBeginsWith(nsDependentAtomString(aPseudo),
                           NS_LITERAL_STRING(":-moz-tree-"));
 }
 #endif
 
 /* static*/ nsCSSAnonBoxes::NonInheriting
 nsCSSAnonBoxes::NonInheritingTypeForPseudoTag(nsAtom* aPseudo)
 {
   MOZ_ASSERT(IsNonInheritingAnonBox(aPseudo));
-  Maybe<uint32_t> index = nsStaticAtomUtils::Lookup(aPseudo, sAtoms, sAtomsLen);
+  Maybe<uint32_t> index =
+    nsStaticAtomUtils::Lookup(aPseudo, GetAtomBase(), kAtomCount_AnonBoxes);
   MOZ_RELEASE_ASSERT(index.isSome());
   return static_cast<NonInheriting>(*index);
 }
+
+#ifdef DEBUG
+/* static */ void
+nsCSSAnonBoxes::AssertAtoms()
+{
+  nsStaticAtom* base = GetAtomBase();
+  size_t index = 0;
+#define CSS_ANON_BOX(name_, value_)                                  \
+  {                                                                  \
+    RefPtr<nsAtom> atom = NS_Atomize(value_);                        \
+    MOZ_ASSERT(atom == nsGkAtoms::AnonBox_##name_,                   \
+               "Static atom for " #name_ " has incorrect value");    \
+    MOZ_ASSERT(atom == &base[index],                                 \
+               "Static atom for " #name_ " not at expected index");  \
+    ++index;                                                         \
+  }
+#include "nsCSSAnonBoxList.h"
+#undef CSS_ANON_BOX
+}
+#endif
--- a/layout/style/nsCSSAnonBoxes.h
+++ b/layout/style/nsCSSAnonBoxes.h
@@ -5,78 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* atom list for CSS anonymous boxes */
 
 #ifndef nsCSSAnonBoxes_h___
 #define nsCSSAnonBoxes_h___
 
 #include "nsAtom.h"
-#include "nsStaticAtom.h"
-
-// Trivial subclass of nsStaticAtom so that function signatures can require an
-// atom from this atom list.
-class nsICSSAnonBoxPseudo : public nsStaticAtom
-{
-public:
-  constexpr nsICSSAnonBoxPseudo(const char16_t* aStr, uint32_t aLength,
-                                uint32_t aStringOffset)
-    : nsStaticAtom(aStr, aLength, aStringOffset)
-  {}
-};
-
-namespace mozilla {
-namespace detail {
-
-struct CSSAnonBoxAtoms
-{
-  #define CSS_ANON_BOX(name_, value_) NS_STATIC_ATOM_DECL_STRING(name_, value_)
-  #include "nsCSSAnonBoxList.h"
-  #undef CSS_ANON_BOX
-
-  enum class Atoms {
-    #define CSS_ANON_BOX(name_, value_) \
-      NS_STATIC_ATOM_ENUM(name_)
-    #include "nsCSSAnonBoxList.h"
-    #undef CSS_ANON_BOX
-    AtomsCount
-  };
-
-  const nsICSSAnonBoxPseudo mAtoms[static_cast<size_t>(Atoms::AtomsCount)];
-};
-
-} // namespace detail
-} // namespace mozilla
+#include "nsGkAtoms.h"
 
 class nsCSSAnonBoxes {
 public:
-
-  static void RegisterStaticAtoms();
-
   static bool IsAnonBox(nsAtom *aAtom);
 #ifdef MOZ_XUL
   static bool IsTreePseudoElement(nsAtom* aPseudo);
 #endif
   static bool IsNonElement(nsAtom* aPseudo)
   {
-    return aPseudo == mozText || aPseudo == oofPlaceholder ||
-           aPseudo == firstLetterContinuation;
+    return aPseudo == nsCSSAnonBoxes::mozText() ||
+           aPseudo == nsCSSAnonBoxes::oofPlaceholder() ||
+           aPseudo == nsCSSAnonBoxes::firstLetterContinuation();
   }
 
-private:
-  static const nsStaticAtom* const sAtoms;
-  static constexpr size_t sAtomsLen =
-    static_cast<size_t>(mozilla::detail::CSSAnonBoxAtoms::Atoms::AtomsCount);
-
-public:
-  #define CSS_ANON_BOX(name_, value_) \
-    NS_STATIC_ATOM_DECL_PTR(nsICSSAnonBoxPseudo, name_)
-  #include "nsCSSAnonBoxList.h"
-  #undef CSS_ANON_BOX
-
   typedef uint8_t NonInheritingBase;
   enum class NonInheriting : NonInheritingBase {
 #define CSS_ANON_BOX(_name, _value) /* nothing */
 #define CSS_NON_INHERITING_ANON_BOX(_name, _value) _name,
 #include "nsCSSAnonBoxList.h"
 #undef CSS_NON_INHERITING_ANON_BOX
 #undef CSS_ANON_BOX
     _Count
@@ -86,55 +39,71 @@ public:
   // might not be very fast.  We may want to think of ways to handle that
   // (e.g. by moving to an enum instead of an atom, like we did for
   // pseudo-elements, or by adding a new value of the pseudo-element enum for
   // non-inheriting anon boxes or something).
   static bool IsNonInheritingAnonBox(nsAtom* aPseudo)
   {
     return
 #define CSS_ANON_BOX(_name, _value) /* nothing */
-#define CSS_NON_INHERITING_ANON_BOX(_name, _value) _name == aPseudo ||
+#define CSS_NON_INHERITING_ANON_BOX(_name, _value) \
+      nsGkAtoms::AnonBox_##_name == aPseudo ||
 #include "nsCSSAnonBoxList.h"
 #undef CSS_NON_INHERITING_ANON_BOX
 #undef CSS_ANON_BOX
       false;
   }
 
 #ifdef DEBUG
   // NOTE(emilio): DEBUG only because this does a pretty slow linear search. Try
   // to use IsNonInheritingAnonBox if you know the atom is an anon box already
   // or, even better, nothing like this.  Note that this function returns true
   // for wrapper anon boxes as well, since they're all inheriting.
   static bool IsInheritingAnonBox(nsAtom* aPseudo)
   {
     return
-#define CSS_ANON_BOX(_name, _value) _name == aPseudo ||
+#define CSS_ANON_BOX(_name, _value) nsGkAtoms::AnonBox_##_name == aPseudo ||
 #define CSS_NON_INHERITING_ANON_BOX(_name, _value) /* nothing */
 #include "nsCSSAnonBoxList.h"
 #undef CSS_NON_INHERITING_ANON_BOX
 #undef CSS_ANON_BOX
       false;
   }
 #endif // DEBUG
 
   // This function is rather slow; you probably don't want to use it outside
   // asserts unless you have to.
   static bool IsWrapperAnonBox(nsAtom* aPseudo) {
     // We commonly get null passed here, and want to quickly return false for
     // it.
     return aPseudo &&
       (
 #define CSS_ANON_BOX(_name, _value) /* nothing */
-#define CSS_WRAPPER_ANON_BOX(_name, _value) _name == aPseudo ||
+#define CSS_WRAPPER_ANON_BOX(_name, _value) nsGkAtoms::AnonBox_##_name == aPseudo ||
 #define CSS_NON_INHERITING_ANON_BOX(_name, _value) /* nothing */
 #include "nsCSSAnonBoxList.h"
 #undef CSS_NON_INHERITING_ANON_BOX
 #undef CSS_WRAPPER_ANON_BOX
 #undef CSS_ANON_BOX
        false);
   }
 
   // Get the NonInheriting type for a given pseudo tag.  The pseudo tag must
   // test true for IsNonInheritingAnonBox.
   static NonInheriting NonInheritingTypeForPseudoTag(nsAtom* aPseudo);
+
+#ifdef DEBUG
+  static void AssertAtoms();
+#endif
+
+  // Alias nsCSSAnonBoxes::foo() to alias nsGkAtoms::AnonBox_foo.
+  // XXX Once nsGkAtoms::AnonBox_foo become constexpr variables, these can too.
+  // See bug 1449787.
+  #define CSS_ANON_BOX(name_, value_)                     \
+    static constexpr nsICSSAnonBoxPseudo* const& name_()  \
+    {                                                     \
+      return nsGkAtoms::AnonBox_##name_;                  \
+    }
+  #include "nsCSSAnonBoxList.h"
+  #undef CSS_ANON_BOX
 };
 
 #endif /* nsCSSAnonBoxes_h___ */
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -670,17 +670,17 @@ nsTableColGroupFrame*
 nsTableFrame::CreateSyntheticColGroupFrame()
 {
   nsIContent* colGroupContent = GetContent();
   nsPresContext* presContext = PresContext();
   nsIPresShell *shell = presContext->PresShell();
 
   RefPtr<ComputedStyle> colGroupStyle;
   colGroupStyle = shell->StyleSet()->
-    ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableColGroup);
+    ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableColGroup());
   // Create a col group frame
   nsTableColGroupFrame* newFrame =
     NS_NewTableColGroupFrame(shell, colGroupStyle);
   newFrame->SetIsSynthetic();
   newFrame->Init(colGroupContent, this, nullptr);
   return newFrame;
 }
 
@@ -729,17 +729,17 @@ nsTableFrame::AppendAnonymousColFrames(n
   int32_t startIndex = mColFrames.Length();
   int32_t lastIndex  = startIndex + aNumColsToAdd - 1;
 
   for (int32_t childX = startIndex; childX <= lastIndex; childX++) {
     // all anonymous cols that we create here use a pseudo ComputedStyle of the
     // col group
     nsIContent* iContent = aColGroupFrame->GetContent();
     RefPtr<ComputedStyle> computedStyle = shell->StyleSet()->
-      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableCol);
+      ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableCol());
     // ASSERTION to check for bug 54454 sneaking back in...
     NS_ASSERTION(iContent, "null content in CreateAnonymousColFrames");
 
     // create the new col frame
     nsIFrame* colFrame = NS_NewTableColFrame(shell, computedStyle);
     ((nsTableColFrame *) colFrame)->SetColType(aColType);
     colFrame->Init(iContent, aColGroupFrame, nullptr);
 
@@ -8196,35 +8196,35 @@ nsTableFrame::InvalidateTableFrame(nsIFr
   }
 }
 
 void
 nsTableFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
 {
   nsIFrame* wrapper = GetParent();
   MOZ_ASSERT(wrapper->Style()->GetPseudo() ==
-               nsCSSAnonBoxes::tableWrapper,
+               nsCSSAnonBoxes::tableWrapper(),
              "What happened to our parent?");
   aResult.AppendElement(
     OwnedAnonBox(wrapper, &UpdateStyleOfOwnedAnonBoxesForTableWrapper));
 }
 
 /* static */ void
 nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
   nsIFrame* aOwningFrame,
   nsIFrame* aWrapperFrame,
   ServoRestyleState& aRestyleState)
 {
   MOZ_ASSERT(aWrapperFrame->Style()->GetPseudo() ==
-               nsCSSAnonBoxes::tableWrapper,
+               nsCSSAnonBoxes::tableWrapper(),
              "What happened to our parent?");
 
   RefPtr<ComputedStyle> newStyle =
     aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(
-      nsCSSAnonBoxes::tableWrapper, aOwningFrame->Style());
+      nsCSSAnonBoxes::tableWrapper(), aOwningFrame->Style());
 
   // Figure out whether we have an actual change.  It's important that we do
   // this, even though all the wrapper's changes are due to properties it
   // inherits from us, because it's possible that no one ever asked us for those
   // style structs and hence changes to them aren't reflected in
   // the handled changes at all.
   //
   // Also note that extensions can add/remove stylesheets that change the styles
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -217,17 +217,17 @@ nscoord
 nsTreeBodyFrame::CalcMaxRowWidth()
 {
   if (mStringWidth != -1)
     return mStringWidth;
 
   if (!mView)
     return 0;
 
-  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow);
+  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
   nsMargin rowMargin(0,0,0,0);
   GetBorderPadding(rowContext, rowMargin);
 
   nscoord rowWidth;
   nsTreeColumn* col;
 
   RefPtr<gfxContext> rc =
     PresShell()->CreateReferenceRenderingContext();
@@ -994,23 +994,23 @@ nsTreeBodyFrame::GetCellAt(int32_t aX, i
   }
 
   nsTreeColumn* col;
   nsICSSAnonBoxPseudo* child;
   GetCellAt(point.x, point.y, aRow, &col, &child);
 
   if (col) {
     NS_ADDREF(*aCol = col);
-    if (child == nsCSSAnonBoxes::mozTreeCell)
+    if (child == nsCSSAnonBoxes::mozTreeCell())
       aChildElt.AssignLiteral("cell");
-    else if (child == nsCSSAnonBoxes::mozTreeTwisty)
+    else if (child == nsCSSAnonBoxes::mozTreeTwisty())
       aChildElt.AssignLiteral("twisty");
-    else if (child == nsCSSAnonBoxes::mozTreeImage)
+    else if (child == nsCSSAnonBoxes::mozTreeImage())
       aChildElt.AssignLiteral("image");
-    else if (child == nsCSSAnonBoxes::mozTreeCellText)
+    else if (child == nsCSSAnonBoxes::mozTreeCellText())
       aChildElt.AssignLiteral("text");
   }
 
   return NS_OK;
 }
 
 
 //
@@ -1072,24 +1072,24 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
     }
     // Now obtain the properties for our cell.
     PrefillPropertyArray(aRow, currCol);
 
     nsAutoString properties;
     mView->GetCellProperties(aRow, currCol, properties);
     nsTreeUtils::TokenizeProperties(properties, mScratchArray);
 
-    ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow);
+    ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
 
     // We don't want to consider any of the decorations that may be present
     // on the current row, so we have to deflate the rect by the border and
     // padding and offset its left and top coordinates appropriately.
     AdjustForBorderPadding(rowContext, cellRect);
 
-    ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell);
+    ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
 
     NS_NAMED_LITERAL_CSTRING(cell, "cell");
     if (currCol->IsCycler() || cell.Equals(aElement)) {
       // If the current Column is a Cycler, then the Rect is just the cell - the margins.
       // Similarly, if we're just being asked for the cell rect, provide it.
 
       theRect = cellRect;
       nsMargin cellMargin;
@@ -1122,17 +1122,17 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
       mView->GetLevel(aRow, &level);
       if (!isRTL)
         cellX += mIndentation * level;
       remainWidth -= mIndentation * level;
 
       // Find the twisty rect by computing its size.
       nsRect imageRect;
       nsRect twistyRect(cellRect);
-      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
       GetTwistyRect(aRow, currCol, imageRect, twistyRect, presContext,
                     twistyContext);
 
       if (NS_LITERAL_CSTRING("twisty").Equals(aElement)) {
         // If we're looking for the twisty Rect, just return the size
         theRect = twistyRect;
         break;
       }
@@ -1145,17 +1145,17 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
 
       // Adjust our working X value with the twisty width (image size, margins,
       // borders, padding.
       if (!isRTL)
         cellX += twistyRect.width;
     }
 
     // Cell Image
-    ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage);
+    ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage());
 
     nsRect imageSize = GetImageSize(aRow, currCol, false, imageContext);
     if (NS_LITERAL_CSTRING("image").Equals(aElement)) {
       theRect = imageSize;
       theRect.x = cellX;
       theRect.y = cellRect.y;
       break;
     }
@@ -1181,17 +1181,17 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
     // remaining width we have left to traverse in the cell, which will be the
     // widest possible value for the text rect, and the row height.
     nsRect textRect(cellX, cellRect.y, remainWidth, cellRect.height);
 
     // Measure the width of the text. If the width of the text is greater than
     // the remaining width available, then we just assume that the text has
     // been cropped and use the remaining rect as the text Rect. Otherwise,
     // we add in borders and padding to the text dimension and give that back.
-    ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText);
+    ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText());
 
     RefPtr<nsFontMetrics> fm =
       nsLayoutUtils::GetFontMetricsForComputedStyle(textContext, presContext);
     nscoord height = fm->MaxHeight();
 
     nsMargin textMargin;
     textContext->StyleMargin()->GetMargin(textMargin);
     textRect.Deflate(textMargin);
@@ -1433,31 +1433,31 @@ nsTreeBodyFrame::GetItemWithinCellAt(nsc
 
   // Obtain the properties for our cell.
   PrefillPropertyArray(aRowIndex, aColumn);
   nsAutoString properties;
   mView->GetCellProperties(aRowIndex, aColumn, properties);
   nsTreeUtils::TokenizeProperties(properties, mScratchArray);
 
   // Resolve style for the cell.
-  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell);
+  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
 
   // Obtain the margins for the cell and then deflate our rect by that
   // amount.  The cell is assumed to be contained within the deflated rect.
   nsRect cellRect(aCellRect);
   nsMargin cellMargin;
   cellContext->StyleMargin()->GetMargin(cellMargin);
   cellRect.Deflate(cellMargin);
 
   // Adjust the rect for its border and padding.
   AdjustForBorderPadding(cellContext, cellRect);
 
   if (aX < cellRect.x || aX >= cellRect.x + cellRect.width) {
     // The user clicked within the cell's margins/borders/padding.  This constitutes a click on the cell.
-    return nsCSSAnonBoxes::mozTreeCell;
+    return nsCSSAnonBoxes::mozTreeCell();
   }
 
   nscoord currX = cellRect.x;
   nscoord remainingWidth = cellRect.width;
 
   // Handle right alignment hit testing.
   bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
 
@@ -1472,33 +1472,33 @@ nsTreeBodyFrame::GetItemWithinCellAt(nsc
 
     if (!isRTL)
       currX += mIndentation*level;
     remainingWidth -= mIndentation*level;
 
     if ((isRTL && aX > currX + remainingWidth) ||
         (!isRTL && aX < currX)) {
       // The user clicked within the indentation.
-      return nsCSSAnonBoxes::mozTreeCell;
+      return nsCSSAnonBoxes::mozTreeCell();
     }
 
     // Always leave space for the twisty.
     nsRect twistyRect(currX, cellRect.y, remainingWidth, cellRect.height);
     bool hasTwisty = false;
     bool isContainer = false;
     mView->IsContainer(aRowIndex, &isContainer);
     if (isContainer) {
       bool isContainerEmpty = false;
       mView->IsContainerEmpty(aRowIndex, &isContainerEmpty);
       if (!isContainerEmpty)
         hasTwisty = true;
     }
 
     // Resolve style for the twisty.
-    ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+    ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
 
     nsRect imageSize;
     GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, presContext,
                   twistyContext);
 
     // We will treat a click as hitting the twisty if it happens on the margins, borders, padding,
     // or content of the twisty object.  By allowing a "slop" into the margin, we make it a little
     // bit easier for a user to hit the twisty.  (We don't want to be too picky here.)
@@ -1508,73 +1508,73 @@ nsTreeBodyFrame::GetItemWithinCellAt(nsc
     if (isRTL)
       twistyRect.x = currX + remainingWidth - twistyRect.width;
 
     // Now we test to see if aX is actually within the twistyRect.  If it is, and if the item should
     // have a twisty, then we return "twisty".  If it is within the rect but we shouldn't have a twisty,
     // then we return "cell".
     if (aX >= twistyRect.x && aX < twistyRect.x + twistyRect.width) {
       if (hasTwisty)
-        return nsCSSAnonBoxes::mozTreeTwisty;
+        return nsCSSAnonBoxes::mozTreeTwisty();
       else
-        return nsCSSAnonBoxes::mozTreeCell;
+        return nsCSSAnonBoxes::mozTreeCell();
     }
 
     if (!isRTL)
       currX += twistyRect.width;
     remainingWidth -= twistyRect.width;
   }
 
   // Now test to see if the user hit the icon for the cell.
   nsRect iconRect(currX, cellRect.y, remainingWidth, cellRect.height);
 
   // Resolve style for the image.
-  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage);
+  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage());
 
   nsRect iconSize = GetImageSize(aRowIndex, aColumn, false, imageContext);
   nsMargin imageMargin;
   imageContext->StyleMargin()->GetMargin(imageMargin);
   iconSize.Inflate(imageMargin);
   iconRect.width = iconSize.width;
   if (isRTL)
     iconRect.x = currX + remainingWidth - iconRect.width;
 
   if (aX >= iconRect.x && aX < iconRect.x + iconRect.width) {
     // The user clicked on the image.
-    return nsCSSAnonBoxes::mozTreeImage;
+    return nsCSSAnonBoxes::mozTreeImage();
   }
 
   if (!isRTL)
     currX += iconRect.width;
   remainingWidth -= iconRect.width;
 
   nsAutoString cellText;
   mView->GetCellText(aRowIndex, aColumn, cellText);
   // We're going to measure this text so we need to ensure bidi is enabled if
   // necessary
   CheckTextForBidi(cellText);
 
   nsRect textRect(currX, cellRect.y, remainingWidth, cellRect.height);
 
-  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText);
+  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText());
 
   nsMargin textMargin;
   textContext->StyleMargin()->GetMargin(textMargin);
   textRect.Deflate(textMargin);
 
   AdjustForBorderPadding(textContext, textRect);
 
   RefPtr<nsFontMetrics> fm =
     nsLayoutUtils::GetFontMetricsForComputedStyle(textContext, presContext);
   AdjustForCellText(cellText, aRowIndex, aColumn, *rc, *fm, textRect);
 
   if (aX >= textRect.x && aX < textRect.x + textRect.width)
-    return nsCSSAnonBoxes::mozTreeCellText;
+    return nsCSSAnonBoxes::mozTreeCellText();
   else
-    return nsCSSAnonBoxes::mozTreeCell;
+    return nsCSSAnonBoxes::mozTreeCell();
 }
 
 void
 nsTreeBodyFrame::GetCellAt(nscoord aX, nscoord aY, int32_t* aRow,
                            nsTreeColumn** aCol,
                            nsICSSAnonBoxPseudo** aChildElt)
 {
   *aCol = nullptr;
@@ -1602,17 +1602,17 @@ nsTreeBodyFrame::GetCellAt(nscoord aX, n
       continue;
 
     if (aX >= cellRect.x && aX < cellRect.x + cellRect.width) {
       // We know the column hit now.
       *aCol = currCol;
 
       if (currCol->IsCycler())
         // Cyclers contain only images.  Fill this in immediately and return.
-        *aChildElt = nsCSSAnonBoxes::mozTreeImage;
+        *aChildElt = nsCSSAnonBoxes::mozTreeImage();
       else
         *aChildElt = GetItemWithinCellAt(aX, cellRect, *aRow, currCol);
       break;
     }
   }
 }
 
 nsresult
@@ -1630,49 +1630,49 @@ nsTreeBodyFrame::GetCellWidth(int32_t aR
 
   nsRect cellRect(0, 0, colWidth, mRowHeight);
 
   int32_t overflow = cellRect.x+cellRect.width-(mInnerBox.x+mInnerBox.width);
   if (overflow > 0)
     cellRect.width -= overflow;
 
   // Adjust borders and padding for the cell.
-  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell);
+  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
   nsMargin bp(0,0,0,0);
   GetBorderPadding(cellContext, bp);
 
   aCurrentSize = cellRect.width;
   aDesiredSize = bp.left + bp.right;
 
   if (aCol->IsPrimary()) {
     // If the current Column is a Primary, then we need to take into account
     // the indentation and possibly a twisty.
 
     // The amount of indentation is the indentation width (|mIndentation|) by the level.
     int32_t level;
     mView->GetLevel(aRow, &level);
     aDesiredSize += mIndentation * level;
 
     // Find the twisty rect by computing its size.
-    ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+    ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
 
     nsRect imageSize;
     nsRect twistyRect(cellRect);
     GetTwistyRect(aRow, aCol, imageSize, twistyRect, PresContext(),
                   twistyContext);
 
     // Add in the margins of the twisty element.
     nsMargin twistyMargin;
     twistyContext->StyleMargin()->GetMargin(twistyMargin);
     twistyRect.Inflate(twistyMargin);
 
     aDesiredSize += twistyRect.width;
   }
 
-  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage);
+  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage());
 
   // Account for the width of the cell image.
   nsRect imageSize = GetImageSize(aRow, aCol, false, imageContext);
   // Add in the margins of the cell image.
   nsMargin imageMargin;
   imageContext->StyleMargin()->GetMargin(imageMargin);
   imageSize.Inflate(imageMargin);
 
@@ -1680,17 +1680,17 @@ nsTreeBodyFrame::GetCellWidth(int32_t aR
 
   // Get the cell text.
   nsAutoString cellText;
   mView->GetCellText(aRow, aCol, cellText);
   // We're going to measure this text so we need to ensure bidi is enabled if
   // necessary
   CheckTextForBidi(cellText);
 
-  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText);
+  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText());
 
   // Get the borders and padding for the text.
   GetBorderPadding(textContext, bp);
 
   RefPtr<nsFontMetrics> fm =
     nsLayoutUtils::GetFontMetricsForComputedStyle(textContext, PresContext());
   // Get the width of the text itself
   nscoord width = nsLayoutUtils::AppUnitWidthOfStringBidi(cellText, this, *fm,
@@ -2336,17 +2336,17 @@ nsTreeBodyFrame::GetImageSourceRect(Comp
   return r;
 }
 
 int32_t nsTreeBodyFrame::GetRowHeight()
 {
   // Look up the correct height.  It is equal to the specified height
   // + the specified margins.
   mScratchArray.Clear();
-  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow);
+  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
   if (rowContext) {
     const nsStylePosition* myPosition = rowContext->StylePosition();
 
     nscoord minHeight = 0;
     if (myPosition->mMinHeight.GetUnit() == eStyleUnit_Coord)
       minHeight = myPosition->mMinHeight.GetCoordValue();
 
     nscoord height = 0;
@@ -2374,17 +2374,17 @@ int32_t nsTreeBodyFrame::GetRowHeight()
 
   return nsPresContext::CSSPixelsToAppUnits(18); // As good a default as any.
 }
 
 int32_t nsTreeBodyFrame::GetIndentation()
 {
   // Look up the correct indentation.  It is equal to the specified indentation width.
   mScratchArray.Clear();
-  ComputedStyle* indentContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeIndentation);
+  ComputedStyle* indentContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeIndentation());
   if (indentContext) {
     const nsStylePosition* myPosition = indentContext->StylePosition();
     if (myPosition->mWidth.GetUnit() == eStyleUnit_Coord)  {
       nscoord val = myPosition->mWidth.GetCoordValue();
       return val;
     }
   }
 
@@ -2779,17 +2779,17 @@ nsTreeBodyFrame::BuildDisplayList(nsDisp
       bool isSelected;
       selection->IsSelected(i, &isSelected);
       if (isSelected) {
         PrefillPropertyArray(i, nullptr);
         nsAutoString properties;
         mView->GetRowProperties(i, properties);
         nsTreeUtils::TokenizeProperties(properties, mScratchArray);
         ComputedStyle* rowContext =
-          GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow);
+          GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
         auto appearance = rowContext->StyleDisplay()->mAppearance;
         if (appearance != StyleAppearance::None) {
           if (theme->ThemeSupportsWidget(PresContext(), this, appearance)) {
             nsITheme::ThemeGeometryType type =
               theme->ThemeGeometryTypeForWidget(this, appearance);
             if (type != nsITheme::eThemeGeometryTypeUnknown) {
               nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight *
                              (i - FirstVisibleRow()), mInnerBox.width,
@@ -2903,17 +2903,17 @@ nsTreeBodyFrame::PaintColumn(nsTreeColum
   // Now obtain the properties for our cell.
   PrefillPropertyArray(-1, aColumn);
   nsAutoString properties;
   mView->GetColumnProperties(aColumn, properties);
   nsTreeUtils::TokenizeProperties(properties, mScratchArray);
 
   // Resolve style for the column.  It contains all the info we need to lay ourselves
   // out and to paint.
-  ComputedStyle* colContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeColumn);
+  ComputedStyle* colContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeColumn());
 
   // Obtain the margins for the cell and then deflate our rect by that
   // amount.  The cell is assumed to be contained within the deflated rect.
   nsRect colRect(aColumnRect);
   nsMargin colMargin;
   colContext->StyleMargin()->GetMargin(colMargin);
   colRect.Deflate(colMargin);
 
@@ -2945,17 +2945,17 @@ nsTreeBodyFrame::PaintRow(int32_t       
   PrefillPropertyArray(aRowIndex, nullptr);
 
   nsAutoString properties;
   mView->GetRowProperties(aRowIndex, properties);
   nsTreeUtils::TokenizeProperties(properties, mScratchArray);
 
   // Resolve style for the row.  It contains all the info we need to lay ourselves
   // out and to paint.
-  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow);
+  ComputedStyle* rowContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
 
   // Obtain the margins for the row and then deflate our rect by that
   // amount.  The row is assumed to be contained within the deflated rect.
   nsRect rowRect(aRowRect);
   nsMargin rowMargin;
   rowContext->StyleMargin()->GetMargin(rowMargin);
   rowRect.Deflate(rowMargin);
 
@@ -3085,17 +3085,17 @@ nsTreeBodyFrame::PaintRow(int32_t       
 ImgDrawResult
 nsTreeBodyFrame::PaintSeparator(int32_t              aRowIndex,
                                 const nsRect&        aSeparatorRect,
                                 nsPresContext*      aPresContext,
                                 gfxContext&          aRenderingContext,
                                 const nsRect&        aDirtyRect)
 {
   // Resolve style for the separator.
-  ComputedStyle* separatorContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeSeparator);
+  ComputedStyle* separatorContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeSeparator());
   bool useTheme = false;
   nsITheme *theme = nullptr;
   const nsStyleDisplay* displayData = separatorContext->StyleDisplay();
   if (displayData->HasAppearance()) {
     theme = aPresContext->GetTheme();
     if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, displayData->mAppearance))
       useTheme = true;
   }
@@ -3156,17 +3156,17 @@ nsTreeBodyFrame::PaintCell(int32_t      
   // XXX Automatically fill in the following props: open, closed, container, leaf, selected, focused, and the col ID.
   PrefillPropertyArray(aRowIndex, aColumn);
   nsAutoString properties;
   mView->GetCellProperties(aRowIndex, aColumn, properties);
   nsTreeUtils::TokenizeProperties(properties, mScratchArray);
 
   // Resolve style for the cell.  It contains all the info we need to lay ourselves
   // out and to paint.
-  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell);
+  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
 
   bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
 
   // Obtain the margins for the cell and then deflate our rect by that
   // amount.  The cell is assumed to be contained within the deflated rect.
   nsRect cellRect(aCellRect);
   nsMargin cellMargin;
   cellContext->StyleMargin()->GetMargin(cellMargin);
@@ -3195,26 +3195,26 @@ nsTreeBodyFrame::PaintCell(int32_t      
     int32_t level;
     mView->GetLevel(aRowIndex, &level);
 
     if (!isRTL)
       currX += mIndentation * level;
     remainingWidth -= mIndentation * level;
 
     // Resolve the style to use for the connecting lines.
-    ComputedStyle* lineContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeLine);
+    ComputedStyle* lineContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeLine());
 
     if (mIndentation && level &&
         lineContext->StyleVisibility()->IsVisibleOrCollapsed()) {
       // Paint the thread lines.
 
       // Get the size of the twisty. We don't want to paint the twisty
       // before painting of connecting lines since it would paint lines over
       // the twisty. But we need to leave a place for it.
-      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
 
       nsRect imageSize;
       nsRect twistyRect(aCellRect);
       GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, aPresContext,
                     twistyContext);
 
       nsMargin twistyMargin;
       twistyContext->StyleMargin()->GetMargin(twistyMargin);
@@ -3347,17 +3347,17 @@ nsTreeBodyFrame::PaintTwisty(int32_t    
   if (isContainer) {
     bool isContainerEmpty = false;
     mView->IsContainerEmpty(aRowIndex, &isContainerEmpty);
     if (!isContainerEmpty)
       shouldPaint = true;
   }
 
   // Resolve style for the twisty.
-  ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+  ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
 
   // Obtain the margins for the twisty and then deflate our rect by that
   // amount.  The twisty is assumed to be contained within the deflated rect.
   nsRect twistyRect(aTwistyRect);
   nsMargin twistyMargin;
   twistyContext->StyleMargin()->GetMargin(twistyMargin);
   twistyRect.Deflate(twistyMargin);
 
@@ -3443,17 +3443,17 @@ nsTreeBodyFrame::PaintImage(int32_t     
                             nscoord&              aCurrX,
                             nsDisplayListBuilder* aBuilder)
 {
   MOZ_ASSERT(aColumn && aColumn->GetFrame(), "invalid column passed");
 
   bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
   nscoord rightEdge = aCurrX + aRemainingWidth;
   // Resolve style for the image.
-  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage);
+  ComputedStyle* imageContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeImage());
 
   // Obtain opacity value for the image.
   float opacity = imageContext->StyleEffects()->mOpacity;
 
   // Obtain the margins for the image and then deflate our rect by that
   // amount.  The image is assumed to be contained within the deflated rect.
   nsRect imageRect(aImageRect);
   nsMargin imageMargin;
@@ -3641,17 +3641,17 @@ nsTreeBodyFrame::PaintText(int32_t      
     return result;
   }
 
   int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
   DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
 
   // Resolve style for the text.  It contains all the info we need to lay ourselves
   // out and to paint.
-  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText);
+  ComputedStyle* textContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCellText());
 
   // Obtain opacity value for the image.
   float opacity = textContext->StyleEffects()->mOpacity;
 
   // Obtain the margins for the text and then deflate our rect by that
   // amount.  The text is assumed to be contained within the deflated rect.
   nsRect textRect(aTextRect);
   nsMargin textMargin;
@@ -3717,17 +3717,17 @@ nsTreeBodyFrame::PaintText(int32_t      
   }
   if (decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
     fontMet->GetStrikeout(offset, size);
     nsRect r(textRect.x, textRect.y + baseline - offset, textRect.width, size);
     Rect devPxRect =
       NSRectToSnappedRect(r, appUnitsPerDevPixel, *drawTarget);
     drawTarget->FillRect(devPxRect, color);
   }
-  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell);
+  ComputedStyle* cellContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
 
   if (opacity != 1.0f) {
     aRenderingContext.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, opacity);
   }
 
   aRenderingContext.SetColor(Color::FromABGR(textContext->StyleColor()->mColor));
   nsLayoutUtils::DrawString(this, *fontMet, &aRenderingContext, text.get(),
                             text.Length(),
@@ -3747,17 +3747,17 @@ nsTreeBodyFrame::PaintCheckbox(int32_t  
                                const nsRect&        aCheckboxRect,
                                nsPresContext*      aPresContext,
                                gfxContext&          aRenderingContext,
                                const nsRect&        aDirtyRect)
 {
   MOZ_ASSERT(aColumn && aColumn->GetFrame(), "invalid column passed");
 
   // Resolve style for the checkbox.
-  ComputedStyle* checkboxContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCheckbox);
+  ComputedStyle* checkboxContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCheckbox());
 
   nscoord rightEdge = aCheckboxRect.XMost();
 
   // Obtain the margins for the checkbox and then deflate our rect by that
   // amount.  The checkbox is assumed to be contained within the deflated rect.
   nsRect checkboxRect(aCheckboxRect);
   nsMargin checkboxMargin;
   checkboxContext->StyleMargin()->GetMargin(checkboxMargin);
@@ -3838,17 +3838,17 @@ nsTreeBodyFrame::PaintDropFeedback(const
     currX += aPt.x - mHorzPosition;
   } else {
     currX = aDropFeedbackRect.x;
   }
 
   PrefillPropertyArray(mSlots->mDropRow, primaryCol);
 
   // Resolve the style to use for the drop feedback.
-  ComputedStyle* feedbackContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeDropFeedback);
+  ComputedStyle* feedbackContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeDropFeedback());
 
   ImgDrawResult result = ImgDrawResult::SUCCESS;
 
   // Paint only if it is visible.
   if (feedbackContext->StyleVisibility()->IsVisibleOrCollapsed()) {
     int32_t level;
     mView->GetLevel(mSlots->mDropRow, &level);
 
@@ -3869,17 +3869,17 @@ nsTreeBodyFrame::PaintDropFeedback(const
         if (nextLevel > level)
           level = nextLevel;
       }
     }
 
     currX += mIndentation * level;
 
     if (primaryCol){
-      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty);
+      ComputedStyle* twistyContext = GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeTwisty());
       nsRect imageSize;
       nsRect twistyRect;
       GetTwistyRect(mSlots->mDropRow, primaryCol, imageSize, twistyRect,
                     aPresContext, twistyContext);
       nsMargin twistyMargin;
       twistyContext->StyleMargin()->GetMargin(twistyMargin);
       twistyRect.Inflate(twistyMargin);
       currX += twistyRect.width;
--- a/servo/components/style/gecko/regen_atoms.py
+++ b/servo/components/style/gecko/regen_atoms.py
@@ -34,57 +34,47 @@ def msvc64_symbolify(source, ident, ty):
 
 def msvc32_symbolify(source, ident, ty):
     # Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
     # See https://github.com/rust-lang/rust/issues/36097
     return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, ty)
 
 
 class GkAtomSource:
-    PATTERN = re.compile('^(GK_ATOM)\(([^,]*),[^"]*"([^"]*)",\s*([^)]*)\)',
+    PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
                          re.MULTILINE)
     FILE = "include/nsGkAtomList.h"
     CLASS = "nsGkAtoms"
-    TYPE = "nsStaticAtom"
-
-
-class CSSAnonBoxesAtomSource:
-    PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX|CSS_WRAPPER_ANON_BOX)\(([^,]*),[^"]*"([^"]*)"()\)',  # NOQA: E501
-                         re.MULTILINE)
-    FILE = "include/nsCSSAnonBoxList.h"
-    CLASS = "nsCSSAnonBoxes"
-    TYPE = "nsICSSAnonBoxPseudo"
 
 
 SOURCES = [
     GkAtomSource,
-    CSSAnonBoxesAtomSource,
 ]
 
 
 def map_atom(ident):
     if ident in {"box", "loop", "match", "mod", "ref",
                  "self", "type", "use", "where", "in"}:
         return ident + "_"
     return ident
 
 
 class Atom:
-    def __init__(self, source, macro_name, ident, value, ty):
+    def __init__(self, source, ident, value, ty, atom_type):
         self.ident = "{}_{}".format(source.CLASS, ident)
         self.original_ident = ident
         self.value = value
         self.source = source
-        self.macro = macro_name
+        # The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
         self.ty = ty
-        if self.is_pseudo():
-            if self.is_non_anon_box_pseudo():
-                self.pseudo_ident = (ident.split("_", 1))[1]
-            else:
-                self.pseudo_ident = ident
+        # The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
+        # or "InheritingAnonBox"
+        self.atom_type = atom_type
+        if self.is_pseudo() or self.is_anon_box():
+            self.pseudo_ident = (ident.split("_", 1))[1]
         if self.is_anon_box():
             assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
 
     def cpp_class(self):
         return self.source.CLASS
 
     def gnu_symbol(self):
         return gnu_symbolify(self.source, self.original_ident)
@@ -97,45 +87,40 @@ class Atom:
 
     def type(self):
         return self.ty
 
     def capitalized_pseudo(self):
         return self.pseudo_ident[0].upper() + self.pseudo_ident[1:]
 
     def is_pseudo(self):
-        return self.is_non_anon_box_pseudo() or self.is_anon_box()
-
-    def is_non_anon_box_pseudo(self):
-        return self.type() == "nsICSSPseudoElement"
+        return self.atom_type == "PseudoElementAtom"
 
     def is_anon_box(self):
-        return self.type() == "nsICSSAnonBoxPseudo"
+        return self.is_non_inheriting_anon_box() or self.is_inheriting_anon_box()
 
     def is_non_inheriting_anon_box(self):
-        return self.macro == "CSS_NON_INHERITING_ANON_BOX"
+        return self.atom_type == "NonInheritingAnonBoxAtom"
 
     def is_inheriting_anon_box(self):
-        return (self.macro == "CSS_ANON_BOX" or
-                self.macro == "CSS_WRAPPER_ANON_BOX")
+        return self.atom_type == "InheritingAnonBoxAtom"
 
     def is_tree_pseudo_element(self):
         return self.value.startswith(":-moz-tree-")
 
 
 def collect_atoms(objdir):
     atoms = []
     for source in SOURCES:
         path = os.path.abspath(os.path.join(objdir, source.FILE))
         print("cargo:rerun-if-changed={}".format(path))
         with open(path) as f:
             content = f.read()
             for result in source.PATTERN.finditer(content):
-                ty = result.group(4) or source.TYPE
-                atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), ty))
+                atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), result.group(4)))
     return atoms
 
 
 class FileAvoidWrite(BytesIO):
     """File-like object that buffers output and only writes if content changed."""
     def __init__(self, filename):
         BytesIO.__init__(self)
         self.name = filename
--- a/xpcom/ds/Atom.py
+++ b/xpcom/ds/Atom.py
@@ -3,13 +3,29 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 class Atom():
     def __init__(self, ident, string, ty="nsStaticAtom"):
         self.ident = ident
         self.string = string
         self.ty = ty
+        self.atom_type = self.__class__.__name__
 
 
 class PseudoElementAtom(Atom):
     def __init__(self, ident, string):
         Atom.__init__(self, ident, string, ty="nsICSSPseudoElement")
+
+
+class AnonBoxAtom(Atom):
+    def __init__(self, ident, string):
+        Atom.__init__(self, ident, string, ty="nsICSSAnonBoxPseudo")
+
+
+class NonInheritingAnonBoxAtom(AnonBoxAtom):
+    def __init__(self, ident, string):
+        AnonBoxAtom.__init__(self, ident, string)
+
+
+class InheritingAnonBoxAtom(AnonBoxAtom):
+    def __init__(self, ident, string):
+        AnonBoxAtom.__init__(self, ident, string)
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -1,19 +1,23 @@
 # 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/.
 
-from Atom import Atom, PseudoElementAtom
+# flake8: noqa
+
+from Atom import Atom, InheritingAnonBoxAtom, NonInheritingAnonBoxAtom
+from Atom import PseudoElementAtom
 from HTMLAtoms import HTML_PARSER_ATOMS
 import sys
 
 # Static atom definitions, used to generate nsGkAtomList.h.
 #
-# Each atom is defined by a call to Atom or PseudoElementAtom.
+# Each atom is defined by a call to Atom, PseudoElementAtom,
+# NonInheritingAnonBoxAtom or InheritingAnonBoxAtom.
 #
 # The first argument is the atom's identifier.
 # The second argument is the atom's string value.
 #
 # It is not possible to conditionally define static atoms with #ifdef etc.
 STATIC_ATOMS = [
     # --------------------------------------------------------------------------
     # Generic atoms
@@ -2259,16 +2263,76 @@ STATIC_ATOMS = [
     PseudoElementAtom("PseudoElement_mozNumberSpinDown", ":-moz-number-spin-down"),
     PseudoElementAtom("PseudoElement_mozProgressBar", ":-moz-progress-bar"),
     PseudoElementAtom("PseudoElement_mozRangeTrack", ":-moz-range-track"),
     PseudoElementAtom("PseudoElement_mozRangeProgress", ":-moz-range-progress"),
     PseudoElementAtom("PseudoElement_mozRangeThumb", ":-moz-range-thumb"),
     PseudoElementAtom("PseudoElement_mozMeterBar", ":-moz-meter-bar"),
     PseudoElementAtom("PseudoElement_placeholder", ":placeholder"),
     PseudoElementAtom("PseudoElement_mozColorSwatch", ":-moz-color-swatch"),
+
+    # CSS anonymous boxes -- these must appear in the same order as
+    # in nsCSSAnonBoxList.h
+    NonInheritingAnonBoxAtom("AnonBox_oofPlaceholder", ":-moz-oof-placeholder"),
+    NonInheritingAnonBoxAtom("AnonBox_horizontalFramesetBorder", ":-moz-hframeset-border"),
+    NonInheritingAnonBoxAtom("AnonBox_verticalFramesetBorder", ":-moz-vframeset-border"),
+    NonInheritingAnonBoxAtom("AnonBox_framesetBlank", ":-moz-frameset-blank"),
+    NonInheritingAnonBoxAtom("AnonBox_tableColGroup", ":-moz-table-column-group"),
+    NonInheritingAnonBoxAtom("AnonBox_tableCol", ":-moz-table-column"),
+    NonInheritingAnonBoxAtom("AnonBox_pageBreak", ":-moz-pagebreak"),
+    InheritingAnonBoxAtom("AnonBox_mozText", ":-moz-text"),
+    InheritingAnonBoxAtom("AnonBox_firstLetterContinuation", ":-moz-first-letter-continuation"),
+    InheritingAnonBoxAtom("AnonBox_mozBlockInsideInlineWrapper", ":-moz-block-inside-inline-wrapper"),
+    InheritingAnonBoxAtom("AnonBox_mozMathMLAnonymousBlock", ":-moz-mathml-anonymous-block"),
+    InheritingAnonBoxAtom("AnonBox_mozXULAnonymousBlock", ":-moz-xul-anonymous-block"),
+    InheritingAnonBoxAtom("AnonBox_mozLineFrame", ":-moz-line-frame"),
+    InheritingAnonBoxAtom("AnonBox_buttonContent", ":-moz-button-content"),
+    InheritingAnonBoxAtom("AnonBox_cellContent", ":-moz-cell-content"),
+    InheritingAnonBoxAtom("AnonBox_dropDownList", ":-moz-dropdown-list"),
+    InheritingAnonBoxAtom("AnonBox_fieldsetContent", ":-moz-fieldset-content"),
+    InheritingAnonBoxAtom("AnonBox_mozDisplayComboboxControlFrame", ":-moz-display-comboboxcontrol-frame"),
+    InheritingAnonBoxAtom("AnonBox_htmlCanvasContent", ":-moz-html-canvas-content"),
+    InheritingAnonBoxAtom("AnonBox_inlineTable", ":-moz-inline-table"),
+    InheritingAnonBoxAtom("AnonBox_table", ":-moz-table"),
+    InheritingAnonBoxAtom("AnonBox_tableCell", ":-moz-table-cell"),
+    InheritingAnonBoxAtom("AnonBox_tableWrapper", ":-moz-table-wrapper"),
+    InheritingAnonBoxAtom("AnonBox_tableRowGroup", ":-moz-table-row-group"),
+    InheritingAnonBoxAtom("AnonBox_tableRow", ":-moz-table-row"),
+    InheritingAnonBoxAtom("AnonBox_canvas", ":-moz-canvas"),
+    InheritingAnonBoxAtom("AnonBox_page", ":-moz-page"),
+    InheritingAnonBoxAtom("AnonBox_pageContent", ":-moz-pagecontent"),
+    InheritingAnonBoxAtom("AnonBox_pageSequence", ":-moz-page-sequence"),
+    InheritingAnonBoxAtom("AnonBox_scrolledContent", ":-moz-scrolled-content"),
+    InheritingAnonBoxAtom("AnonBox_scrolledCanvas", ":-moz-scrolled-canvas"),
+    InheritingAnonBoxAtom("AnonBox_scrolledPageSequence", ":-moz-scrolled-page-sequence"),
+    InheritingAnonBoxAtom("AnonBox_columnContent", ":-moz-column-content"),
+    InheritingAnonBoxAtom("AnonBox_viewport", ":-moz-viewport"),
+    InheritingAnonBoxAtom("AnonBox_viewportScroll", ":-moz-viewport-scroll"),
+    InheritingAnonBoxAtom("AnonBox_anonymousFlexItem", ":-moz-anonymous-flex-item"),
+    InheritingAnonBoxAtom("AnonBox_anonymousGridItem", ":-moz-anonymous-grid-item"),
+    InheritingAnonBoxAtom("AnonBox_ruby", ":-moz-ruby"),
+    InheritingAnonBoxAtom("AnonBox_rubyBase", ":-moz-ruby-base"),
+    InheritingAnonBoxAtom("AnonBox_rubyBaseContainer", ":-moz-ruby-base-container"),
+    InheritingAnonBoxAtom("AnonBox_rubyText", ":-moz-ruby-text"),
+    InheritingAnonBoxAtom("AnonBox_rubyTextContainer", ":-moz-ruby-text-container"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeColumn", ":-moz-tree-column"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeRow", ":-moz-tree-row"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeSeparator", ":-moz-tree-separator"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeCell", ":-moz-tree-cell"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeIndentation", ":-moz-tree-indentation"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeLine", ":-moz-tree-line"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeTwisty", ":-moz-tree-twisty"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeImage", ":-moz-tree-image"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeCellText", ":-moz-tree-cell-text"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeCheckbox", ":-moz-tree-checkbox"),
+    InheritingAnonBoxAtom("AnonBox_mozTreeDropFeedback", ":-moz-tree-drop-feedback"),
+    InheritingAnonBoxAtom("AnonBox_mozSVGMarkerAnonChild", ":-moz-svg-marker-anon-child"),
+    InheritingAnonBoxAtom("AnonBox_mozSVGOuterSVGAnonChild", ":-moz-svg-outer-svg-anon-child"),
+    InheritingAnonBoxAtom("AnonBox_mozSVGForeignContent", ":-moz-svg-foreign-content"),
+    InheritingAnonBoxAtom("AnonBox_mozSVGText", ":-moz-svg-text"),
 ] + HTML_PARSER_ATOMS
 
 
 def verify():
     idents = set()
     strings = set()
     failed = False
     for atom in STATIC_ATOMS:
@@ -2285,30 +2349,39 @@ def verify():
 
 
 def generate_nsgkatomlist_h(output, *ignore):
     verify()
     output.write("/* THIS FILE IS AUTOGENERATED BY StaticAtoms.py.  DO NOT EDIT */\n\n"
                  "#ifdef small\n"
                  "#undef small\n"
                  "#endif\n\n"
-                 "// GK_ATOM(identifier, string, gecko_type)\n" +
-                 "".join(["GK_ATOM(%s, \"%s\", %s)\n" % (a.ident, a.string, a.ty)
+                 "// GK_ATOM(identifier, string, gecko_type, atom_type)\n" +
+                 "".join(["GK_ATOM(%s, \"%s\", %s, %s)\n" %
+                            (a.ident, a.string, a.ty, a.atom_type)
                           for a in STATIC_ATOMS]))
 
 
 def generate_nsgkatomconsts_h(output, *ignore):
     pseudo_index = None
+    anon_box_index = None
     pseudo_count = 0
+    anon_box_count = 0
     for i, atom in enumerate(STATIC_ATOMS):
-        if atom.ty is "nsICSSPseudoElement":
+        if atom.atom_type is "PseudoElementAtom":
             if pseudo_index is None:
                 pseudo_index = i
             pseudo_count += 1
+        elif atom.atom_type is "NonInheritingAnonBoxAtom" or atom.atom_type is "InheritingAnonBoxAtom":
+            if anon_box_index is None:
+                anon_box_index = i
+            anon_box_count += 1
     output.write("/* THIS IS AN AUTOGENERATED FILE.  DO NOT EDIT */\n\n"
                  "namespace mozilla {\n"
                  "  constexpr uint32_t kAtomIndex_PseudoElements = %d;\n"
                  "  constexpr uint32_t kAtomCount_PseudoElements = %d;\n"
-                 "}\n" % (pseudo_index, pseudo_count))
+                 "  constexpr uint32_t kAtomIndex_AnonBoxes = %d;\n"
+                 "  constexpr uint32_t kAtomCount_AnonBoxes = %d;\n"
+                 "}\n" % (pseudo_index, pseudo_count, anon_box_index, anon_box_count))
 
 
 if __name__ == '__main__':
     generate_nsgkatomlist_h(sys.stdout)
--- a/xpcom/ds/nsGkAtoms.cpp
+++ b/xpcom/ds/nsGkAtoms.cpp
@@ -6,34 +6,34 @@
 
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace detail {
 
 MOZ_PUSH_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
 extern constexpr GkAtoms gGkAtoms = {
-  #define GK_ATOM(name_, value_, type_) NS_STATIC_ATOM_INIT_STRING(value_)
+  #define GK_ATOM(name_, value_, type_, atom_type_) NS_STATIC_ATOM_INIT_STRING(value_)
   #include "nsGkAtomList.h"
   #undef GK_ATOM
   {
-    #define GK_ATOM(name_, value_, type_) \
+    #define GK_ATOM(name_, value_, type_, atom_type_) \
       NS_STATIC_ATOM_INIT_ATOM(nsStaticAtom, GkAtoms, name_, value_)
     #include "nsGkAtomList.h"
     #undef GK_ATOM
   }
 };
 MOZ_POP_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
 
 } // namespace detail
 } // namespace mozilla
 
 const nsStaticAtom* const nsGkAtoms::sAtoms = mozilla::detail::gGkAtoms.mAtoms;
 
-#define GK_ATOM(name_, value_, type_) \
+#define GK_ATOM(name_, value_, type_, atom_type_) \
   NS_STATIC_ATOM_DEFN_PTR( \
     type_, mozilla::detail::GkAtoms, mozilla::detail::gGkAtoms, \
     nsGkAtoms, name_)
 #include "nsGkAtomList.h"
 #undef GK_ATOM
 
 void nsGkAtoms::RegisterStaticAtoms()
 {
--- a/xpcom/ds/nsGkAtoms.h
+++ b/xpcom/ds/nsGkAtoms.h
@@ -15,31 +15,32 @@
 #define DEFINE_STATIC_ATOM_SUBCLASS(name_)                                    \
   class name_ : public nsStaticAtom                                           \
   {                                                                           \
   public:                                                                     \
     constexpr name_(const char16_t* aStr, uint32_t aLength, uint32_t aOffset) \
       : nsStaticAtom(aStr, aLength, aOffset) {}                               \
   };
 
+DEFINE_STATIC_ATOM_SUBCLASS(nsICSSAnonBoxPseudo)
 DEFINE_STATIC_ATOM_SUBCLASS(nsICSSPseudoElement)
 
 #undef DEFINE_STATIC_ATOM_SUBCLASS
 
 namespace mozilla {
 namespace detail {
 
 struct GkAtoms
 {
-  #define GK_ATOM(name_, value_, type_) NS_STATIC_ATOM_DECL_STRING(name_, value_)
+  #define GK_ATOM(name_, value_, type_, atom_type_) NS_STATIC_ATOM_DECL_STRING(name_, value_)
   #include "nsGkAtomList.h"
   #undef GK_ATOM
 
   enum class Atoms {
-    #define GK_ATOM(name_, value_, type_) NS_STATIC_ATOM_ENUM(name_)
+    #define GK_ATOM(name_, value_, type_, atom_type_) NS_STATIC_ATOM_ENUM(name_)
     #include "nsGkAtomList.h"
     #undef GK_ATOM
     AtomsCount
   };
 
   const nsStaticAtom mAtoms[static_cast<size_t>(Atoms::AtomsCount)];
 };
 
@@ -57,14 +58,14 @@ public:
   static void RegisterStaticAtoms();
 
   static nsStaticAtom* GetAtomByIndex(size_t aIndex)
   {
     MOZ_ASSERT(aIndex < sAtomsLen);
     return const_cast<nsStaticAtom*>(&sAtoms[aIndex]);
   }
 
-  #define GK_ATOM(name_, value_, type_) NS_STATIC_ATOM_DECL_PTR(type_, name_)
+  #define GK_ATOM(name_, value_, type_, atom_type_) NS_STATIC_ATOM_DECL_PTR(type_, name_)
   #include "nsGkAtomList.h"
   #undef GK_ATOM
 };
 
 #endif /* nsGkAtoms_h___ */