Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 29 Mar 2023 21:23:55 +0000 (2023-03-29)
changeset 658531 0e21add6bf2c506047e36dc8c9c16399c0ca8988
parent 658530 a547406d4b1f1565f1400641623aacb9ffe7a846
child 658532 4ccf340c4e9c4768e86771fedac48f90aeb67830
push id40744
push usernbeleuzu@mozilla.com
push dateThu, 30 Mar 2023 03:13:26 +0000 (2023-03-30)
treeherdermozilla-central@e8f3ccfc88e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslayout-reviewers, desktop-theme-reviewers, devtools-reviewers, dao, TYLin
bugs1824957
milestone113.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 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin And some related tests. A bunch of -moz-box* properties are web exposed, so I'll file a follow-up for hiding them. Differential Revision: https://phabricator.services.mozilla.com/D173819
accessible/base/nsAccessibilityService.cpp
accessible/generic/LocalAccessible.cpp
accessible/generic/TableAccessible.cpp
accessible/tests/mochitest/attributes/a11y.ini
accessible/tests/mochitest/attributes/test_obj_css.xhtml
devtools/server/actors/animation-type-longhand.js
dom/events/EventStateManager.cpp
layout/base/PresShell.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
layout/generic/CSSOrderAwareFrameIterator.cpp
layout/generic/FrameClasses.py
layout/generic/ReflowInput.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrameStateBits.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsIFrame.cpp
layout/generic/nsIFrame.h
layout/generic/nsIScrollableFrame.h
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsPlaceholderFrame.h
layout/generic/nsVideoFrame.cpp
layout/reftests/box-ordinal/dynamic-1-add-to-one-grouped.xhtml
layout/reftests/box-ordinal/dynamic-1-add-to-two-grouped-1.xhtml
layout/reftests/box-ordinal/dynamic-1-add-to-two-grouped-2.xhtml
layout/reftests/box-ordinal/dynamic-1-ref.xhtml
layout/reftests/box-ordinal/dynamic-1-remove-to-none-grouped.xhtml
layout/reftests/box-ordinal/dynamic-1-remove-to-one-grouped-1.xhtml
layout/reftests/box-ordinal/dynamic-1-remove-to-one-grouped-2.xhtml
layout/reftests/box-ordinal/reftest.list
layout/reftests/box/box-as-grid-or-flex-item-1-ref.html
layout/reftests/box/box-as-grid-or-flex-item-1.html
layout/reftests/box/flex-emulation-1-ref.xhtml
layout/reftests/box/flex-emulation-1.xhtml
layout/reftests/box/flex-emulation-2-ref.xhtml
layout/reftests/box/flex-emulation-2.xhtml
layout/reftests/box/flex-emulation-4-ref.xhtml
layout/reftests/box/flex-emulation-4.xhtml
layout/reftests/box/flex-emulation-5-ref.xhtml
layout/reftests/box/flex-emulation-5-ref2.xhtml
layout/reftests/box/flex-emulation-5.xhtml
layout/reftests/box/flexbox-abspos-container-1-ref.html
layout/reftests/box/flexbox-abspos-container-1a.html
layout/reftests/box/flexbox-abspos-container-1b.html
layout/reftests/box/flexbox-abspos-container-1c.html
layout/reftests/box/flexbox-abspos-container-1d.html
layout/reftests/box/flexbox-abspos-container-2-ref.html
layout/reftests/box/flexbox-abspos-container-2.html
layout/reftests/box/flexbox-attributes-no-box-horizontal-ref.xhtml
layout/reftests/box/flexbox-attributes-no-box-horizontal.xhtml
layout/reftests/box/flexbox-attributes-no-box-vertical-ref.xhtml
layout/reftests/box/flexbox-attributes-no-box-vertical.xhtml
layout/reftests/box/flexbox-attributes-no-input-horizontal-ref.xhtml
layout/reftests/box/flexbox-attributes-no-input-horizontal.xhtml
layout/reftests/box/flexbox-attributes-no-input-vertical-ref.xhtml
layout/reftests/box/flexbox-attributes-no-input-vertical.xhtml
layout/reftests/box/flexbox-child-is-abspos-container-1-ref.html
layout/reftests/box/flexbox-child-is-abspos-container-1.html
layout/reftests/box/flexbox-child-is-abspos-container-2-ref.html
layout/reftests/box/flexbox-child-is-abspos-container-2.html
layout/reftests/box/reftest.list
layout/reftests/bugs/322436-1-ref.html
layout/reftests/bugs/322436-1.html
layout/reftests/bugs/413027-1-ref.html
layout/reftests/bugs/413027-1.html
layout/reftests/bugs/508816-2-ref.html
layout/reftests/bugs/508816-2.html
layout/reftests/bugs/531098-1-ref.html
layout/reftests/bugs/531098-1.html
layout/reftests/bugs/579323-1.html
layout/reftests/bugs/reftest.list
layout/reftests/reftest.list
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/style/res/scrollbars.css
layout/style/test/ListCSSProperties.cpp
layout/xul/moz.build
layout/xul/nsBox.cpp
layout/xul/nsBoxLayoutState.cpp
layout/xul/nsBoxLayoutState.h
layout/xul/nsLeafBoxFrame.cpp
layout/xul/nsLeafBoxFrame.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsSplitterFrame.cpp
layout/xul/test/chrome.ini
layout/xul/test/test_blockify_moz_box.html
layout/xul/test/test_splitter.xhtml
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeBodyFrame.h
servo/components/style/properties/longhands/inherited_box.mako.rs
servo/components/style/values/specified/box.rs
toolkit/themes/shared/tree.css
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1312,18 +1312,17 @@ LocalAccessible* nsAccessibilityService:
     }
 
     // Any XUL/flex box can be used as tabpanel, make sure we create a proper
     // accessible for it.
     if (!newAcc && aContext->IsXULTabpanels() &&
         content->GetParent() == aContext->GetContent()) {
       LayoutFrameType frameType = frame->Type();
       // FIXME(emilio): Why only these frame types?
-      if (frameType == LayoutFrameType::Box ||
-          frameType == LayoutFrameType::FlexContainer ||
+      if (frameType == LayoutFrameType::FlexContainer ||
           frameType == LayoutFrameType::Scroll) {
         newAcc = new XULTabpanelAccessible(content, document);
       }
     }
   }
 
   if (!newAcc) {
     if (content->IsSVGElement()) {
--- a/accessible/generic/LocalAccessible.cpp
+++ b/accessible/generic/LocalAccessible.cpp
@@ -402,32 +402,18 @@ uint64_t LocalAccessible::NativeState() 
 
     state |= NativeInteractiveState();
   }
 
   // Gather states::INVISIBLE and states::OFFSCREEN flags for this object.
   state |= VisibilityState();
 
   nsIFrame* frame = GetFrame();
-  if (frame) {
-    if (frame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) state |= states::FLOATING;
-
-    // XXX we should look at layout for non XUL box frames, but need to decide
-    // how that interacts with ARIA.
-    if (HasOwnContent() && mContent->IsXULElement() && frame->IsXULBoxFrame()) {
-      const nsStyleXUL* xulStyle = frame->StyleXUL();
-      if (xulStyle && frame->IsXULBoxFrame()) {
-        // In XUL all boxes are either vertical or horizontal
-        if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical) {
-          state |= states::VERTICAL;
-        } else {
-          state |= states::HORIZONTAL;
-        }
-      }
-    }
+  if (frame && frame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
+    state |= states::FLOATING;
   }
 
   // Check if a XUL element has the popup attribute (an attached popup menu).
   if (HasOwnContent() && mContent->IsXULElement() &&
       mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup)) {
     state |= states::HASPOPUP;
   }
 
--- a/accessible/generic/TableAccessible.cpp
+++ b/accessible/generic/TableAccessible.cpp
@@ -179,18 +179,17 @@ bool TableAccessible::IsProbablyLayoutTa
     RETURN_LAYOUT_ANSWER(false, "table with no frame!");
   }
 
   nsIFrame* cellFrame = tableFrame->GetCellFrameAt(0, 0);
   if (!cellFrame) {
     RETURN_LAYOUT_ANSWER(false, "table's first cell has no frame!");
   }
 
-  nsMargin border;
-  cellFrame->GetXULBorder(border);
+  nsMargin border = cellFrame->StyleBorder()->GetComputedBorder();
   if (border.top && border.bottom && border.left && border.right) {
     RETURN_LAYOUT_ANSWER(false, "Has nonzero border-width on table cell");
   }
 
   // Rules for non-bordered tables with 2-4 columns and 2+ rows from here on
   // forward.
 
   // Check for styled background color across rows (alternating background
--- a/accessible/tests/mochitest/attributes/a11y.ini
+++ b/accessible/tests/mochitest/attributes/a11y.ini
@@ -2,14 +2,13 @@
 support-files =
   !/accessible/tests/mochitest/*.js
 
 [test_dpub_aria_xml-roles.html]
 [test_graphics_aria_xml-roles.html]
 [test_listbox.html]
 [test_obj.html]
 [test_obj_css.html]
-[test_obj_css.xhtml]
 [test_obj_group.html]
 [test_obj_group.xhtml]
 [test_obj_group_tree.xhtml]
 [test_tag.html]
 [test_xml-roles.html]
deleted file mode 100644
--- a/accessible/tests/mochitest/attributes/test_obj_css.xhtml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
-                 type="text/css"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Accessibility CSS-based Object Attributes Test.">
-
-  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
-
-  <script type="application/javascript"
-          src="../common.js" />
-  <script type="application/javascript"
-          src="../events.js" />
-  <script type="application/javascript"
-          src="../attributes.js" />
-
-  <script type="application/javascript">
-  <![CDATA[
-    function doTest()
-    {
-      // CSS display
-      testCSSAttrs("display_mozbox");
-      testCSSAttrs("display_mozinlinebox");
-
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addA11yLoadEvent(doTest);
-  ]]>
-  </script>
-
-  <hbox flex="1" style="overflow: auto;">
-  <body xmlns="http://www.w3.org/1999/xhtml">
-    <a target="_blank"
-       href="https://bugzilla.mozilla.org/show_bug.cgi?id=714579"
-       title="Don't use GetComputedStyle for object attribute calculation">
-      Mozilla Bug 714579
-    </a><br/>
-
-    <p id="display"></p>
-    <div id="content" style="display: none">
-    </div>
-    <pre id="test">
-    </pre>
-  </body>
-
-  <vbox id="display_mozbox" style="display: -moz-box;" role="img"/>
-  <vbox id="display_mozinlinebox" style="display: -moz-inline-box;" role="img"/>
-
-  </hbox>
-</window>
--- a/devtools/server/actors/animation-type-longhand.js
+++ b/devtools/server/actors/animation-type-longhand.js
@@ -243,17 +243,16 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
       "min-inline-size",
       "padding-block-end",
       "padding-block-start",
       "padding-inline-end",
       "padding-inline-start",
       "page-orientation",
       "math-depth",
       "-moz-box-collapse",
-      "-moz-box-layout",
       "-moz-top-layer",
       "scroll-timeline-axis",
       "scroll-timeline-name",
       "size",
       "transition-delay",
       "transition-duration",
       "transition-property",
       "transition-timing-function",
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3114,61 +3114,40 @@ void EventStateManager::DecideGestureEve
 
     // Scrollbars should always be draggable
     if (currentFrameType == LayoutFrameType::Scrollbar) {
       panDirection = WidgetGestureNotifyEvent::ePanNone;
       break;
     }
 
     // Special check for trees
-    nsTreeBodyFrame* treeFrame = do_QueryFrame(current);
-    if (treeFrame) {
+    if (nsTreeBodyFrame* treeFrame = do_QueryFrame(current)) {
       if (treeFrame->GetHorizontalOverflow()) {
         panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
       }
       if (treeFrame->GetVerticalOverflow()) {
         panDirection = WidgetGestureNotifyEvent::ePanVertical;
       }
       break;
     }
 
     if (nsIScrollableFrame* scrollableFrame = do_QueryFrame(current)) {
-      if (current->IsFrameOfType(nsIFrame::eXULBox)) {
+      layers::ScrollDirections scrollbarVisibility =
+          scrollableFrame->GetScrollbarVisibility();
+
+      // Check if we have visible scrollbars
+      if (scrollbarVisibility.contains(layers::ScrollDirection::eVertical)) {
+        panDirection = WidgetGestureNotifyEvent::ePanVertical;
         displayPanFeedback = true;
-
-        nsRect scrollRange = scrollableFrame->GetScrollRange();
-        bool canScrollHorizontally = scrollRange.width > 0;
-
-        // Vertical panning has priority over horizontal panning, so
-        // when vertical movement is possible we can just finish the loop.
-        if (scrollRange.height > 0) {
-          panDirection = WidgetGestureNotifyEvent::ePanVertical;
-          break;
-        }
-
-        if (canScrollHorizontally) {
-          panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
-          displayPanFeedback = false;
-        }
-      } else {  // Not a XUL box
-        layers::ScrollDirections scrollbarVisibility =
-            scrollableFrame->GetScrollbarVisibility();
-
-        // Check if we have visible scrollbars
-        if (scrollbarVisibility.contains(layers::ScrollDirection::eVertical)) {
-          panDirection = WidgetGestureNotifyEvent::ePanVertical;
-          displayPanFeedback = true;
-          break;
-        }
-
-        if (scrollbarVisibility.contains(
-                layers::ScrollDirection::eHorizontal)) {
-          panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
-          displayPanFeedback = true;
-        }
+        break;
+      }
+
+      if (scrollbarVisibility.contains(layers::ScrollDirection::eHorizontal)) {
+        panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
+        displayPanFeedback = true;
       }
     }  // scrollableFrame
   }    // ancestor chain
   aEvent->mDisplayPanFeedback = displayPanFeedback;
   aEvent->mPanDirection = panDirection;
 }
 
 #ifdef XP_MACOSX
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -41,17 +41,16 @@
 #include "mozilla/StaticPrefs_toolkit.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "mozilla/ViewportUtils.h"
 #include "mozilla/gfx/Types.h"
-#include "nsBoxLayoutState.h"
 #include <algorithm>
 
 #ifdef XP_WIN
 #  include "winuser.h"
 #endif
 
 #include "gfxContext.h"
 #include "gfxUserFontSet.h"
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -240,20 +240,19 @@ static inline bool IsFlexContainerForLeg
          aFrame->HasAnyStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
 }
 
 #if DEBUG
 static void AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
                                                 const nsIFrame* aParent) {
   MOZ_ASSERT(IsAnonymousItem(aChild), "expected an anonymous item child frame");
   MOZ_ASSERT(aParent, "expected a parent frame");
-  MOZ_ASSERT(aParent->IsFlexContainerFrame() ||
-                 aParent->IsGridContainerFrame() || aParent->IsXULBoxFrame(),
-             "anonymous items should only exist as children of "
-             "flex/grid/-moz-box container frames");
+  MOZ_ASSERT(aParent->IsFlexOrGridContainer(),
+             "anonymous items should only exist as children of flex/grid "
+             "container frames");
 }
 #else
 #  define AssertAnonymousFlexOrGridItemParent(x, y) PR_BEGIN_MACRO PR_END_MACRO
 #endif
 
 #define ToCreationFunc(_func)                              \
   [](PresShell* aPs, ComputedStyle* aStyle) -> nsIFrame* { \
     return _func(aPs, aStyle);                             \
@@ -299,17 +298,17 @@ static bool IsLastContinuationForColumnC
 
 /**
  * Returns true iff aFrame explicitly prevents its descendants from floating
  * (at least, down to the level of descendants which themselves are
  * float-containing blocks -- those will manage the floating status of any
  * lower-level descendents inside them, of course).
  */
 static bool ShouldSuppressFloatingOfDescendants(nsIFrame* aFrame) {
-  return aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame() ||
+  return aFrame->IsFlexOrGridContainer() ||
          aFrame->IsFrameOfType(nsIFrame::eMathML);
 }
 
 // Return true if column-span descendants should be suppressed under aFrame's
 // subtree (until a multi-column container re-establishing a block formatting
 // context). Basically, this is testing whether aFrame establishes a new block
 // formatting context or not.
 static bool ShouldSuppressColumnSpanDescendants(nsIFrame* aFrame) {
@@ -2312,18 +2311,17 @@ static inline bool NeedFrameFor(const ns
   // whitespace.
 
   // We could handle all this in CreateNeededPseudoContainers or some other
   // place after we build our frame construction items, but that would involve
   // creating frame construction items for whitespace kids that ignores
   // white-space, where we know we'll be dropping them all anyway, and involve
   // an extra walk down the frame construction item list.
   auto excludesIgnorableWhitespace = [](nsIFrame* aParentFrame) {
-    return aParentFrame->IsFrameOfType(nsIFrame::eXULBox) ||
-           aParentFrame->IsFrameOfType(nsIFrame::eMathML);
+    return aParentFrame->IsFrameOfType(nsIFrame::eMathML);
   };
   if (!aParentFrame || !excludesIgnorableWhitespace(aParentFrame) ||
       aParentFrame->IsGeneratedContentFrame() || !aChildContent->IsText()) {
     return true;
   }
 
   aChildContent->SetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE |
                           NS_REFRAME_IF_WHITESPACE);
@@ -2500,18 +2498,17 @@ nsIFrame* nsCSSFrameConstructor::Constru
     static constexpr FrameConstructionData rootSVGData;
     AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
                                    do_AddRef(computedStyle), true);
 
     contentFrame = static_cast<nsContainerFrame*>(ConstructOuterSVG(
         state, item, mDocElementContainingBlock, display, frameList));
   } else if (display->mDisplay == StyleDisplay::Flex ||
              display->mDisplay == StyleDisplay::WebkitBox ||
-             display->mDisplay == StyleDisplay::Grid ||
-             display->mDisplay == StyleDisplay::MozBox) {
+             display->mDisplay == StyleDisplay::Grid) {
     auto func = [&] {
       if (display->mDisplay == StyleDisplay::Grid) {
         return NS_NewGridContainerFrame;
       }
       return NS_NewFlexContainerFrame;
     }();
     contentFrame = func(mPresShell, computedStyle);
     InitAndRestoreFrame(
@@ -4328,27 +4325,25 @@ void nsCSSFrameConstructor::BuildScrollF
   aScrolledFrame->SetComputedStyleWithoutNotification(scrolledContentStyle);
   InitAndRestoreFrame(aState, aContent, aNewFrame, aScrolledFrame);
 
   FinishBuildingScrollFrame(aNewFrame, aScrolledFrame);
 }
 
 const nsCSSFrameConstructor::FrameConstructionData*
 nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
-                                       const StyleMozBoxLayout aMozBoxLayout,
                                        const Element& aElement) {
   static_assert(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET)),
                 "Check eParentTypeCount should not overflow");
 
   // The style system ensures that floated and positioned frames are
   // block-level.
   NS_ASSERTION(
       !(aDisplay.IsFloatingStyle() || aDisplay.IsAbsolutelyPositionedStyle()) ||
-          aDisplay.IsBlockOutsideStyle() ||
-          aDisplay.DisplayOutside() == StyleDisplayOutside::XUL,
+          aDisplay.IsBlockOutsideStyle(),
       "Style system did not apply CSS2.1 section 9.7 fixups");
 
   // If this is "body", try propagating its scroll style to the viewport
   // Note that we need to do this even if the body is NOT scrollable;
   // it might have dynamically changed from scrollable to not scrollable,
   // and that might need to be propagated.
   // XXXbz is this the right place to do this?  If this code moves,
   // make this function static.
@@ -4469,24 +4464,16 @@ nsCSSFrameConstructor::FindDisplayData(c
       return &data;
     }
     case StyleDisplayInside::TableCell: {
       static constexpr FrameConstructionData data(
           &nsCSSFrameConstructor::ConstructTableCell,
           FCDATA_IS_TABLE_PART | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow));
       return &data;
     }
-    case StyleDisplayInside::MozBox: {
-      if (!aElement.IsInNativeAnonymousSubtree() &&
-          aElement.OwnerDoc()->IsContentDocument()) {
-        aElement.OwnerDoc()->WarnOnceAbout(
-            DeprecatedOperations::eMozBoxOrInlineBoxDisplay);
-      }
-      [[fallthrough]];
-    }
     case StyleDisplayInside::Flex:
     case StyleDisplayInside::WebkitBox: {
       static constexpr FrameConstructionData nonScrollableData(
           ToCreationFunc(NS_NewFlexContainerFrame));
       static constexpr FrameConstructionData data(
           ToCreationFunc(NS_NewFlexContainerFrame),
           FCDATA_MAY_NEED_SCROLLFRAME);
       return MOZ_UNLIKELY(propagatedScrollToViewport) ? &nonScrollableData
@@ -5264,31 +5251,30 @@ nsCSSFrameConstructor::FindElementData(c
   // 'display' values other than 'none' or 'contents').
   if (nsImageFrame::ShouldCreateImageFrameForContentProperty(aElement,
                                                              aStyle)) {
     static constexpr FrameConstructionData sImgData(
         NS_NewImageFrameForContentProperty);
     return &sImgData;
   }
 
-  const auto boxLayout = aStyle.StyleVisibility()->mMozBoxLayout;
   const bool shouldBlockify = aFlags.contains(ItemFlag::IsForRenderedLegend) ||
                               aFlags.contains(ItemFlag::IsForOutsideMarker);
   if (shouldBlockify && !aStyle.StyleDisplay()->IsBlockOutsideStyle()) {
     // Make a temp copy of StyleDisplay and blockify its mDisplay value.
     auto display = *aStyle.StyleDisplay();
     bool isRootElement = false;
     uint16_t rawDisplayValue =
         Servo_ComputedValues_BlockifiedDisplay(&aStyle, isRootElement);
     display.mDisplay = StyleDisplay(rawDisplayValue);
-    return FindDisplayData(display, boxLayout, aElement);
+    return FindDisplayData(display, aElement);
   }
 
   const auto& display = *aStyle.StyleDisplay();
-  return FindDisplayData(display, boxLayout, aElement);
+  return FindDisplayData(display, aElement);
 }
 
 const nsCSSFrameConstructor::FrameConstructionData*
 nsCSSFrameConstructor::FindElementTagData(const Element& aElement,
                                           ComputedStyle& aStyle,
                                           nsIFrame* aParentFrame,
                                           ItemFlags aFlags) {
   switch (aElement.GetNameSpaceID()) {
@@ -8699,18 +8685,17 @@ const nsCSSFrameConstructor::PseudoParen
 
 void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
     nsFrameConstructorState& aState, FrameConstructionItemList& aItems,
     nsIFrame* aParentFrame) {
   if (aItems.IsEmpty()) {
     return;
   }
 
-  if (!aParentFrame->IsFlexOrGridContainer() &&
-      !aParentFrame->IsXULBoxFrame()) {
+  if (!aParentFrame->IsFlexOrGridContainer()) {
     return;
   }
 
   const bool isLegacyWebKitBox =
       IsFlexContainerForLegacyWebKitBox(aParentFrame);
   FCItemIterator iter(aItems);
   do {
     // Advance iter past children that don't want to be wrapped
@@ -9327,18 +9312,17 @@ void nsCSSFrameConstructor::CreateNeeded
  *
  * NOTE: aContainerFrame must be a flex or grid container - this function is
  * purely for sanity-checking the children of these container types.
  * NOTE: See also NeedsAnonFlexOrGridItem(), for the non-debug version of this
  * logic (which operates a bit earlier, on FCData instead of frames).
  */
 static bool FrameWantsToBeInAnonymousItem(const nsIFrame* aContainerFrame,
                                           const nsIFrame* aFrame) {
-  MOZ_ASSERT(aContainerFrame->IsFlexOrGridContainer() ||
-             aContainerFrame->IsXULBoxFrame());
+  MOZ_ASSERT(aContainerFrame->IsFlexOrGridContainer());
 
   // Any line-participant frames (e.g. text) definitely want to be wrapped in
   // an anonymous flex/grid item.
   if (aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
     return true;
   }
 
   // If the container is a -webkit-{inline-}box container, then placeholders
@@ -9350,18 +9334,17 @@ static bool FrameWantsToBeInAnonymousIte
 
   return false;
 }
 #endif
 
 static void VerifyGridFlexContainerChildren(nsIFrame* aParentFrame,
                                             const nsFrameList& aChildren) {
 #ifdef DEBUG
-  if (!aParentFrame->IsFlexOrGridContainer() &&
-      !aParentFrame->IsXULBoxFrame()) {
+  if (!aParentFrame->IsFlexOrGridContainer()) {
     return;
   }
 
   bool prevChildWasAnonItem = false;
   for (const nsIFrame* child : aChildren) {
     MOZ_ASSERT(!FrameWantsToBeInAnonymousItem(aParentFrame, child),
                "frame wants to be inside an anonymous item, but it isn't");
     if (IsAnonymousItem(child)) {
@@ -9798,19 +9781,16 @@ void nsCSSFrameConstructor::ProcessChild
   } else {
     ClearLazyBits(aContent->GetFirstChild(), nullptr);
   }
 
   ConstructFramesFromItemList(aState, itemsToConstruct, aFrame,
                               /* aParentIsWrapperAnonBox = */ false,
                               aFrameList);
 
-  NS_ASSERTION(!allowFirstPseudos || !aFrame->IsXULBoxFrame(),
-               "can't be both block and box");
-
   if (listItem) {
     if (auto* markerFrame = nsLayoutUtils::GetMarkerFrame(aContent)) {
       for (auto* childFrame : aFrameList) {
         if (markerFrame == childFrame) {
           if (isOutsideMarker) {
             // SetMarkerFrameForListItem will add childFrame to the
             // FrameChildListID::Bullet
             aFrameList.RemoveFrame(childFrame);
@@ -11353,20 +11333,20 @@ bool nsCSSFrameConstructor::WipeContaini
                                  InsertionKind::Async);
         return true;
       }
     }
   }
 
   nsIFrame* nextSibling = ::GetInsertNextSibling(aFrame, aPrevSibling);
 
-  // Situation #2 is a flex / grid / XUL box container frame into which we're
-  // inserting new inline non-replaced children, adjacent to an existing
-  // anonymous flex or grid item.
-  if (aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame()) {
+  // Situation #2 is a flex / grid  container frame into which we're inserting
+  // new inline non-replaced children, adjacent to an existing anonymous flex or
+  // grid item.
+  if (aFrame->IsFlexOrGridContainer()) {
     FCItemIterator iter(aItems);
 
     // Check if we're adding to-be-wrapped content right *after* an existing
     // anonymous flex or grid item (which would need to absorb this content).
     const bool isLegacyWebKitBox = IsFlexContainerForLegacyWebKitBox(aFrame);
     if (aPrevSibling && IsAnonymousItem(aPrevSibling) &&
         iter.item().NeedsAnonFlexOrGridItem(aState, isLegacyWebKitBox)) {
       TRACE("Inserting inline after anon flex or grid item");
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -1564,17 +1564,16 @@ class nsCSSFrameConstructor final : publ
                                                   nsIFrame* aParentFrame,
                                                   bool aIsWithinSVGText,
                                                   bool aAllowsTextPathChild,
                                                   ComputedStyle&);
 
   // Not static because it does PropagateScrollToViewport.  If this
   // changes, make this static.
   const FrameConstructionData* FindDisplayData(const nsStyleDisplay&,
-                                               mozilla::StyleMozBoxLayout,
                                                const Element&);
 
   /**
    * Construct a scrollable block frame
    */
   nsIFrame* ConstructScrollableBlock(nsFrameConstructorState& aState,
                                      FrameConstructionItem& aItem,
                                      nsContainerFrame* aParentFrame,
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -623,17 +623,16 @@ LogicalSize nsTextControlFrame::ComputeA
               aBorderPadding, aSizeOverrides, aFlags)
               .ISize(aWM);
     }
 #ifdef DEBUG
     else {
       LogicalSize ancestorAutoSize = nsContainerFrame::ComputeAutoSize(
           aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
           aBorderPadding, aSizeOverrides, aFlags);
-      // Disabled when there's inflation; see comment in GetXULPrefSize.
       MOZ_ASSERT(inflation != 1.0f ||
                      ancestorAutoSize.ISize(aWM) == autoSize.ISize(aWM),
                  "Incorrect size computed by ComputeAutoSize?");
     }
 #endif
   }
   return autoSize;
 }
@@ -812,26 +811,16 @@ void nsTextControlFrame::ReflowTextContr
   // place the child
   FinishReflowChild(aKid, aPresContext, desiredSize, &kidReflowInput, wm,
                     position, containerSize, ReflowChildFlags::Default);
 
   // consider the overflow
   aParentDesiredSize.mOverflowAreas.UnionWith(desiredSize.mOverflowAreas);
 }
 
-nsSize nsTextControlFrame::GetXULMinSize(nsBoxLayoutState& aState) {
-  // XXXbz why?  Why not the nsBoxFrame sizes?
-  return nsIFrame::GetUncachedXULMinSize(aState);
-}
-
-bool nsTextControlFrame::IsXULCollapsed() {
-  // We're never collapsed in the box sense.
-  return false;
-}
-
 // IMPLEMENTING NS_IFORMCONTROLFRAME
 void nsTextControlFrame::SetFocus(bool aOn, bool aRepaint) {
   TextControlElement* textControlElement =
       TextControlElement::FromNode(GetContent());
   MOZ_ASSERT(textControlElement);
 
   // If 'dom.placeholeder.show_on_focus' preference is 'false', focusing or
   // blurring the frame can have an impact on the placeholder visibility.
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -95,19 +95,16 @@ class nsTextControlFrame : public nsCont
     }
     NS_ASSERTION(aFirstBaseline != NS_INTRINSIC_ISIZE_UNKNOWN,
                  "please call Reflow before asking for the baseline");
     return mozilla::Some(aBaselineGroup == BaselineSharingGroup::First
                              ? aFirstBaseline
                              : aFrame->BSize(aWM) - aFirstBaseline);
   }
 
-  nsSize GetXULMinSize(nsBoxLayoutState&) override;
-  bool IsXULCollapsed() override;
-
 #ifdef ACCESSIBILITY
   mozilla::a11y::AccType AccessibleType() override;
 #endif
 
 #ifdef DEBUG_FRAME_DUMP
   nsresult GetFrameName(nsAString& aResult) const override {
     aResult.AssignLiteral("nsTextControlFrame");
     return NS_OK;
--- a/layout/generic/CSSOrderAwareFrameIterator.cpp
+++ b/layout/generic/CSSOrderAwareFrameIterator.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Iterator class for frame lists that respect CSS "order" during layout */
 
 #include "CSSOrderAwareFrameIterator.h"
 #include "nsIFrameInlines.h"
 
 static bool CanUse(const nsIFrame* aFrame) {
-  return aFrame->IsFlexOrGridContainer() || aFrame->IsXULBoxFrame() ||
+  return aFrame->IsFlexOrGridContainer() ||
          (aFrame->GetContent() && aFrame->GetContent()->IsAnyOfXULElements(
                                       nsGkAtoms::treecols, nsGkAtoms::treecol));
 }
 
 namespace mozilla {
 
 template <>
 bool CSSOrderAwareFrameIterator::CanUse(const nsIFrame* aFrame) {
--- a/layout/generic/FrameClasses.py
+++ b/layout/generic/FrameClasses.py
@@ -5,18 +5,16 @@
 
 from FrameClass import DYNAMIC_LEAF, LEAF, NOT_LEAF, AbstractFrame, Frame
 
 FRAME_CLASSES = [
     Frame("BRFrame", "Br", LEAF),
     Frame("nsBCTableCellFrame", "TableCell", NOT_LEAF),
     Frame("nsBackdropFrame", "Backdrop", LEAF),
     Frame("nsBlockFrame", "Block", NOT_LEAF),
-    Frame("nsBox", "None", NOT_LEAF),
-    Frame("nsButtonBoxFrame", "Box", NOT_LEAF),
     Frame("nsCanvasFrame", "Canvas", NOT_LEAF),
     Frame("nsCheckboxRadioFrame", "CheckboxRadio", LEAF),
     Frame("nsColorControlFrame", "ColorControl", LEAF),
     Frame("nsColumnSetFrame", "ColumnSet", NOT_LEAF),
     Frame("ColumnSetWrapperFrame", "ColumnSetWrapper", NOT_LEAF),
     Frame("nsComboboxControlFrame", "ComboboxControl", NOT_LEAF),
     Frame("nsComboboxDisplayFrame", "ComboboxDisplay", NOT_LEAF),
     Frame("nsContinuingTextFrame", "Text", LEAF),
@@ -34,17 +32,16 @@ FRAME_CLASSES = [
     Frame("nsHTMLCanvasFrame", "HTMLCanvas", NOT_LEAF),
     Frame("nsHTMLFramesetBlankFrame", "None", LEAF),
     Frame("nsHTMLFramesetBorderFrame", "None", LEAF),
     Frame("nsHTMLFramesetFrame", "FrameSet", LEAF),
     Frame("nsHTMLScrollFrame", "Scroll", NOT_LEAF),
     Frame("nsImageControlFrame", "ImageControl", LEAF),
     Frame("nsImageFrame", "Image", DYNAMIC_LEAF),
     Frame("nsInlineFrame", "Inline", NOT_LEAF),
-    Frame("nsLeafBoxFrame", "LeafBox", LEAF),
     Frame("nsListControlFrame", "ListControl", NOT_LEAF),
     Frame("nsMathMLFrame", "None", NOT_LEAF),
     Frame("nsMathMLmactionFrame", "None", NOT_LEAF),
     Frame("nsMathMLmathBlockFrame", "Block", NOT_LEAF),
     Frame("nsMathMLmathInlineFrame", "Inline", NOT_LEAF),
     Frame("nsMathMLmencloseFrame", "None", NOT_LEAF),
     Frame("nsMathMLmfracFrame", "None", NOT_LEAF),
     Frame("nsMathMLmmultiscriptsFrame", "None", NOT_LEAF),
@@ -78,17 +75,17 @@ FRAME_CLASSES = [
     Frame("nsRubyTextFrame", "RubyText", NOT_LEAF),
     Frame("SimpleXULLeafFrame", "SimpleXULLeaf", LEAF),
     Frame("nsScrollbarButtonFrame", "SimpleXULLeaf", LEAF),
     Frame("nsScrollbarFrame", "Scrollbar", NOT_LEAF),
     Frame("nsSearchControlFrame", "SearchControl", LEAF),
     Frame("nsSelectsAreaFrame", "Block", NOT_LEAF),
     Frame("nsPageSequenceFrame", "PageSequence", NOT_LEAF),
     Frame("nsSliderFrame", "Slider", NOT_LEAF),
-    Frame("nsSplitterFrame", "Box", NOT_LEAF),
+    Frame("nsSplitterFrame", "SimpleXULLeaf", NOT_LEAF),
     Frame("nsSubDocumentFrame", "SubDocument", LEAF),
     Frame("PrintedSheetFrame", "PrintedSheet", NOT_LEAF),
     Frame("SVGAFrame", "SVGA", NOT_LEAF),
     Frame("SVGClipPathFrame", "SVGClipPath", NOT_LEAF),
     Frame("SVGContainerFrame", "None", NOT_LEAF),
     Frame("SVGFEContainerFrame", "SVGFEContainer", NOT_LEAF),
     Frame("SVGFEImageFrame", "SVGFEImage", LEAF),
     Frame("SVGFELeafFrame", "SVGFELeaf", LEAF),
@@ -121,17 +118,17 @@ FRAME_CLASSES = [
     Frame("nsTableColFrame", "TableCol", LEAF),
     Frame("nsTableColGroupFrame", "TableColGroup", NOT_LEAF),
     Frame("nsTableFrame", "Table", NOT_LEAF),
     Frame("nsTableWrapperFrame", "TableWrapper", NOT_LEAF),
     Frame("nsTableRowFrame", "TableRow", NOT_LEAF),
     Frame("nsTableRowGroupFrame", "TableRowGroup", NOT_LEAF),
     Frame("nsTextControlFrame", "TextInput", LEAF),
     Frame("nsTextFrame", "Text", LEAF),
-    Frame("nsTreeBodyFrame", "LeafBox", LEAF),
+    Frame("nsTreeBodyFrame", "SimpleXULLeaf", LEAF),
     Frame("nsVideoFrame", "HTMLVideo", NOT_LEAF),
     Frame("ViewportFrame", "Viewport", NOT_LEAF),
     Frame("WBRFrame", "Wbr", LEAF),
     # Non-concrete classes (for FrameIID use)
     AbstractFrame("MiddleCroppingBlockFrame"),
     AbstractFrame("nsContainerFrame"),
     AbstractFrame("nsLeafFrame"),
     AbstractFrame("nsMathMLContainerFrame"),
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -692,18 +692,17 @@ void ReflowInput::InitResizeFlags(nsPres
   }
 
   bool dependsOnCBBSize = (mStylePosition->BSizeDependsOnContainer(wm) &&
                            // FIXME: condition this on not-abspos?
                            !mStylePosition->BSize(wm).IsAuto()) ||
                           mStylePosition->MinBSizeDependsOnContainer(wm) ||
                           mStylePosition->MaxBSizeDependsOnContainer(wm) ||
                           mStylePosition->mOffset.GetBStart(wm).HasPercent() ||
-                          !mStylePosition->mOffset.GetBEnd(wm).IsAuto() ||
-                          mFrame->IsXULBoxFrame();
+                          !mStylePosition->mOffset.GetBEnd(wm).IsAuto();
 
   // If mFrame is a flex item, and mFrame's block axis is the flex container's
   // main axis (e.g. in a column-oriented flex container with same
   // writing-mode), then its block-size depends on its CB size, if its
   // flex-basis has a percentage.
   if (mFrame->IsFlexItem() &&
       !nsFlexContainerFrame::IsItemInlineAxisMainAxis(mFrame)) {
     const auto& flexBasis = mStylePosition->mFlexBasis;
@@ -1036,22 +1035,16 @@ void ReflowInput::ApplyRelativePositioni
   nsPoint pos =
       aPosition->GetPhysicalPoint(aWritingMode, aContainerSize - frameSize);
   ApplyRelativePositioning(
       aFrame, aComputedOffsets.GetPhysicalMargin(aWritingMode), &pos);
   *aPosition =
       mozilla::LogicalPoint(aWritingMode, pos, aContainerSize - frameSize);
 }
 
-// Returns true if aFrame is non-null, a XUL frame, and "XUL-collapsed" (which
-// only becomes a valid question to ask if we know it's a XUL frame).
-static bool IsXULCollapsedXULFrame(nsIFrame* aFrame) {
-  return aFrame && aFrame->IsXULBoxFrame() && aFrame->IsXULCollapsed();
-}
-
 nsIFrame* ReflowInput::GetHypotheticalBoxContainer(nsIFrame* aFrame,
                                                    nscoord& aCBIStartEdge,
                                                    LogicalSize& aCBSize) const {
   aFrame = aFrame->GetContainingBlock();
   NS_ASSERTION(aFrame != mFrame, "How did that happen?");
 
   /* Now aFrame is the containing block we want */
 
@@ -1076,31 +1069,20 @@ nsIFrame* ReflowInput::GetHypotheticalBo
   } else {
     /* Didn't find a reflow reflowInput for aFrame.  Just compute the
        information we want, on the assumption that aFrame already knows its
        size.  This really ought to be true by now. */
     NS_ASSERTION(!aFrame->HasAnyStateBits(NS_FRAME_IN_REFLOW),
                  "aFrame shouldn't be in reflow; we'll lie if it is");
     WritingMode wm = aFrame->GetWritingMode();
     // Compute CB's offset & content-box size by subtracting borderpadding from
-    // frame size.  Exception: if the CB is 0-sized, it *might* be a child of a
-    // XUL-collapsed frame and might have nonzero borderpadding that was simply
-    // discarded during its layout. (See the child-zero-sizing in
-    // nsSprocketLayout::XULLayout()).  In that case, we ignore the
-    // borderpadding here (just like we did when laying it out), or else we'd
-    // produce a bogus negative content-box size.
-    aCBIStartEdge = 0;
-    aCBSize = aFrame->GetLogicalSize(wm);
-    if (!aCBSize.IsAllZero() || !IsXULCollapsedXULFrame(aFrame->GetParent())) {
-      // aFrame is not XUL-collapsed (nor is it a child of a XUL-collapsed
-      // frame), so we can go ahead and subtract out border padding.
-      LogicalMargin borderPadding = aFrame->GetLogicalUsedBorderAndPadding(wm);
-      aCBIStartEdge += borderPadding.IStart(wm);
-      aCBSize -= borderPadding.Size(wm);
-    }
+    // frame size.
+    const auto& bp = aFrame->GetLogicalUsedBorderAndPadding(wm);
+    aCBIStartEdge = bp.IStart(wm);
+    aCBSize = aFrame->GetLogicalSize(wm) - bp.Size(wm);
   }
 
   return aFrame;
 }
 
 struct nsHypotheticalPosition {
   // offset from inline-start edge of containing block (which is a padding edge)
   nscoord mIStart;
@@ -2147,21 +2129,16 @@ LogicalSize ReflowInput::ComputeContaini
 
 // XXX refactor this code to have methods for each set of properties
 // we are computing: width,height,line-height; margin; offsets
 
 void ReflowInput::InitConstraints(
     nsPresContext* aPresContext, const Maybe<LogicalSize>& aContainingBlockSize,
     const Maybe<LogicalMargin>& aBorder, const Maybe<LogicalMargin>& aPadding,
     LayoutFrameType aFrameType) {
-  MOZ_ASSERT(!mStyleDisplay->IsFloating(mFrame) ||
-                 (mStyleDisplay->mDisplay != StyleDisplay::MozBox &&
-                  mStyleDisplay->mDisplay != StyleDisplay::MozInlineBox),
-             "Please don't try to float a -moz-box or a -moz-inline-box");
-
   WritingMode wm = GetWritingMode();
   LogicalSize cbSize = aContainingBlockSize.valueOr(
       LogicalSize(mWritingMode, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE));
   DISPLAY_INIT_CONSTRAINTS(mFrame, this, cbSize.ISize(wm), cbSize.BSize(wm),
                            aBorder, aPadding);
 
   // If this is a reflow root, then set the computed width and
   // height equal to the available space
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -30,17 +30,16 @@
 #include "nsGkAtoms.h"
 #include "nsViewManager.h"
 #include "nsIWidget.h"
 #include "nsCanvasFrame.h"
 #include "nsCSSRendering.h"
 #include "nsError.h"
 #include "nsDisplayList.h"
 #include "nsIBaseWindow.h"
-#include "nsBoxLayoutState.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsBlockFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "mozilla/AutoRestore.h"
 #include "nsIFrameInlines.h"
 #include "nsPrintfCString.h"
 #include "mozilla/webrender/WebRenderAPI.h"
 #include <algorithm>
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -49,17 +49,16 @@ static mozilla::LazyLogModule gFlexConta
 // Returns true if aFlexContainer is a frame for some element that has
 // display:-webkit-{inline-}box (or -moz-{inline-}box). aFlexContainer is
 // expected to be an instance of nsFlexContainerFrame (enforced with an assert);
 // otherwise, this function's state-bit-check here is bogus.
 static bool IsLegacyBox(const nsIFrame* aFlexContainer) {
   MOZ_ASSERT(aFlexContainer->IsFlexContainerFrame(),
              "only flex containers may be passed to this function");
   return aFlexContainer->HasAnyStateBits(
-      NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX |
       NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
 }
 
 // Returns the OrderState enum we should pass to CSSOrderAwareFrameIterator
 // (depending on whether aFlexContainer has
 // NS_STATE_FLEX_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER state bit).
 static CSSOrderAwareFrameIterator::OrderState OrderStateForIter(
     const nsFlexContainerFrame* aFlexContainer) {
@@ -2742,19 +2741,17 @@ void nsFlexContainerFrame::Init(nsIConte
                "The only way a nsFlexContainerFrame can have 'display:block' "
                "should be if it's the inner part of a scrollable or button "
                "element");
     displayInside = GetParent()->StyleDisplay()->DisplayInside();
   }
 
   // Figure out if we should set a frame state bit to indicate that this frame
   // represents a legacy -moz-{inline-}box or -webkit-{inline-}box container.
-  if (displayInside == StyleDisplayInside::MozBox) {
-    AddStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX);
-  } else if (displayInside == StyleDisplayInside::WebkitBox) {
+  if (displayInside == StyleDisplayInside::WebkitBox) {
     AddStateBits(NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
   }
 }
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult nsFlexContainerFrame::GetFrameName(nsAString& aResult) const {
   return MakeFrameName(u"FlexContainer"_ns, aResult);
 }
@@ -3845,17 +3842,17 @@ FlexboxAxisInfo::FlexboxAxisInfo(const n
     InitAxesFromModernProps(aFlexContainer);
   }
 }
 
 void FlexboxAxisInfo::InitAxesFromLegacyProps(const nsIFrame* aFlexContainer) {
   const nsStyleXUL* styleXUL = aFlexContainer->StyleXUL();
 
   const bool boxOrientIsVertical =
-      (styleXUL->mBoxOrient == StyleBoxOrient::Vertical);
+      styleXUL->mBoxOrient == StyleBoxOrient::Vertical;
   const bool wmIsVertical = aFlexContainer->GetWritingMode().IsVertical();
 
   // If box-orient agrees with our writing-mode, then we're "row-oriented"
   // (i.e. the flexbox main axis is the same as our writing mode's inline
   // direction).  Otherwise, we're column-oriented (i.e. the flexbox's main
   // axis is perpendicular to the writing-mode's inline direction).
   mIsRowOriented = (boxOrientIsVertical == wmIsVertical);
 
@@ -4927,17 +4924,17 @@ bool nsFlexContainerFrame::IsItemInlineA
   const WritingMode flexItemWM = aFrame->GetWritingMode();
   const nsIFrame* flexContainer = aFrame->GetParent();
 
   if (IsLegacyBox(flexContainer)) {
     // For legacy boxes, the main axis is determined by "box-orient", and we can
     // just directly check if that's vertical, and compare that to whether the
     // item's WM is also vertical:
     bool boxOrientIsVertical =
-        (flexContainer->StyleXUL()->mBoxOrient == StyleBoxOrient::Vertical);
+        flexContainer->StyleXUL()->mBoxOrient == StyleBoxOrient::Vertical;
     return flexItemWM.IsVertical() == boxOrientIsVertical;
   }
 
   // For modern CSS flexbox, we get our return value by asking two questions
   // and comparing their answers.
   // Question 1: does aFrame have the same inline axis as its flex container?
   bool itemInlineAxisIsParallelToParent =
       !flexItemWM.IsOrthogonalTo(flexContainer->GetWritingMode());
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -318,34 +318,30 @@ FRAME_STATE_BIT(Generic, 59, NS_FRAME_IS
 FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame)
 
 // True iff the normal flow children are already in CSS 'order' in the
 // order they occur in the child frame list.
 FRAME_STATE_BIT(FlexContainer, 20,
                 NS_STATE_FLEX_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER)
 
 // Set for a flex container that is emulating a legacy
-// 'display:-moz-{inline-}box' container.
-FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX)
-
-// Set for a flex container that is emulating a legacy
 // 'display:-webkit-{inline-}box'.
-FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX)
+FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX)
 
 // True if the container has no flex items; may lie if there is a pending reflow
-FRAME_STATE_BIT(FlexContainer, 23, NS_STATE_FLEX_SYNTHESIZE_BASELINE)
+FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_SYNTHESIZE_BASELINE)
 
 // True iff some first-in-flow in-flow children were pushed.
 // Note that those child frames may have been removed without this bit
 // being updated for performance reasons, so code shouldn't depend on
 // actually finding any pushed items when this bit is set.
-FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_DID_PUSH_ITEMS)
+FRAME_STATE_BIT(FlexContainer, 23, NS_STATE_FLEX_DID_PUSH_ITEMS)
 
 // We've merged some OverflowList children since last reflow.
-FRAME_STATE_BIT(FlexContainer, 25, NS_STATE_FLEX_HAS_CHILD_NIFS)
+FRAME_STATE_BIT(FlexContainer, 24, NS_STATE_FLEX_HAS_CHILD_NIFS)
 
 // == Frame state bits that apply to grid container frames ====================
 
 FRAME_STATE_GROUP(GridContainer, nsGridContainerFrame)
 
 // True iff the normal flow children are already in CSS 'order' in the
 // order they occur in the child frame list.
 FRAME_STATE_BIT(GridContainer, 20,
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -19,17 +19,16 @@
 #include "nsViewportInfo.h"
 #include "nsContainerFrame.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "mozilla/intl/BidiEmbeddingLevel.h"
 #include "mozilla/dom/DocumentInlines.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "nsFontMetrics.h"
-#include "nsBoxLayoutState.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "nsScrollbarFrame.h"
 #include "nsINode.h"
 #include "nsIScrollbarMediator.h"
 #include "nsITextControlFrame.h"
 #include "nsILayoutHistoryState.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
@@ -530,29 +529,27 @@ ScrollReflowInput::ScrollReflowInput(nsH
 
   if (nsScrollbarFrame* scrollbar = aFrame->GetScrollbarBox(false)) {
     scrollbar->SetScrollbarMediatorContent(mReflowInput.mFrame->GetContent());
     mHScrollbarPrefSize = scrollbar->ScrollbarMinSize();
     // A zero minimum size is a bug with non-overlay scrollbars. That means
     // we'll always try to place the scrollbar, even if it will ultimately not
     // fit, see bug 1809630. XUL collapsing is the exception because the
     // front-end uses it.
-    MOZ_ASSERT(scrollbar->IsXULCollapsed() ||
-                   (mHScrollbarPrefSize.width && mHScrollbarPrefSize.height),
+    MOZ_ASSERT(mHScrollbarPrefSize.width && mHScrollbarPrefSize.height,
                "Shouldn't have a zero horizontal scrollbar-size");
   } else {
     mHScrollbar = ShowScrollbar::Never;
     mHScrollbarAllowedForScrollingVVInsideLV = false;
   }
   if (nsScrollbarFrame* scrollbar = aFrame->GetScrollbarBox(true)) {
     scrollbar->SetScrollbarMediatorContent(mReflowInput.mFrame->GetContent());
     mVScrollbarPrefSize = scrollbar->ScrollbarMinSize();
     // See above.
-    MOZ_ASSERT(scrollbar->IsXULCollapsed() ||
-                   (mVScrollbarPrefSize.width && mVScrollbarPrefSize.height),
+    MOZ_ASSERT(mVScrollbarPrefSize.width && mVScrollbarPrefSize.height,
                "Shouldn't have a zero vertical scrollbar-size");
   } else {
     mVScrollbar = ShowScrollbar::Never;
     mVScrollbarAllowedForScrollingVVInsideLV = false;
   }
 
   const auto* scrollbarStyle =
       nsLayoutUtils::StyleForScrollbar(mReflowInput.mFrame);
@@ -1279,29 +1276,16 @@ nscoord nsHTMLScrollFrame::GetPrefISize(
   nscoord result = containISize
                        ? *containISize
                        : mScrolledFrame->GetPrefISize(aRenderingContext);
   DISPLAY_PREF_INLINE_SIZE(this, result);
   return NSCoordSaturatingAdd(
       result, IntrinsicScrollbarGutterSizeAtInlineEdges(aRenderingContext));
 }
 
-nsresult nsHTMLScrollFrame::GetXULPadding(nsMargin& aMargin) {
-  // Our padding hangs out on the inside of the scrollframe, but XUL doesn't
-  // realize that.
-  // TODO: Remove as more XUL layout is removed.
-  aMargin.SizeTo(0, 0, 0, 0);
-  return NS_OK;
-}
-
-bool nsHTMLScrollFrame::IsXULCollapsed() {
-  // We're never collapsed in the box sense.
-  return false;
-}
-
 // When we have perspective set on the outer scroll frame, and transformed
 // children (possibly with preserve-3d) then the effective transform on the
 // child depends on the offset to the scroll frame, which changes as we scroll.
 // This perspective transform can cause the element to move relative to the
 // scrolled inner frame, which would cause the scrollable length changes during
 // scrolling if we didn't account for it. Since we don't want scrollHeight/Width
 // and the size of scrollbar thumbs to change during scrolling, we compute the
 // scrollable overflow by determining the scroll position at which the child
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -12,17 +12,16 @@
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsIStatefulFrame.h"
 #include "nsThreadUtils.h"
 #include "nsIReflowCallback.h"
-#include "nsBoxLayoutState.h"
 #include "nsQueryFrame.h"
 #include "nsExpirationTracker.h"
 #include "TextOverflow.h"
 #include "ScrollVelocityQueue.h"
 #include "mozilla/ScrollTypes.h"
 #include "mozilla/PresState.h"
 #include "mozilla/layout/ScrollAnchorContainer.h"
 #include "mozilla/TypedEnumBits.h"
@@ -112,18 +111,16 @@ class nsHTMLScrollFrame : public nsConta
   nscoord IntrinsicScrollbarGutterSizeAtInlineEdges(
       gfxContext* aRenderingContext);
 
   bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
                       Sides aSkipSides, nscoord aRadii[8]) const final;
 
   nscoord GetMinISize(gfxContext* aRenderingContext) override;
   nscoord GetPrefISize(gfxContext* aRenderingContext) override;
-  nsresult GetXULPadding(nsMargin& aPadding) final;
-  bool IsXULCollapsed() final;
 
   void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
               const ReflowInput& aReflowInput,
               nsReflowStatus& aStatus) override;
   void DidReflow(nsPresContext* aPresContext,
                  const ReflowInput* aReflowInput) override;
 
   bool ComputeCustomOverflow(mozilla::OverflowAreas& aOverflowAreas) final;
@@ -158,18 +155,16 @@ class nsHTMLScrollFrame : public nsConta
   nsIScrollableFrame* GetScrollTargetFrame() const final {
     return const_cast<nsHTMLScrollFrame*>(this);
   }
 
   nsContainerFrame* GetContentInsertionFrame() override {
     return GetScrolledFrame()->GetContentInsertionFrame();
   }
 
-  bool DoesClipChildrenInBothAxes() final { return true; }
-
   nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) final {
     nsPoint pt = aChild->GetPosition();
     if (aChild == GetScrolledFrame()) {
       pt += GetScrollPosition();
     }
     return pt;
   }
 
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -22,17 +22,16 @@
 #include "mozilla/dom/GridBinding.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/PodOperations.h"  // for PodZero
 #include "mozilla/Poison.h"
 #include "mozilla/PresShell.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "nsAlgorithm.h"  // for clamped()
-#include "nsBoxLayoutState.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsTHashMap.h"
 #include "nsDisplayList.h"
 #include "nsHashKeys.h"
 #include "nsFieldSetFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsPlaceholderFrame.h"
--- a/layout/generic/nsIFrame.cpp
+++ b/layout/generic/nsIFrame.cpp
@@ -93,17 +93,16 @@
 #include "RubyUtils.h"
 #include "TextOverflow.h"
 #include "nsAnimationManager.h"
 
 // For triple-click pref
 #include "imgIRequest.h"
 #include "nsError.h"
 #include "nsContainerFrame.h"
-#include "nsBoxLayoutState.h"
 #include "nsBlockFrame.h"
 #include "nsDisplayList.h"
 #include "nsChangeHint.h"
 #include "nsSubDocumentFrame.h"
 #include "RetainedDisplayListBuilder.h"
 
 #include "gfxContext.h"
 #include "nsAbsoluteContainingBlock.h"
@@ -184,80 +183,45 @@ const nsIFrame::FrameClassBits nsIFrame:
 #undef FRAME_ID
 #undef ABSTRACT_FRAME_ID
 };
 
 std::ostream& operator<<(std::ostream& aStream, const nsDirection& aDirection) {
   return aStream << (aDirection == eDirNext ? "eDirNext" : "eDirPrevious");
 }
 
-// Struct containing cached metrics for box-wrapped frames.
-struct nsBoxLayoutMetrics {
-  nsSize mPrefSize;
-  nsSize mMinSize;
-  nsSize mMaxSize;
-
-  nsSize mBlockMinSize;
-  nsSize mBlockPrefSize;
-  nscoord mBlockAscent;
-
-  nscoord mAscent;
-
-  nsSize mLastSize;
-};
-
 struct nsContentAndOffset {
   nsIContent* mContent = nullptr;
   int32_t mOffset = 0;
 };
 
 // Some Misc #defines
 #define SELECTION_DEBUG 0
 #define FORCE_SELECTION_UPDATE 1
 #define CALC_DEBUG 0
 
 #include "nsILineIterator.h"
 #include "prenv.h"
 
-NS_DECLARE_FRAME_PROPERTY_DELETABLE(BoxMetricsProperty, nsBoxLayoutMetrics)
-
-static void InitBoxMetrics(nsIFrame* aFrame, bool aClear) {
-  if (aClear) {
-    aFrame->RemoveProperty(BoxMetricsProperty());
-  }
-
-  nsBoxLayoutMetrics* metrics = new nsBoxLayoutMetrics();
-  aFrame->SetProperty(BoxMetricsProperty(), metrics);
-
-  aFrame->nsIFrame::MarkIntrinsicISizesDirty();
-  metrics->mBlockAscent = 0;
-  metrics->mLastSize.SizeTo(0, 0);
-}
-
 // Utility function to set a nsRect-valued property table entry on aFrame,
 // reusing the existing storage if the property happens to be already set.
 template <typename T>
 static void SetOrUpdateRectValuedProperty(
     nsIFrame* aFrame, FrameProperties::Descriptor<T> aProperty,
     const nsRect& aNewValue) {
   bool found;
   nsRect* rectStorage = aFrame->GetProperty(aProperty, &found);
   if (!found) {
     rectStorage = new nsRect(aNewValue);
     aFrame->AddProperty(aProperty, rectStorage);
   } else {
     *rectStorage = aNewValue;
   }
 }
 
-static bool IsXULBoxWrapped(const nsIFrame* aFrame) {
-  return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame() &&
-         !aFrame->IsXULBoxFrame();
-}
-
 /* static */
 void nsIFrame::DestroyAnonymousContent(
     nsPresContext* aPresContext, already_AddRefed<nsIContent>&& aContent) {
   if (nsCOMPtr<nsIContent> content = aContent) {
     aPresContext->EventStateManager()->NativeAnonymousContentRemoved(content);
     aPresContext->PresShell()->NativeAnonymousContentRemoved(content);
     content->UnbindFromTree();
   }
@@ -562,18 +526,17 @@ static bool IsFontSizeInflationContainer
        // Given multiple frames for the same node, only the
        // outer one should be considered a container.
        // (Important, e.g., for nsSelectsAreaFrame.)
        (aFrame->GetParent()->GetContent() == content) ||
        (content &&
         // Form controls shouldn't become inflation containers.
         (content->IsAnyOfHTMLElements(
             nsGkAtoms::option, nsGkAtoms::optgroup, nsGkAtoms::select,
-            nsGkAtoms::input, nsGkAtoms::button, nsGkAtoms::textarea)))) &&
-      !(aFrame->IsXULBoxFrame() && aFrame->GetParent()->IsXULBoxFrame());
+            nsGkAtoms::input, nsGkAtoms::button, nsGkAtoms::textarea))));
   NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) || isInline ||
                    // br frames and mathml frames report being line
                    // participants even when their position or display is
                    // set
                    aFrame->IsBrFrame() ||
                    aFrame->IsFrameOfType(nsIFrame::eMathML),
                "line participants must not be containers");
   return !isInline;
@@ -769,18 +732,16 @@ void nsIFrame::Init(nsIContent* aContent
   }
 
   if (PresShell()->AssumeAllFramesVisible() && TrackingVisibility()) {
     IncApproximateVisibleCount();
   }
 
   DidSetComputedStyle(nullptr);
 
-  if (::IsXULBoxWrapped(this)) ::InitBoxMetrics(this, false);
-
   // For a newly created frame, we need to update this frame's visibility state.
   // Usually we update the state when the frame is restyled and has a
   // VisibilityChange change hint but we don't generate any change hints for
   // newly created frames.
   // Note: We don't need to do this for placeholders since placeholders have
   // different styles so that the styles don't have visibility:hidden even if
   // the parent has visibility:hidden style. We also don't need to update the
   // state when creating continuations because its visibility is the same as its
@@ -2485,18 +2446,17 @@ bool nsIFrame::CanBeDynamicReflowRoot() 
   if (!StaticPrefs::layout_dynamic_reflow_roots_enabled()) {
     return false;
   }
 
   auto& display = *StyleDisplay();
   if (IsFrameOfType(nsIFrame::eLineParticipant) ||
       nsStyleDisplay::IsRubyDisplayType(display.mDisplay) ||
       display.DisplayOutside() == StyleDisplayOutside::InternalTable ||
-      display.DisplayInside() == StyleDisplayInside::Table ||
-      (GetParent() && GetParent()->IsXULBoxFrame())) {
+      display.DisplayInside() == StyleDisplayInside::Table) {
     // We have a display type where 'width' and 'height' don't actually set the
     // width or height (i.e., the size depends on content).
     MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_DYNAMIC_REFLOW_ROOT),
                "should not have dynamic reflow root bit");
     return false;
   }
 
   // We can't serve as a dynamic reflow root if our used 'width' and 'height'
@@ -5883,29 +5843,16 @@ Maybe<nsIFrame::Cursor> nsIFrame::GetCur
 
   return Some(Cursor{kind, AllowCustomCursorImage::Yes});
 }
 
 // Resize and incremental reflow
 
 /* virtual */
 void nsIFrame::MarkIntrinsicISizesDirty() {
-  // This version is meant only for what used to be box-to-block adaptors.
-  // It should not be called by other derived classes.
-  if (::IsXULBoxWrapped(this)) {
-    nsBoxLayoutMetrics* metrics = BoxMetrics();
-
-    XULSizeNeedsRecalc(metrics->mPrefSize);
-    XULSizeNeedsRecalc(metrics->mMinSize);
-    XULSizeNeedsRecalc(metrics->mMaxSize);
-    XULSizeNeedsRecalc(metrics->mBlockPrefSize);
-    XULSizeNeedsRecalc(metrics->mBlockMinSize);
-    XULCoordNeedsRecalc(metrics->mAscent);
-  }
-
   // If we're a flex item, clear our flex-item-specific cached measurements
   // (which likely depended on our now-stale intrinsic isize).
   if (IsFlexItem()) {
     nsFlexContainerFrame::MarkCachedFlexMeasurementsDirty(this);
   }
 
   if (HasAnyStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT)) {
     nsFontInflationData::MarkFontInflationDataTextDirty(this);
@@ -5930,18 +5877,17 @@ void nsIFrame::MarkSubtreeDirty() {
   AutoTArray<nsIFrame*, 32> stack;
   for (const auto& childLists : ChildLists()) {
     for (nsIFrame* kid : childLists.mList) {
       stack.AppendElement(kid);
     }
   }
   while (!stack.IsEmpty()) {
     nsIFrame* f = stack.PopLastElement();
-    if (f->HasAnyStateBits(NS_FRAME_IS_DIRTY) || f->IsTableColGroupFrame() ||
-        f->IsXULBoxFrame()) {
+    if (f->HasAnyStateBits(NS_FRAME_IS_DIRTY) || f->IsTableColGroupFrame()) {
       continue;
     }
 
     f->AddStateBits(NS_FRAME_IS_DIRTY);
 
     for (const auto& childLists : f->ChildLists()) {
       for (nsIFrame* kid : childLists.mList) {
         stack.AppendElement(kid);
@@ -6344,18 +6290,17 @@ nsIFrame::SizeComputationResult nsIFrame
     if (isGridItem) {
       // When resolving justify/align-self below, we want to use the grid
       // container's justify/align-items value and WritingMode.
       alignCB = grandParent;
     }
   }
   const bool isFlexItem =
       IsFlexItem() && !parentFrame->HasAnyStateBits(
-                          NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX |
-                          NS_STATE_FLEX_IS_EMULATING_LEGACY_MOZ_BOX);
+                          NS_STATE_FLEX_IS_EMULATING_LEGACY_WEBKIT_BOX);
   // This variable only gets set (and used) if isFlexItem is true.  It
   // indicates which axis (in this frame's own WM) corresponds to its
   // flex container's main axis.
   LogicalAxis flexMainAxis =
       eLogicalAxisInline;  // (init to make valgrind happy)
   if (isFlexItem) {
     flexMainAxis = nsFlexContainerFrame::IsItemInlineAxisMainAxis(this)
                        ? eLogicalAxisInline
@@ -7938,24 +7883,20 @@ bool nsIFrame::UpdateOverflow() {
     // have scheduled any necessary reflows. We can return false to say nothing
     // changed, and wait for reflow to correct it.
     return false;
   }
 
   UnionChildOverflow(overflowAreas);
 
   if (FinishAndStoreOverflow(overflowAreas, GetSize())) {
-    nsView* view = GetView();
-    if (view) {
-      ReflowChildFlags flags = GetXULLayoutFlags();
-      if (!(flags & ReflowChildFlags::NoSizeView)) {
-        // Make sure the frame's view is properly sized.
-        nsViewManager* vm = view->GetViewManager();
-        vm->ResizeView(view, overflowAreas.InkOverflow(), true);
-      }
+    if (nsView* view = GetView()) {
+      // Make sure the frame's view is properly sized.
+      nsViewManager* vm = view->GetViewManager();
+      vm->ResizeView(view, overflowAreas.InkOverflow(), true);
     }
 
     return true;
   }
 
   // Frames that combine their 3d transform with their ancestors
   // only compute a pre-transform overflow rect, and then contribute
   // to the normal overflow rect of the preserve-3d root. Always return
@@ -7964,20 +7905,26 @@ bool nsIFrame::UpdateOverflow() {
   return Combines3DTransformWithAncestors();
 }
 
 /* virtual */
 bool nsIFrame::ComputeCustomOverflow(OverflowAreas& aOverflowAreas) {
   return true;
 }
 
+bool nsIFrame::DoesClipChildrenInBothAxes() const {
+  nsIScrollableFrame* sf = do_QueryFrame(this);
+  const nsStyleDisplay* display = StyleDisplay();
+  return sf || (display->mOverflowX == StyleOverflow::Clip &&
+                display->mOverflowY == StyleOverflow::Clip);
+}
+
 /* virtual */
 void nsIFrame::UnionChildOverflow(OverflowAreas& aOverflowAreas) {
-  if (!DoesClipChildrenInBothAxes() &&
-      !(IsXULCollapsed() && (IsXULBoxFrame() || ::IsXULBoxWrapped(this)))) {
+  if (!DoesClipChildrenInBothAxes()) {
     nsLayoutUtils::UnionChildOverflow(this, aOverflowAreas);
   }
 }
 
 // Return true if this form control element's preferred size property (but not
 // percentage max size property) contains a percentage value that should be
 // resolved against zero when calculating its min-content contribution in the
 // corresponding axis.
@@ -10083,29 +10030,16 @@ bool nsIFrame::FinishAndStoreOverflow(Ov
   // dimension(s). 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 size here.
   if (overflowClipAxes != PhysicalAxes::None) {
     aOverflowAreas.ApplyClipping(bounds, overflowClipAxes,
                                  OverflowClipMargin(overflowClipAxes));
   }
 
-  // Note that StyleOverflow::Clip 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->Theme()->GetWidgetOverflow(
-            presContext->DeviceContext(), this, disp->EffectiveAppearance(),
-            &r)) {
-      nsRect& vo = aOverflowAreas.InkOverflow();
-      vo = vo.UnionEdges(r);
-    }
-  }
-
   ComputeAndIncludeOutlineArea(this, aOverflowAreas, aNewSize);
 
   // Nothing in here should affect scrollable overflow.
   aOverflowAreas.InkOverflow() =
       ComputeEffectsRect(this, aOverflowAreas.InkOverflow(), aNewSize);
 
   // Absolute position clipping
   const nsStyleEffects* effects = StyleEffects();
@@ -10696,510 +10630,16 @@ Maybe<StyleVerticalAlignKeyword> nsIFram
   const auto& verticalAlign = StyleDisplay()->mVerticalAlign;
   if (verticalAlign.IsKeyword()) {
     return Some(verticalAlign.AsKeyword());
   }
 
   return Nothing();
 }
 
-NS_IMETHODIMP
-nsIFrame::RefreshSizeCache(nsBoxLayoutState& aState) {
-  // XXXbz this comment needs some rewriting to make sense in the
-  // post-reflow-branch world.
-
-  // Ok we need to compute our minimum, preferred, and maximum sizes.
-  // 1) Maximum size. This is easy. Its infinite unless it is overloaded by CSS.
-  // 2) Preferred size. This is a little harder. This is the size the
-  //    block would be if it were laid out on an infinite canvas. So we can
-  //    get this by reflowing the block with and INTRINSIC width and height. We
-  //    can also do a nice optimization for incremental reflow. If the reflow is
-  //    incremental then we can pass a flag to have the block compute the
-  //    preferred width for us! Preferred height can just be the minimum height;
-  // 3) Minimum size. This is a toughy. We can pass the block a flag asking for
-  //    the max element size. That would give us the width. Unfortunately you
-  //    can only ask for a maxElementSize during an incremental reflow. So on
-  //    other reflows we will just have to use 0. The min height on the other
-  //    hand is fairly easy we need to get the largest line height. This can be
-  //    done with the line iterator.
-
-  // if we do have a rendering context
-  gfxContext* rendContext = aState.GetRenderingContext();
-  if (rendContext) {
-    nsPresContext* presContext = aState.PresContext();
-
-    // If we don't have any HTML constraints and it's a resize, then nothing in
-    // the block could have changed, so no refresh is necessary.
-    nsBoxLayoutMetrics* metrics = BoxMetrics();
-    if (!XULNeedsRecalc(metrics->mBlockPrefSize)) {
-      return NS_OK;
-    }
-
-    // the rect we plan to size to.
-    nsRect rect = GetRect();
-
-    nsMargin bp(0, 0, 0, 0);
-    GetXULBorderAndPadding(bp);
-
-    {
-      // If we're a container for font size inflation, then shrink
-      // wrapping inside of us should not apply font size inflation.
-      AutoMaybeDisableFontInflation an(this);
-
-      metrics->mBlockPrefSize.width =
-          GetPrefISize(rendContext) + bp.LeftRight();
-      metrics->mBlockMinSize.width = GetMinISize(rendContext) + bp.LeftRight();
-    }
-
-    // do the nasty.
-    const WritingMode wm = aState.OuterReflowInput()
-                               ? aState.OuterReflowInput()->GetWritingMode()
-                               : GetWritingMode();
-    ReflowOutput desiredSize(wm);
-    BoxReflow(aState, presContext, desiredSize, rendContext, rect.x, rect.y,
-              metrics->mBlockPrefSize.width, NS_UNCONSTRAINEDSIZE);
-
-    metrics->mBlockMinSize.height = 0;
-    // ok we need the max ascent of the items on the line. So to do this
-    // ask the block for its line iterator. Get the max ascent.
-    AutoAssertNoDomMutations guard;
-    if (IsBlockFrameOrSubclass()) {
-      nsILineIterator* lines = GetLineIterator();
-      MOZ_ASSERT(lines);
-      metrics->mBlockMinSize.height = 0;
-      int32_t lineCount = lines->GetNumLines();
-      for (int32_t i = 0; i < lineCount; ++i) {
-        auto line = lines->GetLine(i).unwrap();
-
-        if (line.mLineBounds.height > metrics->mBlockMinSize.height) {
-          metrics->mBlockMinSize.height = line.mLineBounds.height;
-        }
-      }
-    } else {
-      metrics->mBlockMinSize.height = desiredSize.Height();
-    }
-
-    metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height;
-
-    if (desiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
-      if (!nsLayoutUtils::GetFirstLineBaseline(wm, this,
-                                               &metrics->mBlockAscent))
-        metrics->mBlockAscent = GetLogicalBaseline(wm);
-    } else {
-      metrics->mBlockAscent = desiredSize.BlockStartAscent();
-    }
-
-#ifdef DEBUG_adaptor
-    printf("min=(%d,%d), pref=(%d,%d), ascent=%d\n",
-           metrics->mBlockMinSize.width, metrics->mBlockMinSize.height,
-           metrics->mBlockPrefSize.width, metrics->mBlockPrefSize.height,
-           metrics->mBlockAscent);
-#endif
-  }
-
-  return NS_OK;
-}
-
-nsSize nsIFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
-  nsSize size(0, 0);
-  DISPLAY_PREF_SIZE(this, size);
-  // If the size is cached, and there are no HTML constraints that we might
-  // be depending on, then we just return the cached size.
-  nsBoxLayoutMetrics* metrics = BoxMetrics();
-  if (!XULNeedsRecalc(metrics->mPrefSize)) {
-    size = metrics->mPrefSize;
-    return size;
-  }
-
-  if (IsXULCollapsed()) return size;
-
-  // get our size in CSS.
-  bool widthSet, heightSet;
-  bool completelyRedefined =
-      nsIFrame::AddXULPrefSize(this, size, widthSet, heightSet);
-
-  // Refresh our caches with new sizes.
-  if (!completelyRedefined) {
-    RefreshSizeCache(aState);
-    nsSize blockSize = metrics->mBlockPrefSize;
-
-    // notice we don't need to add our borders or padding
-    // in. That's because the block did it for us.
-    if (!widthSet) size.width = blockSize.width;
-    if (!heightSet) size.height = blockSize.height;
-  }
-
-  metrics->mPrefSize = size;
-  return size;
-}
-
-nsSize nsIFrame::GetXULMinSize(nsBoxLayoutState& aState) {
-  nsSize size(0, 0);
-  DISPLAY_MIN_SIZE(this, size);
-  // Don't use the cache if we have HTMLReflowInput constraints --- they might
-  // have changed
-  nsBoxLayoutMetrics* metrics = BoxMetrics();
-  if (!XULNeedsRecalc(metrics->mMinSize)) {
-    size = metrics->mMinSize;
-    return size;
-  }
-
-  if (IsXULCollapsed()) return size;
-
-  // get our size in CSS.
-  bool widthSet, heightSet;
-  bool completelyRedefined =
-      nsIFrame::AddXULMinSize(this, size, widthSet, heightSet);
-
-  // Refresh our caches with new sizes.
-  if (!completelyRedefined) {
-    RefreshSizeCache(aState);
-    nsSize blockSize = metrics->mBlockMinSize;
-
-    if (!widthSet) size.width = blockSize.width;
-    if (!heightSet) size.height = blockSize.height;
-  }
-
-  metrics->mMinSize = size;
-  return size;
-}
-
-nsSize nsIFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
-  nsSize size(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
-  DISPLAY_MAX_SIZE(this, size);
-  // Don't use the cache if we have HTMLReflowInput constraints --- they might
-  // have changed
-  nsBoxLayoutMetrics* metrics = BoxMetrics();
-  if (!XULNeedsRecalc(metrics->mMaxSize)) {
-    size = metrics->mMaxSize;
-    return size;
-  }
-
-  if (IsXULCollapsed()) return size;
-
-  size = nsIFrame::GetUncachedXULMaxSize(aState);
-  metrics->mMaxSize = size;
-
-  return size;
-}
-
-int32_t nsIFrame::GetXULFlex() const {
-  return clamped(int32_t(StyleXUL()->mBoxFlex), 0, nscoord_MAX - 1);
-}
-
-nscoord nsIFrame::GetXULBoxAscent(nsBoxLayoutState& aState) {
-  nsBoxLayoutMetrics* metrics = BoxMetrics();
-  if (!XULNeedsRecalc(metrics->mAscent)) {
-    return metrics->mAscent;
-  }
-
-  if (IsXULCollapsed()) {
-    metrics->mAscent = 0;
-  } else {
-    // Refresh our caches with new sizes.
-    RefreshSizeCache(aState);
-    metrics->mAscent = metrics->mBlockAscent;
-  }
-
-  return metrics->mAscent;
-}
-
-nsresult nsIFrame::DoXULLayout(nsBoxLayoutState& aState) {
-  nsRect ourRect(mRect);
-
-  gfxContext* rendContext = aState.GetRenderingContext();
-  nsPresContext* presContext = aState.PresContext();
-  WritingMode ourWM = GetWritingMode();
-  const WritingMode outerWM = aState.OuterReflowInput()
-                                  ? aState.OuterReflowInput()->GetWritingMode()
-                                  : ourWM;
-  ReflowOutput desiredSize(outerWM);
-  LogicalSize ourSize = GetLogicalSize(outerWM);
-
-  if (rendContext) {
-    BoxReflow(aState, presContext, desiredSize, rendContext, ourRect.x,
-              ourRect.y, ourRect.width, ourRect.height);
-
-    if (IsXULCollapsed()) {
-      SetSize(nsSize(0, 0));
-    } else {
-      // if our child needs to be bigger. This might happend with
-      // wrapping text. There is no way to predict its height until we
-      // reflow it. Now that we know the height reshuffle upward.
-      if (desiredSize.ISize(outerWM) > ourSize.ISize(outerWM) ||
-          desiredSize.BSize(outerWM) > ourSize.BSize(outerWM)) {
-#ifdef DEBUG_GROW
-        XULDumpBox(stdout);
-        printf(" GREW from (%d,%d) -> (%d,%d)\n", ourSize.ISize(outerWM),
-               ourSize.BSize(outerWM), desiredSize.ISize(outerWM),
-               desiredSize.BSize(outerWM));
-#endif
-
-        if (desiredSize.ISize(outerWM) > ourSize.ISize(outerWM)) {
-          ourSize.ISize(outerWM) = desiredSize.ISize(outerWM);
-        }
-
-        if (desiredSize.BSize(outerWM) > ourSize.BSize(outerWM)) {
-          ourSize.BSize(outerWM) = desiredSize.BSize(outerWM);
-        }
-      }
-
-      // ensure our size is what we think is should be. Someone could have
-      // reset the frame to be smaller or something dumb like that.
-      SetSize(ourSize.ConvertTo(ourWM, outerWM));
-    }
-  }
-
-  // Should we do this if IsXULCollapsed() is true?
-  LogicalSize size(GetLogicalSize(outerWM));
-  desiredSize.ISize(outerWM) = size.ISize(outerWM);
-  desiredSize.BSize(outerWM) = size.BSize(outerWM);
-  desiredSize.UnionOverflowAreasWithDesiredBounds();
-
-  if (HasAbsolutelyPositionedChildren()) {
-    // Set up a |reflowInput| to pass into ReflowAbsoluteFrames
-    ReflowInput reflowInput(aState.PresContext(), this,
-                            aState.GetRenderingContext(),
-                            LogicalSize(ourWM, ISize(), NS_UNCONSTRAINEDSIZE),
-                            ReflowInput::InitFlag::DummyParentReflowInput);
-
-    AddStateBits(NS_FRAME_IN_REFLOW);
-    // Set up a |reflowStatus| to pass into ReflowAbsoluteFrames
-    // (just a dummy value; hopefully that's OK)
-    nsReflowStatus reflowStatus;
-    ReflowAbsoluteFrames(aState.PresContext(), desiredSize, reflowInput,
-                         reflowStatus);
-    RemoveStateBits(NS_FRAME_IN_REFLOW);
-  }
-
-  nsSize oldSize(ourRect.Size());
-  FinishAndStoreOverflow(desiredSize.mOverflowAreas,
-                         size.GetPhysicalSize(outerWM), &oldSize);
-
-  SyncXULLayout(aState);
-
-  return NS_OK;
-}
-
-void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
-                         ReflowOutput& aDesiredSize,
-                         gfxContext* aRenderingContext, nscoord aX, nscoord aY,
-                         nscoord aWidth, nscoord aHeight, bool aMoveFrame) {
-  DO_GLOBAL_REFLOW_COUNT("nsBoxToBlockAdaptor");
-
-  nsBoxLayoutMetrics* metrics = BoxMetrics();
-  if (MOZ_UNLIKELY(!metrics)) {
-    // Can't proceed without BoxMetrics. This should only happen if something
-    // is seriously broken, e.g. if we try to do XUL layout on a non-XUL frame.
-    // (If this is a content process, we'll abort even in release builds,
-    // because XUL layout mixup is extra surprising in content, and aborts are
-    // less catastrophic in content vs. in chrome.)
-    MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(),
-                       "Starting XUL BoxReflow w/o BoxMetrics (in content)?");
-    MOZ_ASSERT_UNREACHABLE("Starting XUL BoxReflow w/o BoxMetrics?");
-    return;
-  }
-
-  nsReflowStatus status;
-
-  bool needsReflow = IsSubtreeDirty();
-
-  // if we don't need a reflow then
-  // lets see if we are already that size. Yes? then don't even reflow. We are
-  // done.
-  if (!needsReflow) {
-    if (aWidth != NS_UNCONSTRAINEDSIZE && aHeight != NS_UNCONSTRAINEDSIZE) {
-      // if the new calculated size has a 0 width or a 0 height
-      if ((metrics->mLastSize.width == 0 || metrics->mLastSize.height == 0) &&
-          (aWidth == 0 || aHeight == 0)) {
-        needsReflow = false;
-        aDesiredSize.Width() = aWidth;
-        aDesiredSize.Height() = aHeight;
-        SetSize(aDesiredSize.Size(GetWritingMode()));
-      } else {
-        aDesiredSize.Width() = metrics->mLastSize.width;
-        aDesiredSize.Height() = metrics->mLastSize.height;
-
-        // remove the margin. The rect of our child does not include it but our
-        // calculated size does. don't reflow if we are already the right size
-        if (metrics->mLastSize.width == aWidth &&
-            metrics->mLastSize.height == aHeight)
-          needsReflow = false;
-        else
-          needsReflow = true;
-      }
-    } else {
-      // if the width or height are intrinsic alway reflow because
-      // we don't know what it should be.
-      needsReflow = true;
-    }
-  }
-
-  // ok now reflow the child into the spacers calculated space
-  if (needsReflow) {
-    aDesiredSize.ClearSize();
-
-    // create a reflow input to tell our child to flow at the given size.
-
-    // Construct a bogus parent reflow input so that there's a usable reflow
-    // input for the containing block.
-    nsMargin margin(0, 0, 0, 0);
-    GetXULMargin(margin);
-
-    nsSize parentSize(aWidth, aHeight);
-    if (parentSize.height != NS_UNCONSTRAINEDSIZE)
-      parentSize.height += margin.TopBottom();
-    if (parentSize.width != NS_UNCONSTRAINEDSIZE)
-      parentSize.width += margin.LeftRight();
-
-    nsIFrame* parentFrame = GetParent();
-    WritingMode parentWM = parentFrame->GetWritingMode();
-    ReflowInput parentReflowInput(
-        aPresContext, parentFrame, aRenderingContext,
-        LogicalSize(parentWM, parentSize),
-        ReflowInput::InitFlag::DummyParentReflowInput);
-
-    // This may not do very much useful, but it's probably worth trying.
-    if (parentSize.width != NS_UNCONSTRAINEDSIZE)
-      parentReflowInput.SetComputedWidth(std::max(parentSize.width, 0));
-    if (parentSize.height != NS_UNCONSTRAINEDSIZE)
-      parentReflowInput.SetComputedHeight(std::max(parentSize.height, 0));
-    parentReflowInput.SetComputedLogicalMargin(parentWM,
-                                               LogicalMargin(parentWM));
-    // XXX use box methods
-    nsMargin padding;
-    parentFrame->GetXULPadding(padding);
-    parentReflowInput.SetComputedLogicalPadding(
-        parentWM, LogicalMargin(parentWM, padding));
-    nsMargin border;
-    parentFrame->GetXULBorder(border);
-    parentReflowInput.SetComputedLogicalBorderPadding(
-        parentWM, LogicalMargin(parentWM, border + padding));
-
-    // Construct the parent chain manually since constructing it normally
-    // messes up dimensions.
-    const ReflowInput* outerReflowInput = aState.OuterReflowInput();
-    NS_ASSERTION(!outerReflowInput || outerReflowInput->mFrame != this,
-                 "in and out of XUL on a single frame?");
-    const ReflowInput* parentRI;
-    if (outerReflowInput && outerReflowInput->mFrame == parentFrame) {
-      // We're a frame (such as a text control frame) that jumps into
-      // box reflow and then straight out of it on the child frame.
-      // This means we actually have a real parent reflow input.
-      // nsLayoutUtils::InflationMinFontSizeFor used to need this to be
-      // linked up correctly for text control frames, so do so here).
-      parentRI = outerReflowInput;
-    } else {
-      parentRI = &parentReflowInput;
-    }
-
-    // XXX Is it OK that this reflow input has only one ancestor?
-    // (It used to have a bogus parent, skipping all the boxes).
-    WritingMode wm = GetWritingMode();
-    LogicalSize logicalSize(wm, nsSize(aWidth, aHeight));
-    logicalSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
-    ReflowInput reflowInput(aPresContext, *parentRI, this, logicalSize,
-                            Nothing(),
-                            ReflowInput::InitFlag::DummyParentReflowInput);
-
-    // XXX_jwir3: This is somewhat fishy. If this is actually changing the value
-    //            here (which it might be), then we should make sure that it's
-    //            correct the first time around, rather than changing it later.
-    reflowInput.mCBReflowInput = parentRI;
-
-    reflowInput.mReflowDepth = aState.GetReflowDepth();
-
-    // mComputedWidth and mComputedHeight are content-box, not
-    // border-box
-    if (aWidth != NS_UNCONSTRAINEDSIZE) {
-      nscoord computedWidth =
-          aWidth - reflowInput.ComputedPhysicalBorderPadding().LeftRight();
-      computedWidth = std::max(computedWidth, 0);
-      reflowInput.SetComputedWidth(computedWidth);
-    }
-
-    // Most child frames of box frames (e.g. subdocument or scroll frames)
-    // need to be constrained to the provided size and overflow as necessary.
-    // The one exception are block frames, because we need to know their
-    // natural height excluding any overflow area which may be caused by
-    // various CSS effects such as shadow or outline.
-    if (!IsBlockFrameOrSubclass()) {
-      if (aHeight != NS_UNCONSTRAINEDSIZE) {
-        nscoord computedHeight =
-            aHeight - reflowInput.ComputedPhysicalBorderPadding().TopBottom();
-        computedHeight = std::max(computedHeight, 0);
-        reflowInput.SetComputedHeight(computedHeight);
-      } else {
-        reflowInput.SetComputedHeight(
-            ComputeSize(
-                aRenderingContext, wm, logicalSize, logicalSize.ISize(wm),
-                reflowInput.ComputedLogicalMargin(wm).Size(wm),
-                reflowInput.ComputedLogicalBorderPadding(wm).Size(wm), {}, {})
-                .mLogicalSize.Height(wm));
-      }
-    }
-
-    // Box layout calls SetRect before XULLayout, whereas non-box layout
-    // calls SetRect after Reflow.
-    // XXX Perhaps we should be doing this by twiddling the rect back to
-    // mLastSize before calling Reflow and then switching it back, but
-    // However, mLastSize can also be the size passed to BoxReflow by
-    // RefreshSizeCache, so that doesn't really make sense.
-    if (metrics->mLastSize.width != aWidth) {
-      reflowInput.SetHResize(true);
-
-      // When font size inflation is enabled, a horizontal resize
-      // requires a full reflow.  See ReflowInput::InitResizeFlags
-      // for more details.
-      if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
-        this->MarkSubtreeDirty();
-      }
-    }
-    if (metrics->mLastSize.height != aHeight) {
-      reflowInput.SetVResize(true);
-    }
-
-    // place the child and reflow
-
-    Reflow(aPresContext, aDesiredSize, reflowInput, status);
-
-    NS_ASSERTION(status.IsComplete(), "bad status");
-
-    ReflowChildFlags layoutFlags = aState.LayoutFlags();
-    nsContainerFrame::FinishReflowChild(
-        this, aPresContext, aDesiredSize, &reflowInput, aX, aY,
-        layoutFlags | ReflowChildFlags::NoMoveFrame);
-
-    // Save the ascent.  (bug 103925)
-    if (IsXULCollapsed()) {
-      metrics->mAscent = 0;
-    } else {
-      if (aDesiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
-        if (!nsLayoutUtils::GetFirstLineBaseline(wm, this, &metrics->mAscent))
-          metrics->mAscent = GetLogicalBaseline(wm);
-      } else
-        metrics->mAscent = aDesiredSize.BlockStartAscent();
-    }
-
-  } else {
-    aDesiredSize.SetBlockStartAscent(metrics->mBlockAscent);
-  }
-
-  metrics->mLastSize.width = aDesiredSize.Width();
-  metrics->mLastSize.height = aDesiredSize.Height();
-}
-
-nsBoxLayoutMetrics* nsIFrame::BoxMetrics() const {
-  nsBoxLayoutMetrics* metrics = GetProperty(BoxMetricsProperty());
-  NS_ASSERTION(
-      metrics,
-      "A box layout method was called but InitBoxMetrics was never called");
-  return metrics;
-}
-
 void nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
                                          ServoRestyleState& aRestyleState) {
 #ifdef DEBUG
   nsIFrame* parent = aChildFrame->GetInFlowParent();
   if (aChildFrame->IsTableFrame()) {
     parent = parent->GetParent();
   }
   if (parent->IsLineFrame()) {
@@ -11342,24 +10782,16 @@ void nsIFrame::SetParent(nsContainerFram
   // _can_ change parent if our parent is a wrapper anon box, because some
   // wrapper anon boxes can have continuations.
   MOZ_ASSERT_IF(ParentIsWrapperAnonBox(),
                 aParent->Style()->IsInheritingAnonBox());
 
   // Note that the current mParent may already be destroyed at this point.
   mParent = aParent;
   MOZ_DIAGNOSTIC_ASSERT(!mParent || PresShell() == mParent->PresShell());
-  if (::IsXULBoxWrapped(this)) {
-    ::InitBoxMetrics(this, true);
-  } else {
-    // We could call Properties().Delete(BoxMetricsProperty()); here but
-    // that's kind of slow and re-parenting in such a way that we were
-    // IsXULBoxWrapped() before but not now should be very rare, so we'll just
-    // keep this unused frame property until this frame dies instead.
-  }
 
   if (HasAnyStateBits(NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW)) {
     for (nsIFrame* f = aParent;
          f && !f->HasAnyStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
          f = f->GetParent()) {
       f->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
     }
   }
@@ -12470,17 +11902,16 @@ void DR_State::InitFrameTypeTable() {
   AddFrameTypeInfo(LayoutFrameType::TableColGroup, "colG", "tableColGroup");
   AddFrameTypeInfo(LayoutFrameType::Table, "tbl", "table");
   AddFrameTypeInfo(LayoutFrameType::TableWrapper, "tblW", "tableWrapper");
   AddFrameTypeInfo(LayoutFrameType::TableRowGroup, "rowG", "tableRowGroup");
   AddFrameTypeInfo(LayoutFrameType::TableRow, "row", "tableRow");
   AddFrameTypeInfo(LayoutFrameType::TextInput, "textCtl", "textInput");
   AddFrameTypeInfo(LayoutFrameType::Text, "text", "text");
   AddFrameTypeInfo(LayoutFrameType::Viewport, "VP", "viewport");
-  AddFrameTypeInfo(LayoutFrameType::Box, "Box", "Box");
   AddFrameTypeInfo(LayoutFrameType::Slider, "Slider", "Slider");
   AddFrameTypeInfo(LayoutFrameType::None, "unknown", "unknown");
 }
 
 void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, int32_t aIndent) {
   DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->Type());
   if (frameTypeInfo) {
     for (int32_t i = 0; i < aIndent; i++) {
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -106,31 +106,28 @@
  */
 
 class nsAtom;
 class nsView;
 class nsFrameSelection;
 class nsIWidget;
 class nsIScrollableFrame;
 class nsISelectionController;
-class nsBoxLayoutState;
-class nsBoxLayout;
 class nsILineIterator;
 class gfxSkipChars;
 class gfxSkipCharsIterator;
 class gfxContext;
 class nsLineList_iterator;
 class nsAbsoluteContainingBlock;
 class nsContainerFrame;
 class nsPlaceholderFrame;
 class nsStyleChangeList;
 class nsViewManager;
 class nsWindowSizes;
 
-struct nsBoxLayoutMetrics;
 struct CharacterDataChangeInfo;
 
 namespace mozilla {
 
 enum class PeekOffsetOption : uint8_t;
 enum class PseudoStyleType : uint8_t;
 enum class TableSelectionMode : uint32_t;
 
@@ -2398,23 +2395,20 @@ class nsIFrame : public nsQueryFrame {
 
   /**
    * Mark any stored intrinsic width information as dirty (requiring
    * re-calculation).  Note that this should generally not be called
    * directly; PresShell::FrameNeedsReflow() will call it instead.
    */
   virtual void MarkIntrinsicISizesDirty();
 
- private:
-  nsBoxLayoutMetrics* BoxMetrics() const;
-
  public:
   /**
    * Make this frame and all descendants dirty (if not already).
-   * Exceptions: XULBoxFrame and TableColGroupFrame children.
+   * Exceptions: TableColGroupFrame children.
    */
   void MarkSubtreeDirty();
 
   /**
    * Get the min-content intrinsic inline size of the frame.  This must be
    * less than or equal to the max-content intrinsic inline size.
    *
    * This is *not* affected by the CSS 'min-width', 'width', and
@@ -3289,33 +3283,32 @@ class nsIFrame : public nsQueryFrame {
     // the frame is for a replaced element, such as an image
     eReplaced = 1 << 4,
     // Frame that contains a block but looks like a replaced element
     // from the outside
     eReplacedContainsBlock = 1 << 5,
     // A frame that participates in inline reflow, i.e., one that
     // requires ReflowInput::mLineLayout.
     eLineParticipant = 1 << 6,
-    eXULBox = 1 << 7,
-    eCanContainOverflowContainers = 1 << 8,
-    eTablePart = 1 << 9,
-    eSupportsCSSTransforms = 1 << 10,
+    eCanContainOverflowContainers = 1 << 7,
+    eTablePart = 1 << 8,
+    eSupportsCSSTransforms = 1 << 9,
 
     // A replaced element that has replaced-element sizing
     // characteristics (i.e., like images or iframes), as opposed to
     // inline-block sizing characteristics (like form controls).
-    eReplacedSizing = 1 << 11,
+    eReplacedSizing = 1 << 10,
 
     // Does this frame class support 'contain: layout' and
     // 'contain:paint' (supporting one is equivalent to supporting the
     // other).
-    eSupportsContainLayoutAndPaint = 1 << 12,
+    eSupportsContainLayoutAndPaint = 1 << 11,
 
     // Does this frame class support `aspect-ratio` property.
-    eSupportsAspectRatio = 1 << 13,
+    eSupportsAspectRatio = 1 << 12,
 
     // These are to allow nsIFrame::Init to assert that IsFrameOfType
     // implementations all call the base class method.  They are only
     // meaningful in DEBUG builds.
     eDEBUGAllFrames = 1 << 30,
     eDEBUGNoFrames = 1 << 31
   };
 
@@ -4262,155 +4255,38 @@ class nsIFrame : public nsQueryFrame {
    * @param  [in, optional] aWithMouse, is this focus query for mouse clicking
    * @param  [in, optional] aCheckVisibility, whether to treat an invisible
    *   frame as not focusable
    * @return whether the frame is focusable via mouse, kbd or script.
    */
   [[nodiscard]] Focusable IsFocusable(bool aWithMouse = false,
                                       bool aCheckVisibility = true);
 
-  // BOX LAYOUT METHODS
-  // These methods have been migrated from nsIBox and are in the process of
-  // being refactored. DO NOT USE OUTSIDE OF XUL.
-  bool IsXULBoxFrame() const { return IsFrameOfType(nsIFrame::eXULBox); }
-
-  enum Halignment { hAlign_Left, hAlign_Right, hAlign_Center };
-
-  enum Valignment { vAlign_Top, vAlign_Middle, vAlign_BaseLine, vAlign_Bottom };
-
-  /**
-   * This calculates the minimum size required for a box based on its state
-   * @param[in] aBoxLayoutState The desired state to calculate for
-   * @return The minimum size
-   */
-  virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState);
-
-  /**
-   * This calculates the preferred size of a box based on its state
-   * @param[in] aBoxLayoutState The desired state to calculate for
-   * @return The preferred size
-   */
-  virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState);
-
-  /**
-   * This calculates the maximum size for a box based on its state
-   * @param[in] aBoxLayoutState The desired state to calculate for
-   * @return The maximum size
-   */
-  virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState);
-
-  int32_t GetXULFlex() const;
-  virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState);
-  virtual bool IsXULCollapsed();
-  // This does not alter the overflow area. If the caller is changing
-  // the box size, the caller is responsible for updating the overflow
-  // area. It's enough to just call XULLayout or SyncXULLayout on the
-  // box. You can pass true to aRemoveOverflowArea as a
-  // convenience.
-  virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState,
-                            const nsRect& aRect,
-                            bool aRemoveOverflowAreas = false);
-  nsresult XULLayout(nsBoxLayoutState& aBoxLayoutState);
-  // Box methods.  Note that these do NOT just get the CSS border, padding,
-  // etc.  They also talk to nsITheme.
-  virtual nsresult GetXULBorderAndPadding(nsMargin& aBorderAndPadding);
-  virtual nsresult GetXULBorder(nsMargin& aBorder);
-  virtual nsresult GetXULPadding(nsMargin& aBorderAndPadding);
-  virtual nsresult GetXULMargin(nsMargin& aMargin);
-  virtual void SetXULLayoutManager(nsBoxLayout* aLayout) {}
-  virtual nsBoxLayout* GetXULLayoutManager() { return nullptr; }
-  nsresult GetXULClientRect(nsRect& aContentRect);
-
-  virtual ReflowChildFlags GetXULLayoutFlags() {
-    return ReflowChildFlags::Default;
-  }
-
-  // For nsSprocketLayout
-  virtual Valignment GetXULVAlign() const { return vAlign_Top; }
-  virtual Halignment GetXULHAlign() const { return hAlign_Left; }
-
-  nsresult XULRedraw(nsBoxLayoutState& aState);
-
-  static bool AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
-                             bool& aHeightSet);
-  static bool AddXULMinSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
-                            bool& aHeightSet);
-  static bool AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidth,
-                            bool& aHeightSet);
-  static int32_t ComputeXULFlex(nsIFrame* aBox);
-
-  void AddXULBorderAndPadding(nsSize& aSize);
-
-  static void AddXULBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
-  static void AddXULMargin(nsIFrame* aChild, nsSize& aSize);
-  static void AddXULMargin(nsSize& aSize, const nsMargin& aMargin);
-
-  static nsSize XULBoundsCheckMinMax(const nsSize& aMinSize,
-                                     const nsSize& aMaxSize);
-  static nsSize XULBoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
-                               const nsSize& aMaxSize);
-  static nscoord XULBoundsCheck(nscoord aMinSize, nscoord aPrefSize,
-                                nscoord aMaxSize);
-
-  static nsIFrame* GetChildXULBox(const nsIFrame* aFrame);
-  static nsIFrame* GetNextXULBox(const nsIFrame* aFrame);
-  static nsIFrame* GetParentXULBox(const nsIFrame* aFrame);
-
  protected:
   // Helper for IsFocusable.
   bool IsFocusableDueToScrollFrame();
 
   /**
    * Returns true if this box clips its children, e.g., if this box is an
-   * scrollbox.
-   */
-  virtual bool DoesClipChildrenInBothAxes();
-
-  // We compute and store the HTML content's overflow area. So don't
-  // try to compute it in the box code.
-  virtual bool XULComputesOwnOverflowArea() { return true; }
-
-  nsresult SyncXULLayout(nsBoxLayoutState& aBoxLayoutState);
-
-  bool XULNeedsRecalc(const nsSize& aSize);
-  bool XULNeedsRecalc(nscoord aCoord);
-  void XULSizeNeedsRecalc(nsSize& aSize);
-  void XULCoordNeedsRecalc(nscoord& aCoord);
-
-  nsresult BeginXULLayout(nsBoxLayoutState& aState);
-  NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState);
-  nsresult EndXULLayout(nsBoxLayoutState& aState);
-
-  nsSize GetUncachedXULMinSize(nsBoxLayoutState& aBoxLayoutState);
-  nsSize GetUncachedXULPrefSize(nsBoxLayoutState& aBoxLayoutState);
-  nsSize GetUncachedXULMaxSize(nsBoxLayoutState& aBoxLayoutState);
-
-  // END OF BOX LAYOUT METHODS
-  // The above methods have been migrated from nsIBox and are in the process of
-  // being refactored. DO NOT USE OUTSIDE OF XUL.
+   * scrollbox or has overflow: clip in both axes.
+   */
+  bool DoesClipChildrenInBothAxes() const;
 
   /**
    * NOTE: aStatus is assumed to be already-initialized. The reflow statuses of
    * any reflowed absolute children will be merged into aStatus; aside from
    * that, this method won't modify aStatus.
    */
   void ReflowAbsoluteFrames(nsPresContext* aPresContext,
                             ReflowOutput& aDesiredSize,
                             const ReflowInput& aReflowInput,
                             nsReflowStatus& aStatus,
                             bool aConstrainBSize = true);
 
  private:
-  void BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
-                 ReflowOutput& aDesiredSize, gfxContext* aRenderingContext,
-                 nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
-                 bool aMoveFrame = true);
-
-  NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
-
   Maybe<nscoord> ComputeInlineSizeFromAspectRatio(
       mozilla::WritingMode aWM, const mozilla::LogicalSize& aCBSize,
       const mozilla::LogicalSize& aContentEdgeToBoxSizing,
       const mozilla::StyleSizeOverrides& aSizeOverrides,
       mozilla::ComputeSizeFlags aFlags) const;
 
  public:
   /**
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -19,17 +19,16 @@
 #include "mozilla/ScrollStyles.h"
 #include "mozilla/ScrollTypes.h"
 #include "mozilla/gfx/Point.h"
 #include "nsIScrollbarMediator.h"
 #include "Units.h"
 #include "FrameMetrics.h"
 
 class gfxContext;
-class nsBoxLayoutState;
 class nsIScrollPositionListener;
 class nsIFrame;
 class nsPresContext;
 class nsIContent;
 
 namespace mozilla {
 class DisplayItemClip;
 class nsDisplayListBuilder;
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -41,37 +41,16 @@ NS_IMPL_FRAMEARENA_HELPERS(nsPlaceholder
 
 #ifdef DEBUG
 NS_QUERYFRAME_HEAD(nsPlaceholderFrame)
   NS_QUERYFRAME_ENTRY(nsPlaceholderFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsIFrame)
 #endif
 
 /* virtual */
-nsSize nsPlaceholderFrame::GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) {
-  nsSize size(0, 0);
-  DISPLAY_MIN_SIZE(this, size);
-  return size;
-}
-
-/* virtual */
-nsSize nsPlaceholderFrame::GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) {
-  nsSize size(0, 0);
-  DISPLAY_PREF_SIZE(this, size);
-  return size;
-}
-
-/* virtual */
-nsSize nsPlaceholderFrame::GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) {
-  nsSize size(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
-  DISPLAY_MAX_SIZE(this, size);
-  return size;
-}
-
-/* virtual */
 void nsPlaceholderFrame::AddInlineMinISize(
     gfxContext* aRenderingContext, nsIFrame::InlineMinISizeData* aData) {
   // Override AddInlineMinWith so that *nothing* happens.  In
   // particular, we don't want to zero out |aData->mTrailingWhitespace|,
   // since nsLineLayout skips placeholders when trimming trailing
   // whitespace, and we don't want to set aData->mSkipWhitespace to
   // false.
 
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -88,48 +88,43 @@ class nsPlaceholderFrame final : public 
   nsIFrame* GetOutOfFlowFrame() const { return mOutOfFlowFrame; }
   void SetOutOfFlowFrame(nsIFrame* aFrame) {
     NS_ASSERTION(!aFrame || !aFrame->GetPrevContinuation(),
                  "OOF must be first continuation");
     mOutOfFlowFrame = aFrame;
   }
 
   // nsIFrame overrides
-  // We need to override GetXULMinSize and GetXULPrefSize because XUL uses
-  // placeholders not within lines.
-  virtual void AddInlineMinISize(gfxContext* aRenderingContext,
-                                 InlineMinISizeData* aData) override;
-  virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
-                                  InlinePrefISizeData* aData) override;
-  virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
-  virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
-  virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
+  void AddInlineMinISize(gfxContext* aRenderingContext,
+                         InlineMinISizeData* aData) override;
+  void AddInlinePrefISize(gfxContext* aRenderingContext,
+                          InlinePrefISizeData* aData) override;
 
-  virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
-                      const ReflowInput& aReflowInput,
-                      nsReflowStatus& aStatus) override;
+  void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
+              const ReflowInput& aReflowInput,
+              nsReflowStatus& aStatus) override;
 
-  virtual void DestroyFrom(nsIFrame* aDestructRoot,
-                           PostDestroyData& aPostDestroyData) override;
+  void DestroyFrom(nsIFrame* aDestructRoot,
+                   PostDestroyData& aPostDestroyData) override;
 
 #if defined(DEBUG) || (defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF))
-  virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
-                                const nsDisplayListSet& aLists) override;
+  void BuildDisplayList(nsDisplayListBuilder* aBuilder,
+                        const nsDisplayListSet& aLists) override;
 #endif  // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
 
 #ifdef DEBUG_FRAME_DUMP
   void List(FILE* out = stderr, const char* aPrefix = "",
             ListFlags aFlags = ListFlags()) const override;
-  virtual nsresult GetFrameName(nsAString& aResult) const override;
+  nsresult GetFrameName(nsAString& aResult) const override;
 #endif  // DEBUG
 
-  virtual bool IsEmpty() override { return true; }
-  virtual bool IsSelfEmpty() override { return true; }
+  bool IsEmpty() override { return true; }
+  bool IsSelfEmpty() override { return true; }
 
-  virtual bool CanContinueTextRun() const override;
+  bool CanContinueTextRun() const override;
 
   void SetLineIsEmptySoFar(bool aValue) {
     AddOrRemoveStateBits(PLACEHOLDER_LINE_IS_EMPTY_SO_FAR, aValue);
     AddStateBits(PLACEHOLDER_HAVE_LINE_IS_EMPTY_SO_FAR);
   }
   bool GetLineIsEmptySoFar(bool* aResult) const {
     bool haveValue = HasAnyStateBits(PLACEHOLDER_HAVE_LINE_IS_EMPTY_SO_FAR);
     if (haveValue) {
@@ -137,17 +132,17 @@ class nsPlaceholderFrame final : public 
     }
     return haveValue;
   }
   void ForgetLineIsEmptySoFar() {
     RemoveStateBits(PLACEHOLDER_HAVE_LINE_IS_EMPTY_SO_FAR);
   }
 
 #ifdef ACCESSIBILITY
-  virtual mozilla::a11y::AccType AccessibleType() override {
+  mozilla::a11y::AccType AccessibleType() override {
     nsIFrame* realFrame = GetRealFrameForPlaceholder(this);
     return realFrame ? realFrame->AccessibleType() : nsIFrame::AccessibleType();
   }
 #endif
 
   ComputedStyle* GetParentComputedStyleForOutOfFlow(
       nsIFrame** aProviderFrame) const;
 
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -15,17 +15,16 @@
 #include "mozilla/dom/HTMLImageElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/layers/RenderRootStateManager.h"
 #include "nsDisplayList.h"
 #include "nsGenericHTMLElement.h"
 #include "nsPresContext.h"
 #include "nsContentCreatorFunctions.h"
-#include "nsBoxLayoutState.h"
 #include "nsIContentInlines.h"
 #include "nsImageFrame.h"
 #include "nsIImageLoadingContent.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "ImageContainer.h"
 #include "nsStyleUtil.h"
 #include <algorithm>
@@ -743,18 +742,17 @@ void nsVideoFrame::BuildDisplayList(nsDi
   if (HasVideoElement() && !shouldDisplayPoster) {
     aLists.Content()->AppendNewToTop<nsDisplayVideo>(aBuilder, this);
   }
 
   // Add child frames to display list. We expect various children,
   // but only want to draw mPosterImage conditionally. Others we
   // always add to the display list.
   for (nsIFrame* child : mFrames) {
-    if (child->GetContent() != mPosterImage || shouldDisplayPoster ||
-        child->IsBoxFrame()) {
+    if (child->GetContent() != mPosterImage || shouldDisplayPoster) {
       nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
           aBuilder, child,
           aBuilder->GetVisibleRect() - child->GetOffsetTo(this),
           aBuilder->GetDirtyRect() - child->GetOffsetTo(this));
 
       child->BuildDisplayListForStackingContext(aBuilder, aLists.Content());
     }
   }
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-add-to-one-grouped.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var c = document.getElementById("C");
-    getComputedStyle(c, "").width; // flush
-    c.style.order = "2";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="A" value="A" />
-  <label id="C" value="C" />
-  <label id="B" value="B" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-add-to-two-grouped-1.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var c = document.getElementById("C");
-    getComputedStyle(c, "").width; // flush
-    c.style.order = "2";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="B" value="B" style="order: 2" />
-  <label id="C" value="C" />
-  <label id="A" value="A" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-add-to-two-grouped-2.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var b = document.getElementById("B");
-    getComputedStyle(b, "").width; // flush
-    b.style.order = "2";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="B" value="B" />
-  <label id="C" value="C" style="order: 2" />
-  <label id="A" value="A" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-ref.xhtml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <label id="A" value="A" />
-  <label id="B" value="B" />
-  <label id="C" value="C" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-remove-to-none-grouped.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var b = document.getElementById("B");
-    getComputedStyle(b, "").width; // flush
-    b.style.order = "";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="A" value="A" />
-  <label id="B" value="B" style="order: 2" />
-  <label id="C" value="C" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-remove-to-one-grouped-1.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var b = document.getElementById("B");
-    getComputedStyle(b, "").width; // flush
-    b.style.order = "";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="C" value="C" style="order: 2" />
-  <label id="A" value="A" />
-  <label id="B" value="B" style="order: 2" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/dynamic-1-remove-to-one-grouped-2.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE window>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="reftest-wait" onload="run()">
-  <script type="application/javascript"><![CDATA[
-
-  function run() {
-    var a = document.getElementById("A");
-    getComputedStyle(a, "").width; // flush
-    a.style.order = "";
-    document.documentElement.removeAttribute("class");
-  }
-
-  ]]></script>
-  <label id="C" value="C" style="order: 2" />
-  <label id="A" value="A" style="order: 2" />
-  <label id="B" value="B" />
-</window>
deleted file mode 100644
--- a/layout/reftests/box-ordinal/reftest.list
+++ /dev/null
@@ -1,6 +0,0 @@
-== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-none-grouped.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
-== chrome://reftest/content/box-ordinal/dynamic-1-add-to-one-grouped.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
-== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-one-grouped-1.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
-== chrome://reftest/content/box-ordinal/dynamic-1-remove-to-one-grouped-2.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
-== chrome://reftest/content/box-ordinal/dynamic-1-add-to-two-grouped-1.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
-== chrome://reftest/content/box-ordinal/dynamic-1-add-to-two-grouped-2.xhtml chrome://reftest/content/box-ordinal/dynamic-1-ref.xhtml
deleted file mode 100644
--- a/layout/reftests/box/box-as-grid-or-flex-item-1-ref.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<title>Reference for bug 1580302</title>
-<style>
-  .grid, .flex {
-    width: 60px;
-    height: 60px;
-    border: 1px solid black;
-  }
-  .grid { display: grid; }
-  .flex { display: flex; }
-  .fCol { flex-direction: column; }
-
-  .item {
-    background: lightblue;
-  }
-  .flexible {
-    flex: 1;
-  }
-</style>
-<body>
-  <!-- The item should fill the grid here (by virtue of the default-stretchy
-       behavior of justify-items and align-items): -->
-  <div class="grid">
-    <div class="item">e</div>
-  </div>
-
-  <!-- For the rest, the item should fill the flex container in the cross axis,
-       and if it's flexible, also fill the container in the main axis. -->
-  <div class="flex">
-    <div class="item">e</div>
-  </div>
-  <div class="flex">
-    <div class="item flexible">e</div>
-  </div>
-  <div class="flex fCol">
-    <div class="item">e</div>
-  </div>
-  <div class="flex fCol">
-    <div class="item flexible">e</div>
-  </div>
-</body>
deleted file mode 100644
--- a/layout/reftests/box/box-as-grid-or-flex-item-1.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<title>Test for bug 1580302</title>
-<style>
-  .grid, .flex {
-    width: 60px;
-    height: 60px;
-    border: 1px solid black;
-  }
-  .grid { display: grid; }
-  .flex { display: flex; }
-  .fCol { flex-direction: column; }
-
-  .item {
-    display: -moz-box;
-    background: lightblue;
-  }
-  .flexible {
-    flex: 1;
-  }
-</style>
-<body>
-  <!-- The item should fill the grid here (by virtue of justify-items/align-items
-       default behavior): -->
-  <div class="grid">
-    <div class="item">e</div>
-  </div>
-
-  <!-- For the rest, the item should fill the flex container in the cross axis,
-       and if it's flexible, also fill the container in the main axis. -->
-  <div class="flex">
-    <div class="item">e</div>
-  </div>
-  <div class="flex">
-    <div class="item flexible">e</div>
-  </div>
-  <div class="flex fCol">
-    <div class="item">e</div>
-  </div>
-  <div class="flex fCol">
-    <div class="item flexible">e</div>
-  </div>
-</body>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-1-ref.xhtml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root {
-        -moz-box-layout: flex;
-      }
-      hbox {
-        width: 100px;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:hbox>
-      <xul:description>X</xul:description>
-      <xul:description flex="1" style="background: blue">X</xul:description>
-    </xul:hbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-1.xhtml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: legacy; }
-      hbox {
-        width: 100px;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:hbox>
-      <xul:description>X</xul:description>
-      <xul:description flex="1" style="background: blue">X</xul:description>
-    </xul:hbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-2-ref.xhtml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:html="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: flex; }
-      hbox {
-        width: 700px;
-      }
-      input {
-        -moz-box-flex: 1;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:hbox>
-      <xul:description>X</xul:description>
-      <html:input flex="1" style="background: blue" value="X"/>
-    </xul:hbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-2.xhtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:html="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: legacy; }
-
-      hbox {
-        width: 700px;
-      }
-      input {
-        -moz-box-flex: 1;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:hbox>
-      <xul:description>X</xul:description>
-      <html:input flex="1" style="background: blue" value="X"/>
-    </xul:hbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-4-ref.xhtml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: flex; }
-      vbox {
-        height: 100px;
-      }
-      browser {
-        background-color: green;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:vbox>
-      <xul:browser></xul:browser>
-    </xul:vbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-4.xhtml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: legacy; }
-      vbox {
-        height: 100px;
-      }
-      browser {
-        background-color: green;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:vbox>
-      <xul:browser></xul:browser>
-    </xul:vbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-5-ref.xhtml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: legacy; }
-      .scroll {
-        height: 100px;
-        width: 100px;
-        overflow: auto;
-      }
-      .scroll > vbox {
-        width: 100px;
-        height: 100px;
-        background: green;
-      }
-      .scroll > vbox[collapsed] {
-        border: 3px solid;
-        padding: 6px;
-        margin: 9px;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:vbox class="scroll">
-      <xul:vbox/>
-      <xul:vbox collapsed="true"/>
-    </xul:vbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-5-ref2.xhtml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: legacy; }
-      .scroll {
-        height: 100px;
-        width: 100px;
-        background: green;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:vbox class="scroll"/>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flex-emulation-5.xhtml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <head>
-    <style>
-      :root { -moz-box-layout: flex }
-      .scroll {
-        height: 100px;
-        width: 100px;
-        overflow: auto;
-      }
-      .scroll > vbox {
-        width: 100px;
-        height: 100px;
-        background: green;
-      }
-      .scroll > vbox[collapsed] {
-        border: 3px solid;
-        padding: 6px;
-        margin: 9px;
-      }
-    </style>
-  </head>
-  <body>
-    <xul:vbox class="scroll">
-      <xul:vbox/>
-      <xul:vbox collapsed="true"/>
-    </xul:vbox>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-1-ref.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
-  <head>
-    <style>
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="relpos_parent">
-      <div class="abspos_child"></div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-1a.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase has a relatively-positioned -moz-box element, which should
-     form a containing block for its absolutely positioned child. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box relpos_parent">
-      <div class="abspos_child"></div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-1b.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase is the same as the -1a version, but with -moz-inline-box. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-inline-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box relpos_parent">
-      <div class="abspos_child"></div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-1c.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase is the same as the -1a version, but with an additional
-     -moz-box wrapper, so that our relatively positioned box will never get a
-     call to Reflow. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box">
-      <div class="box relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-1d.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase is the same as the -1c version, but with -moz-inline-box. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-inline-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box">
-      <div class="box relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-2-ref.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
-  <head>
-    <style>
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        top: 10px;
-        width: 20px;
-        height: 150px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="relpos_parent">
-      <div class="abspos_child"></div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-abspos-container-2.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase has a relatively-positioned -moz-box element, which should
-     form a containing block for its absolutely positioned child. Also: in
-     this case, the child is taller than its container. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        top: 10px;
-        width: 20px;
-        height: 150px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box relpos_parent">
-      <div class="abspos_child"></div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-box-horizontal-ref.xhtml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: horizontal;
-}
-
-div > div {
-  display: -moz-box;
-  -moz-box-flex: 1;
-  border: 1px solid blue;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <div>width</div>
-  <div>height</div>
-  <div>minwidth</div>
-  <div>minheight</div>
-  <div>maxwidth</div>
-  <div>maxheight</div>
-  <div>flex</div>
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-box-horizontal.xhtml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: horizontal;
-}
-
-div > div {
-  display: -moz-box;
-  -moz-box-flex: 1;
-  border: 1px solid blue;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <div width="100">width</div>
-  <div height="100">height</div>
-  <div minwidth="100">minwidth</div>
-  <div minheight="100">minheight</div>
-  <div maxwidth="50">maxwidth</div>
-  <div maxheight="15">maxheight</div>
-  <div style="-moz-box-flex: 100">flex</div>
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-box-vertical-ref.xhtml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: vertical;
-}
-
-div > div {
-  display: -moz-box;
-  -moz-box-flex: 1;
-  border: 1px solid blue;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <div>width</div>
-  <div>height</div>
-  <div>minwidth</div>
-  <div>minheight</div>
-  <div>maxwidth</div>
-  <div>maxheight</div>
-  <div>flex</div>
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-box-vertical.xhtml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: vertical;
-}
-
-div > div {
-  display: -moz-box;
-  -moz-box-flex: 1;
-  border: 1px solid blue;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <div width="100">width</div>
-  <div height="100">height</div>
-  <div minwidth="100">minwidth</div>
-  <div minheight="100">minheight</div>
-  <div maxwidth="50">maxwidth</div>
-  <div maxheight="15">maxheight</div>
-  <div style="-moz-box-flex: 100">flex</div>
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-input-horizontal-ref.xhtml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-  pointer-events: none;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: horizontal;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <input type="text" value="width" />
-  <input type="text" value="height" />
-  <input type="text" value="minwidth" />
-  <input type="text" value="minheight" />
-  <input type="text" value="maxwidth" />
-  <input type="text" value="maxheight" />
-  <input type="text" value="flex" />
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-input-horizontal.xhtml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-  /* Disable pointer-events so we don't get weird hover artifacts */
-  pointer-events: none;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: horizontal;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <input type="text" width="100" value="width" />
-  <input type="text" height="100" value="height" />
-  <input type="text" minwidth="100" value="minwidth" />
-  <input type="text" minheight="100" value="minheight" />
-  <input type="text" maxwidth="50" value="maxwidth" />
-  <input type="text" maxheight="15" value="maxheight" />
-  <input type="text" style="-moz-box-flex: 100" value="flex" />
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-input-vertical-ref.xhtml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: vertical;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <input type="text" value="width" />
-  <input type="text" value="height" />
-  <input type="text" value="minwidth" />
-  <input type="text" value="minheight" />
-  <input type="text" value="maxwidth" />
-  <input type="text" value="maxheight" />
-  <input type="text" value="flex" />
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-attributes-no-input-vertical.xhtml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test that XUL attributes are not supported on non-XUL elements</title>
-<style type="text/css">
-<![CDATA[
-
-html, body {
-  display: -moz-box;
-  margin: 0; padding: 0;
-  width: 100%; height: 100%;
-}
-
-body > div {
-  display: -moz-box;
-  background: yellow;
-  -moz-box-flex: 1;
-  -moz-box-orient: vertical;
-}
-
-]]>
-</style>
-</head>
-<body>
-<div>
-  <input type="text" width="100" value="width" />
-  <input type="text" height="100" value="height" />
-  <input type="text" minwidth="100" value="minwidth" />
-  <input type="text" minheight="100" value="minheight" />
-  <input type="text" maxwidth="50" value="maxwidth" />
-  <input type="text" maxheight="5" value="maxheight" />
-  <input type="text" style="-moz-box-flex: 100" value="flex" />
-</div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-child-is-abspos-container-1-ref.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
-  <head>
-    <style>
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div>
-      <div class="relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-child-is-abspos-container-1.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase has a -moz-box element with a block as its only child, which
-     forms a containing block for an absolutely positioned grandchild. -->
-<html>
-  <head>
-    <style>
-      .box { display: -moz-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 20px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box">
-      <div class="relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-child-is-abspos-container-2-ref.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
-  <head>
-    <style>
-      body { margin-top: 50px }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 130px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div>
-      <div class="relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/flexbox-child-is-abspos-container-2.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!-- This testcase has a -moz-box element with a block as its only child, which
-     forms a containing block for an absolutely positioned grandchild. Also, in
-     this case, the grandchild is taller than its parent and grandparent. -->
-<html>
-  <head>
-    <style>
-      body { margin-top: 50px }
-      .box { display: -moz-box }
-      .relpos_parent {
-        position: relative;
-        width: 100px;
-        height: 100px;
-        background: lightblue;
-      }
-      .abspos_child {
-        position: absolute;
-        left: 30px;
-        bottom: 10px;
-        width: 20px;
-        height: 130px;
-        background: purple;
-      }
-    </style>
-  </head>
-  <body>
-    <div class="box">
-      <div class="relpos_parent">
-        <div class="abspos_child"></div>
-      </div>
-    </div>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/box/reftest.list
+++ /dev/null
@@ -1,18 +0,0 @@
-== chrome://reftest/content/box/box-as-grid-or-flex-item-1.html chrome://reftest/content/box/box-as-grid-or-flex-item-1-ref.html
-== chrome://reftest/content/box/flex-emulation-1.xhtml chrome://reftest/content/box/flex-emulation-1-ref.xhtml
-== chrome://reftest/content/box/flex-emulation-2.xhtml chrome://reftest/content/box/flex-emulation-2-ref.xhtml
-== chrome://reftest/content/box/flex-emulation-4.xhtml chrome://reftest/content/box/flex-emulation-4-ref.xhtml
-== chrome://reftest/content/box/flex-emulation-5.xhtml chrome://reftest/content/box/flex-emulation-5-ref.xhtml
-== chrome://reftest/content/box/flex-emulation-5.xhtml chrome://reftest/content/box/flex-emulation-5-ref2.xhtml
-
-== flexbox-abspos-container-1a.html flexbox-abspos-container-1-ref.html
-== flexbox-abspos-container-1b.html flexbox-abspos-container-1-ref.html
-== flexbox-abspos-container-1c.html flexbox-abspos-container-1-ref.html
-== flexbox-abspos-container-1d.html flexbox-abspos-container-1-ref.html
-== flexbox-abspos-container-2.html  flexbox-abspos-container-2-ref.html
-== flexbox-attributes-no-box-horizontal.xhtml flexbox-attributes-no-box-horizontal-ref.xhtml
-== flexbox-attributes-no-box-vertical.xhtml flexbox-attributes-no-box-vertical-ref.xhtml
-== flexbox-attributes-no-input-horizontal.xhtml flexbox-attributes-no-input-horizontal-ref.xhtml
-== flexbox-attributes-no-input-vertical.xhtml flexbox-attributes-no-input-vertical-ref.xhtml
-== flexbox-child-is-abspos-container-1.html flexbox-child-is-abspos-container-1-ref.html
-== flexbox-child-is-abspos-container-2.html flexbox-child-is-abspos-container-2-ref.html
deleted file mode 100644
--- a/layout/reftests/bugs/322436-1-ref.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-
-<head>
-
-</head>
-
-<body>
-There should be floating text here!  Look at the source!
-This&nbsp;text&nbsp;should&nbsp;show&nbsp;up
-<!-- using non-breaking spaces here because the box in the testcase
-     will always wrap (or not) as a complete unit, depending on
-     font size and window width -->
-
-</body>
-
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/322436-1.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<html>
-
-<head>
-
-</head>
-
-<body>
-There should be floating text here!  Look at the source!
-<div style="display: -moz-inline-box;"><div style="float: left;">This&nbsp;text&nbsp;should&nbsp;show&nbsp;up</div></div>
-<!-- using non-breaking spaces here to match the reference -->
-
-</body>
-
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/413027-1-ref.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html><head>
-<title>Testcase 3 for bug 413027 - Marquee height is sized too small, clipping text vertically</title>
-</head>
-<body>
-
-<div style="background-color: lime; width: 600px; float:left;">
-  <div style="margin: 100px 0px;">text</div>
-</div>
-      
-</body></html>
deleted file mode 100644
--- a/layout/reftests/bugs/413027-1.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html><head>
-<title>Testcase 3 for bug 413027 - Marquee height is sized too small, clipping text vertically</title>
-</head>
-<body>
-
-<div style="display: -moz-box; background-color: lime; width: 600px;">
-<div>
-  <div style="margin: 100px 0px;">text</div>
-</div>
-</div>
-      
-</body></html>
deleted file mode 100644
--- a/layout/reftests/bugs/508816-2-ref.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <style type="text/css">
-    body { padding-right: 100px; }
-    div.x1 { border: 1px solid purple; overflow-x: scroll; overflow-y: hidden; width: 300px; margin: 0 50px 0 0; padding: 0; }
-    div.x2 { height: 50px; }
-    span { display: inline-block; height: 50px; margin: 0; }
-  </style>
-</head>
-<body dir="rtl">
-  <div class="x1">
-    <span style="background: green; width: 50px; position: fixed; margin-inline-start: -50px"></span>
-    <div class="x2">
-      <span style="background: yellow; width: 400px; overflow: hidden"></span>
-    </div>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/508816-2.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <style type="text/css">
-    body { padding-right: 100px; }
-    div { border: 1px solid purple; overflow-x: scroll; overflow-y: hidden; width: 300px; margin: 0 50px 0 0; padding: 0; }
-    span { display: inline-block; height: 50px; margin: 0; }
-  </style>
-</head>
-<body dir="rtl">
-  <div style="display: -moz-box;">
-    <span style="background: green; width: 50px; position: fixed; margin-inline-start: -50px"></span>
-    <span style="background: yellow; width: 400px; overflow: hidden"></span>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/bugs/531098-1-ref.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE HTML>
-<style type="text/css">
-html, body { margin: 0; padding: 0; border: none; }
-</style>
-
-<div style="position: absolute; width: 200px; height: 400px; top: 100px; left: 100px; box-shadow: 0 0 14px blue">A</div>
-<div style="position: absolute; width: 100px; height: 400px; top: 100px; left: 400px; box-shadow: 0 0 14px blue">B</div>
deleted file mode 100644
--- a/layout/reftests/bugs/531098-1.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<style type="text/css">
-html, body { margin: 0; padding: 0; border: none; }
-</style>
-
-<div style="margin: 100px; height: 400px; width: 400px; display: -moz-box; -moz-box-orient: horizontal">
-
-  <div style="width: 200px; box-shadow: 0 0 14px blue">A</div>
-  <div style="width: 100px"></div>
-  <div style="-moz-box-flex: 1; box-shadow: 0 0 14px blue">B</div>
-
-</div>
--- a/layout/reftests/bugs/579323-1.html
+++ b/layout/reftests/bugs/579323-1.html
@@ -1,20 +1,19 @@
 <!DOCTYPE HTML>
 <html class="reftest-wait">
 <head>
 <style>
 body {
   margin: 0;
-  display: -moz-box;
-  -moz-box-orient: horizontal;
+  display: flex;
   width: 400px;
 }
 canvas {
-  -moz-box-flex: 1;
+  flex: 1;
   opacity: 0.999;
   border: 1px solid black;
 }
 .censor {
   position: absolute;
   width: 1px;
   height: 1px;
   background: cyan;
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -420,17 +420,16 @@ fuzzy(0-1,0-1) == 315920-20.svg 315920-2
 == 320979-1.html 320979-1-ref.html
 != 321402-1.html about:blank
 != 321402-2.html about:blank
 == chrome://reftest/content/bugs/321402-3.xhtml chrome://reftest/content/bugs/321402-3-ref.xhtml
 == chrome://reftest/content/bugs/321402-4.xhtml chrome://reftest/content/bugs/321402-4-ref.xhtml
 == chrome://reftest/content/bugs/321402-5.xhtml chrome://reftest/content/bugs/321402-5-ref.xhtml
 == chrome://reftest/content/bugs/321402-6.xhtml chrome://reftest/content/bugs/321402-6-ref.xhtml
 == 321738-1.html 321738-1-ref.html
-== chrome://reftest/content/bugs/322436-1.html chrome://reftest/content/bugs/322436-1-ref.html
 == 322461-1.xml 322461-1-ref.html
 == 323656-1.html 323656-1-ref.html
 == 323656-2.html 323656-2-ref.html
 == 323656-3.html 323656-3-ref.html
 == 323656-4.html 323656-4-ref.html
 == 323656-5.svg 323656-5-ref.svg
 == 323656-6.html 323656-6-ref.html
 fuzzy-if(Android,0-2,0-140) == 325292-1.html 325292-1-ref.html
@@ -929,17 +928,16 @@ fails == 411585-3.html 411585-3-ref.html
 == 411792-1.html 411792-1-ref.html
 == 412093-1.html 412093-1-ref.html
 == 412352-1.html 412352-1-ref.html
 == 412352-2.html 412352-2-ref.html
 == 412607-1a.html 412607-1-ref.html
 == 412607-1b.html 412607-1-ref.html
 == 412679-1.html 412679-1-ref.html
 fuzzy(0-1,0-17) == 412679-2.html 412679-2-ref.html
-== chrome://reftest/content/bugs/413027-1.html chrome://reftest/content/bugs/413027-1-ref.html
 fails == 413027-2.html 413027-2-ref.html
 fails == 413027-3.html 413027-3-ref.html
 == 413286-1a.html 413286-1-ref.html
 == 413286-1b.html 413286-1-ref.html
 == 413286-1c.html 413286-1-ref.html
 == 413286-2a.html 413286-2-ref.html
 == 413286-2b.html 413286-2-ref.html
 == 413286-2c.html 413286-2-ref.html
@@ -1359,17 +1357,16 @@ needs-focus fails-if(!useDrawSnapshot) =
 fuzzy-if(Android,0-5,0-2800) == 506481-1.html 506481-1-ref.html
 == 507187-1.html 507187-1-ref.html
 == 507487-1.html 507487-1-ref.html
 == 507487-2.xhtml 507487-2-ref.xhtml
 == 507762-1.html 507762-1-ref.html
 == 507762-2.html 507762-2-ref.html
 == 507762-3.html 507762-1-ref.html
 == 507762-4.html 507762-2-ref.html
-== chrome://reftest/content/bugs/508816-2.html chrome://reftest/content/bugs/508816-2-ref.html
 == 508919-1.xhtml 508919-1-ref.xhtml
 == 509155-1.xhtml 509155-1-ref.xhtml
 fuzzy(0-1,0-1200) == 512410.html 512410-ref.html
 == 512631-1.html 512631-1-ref.html
 fuzzy(0-1,0-4) == 513153-1a.html 513153-1-ref.html
 fuzzy(0-1,0-4) == 513153-1b.html 513153-1-ref.html
 pref(widget.non-native-theme.webrender,true) == 513153-2a.html 513153-2-ref.html # appleSilicon: bug 1724583
 fuzzy-if(cocoaWidget,0-112,0-108) == 513153-2b.html 513153-2-ref.html # only fuzzy when widget.non-native-theme.webrender=false, snapping difference
@@ -1398,17 +1395,16 @@ fuzzy(0-5,0-50) == 526463-1.html 526463-
 == 528038-1b.html 528038-1-ref.html
 == 528038-1c.html 528038-1-ref.html
 == 528038-1d.html 528038-1-ref.html
 == 528038-1e.html 528038-1-ref.html
 == 528038-1f.html 528038-1-ref.html
 == 528038-2.html 528038-2-ref.html
 == 528096-1.html 528096-1-ref.html
 == 530686-1.html 530686-1-ref.html
-== chrome://reftest/content/bugs/531098-1.html chrome://reftest/content/bugs/531098-1-ref.html
 fuzzy-if(Android,0-2,0-48) fuzzy-if(cocoaWidget&&swgl,0-1,0-3) == 531200-1.html 531200-1-ref.html
 == 531371-1.html 531371-1-ref.html
 == 534526-1a.html 534526-1-ref.html
 == 534526-1b.html 534526-1-ref.html
 == 534804-1.html 534804-1-ref.html
 == 534808-1.html 534808-1-ref.html
 == 534808-2.html 534808-2-ref.html
 == 534919-1.html 534919-1-ref.html
@@ -1508,17 +1504,17 @@ fuzzy-if(Android,0-1,0-1) needs-focus ==
 == 572598-1.html 572598-ref.html
 == 574898-1.html 574898-ref.html
 # 574907 is a windows-only issue, result on other platforms depends on details of font support
 random-if(!winWidget) == 574907-1.html 574907-1-ref.html
 random-if(!winWidget) == 574907-2.html 574907-2-ref.html
 random-if(!winWidget) != 574907-3.html 574907-3-notref.html
 == 577838-1.html 577838-1-ref.html
 == 577838-2.html 577838-2-ref.html
-pref(layout.css.moz-box-flexbox-emulation.enabled,true) == chrome://reftest/content/bugs/579323-1.html chrome://reftest/content/bugs/579323-1-ref.html
+== chrome://reftest/content/bugs/579323-1.html chrome://reftest/content/bugs/579323-1-ref.html
 == 579349-1.html 579349-1-ref.html
 == 579655-1.html 579655-1-ref.html
 fails-if(Android) random-if(layersGPUAccelerated) fuzzy(0-1,0-10000) == 579985-1.html 579985-1-ref.html # this bug was only for a regression in BasicLayers anyway
 fuzzy-if(asyncPan&&!layersGPUAccelerated,0-255,0-141) == 580863-1.html 580863-1-ref.html
 fails-if(Android) random-if(layersGPUAccelerated) fuzzy(0-1,0-6436) == 581317-1.html 581317-1-ref.html
 == 581579-1.html 581579-1-ref.html
 == 582037-1a.html 582037-1-ref.html
 == 582037-1b.html 582037-1-ref.html
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -30,22 +30,16 @@ include bidi/reftest.list
 include border-dotted/reftest.list
 
 # border-image
 include border-image/reftest.list
 
 # border-radius/
 include border-radius/reftest.list
 
-# -moz-box tests
-include box/reftest.list
-
-# box-ordinal/
-include box-ordinal/reftest.list
-
 # box-properties/
 include box-properties/reftest.list
 
 # box-shadow/
 include box-shadow/reftest.list
 
 # bugs/
 include bugs/reftest.list
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -80,22 +80,16 @@ enum class StyleDisplay : uint16_t {
   RubyBase = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
                               StyleDisplayInside::RubyBase),
   RubyBaseContainer = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
                                        StyleDisplayInside::RubyBaseContainer),
   RubyText = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
                               StyleDisplayInside::RubyText),
   RubyTextContainer = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
                                        StyleDisplayInside::RubyTextContainer),
-
-  /// XUL boxes.
-  MozBox =
-      StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox),
-  MozInlineBox =
-      StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox),
 };
 // The order of the StyleDisplay values isn't meaningful.
 bool operator<(const StyleDisplay&, const StyleDisplay&) = delete;
 bool operator<=(const StyleDisplay&, const StyleDisplay&) = delete;
 bool operator>(const StyleDisplay&, const StyleDisplay&) = delete;
 bool operator>=(const StyleDisplay&, const StyleDisplay&) = delete;
 
 // Basic shapes
@@ -508,22 +502,16 @@ enum class StyleTextSizeAdjust : uint8_t
 
 // See nsStyleVisibility
 enum class StyleTextOrientation : uint8_t {
   Mixed,
   Upright,
   Sideways,
 };
 
-// Whether to emulate -moz-box with flex. See nsStyleVisibility
-enum class StyleMozBoxLayout : uint8_t {
-  Flex,
-  Legacy,
-};
-
 // Whether flexbox visibility: collapse items use legacy -moz-box behavior or
 // not.
 enum class StyleMozBoxCollapse : uint8_t {
   Flex,
   Legacy,
 };
 
 // See nsStyleText
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2690,43 +2690,40 @@ nsChangeHint nsStyleDisplay::CalcTransfo
 nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
     : mDirection(aDocument.GetBidiOptions() == IBMBIDI_TEXTDIRECTION_RTL
                      ? StyleDirection::Rtl
                      : StyleDirection::Ltr),
       mVisible(StyleVisibility::Visible),
       mImageRendering(StyleImageRendering::Auto),
       mWritingMode(StyleWritingModeProperty::HorizontalTb),
       mTextOrientation(StyleTextOrientation::Mixed),
-      mMozBoxLayout(StyleMozBoxLayout::Flex),
       mMozBoxCollapse(StyleMozBoxCollapse::Flex),
       mPrintColorAdjust(StylePrintColorAdjust::Economy),
       mImageOrientation(StyleImageOrientation::FromImage) {
   MOZ_COUNT_CTOR(nsStyleVisibility);
 }
 
 nsStyleVisibility::nsStyleVisibility(const nsStyleVisibility& aSource)
     : mDirection(aSource.mDirection),
       mVisible(aSource.mVisible),
       mImageRendering(aSource.mImageRendering),
       mWritingMode(aSource.mWritingMode),
       mTextOrientation(aSource.mTextOrientation),
-      mMozBoxLayout(aSource.mMozBoxLayout),
       mMozBoxCollapse(aSource.mMozBoxCollapse),
       mPrintColorAdjust(aSource.mPrintColorAdjust),
       mImageOrientation(aSource.mImageOrientation) {
   MOZ_COUNT_CTOR(nsStyleVisibility);
 }
 
 nsChangeHint nsStyleVisibility::CalcDifference(
     const nsStyleVisibility& aNewData) const {
   nsChangeHint hint = nsChangeHint(0);
 
   if (mDirection != aNewData.mDirection ||
-      mWritingMode != aNewData.mWritingMode ||
-      mMozBoxLayout != aNewData.mMozBoxLayout) {
+      mWritingMode != aNewData.mWritingMode) {
     // It's important that a change in mWritingMode results in frame
     // reconstruction, because it may affect intrinsic size (see
     // nsSubDocumentFrame::GetIntrinsicISize/BSize).
     // Also, the used writing-mode value is now a field on nsIFrame and some
     // classes (e.g. table rows/cells) copy their value from an ancestor.
     return nsChangeHint_ReconstructFrame;
   }
   if (mImageOrientation != aNewData.mImageOrientation) {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1072,20 +1072,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     return mVisible == mozilla::StyleVisibility::Collapse;
   }
 
   bool IsVisibleOrCollapsed() const {
     return mVisible == mozilla::StyleVisibility::Visible ||
            mVisible == mozilla::StyleVisibility::Collapse;
   }
 
-  bool EmulateMozBoxWithFlex() const {
-    return mMozBoxLayout == mozilla::StyleMozBoxLayout::Flex;
-  }
-
   bool UseLegacyCollapseBehavior() const {
     return mMozBoxCollapse == mozilla::StyleMozBoxCollapse::Legacy;
   }
 
   /**
    * Given an image request, returns the orientation that should be used
    * on the image. The returned orientation may differ from the style
    * struct's orientation member value, if the image request is not of the
@@ -1111,17 +1107,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
       imgIRequest* aRequest, mozilla::StyleImageOrientation aOrientation);
 
   static constexpr bool kHasTriggerImageLoads = false;
   mozilla::StyleDirection mDirection;
   mozilla::StyleVisibility mVisible;
   mozilla::StyleImageRendering mImageRendering;
   mozilla::StyleWritingModeProperty mWritingMode;
   mozilla::StyleTextOrientation mTextOrientation;
-  mozilla::StyleMozBoxLayout mMozBoxLayout;
   mozilla::StyleMozBoxCollapse mMozBoxCollapse;
   mozilla::StylePrintColorAdjust mPrintColorAdjust;
 
  private:
   mozilla::StyleImageOrientation mImageOrientation;
 };
 
 namespace mozilla {
@@ -1489,18 +1484,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
     auto outside = DisplayOutside(aDisplay);
     if (outside == mozilla::StyleDisplayOutside::Inline) {
       return true;
     }
     // just an optimization for the common case:
     if (outside == mozilla::StyleDisplayOutside::Block) {
       return false;
     }
-    return mozilla::StyleDisplay::MozInlineBox == aDisplay ||
-           mozilla::StyleDisplay::RubyBase == aDisplay ||
+    return mozilla::StyleDisplay::RubyBase == aDisplay ||
            mozilla::StyleDisplay::RubyBaseContainer == aDisplay ||
            mozilla::StyleDisplay::RubyText == aDisplay ||
            mozilla::StyleDisplay::RubyTextContainer == aDisplay;
   }
 
   bool IsInlineOutsideStyle() const {
     return IsDisplayTypeInlineOutside(mDisplay);
   }
--- a/layout/style/res/scrollbars.css
+++ b/layout/style/res/scrollbars.css
@@ -16,17 +16,16 @@
     pointer-events: inherit;
 
     /* These properties are not included in 'all'. */
     -moz-context-properties: initial;
     -moz-control-character-visibility: initial;
     -moz-font-smoothing-background-color: initial;
     -moz-min-font-size-ratio: initial;
     -moz-box-collapse: initial;
-    -moz-box-layout: initial;
 
     math-depth: initial;
     /* As long as inert implies pointer-events: none as it does now, we're
      * good. */
     -moz-inert: initial;
 
     /* direction: initial is not sufficient, since its initial value can depend
      * on the document's language. But we specify ltr explicitly below */
--- a/layout/style/test/ListCSSProperties.cpp
+++ b/layout/style/test/ListCSSProperties.cpp
@@ -98,17 +98,16 @@ const char* gInaccessibleProperties[] = 
     "-moz-script-level",  // parsed by UA sheets only
     "-moz-script-size-multiplier",
     "-moz-script-min-size",
     "-moz-math-variant",
     "-moz-math-display",                     // parsed by UA sheets only
     "-moz-top-layer",                        // parsed by UA sheets only
     "-moz-min-font-size-ratio",              // parsed by UA sheets only
     "-moz-box-collapse",                     // chrome-only internal properties
-    "-moz-box-layout",                       // chrome-only internal properties
     "-moz-font-smoothing-background-color",  // chrome-only internal properties
     "-moz-subtree-hidden-only-visually",     // chrome-only internal properties
     "-moz-window-input-region-margin",       // chrome-only internal properties
     "-moz-window-opacity",                   // chrome-only internal properties
     "-moz-window-transform",                 // chrome-only internal properties
     "-moz-window-transform-origin",          // chrome-only internal properties
     "-moz-window-shadow",                    // chrome-only internal properties
 };
--- a/layout/xul/moz.build
+++ b/layout/xul/moz.build
@@ -15,19 +15,16 @@ if CONFIG["ENABLE_TESTS"]:
 EXPORTS += [
     "nsIScrollbarMediator.h",
     "nsXULPopupManager.h",
     "nsXULTooltipListener.h",
 ]
 
 UNIFIED_SOURCES += [
     "MiddleCroppingLabelFrame.cpp",
-    "nsBox.cpp",
-    "nsBoxLayoutState.cpp",
-    "nsLeafBoxFrame.cpp",
     "nsMenuPopupFrame.cpp",
     "nsRepeatService.cpp",
     "nsScrollbarButtonFrame.cpp",
     "nsScrollbarFrame.cpp",
     "nsSliderFrame.cpp",
     "nsSplitterFrame.cpp",
     "nsXULPopupManager.cpp",
     "nsXULTooltipListener.cpp",
deleted file mode 100644
--- a/layout/xul/nsBox.cpp
+++ /dev/null
@@ -1,585 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/Attributes.h"
-#include "mozilla/StaticPtr.h"
-#include "nsIFrame.h"
-
-#include "nsBoxLayoutState.h"
-#include "nsDOMAttributeMap.h"
-#include "nsPresContext.h"
-#include "nsCOMPtr.h"
-#include "nsIContent.h"
-#include "nsContainerFrame.h"
-#include "nsNameSpaceManager.h"
-#include "nsGkAtoms.h"
-#include "nsITheme.h"
-#include "nsLayoutUtils.h"
-#include "mozilla/dom/Attr.h"
-#include "mozilla/dom/Element.h"
-#include <algorithm>
-
-using namespace mozilla;
-
-nsresult nsIFrame::BeginXULLayout(nsBoxLayoutState& aState) {
-  // mark ourselves as dirty so no child under us
-  // can post an incremental layout.
-  // XXXldb Is this still needed?
-  AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
-
-  if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
-    // If the parent is dirty, all the children are dirty (ReflowInput
-    // does this too).
-    nsIFrame* box;
-    for (box = GetChildXULBox(this); box; box = GetNextXULBox(box))
-      box->MarkSubtreeDirty();
-  }
-
-  // Another copy-over from ReflowInput.
-  // Since we are in reflow, we don't need to store these properties anymore.
-  RemoveProperty(UsedBorderProperty());
-  RemoveProperty(UsedPaddingProperty());
-  RemoveProperty(UsedMarginProperty());
-
-  return NS_OK;
-}
-
-nsresult nsIFrame::EndXULLayout(nsBoxLayoutState& aState) {
-  return SyncXULLayout(aState);
-}
-
-nsresult nsIFrame::GetXULClientRect(nsRect& aClientRect) {
-  aClientRect = mRect;
-  aClientRect.MoveTo(0, 0);
-
-  nsMargin borderPadding;
-  GetXULBorderAndPadding(borderPadding);
-
-  aClientRect.Deflate(borderPadding);
-
-  if (aClientRect.width < 0) aClientRect.width = 0;
-
-  if (aClientRect.height < 0) aClientRect.height = 0;
-
-  return NS_OK;
-}
-
-void nsIFrame::SetXULBounds(nsBoxLayoutState& aState, const nsRect& aRect,
-                            bool aRemoveOverflowAreas) {
-  nsRect rect(mRect);
-
-  ReflowChildFlags flags = GetXULLayoutFlags() | aState.LayoutFlags();
-
-  if ((flags & ReflowChildFlags::NoMoveFrame) ==
-      ReflowChildFlags::NoMoveFrame) {
-    SetSize(aRect.Size());
-  } else {
-    SetRect(aRect);
-  }
-
-  // Nuke the overflow area. The caller is responsible for restoring
-  // it if necessary.
-  if (aRemoveOverflowAreas) {
-    // remove the previously stored overflow area
-    ClearOverflowRects();
-  }
-
-  if (!(flags & ReflowChildFlags::NoMoveView)) {
-    nsContainerFrame::PositionFrameView(this);
-    if ((rect.x != aRect.x) || (rect.y != aRect.y))
-      nsContainerFrame::PositionChildViews(this);
-  }
-}
-
-nsresult nsIFrame::GetXULBorderAndPadding(nsMargin& aBorderAndPadding) {
-  aBorderAndPadding.SizeTo(0, 0, 0, 0);
-  nsresult rv = GetXULBorder(aBorderAndPadding);
-  if (NS_FAILED(rv)) return rv;
-
-  nsMargin padding;
-  rv = GetXULPadding(padding);
-  if (NS_FAILED(rv)) return rv;
-
-  aBorderAndPadding += padding;
-
-  return rv;
-}
-
-nsresult nsIFrame::GetXULBorder(nsMargin& aBorder) {
-  aBorder.SizeTo(0, 0, 0, 0);
-
-  StyleAppearance appearance = StyleDisplay()->EffectiveAppearance();
-  if (appearance != StyleAppearance::None) {
-    // Go to the theme for the border.
-    nsPresContext* pc = PresContext();
-    nsITheme* theme = pc->Theme();
-    if (theme->ThemeSupportsWidget(pc, this, appearance)) {
-      LayoutDeviceIntMargin margin =
-          theme->GetWidgetBorder(pc->DeviceContext(), this, appearance);
-      aBorder =
-          LayoutDevicePixel::ToAppUnits(margin, pc->AppUnitsPerDevPixel());
-      return NS_OK;
-    }
-  }
-
-  aBorder = StyleBorder()->GetComputedBorder();
-
-  return NS_OK;
-}
-
-nsresult nsIFrame::GetXULPadding(nsMargin& aBorderAndPadding) {
-  StyleAppearance appearance = StyleDisplay()->EffectiveAppearance();
-  if (appearance != StyleAppearance::None) {
-    // Go to the theme for the padding.
-    nsPresContext* pc = PresContext();
-    nsITheme* theme = pc->Theme();
-    if (theme->ThemeSupportsWidget(pc, this, appearance)) {
-      LayoutDeviceIntMargin padding;
-      bool useThemePadding = theme->GetWidgetPadding(pc->DeviceContext(), this,
-                                                     appearance, &padding);
-      if (useThemePadding) {
-        aBorderAndPadding =
-            LayoutDevicePixel::ToAppUnits(padding, pc->AppUnitsPerDevPixel());
-        return NS_OK;
-      }
-    }
-  }
-
-  aBorderAndPadding.SizeTo(0, 0, 0, 0);
-  StylePadding()->GetPadding(aBorderAndPadding);
-
-  return NS_OK;
-}
-
-nsresult nsIFrame::GetXULMargin(nsMargin& aMargin) {
-  aMargin.SizeTo(0, 0, 0, 0);
-  StyleMargin()->GetMargin(aMargin);
-
-  return NS_OK;
-}
-
-void nsIFrame::XULSizeNeedsRecalc(nsSize& aSize) {
-  aSize.width = -1;
-  aSize.height = -1;
-}
-
-void nsIFrame::XULCoordNeedsRecalc(nscoord& aCoord) { aCoord = -1; }
-
-bool nsIFrame::XULNeedsRecalc(const nsSize& aSize) {
-  return (aSize.width == -1 || aSize.height == -1);
-}
-
-bool nsIFrame::XULNeedsRecalc(nscoord aCoord) { return (aCoord == -1); }
-
-nsSize nsIFrame::GetUncachedXULPrefSize(nsBoxLayoutState& aBoxLayoutState) {
-  NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
-               "must have rendering context");
-
-  nsSize pref(0, 0);
-  DISPLAY_PREF_SIZE(this, pref);
-
-  if (IsXULCollapsed()) {
-    return pref;
-  }
-
-  AddXULBorderAndPadding(pref);
-  bool widthSet, heightSet;
-  nsIFrame::AddXULPrefSize(this, pref, widthSet, heightSet);
-
-  nsSize minSize = GetXULMinSize(aBoxLayoutState);
-  nsSize maxSize = GetXULMaxSize(aBoxLayoutState);
-  return XULBoundsCheck(minSize, pref, maxSize);
-}
-
-nsSize nsIFrame::GetUncachedXULMinSize(nsBoxLayoutState& aBoxLayoutState) {
-  NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
-               "must have rendering context");
-
-  nsSize min(0, 0);
-  DISPLAY_MIN_SIZE(this, min);
-
-  if (IsXULCollapsed()) {
-    return min;
-  }
-
-  AddXULBorderAndPadding(min);
-  bool widthSet, heightSet;
-  nsIFrame::AddXULMinSize(this, min, widthSet, heightSet);
-  return min;
-}
-
-nsSize nsIFrame::GetUncachedXULMaxSize(nsBoxLayoutState& aBoxLayoutState) {
-  NS_ASSERTION(aBoxLayoutState.GetRenderingContext(),
-               "must have rendering context");
-
-  nsSize maxSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
-  DISPLAY_MAX_SIZE(this, maxSize);
-
-  if (IsXULCollapsed()) {
-    return maxSize;
-  }
-
-  AddXULBorderAndPadding(maxSize);
-  bool widthSet, heightSet;
-  nsIFrame::AddXULMaxSize(this, maxSize, widthSet, heightSet);
-  return maxSize;
-}
-
-bool nsIFrame::IsXULCollapsed() {
-  return StyleVisibility()->mVisible == StyleVisibility::Collapse;
-}
-
-nsresult nsIFrame::XULLayout(nsBoxLayoutState& aState) {
-  NS_ASSERTION(aState.GetRenderingContext(), "must have rendering context");
-
-  nsIFrame* box = static_cast<nsIFrame*>(this);
-  DISPLAY_LAYOUT(box);
-
-  box->BeginXULLayout(aState);
-
-  box->DoXULLayout(aState);
-
-  box->EndXULLayout(aState);
-
-  return NS_OK;
-}
-
-bool nsIFrame::DoesClipChildrenInBothAxes() {
-  const nsStyleDisplay* display = StyleDisplay();
-  return display->mOverflowX == StyleOverflow::Clip &&
-         display->mOverflowY == StyleOverflow::Clip;
-}
-
-nsresult nsIFrame::SyncXULLayout(nsBoxLayoutState& aBoxLayoutState) {
-  /*
-  if (IsXULCollapsed()) {
-    CollapseChild(aBoxLayoutState, this, true);
-    return NS_OK;
-  }
-  */
-
-  if (HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
-    XULRedraw(aBoxLayoutState);
-  }
-
-  RemoveStateBits(NS_FRAME_HAS_DIRTY_CHILDREN | NS_FRAME_IS_DIRTY |
-                  NS_FRAME_FIRST_REFLOW | NS_FRAME_IN_REFLOW);
-
-  nsPresContext* presContext = aBoxLayoutState.PresContext();
-
-  ReflowChildFlags flags = GetXULLayoutFlags() | aBoxLayoutState.LayoutFlags();
-
-  nsRect inkOverflow;
-
-  if (XULComputesOwnOverflowArea()) {
-    inkOverflow = InkOverflowRect();
-  } else {
-    nsRect rect(nsPoint(0, 0), GetSize());
-    OverflowAreas overflowAreas(rect, rect);
-    if (!DoesClipChildrenInBothAxes() && !IsXULCollapsed()) {
-      // See if our child frames caused us to overflow after being laid
-      // out. If so, store the overflow area.  This normally can't happen
-      // in XUL, but it can happen with the CSS 'outline' property and
-      // possibly with other exotic stuff (e.g. relatively positioned
-      // frames in HTML inside XUL).
-      nsLayoutUtils::UnionChildOverflow(this, overflowAreas);
-    }
-
-    FinishAndStoreOverflow(overflowAreas, GetSize());
-    inkOverflow = overflowAreas.InkOverflow();
-  }
-
-  nsView* view = GetView();
-  if (view) {
-    // Make sure the frame's view is properly sized and positioned and has
-    // things like opacity correct
-    nsContainerFrame::SyncFrameViewAfterReflow(presContext, this, view,
-                                               inkOverflow, flags);
-  }
-
-  return NS_OK;
-}
-
-nsresult nsIFrame::XULRedraw(nsBoxLayoutState& aState) {
-  if (aState.PaintingDisabled()) return NS_OK;
-
-  // Unclear whether we could get away with just InvalidateFrame().
-  InvalidateFrameSubtree();
-
-  return NS_OK;
-}
-
-bool nsIFrame::AddXULPrefSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
-                              bool& aHeightSet) {
-  aWidthSet = false;
-  aHeightSet = false;
-
-  // add in the css min, max, pref
-  const nsStylePosition* position = aBox->StylePosition();
-
-  // see if the width or height was specifically set
-  // XXX Handle eStyleUnit_Enumerated?
-  // (Handling the eStyleUnit_Enumerated types requires
-  // GetXULPrefSize/GetXULMinSize methods that don't consider
-  // (min-/max-/)(width/height) properties.)
-  const auto& width = position->mWidth;
-  if (width.ConvertsToLength()) {
-    aSize.width = std::max(0, width.ToLength());
-    aWidthSet = true;
-  }
-
-  const auto& height = position->mHeight;
-  if (height.ConvertsToLength()) {
-    aSize.height = std::max(0, height.ToLength());
-    aHeightSet = true;
-  }
-
-  nsIContent* content = aBox->GetContent();
-  // ignore 'height' and 'width' attributes if the actual element is not XUL
-  // For example, we might be magic XUL frames whose primary content is an HTML
-  // <select>
-  if (content && content->IsXULElement()) {
-    nsAutoString value;
-    nsresult error;
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      aSize.width = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      aWidthSet = true;
-    }
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::height, value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      aSize.height =
-          nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      aHeightSet = true;
-    }
-  }
-
-  return (aWidthSet && aHeightSet);
-}
-
-bool nsIFrame::AddXULMinSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
-                             bool& aHeightSet) {
-  aWidthSet = false;
-  aHeightSet = false;
-
-  nsPresContext* pc = aBox->PresContext();
-
-  // See if a native theme wants to supply a minimum size.
-  const nsStyleDisplay* display = aBox->StyleDisplay();
-  if (display->HasAppearance()) {
-    nsITheme* theme = pc->Theme();
-    StyleAppearance appearance = display->EffectiveAppearance();
-    if (theme->ThemeSupportsWidget(pc, aBox, appearance)) {
-      LayoutDeviceIntSize size =
-          theme->GetMinimumWidgetSize(pc, aBox, appearance);
-      if (size.width) {
-        aSize.width = pc->DevPixelsToAppUnits(size.width);
-        aWidthSet = true;
-      }
-      if (size.height) {
-        aSize.height = pc->DevPixelsToAppUnits(size.height);
-        aHeightSet = true;
-      }
-    }
-  }
-
-  // add in the css min, max, pref
-  const nsStylePosition* position = aBox->StylePosition();
-  const auto& minWidth = position->mMinWidth;
-  if (minWidth.ConvertsToLength()) {
-    nscoord min = minWidth.ToLength();
-    if (!aWidthSet || min > aSize.width) {
-      aSize.width = min;
-      aWidthSet = true;
-    }
-  } else if (minWidth.ConvertsToPercentage()) {
-    NS_ASSERTION(minWidth.ToPercentage() == 0.0f,
-                 "Non-zero percentage values not currently supported");
-    aSize.width = 0;
-    aWidthSet = true;  // FIXME: should we really do this for
-                       // nonzero values?
-  }
-  // XXX Handle ExtremumLength?
-  // (Handling them  requires GetXULPrefSize/GetXULMinSize methods that don't
-  // consider (min-/max-/)(width/height) properties.
-  // calc() with percentage is treated like '0' (unset)
-
-  const auto& minHeight = position->mMinHeight;
-  if (minHeight.ConvertsToLength()) {
-    nscoord min = minHeight.ToLength();
-    if (!aHeightSet || min > aSize.height) {
-      aSize.height = min;
-      aHeightSet = true;
-    }
-  } else if (minHeight.ConvertsToPercentage()) {
-    NS_ASSERTION(position->mMinHeight.ToPercentage() == 0.0f,
-                 "Non-zero percentage values not currently supported");
-    aSize.height = 0;
-    aHeightSet = true;  // FIXME: should we really do this for
-                        // nonzero values?
-  }
-  // calc() with percentage is treated like '0' (unset)
-
-  nsIContent* content = aBox->GetContent();
-  if (content && content->IsXULElement()) {
-    nsAutoString value;
-    nsresult error;
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth,
-                                  value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      if (val > aSize.width) aSize.width = val;
-      aWidthSet = true;
-    }
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::minheight,
-                                  value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      if (val > aSize.height) aSize.height = val;
-
-      aHeightSet = true;
-    }
-  }
-
-  return (aWidthSet && aHeightSet);
-}
-
-bool nsIFrame::AddXULMaxSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
-                             bool& aHeightSet) {
-  aWidthSet = false;
-  aHeightSet = false;
-
-  // add in the css min, max, pref
-  const nsStylePosition* position = aBox->StylePosition();
-
-  // and max
-  // see if the width or height was specifically set
-  // XXX Handle eStyleUnit_Enumerated?
-  // (Handling the eStyleUnit_Enumerated types requires
-  // GetXULPrefSize/GetXULMinSize methods that don't consider
-  // (min-/max-/)(width/height) properties.)
-  const auto& maxWidth = position->mMaxWidth;
-  if (maxWidth.ConvertsToLength()) {
-    aSize.width = maxWidth.ToLength();
-    aWidthSet = true;
-  }
-  // percentages and calc() with percentages are treated like 'none'
-
-  const auto& maxHeight = position->mMaxHeight;
-  if (maxHeight.ConvertsToLength()) {
-    aSize.height = maxHeight.ToLength();
-    aHeightSet = true;
-  }
-  // percentages and calc() with percentages are treated like 'none'
-
-  nsIContent* content = aBox->GetContent();
-  if (content && content->IsXULElement()) {
-    nsAutoString value;
-    nsresult error;
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth,
-                                  value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      aSize.width = val;
-      aWidthSet = true;
-    }
-
-    content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::maxheight,
-                                  value);
-    if (!value.IsEmpty()) {
-      value.Trim("%");
-
-      nscoord val = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
-      aSize.height = val;
-
-      aHeightSet = true;
-    }
-  }
-
-  return (aWidthSet || aHeightSet);
-}
-
-void nsIFrame::AddXULBorderAndPadding(nsSize& aSize) {
-  AddXULBorderAndPadding(this, aSize);
-}
-
-void nsIFrame::AddXULBorderAndPadding(nsIFrame* aBox, nsSize& aSize) {
-  nsMargin borderPadding(0, 0, 0, 0);
-  aBox->GetXULBorderAndPadding(borderPadding);
-  AddXULMargin(aSize, borderPadding);
-}
-
-void nsIFrame::AddXULMargin(nsIFrame* aChild, nsSize& aSize) {
-  nsMargin margin(0, 0, 0, 0);
-  aChild->GetXULMargin(margin);
-  AddXULMargin(aSize, margin);
-}
-
-void nsIFrame::AddXULMargin(nsSize& aSize, const nsMargin& aMargin) {
-  if (aSize.width != NS_UNCONSTRAINEDSIZE)
-    aSize.width += aMargin.left + aMargin.right;
-
-  if (aSize.height != NS_UNCONSTRAINEDSIZE)
-    aSize.height += aMargin.top + aMargin.bottom;
-}
-
-nscoord nsIFrame::XULBoundsCheck(nscoord aMin, nscoord aPref, nscoord aMax) {
-  if (aPref > aMax) aPref = aMax;
-
-  if (aPref < aMin) aPref = aMin;
-
-  return aPref;
-}
-
-nsSize nsIFrame::XULBoundsCheckMinMax(const nsSize& aMinSize,
-                                      const nsSize& aMaxSize) {
-  return nsSize(std::max(aMaxSize.width, aMinSize.width),
-                std::max(aMaxSize.height, aMinSize.height));
-}
-
-nsSize nsIFrame::XULBoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize,
-                                const nsSize& aMaxSize) {
-  return nsSize(
-      XULBoundsCheck(aMinSize.width, aPrefSize.width, aMaxSize.width),
-      XULBoundsCheck(aMinSize.height, aPrefSize.height, aMaxSize.height));
-}
-
-/*static*/
-nsIFrame* nsIFrame::GetChildXULBox(const nsIFrame* aFrame) {
-  // box layout ends at box-wrapped frames, so don't allow these frames
-  // to report child boxes.
-  return aFrame->IsXULBoxFrame() ? aFrame->PrincipalChildList().FirstChild()
-                                 : nullptr;
-}
-
-/*static*/
-nsIFrame* nsIFrame::GetNextXULBox(const nsIFrame* aFrame) {
-  return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame()
-             ? aFrame->GetNextSibling()
-             : nullptr;
-}
-
-/*static*/
-nsIFrame* nsIFrame::GetParentXULBox(const nsIFrame* aFrame) {
-  return aFrame->GetParent() && aFrame->GetParent()->IsXULBoxFrame()
-             ? aFrame->GetParent()
-             : nullptr;
-}
deleted file mode 100644
--- a/layout/xul/nsBoxLayoutState.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//
-// Eric Vaughan
-// Netscape Communications
-//
-// See documentation in associated header file
-//
-
-#include "nsBoxLayoutState.h"
-
-nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
-                                   gfxContext* aRenderingContext,
-                                   const ReflowInput* aOuterReflowInput,
-                                   uint16_t aReflowDepth)
-    : mPresContext(aPresContext),
-      mRenderingContext(aRenderingContext),
-      mOuterReflowInput(aOuterReflowInput),
-      mLayoutFlags(nsIFrame::ReflowChildFlags::Default),
-      mReflowDepth(aReflowDepth),
-      mPaintingDisabled(false) {
-  NS_ASSERTION(mPresContext, "PresContext must be non-null");
-}
-
-nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
-    : mPresContext(aState.mPresContext),
-      mRenderingContext(aState.mRenderingContext),
-      mOuterReflowInput(aState.mOuterReflowInput),
-      mLayoutFlags(aState.mLayoutFlags),
-      mReflowDepth(aState.mReflowDepth + 1),
-      mPaintingDisabled(aState.mPaintingDisabled) {
-  NS_ASSERTION(mPresContext, "PresContext must be non-null");
-}
deleted file mode 100644
--- a/layout/xul/nsBoxLayoutState.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
-
-  Author:
-  Eric D Vaughan
-
-**/
-
-#ifndef nsBoxLayoutState_h___
-#define nsBoxLayoutState_h___
-
-#include "nsCOMPtr.h"
-#include "nsPresContext.h"
-#include "nsIFrame.h"
-
-class gfxContext;
-namespace mozilla {
-class PresShell;
-struct ReflowInput;
-}  // namespace mozilla
-
-class MOZ_STACK_CLASS nsBoxLayoutState {
-  using ReflowInput = mozilla::ReflowInput;
-
- public:
-  explicit nsBoxLayoutState(nsPresContext* aPresContext,
-                            gfxContext* aRenderingContext = nullptr,
-                            // see OuterReflowInput() below
-                            const ReflowInput* aOuterReflowInput = nullptr,
-                            uint16_t aReflowDepth = 0);
-  nsBoxLayoutState(const nsBoxLayoutState& aState);
-
-  nsPresContext* PresContext() const { return mPresContext; }
-  mozilla::PresShell* PresShell() const { return mPresContext->PresShell(); }
-
-  nsIFrame::ReflowChildFlags LayoutFlags() const { return mLayoutFlags; }
-  void SetLayoutFlags(nsIFrame::ReflowChildFlags aFlags) {
-    mLayoutFlags = aFlags;
-  }
-
-  // if true no one under us will paint during reflow.
-  void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; }
-  bool PaintingDisabled() const { return mPaintingDisabled; }
-
-  // The rendering context may be null for specialized uses of
-  // nsBoxLayoutState and should be null-checked before it is used.
-  // However, passing a null rendering context to the constructor when
-  // doing box layout or intrinsic size calculation will cause bugs.
-  gfxContext* GetRenderingContext() const { return mRenderingContext; }
-
-  struct AutoReflowDepth {
-    explicit AutoReflowDepth(nsBoxLayoutState& aState) : mState(aState) {
-      ++mState.mReflowDepth;
-    }
-    ~AutoReflowDepth() { --mState.mReflowDepth; }
-    nsBoxLayoutState& mState;
-  };
-
-  // The HTML reflow input that lives outside the box-block boundary.
-  // May not be set reliably yet.
-  const ReflowInput* OuterReflowInput() { return mOuterReflowInput; }
-
-  uint16_t GetReflowDepth() { return mReflowDepth; }
-
- private:
-  RefPtr<nsPresContext> mPresContext;
-  gfxContext* mRenderingContext;
-  const ReflowInput* mOuterReflowInput;
-  nsIFrame::ReflowChildFlags mLayoutFlags;
-  uint16_t mReflowDepth;
-  bool mPaintingDisabled;
-};
-
-#endif
deleted file mode 100644
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//
-// Eric Vaughan
-// Netscape Communications
-//
-// See documentation in associated header file
-//
-
-#include "mozilla/ComputedStyle.h"
-#include "mozilla/PresShell.h"
-#include "nsLeafBoxFrame.h"
-#include "nsCOMPtr.h"
-#include "nsGkAtoms.h"
-#include "nsPresContext.h"
-#include "nsIContent.h"
-#include "nsNameSpaceManager.h"
-#include "nsBoxLayoutState.h"
-#include "nsWidgetsCID.h"
-#include "nsViewManager.h"
-#include "nsContainerFrame.h"
-#include "nsDisplayList.h"
-#include <algorithm>
-
-using namespace mozilla;
-
-//
-// NS_NewLeafBoxFrame
-//
-// Creates a new Toolbar frame and returns it
-//
-nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
-  return new (aPresShell) nsLeafBoxFrame(aStyle, aPresShell->GetPresContext());
-}
-
-NS_IMPL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
-
-/**
- * Initialize us. This is a good time to get the alignment of the box
- */
-void nsLeafBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
-                          nsIFrame* aPrevInFlow) {
-  nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
-
-  if (HasAnyStateBits(NS_FRAME_FONT_INFLATION_CONTAINER)) {
-    AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
-  }
-}
-
-void nsLeafBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
-                                      const nsDisplayListSet& aLists) {
-  // REVIEW: GetFrameForPoint used to not report events for the background
-  // layer, whereas this code will put an event receiver for this frame in the
-  // BlockBorderBackground() list. But I don't see any need to preserve
-  // that anomalous behaviour. The important thing I'm preserving is that
-  // leaf boxes continue to receive events in the foreground layer.
-  DisplayBorderBackgroundOutline(aBuilder, aLists);
-
-  if (!aBuilder->IsForEventDelivery() || !IsVisibleForPainting()) return;
-
-  aLists.Content()->AppendNewToTop<nsDisplayEventReceiver>(aBuilder, this);
-}
-
-/* virtual */
-nscoord nsLeafBoxFrame::GetMinISize(gfxContext* aRenderingContext) {
-  nscoord result;
-  DISPLAY_MIN_INLINE_SIZE(this, result);
-  nsBoxLayoutState state(PresContext(), aRenderingContext);
-
-  WritingMode wm = GetWritingMode();
-  LogicalSize minSize(wm, GetXULMinSize(state));
-
-  // GetXULMinSize returns border-box size, and we want to return content
-  // inline-size.  Since Reflow uses the reflow input's border and padding, we
-  // actually just want to subtract what GetXULMinSize added, which is the
-  // result of GetXULBorderAndPadding.
-  nsMargin bp;
-  GetXULBorderAndPadding(bp);
-
-  result = minSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
-
-  return result;
-}
-
-/* virtual */
-nscoord nsLeafBoxFrame::GetPrefISize(gfxContext* aRenderingContext) {
-  nscoord result;
-  DISPLAY_PREF_INLINE_SIZE(this, result);
-  nsBoxLayoutState state(PresContext(), aRenderingContext);
-
-  WritingMode wm = GetWritingMode();
-  LogicalSize prefSize(wm, GetXULPrefSize(state));
-
-  // GetXULPrefSize returns border-box size, and we want to return content
-  // inline-size.  Since Reflow uses the reflow input's border and padding, we
-  // actually just want to subtract what GetXULPrefSize added, which is the
-  // result of GetXULBorderAndPadding.
-  nsMargin bp;
-  GetXULBorderAndPadding(bp);
-
-  result = prefSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
-
-  return result;
-}
-
-nscoord nsLeafBoxFrame::GetIntrinsicISize() {
-  // No intrinsic width
-  return 0;
-}
-
-LogicalSize nsLeafBoxFrame::ComputeAutoSize(
-    gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
-    nscoord aAvailableISize, const LogicalSize& aMargin,
-    const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
-    ComputeSizeFlags aFlags) {
-  // Important: NOT calling our direct superclass here!
-  return nsIFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
-                                   aAvailableISize, aMargin, aBorderPadding,
-                                   aSizeOverrides, aFlags);
-}
-
-void nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
-                            ReflowOutput& aDesiredSize,
-                            const ReflowInput& aReflowInput,
-                            nsReflowStatus& aStatus) {
-  MarkInReflow();
-  DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame");
-  DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
-  MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
-
-  NS_ASSERTION(
-      aReflowInput.ComputedWidth() >= 0 && aReflowInput.ComputedHeight() >= 0,
-      "Computed Size < 0");
-
-#ifdef DO_NOISY_REFLOW
-  printf(
-      "\n-------------Starting LeafBoxFrame Reflow "
-      "----------------------------\n");
-  printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);
-  switch (aReflowInput.reason) {
-    case eReflowReason_Initial:
-      printf("Ini");
-      break;
-    case eReflowReason_Incremental:
-      printf("Inc");
-      break;
-    case eReflowReason_Resize:
-      printf("Rsz");
-      break;
-    case eReflowReason_StyleChange:
-      printf("Sty");
-      break;
-    case eReflowReason_Dirty:
-      printf("Drt ");
-      break;
-    default:
-      printf("<unknown>%d", aReflowInput.reason);
-      break;
-  }
-
-  printSize("AW", aReflowInput.AvailableWidth());
-  printSize("AH", aReflowInput.AvailableHeight());
-  printSize("CW", aReflowInput.ComputedWidth());
-  printSize("CH", aReflowInput.ComputedHeight());
-
-  printf(" *\n");
-
-#endif
-
-  // create the layout state
-  nsBoxLayoutState state(aPresContext, aReflowInput.mRenderingContext);
-
-  nsSize computedSize(aReflowInput.ComputedWidth(),
-                      aReflowInput.ComputedHeight());
-
-  nsMargin m;
-  m = aReflowInput.ComputedPhysicalBorderPadding();
-
-  // GetXULBorderAndPadding(m);
-
-  // this happens sometimes. So lets handle it gracefully.
-  if (aReflowInput.ComputedHeight() == 0) {
-    nsSize minSize = GetXULMinSize(state);
-    computedSize.height = minSize.height - m.top - m.bottom;
-  }
-
-  nsSize prefSize(0, 0);
-
-  // if we are told to layout intrinic then get our preferred size.
-  if (computedSize.width == NS_UNCONSTRAINEDSIZE ||
-      computedSize.height == NS_UNCONSTRAINEDSIZE) {
-    prefSize = GetXULPrefSize(state);
-    nsSize minSize = GetXULMinSize(state);
-    nsSize maxSize = GetXULMaxSize(state);
-    prefSize = XULBoundsCheck(minSize, prefSize, maxSize);
-  }
-
-  // get our desiredSize
-  if (aReflowInput.ComputedWidth() == NS_UNCONSTRAINEDSIZE) {
-    computedSize.width = prefSize.width;
-  } else {
-    computedSize.width += m.left + m.right;
-  }
-
-  if (aReflowInput.ComputedHeight() == NS_UNCONSTRAINEDSIZE) {
-    computedSize.height = prefSize.height;
-  } else {
-    computedSize.height += m.top + m.bottom;
-  }
-
-  // handle reflow input min and max sizes
-  // XXXbz the width handling here seems to be wrong, since
-  // mComputedMin/MaxWidth is a content-box size, whole
-  // computedSize.width is a border-box size...
-  if (computedSize.width > aReflowInput.ComputedMaxWidth())
-    computedSize.width = aReflowInput.ComputedMaxWidth();
-
-  if (computedSize.width < aReflowInput.ComputedMinWidth())
-    computedSize.width = aReflowInput.ComputedMinWidth();
-
-  // Now adjust computedSize.height for our min and max computed
-  // height.  The only problem is that those are content-box sizes,
-  // while computedSize.height is a border-box size.  So subtract off
-  // m.TopBottom() before adjusting, then readd it.
-  computedSize.height = std::max(0, computedSize.height - m.TopBottom());
-  computedSize.height =
-      NS_CSS_MINMAX(computedSize.height, aReflowInput.ComputedMinHeight(),
-                    aReflowInput.ComputedMaxHeight());
-  computedSize.height += m.TopBottom();
-
-  nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
-
-  SetXULBounds(state, r);
-
-  // layout our children
-  XULLayout(state);
-
-  // ok our child could have gotten bigger. So lets get its bounds
-  aDesiredSize.Width() = mRect.width;
-  aDesiredSize.Height() = mRect.height;
-  aDesiredSize.SetBlockStartAscent(GetXULBoxAscent(state));
-
-  // the overflow rect is set in SetXULBounds() above
-  aDesiredSize.mOverflowAreas = GetOverflowAreas();
-
-#ifdef DO_NOISY_REFLOW
-  {
-    printf("%p ** nsLBF(done) W:%d H:%d  ", this, aDesiredSize.Width(),
-           aDesiredSize.Height());
-
-    if (maxElementWidth) {
-      printf("MW:%d\n", *maxElementWidth);
-    } else {
-      printf("MW:?\n");
-    }
-  }
-#endif
-}
-
-#ifdef DEBUG_FRAME_DUMP
-nsresult nsLeafBoxFrame::GetFrameName(nsAString& aResult) const {
-  return MakeFrameName(u"LeafBox"_ns, aResult);
-}
-#endif
-
-nsresult nsLeafBoxFrame::CharacterDataChanged(
-    const CharacterDataChangeInfo& aInfo) {
-  MarkIntrinsicISizesDirty();
-  return nsLeafFrame::CharacterDataChanged(aInfo);
-}
-
-/* virtual */
-nsSize nsLeafBoxFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
-  return nsIFrame::GetUncachedXULPrefSize(aState);
-}
-
-/* virtual */
-nsSize nsLeafBoxFrame::GetXULMinSize(nsBoxLayoutState& aState) {
-  return nsIFrame::GetUncachedXULMinSize(aState);
-}
-
-/* virtual */
-nsSize nsLeafBoxFrame::GetXULMaxSize(nsBoxLayoutState& aState) {
-  return nsIFrame::GetUncachedXULMaxSize(aState);
-}
-
-/* virtual */
-nscoord nsLeafBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aState) {
-  if (IsXULCollapsed()) {
-    return 0;
-  }
-  return GetXULPrefSize(aState).height;
-}
-
-NS_IMETHODIMP
-nsLeafBoxFrame::DoXULLayout(nsBoxLayoutState& aState) { return NS_OK; }
deleted file mode 100644
--- a/layout/xul/nsLeafBoxFrame.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsLeafBoxFrame_h___
-#define nsLeafBoxFrame_h___
-
-#include "mozilla/Attributes.h"
-#include "nsLeafFrame.h"
-
-namespace mozilla {
-class PresShell;
-}  // namespace mozilla
-
-class nsLeafBoxFrame : public nsLeafFrame {
- public:
-  NS_DECL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
-
-  friend nsIFrame* NS_NewLeafBoxFrame(mozilla::PresShell* aPresShell,
-                                      ComputedStyle* aStyle);
-
-  virtual nsSize GetXULPrefSize(nsBoxLayoutState& aState) override;
-  virtual nsSize GetXULMinSize(nsBoxLayoutState& aState) override;
-  virtual nsSize GetXULMaxSize(nsBoxLayoutState& aState) override;
-  virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aState) override;
-
-  virtual bool IsFrameOfType(uint32_t aFlags) const override {
-    // This is bogus, but it's what we've always done.
-    // Note that nsLeafFrame is also eReplacedContainsBlock.
-    return nsLeafFrame::IsFrameOfType(
-        aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock |
-                   nsIFrame::eXULBox));
-  }
-
-#ifdef DEBUG_FRAME_DUMP
-  virtual nsresult GetFrameName(nsAString& aResult) const override;
-#endif
-
-  // nsIHTMLReflow overrides
-
-  virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
-  virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
-
-  // Our auto size is that provided by nsFrame, not nsLeafFrame
-  mozilla::LogicalSize ComputeAutoSize(
-      gfxContext* aRenderingContext, mozilla::WritingMode aWM,
-      const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
-      const mozilla::LogicalSize& aMargin,
-      const mozilla::LogicalSize& aBorderPadding,
-      const mozilla::StyleSizeOverrides& aSizeOverrides,
-      mozilla::ComputeSizeFlags aFlags) override;
-
-  virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
-                      const ReflowInput& aReflowInput,
-                      nsReflowStatus& aStatus) override;
-
-  virtual nsresult CharacterDataChanged(
-      const CharacterDataChangeInfo&) override;
-
-  virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
-                    nsIFrame* asPrevInFlow) override;
-
-  virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
-                                const nsDisplayListSet& aLists) override;
-
-  virtual bool XULComputesOwnOverflowArea() override { return false; }
-
- protected:
-  NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
-
-  virtual nscoord GetIntrinsicISize() override;
-
-  explicit nsLeafBoxFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
-                          ClassID aID = kClassID)
-      : nsLeafFrame(aStyle, aPresContext, aID) {}
-
-};  // class nsLeafBoxFrame
-
-#endif /* nsLeafBoxFrame_h___ */
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -19,17 +19,16 @@
 #include "nsNameSpaceManager.h"
 #include "nsIFrameInlines.h"
 #include "nsViewManager.h"
 #include "nsWidgetsCID.h"
 #include "nsPIDOMWindow.h"
 #include "nsFrameManager.h"
 #include "mozilla/dom/Document.h"
 #include "nsRect.h"
-#include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
 #include "nsIPopupContainer.h"
 #include "nsIDocShell.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsContentUtils.h"
 #include "nsCSSFrameConstructor.h"
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -22,17 +22,16 @@
 #include "nsHTMLParts.h"
 #include "nsCSSRendering.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsISupportsImpl.h"
 #include "nsScrollbarFrame.h"
 #include "nsRepeatService.h"
-#include "nsBoxLayoutState.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsDeviceContext.h"
 #include "nsRefreshDriver.h"     // for nsAPostRefreshObserver
 #include "mozilla/Assertions.h"  // for MOZ_ASSERT
 #include "mozilla/DisplayPortUtils.h"
 #include "mozilla/LookAndFeel.h"
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -6,32 +6,33 @@
 
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
+#include "LayoutConstants.h"
 #include "SimpleXULLeafFrame.h"
 #include "gfxContext.h"
+#include "mozilla/ReflowInput.h"
 #include "nsSplitterFrame.h"
 #include "nsGkAtoms.h"
 #include "nsXULElement.h"
 #include "nsPresContext.h"
 #include "mozilla/dom/Document.h"
 #include "nsNameSpaceManager.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsIDOMEventListener.h"
 #include "nsICSSDeclaration.h"
 #include "nsFrameList.h"
 #include "nsHTMLParts.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/CSSOrderAwareFrameIterator.h"
-#include "nsBoxLayoutState.h"
 #include "nsContainerFrame.h"
 #include "nsContentCID.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 #include "nsFlexContainerFrame.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
@@ -138,18 +139,17 @@ class nsSplitterFrameInner final : publi
 
   ResizeType GetResizeBefore();
   ResizeType GetResizeAfter();
   State GetState();
 
   bool SupportsCollapseDirection(CollapseDirection aDirection);
 
   void EnsureOrient();
-  void SetPreferredSize(nsBoxLayoutState& aState, nsIFrame* aChildBox,
-                        bool aIsHorizontal, nscoord aSize);
+  void SetPreferredSize(nsIFrame* aChildBox, bool aIsHorizontal, nscoord aSize);
 
   nsSplitterFrame* mOuter;
   bool mDidDrag = false;
   nscoord mDragStart = 0;
   nsIFrame* mParentBox = nullptr;
   bool mPressed = false;
   nsTArray<nsSplitterInfo> mChildInfosBefore;
   nsTArray<nsSplitterInfo> mChildInfosAfter;
@@ -509,16 +509,25 @@ static nscoord ToLengthWithFallback(cons
 template <typename LengthLike>
 static nsSize ToLengthWithFallback(const LengthLike& aWidth,
                                    const LengthLike& aHeight,
                                    nscoord aFallback = 0) {
   return {ToLengthWithFallback(aWidth, aFallback),
           ToLengthWithFallback(aHeight, aFallback)};
 }
 
+static void ApplyMargin(nsSize& aSize, const nsMargin& aMargin) {
+  if (aSize.width != NS_UNCONSTRAINEDSIZE) {
+    aSize.width += aMargin.LeftRight();
+  }
+  if (aSize.height != NS_UNCONSTRAINEDSIZE) {
+    aSize.height += aMargin.TopBottom();
+  }
+}
+
 nsresult nsSplitterFrameInner::MouseDown(Event* aMouseEvent) {
   NS_ENSURE_TRUE(mOuter, NS_OK);
   dom::MouseEvent* mouseEvent = aMouseEvent->AsMouseEvent();
   if (!mouseEvent) {
     return NS_OK;
   }
 
   // only if left button
@@ -531,22 +540,16 @@ nsresult nsSplitterFrameInner::MouseDown
     return NS_OK;
 
   mParentBox = GetValidParentBox(mOuter);
   if (!mParentBox) {
     return NS_OK;
   }
 
   // get our index
-  nsPresContext* outerPresContext = mOuter->PresContext();
-
-  UniquePtr<gfxContext> rc =
-      outerPresContext->PresShell()->CreateReferenceRenderingContext();
-  nsBoxLayoutState state(outerPresContext, rc.get());
-
   mDidDrag = false;
 
   EnsureOrient();
   const bool isHorizontal = !mOuter->IsHorizontal();
 
   const nsIContent* outerContent = mOuter->GetContent();
 
   const ResizeType resizeBefore = GetResizeBefore();
@@ -574,17 +577,19 @@ nsresult nsSplitterFrameInner::MouseDown
       if (count == childCount - 1 && resizeAfter != ResizeType::Grow) {
         // If it's the last index then we need to allow for resizeafter="grow"
         return NS_OK;
       }
     }
     count++;
 
     nsIContent* content = childBox->GetContent();
-    const nscoord flex = childBox->GetXULFlex();
+    // XXX flex seems untested, as it uses mBoxFlex rather than actual flexbox
+    // flex.
+    const nscoord flex = childBox->StyleXUL()->mBoxFlex;
     const bool isBefore = !foundOuter;
     const bool isResizable = [&] {
       if (auto* element = nsXULElement::FromNode(content)) {
         if (element->NodeInfo()->NameAtom() == nsGkAtoms::splitter) {
           // skip over any splitters
           return false;
         }
 
@@ -629,23 +634,30 @@ nsresult nsSplitterFrameInner::MouseDown
     nsSize curSize = childBox->GetSize();
     const auto& pos = *childBox->StylePosition();
     nsSize minSize = ToLengthWithFallback(pos.mMinWidth, pos.mMinHeight);
     nsSize maxSize = ToLengthWithFallback(pos.mMaxWidth, pos.mMaxHeight,
                                           NS_UNCONSTRAINEDSIZE);
     nsSize prefSize(ToLengthWithFallback(pos.mWidth, curSize.width),
                     ToLengthWithFallback(pos.mHeight, curSize.height));
 
-    maxSize = nsIFrame::XULBoundsCheckMinMax(minSize, maxSize);
-    prefSize = nsIFrame::XULBoundsCheck(minSize, prefSize, maxSize);
+    maxSize.width = std::max(maxSize.width, minSize.width);
+    maxSize.height = std::max(maxSize.height, minSize.height);
+    prefSize.width =
+        NS_CSS_MINMAX(prefSize.width, minSize.width, maxSize.width);
+    prefSize.height =
+        NS_CSS_MINMAX(prefSize.height, minSize.height, maxSize.height);
 
-    nsSplitterFrame::AddXULMargin(childBox, minSize);
-    nsSplitterFrame::AddXULMargin(childBox, maxSize);
-    nsSplitterFrame::AddXULMargin(childBox, prefSize);
-    nsSplitterFrame::AddXULMargin(childBox, curSize);
+    nsMargin m;
+    childBox->StyleMargin()->GetMargin(m);
+
+    ApplyMargin(curSize, m);
+    ApplyMargin(minSize, m);
+    ApplyMargin(maxSize, m);
+    ApplyMargin(prefSize, m);
 
     auto& list = isBefore ? mChildInfosBefore : mChildInfosAfter;
     nsSplitterInfo& info = *list.AppendElement();
     info.childElem = content;
     info.min = isHorizontal ? minSize.width : minSize.height;
     info.max = isHorizontal ? maxSize.width : maxSize.height;
     info.pref = isHorizontal ? prefSize.width : prefSize.height;
     info.current = info.changed = isHorizontal ? curSize.width : curSize.height;
@@ -849,33 +861,29 @@ static nsIFrame* GetChildBoxForContent(n
   return nullptr;
 }
 
 void nsSplitterFrameInner::AdjustChildren(nsPresContext* aPresContext,
                                           nsTArray<nsSplitterInfo>& aChildInfos,
                                           bool aIsHorizontal) {
   /// printf("------- AdjustChildren------\n");
 
-  nsBoxLayoutState state(aPresContext);
-
   for (auto& info : aChildInfos) {
     nscoord newPref = info.pref + (info.changed - info.current);
     if (nsIFrame* childBox =
             GetChildBoxForContent(mParentBox, info.childElem)) {
-      SetPreferredSize(state, childBox, aIsHorizontal, newPref);
+      SetPreferredSize(childBox, aIsHorizontal, newPref);
     }
   }
 }
 
-void nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState,
-                                            nsIFrame* aChildBox,
+void nsSplitterFrameInner::SetPreferredSize(nsIFrame* aChildBox,
                                             bool aIsHorizontal, nscoord aSize) {
-  nsMargin margin(0, 0, 0, 0);
-  aChildBox->GetXULMargin(margin);
-
+  nsMargin margin;
+  aChildBox->StyleMargin()->GetMargin(margin);
   if (aIsHorizontal) {
     aSize -= (margin.left + margin.right);
   } else {
     aSize -= (margin.top + margin.bottom);
   }
 
   RefPtr element = nsStyledElement::FromNode(aChildBox->GetContent());
   if (!element) {
--- a/layout/xul/test/chrome.ini
+++ b/layout/xul/test/chrome.ini
@@ -8,17 +8,16 @@ support-files =
   windowminmaxsize5.xhtml
   windowminmaxsize6.xhtml
   windowminmaxsize7.xhtml
   windowminmaxsize8.xhtml
   windowminmaxsize9.xhtml
   windowminmaxsize10.xhtml
   titledpanelwindow.xhtml
 
-[test_blockify_moz_box.html]
 [test_bug159346.xhtml]
 [test_bug381167.xhtml]
 [test_bug398982-1.xhtml]
 [test_bug398982-2.xhtml]
 [test_bug467442.xhtml]
 [test_bug477754.xhtml]
 [test_bug703150.xhtml]
 [test_bug987230.xhtml]
deleted file mode 100644
--- a/layout/xul/test/test_blockify_moz_box.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1580012
--->
-<head>
-  <title>Test for Bug 1580012</title>
-  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <style>
-    /* Styling for parents that blockify their children: */
-    .grid { display: grid; }
-    .flex { display: flex; }
-
-    /* Styling that blockifies an element itself: */
-    .float { float: left; }
-    .abs  { position: absolute; }
-  </style>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1580012">Mozilla Bug 1580012</a>
-<p id="display"></p>
-<div id="content">
-  <!-- Boxes that have no reason to be blockified: -->
-  <div class="moz-box" id="regularMozBox"></div>
-  <div class="moz-inline-box" id="regularMozInlineBox"></div>
-
-  <!-- A grid container with a -moz-box and a -moz-inline-box grid item (which
-       should both end up with display:-moz-box), and a -moz-inline-box
-       grandchild (which should preserve its -moz-inline-box display val): -->
-  <div class="grid">
-    <div class="moz-box" id="gridItemMozBox"></div>
-    <div class="moz-inline-box" id="gridItemMozInlineBox"></div>
-    <div><div class="moz-inline-box" id="gridGrandchildMozInlineBox"></div></div>
-  </div>
-
-  <!-- A flex container with a -moz-box and a -moz-inline-box flex item (which
-       should both end up with display:-moz-box), and a -moz-inline-box
-       grandchild (which should preserve its -moz-inline-box display val): -->
-  <div class="flex">
-    <div class="moz-box" id="flexItemMozBox"></div>
-    <div class="moz-inline-box" id="flexItemMozInlineBox"></div>
-    <div><div class="moz-inline-box" id="flexGrandchildMozInlineBox"></div></div>
-  </div>
-
-  <!-- Boxes that are directly blockified via other styling on them: -->
-  <!-- XXXdholbert commenting these out -- see notes below about assertion
-       failures for floated -moz-box.
-  <div class="float moz-box" id="floatMozBox"></div>
-  <div class="float moz-inline-box" id="floatMozInlineBox"></div>
-  -->
-  <!-- XXXdholbert commenting these out -- see notes below about assertion
-       failures for positioned -moz-box.
-  <div class="abs moz-box" id="absMozBox"></div>
-  <div class="abs moz-inline-box" id="absMozInlineBox"></div>
-  -->
-</div>
-<pre id="test">
-<script>
-
-/** Test for Bug 1580012 **/
-
-function checkDisp(elemId, expectedDisplay) {
-  var elem = document.getElementById(elemId);
-  ok(elem, "should have a valid ID for an element");
-
-  is(getComputedStyle(elem).display, expectedDisplay,
-     "Element with ID " + elemId + " should have expected display value");
-}
-
-// Create CSS Style rules to add -moz-box / -moz-inline-box styling.
-// Note that these style won't parse correctly until after we've flipped
-// the prefs via pushPrefEnv(). That's why I'm creating these style rules
-// here rather than just putting them inline in the <style> element.
-var sheet = document.styleSheets[0];
-sheet.insertRule(".moz-box { display: -moz-box; }");
-sheet.insertRule(".moz-inline-box { display: -moz-inline-box; }");
-
-// Check the computed 'display' of the various elements.
-checkDisp("regularMozBox",             "-moz-box");
-checkDisp("regularMozInlineBox",       "-moz-inline-box");
-
-checkDisp("gridItemMozBox",             "-moz-box");
-checkDisp("gridItemMozInlineBox",       "-moz-box");
-checkDisp("gridGrandchildMozInlineBox", "-moz-inline-box");
-
-checkDisp("flexItemMozBox",             "-moz-box");
-checkDisp("flexItemMozInlineBox",       "-moz-box");
-checkDisp("flexGrandchildMozInlineBox", "-moz-inline-box");
-
-// XXXdholbert The floated boxes trigger assertion failures where
-// nsLineLayout thinks it somehow ended up with an inline-level (really, just
-// a non-'block') floated thing. In practice this isn't really a concern
-// since -moz-box display values are disabled in content and since XUL
-// doesn't use 'float' for layout.  So: I've added a fatal assertion in
-// ReflowInput.cpp to validate that we never actually encounter a floated
-// -moz-box/-moz-inline-box, and I'm commenting out these lines (which
-// trigger that fatal assertion).
-//
-//  checkDisp("floatMozBox",                "-moz-box");
-//  checkDisp("floatMozInlineBox",          "-moz-box");
-
-
-// XXXdholbert These abspos boxes trigger a diagnostic assertion added in
-// bug 1582819 which is intended to flush out XUL content that is positioned
-// and hence was previously blockified to 'block' but will now be '-moz-box'.
-// The diagnostic assertion doesn't need to stay around forever, but while
-// it exists, we can't test this scenario without triggering it.
-//
-// checkDisp("absMozBox",                  "-moz-box");
-// checkDisp("absMozInlineBox",            "-moz-box");
-</script>
-</pre>
-</body>
-</html>
--- a/layout/xul/test/test_splitter.xhtml
+++ b/layout/xul/test/test_splitter.xhtml
@@ -91,18 +91,16 @@ XUL <splitter> collapsing tests
       await runPass(rtl, !rtl, rtl);
       splitter.setAttribute("collapse", "both");
       await runPass(rtl, true, true);
     }
 
     async function runAllTests() {
       await runTests(false, "ltr-splitter");
       await runTests(true, "rtl-splitter");
-      await runTests(false, "ltr-flex-splitter");
-      await runTests(true, "rtl-flex-splitter");
       SimpleTest.finish();
     }
 
     addLoadEvent(function() {SimpleTest.executeSoon(runAllTests);});
    ]]></script>
 
   <hbox style="display: none; width: 200px; height: 300px; direction: ltr;">
   <vbox style="height: 300px; flex: 1 auto"/>
@@ -111,21 +109,9 @@ XUL <splitter> collapsing tests
   </hbox>
 
   <hbox style="display: none; width: 200px; height: 300px; direction: rtl;">
     <vbox style="height: 300px; flex: 1 auto" />
     <splitter id="rtl-splitter" style="width: 5px"/>
     <vbox style="height: 300px; flex: 1 auto" />
   </hbox>
 
-  <hbox style="display: none; width: 200px; height: 300px; direction: ltr; -moz-box-layout: flex">
-    <vbox style="height: 300px; flex: 1 auto" />
-    <splitter id="ltr-flex-splitter" style="width: 5px"/>
-    <vbox style="height: 300px; flex: 1 auto" />
-  </hbox>
-
-  <hbox style="display: none; width: 200px; height: 300px; direction: rtl; -moz-box-layout: flex">
-    <vbox style="height: 300px; flex: 1 auto" />
-    <splitter id="rtl-flex-splitter" style="width: 5px"/>
-    <vbox style="height: 300px; flex: 1 auto" />
-  </hbox>
-
 </window>
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -44,17 +44,16 @@
 #include "nsCSSRendering.h"
 #include "nsString.h"
 #include "nsContainerFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsVariant.h"
 #include "nsWidgetsCID.h"
 #include "nsIFrameInlines.h"
-#include "nsBoxLayoutState.h"
 #include "nsTreeContentView.h"
 #include "nsTreeUtils.h"
 #include "nsStyleConsts.h"
 #include "nsITheme.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "nsContentUtils.h"
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsTreeBodyFrame_h
 #define nsTreeBodyFrame_h
 
 #include "mozilla/AtomArray.h"
 #include "mozilla/Attributes.h"
 
-#include "nsLeafBoxFrame.h"
 #include "nsITreeView.h"
 #include "nsIScrollbarMediator.h"
 #include "nsITimer.h"
 #include "nsIReflowCallback.h"
 #include "nsTArray.h"
 #include "nsTreeStyleCache.h"
 #include "nsTreeColumns.h"
 #include "nsTHashMap.h"
--- a/servo/components/style/properties/longhands/inherited_box.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_box.mako.rs
@@ -52,26 +52,16 @@
     engines="gecko",
     gecko_enum_prefix="StyleMozBoxCollapse",
     animation_value_type="none",
     enabled_in="chrome",
     spec="None (internal)",
 )}
 
 ${helpers.single_keyword(
-    "-moz-box-layout",
-    "flex legacy",
-    engines="gecko",
-    gecko_enum_prefix="StyleMozBoxLayout",
-    animation_value_type="none",
-    enabled_in="chrome",
-    spec="None (internal)",
-)}
-
-${helpers.single_keyword(
     "text-orientation",
     "mixed upright sideways",
     engines="gecko",
     gecko_aliases="sideways-right=sideways",
     gecko_enum_prefix="StyleTextOrientation",
     animation_value_type="none",
     spec="https://drafts.csswg.org/css-writing-modes/#propdef-text-orientation",
 )}
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -17,21 +17,16 @@ use crate::values::specified::{AllowQuir
 use crate::values::{CustomIdent, KeyframesName, TimelineName};
 use crate::Atom;
 use cssparser::Parser;
 use num_traits::FromPrimitive;
 use std::fmt::{self, Write};
 use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
 use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
 
-#[cfg(feature = "gecko")]
-fn moz_display_values_enabled(context: &ParserContext) -> bool {
-    context.in_ua_or_chrome_sheet()
-}
-
 #[cfg(not(feature = "servo-layout-2020"))]
 fn flexbox_enabled() -> bool {
     true
 }
 
 #[cfg(feature = "servo-layout-2020")]
 fn flexbox_enabled() -> bool {
     servo_config::prefs::pref_map()
@@ -51,18 +46,16 @@ pub enum DisplayOutside {
     Inline,
     Block,
     #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
     TableCaption,
     #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
     InternalTable,
     #[cfg(feature = "gecko")]
     InternalRuby,
-    #[cfg(feature = "gecko")]
-    XUL,
 }
 
 #[allow(missing_docs)]
 #[derive(Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, PartialEq, ToCss, ToShmem)]
 #[repr(u8)]
 pub enum DisplayInside {
     None = 0,
     #[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
@@ -95,18 +88,16 @@ pub enum DisplayInside {
     #[cfg(feature = "gecko")]
     RubyBaseContainer,
     #[cfg(feature = "gecko")]
     RubyText,
     #[cfg(feature = "gecko")]
     RubyTextContainer,
     #[cfg(feature = "gecko")]
     WebkitBox,
-    #[cfg(feature = "gecko")]
-    MozBox,
 }
 
 #[allow(missing_docs)]
 #[derive(
     Clone,
     Copy,
     Debug,
     Eq,
@@ -203,22 +194,16 @@ impl Display {
     #[cfg(feature = "gecko")]
     pub const RubyText: Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyText);
     #[cfg(feature = "gecko")]
     pub const RubyTextContainer: Self = Self::new(
         DisplayOutside::InternalRuby,
         DisplayInside::RubyTextContainer,
     );
 
-    /// XUL boxes.
-    #[cfg(feature = "gecko")]
-    pub const MozBox: Self = Self::new(DisplayOutside::Block, DisplayInside::MozBox);
-    #[cfg(feature = "gecko")]
-    pub const MozInlineBox: Self = Self::new(DisplayOutside::Inline, DisplayInside::MozBox);
-
     /// Make a raw display value from <display-outside> and <display-inside> values.
     #[inline]
     const fn new(outside: DisplayOutside, inside: DisplayInside) -> Self {
         let o: u16 = ((outside as u8) as u16) << Self::DISPLAY_INSIDE_BITS;
         let i: u16 = (inside as u8) as u16;
         Self(o | i)
     }
 
@@ -313,18 +298,16 @@ impl Display {
     /// grid container.
     ///
     /// This is used to implement various style fixups.
     pub fn is_item_container(&self) -> bool {
         match self.inside() {
             DisplayInside::Flex => true,
             #[cfg(feature = "gecko")]
             DisplayInside::Grid => true,
-            #[cfg(feature = "gecko")]
-            DisplayInside::MozBox => true,
             _ => false,
         }
     }
 
     /// Returns whether an element with this display type is a line
     /// participant, which means it may lay its children on the same
     /// line as itself.
     pub fn is_line_participant(&self) -> bool {
@@ -353,17 +336,17 @@ impl Display {
                 let inside = match self.inside() {
                     // `inline-block` blockifies to `block` rather than
                     // `flow-root`, for legacy reasons.
                     DisplayInside::FlowRoot => DisplayInside::Flow,
                     inside => inside,
                 };
                 Display::from3(DisplayOutside::Block, inside, self.is_list_item())
             },
-            DisplayOutside::Block | DisplayOutside::XUL | DisplayOutside::None => *self,
+            DisplayOutside::Block | DisplayOutside::None => *self,
             #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
             _ => Display::Block,
         }
     }
 
     /// Convert this display into an equivalent inline-outside display.
     /// https://drafts.csswg.org/css-display/#inlinify
     #[cfg(feature = "gecko")]
@@ -406,18 +389,16 @@ impl ToCss for Display {
     {
         let outside = self.outside();
         let inside = self.inside();
         match *self {
             Display::Block | Display::Inline => outside.to_css(dest),
             Display::InlineBlock => dest.write_str("inline-block"),
             #[cfg(feature = "gecko")]
             Display::WebkitInlineBox => dest.write_str("-webkit-inline-box"),
-            #[cfg(feature = "gecko")]
-            Display::MozInlineBox => dest.write_str("-moz-inline-box"),
             #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
             Display::TableCaption => dest.write_str("table-caption"),
             _ => match (outside, inside) {
                 #[cfg(feature = "gecko")]
                 (DisplayOutside::Inline, DisplayInside::Grid) => dest.write_str("inline-grid"),
                 (DisplayOutside::Inline, DisplayInside::Flex) => dest.write_str("inline-flex"),
                 #[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
                 (DisplayOutside::Inline, DisplayInside::Table) => dest.write_str("inline-table"),
@@ -582,20 +563,16 @@ impl Parse for Display {
             #[cfg(feature = "gecko")]
             "ruby-text" => Display::RubyText,
             #[cfg(feature = "gecko")]
             "ruby-text-container" => Display::RubyTextContainer,
             #[cfg(feature = "gecko")]
             "-webkit-box" => Display::WebkitBox,
             #[cfg(feature = "gecko")]
             "-webkit-inline-box" => Display::WebkitInlineBox,
-            #[cfg(feature = "gecko")]
-            "-moz-box" if moz_display_values_enabled(context) => Display::MozBox,
-            #[cfg(feature = "gecko")]
-            "-moz-inline-box" if moz_display_values_enabled(context) => Display::MozInlineBox,
         })
     }
 }
 
 impl SpecifiedValueInfo for Display {
     fn collect_completion_keywords(f: KeywordsCollectFn) {
         f(&[
             "block",
--- a/toolkit/themes/shared/tree.css
+++ b/toolkit/themes/shared/tree.css
@@ -130,19 +130,16 @@ treecol,
 
 treecol:where(:hover),
 .tree-columnpicker-button:where(:hover) {
   color: -moz-ColHeaderHoverText;
 }
 
 .treecol-text {
   margin: 0 !important;
-  /* NOTE(emilio): Eventually we should move <treecol> out of XUL layout
-   * proper, till then this makes cropping work. */
-  -moz-box-layout: flex;
 }
 
 treecol[hideheader="true"] {
   appearance: none;
 }
 
 /* ::::: column drag and drop styles ::::: */