Bug 1545342 - part 2: Make some public enum of nsIPresShell move to mozilla namespace and defined as enum class in PresShellForwards.h r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 25 Apr 2019 05:04:15 +0000
changeset 530057 ac28f88b0c677487f673867a9fa5a0a79b96407f
parent 530056 97f1fb7c02bd96ded2c90917085bf75071a00199
child 530058 e73708ef8ebaa3215f8575fede5979d01fa8df10
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1545342
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545342 - part 2: Make some public enum of nsIPresShell move to mozilla namespace and defined as enum class in PresShellForwards.h r=smaug This patch moves some `enum` in `nsIPresShell` which are in public scope into `mozilla` namespace and change them as `enum class`es. Unfortunately, only "where to scroll" enum is just defines constants of percentages of scroll destination. Therefore, this patch makes only them as `static const`. Differential Revision: https://phabricator.services.mozilla.com/D28606
accessible/base/nsCoreUtils.cpp
accessible/generic/Accessible.cpp
docshell/base/nsDocShell.cpp
dom/base/Element.cpp
dom/base/Selection.cpp
dom/base/Selection.h
dom/base/nsDOMWindowUtils.cpp
dom/base/nsFocusManager.cpp
dom/base/nsFrameLoader.cpp
dom/html/HTMLMediaElement.cpp
dom/html/nsGenericHTMLFrameElement.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/PresShellForwards.h
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCounterManager.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsMeterFrame.cpp
layout/forms/nsProgressFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/generic/nsAbsoluteContainingBlock.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSelection.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrame.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/style/ImageLoader.cpp
layout/style/nsFontFaceUtils.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/SVGTextFrame.h
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGForeignObjectFrame.h
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGUtils.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableWrapperFrame.cpp
layout/xul/grid/nsGridRowGroupLayout.cpp
layout/xul/grid/nsGridRowLeafLayout.cpp
layout/xul/nsBoxFrame.cpp
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsMenuFrame.cpp
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsSplitterFrame.cpp
layout/xul/nsTextBoxFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
toolkit/components/satchel/nsFormFillController.cpp
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -260,60 +260,60 @@ void nsCoreUtils::ScrollFrameToPoint(nsI
   scrollPoint -= deltaPoint;
 
   scrollableFrame->ScrollTo(scrollPoint, ScrollMode::eInstant);
 }
 
 void nsCoreUtils::ConvertScrollTypeToPercents(
     uint32_t aScrollType, nsIPresShell::ScrollAxis *aVertical,
     nsIPresShell::ScrollAxis *aHorizontal) {
-  int16_t whereY, whereX;
-  nsIPresShell::WhenToScroll whenY, whenX;
+  WhereToScroll whereY, whereX;
+  WhenToScroll whenY, whenX;
   switch (aScrollType) {
     case nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT:
-      whereY = nsIPresShell::SCROLL_TOP;
-      whenY = nsIPresShell::SCROLL_ALWAYS;
-      whereX = nsIPresShell::SCROLL_LEFT;
-      whenX = nsIPresShell::SCROLL_ALWAYS;
+      whereY = kScrollToTop;
+      whenY = WhenToScroll::Always;
+      whereX = kScrollToLeft;
+      whenX = WhenToScroll::Always;
       break;
     case nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT:
-      whereY = nsIPresShell::SCROLL_BOTTOM;
-      whenY = nsIPresShell::SCROLL_ALWAYS;
-      whereX = nsIPresShell::SCROLL_RIGHT;
-      whenX = nsIPresShell::SCROLL_ALWAYS;
+      whereY = kScrollToBottom;
+      whenY = WhenToScroll::Always;
+      whereX = kScrollToRight;
+      whenX = WhenToScroll::Always;
       break;
     case nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE:
-      whereY = nsIPresShell::SCROLL_TOP;
-      whenY = nsIPresShell::SCROLL_ALWAYS;
-      whereX = nsIPresShell::SCROLL_MINIMUM;
-      whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
+      whereY = kScrollToTop;
+      whenY = WhenToScroll::Always;
+      whereX = kScrollMinimum;
+      whenX = WhenToScroll::IfNotFullyVisible;
       break;
     case nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_EDGE:
-      whereY = nsIPresShell::SCROLL_BOTTOM;
-      whenY = nsIPresShell::SCROLL_ALWAYS;
-      whereX = nsIPresShell::SCROLL_MINIMUM;
-      whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
+      whereY = kScrollToBottom;
+      whenY = WhenToScroll::Always;
+      whereX = kScrollMinimum;
+      whenX = WhenToScroll::IfNotFullyVisible;
       break;
     case nsIAccessibleScrollType::SCROLL_TYPE_LEFT_EDGE:
-      whereY = nsIPresShell::SCROLL_MINIMUM;
-      whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
-      whereX = nsIPresShell::SCROLL_LEFT;
-      whenX = nsIPresShell::SCROLL_ALWAYS;
+      whereY = kScrollMinimum;
+      whenY = WhenToScroll::IfNotFullyVisible;
+      whereX = kScrollToLeft;
+      whenX = WhenToScroll::Always;
       break;
     case nsIAccessibleScrollType::SCROLL_TYPE_RIGHT_EDGE:
-      whereY = nsIPresShell::SCROLL_MINIMUM;
-      whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
-      whereX = nsIPresShell::SCROLL_RIGHT;
-      whenX = nsIPresShell::SCROLL_ALWAYS;
+      whereY = kScrollMinimum;
+      whenY = WhenToScroll::IfNotFullyVisible;
+      whereX = kScrollToRight;
+      whenX = WhenToScroll::Always;
       break;
     default:
-      whereY = nsIPresShell::SCROLL_MINIMUM;
-      whenY = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
-      whereX = nsIPresShell::SCROLL_MINIMUM;
-      whenX = nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
+      whereY = kScrollMinimum;
+      whenY = WhenToScroll::IfNotFullyVisible;
+      whereX = kScrollMinimum;
+      whenX = WhenToScroll::IfNotFullyVisible;
   }
   *aVertical = nsIPresShell::ScrollAxis(whereY, whenY);
   *aHorizontal = nsIPresShell::ScrollAxis(whereX, whenX);
 }
 
 nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) {
   nsIntPoint coords(0, 0);
   nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
@@ -505,17 +505,17 @@ bool nsCoreUtils::IsColumnHidden(nsTreeC
                               nsGkAtoms::_true, eCaseMatters);
 }
 
 void nsCoreUtils::ScrollTo(PresShell *aPresShell, nsIContent *aContent,
                            uint32_t aScrollType) {
   nsIPresShell::ScrollAxis vertical, horizontal;
   ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
   aPresShell->ScrollContentIntoView(aContent, vertical, horizontal,
-                                    nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
+                                    ScrollFlags::ScrollOverflowHidden);
 }
 
 bool nsCoreUtils::IsWhitespaceString(const nsAString &aString) {
   nsAString::const_char_iterator iterBegin, iterEnd;
 
   aString.BeginReading(iterBegin);
   aString.EndReading(iterEnd);
 
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -1841,17 +1841,17 @@ void Accessible::DispatchClickEvent(nsIC
                                     uint32_t aActionIndex) const {
   if (IsDefunct()) return;
 
   RefPtr<PresShell> presShell = mDoc->PresShellPtr();
 
   // Scroll into view.
   presShell->ScrollContentIntoView(aContent, nsIPresShell::ScrollAxis(),
                                    nsIPresShell::ScrollAxis(),
-                                   nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
+                                   ScrollFlags::ScrollOverflowHidden);
 
   AutoWeakFrame frame = aContent->GetPrimaryFrame();
   if (!frame) return;
 
   // Compute x and y coordinates.
   nsPoint point;
   nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget(point);
   if (!widget) return;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10489,30 +10489,29 @@ nsresult nsDocShell::ScrollToAnchor(bool
     // We try the UTF-8 string first, and then try the document's
     // charset (see below).  If the string is not UTF-8,
     // conversion will fail and give us an empty Unicode string.
     // In that case, we should just fall through to using the
     // page's charset.
     nsresult rv = NS_ERROR_FAILURE;
     NS_ConvertUTF8toUTF16 uStr(aNewHash);
     if (!uStr.IsEmpty()) {
-      rv =
-          presShell->GoToAnchor(uStr, scroll, nsIPresShell::SCROLL_SMOOTH_AUTO);
+      rv = presShell->GoToAnchor(uStr, scroll, ScrollFlags::ScrollSmoothAuto);
     }
 
     if (NS_FAILED(rv)) {
       char* str = ToNewCString(aNewHash);
       if (!str) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
       nsUnescape(str);
       NS_ConvertUTF8toUTF16 utf16Str(str);
       if (!utf16Str.IsEmpty()) {
         rv = presShell->GoToAnchor(utf16Str, scroll,
-                                   nsIPresShell::SCROLL_SMOOTH_AUTO);
+                                   ScrollFlags::ScrollSmoothAuto);
       }
       free(str);
     }
 
     // Above will fail if the anchor name is not UTF-8.  Need to
     // convert from document charset to unicode.
     if (NS_FAILED(rv)) {
       // Get a document charset
@@ -10536,17 +10535,17 @@ nsresult nsDocShell::ScrollToAnchor(bool
       // if there is no such anchor in the document, which is actually a
       // success condition for us (we want to update the session history
       // with the new URI no matter whether we actually scrolled
       // somewhere).
       //
       // When aNewHash contains "%00", unescaped string may be empty.
       // And GoToAnchor asserts if we ask it to scroll to an empty ref.
       presShell->GoToAnchor(uStr, scroll && !uStr.IsEmpty(),
-                            nsIPresShell::SCROLL_SMOOTH_AUTO);
+                            ScrollFlags::ScrollSmoothAuto);
     }
   } else {
     // Tell the shell it's at an anchor, without scrolling.
     presShell->GoToAnchor(EmptyString(), false);
 
     // An empty anchor was found, but if it's a load from history,
     // we don't have to jump to the top of the page. Scrollbar
     // position will be restored by the caller, based on positions
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -731,65 +731,67 @@ void Element::ScrollIntoView(const Scrol
   }
 
   // Get the presentation shell
   RefPtr<PresShell> presShell = document->GetPresShell();
   if (!presShell) {
     return;
   }
 
-  int16_t vpercent = nsIPresShell::SCROLL_CENTER;
+  WhereToScroll whereToScrollVertically = kScrollToCenter;
   switch (aOptions.mBlock) {
     case ScrollLogicalPosition::Start:
-      vpercent = nsIPresShell::SCROLL_TOP;
+      whereToScrollVertically = kScrollToTop;
       break;
     case ScrollLogicalPosition::Center:
-      vpercent = nsIPresShell::SCROLL_CENTER;
+      whereToScrollVertically = kScrollToCenter;
       break;
     case ScrollLogicalPosition::End:
-      vpercent = nsIPresShell::SCROLL_BOTTOM;
+      whereToScrollVertically = kScrollToBottom;
       break;
     case ScrollLogicalPosition::Nearest:
-      vpercent = nsIPresShell::SCROLL_MINIMUM;
+      whereToScrollVertically = kScrollMinimum;
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected ScrollLogicalPosition value");
   }
 
-  int16_t hpercent = nsIPresShell::SCROLL_CENTER;
+  WhereToScroll whereToScrollHorizontally = kScrollToCenter;
   switch (aOptions.mInline) {
     case ScrollLogicalPosition::Start:
-      hpercent = nsIPresShell::SCROLL_LEFT;
+      whereToScrollHorizontally = kScrollToLeft;
       break;
     case ScrollLogicalPosition::Center:
-      hpercent = nsIPresShell::SCROLL_CENTER;
+      whereToScrollHorizontally = kScrollToCenter;
       break;
     case ScrollLogicalPosition::End:
-      hpercent = nsIPresShell::SCROLL_RIGHT;
+      whereToScrollHorizontally = kScrollToRight;
       break;
     case ScrollLogicalPosition::Nearest:
-      hpercent = nsIPresShell::SCROLL_MINIMUM;
+      whereToScrollHorizontally = kScrollMinimum;
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected ScrollLogicalPosition value");
   }
 
-  uint32_t flags = nsIPresShell::SCROLL_OVERFLOW_HIDDEN;
+  ScrollFlags scrollFlags = ScrollFlags::ScrollOverflowHidden;
   if (aOptions.mBehavior == ScrollBehavior::Smooth) {
-    flags |= nsIPresShell::SCROLL_SMOOTH;
+    scrollFlags |= ScrollFlags::ScrollSmooth;
   } else if (aOptions.mBehavior == ScrollBehavior::Auto) {
-    flags |= nsIPresShell::SCROLL_SMOOTH_AUTO;
+    scrollFlags |= ScrollFlags::ScrollSmoothAuto;
   }
   if (StaticPrefs::layout_css_scroll_snap_v1_enabled()) {
-    flags |= nsIPresShell::SCROLL_SNAP;
+    scrollFlags |= ScrollFlags::ScrollSnap;
   }
 
   presShell->ScrollContentIntoView(
-      this, nsIPresShell::ScrollAxis(vpercent, nsIPresShell::SCROLL_ALWAYS),
-      nsIPresShell::ScrollAxis(hpercent, nsIPresShell::SCROLL_ALWAYS), flags);
+      this,
+      nsIPresShell::ScrollAxis(whereToScrollVertically, WhenToScroll::Always),
+      nsIPresShell::ScrollAxis(whereToScrollHorizontally, WhenToScroll::Always),
+      scrollFlags);
 }
 
 void Element::Scroll(const CSSIntPoint& aScroll,
                      const ScrollOptions& aOptions) {
   nsIScrollableFrame* sf = GetScrollFrame();
   if (sf) {
     ScrollMode scrollMode = ScrollMode::eInstant;
     if (aOptions.mBehavior == ScrollBehavior::Smooth) {
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -1873,18 +1873,17 @@ nsresult Selection::DoAutoScroll(nsIFram
   // about to do will change the coordinates of aFrame.
   nsPoint globalPoint = aPoint + aFrame->GetOffsetToCrossDoc(rootmostFrame);
 
   bool done = false;
   bool didScroll;
   while (true) {
     didScroll = presShell->ScrollFrameRectIntoView(
         aFrame, nsRect(aPoint, nsSize(0, 0)), nsIPresShell::ScrollAxis(),
-        nsIPresShell::ScrollAxis(),
-        nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+        nsIPresShell::ScrollAxis(), ScrollFlags::IgnoreMarginAndPadding);
     if (!weakFrame || !weakRootFrame) {
       return NS_OK;
     }
     if (!didScroll && !done) {
       // If aPoint is at the screen edge then try to scroll anyway, once.
       RefPtr<nsDeviceContext> dx =
           presShell->GetViewManager()->GetDeviceContext();
       nsRect screen;
@@ -3022,17 +3021,17 @@ nsresult Selection::PostScrollSelectionI
 
   mScrollEvent = new ScrollSelectionIntoViewEvent(this, aRegion, aVertical,
                                                   aHorizontal, aFlags);
   refreshDriver->AddEarlyRunner(mScrollEvent.get());
   return NS_OK;
 }
 
 void Selection::ScrollIntoView(int16_t aRegion, bool aIsSynchronous,
-                               int16_t aVPercent, int16_t aHPercent,
+                               WhereToScroll aVPercent, WhereToScroll aHPercent,
                                ErrorResult& aRv) {
   int32_t flags = aIsSynchronous ? Selection::SCROLL_SYNCHRONOUS : 0;
   nsresult rv = ScrollIntoView(aRegion, nsIPresShell::ScrollAxis(aVPercent),
                                nsIPresShell::ScrollAxis(aHPercent), flags);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
   }
 }
@@ -3084,26 +3083,26 @@ nsresult Selection::ScrollIntoView(Selec
   nsIFrame* frame = GetSelectionAnchorGeometry(aRegion, &rect);
   if (!frame) return NS_ERROR_FAILURE;
 
   // Scroll vertically to get the caret into view, but only if the container
   // is perceived to be scrollable in that direction (i.e. there is a visible
   // vertical scrollbar or the scroll range is at least one device pixel)
   aVertical.mOnlyIfPerceivedScrollableDirection = true;
 
-  uint32_t flags = nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING;
+  ScrollFlags scrollFlags = ScrollFlags::IgnoreMarginAndPadding;
   if (aFlags & Selection::SCROLL_FIRST_ANCESTOR_ONLY) {
-    flags |= nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY;
+    scrollFlags |= ScrollFlags::ScrollFirstAncestorOnly;
   }
   if (aFlags & Selection::SCROLL_OVERFLOW_HIDDEN) {
-    flags |= nsIPresShell::SCROLL_OVERFLOW_HIDDEN;
+    scrollFlags |= ScrollFlags::ScrollOverflowHidden;
   }
 
   presShell->ScrollFrameRectIntoView(frame, rect, aVertical, aHorizontal,
-                                     flags);
+                                     scrollFlags);
   return NS_OK;
 }
 
 void Selection::AddSelectionListener(nsISelectionListener* aNewListener) {
   MOZ_ASSERT(aNewListener);
   mSelectionListeners.AppendElement(aNewListener);  // AddRefs
 }
 
--- a/dom/base/Selection.h
+++ b/dom/base/Selection.h
@@ -373,18 +373,19 @@ class Selection final : public nsSupport
   SelectionType Type() const { return mSelectionType; }
 
   void GetRangesForInterval(nsINode& aBeginNode, int32_t aBeginOffset,
                             nsINode& aEndNode, int32_t aEndOffset,
                             bool aAllowAdjacent,
                             nsTArray<RefPtr<nsRange>>& aReturn,
                             mozilla::ErrorResult& aRv);
 
-  void ScrollIntoView(int16_t aRegion, bool aIsSynchronous, int16_t aVPercent,
-                      int16_t aHPercent, mozilla::ErrorResult& aRv);
+  void ScrollIntoView(int16_t aRegion, bool aIsSynchronous,
+                      WhereToScroll aVPercent, WhereToScroll aHPercent,
+                      mozilla::ErrorResult& aRv);
 
   void SetColors(const nsAString& aForeColor, const nsAString& aBackColor,
                  const nsAString& aAltForeColor, const nsAString& aAltBackColor,
                  mozilla::ErrorResult& aRv);
 
   void ResetColors(mozilla::ErrorResult& aRv);
 
   /**
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2512,21 +2512,19 @@ nsDOMWindowUtils::ZoomToFocusedInput() {
     }
 
     // The content may be inside a scrollable subframe inside a non-scrollable
     // root content document. In this scenario, we want to ensure that the
     // main-thread side knows to scroll the content into view before we get
     // the bounding content rect and ask APZ to adjust the visual viewport.
     presShell->ScrollContentIntoView(
         content,
-        nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                 nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-        nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                 nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-        nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
+        nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
+        nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
+        ScrollFlags::ScrollOverflowHidden);
 
     CSSRect bounds =
         nsLayoutUtils::GetBoundingContentRect(content, rootScrollFrame);
     if (bounds.IsEmpty()) {
       // Do not zoom on empty bounds. Bail out.
       return NS_OK;
     }
     bounds.Inflate(15.0f, 0.0f);
@@ -4060,17 +4058,17 @@ nsDOMWindowUtils::EnsureDirtyRootFrame()
     return NS_ERROR_FAILURE;
   }
 
   nsIFrame* frame = presShell->GetRootFrame();
   if (!frame) {
     return NS_ERROR_FAILURE;
   }
 
-  presShell->FrameNeedsReflow(frame, nsIPresShell::eStyleChange,
+  presShell->FrameNeedsReflow(frame, IntrinsicDirty::StyleChange,
                               NS_FRAME_IS_DIRTY);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::SetPrefersReducedMotionOverrideForTest(bool aValue) {
   nsIWidget* widget = GetWidget();
   if (!widget) {
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -2120,26 +2120,24 @@ void nsFocusManager::FireFocusOrBlurEven
     }
   }
 }
 
 void nsFocusManager::ScrollIntoView(PresShell* aPresShell, nsIContent* aContent,
                                     uint32_t aFlags) {
   // if the noscroll flag isn't set, scroll the newly focused element into view
   if (!(aFlags & FLAG_NOSCROLL)) {
-    uint32_t scrollFlags = nsIPresShell::SCROLL_OVERFLOW_HIDDEN;
+    ScrollFlags scrollFlags = ScrollFlags::ScrollOverflowHidden;
     if (!(aFlags & FLAG_BYELEMENTFOCUS)) {
-      scrollFlags |= nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING;
+      scrollFlags |= ScrollFlags::IgnoreMarginAndPadding;
     }
     aPresShell->ScrollContentIntoView(
         aContent,
-        nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                 nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-        nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                 nsIPresShell::SCROLL_IF_NOT_VISIBLE),
+        nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
+        nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
         scrollFlags);
   }
 }
 
 void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow) {
   // don't raise windows that are already raised or are in the process of
   // being lowered
   if (!aWindow || aWindow == mActiveWindow || aWindow == mWindowBeingLowered)
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -922,17 +922,17 @@ bool nsFrameLoader::Show(int32_t marginW
   GetDocShell()->SetDefaultScrollbarPreferences(
       nsIScrollable::ScrollOrientation_Y, scrollbarPrefY);
 
   if (PresShell* presShell = GetDocShell()->GetPresShell()) {
     // Ensure root scroll frame is reflowed in case scroll preferences or
     // margins have changed
     nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
     if (rootScrollFrame) {
-      presShell->FrameNeedsReflow(rootScrollFrame, nsIPresShell::eResize,
+      presShell->FrameNeedsReflow(rootScrollFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
     }
     return true;
   }
 
   nsView* view = frame->EnsureInnerView();
   if (!view) return false;
 
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3616,17 +3616,17 @@ void HTMLMediaElement::SetPlayedOrSeeked
 
   mHasPlayedOrSeeked = aValue;
 
   // Force a reflow so that the poster frame hides or shows immediately.
   nsIFrame* frame = GetPrimaryFrame();
   if (!frame) {
     return;
   }
-  frame->PresShell()->FrameNeedsReflow(frame, nsIPresShell::eTreeChange,
+  frame->PresShell()->FrameNeedsReflow(frame, IntrinsicDirty::TreeChange,
                                        NS_FRAME_IS_DIRTY);
 }
 
 void HTMLMediaElement::NotifyXPCOMShutdown() { ShutdownDecoder(); }
 
 bool HTMLMediaElement::AudioChannelAgentDelayingPlayback() {
   return mAudioChannelWrapper && mAudioChannelWrapper->IsPlaybackBlocked();
 }
@@ -5903,17 +5903,17 @@ void HTMLMediaElement::Invalidate(bool a
                                   Maybe<nsIntSize>& aNewIntrinsicSize,
                                   bool aForceInvalidate) {
   nsIFrame* frame = GetPrimaryFrame();
   if (aNewIntrinsicSize) {
     UpdateMediaSize(aNewIntrinsicSize.value());
     if (frame) {
       nsPresContext* presContext = frame->PresContext();
       PresShell* presShell = presContext->PresShell();
-      presShell->FrameNeedsReflow(frame, nsIPresShell::eStyleChange,
+      presShell->FrameNeedsReflow(frame, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
     }
   }
 
   RefPtr<ImageContainer> imageContainer = GetImageContainer();
   bool asyncInvalidate =
       imageContainer && imageContainer->IsAsync() && !aForceInvalidate;
   if (frame) {
--- a/dom/html/nsGenericHTMLFrameElement.cpp
+++ b/dom/html/nsGenericHTMLFrameElement.cpp
@@ -291,17 +291,17 @@ nsresult nsGenericHTMLFrameElement::Afte
                 nsIScrollable::ScrollOrientation_Y, val);
             RefPtr<nsPresContext> presContext = docshell->GetPresContext();
             PresShell* presShell =
                 presContext ? presContext->GetPresShell() : nullptr;
             nsIFrame* rootScroll =
                 presShell ? presShell->GetRootScrollFrame() : nullptr;
             if (rootScroll) {
               presShell->FrameNeedsReflow(
-                  rootScroll, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
+                  rootScroll, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
             }
           }
         }
       }
     } else if (aName == nsGkAtoms::mozbrowser) {
       mReallyIsBrowser = !!aValue && BrowserFramesEnabled() &&
                          PrincipalAllowsBrowserFrame(NodePrincipal());
     }
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -193,19 +193,16 @@
 #include "nsHashKeys.h"
 #include "VisualViewport.h"
 
 #ifdef MOZ_TASK_TRACER
 #  include "GeckoTaskTracer.h"
 using namespace mozilla::tasktracer;
 #endif
 
-#define ANCHOR_SCROLL_FLAGS \
-  (nsIPresShell::SCROLL_OVERFLOW_HIDDEN | nsIPresShell::SCROLL_NO_PARENT_FRAMES)
-
 // define the scalfactor of drag and drop images
 // relative to the max screen height/width
 #define RELATIVE_SCALEFACTOR 0.0925f
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
@@ -1766,17 +1763,17 @@ nsresult PresShell::Initialize() {
 
   // Note: when the frame was created above it had the NS_FRAME_IS_DIRTY bit
   // set, but XBL processing could have caused a reflow which clears it.
   if (MOZ_LIKELY(rootFrame->GetStateBits() & NS_FRAME_IS_DIRTY)) {
     // Unset the DIRTY bits so that FrameNeedsReflow() will work right.
     rootFrame->RemoveStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
     NS_ASSERTION(!mDirtyRoots.Contains(rootFrame),
                  "Why is the root in mDirtyRoots already?");
-    FrameNeedsReflow(rootFrame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
+    FrameNeedsReflow(rootFrame, IntrinsicDirty::Resize, NS_FRAME_IS_DIRTY);
     NS_ASSERTION(mDirtyRoots.Contains(rootFrame),
                  "Should be in mDirtyRoots now");
     NS_ASSERTION(mObservingLayoutFlushes, "Why no reflow scheduled?");
   }
 
   // Restore our root scroll position now if we're getting here after EndLoad
   // got called, since this is our one chance to do it.  Note that we need not
   // have reflowed for this to work; when the scrollframe is finally reflowed
@@ -2576,17 +2573,17 @@ void nsIPresShell::FrameNeedsReflow(nsIF
                                     IntrinsicDirty aIntrinsicDirty,
                                     nsFrameState aBitToAdd,
                                     ReflowRootHandling aRootHandling) {
   MOZ_ASSERT(aBitToAdd == NS_FRAME_IS_DIRTY ||
                  aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN || !aBitToAdd,
              "Unexpected bits being added");
 
   // FIXME bug 478135
-  NS_ASSERTION(!(aIntrinsicDirty == eStyleChange &&
+  NS_ASSERTION(!(aIntrinsicDirty == IntrinsicDirty::StyleChange &&
                  aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN),
                "bits don't correspond to style change reason");
 
   // FIXME bug 457400
   NS_ASSERTION(!mIsReflowing, "can't mark frame dirty during reflow");
 
   // If we've not yet done the initial reflow, then don't bother
   // enqueuing a reflow command yet.
@@ -2622,36 +2619,36 @@ void nsIPresShell::FrameNeedsReflow(nsIF
     // subtreeRoot.
     bool wasDirty = NS_SUBTREE_DIRTY(subtreeRoot);
     subtreeRoot->AddStateBits(aBitToAdd);
 
     // Determine whether we need to keep looking for the next ancestor
     // reflow root if subtreeRoot itself is a reflow root.
     bool targetNeedsReflowFromParent;
     switch (aRootHandling) {
-      case ePositionOrSizeChange:
+      case ReflowRootHandling::PositionOrSizeChange:
         targetNeedsReflowFromParent = true;
         break;
-      case eNoPositionOrSizeChange:
+      case ReflowRootHandling::NoPositionOrSizeChange:
         targetNeedsReflowFromParent = false;
         break;
-      case eInferFromBitToAdd:
+      case ReflowRootHandling::InferFromBitToAdd:
         targetNeedsReflowFromParent = (aBitToAdd == NS_FRAME_IS_DIRTY);
         break;
     }
 
 #define FRAME_IS_REFLOW_ROOT(_f)                          \
   ((_f)->HasAnyStateBits(NS_FRAME_REFLOW_ROOT |           \
                          NS_FRAME_DYNAMIC_REFLOW_ROOT) && \
    ((_f) != subtreeRoot || !targetNeedsReflowFromParent))
 
     // Mark the intrinsic widths as dirty on the frame, all of its ancestors,
     // and all of its descendants, if needed:
 
-    if (aIntrinsicDirty != nsIPresShell::eResize) {
+    if (aIntrinsicDirty != IntrinsicDirty::Resize) {
       // Mark argument and all ancestors dirty. (Unless we hit a reflow
       // root that should contain the reflow.  That root could be
       // subtreeRoot itself if it's not dirty, or it could be some
       // ancestor of subtreeRoot.)
       for (nsIFrame* a = subtreeRoot; a && !FRAME_IS_REFLOW_ROOT(a);
            a = a->GetParent()) {
         a->MarkIntrinsicISizesDirty();
         if (a->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW) &&
@@ -2659,17 +2656,17 @@ void nsIPresShell::FrameNeedsReflow(nsIF
           // If we get here, 'a' is abspos, so its subtree's intrinsic sizing
           // has no effect on its ancestors' intrinsic sizing. So, don't loop
           // upwards any further.
           break;
         }
       }
     }
 
-    if (aIntrinsicDirty == eStyleChange) {
+    if (aIntrinsicDirty == IntrinsicDirty::StyleChange) {
       // Mark all descendants dirty (using an nsTArray stack rather than
       // recursion).
       // Note that ReflowInput::InitResizeFlags has some similar
       // code; see comments there for how and why it differs.
       AutoTArray<nsIFrame*, 32> stack;
       stack.AppendElement(subtreeRoot);
 
       do {
@@ -2994,17 +2991,17 @@ already_AddRefed<gfxContext> nsIPresShel
     // so rc may still be null.
     rc = devCtx->CreateReferenceRenderingContext();
   }
 
   return rc ? rc.forget() : nullptr;
 }
 
 nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
-                               uint32_t aAdditionalScrollFlags) {
+                               ScrollFlags aAdditionalScrollFlags) {
   if (!mDocument) {
     return NS_ERROR_FAILURE;
   }
 
   const Element* root = mDocument->GetRootElement();
   if (root && root->IsSVGElement(nsGkAtoms::svg)) {
     // We need to execute this even if there is an empty anchor name
     // so that any existing SVG fragment identifier effect is removed
@@ -3081,19 +3078,19 @@ nsresult PresShell::GoToAnchor(const nsA
   if (rootScroll && rootScroll->DidHistoryRestore()) {
     // Scroll position restored from history trumps scrolling to anchor.
     aScroll = false;
     rootScroll->ClearDidHistoryRestore();
   }
 
   if (content) {
     if (aScroll) {
-      rv = ScrollContentIntoView(content, ScrollAxis(SCROLL_TOP, SCROLL_ALWAYS),
-                                 ScrollAxis(),
-                                 ANCHOR_SCROLL_FLAGS | aAdditionalScrollFlags);
+      rv = ScrollContentIntoView(
+          content, ScrollAxis(kScrollToTop, WhenToScroll::Always), ScrollAxis(),
+          ScrollFlags::AnchorScrollFlags | aAdditionalScrollFlags);
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable();
       if (rootScroll) {
         mLastAnchorScrolledTo = content;
         mLastAnchorScrollPositionY = rootScroll->GetScrollPosition().y;
       }
     }
@@ -3171,19 +3168,19 @@ nsresult PresShell::ScrollToAnchor() {
   NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
 
   nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable();
   if (!rootScroll ||
       mLastAnchorScrollPositionY != rootScroll->GetScrollPosition().y) {
     return NS_OK;
   }
   nsCOMPtr<nsIContent> lastAnchorScrollTo = mLastAnchorScrolledTo;
-  nsresult rv = ScrollContentIntoView(lastAnchorScrollTo,
-                                      ScrollAxis(SCROLL_TOP, SCROLL_ALWAYS),
-                                      ScrollAxis(), ANCHOR_SCROLL_FLAGS);
+  nsresult rv = ScrollContentIntoView(
+      lastAnchorScrollTo, ScrollAxis(kScrollToTop, WhenToScroll::Always),
+      ScrollAxis(), ScrollFlags::AnchorScrollFlags);
   mLastAnchorScrolledTo = nullptr;
   return rv;
 }
 
 /*
  * Helper (per-continuation) for ScrollContentIntoView.
  *
  * @param aContainerFrame [in] the frame which aRect is relative to
@@ -3256,44 +3253,43 @@ static void AccumulateFrameBounds(nsIFra
     // aHaveRect to know when to drop the initial value on the floor.)
     aRect.UnionRectEdges(aRect, transformedBounds);
   } else {
     aHaveRect = true;
     aRect = transformedBounds;
   }
 }
 
-static bool ComputeNeedToScroll(nsIPresShell::WhenToScroll aWhenToScroll,
-                                nscoord aLineSize, nscoord aRectMin,
-                                nscoord aRectMax, nscoord aViewMin,
-                                nscoord aViewMax) {
+static bool ComputeNeedToScroll(WhenToScroll aWhenToScroll, nscoord aLineSize,
+                                nscoord aRectMin, nscoord aRectMax,
+                                nscoord aViewMin, nscoord aViewMax) {
   // See how the rect should be positioned vertically
-  if (nsIPresShell::SCROLL_ALWAYS == aWhenToScroll) {
+  if (WhenToScroll::Always == aWhenToScroll) {
     // The caller wants the frame as visible as possible
     return true;
-  } else if (nsIPresShell::SCROLL_IF_NOT_VISIBLE == aWhenToScroll) {
+  } else if (WhenToScroll::IfNotVisible == aWhenToScroll) {
     // Scroll only if no part of the frame is visible in this view
     return aRectMax - aLineSize <= aViewMin || aRectMin + aLineSize >= aViewMax;
-  } else if (nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE == aWhenToScroll) {
+  } else if (WhenToScroll::IfNotFullyVisible == aWhenToScroll) {
     // Scroll only if part of the frame is hidden and more can fit in view
     return !(aRectMin >= aViewMin && aRectMax <= aViewMax) &&
            std::min(aViewMax, aRectMax) - std::max(aRectMin, aViewMin) <
                aViewMax - aViewMin;
   }
   return false;
 }
 
-static nscoord ComputeWhereToScroll(int16_t aWhereToScroll,
+static nscoord ComputeWhereToScroll(WhereToScroll aWhereToScroll,
                                     nscoord aOriginalCoord, nscoord aRectMin,
                                     nscoord aRectMax, nscoord aViewMin,
                                     nscoord aViewMax, nscoord* aRangeMin,
                                     nscoord* aRangeMax) {
   nscoord resultCoord = aOriginalCoord;
   nscoord scrollPortLength = aViewMax - aViewMin;
-  if (nsIPresShell::SCROLL_MINIMUM == aWhereToScroll) {
+  if (kScrollMinimum == aWhereToScroll) {
     // Scroll the minimum amount necessary to show as much as possible of the
     // frame. If the frame is too large, don't hide any initially visible part
     // of it.
     nscoord min = std::min(aRectMin, aRectMax - scrollPortLength);
     nscoord max = std::max(aRectMin, aRectMax - scrollPortLength);
     resultCoord = std::min(std::max(aOriginalCoord, min), max);
   } else {
     nscoord frameAlignCoord = NSToCoordRound(
@@ -3320,52 +3316,52 @@ static nscoord ComputeWhereToScroll(int1
  * fast as it can on the screen using layout viewport scrolling, and then
  * stop there, even if it could get closer to the desired position by
  * moving the visual viewport within the layout viewport.
  */
 static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
                              const nsRect& aRect,
                              nsIPresShell::ScrollAxis aVertical,
                              nsIPresShell::ScrollAxis aHorizontal,
-                             uint32_t aFlags) {
+                             ScrollFlags aScrollFlags) {
   nsPoint scrollPt = aFrameAsScrollable->GetVisualViewportOffset();
   nsRect visibleRect(scrollPt, aFrameAsScrollable->GetVisualViewportSize());
 
   nsSize lineSize;
   // Don't call GetLineScrollAmount unless we actually need it. Not only
   // does this save time, but it's not safe to call GetLineScrollAmount
   // during reflow (because it depends on font size inflation and doesn't
   // use the in-reflow-safe font-size inflation path). If we did call it,
   // it would assert and possible give the wrong result.
-  if (aVertical.mWhenToScroll == nsIPresShell::SCROLL_IF_NOT_VISIBLE ||
-      aHorizontal.mWhenToScroll == nsIPresShell::SCROLL_IF_NOT_VISIBLE) {
+  if (aVertical.mWhenToScroll == WhenToScroll::IfNotVisible ||
+      aHorizontal.mWhenToScroll == WhenToScroll::IfNotVisible) {
     lineSize = aFrameAsScrollable->GetLineScrollAmount();
   }
   ScrollStyles ss = aFrameAsScrollable->GetScrollStyles();
   nsRect allowedRange(scrollPt, nsSize(0, 0));
   bool needToScroll = false;
   uint32_t directions = aFrameAsScrollable->GetPerceivedScrollingDirections();
 
-  if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
+  if (((aScrollFlags & ScrollFlags::ScrollOverflowHidden) ||
        ss.mVertical != StyleOverflow::Hidden) &&
       (!aVertical.mOnlyIfPerceivedScrollableDirection ||
        (directions & nsIScrollableFrame::VERTICAL))) {
     if (ComputeNeedToScroll(aVertical.mWhenToScroll, lineSize.height, aRect.y,
                             aRect.YMost(), visibleRect.y,
                             visibleRect.YMost())) {
       nscoord maxHeight;
       scrollPt.y = ComputeWhereToScroll(
           aVertical.mWhereToScroll, scrollPt.y, aRect.y, aRect.YMost(),
           visibleRect.y, visibleRect.YMost(), &allowedRange.y, &maxHeight);
       allowedRange.height = maxHeight - allowedRange.y;
       needToScroll = true;
     }
   }
 
-  if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
+  if (((aScrollFlags & ScrollFlags::ScrollOverflowHidden) ||
        ss.mHorizontal != StyleOverflow::Hidden) &&
       (!aHorizontal.mOnlyIfPerceivedScrollableDirection ||
        (directions & nsIScrollableFrame::HORIZONTAL))) {
     if (ComputeNeedToScroll(aHorizontal.mWhenToScroll, lineSize.width, aRect.x,
                             aRect.XMost(), visibleRect.x,
                             visibleRect.XMost())) {
       nscoord maxWidth;
       scrollPt.x = ComputeWhereToScroll(
@@ -3378,47 +3374,47 @@ static void ScrollToShowRect(nsIScrollab
 
   // If we don't need to scroll, then don't try since it might cancel
   // a current smooth scroll operation.
   if (needToScroll) {
     ScrollMode scrollMode = ScrollMode::eInstant;
     bool autoBehaviorIsSmooth =
         (aFrameAsScrollable->GetScrollStyles().mScrollBehavior ==
          NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
-    bool smoothScroll =
-        (aFlags & nsIPresShell::SCROLL_SMOOTH) ||
-        ((aFlags & nsIPresShell::SCROLL_SMOOTH_AUTO) && autoBehaviorIsSmooth);
+    bool smoothScroll = (aScrollFlags & ScrollFlags::ScrollSmooth) ||
+                        ((aScrollFlags & ScrollFlags::ScrollSmoothAuto) &&
+                         autoBehaviorIsSmooth);
     if (gfxPrefs::ScrollBehaviorEnabled() && smoothScroll) {
       scrollMode = ScrollMode::eSmoothMsd;
     }
     aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange,
-                                 aFlags & nsIPresShell::SCROLL_SNAP
+                                 aScrollFlags & ScrollFlags::ScrollSnap
                                      ? nsIScrollbarMediator::ENABLE_SNAP
                                      : nsIScrollbarMediator::DISABLE_SNAP);
   }
 }
 
 nsresult PresShell::ScrollContentIntoView(nsIContent* aContent,
                                           nsIPresShell::ScrollAxis aVertical,
                                           nsIPresShell::ScrollAxis aHorizontal,
-                                          uint32_t aFlags) {
+                                          ScrollFlags aScrollFlags) {
   NS_ENSURE_TRUE(aContent, NS_ERROR_NULL_POINTER);
   RefPtr<Document> composedDoc = aContent->GetComposedDoc();
   NS_ENSURE_STATE(composedDoc);
 
   NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
 
   if (mContentToScrollTo) {
     mContentToScrollTo->DeleteProperty(nsGkAtoms::scrolling);
   }
   mContentToScrollTo = aContent;
   ScrollIntoViewData* data = new ScrollIntoViewData();
   data->mContentScrollVAxis = aVertical;
   data->mContentScrollHAxis = aHorizontal;
-  data->mContentToScrollToFlags = aFlags;
+  data->mContentToScrollToFlags = aScrollFlags;
   if (NS_FAILED(mContentToScrollTo->SetProperty(
           nsGkAtoms::scrolling, data,
           nsINode::DeleteProperty<PresShell::ScrollIntoViewData>))) {
     mContentToScrollTo = nullptr;
   }
 
   // Flush layout and attempt to scroll in the process.
   if (PresShell* presShell = composedDoc->GetPresShell()) {
@@ -3471,35 +3467,34 @@ void PresShell::DoScrollContentIntoView(
   if (MOZ_UNLIKELY(!data)) {
     mContentToScrollTo = nullptr;
     return;
   }
 
   // Get the scroll-margin here since |frame| is going to be changed to iterate
   // over all continuation frames below.
   nsMargin scrollMargin;
-  if (!(data->mContentToScrollToFlags &
-        nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING)) {
+  if (!(data->mContentToScrollToFlags & ScrollFlags::IgnoreMarginAndPadding)) {
     scrollMargin = frame->StyleMargin()->GetScrollMargin();
   }
 
   // This is a two-step process.
   // Step 1: Find the bounds of the rect we want to scroll into view.  For
   //         example, for an inline frame we may want to scroll in the whole
   //         line, or we may want to scroll multiple lines into view.
   // Step 2: Walk container frame and its ancestors and scroll them
   //         appropriately.
   // frameBounds is relative to container. We're assuming
   // that scrollframes don't split so every continuation of frame will
   // be a descendant of container. (Things would still mostly work
   // even if that assumption was false.)
   nsRect frameBounds;
   bool haveRect = false;
   bool useWholeLineHeightForInlines = data->mContentScrollVAxis.mWhenToScroll !=
-                                      nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE;
+                                      WhenToScroll::IfNotFullyVisible;
   // Reuse the same line iterator across calls to AccumulateFrameBounds.  We set
   // it every time we detect a new block (stored in prevBlock).
   nsIFrame* prevBlock = nullptr;
   nsAutoLineIterator lines;
   // The last line we found a continuation on in |lines|.  We assume that later
   // continuations cannot come on earlier lines.
   int32_t curLine = 0;
   do {
@@ -3513,17 +3508,17 @@ void PresShell::DoScrollContentIntoView(
                           data->mContentScrollHAxis,
                           data->mContentToScrollToFlags);
 }
 
 bool nsIPresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
                                            const nsRect& aRect,
                                            nsIPresShell::ScrollAxis aVertical,
                                            nsIPresShell::ScrollAxis aHorizontal,
-                                           uint32_t aFlags) {
+                                           ScrollFlags aScrollFlags) {
   bool didScroll = false;
   // This function needs to work even if rect has a width or height of 0.
   nsRect rect = aRect;
   nsIFrame* container = aFrame;
   // Walk up the frame hierarchy scrolling the rect into view and
   // keeping rect relative to container
   do {
     nsIScrollableFrame* sf = do_QueryFrame(container);
@@ -3548,48 +3543,48 @@ bool nsIPresShell::ScrollFrameRectIntoVi
         }
         if (!cbV) {
           padding.top = padding.bottom = nscoord(0);
         }
         targetRect.Inflate(padding);
       }
 
       targetRect -= sf->GetScrolledFrame()->GetPosition();
-      if (!(aFlags & nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING)) {
+      if (!(aScrollFlags & ScrollFlags::IgnoreMarginAndPadding)) {
         nsMargin scrollPadding = sf->GetScrollPadding();
         targetRect.Inflate(scrollPadding);
         targetRect = targetRect.Intersect(sf->GetScrolledRect());
       }
 
-      ScrollToShowRect(sf, targetRect, aVertical, aHorizontal, aFlags);
+      ScrollToShowRect(sf, targetRect, aVertical, aHorizontal, aScrollFlags);
 
       nsPoint newPosition = sf->LastScrollDestination();
       // If the scroll position increased, that means our content moved up,
       // so our rect's offset should decrease
       rect += oldPosition - newPosition;
 
       if (oldPosition != newPosition) {
         didScroll = true;
       }
 
       // only scroll one container when this flag is set
-      if (aFlags & nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY) {
+      if (aScrollFlags & ScrollFlags::ScrollFirstAncestorOnly) {
         break;
       }
     }
     nsIFrame* parent;
     if (container->IsTransformed()) {
       container->GetTransformMatrix(nullptr, &parent);
       rect =
           nsLayoutUtils::TransformFrameRectToAncestor(container, rect, parent);
     } else {
       rect += container->GetPosition();
       parent = container->GetParent();
     }
-    if (!parent && !(aFlags & nsIPresShell::SCROLL_NO_PARENT_FRAMES)) {
+    if (!parent && !(aScrollFlags & ScrollFlags::ScrollNoParentFrames)) {
       nsPoint extraOffset(0, 0);
       parent = nsLayoutUtils::GetCrossDocParentFrame(container, &extraOffset);
       if (parent) {
         int32_t APD = container->PresContext()->AppUnitsPerDevPixel();
         int32_t parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
         rect = rect.ScaleToOtherAppUnitsRoundOut(APD, parentAPD);
         rect += extraOffset;
       }
@@ -8507,22 +8502,22 @@ bool PresShell::EventHandler::PrepareToU
     //
     // Doing this call first forces the frame to be in view, eliminating the
     // problem. The only difference in the result is that if your cursor is in
     // an edit box below the current view, you'll get the edit box aligned with
     // the top of the window. This is arguably better behavior anyway.
     rv = MOZ_KnownLive(mPresShell)
              ->ScrollContentIntoView(
                  content,
-                 nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                          nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-                 nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                          nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-                 nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
-                     nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+                 nsIPresShell::ScrollAxis(kScrollMinimum,
+                                          WhenToScroll::IfNotVisible),
+                 nsIPresShell::ScrollAxis(kScrollMinimum,
+                                          WhenToScroll::IfNotVisible),
+                 ScrollFlags::ScrollOverflowHidden |
+                     ScrollFlags::IgnoreMarginAndPadding);
     NS_ENSURE_SUCCESS(rv, false);
     frame = content->GetPrimaryFrame();
     NS_WARNING_ASSERTION(frame, "No frame for focused content?");
   }
 
   // Actually scroll the selection (ie caret) into view. Note that this must
   // be synchronous since we will be checking the caret position on the screen.
   //
@@ -8571,20 +8566,19 @@ bool PresShell::EventHandler::PrepareToU
   return true;
 }
 
 void PresShell::EventHandler::GetCurrentItemAndPositionForElement(
     Element* aFocusedElement, nsIContent** aTargetToUse,
     LayoutDeviceIntPoint& aTargetPt, nsIWidget* aRootWidget) {
   nsCOMPtr<nsIContent> focusedContent = aFocusedElement;
   MOZ_KnownLive(mPresShell)
-      ->ScrollContentIntoView(
-          focusedContent, ScrollAxis(), ScrollAxis(),
-          nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
-              nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+      ->ScrollContentIntoView(focusedContent, ScrollAxis(), ScrollAxis(),
+                              ScrollFlags::ScrollOverflowHidden |
+                                  ScrollFlags::IgnoreMarginAndPadding);
 
   nsPresContext* presContext = GetPresContext();
 
   bool istree = false, checkLineHeight = true;
   nscoord extraTreeY = 0;
 
 #ifdef MOZ_XUL
   // Set the position to just underneath the current item for multi-select
@@ -10662,17 +10656,17 @@ void nsIPresShell::MarkFixedFramesForRef
     }
   }
 }
 
 void nsIPresShell::CompleteChangeToVisualViewportSize() {
   if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
     rootScrollFrame->MarkScrollbarsDirtyForReflow();
   }
-  MarkFixedFramesForReflow(nsIPresShell::eResize);
+  MarkFixedFramesForReflow(IntrinsicDirty::Resize);
 
   if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
     window->VisualViewport()->PostResizeEvent();
   }
 
   if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
     ScrollAnchorContainer* container = rootScrollFrame->Anchor();
     container->UserScrolled();
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -359,22 +359,22 @@ class PresShell final : public nsIPresSh
   static PresShell* GetShellForTouchEvent(WidgetGUIEvent* aEvent);
 
   /**
    * Informs the pres shell that the document is now at the anchor with
    * the given name.  If |aScroll| is true, scrolls the view of the
    * document so that the anchor with the specified name is displayed at
    * the top of the window.  If |aAnchorName| is empty, then this informs
    * the pres shell that there is no current target, and |aScroll| must
-   * be false.  If |aAdditionalScrollFlags| is nsIPresShell::SCROLL_SMOOTH_AUTO
+   * be false.  If |aAdditionalScrollFlags| is ScrollFlags::ScrollSmoothAuto
    * and |aScroll| is true, the scrolling may be performed with an animation.
    */
   MOZ_CAN_RUN_SCRIPT
   nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll,
-                      uint32_t aAdditionalScrollFlags = 0);
+                      ScrollFlags aAdditionalScrollFlags = ScrollFlags::None);
 
   /**
    * Tells the presshell to scroll again to the last anchor scrolled to by
    * GoToAnchor, if any. This scroll only happens if the scroll
    * position has not changed since the last GoToAnchor. This is called
    * by nsDocumentViewer::LoadComplete. This clears the last anchor
    * scrolled to by GoToAnchor (we don't want to keep it alive if it's
    * removed from the DOM), so don't call this more than once.
@@ -386,40 +386,44 @@ class PresShell final : public nsIPresSh
    * is displayed in the window. Layout is flushed before scrolling.
    *
    * @param aContent  The content object of which primary frame should be
    *                  scrolled into view.
    * @param aVertical How to align the frame vertically and when to do so.
    *                  This is a ScrollAxis of Where and When.
    * @param aHorizontal How to align the frame horizontally and when to do so.
    *                  This is a ScrollAxis of Where and When.
-   * @param aFlags    If SCROLL_FIRST_ANCESTOR_ONLY is set, only the nearest
-   *                  scrollable ancestor is scrolled, otherwise all
-   *                  scrollable ancestors may be scrolled if necessary.
-   *                  If SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a
-   *                  direction even if overflow:hidden is specified in that
-   *                  direction; otherwise we will not scroll in that direction
-   *                  when overflow:hidden is set for that direction.
-   *                  If SCROLL_NO_PARENT_FRAMES is set then we only scroll
-   *                  nodes in this document, not in any parent documents which
-   *                  contain this document in a iframe or the like.
-   *                  If SCROLL_SMOOTH is set and CSSOM-VIEW scroll-behavior
-   *                  is enabled, we will scroll smoothly using
-   *                  nsIScrollableFrame::ScrollMode::SMOOTH_MSD; otherwise,
-   *                  nsIScrollableFrame::ScrollMode::INSTANT will be used.
-   *                  If SCROLL_SMOOTH_AUTO is set, the CSSOM-View
-   *                  scroll-behavior attribute is set to 'smooth' on the
-   *                  scroll frame, and CSSOM-VIEW scroll-behavior is enabled,
-   *                  we will scroll smoothly using
-   *                  nsIScrollableFrame::ScrollMode::SMOOTH_MSD; otherwise,
-   *                  nsIScrollableFrame::ScrollMode::INSTANT will be used.
+   * @param aScrollFlags  If ScrollFlags::ScrollFirstAncestorOnly is set,
+   *                      only the nearest scrollable ancestor is scrolled,
+   *                      otherwise all scrollable ancestors may be scrolled
+   *                      if necessary.  If ScrollFlags::ScrollOverflowHidden
+   *                      is set then we may scroll in a direction even if
+   *                      overflow:hidden is specified in that direction;
+   *                      otherwise we will not scroll in that direction when
+   *                      overflow:hidden is set for that direction.  If
+   *                      ScrollFlags::ScrollNoParentFrames is set then we
+   *                      only scroll nodes in this document, not in any
+   *                      parent documents which contain this document in a
+   *                      iframe or the like.  If ScrollFlags::ScrollSmooth
+   *                      is set and CSSOM-VIEW scroll-behavior is enabled,
+   *                      we will scroll smoothly using
+   *                      nsIScrollableFrame::ScrollMode::SMOOTH_MSD;
+   *                      otherwise, nsIScrollableFrame::ScrollMode::INSTANT
+   *                      will be used.  If ScrollFlags::ScrollSmoothAuto is
+   *                      set, the CSSOM-View scroll-behavior attribute is
+   *                      set to 'smooth' on the scroll frame, and CSSOM-VIEW
+   *                      scroll-behavior is enabled, we will scroll smoothly
+   *                      using nsIScrollableFrame::ScrollMode::SMOOTH_MSD;
+   *                      otherwise, nsIScrollableFrame::ScrollMode::INSTANT
+   *                      will be used.
    */
   MOZ_CAN_RUN_SCRIPT
   nsresult ScrollContentIntoView(nsIContent* aContent, ScrollAxis aVertical,
-                                 ScrollAxis aHorizontal, uint32_t aFlags);
+                                 ScrollAxis aHorizontal,
+                                 ScrollFlags aScrollFlags);
 
   /**
    * When capturing content is set, it traps all mouse events and retargets
    * them at this content node. If capturing is not allowed
    * (gCaptureInfo.mAllowed is false), then capturing is not set. However, if
    * the CaptureFlags::IgnoreAllowedState is set, the allowed state is ignored
    * and capturing is set regardless. To disable capture, pass null for the
    * value of aContent.
--- a/layout/base/PresShellForwards.h
+++ b/layout/base/PresShellForwards.h
@@ -54,16 +54,64 @@ enum class ResizeReflowOptions : uint32_
 };
 
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ResizeReflowOptions)
 
 // This is actually pref-controlled, but we use this value if we fail to get
 // the pref for any reason.
 #define PAINTLOCK_EVENT_DELAY 5
 
+enum class IntrinsicDirty {
+  // XXXldb eResize should be renamed
+  Resize,       // don't mark any intrinsic widths dirty
+  TreeChange,   // mark intrinsic widths dirty on aFrame and its ancestors
+  StyleChange,  // Do eTreeChange, plus all of aFrame's descendants
+};
+
+enum class ReflowRootHandling {
+  PositionOrSizeChange,    // aFrame is changing position or size
+  NoPositionOrSizeChange,  // ... NOT changing ...
+  InferFromBitToAdd,       // is changing iff (aBitToAdd == NS_FRAME_IS_DIRTY)
+
+  // Note:  With eStyleChange, these can also apply to out-of-flows
+  // in addition to aFrame.
+};
+
+// WhereToScroll should be 0 ~ 100 or -1.  When it's in 0 ~ 100, it means
+// percentage of scrollTop/scrollLeft in scrollHeight/scrollWidth.
+// See ComputeWhereToScroll() for the detail.
+typedef int16_t WhereToScroll;
+static const WhereToScroll kScrollToTop = 0;
+static const WhereToScroll kScrollToLeft = 0;
+static const WhereToScroll kScrollToCenter = 50;
+static const WhereToScroll kScrollToBottom = 100;
+static const WhereToScroll kScrollToRight = 100;
+static const WhereToScroll kScrollMinimum = -1;
+
+enum class WhenToScroll : uint8_t {
+  Always,
+  IfNotVisible,
+  IfNotFullyVisible,
+};
+
+enum class ScrollFlags {
+  None = 0,
+  ScrollFirstAncestorOnly = 1 << 0,
+  ScrollOverflowHidden = 1 << 1,
+  ScrollNoParentFrames = 1 << 2,
+  ScrollSmooth = 1 << 3,
+  ScrollSmoothAuto = 1 << 4,
+  ScrollSnap = 1 << 5,
+  IgnoreMarginAndPadding = 1 << 6,
+  // ScrollOverflowHidden | ScrollNoParentFrames
+  AnchorScrollFlags = (1 << 1) | (1 << 2),
+};
+
+MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags)
+
 #ifdef DEBUG
 
 enum class VerifyReflowFlags {
   None = 0,
   On = 1 << 0,
   Noisy = 1 << 1,
   All = 1 << 2,
   DumpCommands = 1 << 3,
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1244,57 +1244,57 @@ static void AddSubtreeToOverflowTracker(
   for (; !lists.IsDone(); lists.Next()) {
     for (nsIFrame* child : lists.CurrentList()) {
       AddSubtreeToOverflowTracker(child, aOverflowChangedTracker);
     }
   }
 }
 
 static void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint) {
-  nsIPresShell::IntrinsicDirty dirtyType;
+  IntrinsicDirty dirtyType;
   if (aHint & nsChangeHint_ClearDescendantIntrinsics) {
     NS_ASSERTION(aHint & nsChangeHint_ClearAncestorIntrinsics,
                  "Please read the comments in nsChangeHint.h");
     NS_ASSERTION(aHint & nsChangeHint_NeedDirtyReflow,
                  "ClearDescendantIntrinsics requires NeedDirtyReflow");
-    dirtyType = nsIPresShell::eStyleChange;
+    dirtyType = IntrinsicDirty::StyleChange;
   } else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
              aFrame->HasAnyStateBits(
                  NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
-    dirtyType = nsIPresShell::eStyleChange;
+    dirtyType = IntrinsicDirty::StyleChange;
   } else if (aHint & nsChangeHint_ClearAncestorIntrinsics) {
-    dirtyType = nsIPresShell::eTreeChange;
+    dirtyType = IntrinsicDirty::TreeChange;
   } 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;
+    dirtyType = IntrinsicDirty::TreeChange;
   } else {
-    dirtyType = nsIPresShell::eResize;
+    dirtyType = IntrinsicDirty::Resize;
   }
 
   nsFrameState dirtyBits;
   if (aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     dirtyBits = nsFrameState(0);
   } else if ((aHint & nsChangeHint_NeedDirtyReflow) ||
-             dirtyType == nsIPresShell::eStyleChange) {
+             dirtyType == IntrinsicDirty::StyleChange) {
     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 (dirtyType == IntrinsicDirty::Resize && !dirtyBits) return;
+
+  ReflowRootHandling rootHandling;
   if (aHint & nsChangeHint_ReflowChangesSizeOrPosition) {
-    rootHandling = nsIPresShell::ePositionOrSizeChange;
+    rootHandling = ReflowRootHandling::PositionOrSizeChange;
   } else {
-    rootHandling = nsIPresShell::eNoPositionOrSizeChange;
+    rootHandling = ReflowRootHandling::NoPositionOrSizeChange;
   }
 
   do {
     aFrame->PresShell()->FrameNeedsReflow(aFrame, dirtyType, dirtyBits,
                                           rootHandling);
     aFrame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame);
   } while (aFrame);
 }
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5899,17 +5899,17 @@ void nsCSSFrameConstructor::AppendFrames
       nsFrameList ibSiblings;
       CreateIBSiblings(aState, aParentFrame,
                        aParentFrame->IsAbsPosContainingBlock(), aFrameList,
                        ibSiblings);
 
       // Make sure to trigger reflow of the inline that used to be our
       // last one and now isn't anymore, since its GetSkipSides() has
       // changed.
-      mPresShell->FrameNeedsReflow(aParentFrame, nsIPresShell::eTreeChange,
+      mPresShell->FrameNeedsReflow(aParentFrame, IntrinsicDirty::TreeChange,
                                    NS_FRAME_HAS_DIRTY_CHILDREN);
 
       // Recurse so we create new ib siblings as needed for aParentFrame's
       // parent
       return AppendFramesToParent(aState, aParentFrame->GetParent(), ibSiblings,
                                   aParentFrame, true);
     }
     return;
--- a/layout/base/nsCounterManager.cpp
+++ b/layout/base/nsCounterManager.cpp
@@ -187,17 +187,17 @@ void nsCounterList::RecalcAll() {
         useNode->mText->SetData(text, IgnoreErrors());
       }
     }
 
     if (oldValue != node->mValueAfter && node->mPseudoFrame &&
         node->mPseudoFrame->StyleDisplay()->mDisplay ==
             StyleDisplay::ListItem) {
       auto* shell = node->mPseudoFrame->PresShell();
-      shell->FrameNeedsReflow(node->mPseudoFrame, nsIPresShell::eStyleChange,
+      shell->FrameNeedsReflow(node->mPseudoFrame, IntrinsicDirty::StyleChange,
                               NS_FRAME_IS_DIRTY);
     }
   }
 }
 
 static bool HasCounters(const nsStyleContent& aStyle) {
   return aStyle.CounterIncrementCount() || aStyle.CounterResetCount() ||
          aStyle.CounterSetCount();
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2761,17 +2761,17 @@ nsDocumentViewer::SetFullZoom(float aFul
       mPrintPreviewZoomed = true;
     }
 
     mPrintPreviewZoom = aFullZoom;
     pc->SetPrintPreviewScale(aFullZoom * mOriginalPrintPreviewScale);
     nsIPageSequenceFrame* pf = presShell->GetPageSequenceFrame();
     if (pf) {
       nsIFrame* f = do_QueryFrame(pf);
-      presShell->FrameNeedsReflow(f, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
+      presShell->FrameNeedsReflow(f, IntrinsicDirty::Resize, NS_FRAME_IS_DIRTY);
     }
 
     nsIFrame* rootFrame = presShell->GetRootFrame();
     if (rootFrame) {
       rootFrame->InvalidateFrame();
     }
     return NS_OK;
   }
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -431,38 +431,26 @@ class nsIPresShell : public nsStubDocume
    * long as the ancestor chain between them doesn't cross a reflow root.
    *
    * The bit to add should be NS_FRAME_IS_DIRTY, NS_FRAME_HAS_DIRTY_CHILDREN
    * or nsFrameState(0); passing 0 means that dirty bits won't be set on the
    * frame or its ancestors/descendants, but that intrinsic widths will still
    * be marked dirty.  Passing aIntrinsicDirty = eResize and aBitToAdd = 0
    * would result in no work being done, so don't do that.
    */
-  enum IntrinsicDirty {
-    // XXXldb eResize should be renamed
-    eResize,      // don't mark any intrinsic widths dirty
-    eTreeChange,  // mark intrinsic widths dirty on aFrame and its ancestors
-    eStyleChange  // Do eTreeChange, plus all of aFrame's descendants
-  };
-  enum ReflowRootHandling {
-    ePositionOrSizeChange,    // aFrame is changing position or size
-    eNoPositionOrSizeChange,  // ... NOT changing ...
-    eInferFromBitToAdd  // is changing iff (aBitToAdd == NS_FRAME_IS_DIRTY)
-
-    // Note:  With eStyleChange, these can also apply to out-of-flows
-    // in addition to aFrame.
-  };
-  void FrameNeedsReflow(nsIFrame* aFrame, IntrinsicDirty aIntrinsicDirty,
+  void FrameNeedsReflow(nsIFrame* aFrame,
+                        mozilla::IntrinsicDirty aIntrinsicDirty,
                         nsFrameState aBitToAdd,
-                        ReflowRootHandling aRootHandling = eInferFromBitToAdd);
+                        mozilla::ReflowRootHandling aRootHandling =
+                            mozilla::ReflowRootHandling::InferFromBitToAdd);
 
   /**
    * Calls FrameNeedsReflow on all fixed position children of the root frame.
    */
-  void MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty);
+  void MarkFixedFramesForReflow(mozilla::IntrinsicDirty aIntrinsicDirty);
 
   /**
    * Tell the presshell that the given frame's reflow was interrupted.  This
    * will mark as having dirty children a path from the given frame (inclusive)
    * to the nearest ancestor with a dirty subtree, or to the reflow root
    * currently being reflowed if no such ancestor exists (inclusive).  This is
    * to be done immediately after reflow of the current reflow root completes.
    * This method must only be called during reflow, and the frame it's being
@@ -626,33 +614,19 @@ class nsIPresShell : public nsStubDocume
 
   /**
    * Get a reference rendering context. This is a context that should not
    * be rendered to, but is suitable for measuring text and performing
    * other non-rendering operations. Guaranteed to return non-null.
    */
   already_AddRefed<gfxContext> CreateReferenceRenderingContext();
 
-  enum {
-    SCROLL_TOP = 0,
-    SCROLL_BOTTOM = 100,
-    SCROLL_LEFT = 0,
-    SCROLL_RIGHT = 100,
-    SCROLL_CENTER = 50,
-    SCROLL_MINIMUM = -1
-  };
-
-  enum WhenToScroll {
-    SCROLL_ALWAYS,
-    SCROLL_IF_NOT_VISIBLE,
-    SCROLL_IF_NOT_FULLY_VISIBLE
-  };
   typedef struct ScrollAxis {
-    int16_t mWhereToScroll;
-    WhenToScroll mWhenToScroll : 8;
+    mozilla::WhereToScroll mWhereToScroll;
+    mozilla::WhenToScroll mWhenToScroll;
     bool mOnlyIfPerceivedScrollableDirection : 1;
     /**
      * aWhere:
      *   Either a percentage or a special value. nsIPresShell defines:
      *   * (Default) SCROLL_MINIMUM = -1: The visible area is scrolled the
      *     minimum amount to show as much as possible of the frame. This won't
      *     hide any initially visible part of the frame.
      *   * SCROLL_TOP = 0: The frame's upper edge is aligned with the top edge
@@ -677,42 +651,34 @@ class nsIPresShell : public nsStubDocume
      *   * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it is visible.
      *   * SCROLL_ALWAYS: Move the frame regardless of its current visibility.
      *
      * aOnlyIfPerceivedScrollableDirection:
      *   If the direction is not a perceived scrollable direction (i.e. no
      *   scrollbar showing and less than one device pixel of scrollable
      *   distance), don't scroll. Defaults to false.
      */
-    explicit ScrollAxis(int16_t aWhere = SCROLL_MINIMUM,
-                        WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE,
-                        bool aOnlyIfPerceivedScrollableDirection = false)
+    explicit ScrollAxis(
+        mozilla::WhereToScroll aWhere = mozilla::kScrollMinimum,
+        mozilla::WhenToScroll aWhen = mozilla::WhenToScroll::IfNotFullyVisible,
+        bool aOnlyIfPerceivedScrollableDirection = false)
         : mWhereToScroll(aWhere),
           mWhenToScroll(aWhen),
           mOnlyIfPerceivedScrollableDirection(
               aOnlyIfPerceivedScrollableDirection) {}
   } ScrollAxis;
 
-  enum {
-    SCROLL_FIRST_ANCESTOR_ONLY = 0x01,
-    SCROLL_OVERFLOW_HIDDEN = 0x02,
-    SCROLL_NO_PARENT_FRAMES = 0x04,
-    SCROLL_SMOOTH = 0x08,
-    SCROLL_SMOOTH_AUTO = 0x10,
-    SCROLL_SNAP = 0x20,
-    SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING = 0x40
-  };
   /**
    * Scrolls the view of the document so that the given area of a frame
    * is visible, if possible. Layout is not flushed before scrolling.
    *
    * @param aRect relative to aFrame
    * @param aVertical see ScrollContentIntoView and ScrollAxis
    * @param aHorizontal see ScrollContentIntoView and ScrollAxis
-   * @param aFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the
+   * @param aScrollFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the
    * nearest scrollable ancestor is scrolled, otherwise all
    * scrollable ancestors may be scrolled if necessary
    * if SCROLL_OVERFLOW_HIDDEN is set then we may scroll in a direction
    * even if overflow:hidden is specified in that direction; otherwise
    * we will not scroll in that direction when overflow:hidden is
    * set for that direction
    * If SCROLL_NO_PARENT_FRAMES is set then we only scroll
    * nodes in this document, not in any parent documents which
@@ -720,17 +686,17 @@ class nsIPresShell : public nsStubDocume
    * If SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING is set we ignore scroll-margin
    * value specified for |aFrame| and scroll-padding value for the scroll
    * container. This option is typically used to locate poped-up frames into
    * view.
    * @return true if any scrolling happened, false if no scrolling happened
    */
   bool ScrollFrameRectIntoView(nsIFrame* aFrame, const nsRect& aRect,
                                ScrollAxis aVertical, ScrollAxis aHorizontal,
-                               uint32_t aFlags);
+                               mozilla::ScrollFlags aScrollFlags);
 
   /**
    * Determine if a rectangle specified in the frame's coordinate system
    * intersects "enough" with the viewport to be considered visible. This
    * is not a strict test against the viewport -- it's a test against
    * the intersection of the viewport and the frame's ancestor scrollable
    * frames. If it doesn't intersect enough, return a value indicating
    * which direction the frame's topmost ancestor scrollable frame would
@@ -1686,17 +1652,17 @@ class nsIPresShell : public nsStubDocume
 
   void WillDoReflow();
 
   // This data is stored as a content property (nsGkAtoms::scrolling) on
   // mContentToScrollTo when we have a pending ScrollIntoView.
   struct ScrollIntoViewData {
     ScrollAxis mContentScrollVAxis;
     ScrollAxis mContentScrollHAxis;
-    uint32_t mContentToScrollToFlags;
+    mozilla::ScrollFlags mContentToScrollToFlags;
   };
 
   static mozilla::LazyLogModule gLog;
 
   DOMHighResTimeStamp GetPerformanceNowUnclamped();
 
   // The callback for the mReflowContinueTimer timer.
   static void sReflowContinueCallback(nsITimer* aTimer, void* aPresShell);
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8810,17 +8810,17 @@ static void MaybeReflowForInflationScree
           nsTArray<nsCOMPtr<nsIContentViewer>> array;
           cv->AppendSubtree(array);
           for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) {
             nsCOMPtr<nsIContentViewer> cv = array[i];
             if (RefPtr<PresShell> descendantPresShell = cv->GetPresShell()) {
               nsIFrame* rootFrame = descendantPresShell->GetRootFrame();
               if (rootFrame) {
                 descendantPresShell->FrameNeedsReflow(
-                    rootFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
+                    rootFrame, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
               }
             }
           }
         }
       }
     }
   }
 }
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -510,17 +510,17 @@ class nsAsyncResize : public Runnable {
       : mozilla::Runnable("nsAsyncResize"), mFrame(aFrame) {}
   MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD Run() override {
     if (mFrame.IsAlive()) {
       nsComboboxControlFrame* combo =
           static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
       static_cast<nsListControlFrame*>(combo->mDropdownFrame)
           ->SetSuppressScrollbarUpdate(true);
       RefPtr<PresShell> presShell = mFrame->PresShell();
-      presShell->FrameNeedsReflow(combo->mDropdownFrame, nsIPresShell::eResize,
+      presShell->FrameNeedsReflow(combo->mDropdownFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
       presShell->FlushPendingNotifications(FlushType::Layout);
       if (mFrame.IsAlive()) {
         combo = static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
         static_cast<nsListControlFrame*>(combo->mDropdownFrame)
             ->SetSuppressScrollbarUpdate(false);
         if (combo->mDelayedShowDropDown) {
           combo->ShowDropDown(true);
@@ -966,17 +966,17 @@ void nsComboboxControlFrame::HandleRedis
   mRedisplayTextEvent.Forget();
 
   ActuallyDisplayText(true);
   if (!weakThis.IsAlive()) {
     return;
   }
 
   // XXXbz This should perhaps be eResize.  Check.
-  PresShell()->FrameNeedsReflow(mDisplayFrame, nsIPresShell::eStyleChange,
+  PresShell()->FrameNeedsReflow(mDisplayFrame, IntrinsicDirty::StyleChange,
                                 NS_FRAME_IS_DIRTY);
 
   mInRedisplayText = false;
 }
 
 void nsComboboxControlFrame::ActuallyDisplayText(bool aNotify) {
   RefPtr<nsTextNode> displayContent = mDisplayContent;
   if (mDisplayedOptionTextOrPreview.IsEmpty()) {
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1810,19 +1810,19 @@ void nsListControlFrame::ScrollToIndex(i
 
 void nsListControlFrame::ScrollToFrame(dom::HTMLOptionElement& aOptElement) {
   // otherwise we find the content's frame and scroll to it
   nsIFrame* childFrame = aOptElement.GetPrimaryFrame();
   if (childFrame) {
     PresShell()->ScrollFrameRectIntoView(
         childFrame, nsRect(nsPoint(0, 0), childFrame->GetSize()),
         nsIPresShell::ScrollAxis(), nsIPresShell::ScrollAxis(),
-        nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
-            nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
-            nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+        ScrollFlags::ScrollOverflowHidden |
+            ScrollFlags::ScrollFirstAncestorOnly |
+            ScrollFlags::IgnoreMarginAndPadding);
   }
 }
 
 //---------------------------------------------------------------------
 // Ok, the entire idea of this routine is to move to the next item that
 // is suppose to be selected. If the item is disabled then we search in
 // the same direction looking for the next item to select. If we run off
 // the end of the list then we start at the end of the list and search
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -170,17 +170,17 @@ nsresult nsMeterFrame::AttributeChanged(
                                         nsAtom* aAttribute, int32_t aModType) {
   NS_ASSERTION(mBarDiv, "Meter bar div must exist!");
 
   if (aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max ||
        aAttribute == nsGkAtoms::min)) {
     nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
     NS_ASSERTION(barFrame, "The meter frame should have a child with a frame!");
-    PresShell()->FrameNeedsReflow(barFrame, nsIPresShell::eResize,
+    PresShell()->FrameNeedsReflow(barFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
     InvalidateFrame();
   }
 
   return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
 
 LogicalSize nsMeterFrame::ComputeAutoSize(
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -187,17 +187,17 @@ nsresult nsProgressFrame::AttributeChang
                                            nsAtom* aAttribute,
                                            int32_t aModType) {
   NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
 
   if (aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max)) {
     auto presShell = PresShell();
     for (auto childFrame : PrincipalChildList()) {
-      presShell->FrameNeedsReflow(childFrame, nsIPresShell::eResize,
+      presShell->FrameNeedsReflow(childFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
     }
     InvalidateFrame();
   }
 
   return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
 
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -706,17 +706,17 @@ nsresult nsRangeFrame::AttributeChanged(
           static_cast<dom::HTMLInputElement*>(GetContent())->ControlType() ==
           NS_FORM_INPUT_RANGE;
       // If script changed the <input>'s type before setting these attributes
       // then we don't need to do anything since we are going to be reframed.
       if (typeIsRange) {
         UpdateForValueChange();
       }
     } else if (aAttribute == nsGkAtoms::orient) {
-      PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize,
+      PresShell()->FrameNeedsReflow(this, IntrinsicDirty::Resize,
                                     NS_FRAME_IS_DIRTY);
     }
   }
 
   return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
 
 nscoord nsRangeFrame::AutoCrossSize(nscoord aEm) {
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -65,17 +65,17 @@ void nsAbsoluteContainingBlock::AppendFr
 #ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.AppendFrames(nullptr, aFrameList);
 
   // no damage to intrinsic widths, since absolutely positioned frames can't
   // change them
   aDelegatingFrame->PresShell()->FrameNeedsReflow(
-      aDelegatingFrame, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN);
+      aDelegatingFrame, IntrinsicDirty::Resize, NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsAbsoluteContainingBlock::InsertFrames(nsIFrame* aDelegatingFrame,
                                              ChildListID aListID,
                                              nsIFrame* aPrevFrame,
                                              nsFrameList& aFrameList) {
   NS_ASSERTION(mChildListID == aListID, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == aDelegatingFrame,
@@ -84,17 +84,17 @@ void nsAbsoluteContainingBlock::InsertFr
 #ifdef DEBUG
   nsFrame::VerifyDirtyBitSet(aFrameList);
 #endif
   mAbsoluteFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
 
   // no damage to intrinsic widths, since absolutely positioned frames can't
   // change them
   aDelegatingFrame->PresShell()->FrameNeedsReflow(
-      aDelegatingFrame, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN);
+      aDelegatingFrame, IntrinsicDirty::Resize, NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsAbsoluteContainingBlock::RemoveFrame(nsIFrame* aDelegatingFrame,
                                             ChildListID aListID,
                                             nsIFrame* aOldFrame) {
   NS_ASSERTION(mChildListID == aListID, "unexpected child list");
   nsIFrame* nif = aOldFrame->GetNextInFlow();
   if (nif) {
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5114,17 +5114,17 @@ void nsBlockFrame::AppendFrames(ChildLis
     // Workaround for bug 1399425 in case this bit has been removed from the
     // SVGTextFrame just before the parser adds more descendant nodes.
     GetParent()->AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY);
   }
 
   AddFrames(aFrameList, lastKid);
   if (aListID != kNoReflowPrincipalList) {
     PresShell()->FrameNeedsReflow(
-        this, nsIPresShell::eTreeChange,
+        this, IntrinsicDirty::TreeChange,
         NS_FRAME_HAS_DIRTY_CHILDREN);  // XXX sufficient?
   }
 }
 
 void nsBlockFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
                                 nsFrameList& aFrameList) {
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
@@ -5149,17 +5149,17 @@ void nsBlockFrame::InsertFrames(ChildLis
     aPrevFrame->ListTag(stdout);
   }
   printf("\n");
 #endif
 
   AddFrames(aFrameList, aPrevFrame);
   if (aListID != kNoReflowPrincipalList) {
     PresShell()->FrameNeedsReflow(
-        this, nsIPresShell::eTreeChange,
+        this, IntrinsicDirty::TreeChange,
         NS_FRAME_HAS_DIRTY_CHILDREN);  // XXX sufficient?
   }
 }
 
 void nsBlockFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
 #ifdef NOISY_REFLOW_REASON
   ListTag(stdout);
   printf(": remove ");
@@ -5190,17 +5190,17 @@ void nsBlockFrame::RemoveFrame(ChildList
     // Skip the call to |FrameNeedsReflow| below by returning now.
     DoRemoveFrame(aOldFrame, REMOVE_FIXED_CONTINUATIONS);
     return;
   } else {
     MOZ_CRASH("unexpected child list");
   }
 
   PresShell()->FrameNeedsReflow(
-      this, nsIPresShell::eTreeChange,
+      this, IntrinsicDirty::TreeChange,
       NS_FRAME_HAS_DIRTY_CHILDREN);  // XXX sufficient?
 }
 
 static bool ShouldPutNextSiblingOnNewLine(nsIFrame* aLastFrame) {
   LayoutFrameType type = aLastFrame->Type();
   if (type == LayoutFrameType::Br) {
     return true;
   }
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -1152,17 +1152,17 @@ nsresult nsBulletFrame::OnSizeAvailable(
 
   if (mIntrinsicSize != newsize) {
     mIntrinsicSize = newsize;
 
     // Now that the size is available (or an error occurred), trigger
     // a reflow of the bullet frame.
     mozilla::PresShell* presShell = presContext->GetPresShell();
     if (presShell) {
-      presShell->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+      presShell->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
     }
   }
 
   // Handle animations
   aImage->SetAnimationMode(presContext->ImageAnimationMode());
   // Ensure the animation (if any) is started. Note: There is no
   // corresponding call to Decrement for this. This Increment will be
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -107,17 +107,17 @@ void nsContainerFrame::AppendFrames(Chil
   if (MOZ_UNLIKELY(aFrameList.IsEmpty())) {
     return;
   }
 
   DrainSelfOverflowList();  // ensure the last frame is in mFrames
   mFrames.AppendFrames(this, aFrameList);
 
   if (aListID != kNoReflowPrincipalList) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 }
 
 void nsContainerFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
                                     nsFrameList& aFrameList) {
   MOZ_ASSERT(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
              "unexpected child list");
@@ -127,17 +127,17 @@ void nsContainerFrame::InsertFrames(Chil
   if (MOZ_UNLIKELY(aFrameList.IsEmpty())) {
     return;
   }
 
   DrainSelfOverflowList();  // ensure aPrevFrame is in mFrames
   mFrames.InsertFrames(this, aPrevFrame, aFrameList);
 
   if (aListID != kNoReflowPrincipalList) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 }
 
 void nsContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
   MOZ_ASSERT(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
              "unexpected child list");
 
@@ -162,17 +162,17 @@ void nsContainerFrame::RemoveFrame(Child
     nsContainerFrame* parent = continuation->GetParent();
 
     // Please note that 'parent' may not actually be where 'continuation' lives.
     // We really MUST use StealFrame() and nothing else here.
     // @see nsInlineFrame::StealFrame for details.
     parent->StealFrame(continuation);
     continuation->Destroy();
     if (generateReflowCommand && parent != lastParent) {
-      presShell->FrameNeedsReflow(parent, nsIPresShell::eTreeChange,
+      presShell->FrameNeedsReflow(parent, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
       lastParent = parent;
     }
   }
 }
 
 void nsContainerFrame::DestroyAbsoluteFrames(
     nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) {
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -4418,17 +4418,17 @@ nsFlexContainerFrame* nsFlexContainerFra
 
     if (reflowNeeded) {
       // Trigger a reflow that generates additional flex property data.
       // Hold onto aFrame while we do this, in case reflow destroys it.
       AutoWeakFrame weakFrameRef(aFrame);
 
       RefPtr<mozilla::PresShell> presShell = flexFrame->PresShell();
       flexFrame->AddStateBits(NS_STATE_FLEX_GENERATE_COMPUTED_VALUES);
-      presShell->FrameNeedsReflow(flexFrame, nsIPresShell::eResize,
+      presShell->FrameNeedsReflow(flexFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
       presShell->FlushPendingNotifications(FlushType::Layout);
 
       // Since the reflow may have side effects, get the flex frame
       // again. But if the weakFrameRef is no longer valid, then we
       // must bail out.
       if (!weakFrameRef.IsAlive()) {
         return nullptr;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -591,17 +591,17 @@ static void MaybeScheduleReflowSVGNonDis
     return;
   }
 
   if (!svgTextFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) ||
       svgTextFrame->HasAnyStateBits(NS_STATE_SVG_TEXT_IN_REFLOW)) {
     return;
   }
 
-  svgTextFrame->ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
+  svgTextFrame->ScheduleReflowSVGNonDisplayText(IntrinsicDirty::StyleChange);
 }
 
 void nsFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                    nsIFrame* aPrevInFlow) {
   MOZ_ASSERT(nsQueryFrame::FrameIID(mClass) == GetFrameId());
   MOZ_ASSERT(!mContent, "Double-initing a frame?");
   NS_ASSERTION(IsFrameOfType(eDEBUGAllFrames) && !IsFrameOfType(eDEBUGNoFrames),
                "IsFrameOfType implementation that doesn't call base class");
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -1395,18 +1395,18 @@ nsresult nsFrameSelection::ScrollSelecti
     flags |= Selection::SCROLL_SYNCHRONOUS;
   } else if (aFlags & nsISelectionController::SCROLL_FIRST_ANCESTOR_ONLY) {
     flags |= Selection::SCROLL_FIRST_ANCESTOR_ONLY;
   }
   if (aFlags & nsISelectionController::SCROLL_OVERFLOW_HIDDEN) {
     flags |= Selection::SCROLL_OVERFLOW_HIDDEN;
   }
   if (aFlags & nsISelectionController::SCROLL_CENTER_VERTICALLY) {
-    verticalScroll = nsIPresShell::ScrollAxis(
-        nsIPresShell::SCROLL_CENTER, nsIPresShell::SCROLL_IF_NOT_FULLY_VISIBLE);
+    verticalScroll = nsIPresShell::ScrollAxis(kScrollToCenter,
+                                              WhenToScroll::IfNotFullyVisible);
   }
   if (aFlags & nsISelectionController::SCROLL_FOR_CARET_MOVE) {
     flags |= Selection::SCROLL_FOR_CARET_MOVE;
   }
 
   // After ScrollSelectionIntoView(), the pending notifications might be
   // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
   RefPtr<Selection> sel = mDomSelections[index];
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2360,21 +2360,21 @@ static void AdjustViews(nsIFrame* aFrame
       AdjustViews(childFrames.get());
     }
   }
 }
 
 void ScrollFrameHelper::MarkScrollbarsDirtyForReflow() const {
   PresShell* presShell = mOuter->PresShell();
   if (mVScrollbarBox) {
-    presShell->FrameNeedsReflow(mVScrollbarBox, nsIPresShell::eResize,
+    presShell->FrameNeedsReflow(mVScrollbarBox, IntrinsicDirty::Resize,
                                 NS_FRAME_IS_DIRTY);
   }
   if (mHScrollbarBox) {
-    presShell->FrameNeedsReflow(mHScrollbarBox, nsIPresShell::eResize,
+    presShell->FrameNeedsReflow(mHScrollbarBox, IntrinsicDirty::Resize,
                                 NS_FRAME_IS_DIRTY);
   }
 }
 
 bool ScrollFrameHelper::IsAlwaysActive() const {
   if (nsDisplayItem::ForceActiveLayers()) {
     return true;
   }
@@ -5796,17 +5796,17 @@ bool ScrollFrameHelper::ReflowFinished()
   // Update scrollbar attributes.
   if (mMayHaveDirtyFixedChildren) {
     mMayHaveDirtyFixedChildren = false;
     nsIFrame* parentFrame = mOuter->GetParent();
     for (nsIFrame* fixedChild =
              parentFrame->GetChildList(nsIFrame::kFixedList).FirstChild();
          fixedChild; fixedChild = fixedChild->GetNextSibling()) {
       // force a reflow of the fixed child
-      mOuter->PresShell()->FrameNeedsReflow(fixedChild, nsIPresShell::eResize,
+      mOuter->PresShell()->FrameNeedsReflow(fixedChild, IntrinsicDirty::Resize,
                                             NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
   nsRect scrolledContentRect = GetScrolledRect();
   nsSize scrollClampingScrollPort = GetVisualViewportSize();
   nscoord minX = scrolledContentRect.x;
   nscoord maxX = scrolledContentRect.XMost() - scrollClampingScrollPort.width;
@@ -5911,17 +5911,17 @@ bool ScrollFrameHelper::ComputeCustomOve
   }
 
   if (needReflow) {
     // If there are scrollbars, or we're not at the beginning of the pane,
     // the scroll position may change. In this case, mark the frame as
     // needing reflow. Don't use NS_FRAME_IS_DIRTY as dirty as that means
     // we have to reflow the frame and all its descendants, and we don't
     // have to do that here. Only this frame needs to be reflowed.
-    mOuter->PresShell()->FrameNeedsReflow(mOuter, nsIPresShell::eResize,
+    mOuter->PresShell()->FrameNeedsReflow(mOuter, IntrinsicDirty::Resize,
                                           NS_FRAME_HAS_DIRTY_CHILDREN);
     // Ensure that next time nsHTMLScrollFrame::Reflow runs, we don't skip
     // updating the scrollbars. (Because the overflow area of the scrolled
     // frame has probably just been updated, Reflow won't see it change.)
     mSkippedScrollbarLayout = true;
     return false;  // reflowing will update overflow
   }
   PostOverflowEvent();
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -6514,17 +6514,17 @@ void nsGridContainerFrame::NoteNewChildr
   MOZ_ASSERT(supportedLists.contains(aListID), "unexpected child list");
 #endif
 
   mozilla::PresShell* presShell = PresShell();
   for (auto pif = GetPrevInFlow(); pif; pif = pif->GetPrevInFlow()) {
     if (aListID == kPrincipalList) {
       pif->AddStateBits(NS_STATE_GRID_DID_PUSH_ITEMS);
     }
-    presShell->FrameNeedsReflow(pif, nsIPresShell::eTreeChange,
+    presShell->FrameNeedsReflow(pif, IntrinsicDirty::TreeChange,
                                 NS_FRAME_IS_DIRTY);
   }
 }
 
 void nsGridContainerFrame::MergeSortedOverflow(nsFrameList& aList) {
   if (aList.IsEmpty()) {
     return;
   }
@@ -6740,17 +6740,17 @@ nsGridContainerFrame* nsGridContainerFra
 
     if (reflowNeeded) {
       // Trigger a reflow that generates additional grid property data.
       // Hold onto aFrame while we do this, in case reflow destroys it.
       AutoWeakFrame weakFrameRef(aFrame);
 
       RefPtr<mozilla::PresShell> presShell = gridFrame->PresShell();
       gridFrame->AddStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
-      presShell->FrameNeedsReflow(gridFrame, nsIPresShell::eResize,
+      presShell->FrameNeedsReflow(gridFrame, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
       presShell->FlushPendingNotifications(FlushType::Layout);
 
       // Since the reflow may have side effects, get the grid frame
       // again. But if the weakFrameRef is no longer valid, then we
       // must bail out.
       if (!weakFrameRef.IsAlive()) {
         return nullptr;
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -706,17 +706,17 @@ nsresult nsImageFrame::OnSizeAvailable(i
   }
 
   MarkNeedsDisplayItemRebuild();
 
   if (intrinsicSizeChanged) {
     // Now we need to reflow if we have an unconstrained size and have
     // already gotten the initial reflow
     if (!(mState & IMAGE_SIZECONSTRAINED)) {
-      PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+      PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                     NS_FRAME_IS_DIRTY);
     } else {
       // We've already gotten the initial reflow, and our size hasn't changed,
       // so we're ready to request a decode.
       MaybeDecodeForPredictedSize();
     }
   }
 
@@ -787,17 +787,17 @@ void nsImageFrame::ResponsiveContentDens
   if (!mImage) {
     return;
   }
 
   if (!UpdateIntrinsicSize(mImage) && !UpdateIntrinsicRatio(mImage)) {
     return;
   }
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                 NS_FRAME_IS_DIRTY);
 }
 
 void nsImageFrame::NotifyNewCurrentRequest(imgIRequest* aRequest,
                                            nsresult aStatus) {
   nsCOMPtr<imgIContainer> image;
   aRequest->GetImage(getter_AddRefs(image));
   NS_ASSERTION(image || NS_FAILED(aStatus),
@@ -820,17 +820,17 @@ void nsImageFrame::NotifyNewCurrentReque
     mIntrinsicSize.width.SetCoordValue(0);
     mIntrinsicSize.height.SetCoordValue(0);
     mIntrinsicRatio.SizeTo(0, 0);
   }
 
   if (GotInitialReflow()) {
     if (intrinsicSizeChanged) {
       if (!(mState & IMAGE_SIZECONSTRAINED)) {
-        PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+        PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                       NS_FRAME_IS_DIRTY);
       } else {
         // We've already gotten the initial reflow, and our size hasn't changed,
         // so we're ready to request a decode.
         MaybeDecodeForPredictedSize();
       }
     }
     // Update border+content to account for image change
@@ -2341,17 +2341,17 @@ Maybe<nsIFrame::Cursor> nsImageFrame::Ge
 nsresult nsImageFrame::AttributeChanged(int32_t aNameSpaceID,
                                         nsAtom* aAttribute, int32_t aModType) {
   nsresult rv = nsAtomicContainerFrame::AttributeChanged(aNameSpaceID,
                                                          aAttribute, aModType);
   if (NS_FAILED(rv)) {
     return rv;
   }
   if (nsGkAtoms::alt == aAttribute) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   return NS_OK;
 }
 
 void nsImageFrame::OnVisibilityChange(
     Visibility aNewVisibility, const Maybe<OnNonvisible>& aNonvisibleAction) {
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -862,18 +862,18 @@ nsresult nsSubDocumentFrame::AttributeCh
         if (framesetFrame) {
           framesetFrame->RecalculateBorderResize();
         }
       }
     }
   } else if (aAttribute == nsGkAtoms::showresizer) {
     nsIFrame* rootFrame = GetSubdocumentRootFrame();
     if (rootFrame) {
-      rootFrame->PresShell()->FrameNeedsReflow(rootFrame, nsIPresShell::eResize,
-                                               NS_FRAME_IS_DIRTY);
+      rootFrame->PresShell()->FrameNeedsReflow(
+          rootFrame, IntrinsicDirty::Resize, NS_FRAME_IS_DIRTY);
     }
   } else if (aAttribute == nsGkAtoms::marginwidth ||
              aAttribute == nsGkAtoms::marginheight) {
     // Retrieve the attributes
     CSSIntSize margins = GetMarginAttributes();
 
     // Notify the frameloader
     RefPtr<nsFrameLoader> frameloader = FrameLoader();
@@ -1178,22 +1178,22 @@ void nsSubDocumentFrame::EndSwapDocShell
     ::EndSwapDocShellsForViews(other->mInnerView->GetFirstChild());
   }
 
   // Now make sure we reflow both frames, in case their contents
   // determine their size.
   // And repaint them, for good measure, in case there's nothing
   // interesting that happens during reflow.
   if (weakThis.IsAlive()) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_IS_DIRTY);
     InvalidateFrameSubtree();
   }
   if (weakOther.IsAlive()) {
-    other->PresShell()->FrameNeedsReflow(other, nsIPresShell::eTreeChange,
+    other->PresShell()->FrameNeedsReflow(other, IntrinsicDirty::TreeChange,
                                          NS_FRAME_IS_DIRTY);
     other->InvalidateFrameSubtree();
   }
 }
 
 void nsSubDocumentFrame::ClearDisplayItems() {
   DisplayItemArray* items = GetProperty(DisplayItems());
   if (!items) {
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -650,24 +650,24 @@ static void InvalidateFrameDueToGlyphsCh
     // If this is a non-display text frame within SVG <text>, we need
     // to reflow the SVGTextFrame. (This is similar to reflowing the
     // SVGTextFrame in response to style changes, in
     // SVGTextFrame::DidSetComputedStyle.)
     if (nsSVGUtils::IsInSVGTextSubtree(f) &&
         f->GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
       auto svgTextFrame = static_cast<SVGTextFrame*>(
           nsLayoutUtils::GetClosestFrameOfType(f, LayoutFrameType::SVGText));
-      svgTextFrame->ScheduleReflowSVGNonDisplayText(nsIPresShell::eResize);
+      svgTextFrame->ScheduleReflowSVGNonDisplayText(IntrinsicDirty::Resize);
     } else {
       // Theoretically we could just update overflow areas, perhaps using
       // OverflowChangedTracker, but that would do a bunch of work eagerly that
       // we should probably do lazily here since there could be a lot
       // of text frames affected and we'd like to coalesce the work. So that's
       // not easy to do well.
-      presShell->FrameNeedsReflow(f, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
+      presShell->FrameNeedsReflow(f, IntrinsicDirty::Resize, NS_FRAME_IS_DIRTY);
     }
   }
 }
 
 void GlyphObserver::NotifyGlyphsChanged() {
   if (mTextRun->GetFlags2() & nsTextFrameUtils::Flags::TEXT_IS_SIMPLE_FLOW) {
     InvalidateFrameDueToGlyphsChanged(GetFrameForSimpleFlow(mTextRun));
     return;
@@ -4789,17 +4789,17 @@ nsresult nsTextFrame::CharacterDataChang
                  "mReflowRequestedForCharDataChange should only be set "
                  "on dirty frames");
     } else {
       // Make sure textFrame is queued up for a reflow.  Also set a flag so we
       // don't waste time doing this again in repeated calls to this method.
       textFrame->mReflowRequestedForCharDataChange = true;
       if (!areAncestorsAwareOfReflowRequest) {
         // Ask the parent frame to reflow me.
-        presShell->FrameNeedsReflow(textFrame, nsIPresShell::eStyleChange,
+        presShell->FrameNeedsReflow(textFrame, IntrinsicDirty::StyleChange,
                                     NS_FRAME_IS_DIRTY);
       } else {
         // We already called FrameNeedsReflow on behalf of an earlier sibling,
         // so we can just mark this frame as dirty and don't need to bother
         // telling its ancestors.
         // Note: if the parent is a block, we're cheating here because we should
         // be marking our line dirty, but we're not. nsTextFrame::SetLength will
         // do that when it gets called during reflow.
@@ -7196,17 +7196,17 @@ void nsTextFrame::SetSelectedRange(uint3
     // the normal decoration line.
     if (ToSelectionTypeMask(aSelectionType) & kSelectionTypesWithDecorations) {
       bool didHaveOverflowingSelection =
           (f->GetStateBits() & TEXT_SELECTION_UNDERLINE_OVERFLOWED) != 0;
       nsRect r(nsPoint(0, 0), GetSize());
       if (didHaveOverflowingSelection ||
           (aSelected && f->CombineSelectionUnderlineRect(presContext, r))) {
         presContext->PresShell()->FrameNeedsReflow(
-            f, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
+            f, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
       }
     }
     // Selection might change anything. Invalidate the overflow area.
     f->InvalidateFrame();
 
     f = f->GetNextContinuation();
   }
 }
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -668,17 +668,17 @@ nsresult nsMathMLContainerFrame::ReLayou
   // re-sync the presentation data and embellishment data of our children
   RebuildAutomaticDataForChildren(frame);
 
   // Ask our parent frame to reflow us
   nsIFrame* parent = frame->GetParent();
   NS_ASSERTION(parent, "No parent to pass the reflow request up to");
   if (!parent) return NS_OK;
 
-  frame->PresShell()->FrameNeedsReflow(frame, nsIPresShell::eStyleChange,
+  frame->PresShell()->FrameNeedsReflow(frame, IntrinsicDirty::StyleChange,
                                        NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 // There are precise rules governing children of a MathML frame,
 // and properties such as the scriptlevel depends on those rules.
 // Hence for things to work, callers must use Append/Insert/etc wisely.
@@ -722,17 +722,17 @@ void nsMathMLContainerFrame::RemoveFrame
 }
 
 nsresult nsMathMLContainerFrame::AttributeChanged(int32_t aNameSpaceID,
                                                   nsAtom* aAttribute,
                                                   int32_t aModType) {
   // XXX Since they are numerous MathML attributes that affect layout, and
   // we can't check all of them here, play safe by requesting a reflow.
   // XXXldb This should only do work for attributes that cause changes!
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                 NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 void nsMathMLContainerFrame::GatherAndStoreOverflow(ReflowOutput* aMetrics) {
   mBlockStartAscent = aMetrics->BlockStartAscent();
 
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -207,17 +207,17 @@ nsresult nsMathMLmactionFrame::Attribute
     }
   } else {
     // let the base class handle other attribute changes
     return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                                     aModType);
   }
 
   if (needsReflow) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   return NS_OK;
 }
 
 // ################################################################
 // Event handlers
@@ -302,13 +302,13 @@ void nsMathMLmactionFrame::MouseClick() 
       int32_t selection = (mSelection == mChildCount) ? 1 : mSelection + 1;
       nsAutoString value;
       value.AppendInt(selection);
       bool notify = false;  // don't yet notify the document
       mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::selection_,
                                      value, notify);
 
       // Now trigger a content-changed reflow...
-      PresShell()->FrameNeedsReflow(mSelectedFrame, nsIPresShell::eTreeChange,
+      PresShell()->FrameNeedsReflow(mSelectedFrame, IntrinsicDirty::TreeChange,
                                     NS_FRAME_IS_DIRTY);
     }
   }
 }
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -685,29 +685,29 @@ nsresult nsMathMLmtableWrapperFrame::Att
   nsIFrame* tableFrame = mFrames.FirstChild();
   NS_ASSERTION(tableFrame && tableFrame->IsTableFrame(),
                "should always have an inner table frame");
   nsIFrame* rgFrame = tableFrame->PrincipalChildList().FirstChild();
   if (!rgFrame || !rgFrame->IsTableRowGroupFrame()) return NS_OK;
 
   // align - just need to issue a dirty (resize) reflow command
   if (aAttribute == nsGkAtoms::align) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
     return NS_OK;
   }
 
   // displaystyle - may seem innocuous, but it is actually very harsh --
   // like changing an unit. Blow away and recompute all our automatic
   // presentational data, and issue a style-changed reflow request
   if (aAttribute == nsGkAtoms::displaystyle_) {
     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(GetParent());
     // Need to reflow the parent, not us, because this can actually
     // affect siblings.
-    PresShell()->FrameNeedsReflow(GetParent(), nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(GetParent(), IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
     return NS_OK;
   }
 
   // ...and the other attributes affect rows or columns in one way or another
 
   nsPresContext* presContext = tableFrame->PresContext();
   if (aAttribute == nsGkAtoms::rowspacing_ ||
@@ -727,17 +727,17 @@ nsresult nsMathMLmtableWrapperFrame::Att
     // Reparse the new attribute on the table.
     ParseFrameAttribute(tableFrame, aAttribute, true);
   } else {
     // Ignore attributes that do not affect layout.
     return NS_OK;
   }
 
   // Explicitly request a reflow in our subtree to pick up any changes
-  presContext->PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+  presContext->PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                              NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 nsIFrame* nsMathMLmtableWrapperFrame::GetRowFrameAt(int32_t aRowIndex) {
   int32_t rowCount = GetRowCount();
 
@@ -1061,17 +1061,17 @@ nsresult nsMathMLmtrFrame::AttributeChan
   DeleteProperty(AttributeToProperty(aAttribute));
 
   bool allowMultiValues = (aAttribute == nsGkAtoms::columnalign_);
 
   // Reparse the new attribute.
   ParseFrameAttribute(this, aAttribute, allowMultiValues);
 
   // Explicitly request a reflow in our subtree to pick up any changes
-  presContext->PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+  presContext->PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                              NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 // --------
 // implementation of nsMathMLmtdFrame
 
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -604,17 +604,17 @@ void ImageLoader::RequestReflowIfNeeded(
 }
 
 void ImageLoader::RequestReflowOnFrame(FrameWithFlags* aFwf,
                                        imgIRequest* aRequest) {
   nsIFrame* frame = aFwf->mFrame;
 
   // Actually request the reflow.
   nsIFrame* parent = frame->GetInFlowParent();
-  parent->PresShell()->FrameNeedsReflow(parent, nsIPresShell::eStyleChange,
+  parent->PresShell()->FrameNeedsReflow(parent, IntrinsicDirty::StyleChange,
                                         NS_FRAME_IS_DIRTY);
 
   // We'll respond to the reflow events by unblocking onload, regardless
   // of whether the reflow was completed or cancelled. The callback will
   // also delete itself when it is called.
   ImageReflowCallback* unblocker =
       new ImageReflowCallback(this, frame, aRequest);
   parent->PresShell()->PostReflowCallback(unblocker);
--- a/layout/style/nsFontFaceUtils.cpp
+++ b/layout/style/nsFontFaceUtils.cpp
@@ -109,17 +109,17 @@ static void ScheduleReflow(PresShell* aP
           f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
         }
         f = f->GetParent();
       }
       MOZ_ASSERT(f, "should have found an ancestor frame to reflow");
     }
   }
 
-  aPresShell->FrameNeedsReflow(f, nsIPresShell::eStyleChange,
+  aPresShell->FrameNeedsReflow(f, IntrinsicDirty::StyleChange,
                                NS_FRAME_IS_DIRTY);
 }
 
 enum class ReflowAlreadyScheduled {
   No,
   Yes,
 };
 
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -2968,17 +2968,17 @@ void SVGTextFrame::DidSetComputedStyle(C
     // on the parent of the <defs>, then in
     // nsSVGDisplayContainerFrame::ReflowSVG, we would find the non-display
     // <defs> container and then call ReflowSVGNonDisplayText on it.  If we do
     // not actually reflow the parent of the <defs>, then without this
     // DidSetComputedStyle we would (a) not cause the <text>'s anonymous block
     // child to be reflowed when it is next painted, and (b) not cause the
     // <text> to be repainted anyway since the user of the <mask> would not
     // know it needs to be repainted.
-    ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
+    ScheduleReflowSVGNonDisplayText(IntrinsicDirty::StyleChange);
   }
 }
 
 void SVGTextFrame::ReflowSVGNonDisplayText() {
   MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
              "only call ReflowSVGNonDisplayText when an outer SVG frame is "
              "under ReflowSVG");
   MOZ_ASSERT(mState & NS_FRAME_IS_NONDISPLAY,
@@ -2997,18 +2997,17 @@ void SVGTextFrame::ReflowSVGNonDisplayTe
 
   // 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();
 }
 
-void SVGTextFrame::ScheduleReflowSVGNonDisplayText(
-    nsIPresShell::IntrinsicDirty aReason) {
+void SVGTextFrame::ScheduleReflowSVGNonDisplayText(IntrinsicDirty aReason) {
   MOZ_ASSERT(!nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
              "do not call ScheduleReflowSVGNonDisplayText when the outer SVG "
              "frame is under ReflowSVG");
   MOZ_ASSERT(!(mState & NS_STATE_SVG_TEXT_IN_REFLOW),
              "do not call ScheduleReflowSVGNonDisplayText while reflowing the "
              "anonymous block child");
 
   // We need to find an ancestor frame that we can call FrameNeedsReflow
@@ -4983,17 +4982,17 @@ bool SVGTextFrame::ShouldRenderAsPath(ns
     return true;
   }
 
   return false;
 }
 
 void SVGTextFrame::ScheduleReflowSVG() {
   if (mState & NS_FRAME_IS_NONDISPLAY) {
-    ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
+    ScheduleReflowSVGNonDisplayText(IntrinsicDirty::StyleChange);
   } else {
     nsSVGUtils::ScheduleReflowSVG(this);
   }
 }
 
 void SVGTextFrame::NotifyGlyphMetricsChange() {
   // TODO: perf - adding NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY is overly
   // aggressive here.  Ideally we would only set that bit when our descendant
--- a/layout/svg/SVGTextFrame.h
+++ b/layout/svg/SVGTextFrame.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_SVGTEXTFRAME_H
 #define MOZILLA_SVGTEXTFRAME_H
 
 #include "mozilla/Attributes.h"
+#include "mozilla/PresShellForwards.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/gfx/2D.h"
 #include "gfxMatrix.h"
 #include "gfxRect.h"
 #include "gfxTextRun.h"
 #include "nsAutoPtr.h"
 #include "nsIContent.h"  // for GetContent
 #include "nsStubMutationObserver.h"
@@ -22,17 +23,16 @@ class gfxContext;
 class nsDisplaySVGText;
 class SVGTextFrame;
 class nsTextFrame;
 
 namespace mozilla {
 
 class CharIterator;
 class nsISVGPoint;
-class PresShell;
 class TextFrameIterator;
 class TextNodeCorrespondenceRecorder;
 struct TextRenderedRun;
 class TextRenderedRunIterator;
 
 namespace dom {
 class SVGIRect;
 class SVGGeometryElement;
@@ -295,17 +295,17 @@ class SVGTextFrame final : public nsSVGD
    * it.
    *
    * We have to do this in two cases: in response to a style change on a
    * non-display <text>, where aReason will be eStyleChange (the common case),
    * and also in response to glyphs changes on non-display <text> (i.e.,
    * animated SVG-in-OpenType glyphs), in which case aReason will be eResize,
    * since layout doesn't need to be recomputed.
    */
-  void ScheduleReflowSVGNonDisplayText(nsIPresShell::IntrinsicDirty aReason);
+  void ScheduleReflowSVGNonDisplayText(mozilla::IntrinsicDirty aReason);
 
   /**
    * Updates the mFontSizeScaleFactor value by looking at the range of
    * font-sizes used within the <text>.
    *
    * @return Whether mFontSizeScaleFactor changed.
    */
   bool UpdateFontSizeScaleFactor();
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -82,17 +82,17 @@ nsresult nsSVGForeignObjectFrame::Attrib
                                                    int32_t aModType) {
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
       nsLayoutUtils::PostRestyleEvent(
           mContent->AsElement(), RestyleHint{0},
           nsChangeHint_InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
       // XXXjwatt: why mark intrinsic widths dirty? can't we just use eResize?
-      RequestReflow(nsIPresShell::eStyleChange);
+      RequestReflow(IntrinsicDirty::StyleChange);
     } else if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
       // make sure our cached transform matrix gets (lazily) updated
       mCanvasTM = nullptr;
       nsLayoutUtils::PostRestyleEvent(
           mContent->AsElement(), RestyleHint{0},
           nsChangeHint_InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
     } else if (aAttribute == nsGkAtoms::transform) {
@@ -422,17 +422,17 @@ void nsSVGForeignObjectFrame::NotifySVGC
   // If we're called while the PresShell is handling reflow events then we
   // must have been called as a result of the NotifyViewportChange() call in
   // our nsSVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
   // at this point (i.e. during reflow) because it could confuse the
   // PresShell and prevent it from reflowing us properly in future. Besides
   // that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
   // synchronously, so there's no need.
   if (needReflow && !PresShell()->IsReflowLocked()) {
-    RequestReflow(nsIPresShell::eResize);
+    RequestReflow(IntrinsicDirty::Resize);
   }
 
   if (needNewCanvasTM) {
     // Do this after calling InvalidateAndScheduleBoundsUpdate in case we
     // change the code and it needs to use it.
     mCanvasTM = nullptr;
   }
 }
@@ -471,18 +471,17 @@ gfxMatrix nsSVGForeignObjectFrame::GetCa
     mCanvasTM = new gfxMatrix(tm);
   }
   return *mCanvasTM;
 }
 
 //----------------------------------------------------------------------
 // Implementation helpers
 
-void nsSVGForeignObjectFrame::RequestReflow(
-    nsIPresShell::IntrinsicDirty aType) {
+void nsSVGForeignObjectFrame::RequestReflow(IntrinsicDirty aType) {
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW)
     // If we haven't had a ReflowSVG() yet, nothing to do.
     return;
 
   nsIFrame* kid = PrincipalChildList().FirstChild();
   if (!kid) {
     return;
   }
--- a/layout/svg/nsSVGForeignObjectFrame.h
+++ b/layout/svg/nsSVGForeignObjectFrame.h
@@ -3,29 +3,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSSVGFOREIGNOBJECTFRAME_H__
 #define NSSVGFOREIGNOBJECTFRAME_H__
 
 #include "mozilla/Attributes.h"
+#include "mozilla/PresShellForwards.h"
 #include "nsAutoPtr.h"
 #include "nsContainerFrame.h"
-#include "nsIPresShell.h"  // for nsIPresShell::IntrinsicDirty
 #include "nsSVGDisplayableFrame.h"
 #include "nsRegion.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 
-namespace mozilla {
-class PresShell;
-}  // namespace mozilla
-
 class nsSVGForeignObjectFrame final : public nsContainerFrame,
                                       public nsSVGDisplayableFrame {
   friend nsContainerFrame* NS_NewSVGForeignObjectFrame(
       mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGForeignObjectFrame(ComputedStyle* aStyle,
                                    nsPresContext* aPresContext);
@@ -87,17 +83,17 @@ class nsSVGForeignObjectFrame final : pu
   nsRect GetInvalidRegion();
 
   // Return our ::-moz-svg-foreign-content anonymous box.
   void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
 
  protected:
   // implementation helpers:
   void DoReflow();
-  void RequestReflow(nsIPresShell::IntrinsicDirty aType);
+  void RequestReflow(mozilla::IntrinsicDirty aType);
 
   // If width or height is less than or equal to zero we must disable rendering
   bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
 
   nsAutoPtr<gfxMatrix> mCanvasTM;
 
   bool mInReflow;
 };
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -123,17 +123,17 @@ void nsSVGOuterSVGFrame::Init(nsIContent
       if (IsRootOfReplacedElementSubDoc(&embeddingFrame) && embeddingFrame) {
         if (MOZ_UNLIKELY(!embeddingFrame->HasAllStateBits(NS_FRAME_IS_DIRTY)) &&
             DependsOnIntrinsicSize(embeddingFrame)) {
           // Looks like this document is loading after the embedding element
           // has had its first reflow, and that its size depends on our
           // intrinsic size.  We need it to resize itself to use our (now
           // available) intrinsic size:
           embeddingFrame->PresShell()->FrameNeedsReflow(
-              embeddingFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
+              embeddingFrame, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
         }
       }
     }
   }
 }
 
 //----------------------------------------------------------------------
 // nsQueryFrame methods
@@ -697,23 +697,23 @@ nsresult nsSVGOuterSVGFrame::AttributeCh
       // under Reflow if the width/height actually changed.
 
       nsIFrame* embeddingFrame;
       if (IsRootOfReplacedElementSubDoc(&embeddingFrame) && embeddingFrame) {
         if (DependsOnIntrinsicSize(embeddingFrame)) {
           // Tell embeddingFrame's presShell it needs to be reflowed (which
           // takes care of reflowing us too).
           embeddingFrame->PresShell()->FrameNeedsReflow(
-              embeddingFrame, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
+              embeddingFrame, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
         }
         // else our width and height is overridden - don't reflow anything
       } else {
         // We are not embedded by reference, so our 'width' and 'height'
         // attributes are not overridden - we need to reflow.
-        PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+        PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                       NS_FRAME_IS_DIRTY);
       }
     }
   }
 
   return NS_OK;
 }
 
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -217,17 +217,17 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFr
     // nsSVGOuterSVGFrame::DidReflow call pending.
     return;
   }
 
   nsFrameState dirtyBit =
       (outerSVGFrame == aFrame ? NS_FRAME_IS_DIRTY
                                : NS_FRAME_HAS_DIRTY_CHILDREN);
 
-  aFrame->PresShell()->FrameNeedsReflow(outerSVGFrame, nsIPresShell::eResize,
+  aFrame->PresShell()->FrameNeedsReflow(outerSVGFrame, IntrinsicDirty::Resize,
                                         dirtyBit);
 }
 
 bool nsSVGUtils::NeedsReflowSVG(nsIFrame* aFrame) {
   MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG),
              "SVG uses bits differently!");
 
   // The flags we test here may change, hence why we have this separate
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -194,17 +194,17 @@ bool nsTableCellFrame::NeedsToObserve(co
 
 nsresult nsTableCellFrame::AttributeChanged(int32_t aNameSpaceID,
                                             nsAtom* aAttribute,
                                             int32_t aModType) {
   // We need to recalculate in this case because of the nowrap quirk in
   // BasicTableLayoutStrategy
   if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::nowrap &&
       PresContext()->CompatibilityMode() == eCompatibility_NavQuirks) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   if (aAttribute == nsGkAtoms::rowspan || aAttribute == nsGkAtoms::colspan) {
     nsLayoutUtils::PostRestyleEvent(mContent->AsElement(), RestyleHint{0},
                                     nsChangeHint_UpdateTableCellSpans);
   }
   return NS_OK;
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -224,17 +224,17 @@ void nsTableColGroupFrame::InsertFrames(
                          : GetStartColumnIndex();
   InsertColsReflow(colIndex, newFrames);
 }
 
 void nsTableColGroupFrame::InsertColsReflow(int32_t aColIndex,
                                             const nsFrameList::Slice& aCols) {
   AddColsToTable(aColIndex, true, aCols);
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsTableColGroupFrame::RemoveChild(nsTableColFrame& aChild,
                                        bool aResetSubsequentColIndices) {
   int32_t colIndex = 0;
   nsIFrame* nextChild = nullptr;
   if (aResetSubsequentColIndices) {
@@ -248,17 +248,17 @@ void nsTableColGroupFrame::RemoveChild(n
       ResetColIndices(this, colIndex, nextChild);
     } else {
       nsIFrame* nextGroup = GetNextSibling();
       if (nextGroup)  // reset next and all following colgroups
         ResetColIndices(nextGroup, colIndex);
     }
   }
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsTableColGroupFrame::RemoveFrame(ChildListID aListID,
                                        nsIFrame* aOldFrame) {
   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   if (!aOldFrame) {
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -361,17 +361,17 @@ void nsTableFrame::RowOrColSpanChanged(n
       uint32_t colIndex = aCellFrame->ColIndex();
       RemoveCell(aCellFrame, rowIndex);
       AutoTArray<nsTableCellFrame*, 1> cells;
       cells.AppendElement(aCellFrame);
       InsertCells(cells, rowIndex, colIndex - 1);
 
       // XXX Should this use eStyleChange?  It currently doesn't need
       // to, but it might given more optimization.
-      PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+      PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                     NS_FRAME_IS_DIRTY);
     }
   }
 }
 
 /* ****** CellMap methods ******* */
 
 /* return the effective col count */
@@ -2438,17 +2438,17 @@ void nsTableFrame::AppendFrames(ChildLis
       mFrames.AppendFrame(nullptr, f);
     }
   }
 
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== TableFrame::AppendFrames\n");
   Dump(true, true, true);
 #endif
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   SetGeometryDirty();
 }
 
 // Needs to be at file scope or ArrayLength fails to compile.
 struct ChildListInsertions {
   nsIFrame::ChildListID mID;
   nsFrameList mList;
@@ -2607,17 +2607,17 @@ void nsTableFrame::HomogenousInsertFrame
   } else {
     NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
     MOZ_ASSERT_UNREACHABLE("How did we even get here?");
     // Just insert the frame and don't worry about reflowing it
     mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
     return;
   }
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   SetGeometryDirty();
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== TableFrame::InsertFrames\n");
   Dump(true, true, true);
 #endif
 }
 
@@ -2709,17 +2709,17 @@ void nsTableFrame::RemoveFrame(ChildList
     aOldFrame = oldFrameNextContinuation;
     if (parent != lastParent) {
       // for now, just bail and recalc all of the collapsing borders
       // as the cellmap changes we need to recalc
       if (parent->IsBorderCollapse()) {
         parent->SetFullBCDamageArea();
       }
       parent->SetGeometryDirty();
-      presShell->FrameNeedsReflow(parent, nsIPresShell::eTreeChange,
+      presShell->FrameNeedsReflow(parent, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
       lastParent = parent;
     }
   }
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== TableFrame::RemoveFrame\n");
   Dump(true, true, true);
 #endif
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -194,17 +194,17 @@ void nsTableRowFrame::AppendFrames(Child
   for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
     nsIFrame* childFrame = e.get();
     NS_ASSERTION(IsTableCell(childFrame->Type()),
                  "Not a table cell frame/pseudo frame construction failure");
     tableFrame->AppendCell(static_cast<nsTableCellFrame&>(*childFrame),
                            GetRowIndex());
   }
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   tableFrame->SetGeometryDirty();
 }
 
 void nsTableRowFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
                                    nsFrameList& aFrameList) {
   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
@@ -239,34 +239,34 @@ void nsTableRowFrame::InsertFrames(Child
   }
   // insert the cells into the cell map
   int32_t colIndex = -1;
   if (prevCellFrame) {
     colIndex = prevCellFrame->ColIndex();
   }
   tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex);
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   tableFrame->SetGeometryDirty();
 }
 
 void nsTableRowFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
 
   MOZ_ASSERT((nsTableCellFrame*)do_QueryFrame(aOldFrame));
   nsTableCellFrame* cellFrame = static_cast<nsTableCellFrame*>(aOldFrame);
   // remove the cell from the cell map
   nsTableFrame* tableFrame = GetTableFrame();
   tableFrame->RemoveCell(cellFrame, GetRowIndex());
 
   // Remove the frame and destroy it
   mFrames.DestroyFrame(aOldFrame);
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
 
   tableFrame->SetGeometryDirty();
 }
 
 /* virtual */
 nsMargin nsTableRowFrame::GetUsedMargin() const { return nsMargin(0, 0, 0, 0); }
 
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1479,17 +1479,17 @@ void nsTableRowGroupFrame::AppendFrames(
 
   int32_t rowIndex = GetRowCount();
   // Append the frames to the sibling chain
   mFrames.AppendFrames(nullptr, aFrameList);
 
   if (rows.Length() > 0) {
     nsTableFrame* tableFrame = GetTableFrame();
     tableFrame->AppendRows(this, rowIndex, rows);
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
     tableFrame->SetGeometryDirty();
   }
 }
 
 void nsTableRowGroupFrame::InsertFrames(ChildListID aListID,
                                         nsIFrame* aPrevFrame,
                                         nsFrameList& aFrameList) {
@@ -1528,17 +1528,17 @@ void nsTableRowGroupFrame::InsertFrames(
   int32_t numRows = rows.Length();
   if (numRows > 0) {
     nsTableRowFrame* prevRow =
         (nsTableRowFrame*)nsTableFrame::GetFrameAtOrBefore(
             this, aPrevFrame, LayoutFrameType::TableRow);
     int32_t rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : startRowIndex;
     tableFrame->InsertRows(this, rows, rowIndex, true);
 
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
     tableFrame->SetGeometryDirty();
   }
 }
 
 void nsTableRowGroupFrame::RemoveFrame(ChildListID aListID,
                                        nsIFrame* aOldFrame) {
   NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
@@ -1547,17 +1547,17 @@ void nsTableRowGroupFrame::RemoveFrame(C
 
   // XXX why are we doing the QI stuff?  There shouldn't be any non-rows here.
   nsTableRowFrame* rowFrame = do_QueryFrame(aOldFrame);
   if (rowFrame) {
     nsTableFrame* tableFrame = GetTableFrame();
     // remove the rows from the table (and flag a rebalance)
     tableFrame->RemoveRows(*rowFrame, 1, true);
 
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
     tableFrame->SetGeometryDirty();
   }
   mFrames.DestroyFrame(aOldFrame);
 }
 
 /* virtual */
 nsMargin nsTableRowGroupFrame::GetUsedMargin() const {
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -108,17 +108,17 @@ void nsTableWrapperFrame::AppendFrames(C
   // The inner frame is provided when we're initialized, and it cannot change
   MOZ_ASSERT(kCaptionList == aListID, "unexpected child list");
   MOZ_ASSERT(aFrameList.IsEmpty() || aFrameList.FirstChild()->IsTableCaption(),
              "appending non-caption frame to captionList");
   mCaptionFrames.AppendFrames(nullptr, aFrameList);
 
   // Reflow the new caption frame. It's already marked dirty, so
   // just tell the pres shell.
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   // The presence of caption frames makes us sort our display
   // list differently, so mark us as changed for the new
   // ordering.
   MarkNeedsDisplayItemRebuild();
 }
 
 void nsTableWrapperFrame::InsertFrames(ChildListID aListID,
@@ -128,17 +128,17 @@ void nsTableWrapperFrame::InsertFrames(C
   MOZ_ASSERT(aFrameList.IsEmpty() || aFrameList.FirstChild()->IsTableCaption(),
              "inserting non-caption frame into captionList");
   MOZ_ASSERT(!aPrevFrame || aPrevFrame->GetParent() == this,
              "inserting after sibling frame with different parent");
   mCaptionFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
 
   // Reflow the new caption frame. It's already marked dirty, so
   // just tell the pres shell.
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   MarkNeedsDisplayItemRebuild();
 }
 
 void nsTableWrapperFrame::RemoveFrame(ChildListID aListID,
                                       nsIFrame* aOldFrame) {
   // We only have two child frames: the inner table and one caption frame.
   // The inner frame can't be removed so this should be the caption
@@ -148,17 +148,17 @@ void nsTableWrapperFrame::RemoveFrame(Ch
     // The old caption isize had an effect on the inner table isize, so
     // we're going to need to reflow it. Mark it dirty
     InnerTableFrame()->AddStateBits(NS_FRAME_IS_DIRTY);
   }
 
   // Remove the frame and destroy it
   mCaptionFrames.DestroyFrame(aOldFrame);
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
   MarkNeedsDisplayItemRebuild();
 }
 
 void nsTableWrapperFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                            const nsDisplayListSet& aLists) {
   // No border, background or outline are painted because they all belong
   // to the inner table.
--- a/layout/xul/grid/nsGridRowGroupLayout.cpp
+++ b/layout/xul/grid/nsGridRowGroupLayout.cpp
@@ -135,17 +135,17 @@ nsSize nsGridRowGroupLayout::GetXULMinSi
 /*
  * Run down through our children dirtying them recursively.
  */
 void nsGridRowGroupLayout::DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) {
   if (aBox) {
     // mark us dirty
     // XXXldb We probably don't want to walk up the ancestor chain
     // calling MarkIntrinsicISizesDirty for every row group.
-    aState.PresShell()->FrameNeedsReflow(aBox, nsIPresShell::eTreeChange,
+    aState.PresShell()->FrameNeedsReflow(aBox, IntrinsicDirty::TreeChange,
                                          NS_FRAME_IS_DIRTY);
     nsIFrame* child = nsBox::GetChildXULBox(aBox);
 
     while (child) {
       // walk into scrollframes
       nsIFrame* deepChild = nsGrid::GetScrolledBox(child);
 
       // walk into other monuments
--- a/layout/xul/grid/nsGridRowLeafLayout.cpp
+++ b/layout/xul/grid/nsGridRowLeafLayout.cpp
@@ -266,17 +266,17 @@ nsGridRowLeafLayout::XULLayout(nsIFrame*
   return nsGridRowLayout::XULLayout(aBox, aBoxLayoutState);
 }
 
 void nsGridRowLeafLayout::DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) {
   if (aBox) {
     // mark us dirty
     // XXXldb We probably don't want to walk up the ancestor chain
     // calling MarkIntrinsicISizesDirty for every row.
-    aState.PresShell()->FrameNeedsReflow(aBox, nsIPresShell::eTreeChange,
+    aState.PresShell()->FrameNeedsReflow(aBox, IntrinsicDirty::TreeChange,
                                          NS_FRAME_IS_DIRTY);
   }
 }
 
 void nsGridRowLeafLayout::CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
                                            int32_t& aComputedColumnCount) {
   if (aBox) {
     nsIFrame* child = nsBox::GetChildXULBox(aBox);
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -872,17 +872,17 @@ void nsBoxFrame::RemoveFrame(ChildListID
 
   // notify the layout manager
   if (mLayoutManager) mLayoutManager->ChildrenRemoved(this, state, aOldFrame);
 
   // destroy the child frame
   aOldFrame->Destroy();
 
   // mark us dirty and generate a reflow command
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsBoxFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
                               nsFrameList& aFrameList) {
   NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
                "inserting after sibling frame with different parent");
   NS_ASSERTION(!aPrevFrame || mFrames.ContainsFrame(aPrevFrame),
@@ -900,17 +900,17 @@ void nsBoxFrame::InsertFrames(ChildListI
     mLayoutManager->ChildrenInserted(this, state, aPrevFrame, newFrames);
 
   // Make sure to check box order _after_ notifying the layout
   // manager; otherwise the slice we give the layout manager will
   // just be bogus.  If the layout manager cares about the order, we
   // just lose.
   CheckBoxOrder();
 
-  PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+  PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                 NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void nsBoxFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) {
   MOZ_ASSERT(aListID == kPrincipalList, "We don't support out-of-flow kids");
 
   nsBoxLayoutState state(PresContext());
 
@@ -923,17 +923,17 @@ void nsBoxFrame::AppendFrames(ChildListI
   // Make sure to check box order _after_ notifying the layout
   // manager; otherwise the slice we give the layout manager will
   // just be bogus.  If the layout manager cares about the order, we
   // just lose.
   CheckBoxOrder();
 
   // XXXbz why is this NS_FRAME_FIRST_REFLOW check here?
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 }
 
 /* virtual */
 nsContainerFrame* nsBoxFrame::GetContentInsertionFrame() {
   if (GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK)
     return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
@@ -1006,42 +1006,42 @@ nsresult nsBoxFrame::AttributeChanged(in
                aAttribute == nsGkAtoms::right ||
                aAttribute == nsGkAtoms::bottom ||
                aAttribute == nsGkAtoms::start || aAttribute == nsGkAtoms::end) {
       RemoveStateBits(NS_STATE_STACK_NOT_POSITIONED);
     } else if (aAttribute == nsGkAtoms::mousethrough) {
       UpdateMouseThrough();
     }
 
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   } else if (aAttribute == nsGkAtoms::ordinal) {
     nsIFrame* parent = GetParentXULBox(this);
     // If our parent is not a box, there's not much we can do... but in that
     // case our ordinal doesn't matter anyway, so that's ok.
     // Also don't bother with popup frames since they are kept on the
     // kPopupList and XULRelayoutChildAtOrdinal() only handles
     // principal children.
     if (parent && !(GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
         StyleDisplay()->mDisplay != mozilla::StyleDisplay::MozPopup) {
       parent->XULRelayoutChildAtOrdinal(this);
       // XXXldb Should this instead be a tree change on the child or parent?
-      PresShell()->FrameNeedsReflow(parent, nsIPresShell::eStyleChange,
+      PresShell()->FrameNeedsReflow(parent, IntrinsicDirty::StyleChange,
                                     NS_FRAME_IS_DIRTY);
     }
   }
   // If the accesskey changed, register for the new value
   // The old value has been unregistered in nsXULElement::SetAttr
   else if (aAttribute == nsGkAtoms::accesskey) {
     RegUnregAccessKey(true);
   } else if (aAttribute == nsGkAtoms::rows &&
              mContent->IsXULElement(nsGkAtoms::tree)) {
     // Reflow ourselves and all our children if "rows" changes, since
     // nsTreeBodyFrame's layout reads this from its parent (this frame).
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   return rv;
 }
 
 void nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                   const nsDisplayListSet& aLists) {
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -132,17 +132,17 @@ NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxF
 nsresult nsImageBoxFrame::AttributeChanged(int32_t aNameSpaceID,
                                            nsAtom* aAttribute,
                                            int32_t aModType) {
   nsresult rv =
       nsLeafBoxFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 
   if (aAttribute == nsGkAtoms::src) {
     UpdateImage();
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   } else if (aAttribute == nsGkAtoms::validate)
     UpdateLoadFlags();
 
   return rv;
 }
 
 nsImageBoxFrame::nsImageBoxFrame(ComputedStyle* aStyle,
@@ -789,17 +789,17 @@ nsresult nsImageBoxFrame::OnSizeAvailabl
   nscoord w, h;
   aImage->GetWidth(&w);
   aImage->GetHeight(&h);
 
   mIntrinsicSize.SizeTo(nsPresContext::CSSPixelsToAppUnits(w),
                         nsPresContext::CSSPixelsToAppUnits(h));
 
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   return NS_OK;
 }
 
 nsresult nsImageBoxFrame::OnDecodeComplete(imgIRequest* aRequest) {
   nsBoxLayoutState state(PresContext());
@@ -810,17 +810,17 @@ nsresult nsImageBoxFrame::OnDecodeComple
 nsresult nsImageBoxFrame::OnLoadComplete(imgIRequest* aRequest,
                                          nsresult aStatus) {
   if (NS_SUCCEEDED(aStatus)) {
     // Fire an onload DOM event.
     FireImageDOMEvent(mContent, eLoad);
   } else {
     // Fire an onerror DOM event.
     mIntrinsicSize.SizeTo(0, 0);
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
     FireImageDOMEvent(mContent, eLoadError);
   }
 
   return NS_OK;
 }
 
 nsresult nsImageBoxFrame::OnImageIsAnimated(imgIRequest* aRequest) {
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -1152,29 +1152,29 @@ void nsMenuFrame::PassMenuCommandEventTo
 }
 
 void nsMenuFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
   nsFrameList* popupList = GetPopupList();
   if (popupList && popupList->FirstChild() == aOldFrame) {
     popupList->RemoveFirstChild();
     aOldFrame->Destroy();
     DestroyPopupList();
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
     return;
   }
   nsBoxFrame::RemoveFrame(aListID, aOldFrame);
 }
 
 void nsMenuFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
                                nsFrameList& aFrameList) {
   if (!HasPopup() && (aListID == kPrincipalList || aListID == kPopupList)) {
     SetPopupFrame(aFrameList);
     if (HasPopup()) {
-      PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+      PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                     NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
   if (aFrameList.IsEmpty()) return;
 
   if (MOZ_UNLIKELY(aPrevFrame && aPrevFrame == GetPopup())) {
     aPrevFrame = nullptr;
@@ -1182,17 +1182,17 @@ void nsMenuFrame::InsertFrames(ChildList
 
   nsBoxFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
 }
 
 void nsMenuFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) {
   if (!HasPopup() && (aListID == kPrincipalList || aListID == kPopupList)) {
     SetPopupFrame(aFrameList);
     if (HasPopup()) {
-      PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+      PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                     NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
   if (aFrameList.IsEmpty()) return;
 
   nsBoxFrame::AppendFrames(aListID, aFrameList);
 }
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -863,17 +863,17 @@ void nsMenuPopupFrame::ShowPopup(bool aI
     if (menuFrame) {
       AutoWeakFrame weakFrame(this);
       menuFrame->PopupOpened();
       if (!weakFrame.IsAlive()) return;
     }
 
     // do we need an actual reflow here?
     // is SetPopupPosition all that is needed?
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::TreeChange,
                                   NS_FRAME_HAS_DIRTY_CHILDREN);
 
     if (mPopupType == ePopupTypeMenu) {
       nsCOMPtr<nsISound> sound(do_CreateInstance("@mozilla.org/sound;1"));
       if (sound) sound->PlayEventSound(nsISound::EVENT_MENU_POPUP);
     }
   }
 
@@ -1800,19 +1800,19 @@ nsIScrollableFrame* nsMenuPopupFrame::Ge
   return nullptr;
 }
 
 void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsMenuFrame* aMenuItem) {
   if (aMenuItem) {
     aMenuItem->PresShell()->ScrollFrameRectIntoView(
         aMenuItem, nsRect(nsPoint(0, 0), aMenuItem->GetRect().Size()),
         nsIPresShell::ScrollAxis(), nsIPresShell::ScrollAxis(),
-        nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
-            nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
-            nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+        ScrollFlags::ScrollOverflowHidden |
+            ScrollFlags::ScrollFirstAncestorOnly |
+            ScrollFlags::IgnoreMarginAndPadding);
   }
 }
 
 void nsMenuPopupFrame::ChangeByPage(bool aIsUp) {
   // Only scroll by page within menulists.
   if (!IsMenuList()) {
     return;
   }
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -212,17 +212,17 @@ nsresult nsSliderFrame::AttributeChanged
       nsContentUtils::AddScriptRunner(new nsSetAttrRunnable(
           scrollbar->AsElement(), nsGkAtoms::curpos, current));
     }
   }
 
   if (aAttribute == nsGkAtoms::minpos || aAttribute == nsGkAtoms::maxpos ||
       aAttribute == nsGkAtoms::pageincrement ||
       aAttribute == nsGkAtoms::increment) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   }
 
   return rv;
 }
 
 void nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                      const nsDisplayListSet& aLists) {
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -882,17 +882,17 @@ void nsSplitterFrameInner::SetPreferredS
   if (content->AsElement()->AttrValueIs(kNameSpaceID_None, attribute, prefValue,
                                         eCaseMatters)) {
     return;
   }
 
   AutoWeakFrame weakBox(aChildBox);
   content->AsElement()->SetAttr(kNameSpaceID_None, attribute, prefValue, true);
   NS_ENSURE_TRUE_VOID(weakBox.IsAlive());
-  aState.PresShell()->FrameNeedsReflow(aChildBox, nsIPresShell::eStyleChange,
+  aState.PresShell()->FrameNeedsReflow(aChildBox, IntrinsicDirty::StyleChange,
                                        NS_FRAME_IS_DIRTY);
 }
 
 void nsSplitterFrameInner::AddRemoveSpace(nscoord aDiff,
                                           nsSplitterInfo* aChildInfos,
                                           int32_t aCount, int32_t& aSpaceLeft) {
   aSpaceLeft = 0;
 
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -73,17 +73,17 @@ nsresult nsTextBoxFrame::AttributeChange
                                           nsAtom* aAttribute,
                                           int32_t aModType) {
   bool aResize;
   bool aRedraw;
 
   UpdateAttributes(aAttribute, aResize, aRedraw);
 
   if (aResize) {
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
   } else if (aRedraw) {
     nsBoxLayoutState state(PresContext());
     XULRedraw(state);
   }
 
   // If the accesskey changed, register for the new value
   // The old value has been unregistered in nsXULElement::SetAttr
@@ -172,17 +172,17 @@ bool nsTextBoxFrame::UpdateAccesskey(Wea
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
                                  accesskey);
 
   if (!accesskey.Equals(mAccessKey)) {
     // Need to get clean mTitle.
     RecomputeTitle();
     mAccessKey = accesskey;
     UpdateAccessTitle();
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::StyleChange,
                                   NS_FRAME_IS_DIRTY);
     return true;
   }
   return false;
 }
 
 void nsTextBoxFrame::UpdateAttributes(nsAtom* aAttribute, bool& aResize,
                                       bool& aRedraw) {
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -1288,17 +1288,17 @@ void nsXULPopupManager::FirePopupShowing
   popupFrame->GenerateFrames();
 
   // get the frame again
   popupFrame = do_QueryFrame(aPopup->GetPrimaryFrame());
   if (!popupFrame) return;
 
   nsPresContext* presContext = popupFrame->PresContext();
   RefPtr<PresShell> presShell = presContext->PresShell();
-  presShell->FrameNeedsReflow(popupFrame, nsIPresShell::eTreeChange,
+  presShell->FrameNeedsReflow(popupFrame, IntrinsicDirty::TreeChange,
                               NS_FRAME_HAS_DIRTY_CHILDREN);
 
   nsPopupType popupType = popupFrame->PopupType();
 
   // cache the popup so that document.popupNode can retrieve the trigger node
   // during the popupshowing event. It will be cleared below after the event
   // has fired.
   mOpeningPopup = aPopup;
@@ -1374,17 +1374,17 @@ void nsXULPopupManager::FirePopupShowing
     } else {
       // Now check if we need to fire the popuppositioned event. If not, call
       // ShowPopupCallback directly.
 
       // The popuppositioned event only fires on arrow panels for now.
       if (popup->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                           nsGkAtoms::arrow, eCaseMatters)) {
         popupFrame->ShowWithPositionedEvent();
-        presShell->FrameNeedsReflow(popupFrame, nsIPresShell::eTreeChange,
+        presShell->FrameNeedsReflow(popupFrame, IntrinsicDirty::TreeChange,
                                     NS_FRAME_HAS_DIRTY_CHILDREN);
       } else {
         ShowPopupCallback(popup, popupFrame, aIsContextMenu, aSelectFirstItem);
       }
     }
   }
 }
 
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2599,17 +2599,17 @@ ImgDrawResult nsTreeBodyFrame::PaintTree
   int32_t oldPageCount = mPageLength;
   if (!mHasFixedRowCount)
     mPageLength =
         (mRowHeight > 0) ? (mInnerBox.height / mRowHeight) : mRowCount;
 
   if (oldPageCount != mPageLength ||
       mHorzWidth != CalcHorzWidth(GetScrollParts())) {
     // Schedule a ResizeReflow that will update our info properly.
-    PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize,
+    PresShell()->FrameNeedsReflow(this, IntrinsicDirty::Resize,
                                   NS_FRAME_IS_DIRTY);
   }
 #ifdef DEBUG
   int32_t rowCount = mRowCount;
   mView->GetRowCount(&rowCount);
   NS_WARNING_ASSERTION(mRowCount == rowCount, "row count changed unexpectedly");
 #endif
 
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -383,22 +383,20 @@ nsFormFillController::SetPopupOpen(bool 
       nsCOMPtr<nsIContent> content = mFocusedInput;
       NS_ENSURE_STATE(content);
       nsCOMPtr<nsIDocShell> docShell = GetDocShellForInput(mFocusedInput);
       NS_ENSURE_STATE(docShell);
       RefPtr<PresShell> presShell = docShell->GetPresShell();
       NS_ENSURE_STATE(presShell);
       presShell->ScrollContentIntoView(
           content,
-          nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                   nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-          nsIPresShell::ScrollAxis(nsIPresShell::SCROLL_MINIMUM,
-                                   nsIPresShell::SCROLL_IF_NOT_VISIBLE),
-          nsIPresShell::SCROLL_OVERFLOW_HIDDEN |
-              nsIPresShell::SCROLL_IGNORE_SCROLL_MARGIN_AND_PADDING);
+          nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
+          nsIPresShell::ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
+          ScrollFlags::ScrollOverflowHidden |
+              ScrollFlags::IgnoreMarginAndPadding);
       // mFocusedPopup can be destroyed after ScrollContentIntoView, see bug
       // 420089
       if (mFocusedPopup) {
         mFocusedPopup->OpenAutocompletePopup(this, mFocusedInput);
       }
     } else {
       mFocusedPopup->ClosePopup();
       mPasswordPopupAutomaticallyOpened = false;