Bug 1513012 - Move overflow to use cbindgen. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 11 Dec 2018 01:50:32 +0100
changeset 449763 736e6ca6a7e18ad7f7fa4acbb59d2a5a197dd63d
parent 449762 5d24ac329431289a8966eabc3325228dfd7f2c4d
child 449764 142c190bb67a8e338a3ec39a3896984570ce7d45
child 449920 5f42df67d731ccf7d820a1e4f4abeaefd460c212
push id35184
push usernbeleuzu@mozilla.com
push dateTue, 11 Dec 2018 05:24:37 +0000
treeherdermozilla-central@736e6ca6a7e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1513012
milestone66.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 1513012 - Move overflow to use cbindgen. r=heycam It's one of the most annoying / hacky mako bits we have. Differential Revision: https://phabricator.services.mozilla.com/D14084
dom/animation/KeyframeEffect.cpp
dom/base/nsDocument.cpp
dom/events/EventStateManager.cpp
gfx/layers/apz/util/APZCCallbackHelper.cpp
layout/base/PresShell.cpp
layout/base/ScrollStyles.cpp
layout/base/ScrollStyles.h
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/ReflowInput.cpp
layout/generic/TextOverflow.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameSelection.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsIScrollableFrame.h
layout/style/ServoBindings.toml
layout/style/ServoCSSPropList.mako.py
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
layout/style/nsCSSProps.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/svg/nsSVGUtils.cpp
layout/xul/nsBox.cpp
servo/components/style/cbindgen.toml
servo/components/style/properties/data.py
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhands/box.mako.rs
servo/components/style/values/computed/box.rs
servo/components/style/values/computed/mod.rs
servo/components/style/values/specified/box.rs
servo/components/style/values/specified/mod.rs
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -1272,18 +1272,18 @@ bool KeyframeEffect::CanThrottleOverflow
   // we don't care about overflow.
   nsIScrollableFrame* scrollable =
       nsLayoutUtils::GetNearestScrollableFrame(&aFrame);
   if (!scrollable) {
     return true;
   }
 
   ScrollStyles ss = scrollable->GetScrollStyles();
-  if (ss.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
-      ss.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
+  if (ss.mVertical == StyleOverflow::Hidden &&
+      ss.mHorizontal == StyleOverflow::Hidden &&
       scrollable->GetLogicalScrollPosition() == nsPoint(0, 0)) {
     return true;
   }
 
   return false;
 }
 
 nsIFrame* KeyframeEffect::GetStyleFrame() const {
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -6990,17 +6990,17 @@ nsViewportInfo nsIDocument::GetViewportI
 }
 
 void nsIDocument::UpdateViewportOverflowType(nscoord aScrolledWidth,
                                              nscoord aScrollportWidth) {
 #ifdef DEBUG
   MOZ_ASSERT(mPresShell);
   nsPresContext* pc = GetPresContext();
   MOZ_ASSERT(pc->GetViewportScrollStylesOverride().mHorizontal ==
-                 NS_STYLE_OVERFLOW_HIDDEN,
+                 StyleOverflow::Hidden,
              "Should only be called when viewport has overflow-x: hidden");
   MOZ_ASSERT(aScrolledWidth > aScrollportWidth,
              "Should only be called when viewport is overflowed");
   MOZ_ASSERT(IsTopLevelContentDocument(),
              "Should only be called for top-level content document");
 #endif  // DEBUG
 
   if (!gfxPrefs::MetaViewportEnabled() ||
@@ -9312,25 +9312,25 @@ bool nsIDocument::IsPotentiallyScrollabl
     return false;
   }
 
   // The element is not the HTML body element, or it is and the root element's
   // used value of the overflow-x or overflow-y properties is not visible.
   MOZ_ASSERT(aBody->GetParent() == aBody->OwnerDoc()->GetRootElement());
   nsIFrame* parentFrame = aBody->GetParent()->GetPrimaryFrame();
   if (parentFrame &&
-      parentFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
-      parentFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
+      parentFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible &&
+      parentFrame->StyleDisplay()->mOverflowY == StyleOverflow::Visible) {
     return false;
   }
 
   // The element's used value of the overflow-x or overflow-y properties is not
   // visible.
-  if (bodyFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
-      bodyFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
+  if (bodyFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible &&
+      bodyFrame->StyleDisplay()->mOverflowY == StyleOverflow::Visible) {
     return false;
   }
 
   return true;
 }
 
 Element* nsIDocument::GetScrollingElement() {
   // Keep this in sync with IsScrollingElement.
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2471,18 +2471,18 @@ nsIFrame* EventStateManager::ComputeScro
           if (checkIfScrollableY) {
             continue;
           }
           break;
       }
     }
 
     ScrollStyles ss = scrollableFrame->GetScrollStyles();
-    bool hiddenForV = (NS_STYLE_OVERFLOW_HIDDEN == ss.mVertical);
-    bool hiddenForH = (NS_STYLE_OVERFLOW_HIDDEN == ss.mHorizontal);
+    bool hiddenForV = (StyleOverflow::Hidden == ss.mVertical);
+    bool hiddenForH = (StyleOverflow::Hidden == ss.mHorizontal);
     if ((hiddenForV && hiddenForH) ||
         (checkIfScrollableY && !checkIfScrollableX && hiddenForV) ||
         (checkIfScrollableX && !checkIfScrollableY && hiddenForH)) {
       continue;
     }
 
     // Computes whether the currently checked frame is scrollable by this wheel
     // event.
@@ -2580,20 +2580,20 @@ void EventStateManager::DoScrollText(nsI
       pc->AppUnitsToDevPixels(scrollAmount.width),
       pc->AppUnitsToDevPixels(scrollAmount.height));
   nsIntPoint actualDevPixelScrollAmount =
       DeltaAccumulator::GetInstance()->ComputeScrollAmountForDefaultAction(
           aEvent, scrollAmountInDevPixels);
 
   // Don't scroll around the axis whose overflow style is hidden.
   ScrollStyles overflowStyle = aScrollableFrame->GetScrollStyles();
-  if (overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
+  if (overflowStyle.mHorizontal == StyleOverflow::Hidden) {
     actualDevPixelScrollAmount.x = 0;
   }
-  if (overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
+  if (overflowStyle.mVertical == StyleOverflow::Hidden) {
     actualDevPixelScrollAmount.y = 0;
   }
 
   nsIScrollbarMediator::ScrollSnapMode snapMode =
       nsIScrollbarMediator::DISABLE_SNAP;
   nsAtom* origin = nullptr;
   switch (aEvent->mDeltaMode) {
     case WheelEvent_Binding::DOM_DELTA_LINE:
@@ -2683,25 +2683,23 @@ void EventStateManager::DoScrollText(nsI
 
   // If CSS overflow properties caused not to scroll, the overflowDelta* values
   // should be same as delta* values since they may be used as gesture event by
   // widget.  However, if there is another scrollable element in the ancestor
   // along the axis, probably users don't want the operation to cause
   // additional action such as moving history.  In such case, overflowDelta
   // values should stay zero.
   if (scrollFrameWeak.IsAlive()) {
-    if (aEvent->mDeltaX &&
-        overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
+    if (aEvent->mDeltaX && overflowStyle.mHorizontal == StyleOverflow::Hidden &&
         !ComputeScrollTargetAndMayAdjustWheelEvent(
             scrollFrame, aEvent,
             COMPUTE_SCROLLABLE_ANCESTOR_ALONG_X_AXIS_WITH_AUTO_DIR)) {
       aEvent->mOverflowDeltaX = aEvent->mDeltaX;
     }
-    if (aEvent->mDeltaY &&
-        overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
+    if (aEvent->mDeltaY && overflowStyle.mVertical == StyleOverflow::Hidden &&
         !ComputeScrollTargetAndMayAdjustWheelEvent(
             scrollFrame, aEvent,
             COMPUTE_SCROLLABLE_ANCESTOR_ALONG_Y_AXIS_WITH_AUTO_DIR)) {
       aEvent->mOverflowDeltaY = aEvent->mDeltaY;
     }
   }
 
   NS_ASSERTION(
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -116,25 +116,25 @@ static CSSPoint ScrollFrameTo(nsIScrolla
   // scroll event. The overflow property could have changed at some time
   // between the two events and so APZ may have computed a scrollable region
   // that is larger than what is actually allowed.
   //
   // Currently, we allow the scroll position to change even though the frame is
   // overflow:hidden (that is, we take |targetScrollPosition|). If this turns
   // out to be problematic, an alternative solution would be to ignore the
   // scroll position change (that is, use |geckoScrollPosition|).
-  if (aFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
+  if (aFrame->GetScrollStyles().mVertical == StyleOverflow::Hidden &&
       targetScrollPosition.y != geckoScrollPosition.y) {
     NS_WARNING(
         nsPrintfCString(
             "APZCCH: targetScrollPosition.y (%f) != geckoScrollPosition.y (%f)",
             targetScrollPosition.y, geckoScrollPosition.y)
             .get());
   }
-  if (aFrame->GetScrollStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
+  if (aFrame->GetScrollStyles().mHorizontal == StyleOverflow::Hidden &&
       targetScrollPosition.x != geckoScrollPosition.x) {
     NS_WARNING(
         nsPrintfCString(
             "APZCCH: targetScrollPosition.x (%f) != geckoScrollPosition.x (%f)",
             targetScrollPosition.x, geckoScrollPosition.x)
             .get());
   }
 
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -3259,33 +3259,33 @@ static void ScrollToShowRect(nsIScrollab
     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) ||
-       ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) &&
+       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) ||
-       ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) &&
+       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(
           aHorizontal.mWhereToScroll, scrollPt.x, aRect.x, aRect.XMost(),
--- a/layout/base/ScrollStyles.cpp
+++ b/layout/base/ScrollStyles.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ScrollStyles.h"
 #include "nsStyleStruct.h"  // for nsStyleDisplay and nsStyleBackground::Position
 
 namespace mozilla {
 
-ScrollStyles::ScrollStyles(uint8_t aH, uint8_t aV,
+ScrollStyles::ScrollStyles(StyleOverflow aH, StyleOverflow aV,
                            const nsStyleDisplay* aDisplay)
     : mHorizontal(aH),
       mVertical(aV),
       mScrollBehavior(aDisplay->mScrollBehavior),
       mOverscrollBehaviorX(aDisplay->mOverscrollBehaviorX),
       mOverscrollBehaviorY(aDisplay->mOverscrollBehaviorY),
       mScrollSnapTypeX(aDisplay->mScrollSnapTypeX),
       mScrollSnapTypeY(aDisplay->mScrollSnapTypeY),
--- a/layout/base/ScrollStyles.h
+++ b/layout/base/ScrollStyles.h
@@ -13,52 +13,51 @@
 #include "mozilla/dom/WindowBinding.h"
 
 // Forward declarations
 struct nsStyleDisplay;
 
 namespace mozilla {
 
 struct ScrollStyles {
-  // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
-  // or NS_STYLE_OVERFLOW_AUTO.
-  uint8_t mHorizontal;
-  uint8_t mVertical;
+  // Always one of Scroll, Hidden, or Auto
+  StyleOverflow mHorizontal;
+  StyleOverflow mVertical;
   // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
   // NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
   uint8_t mScrollBehavior;
-  mozilla::StyleOverscrollBehavior mOverscrollBehaviorX;
-  mozilla::StyleOverscrollBehavior mOverscrollBehaviorY;
-  mozilla::StyleScrollSnapType mScrollSnapTypeX;
-  mozilla::StyleScrollSnapType mScrollSnapTypeY;
+  StyleOverscrollBehavior mOverscrollBehaviorX;
+  StyleOverscrollBehavior mOverscrollBehaviorY;
+  StyleScrollSnapType mScrollSnapTypeX;
+  StyleScrollSnapType mScrollSnapTypeY;
   nsStyleCoord mScrollSnapPointsX;
   nsStyleCoord mScrollSnapPointsY;
   nsStyleCoord::CalcValue mScrollSnapDestinationX;
   nsStyleCoord::CalcValue mScrollSnapDestinationY;
 
-  ScrollStyles(uint8_t aH, uint8_t aV)
+  ScrollStyles(StyleOverflow aH, StyleOverflow aV)
       : mHorizontal(aH),
         mVertical(aV),
         mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
         mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
         mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
-        mScrollSnapTypeX(mozilla::StyleScrollSnapType::None),
-        mScrollSnapTypeY(mozilla::StyleScrollSnapType::None),
+        mScrollSnapTypeX(StyleScrollSnapType::None),
+        mScrollSnapTypeY(StyleScrollSnapType::None),
         mScrollSnapPointsX(nsStyleCoord(eStyleUnit_None)),
         mScrollSnapPointsY(nsStyleCoord(eStyleUnit_None)) {
     mScrollSnapDestinationX.mPercent = 0;
     mScrollSnapDestinationX.mLength = nscoord(0.0f);
     mScrollSnapDestinationX.mHasPercent = false;
     mScrollSnapDestinationY.mPercent = 0;
     mScrollSnapDestinationY.mLength = nscoord(0.0f);
     mScrollSnapDestinationY.mHasPercent = false;
   }
 
   explicit ScrollStyles(const nsStyleDisplay* aDisplay);
-  ScrollStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
+  ScrollStyles(StyleOverflow aH, StyleOverflow aV, const nsStyleDisplay*);
   bool operator==(const ScrollStyles& aStyles) const {
     return aStyles.mHorizontal == mHorizontal &&
            aStyles.mVertical == mVertical &&
            aStyles.mScrollBehavior == mScrollBehavior &&
            aStyles.mOverscrollBehaviorX == mOverscrollBehaviorX &&
            aStyles.mOverscrollBehaviorY == mOverscrollBehaviorY &&
            aStyles.mScrollSnapTypeX == mScrollSnapTypeX &&
            aStyles.mScrollSnapTypeY == mScrollSnapTypeY &&
@@ -66,18 +65,18 @@ struct ScrollStyles {
            aStyles.mScrollSnapPointsY == mScrollSnapPointsY &&
            aStyles.mScrollSnapDestinationX == mScrollSnapDestinationX &&
            aStyles.mScrollSnapDestinationY == mScrollSnapDestinationY;
   }
   bool operator!=(const ScrollStyles& aStyles) const {
     return !(*this == aStyles);
   }
   bool IsHiddenInBothDirections() const {
-    return mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
-           mVertical == NS_STYLE_OVERFLOW_HIDDEN;
+    return mHorizontal == StyleOverflow::Hidden &&
+           mVertical == StyleOverflow::Hidden;
   }
   bool IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
     return aBehavior == dom::ScrollBehavior::Smooth ||
            (aBehavior == dom::ScrollBehavior::Auto &&
             mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
   }
 };
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1822,19 +1822,19 @@ nsIScrollableFrame* nsLayoutUtils::GetNe
   NS_ASSERTION(
       aFrame, "GetNearestScrollableFrameForDirection expects a non-null frame");
   for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
     nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
     if (scrollableFrame) {
       ScrollStyles ss = scrollableFrame->GetScrollStyles();
       uint32_t directions = scrollableFrame->GetPerceivedScrollingDirections();
       if (aDirection == eVertical
-              ? (ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
+              ? (ss.mVertical != StyleOverflow::Hidden &&
                  (directions & nsIScrollableFrame::VERTICAL))
-              : (ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
+              : (ss.mHorizontal != StyleOverflow::Hidden &&
                  (directions & nsIScrollableFrame::HORIZONTAL)))
         return scrollableFrame;
     }
   }
   return nullptr;
 }
 
 // static
@@ -1849,18 +1849,18 @@ nsIScrollableFrame* nsLayoutUtils::GetNe
     if (scrollableFrame) {
       if (aFlags & SCROLLABLE_ONLY_ASYNC_SCROLLABLE) {
         if (scrollableFrame->WantAsyncScroll()) {
           return scrollableFrame;
         }
       } else {
         ScrollStyles ss = scrollableFrame->GetScrollStyles();
         if ((aFlags & SCROLLABLE_INCLUDE_HIDDEN) ||
-            ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN ||
-            ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
+            ss.mVertical != StyleOverflow::Hidden ||
+            ss.mHorizontal != StyleOverflow::Hidden) {
           return scrollableFrame;
         }
       }
       if (aFlags & SCROLLABLE_ALWAYS_MATCH_ROOT) {
         nsIPresShell* ps = f->PresShell();
         if (ps->GetRootScrollFrame() == f && ps->GetDocument() &&
             ps->GetDocument()->IsRootDisplayDocument()) {
           return scrollableFrame;
@@ -5381,17 +5381,17 @@ static void AddStateBitToAncestors(nsIFr
       maxSize.SetNoneValue();
     }
   }
 
   nscoord minSize;
   nscoord* fixedMinSize = nullptr;
   auto minSizeUnit = size.GetUnit();
   if (minSizeUnit == eStyleUnit_Auto) {
-    if (aFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
+    if (aFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible) {
       size = aAxis == eAxisHorizontal ? stylePos->mWidth : stylePos->mHeight;
       // This is same as above: keywords should behaves as property's initial
       // values in block axis.
       if (aAxis != ourInlineAxis && size.GetUnit() == eStyleUnit_Enumerated) {
         size.SetAutoValue();
       }
 
       if (GetAbsoluteCoord(size, minSize)) {
@@ -8334,22 +8334,22 @@ nsLayoutUtils::ScrollbarAreaToExcludeFro
 /* static */ nsRect nsLayoutUtils::CalculateScrollableRectForFrame(
     nsIScrollableFrame* aScrollableFrame, nsIFrame* aRootFrame) {
   nsRect contentBounds;
   if (aScrollableFrame) {
     contentBounds = aScrollableFrame->GetScrollRange();
 
     nsPoint scrollPosition = aScrollableFrame->GetScrollPosition();
     if (aScrollableFrame->GetScrollStyles().mVertical ==
-        NS_STYLE_OVERFLOW_HIDDEN) {
+        StyleOverflow::Hidden) {
       contentBounds.y = scrollPosition.y;
       contentBounds.height = 0;
     }
     if (aScrollableFrame->GetScrollStyles().mHorizontal ==
-        NS_STYLE_OVERFLOW_HIDDEN) {
+        StyleOverflow::Hidden) {
       contentBounds.x = scrollPosition.x;
       contentBounds.width = 0;
     }
 
     contentBounds.width += aScrollableFrame->GetScrollPortRect().width;
     contentBounds.height += aScrollableFrame->GetScrollPortRect().height;
   } else {
     contentBounds = aRootFrame->GetRect();
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -188,17 +188,17 @@ nsPresContext::nsPresContext(nsIDocument
       mBackgroundColor(NS_RGB(0xFF, 0xFF, 0xFF)),
       mLinkColor(NS_RGB(0x00, 0x00, 0xEE)),
       mActiveLinkColor(NS_RGB(0xEE, 0x00, 0x00)),
       mVisitedLinkColor(NS_RGB(0x55, 0x1A, 0x8B)),
       mFocusBackgroundColor(mBackgroundColor),
       mFocusTextColor(mDefaultColor),
       mBodyTextColor(mDefaultColor),
       mViewportScrollOverrideElement(nullptr),
-      mViewportScrollStyles(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
+      mViewportScrollStyles(StyleOverflow::Auto, StyleOverflow::Auto),
       mFocusRingWidth(1),
       mExistThrottledUpdates(false),
       // mImageAnimationMode is initialised below, in constructor body
       mImageAnimationModePref(imgIContainer::kNormalAnimMode),
       mFontGroupCacheDirty(true),
       mInterruptChecksToSkip(0),
       mElementsRestyled(0),
       mFramesConstructed(0),
@@ -1235,34 +1235,34 @@ gfxSize nsPresContext::ScreenSizeInchesF
     mLastFontInflationScreenSize = deviceSizeInches;
   }
 
   return deviceSizeInches;
 }
 
 static bool CheckOverflow(const nsStyleDisplay* aDisplay,
                           ScrollStyles* aStyles) {
-  if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
+  if (aDisplay->mOverflowX == StyleOverflow::Visible &&
       aDisplay->mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_AUTO &&
       aDisplay->mOverscrollBehaviorX == StyleOverscrollBehavior::Auto &&
       aDisplay->mOverscrollBehaviorY == StyleOverscrollBehavior::Auto &&
       aDisplay->mScrollSnapTypeX == StyleScrollSnapType::None &&
       aDisplay->mScrollSnapTypeY == StyleScrollSnapType::None &&
       aDisplay->mScrollSnapPointsX == nsStyleCoord(eStyleUnit_None) &&
       aDisplay->mScrollSnapPointsY == nsStyleCoord(eStyleUnit_None) &&
       !aDisplay->mScrollSnapDestination.mXPosition.mHasPercent &&
       !aDisplay->mScrollSnapDestination.mYPosition.mHasPercent &&
       aDisplay->mScrollSnapDestination.mXPosition.mLength == 0 &&
       aDisplay->mScrollSnapDestination.mYPosition.mLength == 0) {
     return false;
   }
 
-  if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
-    *aStyles = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN,
-                            aDisplay);
+  if (aDisplay->mOverflowX == StyleOverflow::MozHiddenUnscrollable) {
+    *aStyles =
+        ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden, aDisplay);
   } else {
     *aStyles = ScrollStyles(aDisplay);
   }
   return true;
 }
 
 static Element* GetPropagatedScrollStylesForViewport(
     nsPresContext* aPresContext, ScrollStyles* aStyles) {
@@ -1310,17 +1310,17 @@ static Element* GetPropagatedScrollStyle
   }
 
   return nullptr;
 }
 
 Element* nsPresContext::UpdateViewportScrollStylesOverride() {
   // Start off with our default styles, and then update them as needed.
   mViewportScrollStyles =
-      ScrollStyles(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
+      ScrollStyles(StyleOverflow::Auto, StyleOverflow::Auto);
   mViewportScrollOverrideElement = nullptr;
   // Don't propagate the scrollbar state in printing or print preview.
   if (!IsPaginated()) {
     mViewportScrollOverrideElement =
         GetPropagatedScrollStylesForViewport(this, &mViewportScrollStyles);
   }
 
   nsIDocument* document = Document();
@@ -1328,17 +1328,17 @@ Element* nsPresContext::UpdateViewportSc
     // If the document is in fullscreen, but the fullscreen element is
     // not the root element, we should explicitly suppress the scrollbar
     // here. Note that, we still need to return the original element
     // the styles are from, so that the state of those elements is not
     // affected across fullscreen change.
     if (fullscreenElement != document->GetRootElement() &&
         fullscreenElement != mViewportScrollOverrideElement) {
       mViewportScrollStyles =
-          ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN);
+          ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden);
     }
   }
   return mViewportScrollOverrideElement;
 }
 
 bool nsPresContext::ElementWouldPropagateScrollStyles(const Element& aElement) {
   MOZ_ASSERT(IsPaginated(), "Should only be called on paginated contexts");
   if (aElement.GetParent() && !aElement.IsHTMLElement(nsGkAtoms::body)) {
@@ -1346,17 +1346,17 @@ bool nsPresContext::ElementWouldPropagat
     return false;
   }
 
   // Go ahead and just call GetPropagatedScrollStylesForViewport, but update
   // a dummy ScrollStyles we don't care about.  It'll do a bit of extra work,
   // but saves us having to have more complicated code or more code duplication;
   // in practice we will make this call quite rarely, because we checked for all
   // the common cases above.
-  ScrollStyles dummy(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
+  ScrollStyles dummy(StyleOverflow::Auto, StyleOverflow::Auto);
   return GetPropagatedScrollStylesForViewport(this, &dummy) == &aElement;
 }
 
 void nsPresContext::SetContainer(nsIDocShell* aDocShell) {
   if (aDocShell) {
     NS_ASSERTION(!(mContainer && mNeedsPrefUpdate),
                  "Should only need pref update if mContainer is null.");
     mContainer = static_cast<nsDocShell*>(aDocShell);
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -67,17 +67,17 @@ nsresult nsHTMLButtonControlFrame::Handl
   }
 
   // mouse clicks are handled by content
   // we don't want our children to get any events. So just pass it to frame.
   return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 }
 
 bool nsHTMLButtonControlFrame::ShouldClipPaintingToBorderBox() {
-  return IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE;
+  return IsInput() || StyleDisplay()->mOverflowX != StyleOverflow::Visible;
 }
 
 void nsHTMLButtonControlFrame::BuildDisplayList(
     nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
   // Clip to our border area for event hit testing.
   Maybe<DisplayListClipState::AutoSaveRestore> eventClipState;
   const bool isForEventDelivery = aBuilder->IsForEventDelivery();
   if (isForEventDelivery) {
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -597,22 +597,21 @@ void nsListControlFrame::ReflowAsDropdow
 
   aStatus.Reset();
   nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
 }
 
 ScrollStyles nsListControlFrame::GetScrollStyles() const {
   // We can't express this in the style system yet; when we can, this can go
   // away and GetScrollStyles can be devirtualized
-  int32_t style =
-      IsInDropDownMode() ? NS_STYLE_OVERFLOW_AUTO : NS_STYLE_OVERFLOW_SCROLL;
+  auto style = IsInDropDownMode() ? StyleOverflow::Auto : StyleOverflow::Scroll;
   if (GetWritingMode().IsVertical()) {
-    return ScrollStyles(style, NS_STYLE_OVERFLOW_HIDDEN);
+    return ScrollStyles(style, StyleOverflow::Hidden);
   } else {
-    return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, style);
+    return ScrollStyles(StyleOverflow::Hidden, style);
   }
 }
 
 bool nsListControlFrame::ShouldPropagateComputedBSizeToScrolledContent() const {
   return !IsInDropDownMode();
 }
 
 //---------------------------------------------------------
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -438,21 +438,21 @@ nsresult nsTextControlFrame::CreateRootN
   // of a 'style' attribute so that the style comes from a user-agent style
   // sheet and is still applied even if author styles are disabled.
   nsAutoString classValue;
   classValue.AppendLiteral("anonymous-div");
 
   if (!IsSingleLineTextControl()) {
     // We can't just inherit the overflow because setting visible overflow will
     // crash when the number of lines exceeds the height of the textarea and
-    // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_CLIP)
-    // doesn't paint the caret for some reason.
+    // setting -moz-hidden-unscrollable overflow doesn't paint the caret for
+    // some reason.
     const nsStyleDisplay* disp = StyleDisplay();
-    if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
-        disp->mOverflowX != NS_STYLE_OVERFLOW_CLIP) {
+    if (disp->mOverflowX != StyleOverflow::Visible &&
+        disp->mOverflowX != StyleOverflow::MozHiddenUnscrollable) {
       classValue.AppendLiteral(" inherit-overflow");
     }
   }
   nsresult rv = mRootNode->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
                                    classValue, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -402,17 +402,17 @@ void ReflowInput::Init(nsPresContext* aP
 
   InitConstraints(aPresContext, cbSize, aBorder, aPadding, type);
 
   InitResizeFlags(aPresContext, type);
 
   nsIFrame* parent = mFrame->GetParent();
   if (parent && (parent->GetStateBits() & NS_FRAME_IN_CONSTRAINED_BSIZE) &&
       !(parent->IsScrollFrame() &&
-        parent->StyleDisplay()->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN)) {
+        parent->StyleDisplay()->mOverflowY != StyleOverflow::Hidden)) {
     mFrame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
   } else if (type == LayoutFrameType::SVGForeignObject) {
     // An SVG foreignObject frame is inherently constrained block-size.
     mFrame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
   } else {
     const nsStyleCoord& bSizeCoord = mStylePosition->BSize(mWritingMode);
     const nsStyleCoord& maxBSizeCoord = mStylePosition->MaxBSize(mWritingMode);
     if ((!bSizeCoord.IsAutoOrEnum() || !maxBSizeCoord.IsAutoOrEnum()) &&
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -97,17 +97,17 @@ static bool IsInlineAxisOverflowVisible(
     f = f->GetParent();
   }
   if (!f) {
     return true;
   }
   auto overflow = aFrame->GetWritingMode().IsVertical()
                       ? f->StyleDisplay()->mOverflowY
                       : f->StyleDisplay()->mOverflowX;
-  return overflow == NS_STYLE_OVERFLOW_VISIBLE;
+  return overflow == StyleOverflow::Visible;
 }
 
 static void ClipMarker(const nsRect& aContentArea, const nsRect& aMarkerRect,
                        DisplayListClipState::AutoSaveRestore& aClipState) {
   nscoord rightOverflow = aMarkerRect.XMost() - aContentArea.XMost();
   nsRect markerRect = aMarkerRect;
   if (rightOverflow > 0) {
     // Marker overflows on the right side (content width < marker width).
@@ -309,17 +309,17 @@ TextOverflow::TextOverflow(nsDisplayList
     }
   }
 #endif
   mCanHaveInlineAxisScrollbar = false;
   if (mScrollableFrame) {
     auto scrollbarStyle = mBlockWM.IsVertical()
                               ? mScrollableFrame->GetScrollStyles().mVertical
                               : mScrollableFrame->GetScrollStyles().mHorizontal;
-    mCanHaveInlineAxisScrollbar = scrollbarStyle != NS_STYLE_OVERFLOW_HIDDEN;
+    mCanHaveInlineAxisScrollbar = scrollbarStyle != StyleOverflow::Hidden;
     if (!mAdjustForPixelSnapping) {
       // Scrolling to the end position can leave some text still overflowing due
       // to pixel snapping behaviour in our scrolling code.
       mAdjustForPixelSnapping = mCanHaveInlineAxisScrollbar;
     }
     // Use a null containerSize to convert a vector from logical to physical.
     const nsSize nullContainerSize;
     mContentArea.MoveBy(
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -2031,17 +2031,17 @@ void FlexItem::CheckForMinSizeAuto(const
           : pos->MinBSize(aAxisTracker.GetWritingMode());
 
   // NOTE: Technically we should be checking the 'overflow' subproperty in the
   // main axis. But since we only care whether it's 'visible', we can check
   // either subproperty -- because they must be BOTH 'visible' or BOTH
   // non-'visible' due to the way the subproperties interact.
   mNeedsMinSizeAutoResolution =
       IsAutoOrEnumOnBSize(mainMinSize, IsInlineAxisMainAxis()) &&
-      disp->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE;
+      disp->mOverflowX == StyleOverflow::Visible;
 }
 
 nscoord FlexItem::GetBaselineOffsetFromOuterCrossEdge(
     AxisEdgeType aEdge, const FlexboxAxisTracker& aAxisTracker,
     bool aUseFirstLineBaseline) const {
   // NOTE:
   //  * We only use baselines for aligning in the flex container's cross axis.
   //  * Baselines are a measurement in the item's block axis.
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -8890,18 +8890,18 @@ bool nsIFrame::FinishAndStoreOverflow(ns
                      r->Contains(nsRect(nsPoint(0, 0), aNewSize)),
                  "Computed overflow area must contain frame bounds");
   }
 
   // If we clip our children, clear accumulated overflow area. The
   // children are actually clipped to the padding-box, but since the
   // overflow area should include the entire border-box, just set it to
   // the border-box here.
-  NS_ASSERTION((disp->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
-                   (disp->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
+  NS_ASSERTION((disp->mOverflowY == StyleOverflow::MozHiddenUnscrollable) ==
+                   (disp->mOverflowX == StyleOverflow::MozHiddenUnscrollable),
                "If one overflow is clip, the other should be too");
   if (applyOverflowClipping) {
     // The contents are actually clipped to the padding area
     aOverflowAreas.SetAllTo(bounds);
   }
 
   // Overflow area must always include the frame's top-left and bottom-right,
   // even if the frame rect is empty (so we can scroll to those positions).
@@ -8912,18 +8912,18 @@ bool nsIFrame::FinishAndStoreOverflow(ns
   if ((aNewSize.width != 0 || !IsInlineFrame()) &&
       !(GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
     NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
       nsRect& o = aOverflowAreas.Overflow(otype);
       o.UnionRectEdges(o, bounds);
     }
   }
 
-  // Note that NS_STYLE_OVERFLOW_CLIP doesn't clip the frame background,
-  // so we add theme background overflow here so it's not clipped.
+  // Note that StyleOverflow::MozHiddenUnscrollable doesn't clip the frame
+  // background, so we add theme background overflow here so it's not clipped.
   if (!::IsXULBoxWrapped(this) && IsThemed(disp)) {
     nsRect r(bounds);
     nsPresContext* presContext = PresContext();
     if (presContext->GetTheme()->GetWidgetOverflow(
             presContext->DeviceContext(), this, disp->mAppearance, &r)) {
       nsRect& vo = aOverflowAreas.VisualOverflow();
       vo.UnionRectEdges(vo, r);
     }
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -583,33 +583,34 @@ class nsFrame : public nsBox {
 
   /**
    * Returns true if aFrame should apply overflow clipping.
    */
   static bool ShouldApplyOverflowClipping(const nsIFrame* aFrame,
                                           const nsStyleDisplay* aDisp) {
     // clip overflow:-moz-hidden-unscrollable, except for nsListControlFrame,
     // which is an nsHTMLScrollFrame.
-    if (MOZ_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP &&
+    if (MOZ_UNLIKELY(aDisp->mOverflowX ==
+                         mozilla::StyleOverflow::MozHiddenUnscrollable &&
                      !aFrame->IsListControlFrame())) {
       return true;
     }
 
     // contain: paint, which we interpret as -moz-hidden-unscrollable
     // Exception: for scrollframes, we don't need contain:paint to add any
     // clipping, because the scrollable frame will already clip overflowing
     // content, and because contain:paint should prevent all means of escaping
     // that clipping (e.g. because it forms a fixed-pos containing block).
     if (aDisp->IsContainPaint() && !aFrame->IsScrollFrame()) {
       return true;
     }
 
     // and overflow:hidden that we should interpret as -moz-hidden-unscrollable
-    if (aDisp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
-        aDisp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
+    if (aDisp->mOverflowX == mozilla::StyleOverflow::Hidden &&
+        aDisp->mOverflowY == mozilla::StyleOverflow::Hidden) {
       // REVIEW: these are the frame types that set up clipping.
       mozilla::LayoutFrameType type = aFrame->Type();
       if (type == mozilla::LayoutFrameType::Table ||
           type == mozilla::LayoutFrameType::TableCell ||
           type == mozilla::LayoutFrameType::BCTableCell ||
           type == mozilla::LayoutFrameType::SVGOuterSVG ||
           type == mozilla::LayoutFrameType::SVGInnerSVG ||
           type == mozilla::LayoutFrameType::SVGSymbol ||
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -1608,17 +1608,17 @@ nsIFrame* nsFrameSelection::GetFrameToPa
     // parent under the root frame.
     for (nsIFrame* frame = contentToSelect->GetPrimaryFrame();
          frame && frame != rootFrameToSelect; frame = frame->GetParent()) {
       nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame);
       if (!scrollableFrame) {
         continue;
       }
       ScrollStyles scrollStyles = scrollableFrame->GetScrollStyles();
-      if (scrollStyles.mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
+      if (scrollStyles.mVertical == StyleOverflow::Hidden) {
         continue;
       }
       uint32_t directions = scrollableFrame->GetPerceivedScrollingDirections();
       if (directions & nsIScrollableFrame::VERTICAL) {
         // If there is sub scrollable frame, let's use its page size to select.
         return frame;
       }
     }
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -184,24 +184,24 @@ void nsHTMLScrollFrame::RemoveFrame(Chil
 namespace mozilla {
 
 enum class ShowScrollbar : uint8_t {
   Auto,
   Always,
   Never,
 };
 
-static ShowScrollbar ShouldShowScrollbar(uint8_t aOverflow) {
+static ShowScrollbar ShouldShowScrollbar(StyleOverflow aOverflow) {
   switch (aOverflow) {
-    case NS_STYLE_OVERFLOW_SCROLL:
+    case StyleOverflow::Scroll:
       return ShowScrollbar::Always;
-    case NS_STYLE_OVERFLOW_HIDDEN:
+    case StyleOverflow::Hidden:
       return ShowScrollbar::Never;
     default:
-    case NS_STYLE_OVERFLOW_AUTO:
+    case StyleOverflow::Auto:
       return ShowScrollbar::Auto;
   }
 }
 
 struct MOZ_STACK_CLASS ScrollReflowInput {
   const ReflowInput& mReflowInput;
   nsBoxLayoutState mBoxState;
   ShowScrollbar mHScrollbar;
@@ -427,17 +427,17 @@ bool nsHTMLScrollFrame::TryLayout(Scroll
     if (scrolledWidth <= scrollPortSize.width) {
       break;
     }
     // Viewport scrollbar style is used below instead of aState because
     // the latter can be affected by various factors, while we only
     // care about what the page itself specifies.
     nsPresContext* pc = PresContext();
     ScrollStyles styles = pc->GetViewportScrollStylesOverride();
-    if (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
+    if (styles.mHorizontal != StyleOverflow::Hidden) {
       break;
     }
     // Only top level content document is considered.
     nsIDocument* doc = pc->Document();
     if (!doc->IsTopLevelContentDocument()) {
       break;
     }
     doc->UpdateViewportOverflowType(scrolledWidth, scrollPortSize.width);
@@ -793,17 +793,17 @@ void nsHTMLScrollFrame::PlaceScrollArea(
   nsContainerFrame::SyncFrameViewAfterReflow(
       scrolledFrame->PresContext(), scrolledFrame, scrolledFrame->GetView(),
       scrolledArea, 0);
 }
 
 nscoord nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(
     gfxContext* aRenderingContext) {
   ScrollStyles ss = GetScrollStyles();
-  if (ss.mVertical != NS_STYLE_OVERFLOW_SCROLL || !mHelper.mVScrollbarBox)
+  if (ss.mVertical != StyleOverflow::Scroll || !mHelper.mVScrollbarBox)
     return 0;
 
   // Don't need to worry about reflow depth here since it's
   // just for scrollbars
   nsBoxLayoutState bls(PresContext(), aRenderingContext, 0);
   nsSize vScrollbarPrefSize(0, 0);
   GetScrollbarMetrics(bls, mHelper.mVScrollbarBox, nullptr, &vScrollbarPrefSize,
                       true);
@@ -1305,19 +1305,19 @@ bool ScrollFrameHelper::WantAsyncScroll(
   // the layout viewport size at the current zoom level, we need to be
   // able to scroll the visual viewport inside the layout viewport
   // even if the page is not zoomable.
   if (!GetScrollRangeForClamping().IsEqualInterior(scrollRange)) {
     return true;
   }
 
   bool isVScrollable = (scrollRange.height >= oneDevPixel) &&
-                       (styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
+                       (styles.mVertical != StyleOverflow::Hidden);
   bool isHScrollable = (scrollRange.width >= oneDevPixel) &&
-                       (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
+                       (styles.mHorizontal != StyleOverflow::Hidden);
 
 #if defined(MOZ_WIDGET_ANDROID)
   // Mobile platforms need focus to scroll text inputs.
   bool canScrollWithoutScrollbars =
       !IsForTextControlWithNoScrollbars() || IsFocused(mOuter->GetContent());
 #else
   bool canScrollWithoutScrollbars = true;
 #endif
@@ -1511,49 +1511,47 @@ nscoord nsXULScrollFrame::GetXULBoxAscen
 
 nsSize nsXULScrollFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
   nsSize pref = mHelper.mScrolledFrame->GetXULPrefSize(aState);
 
   ScrollStyles styles = GetScrollStyles();
 
   // scrolled frames don't have their own margins
 
-  if (mHelper.mVScrollbarBox && styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
+  if (mHelper.mVScrollbarBox && styles.mVertical == StyleOverflow::Scroll) {
     nsSize vSize = mHelper.mVScrollbarBox->GetXULPrefSize(aState);
     nsBox::AddMargin(mHelper.mVScrollbarBox, vSize);
     pref.width += vSize.width;
   }
 
-  if (mHelper.mHScrollbarBox &&
-      styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
+  if (mHelper.mHScrollbarBox && styles.mHorizontal == StyleOverflow::Scroll) {
     nsSize hSize = mHelper.mHScrollbarBox->GetXULPrefSize(aState);
     nsBox::AddMargin(mHelper.mHScrollbarBox, hSize);
     pref.height += hSize.height;
   }
 
   AddBorderAndPadding(pref);
   bool widthSet, heightSet;
   nsIFrame::AddXULPrefSize(this, pref, widthSet, heightSet);
   return pref;
 }
 
 nsSize nsXULScrollFrame::GetXULMinSize(nsBoxLayoutState& aState) {
   nsSize min = mHelper.mScrolledFrame->GetXULMinSizeForScrollArea(aState);
 
   ScrollStyles styles = GetScrollStyles();
 
-  if (mHelper.mVScrollbarBox && styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
+  if (mHelper.mVScrollbarBox && styles.mVertical == StyleOverflow::Scroll) {
     nsSize vSize = mHelper.mVScrollbarBox->GetXULMinSize(aState);
     AddMargin(mHelper.mVScrollbarBox, vSize);
     min.width += vSize.width;
     if (min.height < vSize.height) min.height = vSize.height;
   }
 
-  if (mHelper.mHScrollbarBox &&
-      styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
+  if (mHelper.mHScrollbarBox && styles.mHorizontal == StyleOverflow::Scroll) {
     nsSize hSize = mHelper.mHScrollbarBox->GetXULMinSize(aState);
     AddMargin(mHelper.mHScrollbarBox, hSize);
     min.height += hSize.height;
     if (min.width < hSize.width) min.width = hSize.width;
   }
 
   AddBorderAndPadding(min);
   bool widthSet, heightSet;
@@ -2387,18 +2385,18 @@ bool ScrollFrameHelper::IsAlwaysActive()
   // If we have scrolled before, then we should stay active.
   if (mHasBeenScrolled) {
     return true;
   }
 
   // If we're overflow:hidden, then start as inactive until
   // we get scrolled manually.
   ScrollStyles styles = GetScrollStylesFromFrame();
-  return (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
-          styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
+  return (styles.mHorizontal != StyleOverflow::Hidden &&
+          styles.mVertical != StyleOverflow::Hidden);
 }
 
 static void RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure) {
   ScrollFrameHelper* helper = static_cast<ScrollFrameHelper*>(aClosure);
 
   // This function only ever gets called from the expiry timer, so it must
   // be non-null here. Set it to null here so that we don't keep resetting
   // it unnecessarily in MarkRecentlyScrolled().
@@ -3871,37 +3869,37 @@ bool ScrollFrameHelper::IsRectNearlyVisi
   nsRect displayPort;
   bool usingDisplayport = nsLayoutUtils::GetDisplayPort(
       mOuter->GetContent(), &displayPort, RelativeTo::ScrollFrame);
   return aRect.Intersects(
       ExpandRectToNearlyVisible(usingDisplayport ? displayPort : mScrollPort));
 }
 
 static void HandleScrollPref(nsIScrollable* aScrollable, int32_t aOrientation,
-                             uint8_t& aValue) {
+                             StyleOverflow& aValue) {
   int32_t pref;
   aScrollable->GetDefaultScrollbarPreferences(aOrientation, &pref);
   switch (pref) {
     case nsIScrollable::Scrollbar_Auto:
       // leave |aValue| untouched
       break;
     case nsIScrollable::Scrollbar_Never:
-      aValue = NS_STYLE_OVERFLOW_HIDDEN;
+      aValue = StyleOverflow::Hidden;
       break;
     case nsIScrollable::Scrollbar_Always:
-      aValue = NS_STYLE_OVERFLOW_SCROLL;
+      aValue = StyleOverflow::Scroll;
       break;
   }
 }
 
 ScrollStyles ScrollFrameHelper::GetScrollStylesFromFrame() const {
   nsPresContext* presContext = mOuter->PresContext();
   if (!presContext->IsDynamic() &&
       !(mIsRoot && presContext->HasPaginatedScrolling())) {
-    return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN);
+    return ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden);
   }
 
   if (!mIsRoot) {
     const nsStyleDisplay* disp = mOuter->StyleDisplay();
     return ScrollStyles(disp);
   }
 
   ScrollStyles result = presContext->GetViewportScrollStylesOverride();
@@ -4532,18 +4530,18 @@ nsresult ScrollFrameHelper::CreateAnonym
   bool canHaveVertical;
   if (!mIsRoot) {
     if (mOuter->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) {
       // If scrollbar-width is none, don't generate scrollbars.
       canHaveHorizontal = false;
       canHaveVertical = false;
     } else {
       ScrollStyles styles = scrollable->GetScrollStyles();
-      canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
-      canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
+      canHaveHorizontal = styles.mHorizontal != StyleOverflow::Hidden;
+      canHaveVertical = styles.mVertical != StyleOverflow::Hidden;
     }
     if (!canHaveHorizontal && !canHaveVertical && !isResizable) {
       // Nothing to do.
       return NS_OK;
     }
   } else {
     canHaveHorizontal = true;
     canHaveVertical = true;
@@ -5217,41 +5215,41 @@ nsresult nsXULScrollFrame::XULLayout(nsB
    square that is needed in the corner of the window when two
    scrollbars are visible), and reflow any fixed position views
    (if we're the viewport and we added or removed a scrollbar).
    **************/
 
   ScrollStyles styles = GetScrollStyles();
 
   // Look at our style do we always have vertical or horizontal scrollbars?
-  if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL)
+  if (styles.mHorizontal == StyleOverflow::Scroll)
     mHelper.mHasHorizontalScrollbar = true;
-  if (styles.mVertical == NS_STYLE_OVERFLOW_SCROLL)
+  if (styles.mVertical == StyleOverflow::Scroll)
     mHelper.mHasVerticalScrollbar = true;
 
   if (mHelper.mHasHorizontalScrollbar)
     AddHorizontalScrollbar(aState, scrollbarBottom);
 
   if (mHelper.mHasVerticalScrollbar)
     AddVerticalScrollbar(aState, scrollbarRight);
 
   // layout our the scroll area
   LayoutScrollArea(aState, oldScrollPosition);
 
   // now look at the content area and see if we need scrollbars or not
   bool needsLayout = false;
 
   // if we have 'auto' scrollbars look at the vertical case
-  if (styles.mVertical != NS_STYLE_OVERFLOW_SCROLL) {
+  if (styles.mVertical != StyleOverflow::Scroll) {
     // These are only good until the call to LayoutScrollArea.
     nsRect scrolledRect = mHelper.GetScrolledRect();
 
     // There are two cases to consider
     if (scrolledRect.height <= mHelper.mScrollPort.height ||
-        styles.mVertical != NS_STYLE_OVERFLOW_AUTO) {
+        styles.mVertical != StyleOverflow::Auto) {
       if (mHelper.mHasVerticalScrollbar) {
         // We left room for the vertical scrollbar, but it's not needed;
         // remove it.
         RemoveVerticalScrollbar(aState, scrollbarRight);
         needsLayout = true;
       }
     } else {
       if (!mHelper.mHasVerticalScrollbar) {
@@ -5267,24 +5265,24 @@ nsresult nsXULScrollFrame::XULLayout(nsB
     if (needsLayout) {
       nsBoxLayoutState resizeState(aState);
       LayoutScrollArea(resizeState, oldScrollPosition);
       needsLayout = false;
     }
   }
 
   // if scrollbars are auto look at the horizontal case
-  if (styles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) {
+  if (styles.mHorizontal != StyleOverflow::Scroll) {
     // These are only good until the call to LayoutScrollArea.
     nsRect scrolledRect = mHelper.GetScrolledRect();
 
     // if the child is wider that the scroll area
     // and we don't have a scrollbar add one.
     if ((scrolledRect.width > mHelper.mScrollPort.width) &&
-        styles.mHorizontal == NS_STYLE_OVERFLOW_AUTO) {
+        styles.mHorizontal == StyleOverflow::Auto) {
       if (!mHelper.mHasHorizontalScrollbar) {
         // no scrollbar?
         if (AddHorizontalScrollbar(aState, scrollbarBottom)) {
           // if we added a horizontal scrollbar and we did not have a vertical
           // there is a chance that by adding the horizontal scrollbar we will
           // suddenly need a vertical scrollbar. Is a special case but it's
           // important.
           //
@@ -5300,17 +5298,17 @@ nsresult nsXULScrollFrame::XULLayout(nsB
             nsBoxLayoutState resizeState(aState);
             LayoutScrollArea(resizeState, oldScrollPosition);
             needsLayout = false;
           }
 
           // Refresh scrolledRect because we called LayoutScrollArea.
           scrolledRect = mHelper.GetScrolledRect();
 
-          if (styles.mVertical == NS_STYLE_OVERFLOW_AUTO &&
+          if (styles.mVertical == StyleOverflow::Auto &&
               !mHelper.mHasVerticalScrollbar &&
               scrolledRect.height > mHelper.mScrollPort.height) {
             if (AddVerticalScrollbar(aState, scrollbarRight)) {
               needsLayout = true;
             }
           }
         }
       }
@@ -5553,22 +5551,22 @@ bool ScrollFrameHelper::ComputeCustomOve
   // reduced extents.
   nsRect scrolledRect = GetScrolledRect();
   uint32_t overflowChange = GetOverflowChange(scrolledRect, mPrevScrolledRect);
   mPrevScrolledRect = scrolledRect;
 
   bool needReflow = false;
   nsPoint scrollPosition = GetScrollPosition();
   if (overflowChange & nsIScrollableFrame::HORIZONTAL) {
-    if (ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN || scrollPosition.x) {
+    if (ss.mHorizontal != StyleOverflow::Hidden || scrollPosition.x) {
       needReflow = true;
     }
   }
   if (overflowChange & nsIScrollableFrame::VERTICAL) {
-    if (ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN || scrollPosition.y) {
+    if (ss.mVertical != StyleOverflow::Hidden || scrollPosition.y) {
       needReflow = true;
     }
   }
 
   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
@@ -6133,17 +6131,17 @@ void ScrollFrameHelper::RestoreState(Pre
   mDidHistoryRestore = true;
   mLastPos = mScrolledFrame ? GetLogicalScrollPosition() : nsPoint(0, 0);
 
   // Resolution properties should only exist on root scroll frames.
   MOZ_ASSERT(mIsRoot || aState->resolution() == 1.0);
 
   if (mIsRoot) {
     nsIPresShell* presShell = mOuter->PresShell();
-    presShell->SetResolutionAndScaleTo(aState->resolution(), 
+    presShell->SetResolutionAndScaleTo(aState->resolution(),
                                        nsGkAtoms::restore);
   }
 }
 
 void ScrollFrameHelper::PostScrolledAreaEvent() {
   if (mScrolledAreaEvent.IsPending()) {
     return;
   }
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -608,17 +608,17 @@ struct nsGridContainerFrame::GridItemInf
     // FIXME: Bug 567039: moz-fit-content and -moz-available are not supported
     // for block size dimension on sizing properties (e.g. height), so we
     // treat it as `auto`.
     isAuto = minSize.GetUnit() == eStyleUnit_Auto ||
              (isInlineAxis ==
                   aContainerWM.IsOrthogonalTo(mFrame->GetWritingMode()) &&
               minSize.GetUnit() == eStyleUnit_Enumerated);
     return isAuto &&
-           mFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE;
+           mFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible;
   }
 
 #ifdef DEBUG
   void Dump() const;
 #endif
 
   static bool IsStartRowLessThan(const GridItemInfo* a, const GridItemInfo* b) {
     return a->mArea.mRows.mStart < b->mArea.mRows.mStart;
@@ -3592,17 +3592,17 @@ static nscoord MinSize(const GridItemInf
   // FIXME: Bug 567039: moz-fit-content and -moz-available are not supported
   // for block size dimension on sizing properties (e.g. height), so we
   // treat it as `auto`.
   auto unit = axis != ourInlineAxis && style.GetUnit() == eStyleUnit_Enumerated
                   ? eStyleUnit_Auto
                   : style.GetUnit();
   if (unit == eStyleUnit_Enumerated ||
       (unit == eStyleUnit_Auto &&
-       child->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)) {
+       child->StyleDisplay()->mOverflowX == StyleOverflow::Visible)) {
     // Now calculate the "content size" part and return whichever is smaller.
     MOZ_ASSERT(unit != eStyleUnit_Enumerated || sz == NS_UNCONSTRAINEDSIZE);
     sz = std::min(
         sz, ContentContribution(aGridItem, aState, aRC, aCBWM, aAxis,
                                 aCache->mPercentageBasis,
                                 nsLayoutUtils::MIN_ISIZE, aCache->mMinSizeClamp,
                                 nsLayoutUtils::MIN_INTRINSIC_ISIZE));
   }
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -56,18 +56,18 @@ class nsIScrollableFrame : public nsIScr
 
   /**
    * Get the frame for the content that we are scrolling within
    * this scrollable frame.
    */
   virtual nsIFrame* GetScrolledFrame() const = 0;
 
   /**
-   * Get the styles (NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
-   * or NS_STYLE_OVERFLOW_AUTO) governing the horizontal and vertical
+   * Get the styles (StyleOverflow::Scroll, StyleOverflow::Hidden,
+   * or StyleOverflow::Auto) governing the horizontal and vertical
    * scrollbars for this frame.
    */
   virtual mozilla::ScrollStyles GetScrollStyles() const = 0;
 
   enum { HORIZONTAL = 0x01, VERTICAL = 0x02 };
   /**
    * Return the scrollbars which are visible. It's OK to call this during reflow
    * of the scrolled contents, in which case it will reflect the current
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -404,16 +404,17 @@ cbindgen-types = [
     { gecko = "StyleBorderStyle", servo = "values::computed::BorderStyle" },
     { gecko = "StyleOutlineStyle", servo = "values::computed::OutlineStyle" },
     { gecko = "StyleScrollSnapType", servo = "values::computed::ScrollSnapType" },
     { gecko = "StyleResize", servo = "values::computed::Resize" },
     { gecko = "StyleOverflowClipBox", servo = "values::computed::OverflowClipBox" },
     { gecko = "StyleFloat", servo = "values::computed::Float" },
     { gecko = "StyleOverscrollBehavior", servo = "values::computed::OverscrollBehavior" },
     { gecko = "StyleTextAlign", servo = "values::computed::TextAlign" },
+    { gecko = "StyleOverflow", servo = "values::computed::Overflow" },
 ]
 
 mapped-generic-types = [
     { generic = true, gecko = "mozilla::RustCell", servo = "::std::cell::Cell" },
     { generic = false, gecko = "ServoNodeData", servo = "AtomicRefCell<ElementData>" },
     { generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>" },
     { generic = false, gecko = "mozilla::ServoRuleNode", servo = "Option<::rule_tree::StrongRuleNode>" },
--- a/layout/style/ServoCSSPropList.mako.py
+++ b/layout/style/ServoCSSPropList.mako.py
@@ -123,16 +123,17 @@ SERIALIZED_PREDEFINED_TYPES = [
     "position::HorizontalPosition",
     "position::VerticalPosition",
     "url::ImageUrlOrNone",
     "Appearance",
     "OverscrollBehavior",
     "OverflowClipBox",
     "ScrollSnapType",
     "Float",
+    "Overflow",
 ]
 
 def serialized_by_servo(prop):
     # If the property requires layout information, no such luck.
     if "GETCS_NEEDS_LAYOUT_FLUSH" in prop.flags:
         return False
     if prop.type() == "shorthand":
         # FIXME: Need to serialize a value interpolated with currentcolor
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -43,17 +43,16 @@ CSS_KEY(-moz-block-height, _moz_block_he
 CSS_KEY(-moz-deck, _moz_deck)
 CSS_KEY(-moz-fit-content, _moz_fit_content)
 CSS_KEY(-moz-grabbing, _moz_grabbing)
 CSS_KEY(-moz-grab, _moz_grab)
 CSS_KEY(-moz-grid-group, _moz_grid_group)
 CSS_KEY(-moz-grid-line, _moz_grid_line)
 CSS_KEY(-moz-grid, _moz_grid)
 CSS_KEY(-moz-groupbox, _moz_groupbox)
-CSS_KEY(-moz-hidden-unscrollable, _moz_hidden_unscrollable)
 CSS_KEY(-moz-inline-box, _moz_inline_box)
 CSS_KEY(-moz-inline-grid, _moz_inline_grid)
 CSS_KEY(-moz-inline-stack, _moz_inline_stack)
 CSS_KEY(-moz-left, _moz_left)
 CSS_KEY(-moz-max-content, _moz_max_content)
 CSS_KEY(-moz-middle-with-baseline, _moz_middle_with_baseline)
 CSS_KEY(-moz-min-content, _moz_min_content)
 CSS_KEY(-moz-none, _moz_none)
@@ -111,17 +110,16 @@ CSS_KEY(flex, flex)
 CSS_KEY(flex-end, flex_end)
 CSS_KEY(flex-start, flex_start)
 CSS_KEY(flow-root, flow_root)
 CSS_KEY(grab, grab)
 CSS_KEY(grabbing, grabbing)
 CSS_KEY(grayscale, grayscale)
 CSS_KEY(grid, grid)
 CSS_KEY(help, help)
-CSS_KEY(hidden, hidden)
 CSS_KEY(hue-rotate, hue_rotate)
 CSS_KEY(infinite, infinite)
 CSS_KEY(inline, inline)
 CSS_KEY(inline-block, inline_block)
 CSS_KEY(inline-flex, inline_flex)
 CSS_KEY(inline-grid, inline_grid)
 CSS_KEY(inline-table, inline_table)
 CSS_KEY(inset, inset)
@@ -179,17 +177,16 @@ CSS_KEY(ruby-text-container, ruby_text_c
 CSS_KEY(s-resize, s_resize)
 CSS_KEY(safe, safe)
 CSS_KEY(saturate, saturate)
 CSS_KEY(scale, scale)
 CSS_KEY(scale3d, scale3d)
 CSS_KEY(scalex, scalex)
 CSS_KEY(scaley, scaley)
 CSS_KEY(scalez, scalez)
-CSS_KEY(scroll, scroll)
 CSS_KEY(se-resize, se_resize)
 CSS_KEY(self-end, self_end)
 CSS_KEY(self-start, self_start)
 CSS_KEY(sepia, sepia)
 CSS_KEY(sesame, sesame)
 CSS_KEY(size, size)
 CSS_KEY(skew, skew)
 CSS_KEY(skewx, skewx)
@@ -225,17 +222,16 @@ CSS_KEY(translate3d, translate3d)
 CSS_KEY(translatex, translatex)
 CSS_KEY(translatey, translatey)
 CSS_KEY(translatez, translatez)
 CSS_KEY(triangle, triangle)
 CSS_KEY(under, under)
 CSS_KEY(underline, underline)
 CSS_KEY(unsafe, unsafe)
 CSS_KEY(vertical-text, vertical_text)
-CSS_KEY(visible, visible)
 CSS_KEY(w-resize, w_resize)
 CSS_KEY(wait, wait)
 CSS_KEY(wavy, wavy)
 CSS_KEY(zoom-in, zoom_in)
 CSS_KEY(zoom-out, zoom_out)
 
 // Appearance keywords for widget styles
 //CSS_KEY(middle, middle)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -442,25 +442,16 @@ const KTableEntry nsCSSProps::kContainKT
     {eCSSKeyword_strict, NS_STYLE_CONTAIN_STRICT},
     {eCSSKeyword_content, NS_STYLE_CONTAIN_CONTENT},
     {eCSSKeyword_layout, NS_STYLE_CONTAIN_LAYOUT},
     {eCSSKeyword_style, NS_STYLE_CONTAIN_STYLE},
     {eCSSKeyword_paint, NS_STYLE_CONTAIN_PAINT},
     {eCSSKeyword_size, NS_STYLE_CONTAIN_SIZE},
     {eCSSKeyword_UNKNOWN, -1}};
 
-const KTableEntry nsCSSProps::kOverflowSubKTable[] = {
-    {eCSSKeyword_auto, NS_STYLE_OVERFLOW_AUTO},
-    {eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE},
-    {eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN},
-    {eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL},
-    // Deprecated:
-    {eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP},
-    {eCSSKeyword_UNKNOWN, -1}};
-
 const KTableEntry nsCSSProps::kTextAlignKTable[] = {
     {eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT},
     {eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT},
     {eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER},
     {eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY},
     {eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER},
     {eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT},
     {eCSSKeyword__moz_left, NS_STYLE_TEXT_ALIGN_MOZ_LEFT},
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -311,17 +311,16 @@ class nsCSSProps {
   static const KTableEntry kAutoCompletionAlignJustifyContent[];
   // ------------------------------------------------------------------
   // clang-format on
   static const KTableEntry kFontSmoothingKTable[];
   static const KTableEntry kGridAutoFlowKTable[];
   static const KTableEntry kGridTrackBreadthKTable[];
   static const KTableEntry kLineHeightKTable[];
   static const KTableEntry kContainKTable[];
-  static const KTableEntry kOverflowSubKTable[];
   static const KTableEntry kTextAlignKTable[];
   static const KTableEntry kTextDecorationLineKTable[];
   static const KTableEntry kTextDecorationStyleKTable[];
   static const KTableEntry kTextEmphasisStyleShapeKTable[];
   static const KTableEntry kTextOverflowKTable[];
   static const KTableEntry kTouchActionKTable[];
   static const KTableEntry kVerticalAlignKTable[];
   static const KTableEntry kWidthKTable[];  // also min-width, max-width
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -2510,23 +2510,16 @@ already_AddRefed<CSSValue> nsComputedDOM
     RefPtr<nsROCSSPrimitiveValue> property = new nsROCSSPrimitiveValue;
     property->SetString(nsDependentAtomString(ident));
     valueList->AppendCSSValue(property.forget());
   }
 
   return valueList.forget();
 }
 
-already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOverflowY() {
-  RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowY,
-                                               nsCSSProps::kOverflowSubKTable));
-  return val.forget();
-}
-
 already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetTouchAction() {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   int32_t intValue = StyleDisplay()->mTouchAction;
 
   // None and Auto and Manipulation values aren't allowed
   // to be in conjunction with other values.
   // But there are all checks in CSSParserImpl::ParseTouchAction
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -552,25 +552,16 @@ enum class StyleGridTrackBreadth : uint8
 #define NS_STYLE_FRAME_0 2
 #define NS_STYLE_FRAME_1 3
 #define NS_STYLE_FRAME_ON 4
 #define NS_STYLE_FRAME_OFF 5
 #define NS_STYLE_FRAME_AUTO 6
 #define NS_STYLE_FRAME_SCROLL 7
 #define NS_STYLE_FRAME_NOSCROLL 8
 
-// See nsStyleDisplay.mOverflow{X,Y}
-#define NS_STYLE_OVERFLOW_VISIBLE 0
-#define NS_STYLE_OVERFLOW_HIDDEN 1
-#define NS_STYLE_OVERFLOW_SCROLL 2
-#define NS_STYLE_OVERFLOW_AUTO 3
-#define NS_STYLE_OVERFLOW_CLIP 4
-#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
-#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
-
 // See nsStyleList
 #define NS_STYLE_LIST_STYLE_CUSTOM -1  // for @counter-style
 #define NS_STYLE_LIST_STYLE_NONE 0
 #define NS_STYLE_LIST_STYLE_DECIMAL 1
 #define NS_STYLE_LIST_STYLE_DISC 2
 #define NS_STYLE_LIST_STYLE_CIRCLE 3
 #define NS_STYLE_LIST_STYLE_SQUARE 4
 #define NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED 5
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2972,18 +2972,18 @@ nsStyleDisplay::nsStyleDisplay(const nsP
       mAppearance(StyleAppearance::None),
       mPosition(NS_STYLE_POSITION_STATIC),
       mFloat(StyleFloat::None),
       mOriginalFloat(StyleFloat::None),
       mBreakType(StyleClear::None),
       mBreakInside(StyleBreakWithin::Auto),
       mBreakBefore(StyleBreakBetween::Auto),
       mBreakAfter(StyleBreakBetween::Auto),
-      mOverflowX(NS_STYLE_OVERFLOW_VISIBLE),
-      mOverflowY(NS_STYLE_OVERFLOW_VISIBLE),
+      mOverflowX(StyleOverflow::Visible),
+      mOverflowY(StyleOverflow::Visible),
       mOverflowClipBoxBlock(StyleOverflowClipBox::PaddingBox),
       mOverflowClipBoxInline(StyleOverflowClipBox::PaddingBox),
       mResize(StyleResize::None),
       mOrient(StyleOrient::Inline),
       mIsolation(NS_STYLE_ISOLATION_AUTO),
       mTopLayer(NS_STYLE_TOP_LAYER_NONE),
       mWillChangeBitField(0),
       mTouchAction(NS_STYLE_TOUCH_ACTION_AUTO),
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1897,18 +1897,18 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   mozilla::StyleFloat mFloat;
   // Save mFloat for position:absolute/fixed; otherwise equal to mFloat.
   mozilla::StyleFloat mOriginalFloat;
 
   mozilla::StyleClear mBreakType;
   mozilla::StyleBreakWithin mBreakInside;
   mozilla::StyleBreakBetween mBreakBefore;
   mozilla::StyleBreakBetween mBreakAfter;
-  uint8_t mOverflowX;  // NS_STYLE_OVERFLOW_*
-  uint8_t mOverflowY;  // NS_STYLE_OVERFLOW_*
+  mozilla::StyleOverflow mOverflowX;
+  mozilla::StyleOverflow mOverflowY;
   mozilla::StyleOverflowClipBox mOverflowClipBoxBlock;
   mozilla::StyleOverflowClipBox mOverflowClipBoxInline;
   mozilla::StyleResize mResize;
   mozilla::StyleOrient mOrient;
   uint8_t mIsolation;           // NS_STYLE_ISOLATION_*
   uint8_t mTopLayer;            // NS_STYLE_TOP_LAYER_*
   uint8_t mWillChangeBitField;  // NS_STYLE_WILL_CHANGE_*
                                 // Stores a bitfield representation of the
@@ -2132,19 +2132,19 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   }
 
   bool IsOutOfFlowStyle() const {
     return (IsAbsolutelyPositionedStyle() || IsFloatingStyle());
   }
 
   bool IsScrollableOverflow() const {
     // mOverflowX and mOverflowY always match when one of them is
-    // NS_STYLE_OVERFLOW_VISIBLE or NS_STYLE_OVERFLOW_CLIP.
-    return mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
-           mOverflowX != NS_STYLE_OVERFLOW_CLIP;
+    // Visible or MozHiddenUnscrollable.
+    return mOverflowX != mozilla::StyleOverflow::Visible &&
+           mOverflowX != mozilla::StyleOverflow::MozHiddenUnscrollable;
   }
 
   bool IsContainPaint() const {
     return (NS_STYLE_CONTAIN_PAINT & mContain) &&
            !IsInternalRubyDisplayType() && !IsInternalTableStyleExceptCell();
   }
 
   bool IsContainLayout() const {
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -921,35 +921,35 @@ gfxRect nsSVGUtils::GetClipRectForFrame(
   const nsStyleEffects* effects = aFrame->StyleEffects();
 
   if (!(effects->mClipFlags & NS_STYLE_CLIP_RECT)) {
     NS_ASSERTION(effects->mClipFlags == NS_STYLE_CLIP_AUTO,
                  "We don't know about this type of clip.");
     return gfxRect(aX, aY, aWidth, aHeight);
   }
 
-  if (disp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN ||
-      disp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
+  if (disp->mOverflowX == StyleOverflow::Hidden ||
+      disp->mOverflowY == StyleOverflow::Hidden) {
     nsIntRect clipPxRect = effects->mClip.ToOutsidePixels(
         aFrame->PresContext()->AppUnitsPerDevPixel());
     gfxRect clipRect = gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width,
                                clipPxRect.height);
 
     if (NS_STYLE_CLIP_RIGHT_AUTO & effects->mClipFlags) {
       clipRect.width = aWidth - clipRect.X();
     }
     if (NS_STYLE_CLIP_BOTTOM_AUTO & effects->mClipFlags) {
       clipRect.height = aHeight - clipRect.Y();
     }
 
-    if (disp->mOverflowX != NS_STYLE_OVERFLOW_HIDDEN) {
+    if (disp->mOverflowX != StyleOverflow::Hidden) {
       clipRect.x = aX;
       clipRect.width = aWidth;
     }
-    if (disp->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN) {
+    if (disp->mOverflowY != StyleOverflow::Hidden) {
       clipRect.y = aY;
       clipRect.height = aHeight;
     }
 
     return clipRect;
   }
   return gfxRect(aX, aY, aWidth, aHeight);
 }
--- a/layout/xul/nsBox.cpp
+++ b/layout/xul/nsBox.cpp
@@ -300,20 +300,21 @@ nsresult nsIFrame::XULLayout(nsBoxLayout
 
   box->EndXULLayout(aState);
 
   return NS_OK;
 }
 
 bool nsBox::DoesClipChildren() {
   const nsStyleDisplay* display = StyleDisplay();
-  NS_ASSERTION((display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
-                   (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
-               "If one overflow is clip, the other should be too");
-  return display->mOverflowX == NS_STYLE_OVERFLOW_CLIP;
+  NS_ASSERTION(
+      (display->mOverflowY == StyleOverflow::MozHiddenUnscrollable) ==
+          (display->mOverflowX == StyleOverflow::MozHiddenUnscrollable),
+      "If one overflow is -moz-hidden-unscrollable, the other should be too");
+  return display->mOverflowX == StyleOverflow::MozHiddenUnscrollable;
 }
 
 nsresult nsBox::SyncLayout(nsBoxLayoutState& aState) {
   /*
   if (IsXULCollapsed()) {
     CollapseChild(aState, this, true);
     return NS_OK;
   }
--- a/servo/components/style/cbindgen.toml
+++ b/servo/components/style/cbindgen.toml
@@ -59,10 +59,11 @@ include = [
   "PathCommand",
   "UnicodeRange",
   "UserSelect",
   "Float",
   "OverscrollBehavior",
   "ScrollSnapType",
   "OverflowClipBox",
   "Resize",
+  "Overflow",
 ]
 item_types = ["enums", "structs", "typedefs"]
--- a/servo/components/style/properties/data.py
+++ b/servo/components/style/properties/data.py
@@ -320,16 +320,17 @@ class Longhand(object):
                 "JustifySelf",
                 "MozForceBrokenImageIcon",
                 "MozScriptLevel",
                 "MozScriptMinSize",
                 "MozScriptSizeMultiplier",
                 "NonNegativeNumber",
                 "Opacity",
                 "OutlineStyle",
+                "Overflow",
                 "OverflowClipBox",
                 "OverflowWrap",
                 "OverscrollBehavior",
                 "Percentage",
                 "Resize",
                 "SVGOpacity",
                 "SVGPaintOrder",
                 "ScrollSnapType",
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1389,16 +1389,17 @@ impl Clone for ${style_struct.gecko_stru
 
     # Types used with predefined_type()-defined properties that we can auto-generate.
     predefined_types = {
         "Appearance": impl_simple,
         "OverscrollBehavior": impl_simple,
         "OverflowClipBox": impl_simple,
         "ScrollSnapType": impl_simple,
         "Float": impl_simple,
+        "Overflow": impl_simple,
         "BreakBetween": impl_simple,
         "BreakWithin": impl_simple,
         "Resize": impl_simple,
         "Color": impl_color,
         "ColorOrAuto": impl_color,
         "GreaterThanOrEqualToOneNumber": impl_simple,
         "Integer": impl_simple,
         "length::LengthOrAuto": impl_style_coord,
@@ -3006,17 +3007,17 @@ fn static_assert() {
         let list = unsafe { (*self.gecko.${gecko_ffi_name}.to_safe().get()).mHead.as_ref() };
 
         let mut transform = clone_transform_from_list(list);
         debug_assert_eq!(transform.0.len(), 1);
         ${type}::from_transform_operation(&transform.0.pop().unwrap())
     }
 </%def>
 
-<% skip_box_longhands= """display overflow-y vertical-align
+<% skip_box_longhands= """display vertical-align
                           animation-name animation-delay animation-duration
                           animation-direction animation-fill-mode animation-play-state
                           animation-iteration-count animation-timing-function
                           clear transition-duration transition-delay
                           transition-timing-function transition-property
                           rotate scroll-snap-points-x scroll-snap-points-y
                           scroll-snap-coordinate
                           perspective-origin -moz-binding will-change
@@ -3058,38 +3059,16 @@ fn static_assert() {
     <% clear_keyword = Keyword(
         "clear",
         "Left Right None Both",
         gecko_enum_prefix="StyleClear",
         gecko_inexhaustive=True,
     ) %>
     ${impl_keyword('clear', 'mBreakType', clear_keyword)}
 
-    <% overflow_x = data.longhands_by_name["overflow-x"] %>
-    pub fn set_overflow_y(&mut self, v: longhands::overflow_y::computed_value::T) {
-        use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
-        // FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
-        self.gecko.mOverflowY = match v {
-            % for value in overflow_x.keyword.values_for('gecko'):
-                BaseType::${to_camel_case(value)} => structs::${overflow_x.keyword.gecko_constant(value)} as u8,
-            % endfor
-        };
-    }
-    ${impl_simple_copy('overflow_y', 'mOverflowY')}
-    pub fn clone_overflow_y(&self) -> longhands::overflow_y::computed_value::T {
-        use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
-        // FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
-        match self.gecko.mOverflowY as u32 {
-            % for value in overflow_x.keyword.values_for('gecko'):
-            structs::${overflow_x.keyword.gecko_constant(value)} => BaseType::${to_camel_case(value)},
-            % endfor
-            x => panic!("Found unexpected value in style struct for overflow_y property: {}", x),
-        }
-    }
-
     pub fn set_vertical_align(&mut self, v: longhands::vertical_align::computed_value::T) {
         use crate::values::generics::box_::VerticalAlign;
         let value = match v {
             VerticalAlign::Baseline => structs::NS_STYLE_VERTICAL_ALIGN_BASELINE,
             VerticalAlign::Sub => structs::NS_STYLE_VERTICAL_ALIGN_SUB,
             VerticalAlign::Super => structs::NS_STYLE_VERTICAL_ALIGN_SUPER,
             VerticalAlign::Top => structs::NS_STYLE_VERTICAL_ALIGN_TOP,
             VerticalAlign::TextTop => structs::NS_STYLE_VERTICAL_ALIGN_TEXT_TOP,
--- a/servo/components/style/properties/longhands/box.mako.rs
+++ b/servo/components/style/properties/longhands/box.mako.rs
@@ -95,44 +95,40 @@
         flags="APPLIES_TO_PLACEHOLDER",
         gecko_pref="layout.css.overflow-clip-box.enabled",
         animation_value_type="discrete",
         spec="Internal, may be standardized in the future: \
               https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box",
     )}
 % endfor
 
-<%
-    overflow_custom_consts = { "-moz-hidden-unscrollable": "CLIP" }
-%>
-
 // FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
 //
 // We allow it to apply to placeholders for UA sheets, which set it !important.
-${helpers.single_keyword(
+${helpers.predefined_type(
     "overflow-x",
-    "visible hidden scroll auto",
+    "Overflow",
+    "computed::Overflow::Visible",
     animation_value_type="discrete",
-    extra_gecko_values="-moz-hidden-unscrollable",
-    custom_consts=overflow_custom_consts,
-    gecko_constant_prefix="NS_STYLE_OVERFLOW",
     flags="APPLIES_TO_PLACEHOLDER",
     spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x",
+    needs_context=False,
     servo_restyle_damage = "reflow",
 )}
 
-// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
-//
-// We allow it to apply to placeholders for UA sheets, which set it !important.
-<%helpers:longhand name="overflow-y" animation_value_type="discrete"
-                   flags="APPLIES_TO_PLACEHOLDER",
-                   spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y"
-                   servo_restyle_damage = "reflow">
-    pub use super::overflow_x::{SpecifiedValue, parse, get_initial_value, computed_value};
-</%helpers:longhand>
+${helpers.predefined_type(
+    "overflow-y",
+    "Overflow",
+    "computed::Overflow::Visible",
+    animation_value_type="discrete",
+    flags="APPLIES_TO_PLACEHOLDER",
+    spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y",
+    needs_context=False,
+    servo_restyle_damage = "reflow",
+)}
 
 <% transition_extra_prefixes = "moz:layout.css.prefixes.transitions webkit" %>
 
 ${helpers.predefined_type(
     "transition-duration",
     "Time",
     "computed::Time::zero()",
     initial_specified_value="specified::Time::zero()",
--- a/servo/components/style/values/computed/box.rs
+++ b/servo/components/style/values/computed/box.rs
@@ -8,17 +8,17 @@ use crate::values::computed::length::{Le
 use crate::values::computed::{Context, Number, ToComputedValue};
 use crate::values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
 use crate::values::generics::box_::Perspective as GenericPerspective;
 use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
 use crate::values::specified::box_ as specified;
 
 pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin};
 pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
-pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox};
+pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowClipBox};
 pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType};
 pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};
 
 /// A computed value for the `vertical-align` property.
 pub type VerticalAlign = GenericVerticalAlign<LengthOrPercentage>;
 
 /// A computed value for the `animation-iteration-count` property.
 pub type AnimationIterationCount = GenericAnimationIterationCount<Number>;
--- a/servo/components/style/values/computed/mod.rs
+++ b/servo/components/style/values/computed/mod.rs
@@ -38,17 +38,17 @@ pub use self::align::{AlignSelf, Justify
 pub use self::angle::Angle;
 pub use self::background::{BackgroundRepeat, BackgroundSize};
 pub use self::basic_shape::FillRule;
 pub use self::border::{BorderCornerRadius, BorderRadius, BorderSpacing};
 pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
 pub use self::border::{BorderImageSlice, BorderImageWidth};
 pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
 pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
-pub use self::box_::{Display, TransitionProperty};
+pub use self::box_::{Display, TransitionProperty, Overflow};
 pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
 pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
 pub use self::color::{Color, ColorPropertyValue, RGBAColor};
 pub use self::column::ColumnCount;
 pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset};
 pub use self::easing::TimingFunction;
 pub use self::effects::{BoxShadow, Filter, SimpleShadow};
 pub use self::flex::FlexBasis;
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -1358,8 +1358,33 @@ impl BreakBetween {
     ToCss,
     ToComputedValue,
 )]
 #[repr(u8)]
 pub enum BreakWithin {
     Auto,
     Avoid,
 }
+
+/// The value for the `overflow-x` / `overflow-y` properties.
+#[allow(missing_docs)]
+#[derive(
+    Clone,
+    Copy,
+    Debug,
+    Eq,
+    Hash,
+    MallocSizeOf,
+    Parse,
+    PartialEq,
+    SpecifiedValueInfo,
+    ToCss,
+    ToComputedValue,
+)]
+#[repr(u8)]
+pub enum Overflow {
+    Visible,
+    Hidden,
+    Scroll,
+    Auto,
+    #[cfg(feature = "gecko")]
+    MozHiddenUnscrollable,
+}
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -31,17 +31,17 @@ pub use self::align::{AlignContent, Alig
 pub use self::align::{JustifyContent, JustifyItems, JustifySelf, SelfAlignment};
 pub use self::angle::Angle;
 pub use self::background::{BackgroundRepeat, BackgroundSize};
 pub use self::basic_shape::FillRule;
 pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
 pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
 pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle};
 pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display};
-pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
+pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow};
 pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
 pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange};
 pub use self::color::{Color, ColorPropertyValue, RGBAColor};
 pub use self::column::ColumnCount;
 pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset};
 pub use self::easing::TimingFunction;
 pub use self::effects::{BoxShadow, Filter, SimpleShadow};
 pub use self::flex::FlexBasis;