Bug 1274891 - Part 1: Use enum class for nsChangeHint. draft
authorBoris Chiou <boris.chiou@gmail.com>
Wed, 21 Dec 2016 15:11:02 +0800
changeset 453449 81fd4150d67311b92ea5b7ee1d8507ae352eb60d
parent 451264 567894f026558e6dada617a3998f29aed06ac7d8
child 453450 50d4f6df938aefa3230908918e44b36c478afff6
child 453485 9534365cbe541995854a633a566b167460feba66
push id39679
push userbmo:boris.chiou@gmail.com
push dateFri, 23 Dec 2016 15:19:32 +0000
bugs1274891
milestone53.0a1
Bug 1274891 - Part 1: Use enum class for nsChangeHint. Note: AllHints might be used by other modules in Linux, so we have to rename it, i.e. nsChangeHint::AllChangeHints, to pass the compilation. MozReview-Commit-ID: 1SRlmmJXEJC
dom/html/HTMLDetailsElement.cpp
dom/html/HTMLFrameSetElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLSelectElement.cpp
dom/html/HTMLTextAreaElement.cpp
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSwitchElement.cpp
dom/svg/SVGTransformableElement.cpp
dom/svg/nsSVGElement.cpp
dom/xul/nsXULElement.cpp
layout/base/PresShell.cpp
layout/base/RestyleManager.cpp
layout/base/RestyleManagerBase.cpp
layout/base/RestyleTracker.cpp
layout/base/RestyleTracker.h
layout/base/ServoRestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsChangeHint.h
layout/base/nsPresContext.cpp
layout/base/nsStyleChangeList.cpp
layout/style/LayerAnimationInfo.cpp
layout/style/nsStyleContext.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/svg/SVGGeometryFrame.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGContainerFrame.cpp
layout/svg/nsSVGEffects.cpp
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGImageFrame.cpp
layout/svg/nsSVGInnerSVGFrame.cpp
layout/svg/nsSVGUseFrame.cpp
layout/tables/nsTableFrame.cpp
--- a/dom/html/HTMLDetailsElement.cpp
+++ b/dom/html/HTMLDetailsElement.cpp
@@ -34,17 +34,17 @@ HTMLDetailsElement::GetFirstSummary() co
 
 nsChangeHint
 HTMLDetailsElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                            int32_t aModType) const
 {
   nsChangeHint hint =
     nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::open) {
-    hint |= nsChangeHint_ReconstructFrame;
+    hint |= nsChangeHint::ReconstructFrame;
   }
   return hint;
 }
 
 nsresult
 HTMLDetailsElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
                                   nsAttrValueOrString* aValue, bool aNotify)
 {
--- a/dom/html/HTMLFrameSetElement.cpp
+++ b/dom/html/HTMLFrameSetElement.cpp
@@ -80,25 +80,25 @@ HTMLFrameSetElement::SetAttr(int32_t aNa
    *  Once nsGenericHTMLElement::SetAttr returns, we want to go back to our
    *  normal hint, which is NS_STYLE_HINT_REFLOW.
    */
   if (aAttribute == nsGkAtoms::rows && aNameSpaceID == kNameSpaceID_None) {
     int32_t oldRows = mNumRows;
     ParseRowCol(aValue, mNumRows, &mRowSpecs);
 
     if (mNumRows != oldRows) {
-      mCurrentRowColHint = nsChangeHint_ReconstructFrame;
+      mCurrentRowColHint = nsChangeHint::ReconstructFrame;
     }
   } else if (aAttribute == nsGkAtoms::cols &&
              aNameSpaceID == kNameSpaceID_None) {
     int32_t oldCols = mNumCols;
     ParseRowCol(aValue, mNumCols, &mColSpecs);
 
     if (mNumCols != oldCols) {
-      mCurrentRowColHint = nsChangeHint_ReconstructFrame;
+      mCurrentRowColHint = nsChangeHint::ReconstructFrame;
     }
   }
 
   rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aAttribute, aPrefix,
                                      aValue, aNotify);
   mCurrentRowColHint = NS_STYLE_HINT_REFLOW;
 
   return rv;
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -331,21 +331,21 @@ HTMLImageElement::MapAttributesIntoRule(
 nsChangeHint
 HTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                          int32_t aModType) const
 {
   nsChangeHint retval =
     nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::usemap ||
       aAttribute == nsGkAtoms::ismap) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   } else if (aAttribute == nsGkAtoms::alt) {
     if (aModType == nsIDOMMutationEvent::ADDITION ||
         aModType == nsIDOMMutationEvent::REMOVAL) {
-      retval |= nsChangeHint_ReconstructFrame;
+      retval |= nsChangeHint::ReconstructFrame;
     }
   }
   return retval;
 }
 
 NS_IMETHODIMP_(bool)
 HTMLImageElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -5827,30 +5827,30 @@ HTMLInputElement::GetAttributeChangeHint
 {
   nsChangeHint retval =
     nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::type ||
       // The presence or absence of the 'directory' attribute determines what
       // buttons we show for type=file.
       aAttribute == nsGkAtoms::allowdirs ||
       aAttribute == nsGkAtoms::webkitdirectory) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   } else if (mType == NS_FORM_INPUT_IMAGE &&
              (aAttribute == nsGkAtoms::alt ||
               aAttribute == nsGkAtoms::value)) {
     // We might need to rebuild our alt text.  Just go ahead and
     // reconstruct our frame.  This should be quite rare..
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   } else if (aAttribute == nsGkAtoms::value) {
     retval |= NS_STYLE_HINT_REFLOW;
   } else if (aAttribute == nsGkAtoms::size &&
              IsSingleLineTextControl(false)) {
     retval |= NS_STYLE_HINT_REFLOW;
   } else if (PlaceholderApplies() && aAttribute == nsGkAtoms::placeholder) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   }
   return retval;
 }
 
 NS_IMETHODIMP_(bool)
 HTMLInputElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry attributes[] = {
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -1421,17 +1421,17 @@ HTMLSelectElement::MapAttributesIntoRule
 nsChangeHint
 HTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                           int32_t aModType) const
 {
   nsChangeHint retval =
       nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::multiple ||
       aAttribute == nsGkAtoms::size) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   }
   return retval;
 }
 
 NS_IMETHODIMP_(bool)
 HTMLSelectElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry* const map[] = {
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -459,19 +459,19 @@ HTMLTextAreaElement::GetAttributeChangeH
                                             int32_t aModType) const
 {
   nsChangeHint retval =
       nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::rows ||
       aAttribute == nsGkAtoms::cols) {
     retval |= NS_STYLE_HINT_REFLOW;
   } else if (aAttribute == nsGkAtoms::wrap) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   } else if (aAttribute == nsGkAtoms::placeholder) {
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   }
   return retval;
 }
 
 NS_IMETHODIMP_(bool)
 HTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry attributes[] = {
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -692,29 +692,29 @@ SVGSVGElement::ChildrenOnlyTransformChan
 
   bool hadChildrenOnlyTransform = mHasChildrenOnlyTransform;
 
   UpdateHasChildrenOnlyTransform();
 
   if (hadChildrenOnlyTransform != mHasChildrenOnlyTransform) {
     // Reconstruct the frame tree to handle stacking context changes:
     // XXXjwatt don't do this for root-<svg> or even outer-<svg>?
-    changeHint = nsChangeHint_ReconstructFrame;
+    changeHint = nsChangeHint::ReconstructFrame;
   } else {
     // We just assume the old and new transforms are different.
-    changeHint = nsChangeHint(nsChangeHint_UpdateOverflow |
-                              nsChangeHint_ChildrenOnlyTransform);
+    changeHint = nsChangeHint::UpdateOverflow |
+                 nsChangeHint::ChildrenOnlyTransform;
   }
 
   // If we're not reconstructing the frame tree, then we only call
   // PostRestyleEvent if we're not being called under reflow to avoid recursing
   // to death. See bug 767056 comments 10 and 12. Since our nsSVGOuterSVGFrame
   // is being reflowed we're going to invalidate and repaint its entire area
   // anyway (which will include our children).
-  if ((changeHint & nsChangeHint_ReconstructFrame) ||
+  if ((changeHint & nsChangeHint::ReconstructFrame) ||
       !(aFlags & eDuringReflow)) {
     nsLayoutUtils::PostRestyleEvent(this, nsRestyleHint(0), changeHint);
   }
 }
 
 nsresult
 SVGSVGElement::BindToTree(nsIDocument* aDocument,
                           nsIContent* aParent,
--- a/dom/svg/SVGSwitchElement.cpp
+++ b/dom/svg/SVGSwitchElement.cpp
@@ -60,17 +60,17 @@ SVGSwitchElement::MaybeInvalidate()
   if (newActiveChild == mActiveChild) {
     return;
   }
 
   nsIFrame *frame = GetPrimaryFrame();
   if (frame) {
     nsLayoutUtils::PostRestyleEvent(
       this, nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(frame);
   }
 
   mActiveChild = newActiveChild;
 }
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
--- a/dom/svg/SVGTransformableElement.cpp
+++ b/dom/svg/SVGTransformableElement.cpp
@@ -54,17 +54,17 @@ SVGTransformableElement::GetAttributeCha
                                                 int32_t aModType) const
 {
   nsChangeHint retval =
     nsSVGElement::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::transform ||
       aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) {
     nsIFrame* frame =
       const_cast<SVGTransformableElement*>(this)->GetPrimaryFrame();
-    retval |= nsChangeHint_InvalidateRenderingObservers;
+    retval |= nsChangeHint::InvalidateRenderingObservers;
     if (!frame || (frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
       return retval;
     }
 
     bool isAdditionOrRemoval = false;
     if (aModType == nsIDOMMutationEvent::ADDITION ||
         aModType == nsIDOMMutationEvent::REMOVAL) {
       isAdditionOrRemoval = true;
@@ -76,21 +76,21 @@ SVGTransformableElement::GetAttributeCha
           !mTransforms->HadTransformBeforeLastBaseValChange()) {
         // New or old value is empty; this is effectively addition or removal.
         isAdditionOrRemoval = true;
       }
     }
 
     if (isAdditionOrRemoval) {
       // Reconstruct the frame tree to handle stacking context changes:
-      retval |= nsChangeHint_ReconstructFrame;
+      retval |= nsChangeHint::ReconstructFrame;
     } else {
       // We just assume the old and new transforms are different.
-      retval |= nsChangeHint_UpdatePostTransformOverflow |
-                nsChangeHint_UpdateTransformLayer;
+      retval |= nsChangeHint::UpdatePostTransformOverflow |
+                nsChangeHint::UpdateTransformLayer;
     }
   }
   return retval;
 }
 
 bool
 SVGTransformableElement::IsEventAttributeName(nsIAtom* aName)
 {
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -881,17 +881,17 @@ nsSVGElement::GetAttributeChangeHint(con
   nsChangeHint retval =
     nsSVGElementBase::GetAttributeChangeHint(aAttribute, aModType);
 
   nsCOMPtr<SVGTests> tests = do_QueryObject(const_cast<nsSVGElement*>(this));
   if (tests && tests->IsConditionalProcessingAttribute(aAttribute)) {
     // It would be nice to only reconstruct the frame if the value returned by
     // SVGTests::PassesConditionalProcessingTests has changed, but we don't
     // know that
-    retval |= nsChangeHint_ReconstructFrame;
+    retval |= nsChangeHint::ReconstructFrame;
   }
   return retval;
 }
 
 bool
 nsSVGElement::IsNodeOfType(uint32_t aFlags) const
 {
   return !(aFlags & ~eCONTENT);
@@ -2392,17 +2392,17 @@ nsSVGElement::DidAnimateTransformList(in
     // will call nsNodeUtills::AttributeChanged, under which
     // SVGTransformableElement::GetAttributeChangeHint will be called and an
     // appropriate change event posted to update our frame's overflow rects.
     // The SetAttrAndNotify doesn't happen for transform changes caused by
     // 'animateTransform' though (and sending out the mutation events that
     // nsNodeUtills::AttributeChanged dispatches would be inappropriate
     // anyway), so we need to post the change event ourself.
     nsChangeHint changeHint = GetAttributeChangeHint(transformAttr, aModType);
-    if (changeHint) {
+    if (bool(changeHint)) {
       nsLayoutUtils::PostRestyleEvent(this, nsRestyleHint(0), changeHint);
     }
   }
 }
 
 nsSVGElement::StringAttributesInfo
 nsSVGElement::GetStringInfo()
 {
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1464,17 +1464,17 @@ nsXULElement::GetAttributeChangeHint(con
         (aModType == nsIDOMMutationEvent::REMOVAL ||
          aModType == nsIDOMMutationEvent::ADDITION)) {
       if (IsAnyOfXULElements(nsGkAtoms::label, nsGkAtoms::description))
         // Label and description dynamically morph between a normal
         // block and a cropping single-line XUL text frame.  If the
         // value attribute is being added or removed, then we need to
         // return a hint of frame change.  (See bugzilla bug 95475 for
         // details.)
-        retval = nsChangeHint_ReconstructFrame;
+        retval = nsChangeHint::ReconstructFrame;
     } else {
         // if left or top changes we reflow. This will happen in xul
         // containers that manage positioned children such as a stack.
         if (nsGkAtoms::left == aAttribute || nsGkAtoms::top == aAttribute ||
             nsGkAtoms::right == aAttribute || nsGkAtoms::bottom == aAttribute ||
             nsGkAtoms::start == aAttribute || nsGkAtoms::end == aAttribute)
             retval = NS_STYLE_HINT_REFLOW;
     }
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -2897,33 +2897,34 @@ PresShell::RecreateFramesFor(nsIContent*
 
   // Have to make sure that the content notifications are flushed before we
   // start messing with the frame model; otherwise we can get content doubling.
   mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
 
   nsAutoScriptBlocker scriptBlocker;
 
   nsStyleChangeList changeList;
-  changeList.AppendChange(nullptr, aContent, nsChangeHint_ReconstructFrame);
+  changeList.AppendChange(nullptr, aContent, nsChangeHint::ReconstructFrame);
 
   // Mark ourselves as not safe to flush while we're doing frame construction.
   ++mChangeNestCount;
   RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
   nsresult rv = restyleManager->ProcessRestyledFrames(changeList);
   restyleManager->FlushOverflowChangedTracker();
   --mChangeNestCount;
 
   return rv;
 }
 
 void
 nsIPresShell::PostRecreateFramesFor(Element* aElement)
 {
-  mPresContext->RestyleManager()->PostRestyleEvent(aElement, nsRestyleHint(0),
-                                                   nsChangeHint_ReconstructFrame);
+  mPresContext->RestyleManager()->
+    PostRestyleEvent(aElement, nsRestyleHint(0),
+                     nsChangeHint::ReconstructFrame);
 }
 
 void
 nsIPresShell::RestyleForAnimation(Element* aElement, nsRestyleHint aHint)
 {
   // Now that we no longer have separate non-animation and animation
   // restyles, this method having a distinct identity is less important,
   // but it still seems useful to offer as a "more public" API and as a
@@ -9681,17 +9682,17 @@ ReResolveMenusAndTrees(nsIFrame *aFrame,
 }
 
 static bool
 ReframeImageBoxes(nsIFrame *aFrame, void *aClosure)
 {
   nsStyleChangeList *list = static_cast<nsStyleChangeList*>(aClosure);
   if (aFrame->GetType() == nsGkAtoms::imageBoxFrame) {
     list->AppendChange(aFrame, aFrame->GetContent(),
-                       nsChangeHint_ReconstructFrame);
+                       nsChangeHint::ReconstructFrame);
     return false; // don't walk descendants
   }
   return true; // walk descendants
 }
 
 static void
 WalkFramesThroughPlaceholders(nsPresContext *aPresContext, nsIFrame *aFrame,
                               frameWalkerFn aFunc, void *aClosure)
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -140,17 +140,17 @@ RestyleManager::RestyleElement(Element* 
         }
         mRebuildAllExtraHint |= aMinHint;
         StartRebuildAllStyleData(aRestyleTracker);
         return;
       }
     }
   }
 
-  if (aMinHint & nsChangeHint_ReconstructFrame) {
+  if (aMinHint & nsChangeHint::ReconstructFrame) {
     FrameConstructor()->RecreateFramesForContent(aElement, false,
       nsCSSFrameConstructor::REMOVE_FOR_RECONSTRUCTION, nullptr);
   } else if (aPrimaryFrame) {
     ComputeAndProcessStyleChange(aPrimaryFrame, aMinHint, aRestyleTracker,
                                  aRestyleHint, aRestyleHintData);
   } else if (aRestyleHint & ~eRestyle_LaterSiblings) {
     // We're restyling an element with no frame, so we should try to
     // make one if its new style says it should have one.  But in order
@@ -307,18 +307,17 @@ RestyleManager::AttributeChanged(Element
 #if 0
   NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
      ("RestyleManager::AttributeChanged: content=%p[%s] frame=%p",
       aContent, ContentTag(aElement, 0), frame));
 #endif
 
   // the style tag has its own interpretation based on aHint
   nsChangeHint hint = aElement->GetAttributeChangeHint(aAttribute, aModType);
-
-  bool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;
+  bool reframe = !!(hint & nsChangeHint::ReconstructFrame);
 
 #ifdef MOZ_XUL
   // The following listbox widget trap prevents offscreen listbox widget
   // content from being removed and re-inserted (which is what would
   // happen otherwise).
   if (!primaryFrame && !reframe) {
     int32_t namespaceID;
     nsIAtom* tag = PresContext()->Document()->BindingManager()->
@@ -349,17 +348,17 @@ RestyleManager::AttributeChanged(Element
     const nsStyleDisplay* disp = primaryFrame->StyleDisplay();
     if (disp->mAppearance) {
       nsITheme* theme = PresContext()->GetTheme();
       if (theme && theme->ThemeSupportsWidget(PresContext(), primaryFrame, disp->mAppearance)) {
         bool repaint = false;
         theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
             &repaint, aOldValue);
         if (repaint)
-          hint |= nsChangeHint_RepaintFrame;
+          hint |= nsChangeHint::RepaintFrame;
       }
     }
 
     // let the frame deal with it now, so we don't have to deal later
     primaryFrame->AttributeChanged(aNameSpaceID, aAttribute, aModType);
     // XXXwaterson should probably check for IB split siblings
     // here, and propagate the AttributeChanged notification to
     // them, as well. Currently, inline frames don't do anything on
@@ -669,17 +668,17 @@ RestyleManager::ContentRemoved(nsINode* 
     }
   }
 }
 
 void
 RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
                                     nsRestyleHint aRestyleHint)
 {
-  NS_ASSERTION(!(aExtraHint & nsChangeHint_ReconstructFrame),
+  NS_ASSERTION(!(aExtraHint & nsChangeHint::ReconstructFrame),
                "Should not reconstruct the root of the frame tree.  "
                "Use ReconstructDocElementHierarchy instead.");
   MOZ_ASSERT(!(aRestyleHint & ~(eRestyle_Subtree | eRestyle_ForceDescendants)),
              "the only bits allowed in aRestyleHint are eRestyle_Subtree and "
              "eRestyle_ForceDescendants");
 
   mRebuildAllExtraHint |= aExtraHint;
   mRebuildAllRestyleHint |= aRestyleHint;
@@ -944,17 +943,17 @@ RestyleManager::PostRestyleEvent(Element
                                  nsChangeHint aMinChangeHint,
                                  const RestyleHintData* aRestyleHintData)
 {
   if (MOZ_UNLIKELY(IsDisconnected()) ||
       MOZ_UNLIKELY(PresContext()->PresShell()->IsDestroying())) {
     return;
   }
 
-  if (aRestyleHint == 0 && !aMinChangeHint) {
+  if (aRestyleHint == 0 && !bool(aMinChangeHint)) {
     // Nothing to do here
     return;
   }
 
   mPendingRestyles.AddPendingRestyle(aElement, aRestyleHint, aMinChangeHint,
                                      aRestyleHintData);
 
   // Set mHavePendingNonAnimationRestyles for any restyle that could
@@ -967,17 +966,17 @@ RestyleManager::PostRestyleEvent(Element
 
   PostRestyleEventInternal(false);
 }
 
 void
 RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
                                              nsRestyleHint aRestyleHint)
 {
-  NS_ASSERTION(!(aExtraHint & nsChangeHint_ReconstructFrame),
+  NS_ASSERTION(!(aExtraHint & nsChangeHint::ReconstructFrame),
                "Should not reconstruct the root of the frame tree.  "
                "Use ReconstructDocElementHierarchy instead.");
   MOZ_ASSERT(!(aRestyleHint & eRestyle_SomeDescendants),
              "PostRebuildAllStyleDataEvent does not handle "
              "eRestyle_SomeDescendants");
 
   mDoRebuildAllStyleData = true;
   mRebuildAllExtraHint |= aExtraHint;
@@ -1273,17 +1272,17 @@ RestyleManager::ReparentStyleContext(nsI
         DebugOnly<nsChangeHint> styleChange =
           oldContext->CalcStyleDifference(newContext, nsChangeHint(0),
                                           &equalStructs,
                                           &samePointerStructs);
         // The style change is always 0 because we have the same rulenode and
         // CalcStyleDifference optimizes us away.  That's OK, though:
         // reparenting should never trigger a frame reconstruct, and whenever
         // it's happening we already plan to reflow and repaint the frames.
-        NS_ASSERTION(!(styleChange & nsChangeHint_ReconstructFrame),
+        NS_ASSERTION(!(styleChange & nsChangeHint::ReconstructFrame),
                      "Our frame tree is likely to be bogus!");
       }
 
       aFrame->SetStyleContext(newContext);
 
       nsIFrame::ChildListIterator lists(aFrame);
       for (; !lists.IsDone(); lists.Next()) {
         for (nsIFrame* child : lists.CurrentList()) {
@@ -1341,17 +1340,17 @@ RestyleManager::ReparentStyleContext(nsI
                                                    nsChangeHint(0),
                                                    &equalStructs,
                                                    &samePointerStructs);
             // The style change is always 0 because we have the same
             // rulenode and CalcStyleDifference optimizes us away.  That's
             // OK, though: reparenting should never trigger a frame
             // reconstruct, and whenever it's happening we already plan to
             // reflow and repaint the frames.
-            NS_ASSERTION(!(styleChange & nsChangeHint_ReconstructFrame),
+            NS_ASSERTION(!(styleChange & nsChangeHint::ReconstructFrame),
                          "Our frame tree is likely to be bogus!");
           }
 
           aFrame->SetAdditionalStyleContext(contextIndex, newExtraContext);
         }
       }
 #ifdef DEBUG
       DebugVerifyStyleTree(aFrame);
@@ -1437,17 +1436,17 @@ ElementRestyler::ElementRestyler(const E
 #ifdef RESTYLE_LOGGING
   , mLoggingDepth(aParentRestyler.mLoggingDepth + 1)
 #endif
 {
   MOZ_ASSERT_IF(mContent, !mContent->IsStyledByServo());
   if (aConstructorFlags & FOR_OUT_OF_FLOW_CHILD) {
     // Note that the out-of-flow may not be a geometric descendant of
     // the frame where we started the reresolve.  Therefore, even if
-    // mHintsHandled already includes nsChangeHint_AllReflowHints we
+    // mHintsHandled already includes nsChangeHint::AllReflowHints we
     // don't want to pass that on to the out-of-flow reresolve, since
     // that can lead to the out-of-flow not getting reflowed when it
     // should be (eg a reresolve starting at <body> that involves
     // reflowing the <body> would miss reflowing fixed-pos nodes that
     // also need reflow).  In the cases when the out-of-flow _is_ a
     // geometric descendant of a frame we already have a reflow hint
     // for, reflow coalescing should keep us from doing the work twice.
     mHintsHandled &= ~nsChangeHint_AllReflowHints;
@@ -1540,19 +1539,19 @@ ElementRestyler::AddLayerChangesForAnima
   for (const LayerAnimationInfo::Record& layerInfo :
          LayerAnimationInfo::sRecords) {
     Layer* layer =
       FrameLayerBuilder::GetDedicatedLayer(mFrame, layerInfo.mLayerType);
     if (layer && frameGeneration > layer->GetAnimationGeneration()) {
       // If we have a transform layer but don't have any transform style, we
       // probably just removed the transform but haven't destroyed the layer
       // yet. In this case we will add the appropriate change hint
-      // (nsChangeHint_UpdateContainingBlock) when we compare style contexts
+      // (nsChangeHint::UpdateContainingBlock) when we compare style contexts
       // so we can skip adding any change hint here. (If we *were* to add
-      // nsChangeHint_UpdateTransformLayer, ApplyRenderingChangeToTree would
+      // nsChangeHint::UpdateTransformLayer, ApplyRenderingChangeToTree would
       // complain that we're updating a transform layer without a transform).
       if (layerInfo.mLayerType == nsDisplayItem::TYPE_TRANSFORM &&
           !mFrame->StyleDisplay()->HasTransformStyle()) {
         continue;
       }
       hint |= layerInfo.mChangeHint;
     }
 
@@ -1568,17 +1567,17 @@ ElementRestyler::AddLayerChangesForAnima
     // not have those properies just before. e.g,  setting transform by
     // setKeyframes or changing target element from other target which prevents
     // running on the compositor, etc.
     if (!layer &&
         nsLayoutUtils::HasEffectiveAnimation(mFrame, layerInfo.mProperty)) {
       hint |= layerInfo.mChangeHint;
     }
   }
-  if (hint) {
+  if (bool(hint)) {
     mChangeList->AppendChange(mFrame, mContent, hint);
   }
 }
 
 void
 ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
                                nsStyleContext* aNewContext,
                                nsChangeHint aChangeToAssume,
@@ -1595,36 +1594,36 @@ ElementRestyler::CaptureChange(nsStyleCo
                "old and new style contexts should have the same pseudo");
 
   nsChangeHint ourChange =
     aOldContext->CalcStyleDifference(aNewContext,
                                      mParentFrameHintsNotHandledForDescendants,
                                      aEqualStructs,
                                      aSamePointerStructs);
   NS_ASSERTION(!(ourChange & nsChangeHint_AllReflowHints) ||
-               (ourChange & nsChangeHint_NeedReflow),
+               (ourChange & nsChangeHint::NeedReflow),
                "Reflow hint bits set without actually asking for a reflow");
 
   LOG_RESTYLE("CaptureChange, ourChange = %s, aChangeToAssume = %s",
               RestyleManager::ChangeHintToString(ourChange).get(),
               RestyleManager::ChangeHintToString(aChangeToAssume).get());
   LOG_RESTYLE_INDENT();
 
-  // nsChangeHint_UpdateEffects is inherited, but it can be set due to changes
+  // nsChangeHint::UpdateEffects is inherited, but it can be set due to changes
   // in inherited properties (fill and stroke).  Avoid propagating it into
   // text nodes.
-  if ((ourChange & nsChangeHint_UpdateEffects) &&
+  if ((ourChange & nsChangeHint::UpdateEffects) &&
       mContent && !mContent->IsElement()) {
-    ourChange &= ~nsChangeHint_UpdateEffects;
+    ourChange &= ~nsChangeHint::UpdateEffects;
   }
 
   ourChange |= aChangeToAssume;
   if (!NS_IsHintSubset(ourChange, mHintsHandled)) {
     mHintsHandled |= ourChange;
-    if (!(ourChange & nsChangeHint_ReconstructFrame) || mContent) {
+    if (!(ourChange & nsChangeHint::ReconstructFrame) || mContent) {
       LOG_RESTYLE("appending change %s",
                   RestyleManager::ChangeHintToString(ourChange).get());
       mChangeList->AppendChange(mFrame, mContent, ourChange);
     } else {
       LOG_RESTYLE("change has already been handled");
     }
   }
   mHintsNotHandledForDescendants |=
@@ -2212,30 +2211,30 @@ ElementRestyler::Restyle(nsRestyleHint a
       //   (d) something under ProcessPendingRestyles then wants to use of those
       //       now destroyed structs (through the old parent's descendants).
       mSwappedStructOwners.AppendElement(newParent);
       oldContext->MoveTo(newParent);
     }
 
     // Send the accessibility notifications that RestyleChildren otherwise
     // would have sent.
-    if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+    if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
       InitializeAccessibilityNotifications(mFrame->StyleContext());
       SendAccessibilityNotifications();
     }
 
     mRestyleTracker.AddRestyleRootsIfAwaitingRestyle(descendants);
     if (aRestyleHint & eRestyle_SomeDescendants) {
       ConditionallyRestyleChildren();
     }
     return;
   }
 
   if (result == RestyleResult::eStopWithStyleChange &&
-      !(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+      !(mHintsHandled & nsChangeHint::ReconstructFrame)) {
     MOZ_ASSERT(mFrame->StyleContext() != oldContext,
                "RestyleResult::eStopWithStyleChange should only be returned "
                "if we got a new style context or we will reconstruct");
     MOZ_ASSERT(swappedStructs == 0,
                "should have ensured we didn't swap structs when "
                "returning RestyleResult::eStopWithStyleChange");
 
     // We need to ensure that all of the frames that inherit their style
@@ -2244,17 +2243,17 @@ ElementRestyler::Restyle(nsRestyleHint a
     // to ensure it is safe to move all of the relevant child style
     // contexts to newContext.  If these conditions fail, it will
     // return false, and we'll have to continue restyling.
     const bool canStop = MoveStyleContextsForChildren(oldContext);
 
     if (canStop) {
       // Send the accessibility notifications that RestyleChildren otherwise
       // would have sent.
-      if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+      if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
         InitializeAccessibilityNotifications(mFrame->StyleContext());
         SendAccessibilityNotifications();
       }
 
       mRestyleTracker.AddRestyleRootsIfAwaitingRestyle(descendants);
       if (aRestyleHint & eRestyle_SomeDescendants) {
         ConditionallyRestyleChildren();
       }
@@ -2285,17 +2284,17 @@ ElementRestyler::Restyle(nsRestyleHint a
       nsRestyleHint(childRestyleHint | eRestyle_ForceDescendants);
   }
 
   // No need to do this if we're planning to reframe already.
   // It's also important to check mHintsHandled since we use
   // mFrame->StyleContext(), which is out of date if mHintsHandled
   // has a ReconstructFrame hint.  Using an out of date style
   // context could trigger assertions about mismatched rule trees.
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
     RestyleChildren(childRestyleHint);
   }
 
   if (oldContext && !oldContext->HasSingleReference()) {
     // If we swapped some structs out of oldContext in the RestyleSelf call
     // and after the RestyleChildren call we still have other strong references
     // to it, we need to make ensure its descendants don't cache any of the
     // structs that were swapped out.
@@ -2827,19 +2826,19 @@ ElementRestyler::RestyleSelf(nsIFrame* a
             pseudoTag == nsCSSPseudoElements::after) {
           // XXX what other pseudos do we need to treat like this?
           newContext = styleSet->ProbePseudoElementStyle(element,
                                                          pseudoType,
                                                          parentContext,
                                                          mTreeMatchContext);
           if (!newContext) {
             // This pseudo should no longer exist; gotta reframe
-            mHintsHandled |= nsChangeHint_ReconstructFrame;
+            mHintsHandled |= nsChangeHint::ReconstructFrame;
             mChangeList->AppendChange(aSelf, element,
-                                      nsChangeHint_ReconstructFrame);
+                                      nsChangeHint::ReconstructFrame);
             // We're reframing anyway; just keep the same context
             newContext = oldContext;
 #ifdef DEBUG
             // oldContext's parent might have had its style structs swapped out
             // with parentContext, so to avoid any assertions that might
             // otherwise trigger in oldContext's parent's destructor, we set a
             // flag on oldContext to skip it and its descendants in
             // nsStyleContext::AssertStructsNotUsedElsewhere.
@@ -3048,17 +3047,17 @@ ElementRestyler::RestyleSelf(nsIFrame* a
                   RestyleResultToString(result).get());
       result = RestyleResult::eStopWithStyleChange;
     }
 
     if (aRestyleHint & eRestyle_ForceDescendants) {
       result = RestyleResult::eContinueAndForceDescendants;
     }
 
-    if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+    if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
       // If the frame gets regenerated, let it keep its old context,
       // which is important to maintain various invariants about
       // frame types matching their style contexts.
       // Note that this check even makes sense if we didn't call
       // CaptureChange because of copyFromContinuation being true,
       // since we'll have copied the existing context from the
       // previous continuation, so newContext == oldContext.
 
@@ -3179,34 +3178,34 @@ ElementRestyler::RestyleSelf(nsIFrame* a
 
     LOG_RESTYLE("newExtraContext = %p", newExtraContext.get());
 
     if (oldExtraContext != newExtraContext) {
       uint32_t equalStructs;
       uint32_t samePointerStructs;
       CaptureChange(oldExtraContext, newExtraContext, assumeDifferenceHint,
                     &equalStructs, &samePointerStructs);
-      if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+      if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
         LOG_RESTYLE("setting new extra style context");
         aSelf->SetAdditionalStyleContext(contextIndex, newExtraContext);
       } else {
         LOG_RESTYLE("not setting new extra style context, since we'll reframe");
       }
     }
   }
 
   LOG_RESTYLE("returning %s", RestyleResultToString(result).get());
 
   return result;
 }
 
 void
 ElementRestyler::RestyleChildren(nsRestyleHint aChildRestyleHint)
 {
-  MOZ_ASSERT(!(mHintsHandled & nsChangeHint_ReconstructFrame),
+  MOZ_ASSERT(!(mHintsHandled & nsChangeHint::ReconstructFrame),
              "No need to do this if we're planning to reframe already.");
 
   // We'd like style resolution to be exact in the sense that an
   // animation-only style flush flushes only the styles it requests
   // flushing and doesn't update any other styles.  This means avoiding
   // constructing new frames during such a flush.
   //
   // For a ::before or ::after, we'll do an eRestyle_Subtree due to
@@ -3222,73 +3221,76 @@ ElementRestyler::RestyleChildren(nsResty
 
   // Check whether we might need to create a new ::before frame.
   // There's no need to do this if we're planning to reframe already
   // or if we're not forcing restyles on kids.
   // It's also important to check mHintsHandled since we use
   // mFrame->StyleContext(), which is out of date if mHintsHandled has a
   // ReconstructFrame hint.  Using an out of date style context could
   // trigger assertions about mismatched rule trees.
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame) &&
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame) &&
       mightReframePseudos) {
     MaybeReframeForBeforePseudo();
   }
 
   // There is no need to waste time crawling into a frame's children
   // on a frame change.  The act of reconstructing frames will force
   // new style contexts to be resolved on all of this frame's
   // descendants anyway, so we want to avoid wasting time processing
   // style contexts that we're just going to throw away anyway. - dwh
   // It's also important to check mHintsHandled since reresolving the
   // kids would use mFrame->StyleContext(), which is out of date if
   // mHintsHandled has a ReconstructFrame hint; doing this could trigger
   // assertions about mismatched rule trees.
   nsIFrame* lastContinuation;
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
     InitializeAccessibilityNotifications(mFrame->StyleContext());
 
     for (nsIFrame* f = mFrame; f;
          f = RestyleManager::GetNextContinuationWithSameStyle(f, f->StyleContext())) {
       lastContinuation = f;
       RestyleContentChildren(f, aChildRestyleHint);
     }
 
     SendAccessibilityNotifications();
   }
 
   // Check whether we might need to create a new ::after frame.
   // See comments above regarding :before.
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame) &&
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame) &&
       mightReframePseudos) {
     MaybeReframeForAfterPseudo(lastContinuation);
   }
 }
 
 void
 ElementRestyler::RestyleChildrenOfDisplayContentsElement(
   nsIFrame*              aParentFrame,
   nsStyleContext*        aNewContext,
   nsChangeHint           aMinHint,
   RestyleTracker&        aRestyleTracker,
   nsRestyleHint          aRestyleHint,
   const RestyleHintData& aRestyleHintData)
 {
-  MOZ_ASSERT(!(mHintsHandled & nsChangeHint_ReconstructFrame), "why call me?");
+  MOZ_ASSERT(!(mHintsHandled & nsChangeHint::ReconstructFrame),
+             "why call me?");
 
   const bool mightReframePseudos = aRestyleHint & eRestyle_Subtree;
   DoRestyleUndisplayedDescendants(nsRestyleHint(0), mContent, aNewContext);
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame) &&
+      mightReframePseudos) {
     MaybeReframeForPseudo(CSSPseudoElementType::before,
                           aParentFrame, nullptr, mContent, aNewContext);
   }
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame) && mightReframePseudos) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame) &&
+      mightReframePseudos) {
     MaybeReframeForPseudo(CSSPseudoElementType::after,
                           aParentFrame, nullptr, mContent, aNewContext);
   }
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
     InitializeAccessibilityNotifications(aNewContext);
 
     // Then process child frames for content that is a descendant of mContent.
     // XXX perhaps it's better to walk child frames (before reresolving
     // XXX undisplayed contexts above) and mark those that has a stylecontext
     // XXX leading up to mContent's old context? (instead of the
     // XXX ContentIsDescendantOf check below)
     nsIFrame::ChildListIterator lists(aParentFrame);
@@ -3300,17 +3302,17 @@ ElementRestyler::RestyleChildrenOfDispla
             ComputeStyleChangeFor(f, mChangeList, aMinHint, aRestyleTracker,
                                   aRestyleHint, aRestyleHintData,
                                   mContextsToClear, mSwappedStructOwners);
           }
         }
       }
     }
   }
-  if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
+  if (!(mHintsHandled & nsChangeHint::ReconstructFrame)) {
     SendAccessibilityNotifications();
   }
 }
 
 void
 ElementRestyler::ComputeStyleChangeFor(nsIFrame*          aFrame,
                                        nsStyleChangeList* aChangeList,
                                        nsChangeHint       aMinChange,
@@ -3328,17 +3330,17 @@ ElementRestyler::ComputeStyleChangeFor(n
     std::string elemDesc = ToString(*content);
     localDescriptor.Assign(elemDesc.c_str());
   }
 
   PROFILER_LABEL_PRINTF("ElementRestyler", "ComputeStyleChangeFor",
                         js::ProfileEntry::Category::CSS,
                         content ? "Element: %s" : "%s",
                         content ? localDescriptor.get() : "");
-  if (aMinChange) {
+  if (bool(aMinChange)) {
     aChangeList->AppendChange(aFrame, content, aMinChange);
   }
 
   NS_ASSERTION(!aFrame->GetPrevContinuation(),
                "must start with the first continuation");
 
   // We want to start with this frame and walk all its next-in-flows,
   // as well as all its ib-split siblings and their next-in-flows,
@@ -3387,17 +3389,17 @@ ElementRestyler::ComputeStyleChangeFor(n
                                aMinChange, aRestyleTracker,
                                selectorsForDescendants,
                                treeMatchContext,
                                visibleKidsOfHiddenElement,
                                aContextsToClear, aSwappedStructOwners);
 
       restyler.Restyle(aRestyleHint);
 
-      if (restyler.HintsHandledForFrame() & nsChangeHint_ReconstructFrame) {
+      if (restyler.HintsHandledForFrame() & nsChangeHint::ReconstructFrame) {
         // If it's going to cause a framechange, then don't bother
         // with the continuations or ib-split siblings since they'll be
         // clobbered by the frame reconstruct anyway.
         NS_ASSERTION(!cont->GetPrevContinuation(),
                      "continuing frame had more severe impact than first-in-flow");
         return;
       }
     }
@@ -3498,17 +3500,17 @@ ElementRestyler::RestyleUndisplayedNodes
                                               aParentContext,
                                               undisplayed->mStyle,
                                               rshint);
     }
     const nsStyleDisplay* display = undisplayedContext->StyleDisplay();
     if (display->mDisplay != aDisplay) {
       NS_ASSERTION(element, "Must have undisplayed content");
       mChangeList->AppendChange(nullptr, element,
-                                nsChangeHint_ReconstructFrame);
+                                nsChangeHint::ReconstructFrame);
       // The node should be removed from the undisplayed map when
       // we reframe it.
     } else {
       // update the undisplayed node with the new context
       undisplayed->mStyle = undisplayedContext;
 
       if (aDisplay == StyleDisplay::Contents) {
         DoRestyleUndisplayedDescendants(aChildRestyleHint, element,
@@ -3564,19 +3566,19 @@ ElementRestyler::MaybeReframeForPseudo(C
                                        nsIFrame* aFrame,
                                        nsIContent* aContent,
                                        nsStyleContext* aStyleContext)
 {
   if (MustReframeForPseudo(aPseudoType, aGenConParentFrame, aFrame, aContent,
                            aStyleContext)) {
     // Have to create the new ::before/::after frame.
     LOG_RESTYLE("MaybeReframeForPseudo, appending "
-                "nsChangeHint_ReconstructFrame");
-    mHintsHandled |= nsChangeHint_ReconstructFrame;
-    mChangeList->AppendChange(aFrame, aContent, nsChangeHint_ReconstructFrame);
+                "nsChangeHint::ReconstructFrame");
+    mHintsHandled |= nsChangeHint::ReconstructFrame;
+    mChangeList->AppendChange(aFrame, aContent, nsChangeHint::ReconstructFrame);
   }
 }
 
 bool
 ElementRestyler::MustReframeForPseudo(CSSPseudoElementType aPseudoType,
                                       nsIFrame* aGenConParentFrame,
                                       nsIFrame* aFrame,
                                       nsIContent* aContent,
--- a/layout/base/RestyleManagerBase.cpp
+++ b/layout/base/RestyleManagerBase.cpp
@@ -49,28 +49,28 @@ RestyleManagerBase::ContentStateChangedI
   CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
   if (primaryFrame) {
     // If it's generated content, ignore LOADING/etc state changes on it.
     if (!primaryFrame->IsGeneratedContentFrame() &&
         aStateMask.HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
                                          NS_EVENT_STATE_USERDISABLED |
                                          NS_EVENT_STATE_SUPPRESSED |
                                          NS_EVENT_STATE_LOADING)) {
-      *aOutChangeHint = nsChangeHint_ReconstructFrame;
+      *aOutChangeHint = nsChangeHint::ReconstructFrame;
     } else {
       uint8_t app = primaryFrame->StyleDisplay()->mAppearance;
       if (app) {
         nsITheme* theme = PresContext()->GetTheme();
         if (theme &&
             theme->ThemeSupportsWidget(PresContext(), primaryFrame, app)) {
           bool repaint = false;
           theme->WidgetStateChanged(primaryFrame, app, nullptr, &repaint,
                                     nullptr);
           if (repaint) {
-            *aOutChangeHint |= nsChangeHint_RepaintFrame;
+            *aOutChangeHint |= nsChangeHint::RepaintFrame;
           }
         }
       }
     }
 
     pseudoType = primaryFrame->StyleContext()->GetPseudoType();
 
     primaryFrame->ContentStatesChanged(aStateMask);
@@ -93,17 +93,17 @@ RestyleManagerBase::ContentStateChangedI
   if (aStateMask.HasState(NS_EVENT_STATE_HOVER) && *aOutRestyleHint != 0) {
     IncrementHoverGeneration();
   }
 
   if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
     // Exposing information to the page about whether the link is
     // visited or not isn't really something we can worry about here.
     // FIXME: We could probably do this a bit better.
-    *aOutChangeHint |= nsChangeHint_RepaintFrame;
+    *aOutChangeHint |= nsChangeHint::RepaintFrame;
   }
 }
 
 /* static */ nsCString
 RestyleManagerBase::RestyleHintToString(nsRestyleHint aHint)
 {
   nsCString result;
   bool any = false;
@@ -151,45 +151,55 @@ RestyleManagerBase::ChangeHintToString(n
     "UpdateParentOverflow",
     "ChildrenOnlyTransform", "RecomputePosition", "AddOrRemoveTransform",
     "BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
     "NeutralChange", "InvalidateRenderingObservers",
     "ReflowChangesSizeOrPosition", "UpdateComputedBSize",
     "UpdateUsesOpacity", "UpdateBackgroundPosition",
     "AddOrRemoveTransform"
   };
-  static_assert(nsChangeHint_AllHints == (1 << ArrayLength(names)) - 1,
+  static_assert(static_cast<nsChangeHintTypeBase>(nsChangeHint::AllChangeHints)
+                  == (1 << ArrayLength(names)) - 1,
                 "Name list doesn't match change hints.");
-  uint32_t hint = aHint & ((1 << ArrayLength(names)) - 1);
-  uint32_t rest = aHint & ~((1 << ArrayLength(names)) - 1);
-  if (hint == nsChangeHint_Hints_NotHandledForDescendants) {
+  uint32_t hint = static_cast<nsChangeHintTypeBase>(aHint) &
+                    ((1 << ArrayLength(names)) - 1);
+  uint32_t rest = static_cast<nsChangeHintTypeBase>(aHint) &
+                    ~((1 << ArrayLength(names)) - 1);
+  if (hint == static_cast<nsChangeHintTypeBase>(
+                nsChangeHint_Hints_NotHandledForDescendants)) {
     result.AppendLiteral("nsChangeHint_Hints_NotHandledForDescendants");
     hint = 0;
     any = true;
   } else {
-    if ((hint & NS_STYLE_HINT_REFLOW) == NS_STYLE_HINT_REFLOW) {
+    const uint32_t reflowHint =
+      static_cast<nsChangeHintTypeBase>(NS_STYLE_HINT_REFLOW);
+    const uint32_t allReflowHint =
+      static_cast<nsChangeHintTypeBase>(nsChangeHint_AllReflowHints);
+    const uint32_t visualHint =
+      static_cast<nsChangeHintTypeBase>(NS_STYLE_HINT_VISUAL);
+    if ((hint & reflowHint) == reflowHint) {
       result.AppendLiteral("NS_STYLE_HINT_REFLOW");
-      hint = hint & ~NS_STYLE_HINT_REFLOW;
+      hint = hint & ~reflowHint;
       any = true;
-    } else if ((hint & nsChangeHint_AllReflowHints) == nsChangeHint_AllReflowHints) {
+    } else if ((hint & allReflowHint) == allReflowHint) {
       result.AppendLiteral("nsChangeHint_AllReflowHints");
-      hint = hint & ~nsChangeHint_AllReflowHints;
+      hint = hint & ~allReflowHint;
       any = true;
-    } else if ((hint & NS_STYLE_HINT_VISUAL) == NS_STYLE_HINT_VISUAL) {
+    } else if ((hint & visualHint) == visualHint) {
       result.AppendLiteral("NS_STYLE_HINT_VISUAL");
-      hint = hint & ~NS_STYLE_HINT_VISUAL;
+      hint = hint & ~visualHint;
       any = true;
     }
   }
   for (uint32_t i = 0; i < ArrayLength(names); i++) {
     if (hint & (1 << i)) {
       if (any) {
         result.AppendLiteral(" | ");
       }
-      result.AppendPrintf("nsChangeHint_%s", names[i]);
+      result.AppendPrintf("nsChangeHint::%s", names[i]);
       any = true;
     }
   }
   if (rest) {
     if (any) {
       result.AppendLiteral(" | ");
     }
     result.AppendPrintf("0x%0x", rest);
@@ -384,43 +394,43 @@ RestyleManagerBase::DebugVerifyStyleTree
 }
 
 #endif // DEBUG
 
 NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(ChangeListProperty, bool)
 
 /**
  * Sync views on aFrame and all of aFrame's descendants (following placeholders),
- * if aChange has nsChangeHint_SyncFrameView.
+ * if aChange has nsChangeHint::SyncFrameView.
  * Calls DoApplyRenderingChangeToTree on all aFrame's out-of-flow descendants
- * (following placeholders), if aChange has nsChangeHint_RepaintFrame.
- * aFrame should be some combination of nsChangeHint_SyncFrameView,
- * nsChangeHint_RepaintFrame, nsChangeHint_UpdateOpacityLayer and
- * nsChangeHint_SchedulePaint, nothing else.
+ * (following placeholders), if aChange has nsChangeHint::RepaintFrame.
+ * aFrame should be some combination of nsChangeHint::SyncFrameView,
+ * nsChangeHint::RepaintFrame, nsChangeHint::UpdateOpacityLayer and
+ * nsChangeHint::SchedulePaint, nothing else.
 */
 static void SyncViewsAndInvalidateDescendants(nsIFrame* aFrame,
                                               nsChangeHint aChange);
 
 static void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint);
 
 /**
- * To handle nsChangeHint_ChildrenOnlyTransform we must iterate over the child
+ * To handle nsChangeHint::ChildrenOnlyTransform we must iterate over the child
  * frames of the SVG frame concerned. This helper function is used to find that
- * SVG frame when we encounter nsChangeHint_ChildrenOnlyTransform to ensure
+ * SVG frame when we encounter nsChangeHint::ChildrenOnlyTransform to ensure
  * that we iterate over the intended children, since sometimes we end up
  * handling that hint while processing hints for one of the SVG frame's
  * ancestor frames.
  *
  * The reason that we sometimes end up trying to process the hint for an
  * ancestor of the SVG frame that the hint is intended for is due to the way we
  * process restyle events. ApplyRenderingChangeToTree adjusts the frame from
  * the restyled element's principle frame to one of its ancestor frames based
  * on what nsCSSRendering::FindBackground returns, since the background style
  * may have been propagated up to an ancestor frame. Processing hints using an
- * ancestor frame is fine in general, but nsChangeHint_ChildrenOnlyTransform is
+ * ancestor frame is fine in general, but nsChangeHint::ChildrenOnlyTransform is
  * a special case since it is intended to update the children of a specific
  * frame.
  */
 static nsIFrame*
 GetFrameForChildrenOnlyTransformHint(nsIFrame* aFrame)
 {
   if (aFrame->GetType() == nsGkAtoms::viewportFrame) {
     // This happens if the root-<svg> is fixed positioned, in which case we
@@ -461,17 +471,17 @@ RecomputePosition(nsIFrame* aFrame)
     return true;
   }
 
   // Don't process position changes on frames which have views or the ones which
   // have a view somewhere in their descendants, because the corresponding view
   // needs to be repositioned properly as well.
   if (aFrame->HasView() ||
       (aFrame->GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW)) {
-    StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
+    StyleChangeReflow(aFrame, nsChangeHint::NeedReflow);
     return false;
   }
 
   aFrame->SchedulePaint();
 
   // For relative positioning, we can simply update the frame rect
   if (display->IsRelativelyPositionedStyle()) {
     // Move the frame
@@ -634,17 +644,17 @@ RecomputePosition(nsIFrame* aFrame)
                 parentBorder.top + reflowInput.ComputedPhysicalOffsets().top +
                 reflowInput.ComputedPhysicalMargin().top);
     aFrame->SetPosition(pos);
 
     return true;
   }
 
   // Fall back to a reflow
-  StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
+  StyleChangeReflow(aFrame, nsChangeHint::NeedReflow);
   return false;
 }
 
 static bool
 HasBoxAncestor(nsIFrame* aFrame)
 {
   for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
     if (f->IsXULBoxFrame()) {
@@ -763,67 +773,67 @@ DoApplyRenderingChangeToTree(nsIFrame* a
 
   for ( ; aFrame; aFrame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame)) {
     // Invalidate and sync views on all descendant frames, following placeholders.
     // We don't need to update transforms in SyncViewsAndInvalidateDescendants, because
     // there can't be any out-of-flows or popups that need to be transformed;
     // all out-of-flow descendants of the transformed element must also be
     // descendants of the transformed frame.
     SyncViewsAndInvalidateDescendants(aFrame,
-      nsChangeHint(aChange & (nsChangeHint_RepaintFrame |
-                              nsChangeHint_SyncFrameView |
-                              nsChangeHint_UpdateOpacityLayer |
-                              nsChangeHint_SchedulePaint)));
+      nsChangeHint(aChange & (nsChangeHint::RepaintFrame |
+                              nsChangeHint::SyncFrameView |
+                              nsChangeHint::UpdateOpacityLayer |
+                              nsChangeHint::SchedulePaint)));
     // This must be set to true if the rendering change needs to
     // invalidate content.  If it's false, a composite-only paint
     // (empty transaction) will be scheduled.
     bool needInvalidatingPaint = false;
 
     // if frame has view, will already be invalidated
-    if (aChange & nsChangeHint_RepaintFrame) {
+    if (aChange & nsChangeHint::RepaintFrame) {
       // Note that this whole block will be skipped when painting is suppressed
       // (due to our caller ApplyRendingChangeToTree() discarding the
-      // nsChangeHint_RepaintFrame hint).  If you add handling for any other
+      // nsChangeHint::RepaintFrame hint).  If you add handling for any other
       // hints within this block, be sure that they too should be ignored when
       // painting is suppressed.
       needInvalidatingPaint = true;
       aFrame->InvalidateFrameSubtree();
-      if ((aChange & nsChangeHint_UpdateEffects) &&
+      if ((aChange & nsChangeHint::UpdateEffects) &&
           aFrame->IsFrameOfType(nsIFrame::eSVG) &&
           !(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)) {
         // Need to update our overflow rects:
         nsSVGUtils::ScheduleReflowSVG(aFrame);
       }
     }
-    if (aChange & nsChangeHint_UpdateTextPath) {
+    if (aChange & nsChangeHint::UpdateTextPath) {
       if (aFrame->IsSVGText()) {
         // Invalidate and reflow the entire SVGTextFrame:
         NS_ASSERTION(aFrame->GetContent()->IsSVGElement(nsGkAtoms::textPath),
                      "expected frame for a <textPath> element");
         nsIFrame* text =
           nsLayoutUtils::GetClosestFrameOfType(aFrame, nsGkAtoms::svgTextFrame);
         NS_ASSERTION(text, "expected to find an ancestor SVGTextFrame");
         static_cast<SVGTextFrame*>(text)->NotifyGlyphMetricsChange();
       } else {
-        MOZ_ASSERT(false, "unexpected frame got nsChangeHint_UpdateTextPath");
+        MOZ_ASSERT(false, "unexpected frame got nsChangeHint::UpdateTextPath");
       }
     }
-    if (aChange & nsChangeHint_UpdateOpacityLayer) {
+    if (aChange & nsChangeHint::UpdateOpacityLayer) {
       // FIXME/bug 796697: we can get away with empty transactions for
       // opacity updates in many cases.
       needInvalidatingPaint = true;
 
       ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_opacity);
       if (nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame)) {
         // SVG effects paints the opacity without using
         // nsDisplayOpacity. We need to invalidate manually.
         aFrame->InvalidateFrameSubtree();
       }
     }
-    if ((aChange & nsChangeHint_UpdateTransformLayer) &&
+    if ((aChange & nsChangeHint::UpdateTransformLayer) &&
         aFrame->IsTransformed()) {
       ActiveLayerTracker::NotifyRestyle(aFrame, eCSSProperty_transform);
       // If we're not already going to do an invalidating paint, see
       // if we can get away with only updating the transform on a
       // layer for this frame, and not scheduling an invalidating
       // paint.
       if (!needInvalidatingPaint) {
         Layer* layer;
@@ -833,48 +843,47 @@ DoApplyRenderingChangeToTree(nsIFrame* a
           // Since we're not going to paint, we need to resend animation
           // data to the layer.
           MOZ_ASSERT(layer, "this can't happen if there's no layer");
           nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(
             layer, nullptr, nullptr, aFrame, eCSSProperty_transform);
         }
       }
     }
-    if (aChange & nsChangeHint_ChildrenOnlyTransform) {
+    if (aChange & nsChangeHint::ChildrenOnlyTransform) {
       needInvalidatingPaint = true;
       nsIFrame* childFrame =
         GetFrameForChildrenOnlyTransformHint(aFrame)->PrincipalChildList().FirstChild();
       for ( ; childFrame; childFrame = childFrame->GetNextSibling()) {
         ActiveLayerTracker::NotifyRestyle(childFrame, eCSSProperty_transform);
       }
     }
-    if (aChange & nsChangeHint_SchedulePaint) {
+    if (aChange & nsChangeHint::SchedulePaint) {
       needInvalidatingPaint = true;
     }
     aFrame->SchedulePaint(needInvalidatingPaint
                             ? nsIFrame::PAINT_DEFAULT
                             : nsIFrame::PAINT_COMPOSITE_ONLY);
   }
 }
 
 static void
 SyncViewsAndInvalidateDescendants(nsIFrame* aFrame, nsChangeHint aChange)
 {
   NS_PRECONDITION(gInApplyRenderingChangeToTree,
                   "should only be called within ApplyRenderingChangeToTree");
-  NS_ASSERTION(nsChangeHint_size_t(aChange) ==
-                          (aChange & (nsChangeHint_RepaintFrame |
-                                      nsChangeHint_SyncFrameView |
-                                      nsChangeHint_UpdateOpacityLayer |
-                                      nsChangeHint_SchedulePaint)),
+  NS_ASSERTION(!(aChange & ~(nsChangeHint::RepaintFrame |
+                             nsChangeHint::SyncFrameView |
+                             nsChangeHint::UpdateOpacityLayer |
+                             nsChangeHint::SchedulePaint)),
                "Invalid change flag");
 
   nsView* view = aFrame->GetView();
   if (view) {
-    if (aChange & nsChangeHint_SyncFrameView) {
+    if (aChange & nsChangeHint::SyncFrameView) {
       nsContainerFrame::SyncFrameViewProperties(aFrame->PresContext(), aFrame,
                                                 nullptr, view);
     }
   }
 
   nsIFrame::ChildListIterator lists(aFrame);
   for (; !lists.IsDone(); lists.Next()) {
     for (nsIFrame* child : lists.CurrentList()) {
@@ -898,48 +907,49 @@ SyncViewsAndInvalidateDescendants(nsIFra
 static void
 ApplyRenderingChangeToTree(nsIPresShell* aPresShell,
                            nsIFrame* aFrame,
                            nsChangeHint aChange)
 {
   // We check StyleDisplay()->HasTransformStyle() in addition to checking
   // IsTransformed() since we can get here for some frames that don't support
   // CSS transforms.
-  NS_ASSERTION(!(aChange & nsChangeHint_UpdateTransformLayer) ||
+  NS_ASSERTION(!(aChange & nsChangeHint::UpdateTransformLayer) ||
                aFrame->IsTransformed() ||
                aFrame->StyleDisplay()->HasTransformStyle(),
                "Unexpected UpdateTransformLayer hint");
 
   if (aPresShell->IsPaintingSuppressed()) {
     // Don't allow synchronous rendering changes when painting is turned off.
-    aChange &= ~nsChangeHint_RepaintFrame;
-    if (!aChange) {
+    aChange &= ~nsChangeHint::RepaintFrame;
+    if (!bool(aChange)) {
       return;
     }
   }
 
 // Trigger rendering updates by damaging this frame and any
 // continuations of this frame.
 #ifdef DEBUG
   gInApplyRenderingChangeToTree = true;
 #endif
-  if (aChange & nsChangeHint_RepaintFrame) {
+  if (aChange & nsChangeHint::RepaintFrame) {
     // If the frame's background is propagated to an ancestor, walk up to
     // that ancestor and apply the RepaintFrame change hint to it.
     nsStyleContext* bgSC;
     nsIFrame* propagatedFrame = aFrame;
     while (!nsCSSRendering::FindBackground(propagatedFrame, &bgSC)) {
       propagatedFrame = propagatedFrame->GetParent();
       NS_ASSERTION(aFrame, "root frame must paint");
     }
 
     if (propagatedFrame != aFrame) {
-      DoApplyRenderingChangeToTree(propagatedFrame, nsChangeHint_RepaintFrame);
-      aChange &= ~nsChangeHint_RepaintFrame;
-      if (!aChange) {
+      DoApplyRenderingChangeToTree(propagatedFrame,
+                                   nsChangeHint::RepaintFrame);
+      aChange &= ~nsChangeHint::RepaintFrame;
+      if (!bool(aChange)) {
         return;
       }
     }
   }
   DoApplyRenderingChangeToTree(aFrame, aChange);
 #ifdef DEBUG
   gInApplyRenderingChangeToTree = false;
 #endif
@@ -960,54 +970,54 @@ AddSubtreeToOverflowTracker(nsIFrame* aF
     }
   }
 }
 
 static void
 StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
 {
   nsIPresShell::IntrinsicDirty dirtyType;
-  if (aHint & nsChangeHint_ClearDescendantIntrinsics) {
-    NS_ASSERTION(aHint & nsChangeHint_ClearAncestorIntrinsics,
+  if (aHint & nsChangeHint::ClearDescendantIntrinsics) {
+    NS_ASSERTION(aHint & nsChangeHint::ClearAncestorIntrinsics,
                  "Please read the comments in nsChangeHint.h");
-    NS_ASSERTION(aHint & nsChangeHint_NeedDirtyReflow,
+    NS_ASSERTION(aHint & nsChangeHint::NeedDirtyReflow,
                  "ClearDescendantIntrinsics requires NeedDirtyReflow");
     dirtyType = nsIPresShell::eStyleChange;
-  } else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
+  } else if ((aHint & nsChangeHint::UpdateComputedBSize) &&
              aFrame->HasAnyStateBits(
                NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
     dirtyType = nsIPresShell::eStyleChange;
-  } else if (aHint & nsChangeHint_ClearAncestorIntrinsics) {
+  } else if (aHint & nsChangeHint::ClearAncestorIntrinsics) {
     dirtyType = nsIPresShell::eTreeChange;
-  } else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
+  } else if ((aHint & nsChangeHint::UpdateComputedBSize) &&
              HasBoxAncestor(aFrame)) {
     // The frame's computed BSize is changing, and we have a box ancestor
     // whose cached intrinsic height may need to be updated.
     dirtyType = nsIPresShell::eTreeChange;
   } else {
     dirtyType = nsIPresShell::eResize;
   }
 
   nsFrameState dirtyBits;
   if (aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     dirtyBits = nsFrameState(0);
-  } else if ((aHint & nsChangeHint_NeedDirtyReflow) ||
+  } else if ((aHint & nsChangeHint::NeedDirtyReflow) ||
              dirtyType == nsIPresShell::eStyleChange) {
     dirtyBits = NS_FRAME_IS_DIRTY;
   } else {
     dirtyBits = NS_FRAME_HAS_DIRTY_CHILDREN;
   }
 
   // If we're not going to clear any intrinsic sizes on the frames, and
   // there are no dirty bits to set, then there's nothing to do.
   if (dirtyType == nsIPresShell::eResize && !dirtyBits)
     return;
 
   nsIPresShell::ReflowRootHandling rootHandling;
-  if (aHint & nsChangeHint_ReflowChangesSizeOrPosition) {
+  if (aHint & nsChangeHint::ReflowChangesSizeOrPosition) {
     rootHandling = nsIPresShell::ePositionOrSizeChange;
   } else {
     rootHandling = nsIPresShell::eNoPositionOrSizeChange;
   }
 
   do {
     aFrame->PresContext()->PresShell()->FrameNeedsReflow(
       aFrame, dirtyType, dirtyBits, rootHandling);
@@ -1087,48 +1097,48 @@ RestyleManagerBase::ProcessRestyledFrame
 
   for (const nsStyleChangeData& data : aChangeList) {
     nsIFrame* frame = data.mFrame;
     nsIContent* content = data.mContent;
     nsChangeHint hint = data.mHint;
     bool didReflowThisFrame = false;
 
     NS_ASSERTION(!(hint & nsChangeHint_AllReflowHints) ||
-                 (hint & nsChangeHint_NeedReflow),
+                 (hint & nsChangeHint::NeedReflow),
                  "Reflow hint bits set without actually asking for a reflow");
 
     // skip any frame that has been destroyed due to a ripple effect
     if (frame && !propTable->Get(frame, ChangeListProperty())) {
       continue;
     }
 
     if (frame && frame->GetContent() != content) {
       // XXXbz this is due to image maps messing with the primary frame of
       // <area>s.  See bug 135040.  Remove this block once that's fixed.
       frame = nullptr;
-      if (!(hint & nsChangeHint_ReconstructFrame)) {
+      if (!(hint & nsChangeHint::ReconstructFrame)) {
         continue;
       }
     }
 
-    if ((hint & nsChangeHint_UpdateContainingBlock) && frame &&
-        !(hint & nsChangeHint_ReconstructFrame)) {
+    if ((hint & nsChangeHint::UpdateContainingBlock) && frame &&
+        !(hint & nsChangeHint::ReconstructFrame)) {
       if (NeedToReframeForAddingOrRemovingTransform(frame) ||
           frame->GetType() == nsGkAtoms::fieldSetFrame ||
           frame->GetContentInsertionFrame() != frame) {
         // The frame has positioned children that need to be reparented, or
         // it can't easily be converted to/from being an abs-pos container correctly.
-        hint |= nsChangeHint_ReconstructFrame;
+        hint |= nsChangeHint::ReconstructFrame;
       } else {
         for (nsIFrame* cont = frame; cont;
              cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
           // Normally frame construction would set state bits as needed,
           // but we're not going to reconstruct the frame so we need to set them.
           // It's because we need to set this state on each affected frame
-          // that we can't coalesce nsChangeHint_UpdateContainingBlock hints up
+          // that we can't coalesce nsChangeHint::UpdateContainingBlock hints up
           // to ancestors (i.e. it can't be an change hint that is handled for
           // descendants).
           if (cont->IsAbsPosContainingBlock()) {
             if (!cont->IsAbsoluteContainer() &&
                 (cont->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN)) {
               cont->MarkAsAbsoluteContainingBlock();
             }
           } else {
@@ -1145,30 +1155,30 @@ RestyleManagerBase::ProcessRestyledFrame
                 cont->MarkAsNotAbsoluteContainingBlock();
               }
             }
           }
         }
       }
     }
 
-    if ((hint & nsChangeHint_AddOrRemoveTransform) && frame &&
-        !(hint & nsChangeHint_ReconstructFrame)) {
+    if ((hint & nsChangeHint::AddOrRemoveTransform) && frame &&
+        !(hint & nsChangeHint::ReconstructFrame)) {
       for (nsIFrame* cont = frame; cont;
            cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
         if (cont->StyleDisplay()->HasTransform(cont)) {
           cont->AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
         }
         // Don't remove NS_FRAME_MAY_BE_TRANSFORMED since it may still be
         // transformed by other means. It's OK to have the bit even if it's
         // not needed.
       }
     }
 
-    if (hint & nsChangeHint_ReconstructFrame) {
+    if (hint & nsChangeHint::ReconstructFrame) {
       // If we ever start passing true here, be careful of restyles
       // that involve a reframe and animations.  In particular, if the
       // restyle we're processing here is an animation restyle, but
       // the style resolution we will do for the frame construction
       // happens async when we're not in an animation restyle already,
       // problems could arise.
       // We could also have problems with triggering of CSS transitions
       // on elements whose frames are reconstructed, since we depend on
@@ -1176,105 +1186,109 @@ RestyleManagerBase::ProcessRestyledFrame
       frameConstructor->RecreateFramesForContent(content, false,
         nsCSSFrameConstructor::REMOVE_FOR_RECONSTRUCTION, nullptr);
     } else {
       NS_ASSERTION(frame, "This shouldn't happen");
 
       if (!frame->FrameMaintainsOverflow()) {
         // frame does not maintain overflow rects, so avoid calling
         // FinishAndStoreOverflow on it:
-        hint &= ~(nsChangeHint_UpdateOverflow |
-                  nsChangeHint_ChildrenOnlyTransform |
-                  nsChangeHint_UpdatePostTransformOverflow |
-                  nsChangeHint_UpdateParentOverflow);
+        hint &= ~(nsChangeHint::UpdateOverflow |
+                  nsChangeHint::ChildrenOnlyTransform |
+                  nsChangeHint::UpdatePostTransformOverflow |
+                  nsChangeHint::UpdateParentOverflow);
       }
 
       if (!(frame->GetStateBits() & NS_FRAME_MAY_BE_TRANSFORMED)) {
         // Frame can not be transformed, and thus a change in transform will
         // have no effect and we should not use the
-        // nsChangeHint_UpdatePostTransformOverflow hint.
-        hint &= ~nsChangeHint_UpdatePostTransformOverflow;
+        // nsChangeHint::UpdatePostTransformOverflow hint.
+        hint &= ~nsChangeHint::UpdatePostTransformOverflow;
       }
 
-      if (hint & nsChangeHint_UpdateEffects) {
+      if (hint & nsChangeHint::UpdateEffects) {
         for (nsIFrame* cont = frame; cont;
              cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
           nsSVGEffects::UpdateEffects(cont);
         }
       }
-      if ((hint & nsChangeHint_InvalidateRenderingObservers) ||
-          ((hint & nsChangeHint_UpdateOpacityLayer) &&
+      if ((hint & nsChangeHint::InvalidateRenderingObservers) ||
+          ((hint & nsChangeHint::UpdateOpacityLayer) &&
            frame->IsFrameOfType(nsIFrame::eSVG) &&
            !(frame->GetStateBits() & NS_STATE_IS_OUTER_SVG))) {
         nsSVGEffects::InvalidateRenderingObservers(frame);
       }
-      if (hint & nsChangeHint_NeedReflow) {
+      if (hint & nsChangeHint::NeedReflow) {
         StyleChangeReflow(frame, hint);
         didReflowThisFrame = true;
       }
 
-      if ((hint & nsChangeHint_UpdateUsesOpacity) &&
+      if ((hint & nsChangeHint::UpdateUsesOpacity) &&
           frame->IsFrameOfType(nsIFrame::eTablePart)) {
-        NS_ASSERTION(hint & nsChangeHint_UpdateOpacityLayer,
+        NS_ASSERTION(hint & nsChangeHint::UpdateOpacityLayer,
                      "should only return UpdateUsesOpacity hint "
                      "when also returning UpdateOpacityLayer hint");
         // When an internal table part (including cells) changes between
         // having opacity 1 and non-1, it changes whether its
         // backgrounds (and those of table parts inside of it) are
         // painted as part of the table's nsDisplayTableBorderBackground
         // display item, or part of its own display item.  That requires
         // invalidation, so change UpdateOpacityLayer to RepaintFrame.
-        hint &= ~nsChangeHint_UpdateOpacityLayer;
-        hint |= nsChangeHint_RepaintFrame;
+        hint &= ~nsChangeHint::UpdateOpacityLayer;
+        hint |= nsChangeHint::RepaintFrame;
       }
 
-      if (hint & nsChangeHint_UpdateBackgroundPosition) {
+      if (hint & nsChangeHint::UpdateBackgroundPosition) {
         // For most frame types, DLBI can detect background position changes,
         // so we only need to schedule a paint.
-        hint |= nsChangeHint_SchedulePaint;
+        hint |= nsChangeHint::SchedulePaint;
         if (frame->IsFrameOfType(nsIFrame::eTablePart) ||
             frame->IsFrameOfType(nsIFrame::eMathML)) {
           // Table parts and MathML frames don't build display items for their
           // backgrounds, so DLBI can't detect background-position changes for
           // these frames. Repaint the whole frame.
-          hint |= nsChangeHint_RepaintFrame;
+          hint |= nsChangeHint::RepaintFrame;
         }
       }
 
-      if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
-                  nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
-                  nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {
+      if (hint & (nsChangeHint::RepaintFrame |
+                  nsChangeHint::SyncFrameView |
+                  nsChangeHint::UpdateOpacityLayer |
+                  nsChangeHint::UpdateTransformLayer |
+                  nsChangeHint::ChildrenOnlyTransform |
+                  nsChangeHint::SchedulePaint)) {
         ApplyRenderingChangeToTree(presContext->PresShell(), frame, hint);
       }
-      if ((hint & nsChangeHint_RecomputePosition) && !didReflowThisFrame) {
+      if ((hint & nsChangeHint::RecomputePosition) &&
+          !didReflowThisFrame) {
         ActiveLayerTracker::NotifyOffsetRestyle(frame);
         // It is possible for this to fall back to a reflow
         if (!RecomputePosition(frame)) {
           didReflowThisFrame = true;
         }
       }
-      NS_ASSERTION(!(hint & nsChangeHint_ChildrenOnlyTransform) ||
-                   (hint & nsChangeHint_UpdateOverflow),
-                   "nsChangeHint_UpdateOverflow should be passed too");
+      NS_ASSERTION(!(hint & nsChangeHint::ChildrenOnlyTransform) ||
+                   (hint & nsChangeHint::UpdateOverflow),
+                   "nsChangeHint::UpdateOverflow should be passed too");
       if (!didReflowThisFrame &&
-          (hint & (nsChangeHint_UpdateOverflow |
-                   nsChangeHint_UpdatePostTransformOverflow |
-                   nsChangeHint_UpdateParentOverflow |
-                   nsChangeHint_UpdateSubtreeOverflow))) {
-        if (hint & nsChangeHint_UpdateSubtreeOverflow) {
+          (hint & (nsChangeHint::UpdateOverflow |
+                   nsChangeHint::UpdatePostTransformOverflow |
+                   nsChangeHint::UpdateParentOverflow |
+                   nsChangeHint::UpdateSubtreeOverflow))) {
+        if (hint & nsChangeHint::UpdateSubtreeOverflow) {
           for (nsIFrame* cont = frame; cont; cont =
                  nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
             AddSubtreeToOverflowTracker(cont, mOverflowChangedTracker);
           }
           // The work we just did in AddSubtreeToOverflowTracker
           // subsumes some of the other hints:
-          hint &= ~(nsChangeHint_UpdateOverflow |
-                    nsChangeHint_UpdatePostTransformOverflow);
+          hint &= ~(nsChangeHint::UpdateOverflow |
+                    nsChangeHint::UpdatePostTransformOverflow);
         }
-        if (hint & nsChangeHint_ChildrenOnlyTransform) {
+        if (hint & nsChangeHint::ChildrenOnlyTransform) {
           // The overflow areas of the child frames need to be updated:
           nsIFrame* hintFrame = GetFrameForChildrenOnlyTransformHint(frame);
           nsIFrame* childFrame = hintFrame->PrincipalChildList().FirstChild();
           NS_ASSERTION(!nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame),
                        "SVG frames should not have continuations "
                        "or ib-split siblings");
           NS_ASSERTION(!nsLayoutUtils::GetNextContinuationOrIBSplitSibling(hintFrame),
                        "SVG frames should not have continuations "
@@ -1295,49 +1309,49 @@ RestyleManagerBase::ProcessRestyledFrame
             NS_ASSERTION(childFrame->GetParent() == hintFrame,
                          "SVG child frame not expected to have different parent");
           }
         }
         // If |frame| is dirty or has dirty children, we don't bother updating
         // overflows since that will happen when it's reflowed.
         if (!(frame->GetStateBits() &
               (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN))) {
-          if (hint & (nsChangeHint_UpdateOverflow |
-                      nsChangeHint_UpdatePostTransformOverflow)) {
+          if (hint & (nsChangeHint::UpdateOverflow |
+                      nsChangeHint::UpdatePostTransformOverflow)) {
             OverflowChangedTracker::ChangeKind changeKind;
-            // If we have both nsChangeHint_UpdateOverflow and
-            // nsChangeHint_UpdatePostTransformOverflow,
+            // If we have both nsChangeHint::UpdateOverflow and
+            // nsChangeHint::UpdatePostTransformOverflow,
             // CHILDREN_CHANGED is selected as it is
             // strictly stronger.
-            if (hint & nsChangeHint_UpdateOverflow) {
+            if (hint & nsChangeHint::UpdateOverflow) {
               changeKind = OverflowChangedTracker::CHILDREN_CHANGED;
             } else {
               changeKind = OverflowChangedTracker::TRANSFORM_CHANGED;
             }
             for (nsIFrame* cont = frame; cont; cont =
                    nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
               mOverflowChangedTracker.AddFrame(cont, changeKind);
             }
           }
           // UpdateParentOverflow hints need to be processed in addition
           // to the above, since if the processing of the above hints
           // yields no change, the update will not propagate to the
           // parent.
-          if (hint & nsChangeHint_UpdateParentOverflow) {
+          if (hint & nsChangeHint::UpdateParentOverflow) {
             MOZ_ASSERT(frame->GetParent(),
                        "shouldn't get style hints for the root frame");
             for (nsIFrame* cont = frame; cont; cont =
                    nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
               mOverflowChangedTracker.AddFrame(cont->GetParent(),
                                    OverflowChangedTracker::CHILDREN_CHANGED);
             }
           }
         }
       }
-      if ((hint & nsChangeHint_UpdateCursor) && !didUpdateCursor) {
+      if ((hint & nsChangeHint::UpdateCursor) && !didUpdateCursor) {
         presContext->PresShell()->SynthesizeMouseMove(false);
         didUpdateCursor = true;
       }
     }
   }
 
   frameConstructor->EndUpdate();
 
--- a/layout/base/RestyleTracker.cpp
+++ b/layout/base/RestyleTracker.cpp
@@ -91,19 +91,19 @@ RestyleTracker::ProcessOneRestyle(Elemen
       LOG_RESTYLE("style context tree before restyle:");
       LOG_RESTYLE_INDENT();
       primaryFrame->StyleContext()->LogStyleContextTree(
           LoggingDepth(), RestyleManager::StructsToLog());
     }
 #endif
     mRestyleManager->RestyleElement(aElement, primaryFrame, aChangeHint,
                                     *this, aRestyleHint, aRestyleHintData);
-  } else if (aChangeHint &&
+  } else if (bool(aChangeHint) &&
              (primaryFrame ||
-              (aChangeHint & nsChangeHint_ReconstructFrame))) {
+              (aChangeHint & nsChangeHint::ReconstructFrame))) {
     // Don't need to recompute style; just apply the hint
     nsStyleChangeList changeList;
     changeList.AppendChange(primaryFrame, aElement, aChangeHint);
     mRestyleManager->ProcessRestyledFrames(changeList);
   }
 }
 
 void
@@ -317,17 +317,17 @@ RestyleTracker::DoProcessRestyles()
               element->GetComposedDoc()->GetShell()->FrameManager()
                 ->GetDisplayContentsStyleFor(element))) ||
             // Or not reachable due to an async reinsert we have
             // pending?  If so, we'll have a reframe hint around.
             // That incidentally makes it safe that we still have
             // the bit, since any descendants that didn't get added
             // to the roots list because we had the bits will be
             // completely restyled in a moment.
-            (data->mChangeHint & nsChangeHint_ReconstructFrame),
+            (data->mChangeHint & nsChangeHint::ReconstructFrame),
             "Why did this not get handled while processing mRestyleRoots?");
 
           // Unset the restyle bits now, so if they get readded later as we
           // process we won't clobber that adding of the bit.
           element->UnsetFlags(RestyleBit() |
                               RootBit() |
                               ConditionalDescendantsBit());
 
--- a/layout/base/RestyleTracker.h
+++ b/layout/base/RestyleTracker.h
@@ -325,17 +325,17 @@ RestyleTracker::AddPendingRestyle(Elemen
   bool hadRestyleLaterSiblings =
     AddPendingRestyleToTable(aElement, aRestyleHint, aMinChangeHint,
                              aRestyleHintData);
 
   // We can only treat this element as a restyle root if we would
   // actually restyle its descendants (so either call
   // ElementRestyler::Restyle on it or just reframe it).
   if ((aRestyleHint & ~eRestyle_LaterSiblings) ||
-      (aMinChangeHint & nsChangeHint_ReconstructFrame)) {
+      (aMinChangeHint & nsChangeHint::ReconstructFrame)) {
     Element* cur =
       aRestyleRoot ? *aRestyleRoot : FindClosestRestyleRoot(aElement);
     if (!cur) {
       mRestyleRoots.AppendElement(aElement);
       cur = aElement;
     }
     // At this point some ancestor of aElement (possibly aElement
     // itself) is in mRestyleRoots.  Set the root bit on aElement, to
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -30,17 +30,18 @@ ServoRestyleManager::PostRestyleEvent(El
                                       nsRestyleHint aRestyleHint,
                                       nsChangeHint aMinChangeHint)
 {
   if (MOZ_UNLIKELY(IsDisconnected()) ||
       MOZ_UNLIKELY(PresContext()->PresShell()->IsDestroying())) {
     return;
   }
 
-  if (aRestyleHint == 0 && !aMinChangeHint && !HasPendingRestyles()) {
+  if (aRestyleHint == 0 && !bool(aMinChangeHint) &&
+      !HasPendingRestyles()) {
     return; // Nothing to do.
   }
 
   // We allow posting change hints during restyling, but not restyle hints
   // themselves, since those would require us to re-traverse the tree.
   MOZ_ASSERT_IF(mInStyleRefresh, aRestyleHint == 0);
 
   // Processing change hints sometimes causes new change hints to be generated.
@@ -64,17 +65,17 @@ ServoRestyleManager::PostRestyleEvent(El
   // RESTYLE_SELF | RESTYLE_DESCENDANTS, since this is a commonly
   // posted restyle hint that doesn't yet align with RestyleHint's
   // bits.
   if (aRestyleHint & eRestyle_Subtree) {
     aRestyleHint &= ~eRestyle_Subtree;
     aRestyleHint |= eRestyle_Self | eRestyle_SomeDescendants;
   }
 
-  if (aRestyleHint || aMinChangeHint) {
+  if (aRestyleHint || bool(aMinChangeHint)) {
     Servo_NoteExplicitHints(aElement, aRestyleHint, aMinChangeHint);
   }
 
   PostRestyleEventInternal(false);
 }
 
 void
 ServoRestyleManager::PostRestyleEventForLazyConstruction()
@@ -130,33 +131,33 @@ ServoRestyleManager::RecreateStyleContex
                                            ServoStyleSet* aStyleSet,
                                            nsStyleChangeList& aChangeListToProcess)
 {
   nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
 
   // FIXME(bholley): Once we transfer ownership of the styles to the frame, we
   // can fast-reject without the FFI call by checking mServoData for null.
   nsChangeHint changeHint = Servo_CheckChangeHint(aElement);
-  if (changeHint) {
+  if (bool(changeHint)) {
       aChangeListToProcess.AppendChange(primaryFrame, aElement, changeHint);
   }
 
   // If our change hint is reconstruct, we delegate to the frame constructor,
   // which consumes the new style and expects the old style to be on the frame.
   //
   // XXXbholley: We should teach the frame constructor how to clear the dirty
   // descendants bit to avoid the traversal here.
-  if (changeHint & nsChangeHint_ReconstructFrame) {
+  if (changeHint & nsChangeHint::ReconstructFrame) {
     ClearDirtyDescendantsFromSubtree(aElement);
     return;
   }
 
   // If we have a frame and a non-zero + non-reconstruct change hint, we need to
   // attach a new style context.
-  bool recreateContext = primaryFrame && changeHint;
+  bool recreateContext = primaryFrame && bool(changeHint);
   if (recreateContext) {
     RefPtr<ServoComputedValues> computedValues
       = Servo_ResolveStyle(aElement, aStyleSet->mRawSet.get(),
                            ConsumeStyleBehavior::Consume,
                            LazyComputeBehavior::Assert).Consume();
 
     // Hold the old style context alive, because it could become a dangling
     // pointer during the replacement. In practice it's not a huge deal (on
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -9734,17 +9734,18 @@ nsCSSFrameConstructor::RecreateFramesFor
     }
     if (reconstruct && !didReconstruct) {
       // Now, recreate the frames associated with this content object. If
       // ContentRemoved triggered reconstruction, then we don't need to do this
       // because the frames will already have been built.
       if (aAsyncInsert) {
         // XXXmats doesn't frame state need to be restored in this case too?
         RestyleManager()->PostRestyleEvent(
-          aContent->AsElement(), nsRestyleHint(0), nsChangeHint_ReconstructFrame);
+          aContent->AsElement(), nsRestyleHint(0),
+          nsChangeHint::ReconstructFrame);
       } else {
         rv = ContentInserted(container, aContent, mTempFrameTreeState, false);
       }
     }
   }
 
   return rv;
 }
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -3,393 +3,356 @@
  * 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/. */
 
 /* constants for what needs to be recomputed in response to style changes */
 
 #ifndef nsChangeHint_h___
 #define nsChangeHint_h___
 
+#include "mozilla/TypedEnumBits.h"
 #include "mozilla/Types.h"
 #include "nsDebug.h"
 #include "nsTArray.h"
 
 struct nsCSSSelector;
 
 // Defines for various style related constants
 
-enum nsChangeHint {
-  nsChangeHint_Empty = 0,
+typedef uint32_t nsChangeHintTypeBase;
+enum class nsChangeHint : nsChangeHintTypeBase {
+  Empty = 0,
 
   // change was visual only (e.g., COLOR=)
   // Invalidates all descendant frames (including following
   // placeholders to out-of-flow frames).
-  nsChangeHint_RepaintFrame = 1 << 0,
+  RepaintFrame = 1 << 0,
 
   // For reflow, we want flags to give us arbitrary FrameNeedsReflow behavior.
   // just do a FrameNeedsReflow.
-  nsChangeHint_NeedReflow = 1 << 1,
+  NeedReflow = 1 << 1,
 
   // Invalidate intrinsic widths on the frame's ancestors.  Must not be set
-  // without setting nsChangeHint_NeedReflow.
-  nsChangeHint_ClearAncestorIntrinsics = 1 << 2,
+  // without setting nsChangeHint::NeedReflow.
+  ClearAncestorIntrinsics = 1 << 2,
 
   // Invalidate intrinsic widths on the frame's descendants.  Must not be set
-  // without also setting nsChangeHint_ClearAncestorIntrinsics.
-  nsChangeHint_ClearDescendantIntrinsics = 1 << 3,
+  // without also setting nsChangeHint::ClearAncestorIntrinsics.
+  ClearDescendantIntrinsics = 1 << 3,
 
   // Force unconditional reflow of all descendants.  Must not be set without
-  // setting nsChangeHint_NeedReflow, but is independent of both the
+  // setting nsChangeHint::NeedReflow, but is independent of both the
   // Clear*Intrinsics flags.
-  nsChangeHint_NeedDirtyReflow = 1 << 4,
+  NeedDirtyReflow = 1 << 4,
 
   // change requires view to be updated, if there is one (e.g., clip:).
   // Updates all descendants (including following placeholders to out-of-flows).
-  nsChangeHint_SyncFrameView = 1 << 5,
+  SyncFrameView = 1 << 5,
 
   // The currently shown mouse cursor needs to be updated
-  nsChangeHint_UpdateCursor = 1 << 6,
+  UpdateCursor = 1 << 6,
 
   /**
    * Used when the computed value (a URI) of one or more of an element's
    * filter/mask/clip/etc CSS properties changes, causing the element's frame
    * to start/stop referencing (or reference different) SVG resource elements.
    * (_Not_ used to handle changes to referenced resource elements.) Using this
    * hint results in nsSVGEffects::UpdateEffects being called on the element's
    * frame.
    */
-  nsChangeHint_UpdateEffects = 1 << 7,
+  UpdateEffects = 1 << 7,
 
   /**
    * Visual change only, but the change can be handled entirely by
    * updating the layer(s) for the frame.
    * Updates all descendants (including following placeholders to out-of-flows).
    */
-  nsChangeHint_UpdateOpacityLayer = 1 << 8,
+  UpdateOpacityLayer = 1 << 8,
   /**
    * Updates all descendants. Any placeholder descendants' out-of-flows
    * are also descendants of the transformed frame, so they're updated.
    */
-  nsChangeHint_UpdateTransformLayer = 1 << 9,
+  UpdateTransformLayer = 1 << 9,
 
   /**
    * Change requires frame change (e.g., display:).
    * Reconstructs all frame descendants, including following placeholders
    * to out-of-flows.
    *
    * Note that this subsumes all the other change hints. (see
    * RestyleManager::ProcessRestyledFrames for details).
    */
-  nsChangeHint_ReconstructFrame = 1 << 10,
+  ReconstructFrame = 1 << 10,
 
   /**
    * The frame's overflow area has changed. Does not update any descendant
    * frames.
    */
-  nsChangeHint_UpdateOverflow = 1 << 11,
+  UpdateOverflow = 1 << 11,
 
   /**
    * The overflow area of the frame and all of its descendants has changed. This
-   * can happen through a text-decoration change.   
+   * can happen through a text-decoration change.
    */
-  nsChangeHint_UpdateSubtreeOverflow = 1 << 12,
+  UpdateSubtreeOverflow = 1 << 12,
 
   /**
    * The frame's overflow area has changed, through a change in its transform.
    * In other words, the frame's pre-transform overflow is unchanged, but
    * its post-transform overflow has changed, and thus its effect on its
    * parent's overflow has changed.  If the pre-transform overflow has
-   * changed, see nsChangeHint_UpdateOverflow.
+   * changed, see nsChangeHint::UpdateOverflow.
    * Does not update any descendant frames.
    */
-  nsChangeHint_UpdatePostTransformOverflow = 1 << 13,
+  UpdatePostTransformOverflow = 1 << 13,
 
   /**
    * This frame's effect on its parent's overflow area has changed.
    * (But neither its pre-transform nor post-transform overflow have
    * changed; if those are the case, see
-   * nsChangeHint_UpdatePostTransformOverflow.)
+   * nsChangeHint::UpdatePostTransformOverflow.)
    */
-  nsChangeHint_UpdateParentOverflow = 1 << 14,
+  UpdateParentOverflow = 1 << 14,
 
   /**
    * The children-only transform of an SVG frame changed, requiring the
    * overflow rects of the frame's immediate children to be updated.
    */
-  nsChangeHint_ChildrenOnlyTransform = 1 << 15,
+  ChildrenOnlyTransform = 1 << 15,
 
   /**
    * The frame's offsets have changed, while its dimensions might have
    * changed as well.  This hint is used for positioned frames if their
    * offset changes.  If we decide that the dimensions are likely to
    * change, this will trigger a reflow.
    *
    * Note that this should probably be used in combination with
-   * nsChangeHint_UpdateOverflow in order to get the overflow areas of
+   * nsChangeHint::UpdateOverflow in order to get the overflow areas of
    * the ancestors updated as well.
    */
-  nsChangeHint_RecomputePosition = 1 << 16,
+  RecomputePosition = 1 << 16,
 
   /**
    * Behaves like ReconstructFrame, but only if the frame has descendants
    * that are absolutely or fixed position. Use this hint when a style change
    * has changed whether the frame is a container for fixed-pos or abs-pos
    * elements, but reframing is otherwise not needed.
    *
    * Note that nsStyleContext::CalcStyleDifference adjusts results
    * returned by style struct CalcDifference methods to return this hint
    * only if there was a change to whether the element's overall style
    * indicates that it establishes a containing block.
    */
-  nsChangeHint_UpdateContainingBlock = 1 << 17,
+  UpdateContainingBlock = 1 << 17,
 
   /**
    * This change hint has *no* change handling behavior.  However, it
    * exists to be a non-inherited hint, because when the border-style
    * changes, and it's inherited by a child, that might require a reflow
    * due to the border-width change on the child.
    */
-  nsChangeHint_BorderStyleNoneChange = 1 << 18,
+  BorderStyleNoneChange = 1 << 18,
 
   /**
    * SVG textPath needs to be recomputed because the path has changed.
    * This means that the glyph positions of the text need to be recomputed.
    */
-  nsChangeHint_UpdateTextPath = 1 << 19,
+  UpdateTextPath = 1 << 19,
 
   /**
    * This will schedule an invalidating paint. This is useful if something
    * has changed which will be invalidated by DLBI.
    */
-  nsChangeHint_SchedulePaint = 1 << 20,
+  SchedulePaint = 1 << 20,
 
   /**
    * A hint reflecting that style data changed with no change handling
    * behavior.  We need to return this, rather than nsChangeHint(0),
    * so that certain optimizations that manipulate the style context tree are
    * correct.
    *
-   * nsChangeHint_NeutralChange must be returned by CalcDifference on a given
+   * nsChangeHint::NeutralChange must be returned by CalcDifference on a given
    * style struct if the data in the style structs are meaningfully different
    * and if no other change hints are returned.  If any other change hints are
-   * set, then nsChangeHint_NeutralChange need not also be included, but it is
+   * set, then nsChangeHint::NeutralChange need not also be included, but it is
    * safe to do so.  (An example of style structs having non-meaningfully
    * different data would be cached information that would be re-calculated
    * to the same values, such as nsStyleBorder::mSubImages.)
    */
-  nsChangeHint_NeutralChange = 1 << 21,
+  NeutralChange = 1 << 21,
 
   /**
    * This will cause rendering observers to be invalidated.
    */
-  nsChangeHint_InvalidateRenderingObservers = 1 << 22,
+  InvalidateRenderingObservers = 1 << 22,
 
   /**
    * Indicates that the reflow changes the size or position of the
    * element, and thus the reflow must start from at least the frame's
    * parent.
    */
-  nsChangeHint_ReflowChangesSizeOrPosition = 1 << 23,
+  ReflowChangesSizeOrPosition = 1 << 23,
 
   /**
    * Indicates that the style changes the computed BSize --- e.g. 'height'.
    */
-  nsChangeHint_UpdateComputedBSize = 1 << 24,
+  UpdateComputedBSize = 1 << 24,
 
   /**
    * Indicates that the 'opacity' property changed between 1 and non-1.
    *
    * Used as extra data for handling UpdateOpacityLayer hints.
    *
    * Note that we do not send this hint if the non-1 value was 0.99 or
    * greater, since in that case we send a RepaintFrame hint instead.
    */
-  nsChangeHint_UpdateUsesOpacity = 1 << 25,
+  UpdateUsesOpacity = 1 << 25,
 
   /**
    * Indicates that the 'background-position' property changed.
    * Regular frames can invalidate these changes using DLBI, but
    * for some frame types we need to repaint the whole frame because
    * the frame does not build individual background image display items
    * for each background layer.
    */
-  nsChangeHint_UpdateBackgroundPosition = 1 << 26,
+  UpdateBackgroundPosition = 1 << 26,
 
   /**
    * Indicates that a frame has changed to or from having the CSS
    * transform property set.
    */
-  nsChangeHint_AddOrRemoveTransform = 1 << 27,
+  AddOrRemoveTransform = 1 << 27,
 
   // IMPORTANT NOTE: When adding new hints, consider whether you need
   // to add them to NS_HintsNotHandledForDescendantsIn() below. Please
   // also add them to RestyleManager::ChangeHintToString and modify
-  // nsChangeHint_AllHints below accordingly.
+  // nsChangeHint::AllChangeHints below accordingly.
 
   /**
    * Dummy hint value for all hints. It exists for compile time check.
    */
-  nsChangeHint_AllHints = (1 << 28) - 1,
+  AllChangeHints = (1 << 28) - 1,
 };
 
+MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsChangeHint)
+
 // Redefine these operators to return nothing. This will catch any use
 // of these operators on hints. We should not be using these operators
 // on nsChangeHints
 inline void operator<(nsChangeHint s1, nsChangeHint s2) {}
 inline void operator>(nsChangeHint s1, nsChangeHint s2) {}
 inline void operator!=(nsChangeHint s1, nsChangeHint s2) {}
 inline void operator==(nsChangeHint s1, nsChangeHint s2) {}
 inline void operator<=(nsChangeHint s1, nsChangeHint s2) {}
 inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
 
 // Operators on nsChangeHints
 
 // Returns true iff the second hint contains all the hints of the first hint
 inline bool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
-  return (aSubset & aSuperSet) == aSubset;
-}
-
-// The functions below need an integral type to cast to to avoid
-// infinite recursion.
-typedef decltype(nsChangeHint(0) + nsChangeHint(0)) nsChangeHint_size_t;
-
-inline nsChangeHint constexpr
-operator|(nsChangeHint aLeft, nsChangeHint aRight)
-{
-  return nsChangeHint(nsChangeHint_size_t(aLeft) | nsChangeHint_size_t(aRight));
-}
-
-inline nsChangeHint constexpr
-operator&(nsChangeHint aLeft, nsChangeHint aRight)
-{
-  return nsChangeHint(nsChangeHint_size_t(aLeft) & nsChangeHint_size_t(aRight));
-}
-
-inline nsChangeHint& operator|=(nsChangeHint& aLeft, nsChangeHint aRight)
-{
-  return aLeft = aLeft | aRight;
-}
-
-inline nsChangeHint& operator&=(nsChangeHint& aLeft, nsChangeHint aRight)
-{
-  return aLeft = aLeft & aRight;
-}
-
-inline nsChangeHint constexpr
-operator~(nsChangeHint aArg)
-{
-  return nsChangeHint(~nsChangeHint_size_t(aArg));
-}
-
-inline nsChangeHint constexpr
-operator^(nsChangeHint aLeft, nsChangeHint aRight)
-{
-  return nsChangeHint(nsChangeHint_size_t(aLeft) ^ nsChangeHint_size_t(aRight));
-}
-
-inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
-{
-  return aLeft = aLeft ^ aRight;
+  return static_cast<nsChangeHintTypeBase>(aSubset & aSuperSet) ==
+         static_cast<nsChangeHintTypeBase>(aSubset);
 }
 
 /**
  * We have an optimization when processing change hints which prevents
  * us from visiting the descendants of a node when a hint on that node
  * is being processed.  This optimization does not apply in some of the
  * cases where applying a hint to an element does not necessarily result
  * in the same hint being handled on the descendants.
  */
 
 // The most hints that NS_HintsNotHandledForDescendantsIn could possibly return:
 #define nsChangeHint_Hints_NotHandledForDescendants nsChangeHint( \
-          nsChangeHint_UpdateTransformLayer | \
-          nsChangeHint_UpdateEffects | \
-          nsChangeHint_InvalidateRenderingObservers | \
-          nsChangeHint_UpdateOpacityLayer | \
-          nsChangeHint_UpdateOverflow | \
-          nsChangeHint_UpdatePostTransformOverflow | \
-          nsChangeHint_UpdateParentOverflow | \
-          nsChangeHint_ChildrenOnlyTransform | \
-          nsChangeHint_RecomputePosition | \
-          nsChangeHint_UpdateContainingBlock | \
-          nsChangeHint_AddOrRemoveTransform | \
-          nsChangeHint_BorderStyleNoneChange | \
-          nsChangeHint_NeedReflow | \
-          nsChangeHint_ReflowChangesSizeOrPosition | \
-          nsChangeHint_ClearAncestorIntrinsics | \
-          nsChangeHint_UpdateComputedBSize | \
-          nsChangeHint_UpdateUsesOpacity | \
-          nsChangeHint_UpdateBackgroundPosition)
+          nsChangeHint::UpdateTransformLayer | \
+          nsChangeHint::UpdateEffects | \
+          nsChangeHint::InvalidateRenderingObservers | \
+          nsChangeHint::UpdateOpacityLayer | \
+          nsChangeHint::UpdateOverflow | \
+          nsChangeHint::UpdatePostTransformOverflow | \
+          nsChangeHint::UpdateParentOverflow | \
+          nsChangeHint::ChildrenOnlyTransform | \
+          nsChangeHint::RecomputePosition | \
+          nsChangeHint::UpdateContainingBlock | \
+          nsChangeHint::AddOrRemoveTransform | \
+          nsChangeHint::BorderStyleNoneChange | \
+          nsChangeHint::NeedReflow | \
+          nsChangeHint::ReflowChangesSizeOrPosition | \
+          nsChangeHint::ClearAncestorIntrinsics | \
+          nsChangeHint::UpdateComputedBSize | \
+          nsChangeHint::UpdateUsesOpacity | \
+          nsChangeHint::UpdateBackgroundPosition)
 
 inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
-  nsChangeHint result = nsChangeHint(aChangeHint & (
-    nsChangeHint_UpdateTransformLayer |
-    nsChangeHint_UpdateEffects |
-    nsChangeHint_InvalidateRenderingObservers |
-    nsChangeHint_UpdateOpacityLayer |
-    nsChangeHint_UpdateOverflow |
-    nsChangeHint_UpdatePostTransformOverflow |
-    nsChangeHint_UpdateParentOverflow |
-    nsChangeHint_ChildrenOnlyTransform |
-    nsChangeHint_RecomputePosition |
-    nsChangeHint_UpdateContainingBlock |
-    nsChangeHint_AddOrRemoveTransform |
-    nsChangeHint_BorderStyleNoneChange |
-    nsChangeHint_UpdateComputedBSize |
-    nsChangeHint_UpdateUsesOpacity | \
-    nsChangeHint_UpdateBackgroundPosition));
+  nsChangeHint result = aChangeHint & (
+    nsChangeHint::UpdateTransformLayer |
+    nsChangeHint::UpdateEffects |
+    nsChangeHint::InvalidateRenderingObservers |
+    nsChangeHint::UpdateOpacityLayer |
+    nsChangeHint::UpdateOverflow |
+    nsChangeHint::UpdatePostTransformOverflow |
+    nsChangeHint::UpdateParentOverflow |
+    nsChangeHint::ChildrenOnlyTransform |
+    nsChangeHint::RecomputePosition |
+    nsChangeHint::UpdateContainingBlock |
+    nsChangeHint::AddOrRemoveTransform |
+    nsChangeHint::BorderStyleNoneChange |
+    nsChangeHint::UpdateComputedBSize |
+    nsChangeHint::UpdateUsesOpacity |
+    nsChangeHint::UpdateBackgroundPosition);
 
-  if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
-    if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
+  if (!NS_IsHintSubset(nsChangeHint::NeedDirtyReflow, aChangeHint)) {
+    if (NS_IsHintSubset(nsChangeHint::NeedReflow, aChangeHint)) {
       // If NeedDirtyReflow is *not* set, then NeedReflow is a
       // non-inherited hint.
-      result |= nsChangeHint_NeedReflow;
+      result |= nsChangeHint::NeedReflow;
     }
 
-    if (NS_IsHintSubset(nsChangeHint_ReflowChangesSizeOrPosition,
+    if (NS_IsHintSubset(nsChangeHint::ReflowChangesSizeOrPosition,
                         aChangeHint)) {
       // If NeedDirtyReflow is *not* set, then ReflowChangesSizeOrPosition is a
       // non-inherited hint.
-      result |= nsChangeHint_ReflowChangesSizeOrPosition;
+      result |= nsChangeHint::ReflowChangesSizeOrPosition;
     }
   }
 
-  if (!NS_IsHintSubset(nsChangeHint_ClearDescendantIntrinsics, aChangeHint) &&
-      NS_IsHintSubset(nsChangeHint_ClearAncestorIntrinsics, aChangeHint)) {
+  if (!NS_IsHintSubset(nsChangeHint::ClearDescendantIntrinsics, aChangeHint) &&
+      NS_IsHintSubset(nsChangeHint::ClearAncestorIntrinsics, aChangeHint)) {
     // If ClearDescendantIntrinsics is *not* set, then
     // ClearAncestorIntrinsics is a non-inherited hint.
-    result |= nsChangeHint_ClearAncestorIntrinsics;
+    result |= nsChangeHint::ClearAncestorIntrinsics;
   }
 
   MOZ_ASSERT(NS_IsHintSubset(result,
                              nsChangeHint_Hints_NotHandledForDescendants),
              "something is inconsistent");
 
   return result;
 }
 
 // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure
-#define NS_STYLE_HINT_VISUAL \
-  nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView | \
-               nsChangeHint_SchedulePaint)
-#define nsChangeHint_AllReflowHints                     \
-  nsChangeHint(nsChangeHint_NeedReflow |                \
-               nsChangeHint_ReflowChangesSizeOrPosition|\
-               nsChangeHint_ClearAncestorIntrinsics |   \
-               nsChangeHint_ClearDescendantIntrinsics | \
-               nsChangeHint_NeedDirtyReflow)
+#define NS_STYLE_HINT_VISUAL                 \
+  nsChangeHint(nsChangeHint::RepaintFrame |  \
+               nsChangeHint::SyncFrameView | \
+               nsChangeHint::SchedulePaint)
+#define nsChangeHint_AllReflowHints                       \
+  nsChangeHint(nsChangeHint::NeedReflow |                 \
+               nsChangeHint::ReflowChangesSizeOrPosition| \
+               nsChangeHint::ClearAncestorIntrinsics |    \
+               nsChangeHint::ClearDescendantIntrinsics |  \
+               nsChangeHint::NeedDirtyReflow)
 #define NS_STYLE_HINT_REFLOW \
   nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_AllReflowHints)
 
-#define nsChangeHint_Hints_CanIgnoreIfNotVisible   \
-  nsChangeHint(NS_STYLE_HINT_VISUAL |              \
-               nsChangeHint_NeutralChange |        \
-               nsChangeHint_UpdateOpacityLayer |   \
-               nsChangeHint_UpdateTransformLayer | \
-               nsChangeHint_UpdateUsesOpacity)
+#define nsChangeHint_Hints_CanIgnoreIfNotVisible    \
+  nsChangeHint(NS_STYLE_HINT_VISUAL |               \
+               nsChangeHint::NeutralChange |        \
+               nsChangeHint::UpdateOpacityLayer |   \
+               nsChangeHint::UpdateTransformLayer | \
+               nsChangeHint::UpdateUsesOpacity)
 
 /**
  * |nsRestyleHint| is a bitfield for the result of
  * |HasStateDependentStyle| and |HasAttributeDependentStyle|.  When no
  * restyling is necessary, use |nsRestyleHint(0)|.
  *
  * Without eRestyle_Force or eRestyle_ForceDescendants, the restyling process
  * can stop processing at a frame when it detects no style changes and it is
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1878,17 +1878,17 @@ nsPresContext::MediaFeatureValuesChanged
     }
   }
 
   if (mUsesViewportUnits && mPendingViewportChange) {
     // Rebuild all style data without rerunning selector matching.
     aRestyleHint |= eRestyle_ForceDescendants;
   }
 
-  if (aRestyleHint || aChangeHint) {
+  if (aRestyleHint || bool(aChangeHint)) {
     RebuildAllStyleData(aChangeHint, aRestyleHint);
   }
 
   mPendingViewportChange = false;
 
   if (mDocument->IsBeingUsedAsImage()) {
     MOZ_ASSERT(PR_CLIST_IS_EMPTY(mDocument->MediaQueryLists()));
     return;
--- a/layout/base/nsStyleChangeList.cpp
+++ b/layout/base/nsStyleChangeList.cpp
@@ -9,36 +9,38 @@
  */
 
 #include "nsStyleChangeList.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsFrameManager.h"
 
 void
-nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint)
+nsStyleChangeList::AppendChange(nsIFrame* aFrame,
+                                nsIContent* aContent,
+                                nsChangeHint aHint)
 {
-  MOZ_ASSERT(aFrame || (aHint & nsChangeHint_ReconstructFrame),
+  MOZ_ASSERT(aFrame || (aHint & nsChangeHint::ReconstructFrame),
              "must have frame");
-  MOZ_ASSERT(aContent || !(aHint & nsChangeHint_ReconstructFrame),
+  MOZ_ASSERT(aContent || !(aHint & nsChangeHint::ReconstructFrame),
              "must have content");
   // XXXbz we should make this take Element instead of nsIContent
   MOZ_ASSERT(!aContent || aContent->IsElement() ||
              // display:contents elements posts the changes for their children:
              (aFrame && aContent->GetParent() &&
              aFrame->PresContext()->FrameManager()->
                GetDisplayContentsStyleFor(aContent->GetParent())),
              "Shouldn't be trying to restyle non-elements directly, "
              "except if it's a display:contents child");
   MOZ_ASSERT(!(aHint & nsChangeHint_AllReflowHints) ||
-             (aHint & nsChangeHint_NeedReflow),
+             (aHint & nsChangeHint::NeedReflow),
              "Reflow hint bits set without actually asking for a reflow");
 
   // Filter out all other changes for same content
-  if (!IsEmpty() && (aHint & nsChangeHint_ReconstructFrame)) {
+  if (!IsEmpty() && (aHint & nsChangeHint::ReconstructFrame)) {
     if (aContent) {
       // NOTE: This is captured by reference to please static analysis.
       // Capturing it by value as a pointer should be fine in this case.
       RemoveElementsBy([&](const nsStyleChangeData& aData) {
         return aData.mContent == aContent;
       });
     }
   }
--- a/layout/style/LayerAnimationInfo.cpp
+++ b/layout/style/LayerAnimationInfo.cpp
@@ -7,20 +7,20 @@
 
 #include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
 
 namespace mozilla {
 
 /* static */ const LayerAnimationInfo::Record LayerAnimationInfo::sRecords[] =
   { { eCSSProperty_transform,
       nsDisplayItem::TYPE_TRANSFORM,
-      nsChangeHint_UpdateTransformLayer },
+      nsChangeHint::UpdateTransformLayer },
     { eCSSProperty_opacity,
       nsDisplayItem::TYPE_OPACITY,
-      nsChangeHint_UpdateOpacityLayer } };
+      nsChangeHint::UpdateOpacityLayer } };
 
 #ifdef DEBUG
 /* static */ void
 LayerAnimationInfo::Initialize()
 {
   for (const Record& record : sRecords) {
     MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
                                         CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -1042,28 +1042,28 @@ nsStyleContext::CalcStyleDifferenceInter
                  ((maxDifference & ~differenceAlwaysHandledForDescendants) &  \
                   aParentHintsNotHandledForDescendants)) {                    \
         nsChangeHint difference =                                             \
           this##struct_->CalcDifference(*other##struct_ EXTRA_DIFF_ARGS);     \
         NS_ASSERTION(NS_IsHintSubset(difference, maxDifference),              \
                      "CalcDifference() returned bigger hint than "            \
                      "MaxDifference()");                                      \
         hint |= difference;                                                   \
-        if (!difference) {                                                    \
+        if (!bool(difference)) {                                              \
           *aEqualStructs |= NS_STYLE_INHERIT_BIT(struct_);                    \
         }                                                                     \
       } else {                                                                \
         /* We still must call CalcDifference to see if there were any */      \
         /* changes so that we can set *aEqualStructs appropriately.   */      \
         nsChangeHint difference =                                             \
           this##struct_->CalcDifference(*other##struct_ EXTRA_DIFF_ARGS);     \
         NS_ASSERTION(NS_IsHintSubset(difference, maxDifference),              \
                      "CalcDifference() returned bigger hint than "            \
                      "MaxDifference()");                                      \
-        if (!difference) {                                                    \
+        if (!bool(difference)) {                                              \
           *aEqualStructs |= NS_STYLE_INHERIT_BIT(struct_);                    \
         }                                                                     \
       }                                                                       \
     } else {                                                                  \
       *aEqualStructs |= NS_STYLE_INHERIT_BIT(struct_);                        \
     }                                                                         \
     styleStructCount++;                                                       \
   PR_END_MACRO
@@ -1136,36 +1136,36 @@ nsStyleContext::CalcStyleDifferenceInter
     }                                                                         \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
   // Note that we do not check whether this->RelevantLinkVisited() !=
   // aNewContext->RelevantLinkVisited(); we don't need to since
   // nsCSSFrameConstructor::DoContentStateChanged always adds
-  // nsChangeHint_RepaintFrame for NS_EVENT_STATE_VISITED changes (and
+  // nsChangeHint::RepaintFrame for NS_EVENT_STATE_VISITED changes (and
   // needs to, since HasStateDependentStyle probably doesn't work right
   // for NS_EVENT_STATE_VISITED).  Hopefully this doesn't actually
   // expose whether links are visited to performance tests since all
   // link coloring happens asynchronously at a time when it's hard for
   // the page to measure.
   // However, we do need to compute the larger of the changes that can
   // happen depending on whether the link is visited or unvisited, since
   // doing only the one that's currently appropriate would expose which
   // links are in history to easy performance measurement.  Therefore,
-  // here, we add nsChangeHint_RepaintFrame hints (the maximum for
+  // here, we add nsChangeHint::RepaintFrame hints (the maximum for
   // things that can depend on :visited) for the properties on which we
   // call GetVisitedDependentColor.
   nsStyleContext *thisVis = GetStyleIfVisited(),
                 *otherVis = aNewContext->GetStyleIfVisited();
   if (!thisVis != !otherVis) {
     // One style context has a style-if-visited and the other doesn't.
     // Presume a difference.
-    hint |= nsChangeHint_RepaintFrame;
-  } else if (thisVis && !NS_IsHintSubset(nsChangeHint_RepaintFrame, hint)) {
+    hint |= nsChangeHint::RepaintFrame;
+  } else if (thisVis && !NS_IsHintSubset(nsChangeHint::RepaintFrame, hint)) {
     // Both style contexts have a style-if-visited.
     bool change = false;
 
     // NB: Calling Peek on |this|, not |thisVis|, since callers may look
     // at a struct on |this| without looking at the same struct on
     // |thisVis| (including this function if we skip one of these checks
     // due to change being true already or due to the old style context
     // not having a style-if-visited), but not the other way around.
@@ -1242,22 +1242,22 @@ nsStyleContext::CalcStyleDifferenceInter
       const nsStyleSVG *otherVisSVG = otherVis->StyleSVG();
       if (thisVisSVG->mFill != otherVisSVG->mFill ||
           thisVisSVG->mStroke != otherVisSVG->mStroke) {
         change = true;
       }
     }
 
     if (change) {
-      hint |= nsChangeHint_RepaintFrame;
+      hint |= nsChangeHint::RepaintFrame;
     }
   }
 
-  if (hint & nsChangeHint_UpdateContainingBlock) {
-    // If a struct returned nsChangeHint_UpdateContainingBlock, that
+  if (hint & nsChangeHint::UpdateContainingBlock) {
+    // If a struct returned nsChangeHint::UpdateContainingBlock, that
     // means that one property's influence on whether we're a containing
     // block for abs-pos or fixed-pos elements has changed.  However, we
     // only need to return the hint if the overall computation of
     // whether we establish a containing block has changed.
 
     // This depends on data in nsStyleDisplay and nsStyleEffects, so we
     // do it here.
 
@@ -1268,23 +1268,23 @@ nsStyleContext::CalcStyleDifferenceInter
     if (StyleDisplay()->IsAbsPosContainingBlockForAppropriateFrame(this) ==
         aNewContext->StyleDisplay()->
           IsAbsPosContainingBlockForAppropriateFrame(aNewContext) &&
         StyleDisplay()->IsFixedPosContainingBlockForAppropriateFrame(this) ==
         aNewContext->StyleDisplay()->
           IsFixedPosContainingBlockForAppropriateFrame(aNewContext)) {
       // While some styles that cause the frame to be a containing block
       // has changed, the overall result hasn't.
-      hint &= ~nsChangeHint_UpdateContainingBlock;
+      hint &= ~nsChangeHint::UpdateContainingBlock;
     }
   }
 
-  MOZ_ASSERT(NS_IsHintSubset(hint, nsChangeHint_AllHints),
-             "Added a new hint without bumping AllHints?");
-  return hint & ~nsChangeHint_NeutralChange;
+  MOZ_ASSERT(NS_IsHintSubset(hint, nsChangeHint::AllChangeHints),
+             "Added a new hint without bumping nsChangeHint::AllChangeHints?");
+  return hint & ~nsChangeHint::NeutralChange;
 }
 
 nsChangeHint
 nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext,
                                     nsChangeHint aParentHintsNotHandledForDescendants,
                                     uint32_t* aEqualStructs,
                                     uint32_t* aSamePointerStructs)
 {
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -192,23 +192,23 @@ nsStyleFont::CalcDifference(const nsStyl
       mLanguage != aNewData.mLanguage ||
       mExplicitLanguage != aNewData.mExplicitLanguage ||
       mMathVariant != aNewData.mMathVariant ||
       mMathDisplay != aNewData.mMathDisplay ||
       mMinFontSizeRatio != aNewData.mMinFontSizeRatio) {
     return NS_STYLE_HINT_REFLOW;
   }
 
-  // XXX Should any of these cause a non-nsChangeHint_NeutralChange change?
+  // XXX Should any of these cause a non-nsChangeHint::NeutralChange change?
   if (mGenericID != aNewData.mGenericID ||
       mScriptLevel != aNewData.mScriptLevel ||
       mScriptUnconstrainedSize != aNewData.mScriptUnconstrainedSize ||
       mScriptMinSize != aNewData.mScriptMinSize ||
       mScriptSizeMultiplier != aNewData.mScriptSizeMultiplier) {
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 /* static */ nscoord
 nsStyleFont::ZoomText(StyleStructContext aContext, nscoord aSize)
 {
@@ -265,19 +265,19 @@ nsStyleMargin::Destroy(nsPresContext* aC
 nsChangeHint
 nsStyleMargin::CalcDifference(const nsStyleMargin& aNewData) const
 {
   if (mMargin == aNewData.mMargin) {
     return nsChangeHint(0);
   }
   // Margin differences can't affect descendant intrinsic sizes and
   // don't need to force children to reflow.
-  return nsChangeHint_NeedReflow |
-         nsChangeHint_ReflowChangesSizeOrPosition |
-         nsChangeHint_ClearAncestorIntrinsics;
+  return nsChangeHint::NeedReflow |
+         nsChangeHint::ReflowChangesSizeOrPosition |
+         nsChangeHint::ClearAncestorIntrinsics;
 }
 
 nsStylePadding::nsStylePadding(StyleStructContext aContext)
 {
   MOZ_COUNT_CTOR(nsStylePadding);
   nsStyleCoord zero(0, nsStyleCoord::CoordConstructor);
   NS_FOR_CSS_SIDES(side) {
     mPadding.Set(side, zero);
@@ -306,17 +306,18 @@ nsStylePadding::CalcDifference(const nsS
   // Padding differences can't affect descendant intrinsic sizes, but do need
   // to force children to reflow so that we can reposition them, since their
   // offsets are from our frame bounds but our content rect's position within
   // those bounds is moving.
   // FIXME: It would be good to return a weaker hint here that doesn't
   // force reflow of all descendants, but the hint would need to force
   // reflow of the frame's children (see how
   // ReflowInput::InitResizeFlags initializes the inline-resize flag).
-  return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics;
+  return NS_STYLE_HINT_REFLOW &
+         ~nsChangeHint::ClearDescendantIntrinsics;
 }
 
 nsStyleBorder::nsStyleBorder(StyleStructContext aContext)
   : mBorderColors(nullptr)
   , mBorderImageFill(NS_STYLE_BORDER_IMAGE_SLICE_NOFILL)
   , mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
   , mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
   , mFloatEdge(StyleFloatEdge::ContentBox)
@@ -466,71 +467,71 @@ nsStyleBorder::CalcDifference(const nsSt
       mFloatEdge != aNewData.mFloatEdge ||
       mBorderImageOutset != aNewData.mBorderImageOutset ||
       mBoxDecorationBreak != aNewData.mBoxDecorationBreak) {
     return NS_STYLE_HINT_REFLOW;
   }
 
   NS_FOR_CSS_SIDES(ix) {
     // See the explanation in nsChangeHint.h of
-    // nsChangeHint_BorderStyleNoneChange .
+    // nsChangeHint::BorderStyleNoneChange .
     // Furthermore, even though we know *this* side is 0 width, just
     // assume a repaint hint for some other change rather than bother
     // tracking this result through the rest of the function.
     if (HasVisibleStyle(ix) != aNewData.HasVisibleStyle(ix)) {
-      return nsChangeHint_RepaintFrame |
-             nsChangeHint_BorderStyleNoneChange;
+      return nsChangeHint::RepaintFrame |
+             nsChangeHint::BorderStyleNoneChange;
     }
   }
 
   // Note that mBorderStyle stores not only the border style but also
   // color-related flags.  Given that we've already done an mComputedBorder
   // comparison, border-style differences can only lead to a repaint hint.  So
   // it's OK to just compare the values directly -- if either the actual
   // style or the color flags differ we want to repaint.
   NS_FOR_CSS_SIDES(ix) {
     if (mBorderStyle[ix] != aNewData.mBorderStyle[ix] ||
         mBorderColor[ix] != aNewData.mBorderColor[ix]) {
-      return nsChangeHint_RepaintFrame;
+      return nsChangeHint::RepaintFrame;
     }
   }
 
   if (mBorderRadius != aNewData.mBorderRadius ||
       !mBorderColors != !aNewData.mBorderColors) {
-    return nsChangeHint_RepaintFrame;
+    return nsChangeHint::RepaintFrame;
   }
 
   if (IsBorderImageLoaded() || aNewData.IsBorderImageLoaded()) {
     if (mBorderImageSource  != aNewData.mBorderImageSource  ||
         mBorderImageRepeatH != aNewData.mBorderImageRepeatH ||
         mBorderImageRepeatV != aNewData.mBorderImageRepeatV ||
         mBorderImageSlice   != aNewData.mBorderImageSlice   ||
         mBorderImageFill    != aNewData.mBorderImageFill    ||
         mBorderImageWidth   != aNewData.mBorderImageWidth   ||
         mBorderImageOutset  != aNewData.mBorderImageOutset) {
-      return nsChangeHint_RepaintFrame;
+      return nsChangeHint::RepaintFrame;
     }
   }
 
   // Note that at this point if mBorderColors is non-null so is
   // aNewData.mBorderColors
   if (mBorderColors) {
     NS_FOR_CSS_SIDES(ix) {
       if (!nsBorderColors::Equal(mBorderColors[ix],
                                  aNewData.mBorderColors[ix])) {
-        return nsChangeHint_RepaintFrame;
+        return nsChangeHint::RepaintFrame;
       }
     }
   }
 
   // mBorder is the specified border value.  Changes to this don't
   // need any change processing, since we operate on the computed
   // border values instead.
   if (mBorder != aNewData.mBorder) {
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 nsStyleOutline::nsStyleOutline(StyleStructContext aContext)
   : mOutlineWidth((StaticPresData::Get()
                      ->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
@@ -572,33 +573,33 @@ nsStyleOutline::RecalcData()
 }
 
 nsChangeHint
 nsStyleOutline::CalcDifference(const nsStyleOutline& aNewData) const
 {
   if (mActualOutlineWidth != aNewData.mActualOutlineWidth ||
       (mActualOutlineWidth > 0 &&
        mOutlineOffset != aNewData.mOutlineOffset)) {
-    return nsChangeHint_UpdateOverflow |
-           nsChangeHint_SchedulePaint;
+    return nsChangeHint::UpdateOverflow |
+           nsChangeHint::SchedulePaint;
   }
 
   if (mOutlineStyle != aNewData.mOutlineStyle ||
       mOutlineColor != aNewData.mOutlineColor ||
       mOutlineRadius != aNewData.mOutlineRadius) {
     if (mActualOutlineWidth > 0) {
-      return nsChangeHint_RepaintFrame;
+      return nsChangeHint::RepaintFrame;
     }
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   if (mOutlineWidth != aNewData.mOutlineWidth ||
       mOutlineOffset != aNewData.mOutlineOffset ||
       mTwipsPerPixel != aNewData.mTwipsPerPixel) {
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 // --------------------
 // nsStyleList
 //
@@ -690,20 +691,20 @@ nsStyleList::GetQuotePairs() const
 nsChangeHint
 nsStyleList::CalcDifference(const nsStyleList& aNewData) const
 {
   // If the quotes implementation is ever going to change we might not need
   // a framechange here and a reflow should be sufficient.  See bug 35768.
   if (mQuotes != aNewData.mQuotes &&
       (mQuotes || aNewData.mQuotes) &&
       GetQuotePairs() != aNewData.GetQuotePairs()) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   if (mListStylePosition != aNewData.mListStylePosition) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   if (DefinitelyEqualImages(mListStyleImage, aNewData.mListStyleImage) &&
       mCounterStyle == aNewData.mCounterStyle) {
     if (mImageRegion.IsEqualInterior(aNewData.mImageRegion)) {
       return nsChangeHint(0);
     }
     if (mImageRegion.width == aNewData.mImageRegion.width &&
         mImageRegion.height == aNewData.mImageRegion.height) {
@@ -760,17 +761,17 @@ nsStyleXUL::CalcDifference(const nsStyle
       mBoxFlex == aNewData.mBoxFlex &&
       mBoxOrient == aNewData.mBoxOrient &&
       mBoxPack == aNewData.mBoxPack &&
       mBoxOrdinal == aNewData.mBoxOrdinal &&
       mStretchStack == aNewData.mStretchStack) {
     return nsChangeHint(0);
   }
   if (mBoxOrdinal != aNewData.mBoxOrdinal) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   return NS_STYLE_HINT_REFLOW;
 }
 
 // --------------------
 // nsStyleColumn
 //
 /* static */ const uint32_t nsStyleColumn::kMaxColumnCount;
@@ -811,36 +812,36 @@ nsChangeHint
 nsStyleColumn::CalcDifference(const nsStyleColumn& aNewData) const
 {
   if ((mColumnWidth.GetUnit() == eStyleUnit_Auto)
       != (aNewData.mColumnWidth.GetUnit() == eStyleUnit_Auto) ||
       mColumnCount != aNewData.mColumnCount) {
     // We force column count changes to do a reframe, because it's tricky to handle
     // some edge cases where the column count gets smaller and content overflows.
     // XXX not ideal
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   if (mColumnWidth != aNewData.mColumnWidth ||
       mColumnGap != aNewData.mColumnGap ||
       mColumnFill != aNewData.mColumnFill) {
     return NS_STYLE_HINT_REFLOW;
   }
 
   if (GetComputedColumnRuleWidth() != aNewData.GetComputedColumnRuleWidth() ||
       mColumnRuleStyle != aNewData.mColumnRuleStyle ||
       mColumnRuleColor != aNewData.mColumnRuleColor) {
     return NS_STYLE_HINT_VISUAL;
   }
 
   // XXX Is it right that we never check mTwipsPerPixel to return a
-  // non-nsChangeHint_NeutralChange hint?
+  // non-nsChangeHint::NeutralChange hint?
   if (mColumnRuleWidth != aNewData.mColumnRuleWidth ||
       mTwipsPerPixel != aNewData.mTwipsPerPixel) {
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 // --------------------
 // nsStyleSVG
 //
@@ -915,75 +916,75 @@ nsStyleSVG::CalcDifference(const nsStyle
 {
   nsChangeHint hint = nsChangeHint(0);
 
   if (!DefinitelyEqualURIs(mMarkerEnd, aNewData.mMarkerEnd) ||
       !DefinitelyEqualURIs(mMarkerMid, aNewData.mMarkerMid) ||
       !DefinitelyEqualURIs(mMarkerStart, aNewData.mMarkerStart)) {
     // Markers currently contribute to SVGGeometryFrame::mRect,
     // so we need a reflow as well as a repaint. No intrinsic sizes need
-    // to change, so nsChangeHint_NeedReflow is sufficient.
-    return nsChangeHint_UpdateEffects |
-           nsChangeHint_NeedReflow |
-           nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
-           nsChangeHint_RepaintFrame;
+    // to change, so nsChangeHint::NeedReflow is sufficient.
+    return nsChangeHint::UpdateEffects |
+           nsChangeHint::NeedReflow |
+           nsChangeHint::NeedDirtyReflow | // XXX remove me: bug 876085
+           nsChangeHint::RepaintFrame;
   }
 
   if (mFill != aNewData.mFill ||
       mStroke != aNewData.mStroke ||
       mFillOpacity != aNewData.mFillOpacity ||
       mStrokeOpacity != aNewData.mStrokeOpacity) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
     if (HasStroke() != aNewData.HasStroke() ||
         (!HasStroke() && HasFill() != aNewData.HasFill())) {
       // Frame bounds and overflow rects depend on whether we "have" fill or
       // stroke. Whether we have stroke or not just changed, or else we have no
       // stroke (in which case whether we have fill or not is significant to frame
       // bounds) and whether we have fill or not just changed. In either case we
       // need to reflow so the frame rect is updated.
       // XXXperf this is a waste on non SVGGeometryFrames.
-      hint |= nsChangeHint_NeedReflow |
-              nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
+      hint |= nsChangeHint::NeedReflow |
+              nsChangeHint::NeedDirtyReflow; // XXX remove me: bug 876085
     }
     if (PaintURIChanged(mFill, aNewData.mFill) ||
         PaintURIChanged(mStroke, aNewData.mStroke)) {
-      hint |= nsChangeHint_UpdateEffects;
+      hint |= nsChangeHint::UpdateEffects;
     }
   }
 
   // Stroke currently contributes to SVGGeometryFrame::mRect, so
   // we need a reflow here. No intrinsic sizes need to change, so
-  // nsChangeHint_NeedReflow is sufficient.
+  // nsChangeHint::NeedReflow is sufficient.
   // Note that stroke-dashoffset does not affect SVGGeometryFrame::mRect.
   // text-anchor changes also require a reflow since it changes frames' rects.
   if (mStrokeWidth           != aNewData.mStrokeWidth           ||
       mStrokeMiterlimit      != aNewData.mStrokeMiterlimit      ||
       mStrokeLinecap         != aNewData.mStrokeLinecap         ||
       mStrokeLinejoin        != aNewData.mStrokeLinejoin        ||
       mTextAnchor            != aNewData.mTextAnchor) {
     return hint |
-           nsChangeHint_NeedReflow |
-           nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
-           nsChangeHint_RepaintFrame;
+           nsChangeHint::NeedReflow |
+           nsChangeHint::NeedDirtyReflow | // XXX remove me: bug 876085
+           nsChangeHint::RepaintFrame;
   }
 
-  if (hint & nsChangeHint_RepaintFrame) {
+  if (hint & nsChangeHint::RepaintFrame) {
     return hint; // we don't add anything else below
   }
 
   if ( mStrokeDashoffset      != aNewData.mStrokeDashoffset      ||
        mClipRule              != aNewData.mClipRule              ||
        mColorInterpolation    != aNewData.mColorInterpolation    ||
        mColorInterpolationFilters != aNewData.mColorInterpolationFilters ||
        mFillRule              != aNewData.mFillRule              ||
        mPaintOrder            != aNewData.mPaintOrder            ||
        mShapeRendering        != aNewData.mShapeRendering        ||
        mStrokeDasharray       != aNewData.mStrokeDasharray       ||
        mContextFlags          != aNewData.mContextFlags) {
-    return hint | nsChangeHint_RepaintFrame;
+    return hint | nsChangeHint::RepaintFrame;
   }
 
   return hint;
 }
 
 // --------------------
 // StyleBasicShape
 
@@ -1170,42 +1171,42 @@ nsStyleSVGReset::FinishStyle(nsPresConte
 }
 
 nsChangeHint
 nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
 
   if (mClipPath != aNewData.mClipPath) {
-    hint |= nsChangeHint_UpdateEffects |
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::UpdateEffects |
+            nsChangeHint::RepaintFrame;
     // clip-path changes require that we update the PreEffectsBBoxProperty,
     // which is done during overflow computation.
-    hint |= nsChangeHint_UpdateOverflow;
+    hint |= nsChangeHint::UpdateOverflow;
   }
 
   if (mDominantBaseline != aNewData.mDominantBaseline) {
     // XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
     hint |= NS_STYLE_HINT_REFLOW;
   } else if (mVectorEffect  != aNewData.mVectorEffect) {
     // Stroke currently affects SVGGeometryFrame::mRect, and
     // vector-effect affect stroke. As a result we need to reflow if
     // vector-effect changes in order to have SVGGeometryFrame::
     // ReflowSVG called to update its mRect. No intrinsic sizes need
-    // to change so nsChangeHint_NeedReflow is sufficient.
-    hint |= nsChangeHint_NeedReflow |
-            nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
-            nsChangeHint_RepaintFrame;
+    // to change so nsChangeHint::NeedReflow is sufficient.
+    hint |= nsChangeHint::NeedReflow |
+            nsChangeHint::NeedDirtyReflow | // XXX remove me: bug 876085
+            nsChangeHint::RepaintFrame;
   } else if (mStopColor     != aNewData.mStopColor     ||
              mFloodColor    != aNewData.mFloodColor    ||
              mLightingColor != aNewData.mLightingColor ||
              mStopOpacity   != aNewData.mStopOpacity   ||
              mFloodOpacity  != aNewData.mFloodOpacity  ||
              mMaskType      != aNewData.mMaskType) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   hint |= mMask.CalcDifference(aNewData.mMask,
                                nsStyleImageLayers::LayerType::Mask);
 
   return hint;
 }
 
@@ -1461,109 +1462,104 @@ IsAutonessEqual(const nsStyleSides& aSid
 nsChangeHint
 nsStylePosition::CalcDifference(const nsStylePosition& aNewData,
                                 const nsStyleVisibility* aOldStyleVisibility) const
 {
   nsChangeHint hint = nsChangeHint(0);
 
   // Changes to "z-index" require a repaint.
   if (mZIndex != aNewData.mZIndex) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   // Changes to "object-fit" & "object-position" require a repaint.  They
   // may also require a reflow, if we have a nsSubDocumentFrame, so that we
   // can adjust the size & position of the subdocument.
   if (mObjectFit != aNewData.mObjectFit ||
       mObjectPosition != aNewData.mObjectPosition) {
-    hint |= nsChangeHint_RepaintFrame |
-            nsChangeHint_NeedReflow;
+    hint |= nsChangeHint::RepaintFrame |
+            nsChangeHint::NeedReflow;
   }
 
   if (mOrder != aNewData.mOrder) {
     // "order" impacts both layout order and stacking order, so we need both a
     // reflow and a repaint when it changes.  (Technically, we only need a
     // reflow if we're in a multi-line flexbox (which we can't be sure about,
     // since that's determined by styling on our parent) -- there, "order" can
     // affect which flex line we end up on, & hence can affect our sizing by
     // changing the group of flex items we're competing with for space.)
     return hint |
-           nsChangeHint_RepaintFrame |
+           nsChangeHint::RepaintFrame |
            nsChangeHint_AllReflowHints;
   }
 
   if (mBoxSizing != aNewData.mBoxSizing) {
     // Can affect both widths and heights; just a bad scene.
-    return hint |
-           nsChangeHint_AllReflowHints;
+    return hint | nsChangeHint_AllReflowHints;
   }
 
   // Properties that apply to flex items:
   // XXXdholbert These should probably be more targeted (bug 819536)
   if (mAlignSelf != aNewData.mAlignSelf ||
       mFlexBasis != aNewData.mFlexBasis ||
       mFlexGrow != aNewData.mFlexGrow ||
       mFlexShrink != aNewData.mFlexShrink) {
-    return hint |
-           nsChangeHint_AllReflowHints;
+    return hint | nsChangeHint_AllReflowHints;
   }
 
   // Properties that apply to flex containers:
   // - flex-direction can swap a flex container between vertical & horizontal.
   // - align-items can change the sizing of a flex container & the positioning
   //   of its children.
   // - flex-wrap changes whether a flex container's children are wrapped, which
   //   impacts their sizing/positioning and hence impacts the container's size.
   if (mAlignItems != aNewData.mAlignItems ||
       mFlexDirection != aNewData.mFlexDirection ||
       mFlexWrap != aNewData.mFlexWrap) {
-    return hint |
-           nsChangeHint_AllReflowHints;
+    return hint | nsChangeHint_AllReflowHints;
   }
 
   // Properties that apply to grid containers:
   // FIXME: only for grid containers
   // (ie. 'display: grid' or 'display: inline-grid')
   if (mGridTemplateColumns != aNewData.mGridTemplateColumns ||
       mGridTemplateRows != aNewData.mGridTemplateRows ||
       mGridTemplateAreas != aNewData.mGridTemplateAreas ||
       mGridAutoColumnsMin != aNewData.mGridAutoColumnsMin ||
       mGridAutoColumnsMax != aNewData.mGridAutoColumnsMax ||
       mGridAutoRowsMin != aNewData.mGridAutoRowsMin ||
       mGridAutoRowsMax != aNewData.mGridAutoRowsMax ||
       mGridAutoFlow != aNewData.mGridAutoFlow) {
-    return hint |
-           nsChangeHint_AllReflowHints;
+    return hint | nsChangeHint_AllReflowHints;
   }
 
   // Properties that apply to grid items:
   // FIXME: only for grid items
   // (ie. parent frame is 'display: grid' or 'display: inline-grid')
   if (mGridColumnStart != aNewData.mGridColumnStart ||
       mGridColumnEnd != aNewData.mGridColumnEnd ||
       mGridRowStart != aNewData.mGridRowStart ||
       mGridRowEnd != aNewData.mGridRowEnd ||
       mGridColumnGap != aNewData.mGridColumnGap ||
       mGridRowGap != aNewData.mGridRowGap) {
-    return hint |
-           nsChangeHint_AllReflowHints;
+    return hint | nsChangeHint_AllReflowHints;
   }
 
   // Changing 'justify-content/items/self' might affect the positioning,
   // but it won't affect any sizing.
   if (mJustifyContent != aNewData.mJustifyContent ||
       mJustifyItems != aNewData.mJustifyItems ||
       mJustifySelf != aNewData.mJustifySelf) {
-    hint |= nsChangeHint_NeedReflow;
+    hint |= nsChangeHint::NeedReflow;
   }
 
   // 'align-content' doesn't apply to a single-line flexbox but we don't know
   // if we're a flex container at this point so we can't optimize for that.
   if (mAlignContent != aNewData.mAlignContent) {
-    hint |= nsChangeHint_NeedReflow;
+    hint |= nsChangeHint::NeedReflow;
   }
 
   bool widthChanged = mWidth != aNewData.mWidth ||
                       mMinWidth != aNewData.mMinWidth ||
                       mMaxWidth != aNewData.mMaxWidth;
   bool heightChanged = mHeight != aNewData.mHeight ||
                        mMinHeight != aNewData.mMinHeight ||
                        mMaxHeight != aNewData.mMaxHeight;
@@ -1580,48 +1576,48 @@ nsStylePosition::CalcDifference(const ns
   // visibility struct, since a change between vertical and horizontal
   // writing-mode will cause a reframe, and it's easier to pass the old.
   if (aOldStyleVisibility) {
     bool isVertical = WritingMode(aOldStyleVisibility).IsVertical();
     if (isVertical ? widthChanged : heightChanged) {
       // Block-size changes can affect descendant intrinsic sizes due to
       // replaced elements with percentage bsizes in descendants which
       // also have percentage bsizes. This is handled via
-      // nsChangeHint_UpdateComputedBSize which clears intrinsic sizes
+      // nsChangeHint::UpdateComputedBSize which clears intrinsic sizes
       // for frames that have such replaced elements.
-      hint |= nsChangeHint_NeedReflow |
-              nsChangeHint_UpdateComputedBSize |
-              nsChangeHint_ReflowChangesSizeOrPosition;
+      hint |= nsChangeHint::NeedReflow |
+              nsChangeHint::UpdateComputedBSize |
+              nsChangeHint::ReflowChangesSizeOrPosition;
     }
 
     if (isVertical ? heightChanged : widthChanged) {
       // None of our inline-size differences can affect descendant
       // intrinsic sizes and none of them need to force children to
       // reflow.
       hint |= nsChangeHint_AllReflowHints &
-              ~(nsChangeHint_ClearDescendantIntrinsics |
-                nsChangeHint_NeedDirtyReflow);
+              ~(nsChangeHint::ClearDescendantIntrinsics |
+                nsChangeHint::NeedDirtyReflow);
     }
   } else {
     if (widthChanged || heightChanged) {
-      hint |= nsChangeHint_NeutralChange;
+      hint |= nsChangeHint::NeutralChange;
     }
   }
 
   // If any of the offsets have changed, then return the respective hints
   // so that we would hopefully be able to avoid reflowing.
   // Note that it is possible that we'll need to reflow when processing
   // restyles, but we don't have enough information to make a good decision
   // right now.
   // Don't try to handle changes between "auto" and non-auto efficiently;
   // that's tricky to do and will hardly ever be able to avoid a reflow.
   if (mOffset != aNewData.mOffset) {
     if (IsAutonessEqual(mOffset, aNewData.mOffset)) {
-      hint |= nsChangeHint_RecomputePosition |
-              nsChangeHint_UpdateParentOverflow;
+      hint |= nsChangeHint::RecomputePosition |
+              nsChangeHint::UpdateParentOverflow;
     } else {
       hint |= nsChangeHint_AllReflowHints;
     }
   }
   return hint;
 }
 
 /* static */ bool
@@ -1703,17 +1699,17 @@ nsStyleTable::nsStyleTable(const nsStyle
   MOZ_COUNT_CTOR(nsStyleTable);
 }
 
 nsChangeHint
 nsStyleTable::CalcDifference(const nsStyleTable& aNewData) const
 {
   if (mSpan != aNewData.mSpan ||
       mLayoutStrategy != aNewData.mLayoutStrategy) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   return nsChangeHint(0);
 }
 
 // -----------------------
 // nsStyleTableBorder
 
 nsStyleTableBorder::nsStyleTableBorder(StyleStructContext aContext)
@@ -1744,17 +1740,17 @@ nsStyleTableBorder::nsStyleTableBorder(c
 nsChangeHint
 nsStyleTableBorder::CalcDifference(const nsStyleTableBorder& aNewData) const
 {
   // Border-collapse changes need a reframe, because we use a different frame
   // class for table cells in the collapsed border model.  This is used to
   // conserve memory when using the separated border model (collapsed borders
   // require extra state to be stored).
   if (mBorderCollapse != aNewData.mBorderCollapse) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   if ((mCaptionSide == aNewData.mCaptionSide) &&
       (mBorderSpacingCol == aNewData.mBorderSpacingCol) &&
       (mBorderSpacingRow == aNewData.mBorderSpacingRow)) {
     if (mEmptyCells == aNewData.mEmptyCells) {
       return nsChangeHint(0);
     }
@@ -1781,17 +1777,17 @@ nsStyleColor::nsStyleColor(const nsStyle
 }
 
 nsChangeHint
 nsStyleColor::CalcDifference(const nsStyleColor& aNewData) const
 {
   if (mColor == aNewData.mColor) {
     return nsChangeHint(0);
   }
-  return nsChangeHint_RepaintFrame;
+  return nsChangeHint::RepaintFrame;
 }
 
 // --------------------
 // nsStyleGradient
 //
 bool
 nsStyleGradient::operator==(const nsStyleGradient& aOther) const
 {
@@ -2514,49 +2510,49 @@ nsStyleImageLayers::CalcDifference(const
     mImageCount > aNewLayers.mImageCount ?
       aNewLayers : *this;
 
   NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, moreLayers) {
     if (i < lessLayers.mImageCount) {
       nsChangeHint layerDifference =
         moreLayers.mLayers[i].CalcDifference(lessLayers.mLayers[i]);
       hint |= layerDifference;
-      if (layerDifference &&
+      if (bool(layerDifference) &&
           ((moreLayers.mLayers[i].mImage.GetType() == eStyleImageType_Element) ||
            (lessLayers.mLayers[i].mImage.GetType() == eStyleImageType_Element))) {
-        hint |= nsChangeHint_UpdateEffects | nsChangeHint_RepaintFrame;
+        hint |= nsChangeHint::UpdateEffects | nsChangeHint::RepaintFrame;
       }
     } else {
-      hint |= nsChangeHint_RepaintFrame;
+      hint |= nsChangeHint::RepaintFrame;
       if (moreLayers.mLayers[i].mImage.GetType() == eStyleImageType_Element) {
-        hint |= nsChangeHint_UpdateEffects | nsChangeHint_RepaintFrame;
+        hint |= nsChangeHint::UpdateEffects | nsChangeHint::RepaintFrame;
       }
     }
   }
 
   if (aType == nsStyleImageLayers::LayerType::Mask &&
       mImageCount != aNewLayers.mImageCount) {
-    hint |= nsChangeHint_UpdateEffects;
+    hint |= nsChangeHint::UpdateEffects;
   }
 
-  if (hint) {
+  if (bool(hint)) {
     return hint;
   }
 
   if (mAttachmentCount != aNewLayers.mAttachmentCount ||
       mBlendModeCount != aNewLayers.mBlendModeCount ||
       mClipCount != aNewLayers.mClipCount ||
       mCompositeCount != aNewLayers.mCompositeCount ||
       mMaskModeCount != aNewLayers.mMaskModeCount ||
       mOriginCount != aNewLayers.mOriginCount ||
       mRepeatCount != aNewLayers.mRepeatCount ||
       mPositionXCount != aNewLayers.mPositionXCount ||
       mPositionYCount != aNewLayers.mPositionYCount ||
       mSizeCount != aNewLayers.mSizeCount) {
-    hint |= nsChangeHint_NeutralChange;
+    hint |= nsChangeHint::NeutralChange;
   }
 
   return hint;
 }
 
 bool
 nsStyleImageLayers::HasLayerWithImage() const
 {
@@ -2811,17 +2807,17 @@ nsStyleImageLayers::Layer::operator==(co
          DefinitelyEqualURIs(mSourceURI, aOther.mSourceURI);
 }
 
 nsChangeHint
 nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aNewLayer) const
 {
   nsChangeHint hint = nsChangeHint(0);
   if (!DefinitelyEqualURIs(mSourceURI, aNewLayer.mSourceURI)) {
-    hint |= nsChangeHint_RepaintFrame | nsChangeHint_UpdateEffects;
+    hint |= nsChangeHint::RepaintFrame | nsChangeHint::UpdateEffects;
 
     // If Layer::mSourceURI links to a SVG mask, it has a fragment. Not vice
     // versa. Here are examples of URI contains a fragment, two of them link
     // to a SVG mask:
     //   mask:url(a.svg#maskID); // The fragment of this URI is an ID of a mask
     //                           // element in a.svg.
     //   mask:url(#localMaskID); // The fragment of this URI is an ID of a mask
     //                           // element in local document.
@@ -2843,37 +2839,37 @@ nsStyleImageLayers::Layer::CalcDifferenc
         if (aNewLayer.mSourceURI->IsLocalRef()) {
           maybeSVGMask = true;
         } else if (aNewLayer.mSourceURI->GetURI()) {
           aNewLayer.mSourceURI->GetURI()->GetHasRef(&maybeSVGMask);
         }
       }
     }
 
-    // Return nsChangeHint_UpdateOverflow if either URI might link to an SVG
+    // Return nsChangeHint::UpdateOverflow if either URI might link to an SVG
     // mask.
     if (maybeSVGMask) {
       // Mask changes require that we update the PreEffectsBBoxProperty,
       // which is done during overflow computation.
-      hint |= nsChangeHint_UpdateOverflow;
+      hint |= nsChangeHint::UpdateOverflow;
     }
   } else if (mAttachment != aNewLayer.mAttachment ||
              mClip != aNewLayer.mClip ||
              mOrigin != aNewLayer.mOrigin ||
              mRepeat != aNewLayer.mRepeat ||
              mBlendMode != aNewLayer.mBlendMode ||
              mSize != aNewLayer.mSize ||
              mImage != aNewLayer.mImage ||
              mMaskMode != aNewLayer.mMaskMode ||
              mComposite != aNewLayer.mComposite) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   if (mPosition != aNewLayer.mPosition) {
-    hint |= nsChangeHint_UpdateBackgroundPosition;
+    hint |= nsChangeHint::UpdateBackgroundPosition;
   }
 
   return hint;
 }
 
 // --------------------
 // nsStyleBackground
 //
@@ -2914,17 +2910,17 @@ nsStyleBackground::FinishStyle(nsPresCon
   mImage.ResolveImages(aPresContext);
 }
 
 nsChangeHint
 nsStyleBackground::CalcDifference(const nsStyleBackground& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
   if (mBackgroundColor != aNewData.mBackgroundColor) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   hint |= mImage.CalcDifference(aNewData.mImage,
                                 nsStyleImageLayers::LayerType::Background);
 
   return hint;
 }
 
@@ -3217,49 +3213,49 @@ nsStyleDisplay::CalcDifference(const nsS
       || mScrollBehavior != aNewData.mScrollBehavior
       || mScrollSnapTypeX != aNewData.mScrollSnapTypeX
       || mScrollSnapTypeY != aNewData.mScrollSnapTypeY
       || mScrollSnapPointsX != aNewData.mScrollSnapPointsX
       || mScrollSnapPointsY != aNewData.mScrollSnapPointsY
       || mScrollSnapDestination != aNewData.mScrollSnapDestination
       || mTopLayer != aNewData.mTopLayer
       || mResize != aNewData.mResize) {
-    hint |= nsChangeHint_ReconstructFrame;
+    hint |= nsChangeHint::ReconstructFrame;
   }
 
   /* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY,
    * mScrollSnapPointsX, mScrollSnapPointsY, or mScrollSnapDestination are
-   * changed, nsChangeHint_NeutralChange is not sufficient to enter
+   * changed, nsChangeHint::NeutralChange is not sufficient to enter
    * nsCSSFrameConstructor::PropagateScrollToViewport. By using the same hint
    * as used when the overflow css property changes,
-   * nsChangeHint_ReconstructFrame, PropagateScrollToViewport will be called.
+   * nsChangeHint::ReconstructFrame, PropagateScrollToViewport will be called.
    *
    * The scroll-behavior css property is not expected to change often (the
    * CSSOM-View DOM methods are likely to be used in those cases); however,
    * if this does become common perhaps a faster-path might be worth while.
    */
 
   if ((mAppearance == NS_THEME_TEXTFIELD &&
        aNewData.mAppearance != NS_THEME_TEXTFIELD) ||
       (mAppearance != NS_THEME_TEXTFIELD &&
        aNewData.mAppearance == NS_THEME_TEXTFIELD)) {
     // This is for <input type=number> where we allow authors to specify a
     // |-moz-appearance:textfield| to get a control without a spinner. (The
     // spinner is present for |-moz-appearance:number-input| but also other
     // values such as 'none'.) We need to reframe since we want to use
     // nsTextControlFrame instead of nsNumberControlFrame if the author
     // specifies 'textfield'.
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   if (mFloat != aNewData.mFloat) {
     // Changing which side we float on doesn't affect descendants directly
     hint |= nsChangeHint_AllReflowHints &
-            ~(nsChangeHint_ClearDescendantIntrinsics |
-              nsChangeHint_NeedDirtyReflow);
+            ~(nsChangeHint::ClearDescendantIntrinsics |
+              nsChangeHint::NeedDirtyReflow);
   }
 
   if (mVerticalAlign != aNewData.mVerticalAlign) {
     // XXX Can this just be AllReflowHints + RepaintFrame, and be included in
     // the block below?
     hint |= NS_STYLE_HINT_REFLOW;
   }
 
@@ -3268,142 +3264,142 @@ nsStyleDisplay::CalcDifference(const nsS
   if (mBreakType != aNewData.mBreakType
       || mBreakInside != aNewData.mBreakInside
       || mBreakBefore != aNewData.mBreakBefore
       || mBreakAfter != aNewData.mBreakAfter
       || mAppearance != aNewData.mAppearance
       || mOrient != aNewData.mOrient
       || mOverflowClipBox != aNewData.mOverflowClipBox) {
     hint |= nsChangeHint_AllReflowHints |
-            nsChangeHint_RepaintFrame;
+            nsChangeHint::RepaintFrame;
   }
 
   if (mIsolation != aNewData.mIsolation) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   /* If we've added or removed the transform property, we need to reconstruct the frame to add
    * or remove the view object, and also to handle abs-pos and fixed-pos containers.
    */
   if (HasTransformStyle() != aNewData.HasTransformStyle()) {
-    // We do not need to apply nsChangeHint_UpdateTransformLayer since
-    // nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
+    // We do not need to apply nsChangeHint::UpdateTransformLayer since
+    // nsChangeHint::RepaintFrame will forcibly invalidate the frame area and
     // ensure layers are rebuilt (or removed).
-    hint |= nsChangeHint_UpdateContainingBlock |
-            nsChangeHint_AddOrRemoveTransform |
-            nsChangeHint_UpdateOverflow |
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::UpdateContainingBlock |
+            nsChangeHint::AddOrRemoveTransform |
+            nsChangeHint::UpdateOverflow |
+            nsChangeHint::RepaintFrame;
   } else {
     /* Otherwise, if we've kept the property lying around and we already had a
      * transform, we need to see whether or not we've changed the transform.
      * If so, we need to recompute its overflow rect (which probably changed
      * if the transform changed) and to redraw within the bounds of that new
      * overflow rect.
      *
      * If the property isn't present in either style struct, we still do the
      * comparisons but turn all the resulting change hints into
-     * nsChangeHint_NeutralChange.
+     * nsChangeHint::NeutralChange.
      */
     nsChangeHint transformHint = nsChangeHint(0);
 
     if (!mSpecifiedTransform != !aNewData.mSpecifiedTransform ||
         (mSpecifiedTransform &&
          *mSpecifiedTransform != *aNewData.mSpecifiedTransform)) {
-      transformHint |= nsChangeHint_UpdateTransformLayer;
+      transformHint |= nsChangeHint::UpdateTransformLayer;
 
       if (mSpecifiedTransform &&
           aNewData.mSpecifiedTransform) {
-        transformHint |= nsChangeHint_UpdatePostTransformOverflow;
+        transformHint |= nsChangeHint::UpdatePostTransformOverflow;
       } else {
-        transformHint |= nsChangeHint_UpdateOverflow;
+        transformHint |= nsChangeHint::UpdateOverflow;
       }
     }
 
     const nsChangeHint kUpdateOverflowAndRepaintHint =
-      nsChangeHint_UpdateOverflow | nsChangeHint_RepaintFrame;
+      nsChangeHint::UpdateOverflow | nsChangeHint::RepaintFrame;
     for (uint8_t index = 0; index < 3; ++index) {
       if (mTransformOrigin[index] != aNewData.mTransformOrigin[index]) {
-        transformHint |= nsChangeHint_UpdateTransformLayer |
-                         nsChangeHint_UpdatePostTransformOverflow;
+        transformHint |= nsChangeHint::UpdateTransformLayer |
+                         nsChangeHint::UpdatePostTransformOverflow;
         break;
       }
     }
 
     for (uint8_t index = 0; index < 2; ++index) {
       if (mPerspectiveOrigin[index] != aNewData.mPerspectiveOrigin[index]) {
         transformHint |= kUpdateOverflowAndRepaintHint;
         break;
       }
     }
 
     if (HasPerspectiveStyle() != aNewData.HasPerspectiveStyle()) {
       // A change from/to being a containing block for position:fixed.
-      hint |= nsChangeHint_UpdateContainingBlock;
+      hint |= nsChangeHint::UpdateContainingBlock;
     }
 
     if (mChildPerspective != aNewData.mChildPerspective ||
         mTransformStyle != aNewData.mTransformStyle ||
         mTransformBox != aNewData.mTransformBox) {
       transformHint |= kUpdateOverflowAndRepaintHint;
     }
 
     if (mBackfaceVisibility != aNewData.mBackfaceVisibility) {
-      transformHint |= nsChangeHint_RepaintFrame;
+      transformHint |= nsChangeHint::RepaintFrame;
     }
 
-    if (transformHint) {
+    if (bool(transformHint)) {
       if (HasTransformStyle()) {
         hint |= transformHint;
       } else {
-        hint |= nsChangeHint_NeutralChange;
+        hint |= nsChangeHint::NeutralChange;
       }
     }
   }
 
   // Note that the HasTransformStyle() != aNewData.HasTransformStyle()
   // test above handles relevant changes in the
   // NS_STYLE_WILL_CHANGE_TRANSFORM bit, which in turn handles frame
   // reconstruction for changes in the containing block of
   // fixed-positioned elements.
   uint8_t willChangeBitsChanged =
     mWillChangeBitField ^ aNewData.mWillChangeBitField;
   if (willChangeBitsChanged & (NS_STYLE_WILL_CHANGE_STACKING_CONTEXT |
                                NS_STYLE_WILL_CHANGE_SCROLL |
                                NS_STYLE_WILL_CHANGE_OPACITY)) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   if (willChangeBitsChanged & NS_STYLE_WILL_CHANGE_FIXPOS_CB) {
-    hint |= nsChangeHint_UpdateContainingBlock;
+    hint |= nsChangeHint::UpdateContainingBlock;
   }
 
   // If touch-action is changed, we need to regenerate the event regions on
   // the layers and send it over to the compositor for APZ to handle.
   if (mTouchAction != aNewData.mTouchAction) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
   // Note:  Our current behavior for handling changes to the
   // transition-duration, transition-delay, and transition-timing-function
   // properties is to do nothing.  In other words, the transition
   // property that matters is what it is when the transition begins, and
   // we don't stop a transition later because the transition property
   // changed.
   // We do handle changes to transition-property, but we don't need to
   // bother with anything here, since the transition manager is notified
   // of any style context change anyway.
 
   // Note: Likewise, for animation-*, the animation manager gets
   // notified about every new style context constructed, and it uses
   // that opportunity to handle dynamic changes appropriately.
 
-  // But we still need to return nsChangeHint_NeutralChange for these
+  // But we still need to return nsChangeHint::NeutralChange for these
   // properties, since some data did change in the style struct.
 
-  if (!hint &&
+  if (!bool(hint) &&
       (mOriginalDisplay != aNewData.mOriginalDisplay ||
        mOriginalFloat != aNewData.mOriginalFloat ||
        mTransitions != aNewData.mTransitions ||
        mTransitionTimingFunctionCount !=
          aNewData.mTransitionTimingFunctionCount ||
        mTransitionDurationCount != aNewData.mTransitionDurationCount ||
        mTransitionDelayCount != aNewData.mTransitionDelayCount ||
        mTransitionPropertyCount != aNewData.mTransitionPropertyCount ||
@@ -3413,17 +3409,17 @@ nsStyleDisplay::CalcDifference(const nsS
        mAnimationDelayCount != aNewData.mAnimationDelayCount ||
        mAnimationNameCount != aNewData.mAnimationNameCount ||
        mAnimationDirectionCount != aNewData.mAnimationDirectionCount ||
        mAnimationFillModeCount != aNewData.mAnimationFillModeCount ||
        mAnimationPlayStateCount != aNewData.mAnimationPlayStateCount ||
        mAnimationIterationCountCount != aNewData.mAnimationIterationCountCount ||
        mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate ||
        mShapeOutside != aNewData.mShapeOutside)) {
-    hint |= nsChangeHint_NeutralChange;
+    hint |= nsChangeHint::NeutralChange;
   }
 
   return hint;
 }
 
 // --------------------
 // nsStyleVisibility
 //
@@ -3457,39 +3453,39 @@ nsChangeHint
 nsStyleVisibility::CalcDifference(const nsStyleVisibility& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
 
   if (mDirection != aNewData.mDirection || mWritingMode != aNewData.mWritingMode) {
     // It's important that a change in mWritingMode results in frame
     // reconstruction, because it may affect intrinsic size (see
     // nsSubDocumentFrame::GetIntrinsicISize/BSize).
-    hint |= nsChangeHint_ReconstructFrame;
+    hint |= nsChangeHint::ReconstructFrame;
   } else {
     if ((mImageOrientation != aNewData.mImageOrientation)) {
       hint |= nsChangeHint_AllReflowHints |
-              nsChangeHint_RepaintFrame;
+              nsChangeHint::RepaintFrame;
     }
     if (mVisible != aNewData.mVisible) {
       if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
           (NS_STYLE_VISIBILITY_COLLAPSE == aNewData.mVisible)) {
         hint |= NS_STYLE_HINT_REFLOW;
       } else {
         hint |= NS_STYLE_HINT_VISUAL;
       }
     }
     if (mTextOrientation != aNewData.mTextOrientation) {
       hint |= NS_STYLE_HINT_REFLOW;
     }
     if (mImageRendering != aNewData.mImageRendering) {
-      hint |= nsChangeHint_RepaintFrame;
+      hint |= nsChangeHint::RepaintFrame;
     }
     if (mColorAdjust != aNewData.mColorAdjust) {
       // color-adjust only affects media where dynamic changes can't happen.
-      hint |= nsChangeHint_NeutralChange;
+      hint |= nsChangeHint::NeutralChange;
     }
   }
   return hint;
 }
 
 nsStyleContentData::~nsStyleContentData()
 {
   MOZ_COUNT_DTOR(nsStyleContentData);
@@ -3653,17 +3649,17 @@ nsStyleContent::CalcDifference(const nsS
   // in ElementRestyler::Restyle.
 
   // Unfortunately we need to reframe even if the content lengths are the same;
   // a simple reflow will not pick up different text or different image URLs,
   // since we set all that up in the CSSFrameConstructor
   if (mContents != aNewData.mContents ||
       mIncrements != aNewData.mIncrements ||
       mResets != aNewData.mResets) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   return nsChangeHint(0);
 }
 
 // --------------------
 // nsStyleTextReset
 //
@@ -3699,28 +3695,28 @@ nsStyleTextReset::CalcDifference(const n
     return NS_STYLE_HINT_REFLOW;
   }
 
   if (mTextDecorationLine != aNewData.mTextDecorationLine ||
       mTextDecorationStyle != aNewData.mTextDecorationStyle) {
     // Changes to our text-decoration line can impact our overflow area &
     // also our descendants' overflow areas (particularly for text-frame
     // descendants).  So, we update those areas & trigger a repaint.
-    return nsChangeHint_RepaintFrame |
-           nsChangeHint_UpdateSubtreeOverflow |
-           nsChangeHint_SchedulePaint;
+    return nsChangeHint::RepaintFrame |
+           nsChangeHint::UpdateSubtreeOverflow |
+           nsChangeHint::SchedulePaint;
   }
 
   // Repaint for decoration color changes
   if (mTextDecorationColor != aNewData.mTextDecorationColor) {
-    return nsChangeHint_RepaintFrame;
+    return nsChangeHint::RepaintFrame;
   }
 
   if (mTextOverflow != aNewData.mTextOverflow) {
-    return nsChangeHint_RepaintFrame;
+    return nsChangeHint::RepaintFrame;
   }
 
   return nsChangeHint(0);
 }
 
 // Returns true if the given shadow-arrays are equal.
 static bool
 AreShadowArraysEqual(nsCSSShadowArray* lhs,
@@ -3821,22 +3817,22 @@ nsStyleText::~nsStyleText()
 }
 
 nsChangeHint
 nsStyleText::CalcDifference(const nsStyleText& aNewData) const
 {
   if (WhiteSpaceOrNewlineIsSignificant() !=
       aNewData.WhiteSpaceOrNewlineIsSignificant()) {
     // This may require construction of suppressed text frames
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   if (mTextCombineUpright != aNewData.mTextCombineUpright ||
       mControlCharacterVisibility != aNewData.mControlCharacterVisibility) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
 
   if ((mTextAlign != aNewData.mTextAlign) ||
       (mTextAlignLast != aNewData.mTextAlignLast) ||
       (mTextAlignTrue != aNewData.mTextAlignTrue) ||
       (mTextAlignLastTrue != aNewData.mTextAlignLastTrue) ||
       (mTextTransform != aNewData.mTextTransform) ||
       (mWhiteSpace != aNewData.mWhiteSpace) ||
@@ -3854,54 +3850,54 @@ nsStyleText::CalcDifference(const nsStyl
     return NS_STYLE_HINT_REFLOW;
   }
 
   if (HasTextEmphasis() != aNewData.HasTextEmphasis() ||
       (HasTextEmphasis() &&
        mTextEmphasisPosition != aNewData.mTextEmphasisPosition)) {
     // Text emphasis position change could affect line height calculation.
     return nsChangeHint_AllReflowHints |
-           nsChangeHint_RepaintFrame;
+           nsChangeHint::RepaintFrame;
   }
 
   nsChangeHint hint = nsChangeHint(0);
 
   // text-rendering changes require a reflow since they change SVG
   // frames' rects.
   if (mTextRendering != aNewData.mTextRendering) {
-    hint |= nsChangeHint_NeedReflow |
-            nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::NeedReflow |
+            nsChangeHint::NeedDirtyReflow | // XXX remove me: bug 876085
+            nsChangeHint::RepaintFrame;
   }
 
   if (!AreShadowArraysEqual(mTextShadow, aNewData.mTextShadow) ||
       mTextEmphasisStyle != aNewData.mTextEmphasisStyle ||
       mTextEmphasisStyleString != aNewData.mTextEmphasisStyleString ||
       mWebkitTextStrokeWidth != aNewData.mWebkitTextStrokeWidth) {
-    hint |= nsChangeHint_UpdateSubtreeOverflow |
-            nsChangeHint_SchedulePaint |
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::UpdateSubtreeOverflow |
+            nsChangeHint::SchedulePaint |
+            nsChangeHint::RepaintFrame;
 
     // We don't add any other hints below.
     return hint;
   }
 
   if (mTextEmphasisColor != aNewData.mTextEmphasisColor ||
       mWebkitTextFillColor != aNewData.mWebkitTextFillColor ||
       mWebkitTextStrokeColor != aNewData.mWebkitTextStrokeColor) {
-    hint |= nsChangeHint_SchedulePaint |
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::SchedulePaint |
+            nsChangeHint::RepaintFrame;
   }
 
-  if (hint) {
+  if (bool(hint)) {
     return hint;
   }
 
   if (mTextEmphasisPosition != aNewData.mTextEmphasisPosition) {
-    return nsChangeHint_NeutralChange;
+    return nsChangeHint::NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 LogicalSide
 nsStyleText::TextEmphasisSide(WritingMode aWM) const
 {
@@ -4006,48 +4002,48 @@ nsStyleUserInterface::FinishStyle(nsPres
   }
 }
 
 nsChangeHint
 nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
   if (mCursor != aNewData.mCursor) {
-    hint |= nsChangeHint_UpdateCursor;
+    hint |= nsChangeHint::UpdateCursor;
   }
 
   // We could do better. But it wouldn't be worth it, URL-specified cursors are
   // rare.
   if (mCursorImages != aNewData.mCursorImages) {
-    hint |= nsChangeHint_UpdateCursor;
+    hint |= nsChangeHint::UpdateCursor;
   }
 
   if (mPointerEvents != aNewData.mPointerEvents) {
     // SVGGeometryFrame's mRect depends on stroke _and_ on the value
     // of pointer-events. See SVGGeometryFrame::ReflowSVG's use of
     // GetHitTestFlags. (Only a reflow, no visual change.)
-    hint |= nsChangeHint_NeedReflow |
-            nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
+    hint |= nsChangeHint::NeedReflow |
+            nsChangeHint::NeedDirtyReflow; // XXX remove me: bug 876085
   }
 
   if (mUserModify != aNewData.mUserModify) {
     hint |= NS_STYLE_HINT_VISUAL;
   }
 
   if (mUserInput != aNewData.mUserInput) {
     if (StyleUserInput::None == mUserInput ||
         StyleUserInput::None == aNewData.mUserInput) {
-      hint |= nsChangeHint_ReconstructFrame;
+      hint |= nsChangeHint::ReconstructFrame;
     } else {
-      hint |= nsChangeHint_NeutralChange;
+      hint |= nsChangeHint::NeutralChange;
     }
   }
 
   if (mUserFocus != aNewData.mUserFocus) {
-    hint |= nsChangeHint_NeutralChange;
+    hint |= nsChangeHint::NeutralChange;
   }
 
   return hint;
 }
 
 //-----------------------
 // nsStyleUIReset
 //
@@ -4077,30 +4073,30 @@ nsStyleUIReset::~nsStyleUIReset()
   MOZ_COUNT_DTOR(nsStyleUIReset);
 }
 
 nsChangeHint
 nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
 {
   // ignore mIMEMode
   if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   if (mWindowShadow != aNewData.mWindowShadow) {
-    // We really need just an nsChangeHint_SyncFrameView, except
+    // We really need just an nsChangeHint::SyncFrameView, except
     // on an ancestor of the frame, so we get that by doing a
     // reflow.
     return NS_STYLE_HINT_REFLOW;
   }
   if (mUserSelect != aNewData.mUserSelect) {
     return NS_STYLE_HINT_VISUAL;
   }
 
   if (mWindowDragging != aNewData.mWindowDragging) {
-    return nsChangeHint_SchedulePaint;
+    return nsChangeHint::SchedulePaint;
   }
 
   return nsChangeHint(0);
 }
 
 //-----------------------
 // nsStyleVariables
 //
@@ -4162,62 +4158,62 @@ nsStyleEffects::CalcDifference(const nsS
 {
   nsChangeHint hint = nsChangeHint(0);
 
   if (!AreShadowArraysEqual(mBoxShadow, aNewData.mBoxShadow)) {
     // Update overflow regions & trigger DLBI to be sure it's noticed.
     // Also request a repaint, since it's possible that only the color
     // of the shadow is changing (and UpdateOverflow/SchedulePaint won't
     // repaint for that, since they won't know what needs invalidating.)
-    hint |= nsChangeHint_UpdateOverflow |
-            nsChangeHint_SchedulePaint |
-            nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::UpdateOverflow |
+            nsChangeHint::SchedulePaint |
+            nsChangeHint::RepaintFrame;
   }
 
   if (mClipFlags != aNewData.mClipFlags) {
     hint |= nsChangeHint_AllReflowHints |
-            nsChangeHint_RepaintFrame;
+            nsChangeHint::RepaintFrame;
   }
 
   if (!mClip.IsEqualInterior(aNewData.mClip)) {
     // If the clip has changed, we just need to update overflow areas. DLBI
     // will handle the invalidation.
-    hint |= nsChangeHint_UpdateOverflow |
-            nsChangeHint_SchedulePaint;
+    hint |= nsChangeHint::UpdateOverflow |
+            nsChangeHint::SchedulePaint;
   }
 
   if (mOpacity != aNewData.mOpacity) {
     // If we're going from the optimized >=0.99 opacity value to 1.0 or back, then
     // repaint the frame because DLBI will not catch the invalidation.  Otherwise,
     // just update the opacity layer.
     if ((mOpacity >= 0.99f && mOpacity < 1.0f && aNewData.mOpacity == 1.0f) ||
         (aNewData.mOpacity >= 0.99f && aNewData.mOpacity < 1.0f && mOpacity == 1.0f)) {
-      hint |= nsChangeHint_RepaintFrame;
+      hint |= nsChangeHint::RepaintFrame;
     } else {
-      hint |= nsChangeHint_UpdateOpacityLayer;
+      hint |= nsChangeHint::UpdateOpacityLayer;
       if ((mOpacity == 1.0f) != (aNewData.mOpacity == 1.0f)) {
-        hint |= nsChangeHint_UpdateUsesOpacity;
+        hint |= nsChangeHint::UpdateUsesOpacity;
       }
     }
   }
 
   if (HasFilters() != aNewData.HasFilters()) {
     // A change from/to being a containing block for position:fixed.
-    hint |= nsChangeHint_UpdateContainingBlock;
+    hint |= nsChangeHint::UpdateContainingBlock;
   }
 
   if (mFilters != aNewData.mFilters) {
-    hint |= nsChangeHint_UpdateEffects |
-            nsChangeHint_RepaintFrame |
-            nsChangeHint_UpdateOverflow;
+    hint |= nsChangeHint::UpdateEffects |
+            nsChangeHint::RepaintFrame |
+            nsChangeHint::UpdateOverflow;
   }
 
   if (mMixBlendMode != aNewData.mMixBlendMode) {
-    hint |= nsChangeHint_RepaintFrame;
+    hint |= nsChangeHint::RepaintFrame;
   }
 
-  if (!hint &&
+  if (!bool(hint) &&
       !mClip.IsEqualEdges(aNewData.mClip)) {
-    hint |= nsChangeHint_NeutralChange;
+    hint |= nsChangeHint::NeutralChange;
   }
 
   return hint;
 }
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -160,25 +160,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   explicit nsStyleFont(StyleStructContext aContext);
   ~nsStyleFont() {
     MOZ_COUNT_DTOR(nsStyleFont);
   }
   void FinishStyle(nsPresContext* aPresContext) {}
 
   nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return NS_STYLE_HINT_REFLOW |
-           nsChangeHint_NeutralChange;
+    return NS_STYLE_HINT_REFLOW | nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   /**
    * Return aSize multiplied by the current text zoom factor (in aPresContext).
    * aSize is allowed to be negative, but the caller is expected to deal with
    * negative results.  The result is clamped to nscoord_MIN .. nscoord_MAX.
    */
   static nscoord ZoomText(StyleStructContext aContext, nscoord aSize);
@@ -567,17 +566,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   nscolor CalcComplexColor(const mozilla::StyleComplexColor& aColor) const {
     return mozilla::LinearBlendColors(aColor.mColor, mColor,
                                       aColor.mForegroundRatio);
   }
 
   nsChangeHint CalcDifference(const nsStyleColor& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_RepaintFrame;
+    return nsChangeHint::RepaintFrame;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants at all.
     return nsChangeHint(0);
   }
 
   void* operator new(size_t sz, nsStyleColor* aSelf) { return aSelf; }
@@ -921,20 +920,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBackground, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStyleBackground& aNewData) const;
   static nsChangeHint MaxDifference() {
-     return nsChangeHint_UpdateEffects |
-           nsChangeHint_RepaintFrame |
-           nsChangeHint_UpdateBackgroundPosition |
-           nsChangeHint_NeutralChange;
+     return nsChangeHint::UpdateEffects |
+            nsChangeHint::RepaintFrame |
+            nsChangeHint::UpdateBackgroundPosition |
+            nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants at all.
     return nsChangeHint(0);
   }
 
   // True if this background is completely transparent.
@@ -974,19 +973,19 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleMargin, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference can return all of the reflow hints sometimes not
     // handled for descendants as hints not handled for descendants.
     return nsChangeHint(0);
   }
 
   bool GetMargin(nsMargin& aMargin) const
@@ -1022,25 +1021,25 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStylePadding, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics;
+    return NS_STYLE_HINT_REFLOW & ~nsChangeHint::ClearDescendantIntrinsics;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
-    // CalcDifference can return nsChangeHint_ClearAncestorIntrinsics as
+    // CalcDifference can return nsChangeHint::ClearAncestorIntrinsics as
     // a hint not handled for descendants.  We could (and perhaps
-    // should) return nsChangeHint_NeedReflow and
-    // nsChangeHint_ReflowChangesSizeOrPosition as always handled for
+    // should) return nsChangeHint::NeedReflow and
+    // nsChangeHint::ReflowChangesSizeOrPosition as always handled for
     // descendants, but since they're always returned in conjunction
-    // with nsChangeHint_ClearAncestorIntrinsics (which is not), it
+    // with nsChangeHint::ClearAncestorIntrinsics (which is not), it
     // won't ever lead to any optimization in
     // nsStyleContext::CalcStyleDifference.
     return nsChangeHint(0);
   }
 
   nsStyleSides  mPadding;         // [reset] coord, percent, calc
 
   bool IsWidthDependent() const {
@@ -1233,26 +1232,26 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBorder, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStyleBorder& aNewData) const;
   static nsChangeHint MaxDifference() {
     return NS_STYLE_HINT_REFLOW |
-           nsChangeHint_UpdateOverflow |
-           nsChangeHint_BorderStyleNoneChange |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::UpdateOverflow |
+           nsChangeHint::BorderStyleNoneChange |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   void EnsureBorderColors() {
     if (!mBorderColors) {
       mBorderColors = new nsBorderColors*[4];
       if (mBorderColors) {
         for (int32_t i = 0; i < 4; i++) {
           mBorderColors[i] = nullptr;
@@ -1461,20 +1460,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     this->~nsStyleOutline();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleOutline, this);
   }
 
   void RecalcData();
   nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_UpdateOverflow |
-           nsChangeHint_SchedulePaint |
-           nsChangeHint_RepaintFrame |
-           nsChangeHint_NeutralChange;
+    return nsChangeHint::UpdateOverflow |
+           nsChangeHint::SchedulePaint |
+           nsChangeHint::RepaintFrame |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants at all.
     return nsChangeHint(0);
   }
 
   nsStyleCorners  mOutlineRadius; // [reset] coord, percent, calc
@@ -1535,25 +1534,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleList();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleList& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           NS_STYLE_HINT_REFLOW;
+    return nsChangeHint::ReconstructFrame | NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   static void Shutdown() {
     sInitialQuotes = nullptr;
     sNoneQuotes = nullptr;
   }
 
   imgRequestProxy* GetListStyleImage() const
@@ -1762,20 +1760,20 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStylePosition, this);
   }
 
   nsChangeHint CalcDifference(const nsStylePosition& aNewData,
                               const nsStyleVisibility* aOldStyleVisibility) const;
   static nsChangeHint MaxDifference() {
     return NS_STYLE_HINT_REFLOW |
-           nsChangeHint_NeutralChange |
-           nsChangeHint_RecomputePosition |
-           nsChangeHint_UpdateParentOverflow |
-           nsChangeHint_UpdateComputedBSize;
+           nsChangeHint::NeutralChange |
+           nsChangeHint::RecomputePosition |
+           nsChangeHint::UpdateParentOverflow |
+           nsChangeHint::UpdateComputedBSize;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference can return all of the reflow hints that are
     // sometimes handled for descendants as hints not handled for
     // descendants.
     return nsChangeHint(0);
   }
 
@@ -2004,26 +2002,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   // nsStyleContext::HasTextDecorationLines.
   bool HasTextDecorationLines() const {
     return mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_NONE &&
            mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
   }
 
   nsChangeHint CalcDifference(const nsStyleTextReset& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint(
-        NS_STYLE_HINT_REFLOW |
-        nsChangeHint_UpdateSubtreeOverflow);
+    return NS_STYLE_HINT_REFLOW | nsChangeHint::UpdateSubtreeOverflow;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   nsStyleTextOverflow mTextOverflow;    // [reset] enum, string
 
   uint8_t mTextDecorationLine;          // [reset] see nsStyleConsts.h
   uint8_t mTextDecorationStyle;         // [reset] see nsStyleConsts.h
   uint8_t mUnicodeBidi;                 // [reset] see nsStyleConsts.h
   nscoord mInitialLetterSink;           // [reset] 0 means normal
@@ -2046,27 +2042,27 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleText();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleText, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
+    return nsChangeHint::ReconstructFrame |
            NS_STYLE_HINT_REFLOW |
-           nsChangeHint_UpdateSubtreeOverflow |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::UpdateSubtreeOverflow |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   uint8_t mTextAlign;                   // [inherited] see nsStyleConsts.h
   uint8_t mTextAlignLast;               // [inherited] see nsStyleConsts.h
   bool mTextAlignTrue : 1;              // [inherited] see nsStyleConsts.h
   bool mTextAlignLastTrue : 1;          // [inherited] see nsStyleConsts.h
   uint8_t mTextTransform;               // [inherited] see nsStyleConsts.h
   uint8_t mWhiteSpace;                  // [inherited] see nsStyleConsts.h
@@ -2265,26 +2261,26 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleVisibility();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
+    return nsChangeHint::ReconstructFrame |
            NS_STYLE_HINT_REFLOW |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   nsStyleImageOrientation mImageOrientation;  // [inherited]
   uint8_t mDirection;                  // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
   uint8_t mVisible;                    // [inherited]
   uint8_t mImageRendering;             // [inherited] see nsStyleConsts.h
   uint8_t mWritingMode;                // [inherited] see nsStyleConsts.h
   uint8_t mTextOrientation;            // [inherited] see nsStyleConsts.h
@@ -2774,24 +2770,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     this->~nsStyleDisplay();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleDisplay& aNewData) const;
   static nsChangeHint MaxDifference() {
     // All the parts of FRAMECHANGE are present in CalcDifference.
-    return nsChangeHint(nsChangeHint_ReconstructFrame |
-                        NS_STYLE_HINT_REFLOW |
-                        nsChangeHint_UpdateTransformLayer |
-                        nsChangeHint_UpdateOverflow |
-                        nsChangeHint_UpdatePostTransformOverflow |
-                        nsChangeHint_UpdateContainingBlock |
-                        nsChangeHint_AddOrRemoveTransform |
-                        nsChangeHint_NeutralChange);
+    return nsChangeHint::ReconstructFrame |
+           NS_STYLE_HINT_REFLOW |
+           nsChangeHint::UpdateTransformLayer |
+           nsChangeHint::UpdateOverflow |
+           nsChangeHint::UpdatePostTransformOverflow |
+           nsChangeHint::UpdateContainingBlock |
+           nsChangeHint::AddOrRemoveTransform |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference can return all of the reflow hints that are
     // sometimes handled for descendants as hints not handled for
     // descendants.
     return nsChangeHint(0);
   }
 
@@ -3085,17 +3081,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleTable();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleTable, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleTable& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame;
+    return nsChangeHint::ReconstructFrame;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
     return nsChangeHint(0);
   }
 
   uint8_t       mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
@@ -3117,25 +3113,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleTableBorder();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleTableBorder& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           NS_STYLE_HINT_REFLOW;
+    return nsChangeHint::ReconstructFrame | NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   nscoord       mBorderSpacingCol;// [inherited]
   nscoord       mBorderSpacingRow;// [inherited]
   uint8_t       mBorderCollapse;// [inherited]
   uint8_t       mCaptionSide;   // [inherited]
   uint8_t       mEmptyCells;    // [inherited]
 };
@@ -3222,25 +3217,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleContent, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStyleContent& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           NS_STYLE_HINT_REFLOW;
+    return nsChangeHint::ReconstructFrame | NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   uint32_t ContentCount() const { return mContents.Length(); } // [reset]
 
   const nsStyleContentData& ContentAt(uint32_t aIndex) const {
     return mContents[aIndex];
   }
 
@@ -3307,25 +3301,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleUIReset();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           NS_STYLE_HINT_REFLOW;
+    return nsChangeHint::ReconstructFrame | NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   mozilla::StyleUserSelect     mUserSelect;     // [reset](selection-style)
   uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)
   uint8_t                      mIMEMode;        // [reset]
   mozilla::StyleWindowDragging mWindowDragging; // [reset]
   uint8_t                      mWindowShadow;   // [reset]
 };
@@ -3368,27 +3361,27 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleUserInterface();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleUserInterface& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           nsChangeHint_NeedReflow |
-           nsChangeHint_NeedDirtyReflow |
+    return nsChangeHint::ReconstructFrame |
+           nsChangeHint::NeedReflow |
+           nsChangeHint::NeedDirtyReflow |
            NS_STYLE_HINT_VISUAL |
-           nsChangeHint_UpdateCursor |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::UpdateCursor |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow;
+    return nsChangeHint::NeedReflow;
   }
 
   mozilla::StyleUserInput   mUserInput;       // [inherited]
   mozilla::StyleUserModify  mUserModify;      // [inherited] (modify-content)
   mozilla::StyleUserFocus   mUserFocus;       // [inherited] (auto-select)
   uint8_t                   mPointerEvents;   // [inherited] see nsStyleConsts.h
 
   uint8_t mCursor;                            // [inherited] See nsStyleConsts.h
@@ -3412,25 +3405,24 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleXUL();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleXUL, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleXUL& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
-           NS_STYLE_HINT_REFLOW;
+    return nsChangeHint::ReconstructFrame | NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   float         mBoxFlex;               // [reset] see nsStyleConsts.h
   uint32_t      mBoxOrdinal;            // [reset] see nsStyleConsts.h
   mozilla::StyleBoxAlign mBoxAlign;         // [reset]
   mozilla::StyleBoxDirection mBoxDirection; // [reset]
   mozilla::StyleBoxOrient mBoxOrient;       // [reset]
   mozilla::StyleBoxPack mBoxPack;           // [reset]
@@ -3452,26 +3444,26 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleColumn();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleColumn, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_ReconstructFrame |
+    return nsChangeHint::ReconstructFrame |
            NS_STYLE_HINT_REFLOW |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   /**
    * This is the maximum number of columns we can process. It's used in both
    * nsColumnSetFrame and nsRuleNode.
    */
   static const uint32_t kMaxColumnCount = 1000;
 
@@ -3577,26 +3569,26 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleSVG();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVG, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleSVG& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_UpdateEffects |
-           nsChangeHint_NeedReflow |
-           nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
-           nsChangeHint_RepaintFrame;
+    return nsChangeHint::UpdateEffects |
+           nsChangeHint::NeedReflow |
+           nsChangeHint::NeedDirtyReflow | // remove me: bug 876085
+           nsChangeHint::RepaintFrame;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
-    // CalcDifference never returns nsChangeHint_NeedReflow as a hint
+    // CalcDifference never returns nsChangeHint::NeedReflow as a hint
     // not handled for descendants, and never returns
-    // nsChangeHint_ClearAncestorIntrinsics at all.
-    return nsChangeHint_NeedReflow;
+    // nsChangeHint::ClearAncestorIntrinsics at all.
+    return nsChangeHint::NeedReflow;
   }
 
   nsStyleSVGPaint  mFill;             // [inherited]
   nsStyleSVGPaint  mStroke;           // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerEnd;   // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerMid;   // [inherited]
   RefPtr<mozilla::css::URLValue> mMarkerStart; // [inherited]
   nsTArray<nsStyleCoord> mStrokeDasharray;  // [inherited] coord, percent, factor
@@ -3768,29 +3760,29 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, sz);
   }
   void Destroy(nsPresContext* aContext);
 
   nsChangeHint CalcDifference(const nsStyleSVGReset& aNewData) const;
   static nsChangeHint MaxDifference() {
-    return nsChangeHint_UpdateEffects |
-           nsChangeHint_UpdateOverflow |
-           nsChangeHint_NeutralChange |
-           nsChangeHint_RepaintFrame |
-           nsChangeHint_UpdateBackgroundPosition |
+    return nsChangeHint::UpdateEffects |
+           nsChangeHint::UpdateOverflow |
+           nsChangeHint::NeutralChange |
+           nsChangeHint::RepaintFrame |
+           nsChangeHint::UpdateBackgroundPosition |
            NS_STYLE_HINT_REFLOW;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   bool HasClipPath() const {
     return mClipPath.GetType() != mozilla::StyleShapeSourceType::None;
   }
 
   bool HasNonScalingStroke() const {
     return mVectorEffect == NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE;
@@ -3828,18 +3820,18 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleVariables, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleVariables& aNewData) const;
   static nsChangeHint MaxDifference() {
     return nsChangeHint(0);
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
-    // CalcDifference never returns nsChangeHint_NeedReflow or
-    // nsChangeHint_ClearAncestorIntrinsics at all.
+    // CalcDifference never returns nsChangeHint::NeedReflow or
+    // nsChangeHint::ClearAncestorIntrinsics at all.
     return nsChangeHint(0);
   }
 
   mozilla::CSSVariableValues mVariables;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
 {
@@ -3857,31 +3849,31 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     this->~nsStyleEffects();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleEffects, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleEffects& aNewData) const;
   static nsChangeHint MaxDifference() {
     return nsChangeHint_AllReflowHints |
-           nsChangeHint_UpdateOverflow |
-           nsChangeHint_SchedulePaint |
-           nsChangeHint_RepaintFrame |
-           nsChangeHint_UpdateOpacityLayer |
-           nsChangeHint_UpdateUsesOpacity |
-           nsChangeHint_UpdateContainingBlock |
-           nsChangeHint_UpdateEffects |
-           nsChangeHint_NeutralChange;
+           nsChangeHint::UpdateOverflow |
+           nsChangeHint::SchedulePaint |
+           nsChangeHint::RepaintFrame |
+           nsChangeHint::UpdateOpacityLayer |
+           nsChangeHint::UpdateUsesOpacity |
+           nsChangeHint::UpdateContainingBlock |
+           nsChangeHint::UpdateEffects |
+           nsChangeHint::NeutralChange;
   }
   static nsChangeHint DifferenceAlwaysHandledForDescendants() {
     // CalcDifference never returns the reflow hints that are sometimes
     // handled for descendants as hints not handled for descendants.
-    return nsChangeHint_NeedReflow |
-           nsChangeHint_ReflowChangesSizeOrPosition |
-           nsChangeHint_ClearAncestorIntrinsics;
+    return nsChangeHint::NeedReflow |
+           nsChangeHint::ReflowChangesSizeOrPosition |
+           nsChangeHint::ClearAncestorIntrinsics;
   }
 
   bool HasFilters() const {
     return !mFilters.IsEmpty();
   }
 
   nsTArray<nsStyleFilter>  mFilters;   // [reset]
   RefPtr<nsCSSShadowArray> mBoxShadow; // [reset] nullptr for 'none'
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -169,17 +169,17 @@ SVGGeometryFrame::AttributeChanged(int32
   // return nsChangeHint_UpdateOverflow for "transform" attribute changes
   // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
 
   if (aNameSpaceID == kNameSpaceID_None &&
       (static_cast<SVGGeometryElement*>
                   (mContent)->AttributeDefinesGeometry(aAttribute))) {
     nsLayoutUtils::PostRestyleEvent(
       mContent->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(this);
   }
   return NS_OK;
 }
 
 /* virtual */ void
 SVGGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
 {
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3258,17 +3258,17 @@ SVGTextFrame::ReflowSVGNonDisplayText()
   AddStateBits(NS_FRAME_IS_DIRTY);
 
   // We also need to call InvalidateRenderingObservers, so that if the <text>
   // element is within a <mask>, say, the element referencing the <mask> will
   // be updated, which will then cause this SVGTextFrame to be painted and
   // in doing so cause the anonymous block frame to be reflowed.
   nsLayoutUtils::PostRestyleEvent(
     mContent->AsElement(), nsRestyleHint(0),
-    nsChangeHint_InvalidateRenderingObservers);
+    nsChangeHint::InvalidateRenderingObservers);
 
   // Finally, we need to actually reflow the anonymous block frame and update
   // mPositions, in case we are being reflowed immediately after a DOM
   // mutation that needs frame reconstruction.
   MaybeReflowAnonymousBlockChild();
   UpdateGlyphPositioning();
 }
 
@@ -5228,17 +5228,17 @@ SVGTextFrame::ScheduleReflowSVG()
 }
 
 void
 SVGTextFrame::NotifyGlyphMetricsChange()
 {
   AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
   nsLayoutUtils::PostRestyleEvent(
     mContent->AsElement(), nsRestyleHint(0),
-    nsChangeHint_InvalidateRenderingObservers);
+    nsChangeHint::InvalidateRenderingObservers);
   ScheduleReflowSVG();
 }
 
 void
 SVGTextFrame::UpdateGlyphPositioning()
 {
   nsIFrame* kid = PrincipalChildList().FirstChild();
   if (!kid) {
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -202,17 +202,18 @@ nsSVGDisplayContainerFrame::RemoveFrame(
 {
   nsSVGEffects::InvalidateRenderingObservers(aOldFrame);
 
   // nsSVGContainerFrame::RemoveFrame doesn't call down into
   // nsContainerFrame::RemoveFrame, so it doesn't call FrameNeedsReflow. We
   // need to schedule a repaint and schedule an update to our overflow rects.
   SchedulePaint();
   PresContext()->RestyleManager()->PostRestyleEvent(
-    mContent->AsElement(), nsRestyleHint(0), nsChangeHint_UpdateOverflow);
+    mContent->AsElement(), nsRestyleHint(0),
+    nsChangeHint::UpdateOverflow);
 
   nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
 
   if (!(GetStateBits() & (NS_FRAME_IS_NONDISPLAY | NS_STATE_IS_OUTER_SVG))) {
     nsSVGUtils::NotifyAncestorsOfFilterRegionChange(this);
   }
 }
 
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -227,17 +227,17 @@ nsSVGRenderingObserverProperty::DoUpdate
   nsSVGIDRenderingObserver::DoUpdate();
 
   nsIFrame* frame = mFrameReference.Get();
   if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
     // Changes should propagate out to things that might be observing
     // the referencing frame or its ancestors.
     nsLayoutUtils::PostRestyleEvent(
       frame->GetContent()->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
   }
 }
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGFilterReference)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGFilterReference)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsSVGFilterReference)
 
@@ -340,27 +340,27 @@ void
 nsSVGFilterProperty::DoUpdate()
 {
   nsIFrame* frame = mFrameReference.Get();
   if (!frame)
     return;
 
   // Repaint asynchronously in case the filter frame is being torn down
   nsChangeHint changeHint =
-    nsChangeHint(nsChangeHint_RepaintFrame);
+    nsChangeHint(nsChangeHint::RepaintFrame);
 
   if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
     // Changes should propagate out to things that might be observing
     // the referencing frame or its ancestors.
-    changeHint |= nsChangeHint_InvalidateRenderingObservers;
+    changeHint |= nsChangeHint::InvalidateRenderingObservers;
   }
 
   // Don't need to request UpdateOverflow if we're being reflowed.
   if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) {
-    changeHint |= nsChangeHint_UpdateOverflow;
+    changeHint |= nsChangeHint::UpdateOverflow;
   }
   frame->PresContext()->RestyleManager()->PostRestyleEvent(
     frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
 }
 
 void
 nsSVGMarkerProperty::DoUpdate()
 {
@@ -368,22 +368,21 @@ nsSVGMarkerProperty::DoUpdate()
 
   nsIFrame* frame = mFrameReference.Get();
   if (!frame)
     return;
 
   NS_ASSERTION(frame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
 
   // Repaint asynchronously in case the marker frame is being torn down
-  nsChangeHint changeHint =
-    nsChangeHint(nsChangeHint_RepaintFrame);
+  nsChangeHint changeHint = nsChangeHint::RepaintFrame;
 
   // Don't need to request ReflowFrame if we're being reflowed.
   if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) {
-    changeHint |= nsChangeHint_InvalidateRenderingObservers;
+    changeHint |= nsChangeHint::InvalidateRenderingObservers;
     // XXXjwatt: We need to unify SVG into standard reflow so we can just use
     // nsChangeHint_NeedReflow | nsChangeHint_NeedDirtyReflow here.
     // XXXSDL KILL THIS!!!
     nsSVGUtils::ScheduleReflowSVG(frame);
   }
   frame->PresContext()->RestyleManager()->PostRestyleEvent(
     frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
 }
@@ -434,18 +433,18 @@ nsSVGTextPathProperty::DoUpdate()
   bool nowValid = TargetIsValid();
   if (!mValid && !nowValid) {
     // Just return if we were previously invalid, and are still invalid.
     return;
   }
   mValid = nowValid;
 
   // Repaint asynchronously in case the path frame is being torn down
-  nsChangeHint changeHint =
-    nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateTextPath);
+  nsChangeHint changeHint = nsChangeHint::RepaintFrame |
+                            nsChangeHint::UpdateTextPath;
   frame->PresContext()->RestyleManager()->PostRestyleEvent(
     frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
 }
 
 static void
 InvalidateAllContinuations(nsIFrame* aFrame)
 {
   for (nsIFrame* f = aFrame; f;
@@ -461,17 +460,17 @@ nsSVGPaintingProperty::DoUpdate()
 
   nsIFrame* frame = mFrameReference.Get();
   if (!frame)
     return;
 
   if (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
     nsLayoutUtils::PostRestyleEvent(
       frame->GetContent()->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     frame->InvalidateFrameSubtree();
   } else {
     InvalidateAllContinuations(frame);
   }
 }
 
 static nsSVGFilterProperty*
 GetOrCreateFilterProperty(nsIFrame* aFrame)
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -91,39 +91,39 @@ nsSVGForeignObjectFrame::AttributeChange
                                           nsIAtom *aAttribute,
                                           int32_t  aModType)
 {
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::width ||
         aAttribute == nsGkAtoms::height) {
       nsLayoutUtils::PostRestyleEvent(
         mContent->AsElement(), nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
       // XXXjwatt: why mark intrinsic widths dirty? can't we just use eResize?
       RequestReflow(nsIPresShell::eStyleChange);
     } else if (aAttribute == nsGkAtoms::x ||
                aAttribute == nsGkAtoms::y) {
       // make sure our cached transform matrix gets (lazily) updated
       mCanvasTM = nullptr;
       nsLayoutUtils::PostRestyleEvent(
         mContent->AsElement(), nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
     } else if (aAttribute == nsGkAtoms::transform) {
       // We don't invalidate for transform changes (the layers code does that).
       // Also note that SVGTransformableElement::GetAttributeChangeHint will
       // return nsChangeHint_UpdateOverflow for "transform" attribute changes
       // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
       mCanvasTM = nullptr;
     } else if (aAttribute == nsGkAtoms::viewBox ||
                aAttribute == nsGkAtoms::preserveAspectRatio) {
       nsLayoutUtils::PostRestyleEvent(
         mContent->AsElement(), nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
     }
   }
 
   return NS_OK;
 }
 
 void
 nsSVGForeignObjectFrame::Reflow(nsPresContext*           aPresContext,
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -207,17 +207,17 @@ nsSVGImageFrame::AttributeChanged(int32_
 {
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::x ||
         aAttribute == nsGkAtoms::y ||
         aAttribute == nsGkAtoms::width ||
         aAttribute == nsGkAtoms::height) {
       nsLayoutUtils::PostRestyleEvent(
         mContent->AsElement(), nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
       return NS_OK;
     }
     else if (aAttribute == nsGkAtoms::preserveAspectRatio) {
       // We don't paint the content of the image using display lists, therefore
       // we have to invalidate for this children-only transform changes since
       // there is no layer tree to notice that the transform changed and
       // recomposite.
@@ -634,34 +634,34 @@ nsSVGImageListener::Notify(imgIRequest *
 {
   if (!mFrame)
     return NS_ERROR_FAILURE;
 
   if (aType == imgINotificationObserver::LOAD_COMPLETE) {
     mFrame->InvalidateFrame();
     nsLayoutUtils::PostRestyleEvent(
       mFrame->GetContent()->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(mFrame);
   }
 
   if (aType == imgINotificationObserver::FRAME_UPDATE) {
     // No new dimensions, so we don't need to call
     // nsSVGUtils::InvalidateAndScheduleBoundsUpdate.
     nsLayoutUtils::PostRestyleEvent(
       mFrame->GetContent()->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     mFrame->InvalidateFrame();
   }
 
   if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
     // Called once the resource's dimensions have been obtained.
     aRequest->GetImage(getter_AddRefs(mFrame->mImageContainer));
     mFrame->InvalidateFrame();
     nsLayoutUtils::PostRestyleEvent(
       mFrame->GetContent()->AsElement(), nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(mFrame);
   }
 
   return NS_OK;
 }
 
--- a/layout/svg/nsSVGInnerSVGFrame.cpp
+++ b/layout/svg/nsSVGInnerSVGFrame.cpp
@@ -194,17 +194,17 @@ nsSVGInnerSVGFrame::AttributeChanged(int
       !(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
 
     SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent);
 
     if (aAttribute == nsGkAtoms::width ||
         aAttribute == nsGkAtoms::height) {
       nsLayoutUtils::PostRestyleEvent(
         mContent->AsElement(), nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
 
       if (content->HasViewBoxOrSyntheticViewBox()) {
         // make sure our cached transform matrix gets (lazily) updated
         mCanvasTM = nullptr;
         content->ChildrenOnlyTransformChanged();
         nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED);
       } else {
@@ -231,17 +231,17 @@ nsSVGInnerSVGFrame::AttributeChanged(int
       // We don't invalidate for transform changes (the layers code does that).
       // Also note that SVGTransformableElement::GetAttributeChangeHint will
       // return nsChangeHint_UpdateOverflow for "transform" attribute changes
       // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
 
       if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
         nsLayoutUtils::PostRestyleEvent(
           mContent->AsElement(), nsRestyleHint(0),
-          nsChangeHint_InvalidateRenderingObservers);
+          nsChangeHint::InvalidateRenderingObservers);
         nsSVGUtils::ScheduleReflowSVG(this);
       } else if (aAttribute == nsGkAtoms::viewBox ||
                  (aAttribute == nsGkAtoms::preserveAspectRatio &&
                   content->HasViewBoxOrSyntheticViewBox())) {
         content->ChildrenOnlyTransformChanged();
         // SchedulePaint sets a global state flag so we only need to call it once
         // (on ourself is fine), not once on each child (despite bug 828240).
         SchedulePaint();
--- a/layout/svg/nsSVGUseFrame.cpp
+++ b/layout/svg/nsSVGUseFrame.cpp
@@ -117,46 +117,46 @@ nsSVGUseFrame::AttributeChanged(int32_t 
   SVGUseElement *useElement = static_cast<SVGUseElement*>(mContent);
 
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
       // make sure our cached transform matrix gets (lazily) updated
       mCanvasTM = nullptr;
       nsLayoutUtils::PostRestyleEvent(
         useElement, nsRestyleHint(0),
-        nsChangeHint_InvalidateRenderingObservers);
+        nsChangeHint::InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
       nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED);
     } else if (aAttribute == nsGkAtoms::width ||
                aAttribute == nsGkAtoms::height) {
       bool invalidate = false;
       if (mHasValidDimensions != useElement->HasValidDimensions()) {
         mHasValidDimensions = !mHasValidDimensions;
         invalidate = true;
       }
       if (useElement->OurWidthAndHeightAreUsed()) {
         invalidate = true;
         useElement->SyncWidthOrHeight(aAttribute);
       }
       if (invalidate) {
         nsLayoutUtils::PostRestyleEvent(
           useElement, nsRestyleHint(0),
-          nsChangeHint_InvalidateRenderingObservers);
+          nsChangeHint::InvalidateRenderingObservers);
         nsSVGUtils::ScheduleReflowSVG(this);
       }
     }
   }
 
   if ((aNameSpaceID == kNameSpaceID_XLink ||
        aNameSpaceID == kNameSpaceID_None) &&
       aAttribute == nsGkAtoms::href) {
     // we're changing our nature, clear out the clone information
     nsLayoutUtils::PostRestyleEvent(
       useElement, nsRestyleHint(0),
-      nsChangeHint_InvalidateRenderingObservers);
+      nsChangeHint::InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(this);
     useElement->mOriginal = nullptr;
     useElement->UnlinkSource();
     useElement->TriggerReclone();
   }
 
   return nsSVGGFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
@@ -234,17 +234,18 @@ nsSVGUseFrame::NotifySVGChanged(uint32_t
 
 nsresult
 nsSVGUseFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
   SVGUseElement *use = static_cast<SVGUseElement*>(mContent);
 
   nsIContent* clone = use->CreateAnonymousContent();
   nsLayoutUtils::PostRestyleEvent(
-    use, nsRestyleHint(0), nsChangeHint_InvalidateRenderingObservers);
+    use, nsRestyleHint(0),
+    nsChangeHint::InvalidateRenderingObservers);
   if (!clone)
     return NS_ERROR_FAILURE;
   if (!aElements.AppendElement(clone))
     return NS_ERROR_OUT_OF_MEMORY;
   return NS_OK;
 }
 
 void
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -4851,21 +4851,21 @@ nsTableFrame::BCRecalcNeeded(nsStyleCont
   // We use PeekStyleData instead.
 
   const nsStyleBorder* oldStyleData = aOldStyleContext->PeekStyleBorder();
   if (!oldStyleData)
     return false;
 
   const nsStyleBorder* newStyleData = aNewStyleContext->StyleBorder();
   nsChangeHint change = newStyleData->CalcDifference(*oldStyleData);
-  if (!change)
+  if (!bool(change))
     return false;
-  if (change & nsChangeHint_NeedReflow)
+  if (change & nsChangeHint::NeedReflow)
     return true; // the caller only needs to mark the bc damage area
-  if (change & nsChangeHint_RepaintFrame) {
+  if (change & nsChangeHint::RepaintFrame) {
     // we need to recompute the borders and the caller needs to mark
     // the bc damage area
     // XXX In principle this should only be necessary for border style changes
     // However the bc painting code tries to maximize the drawn border segments
     // so it stores in the cellmap where a new border segment starts and this
     // introduces a unwanted cellmap data dependence on color
     nsCOMPtr<nsIRunnable> evt = new nsDelayedCalcBCBorders(this);
     NS_DispatchToCurrentThread(evt);