Bug 1544343 - part 2: Make factory methods take mozilla::PresShell instead of nsIPresShell r=emilio
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 16 Apr 2019 07:24:49 +0000
changeset 469631 4b56de3cd46c
parent 469630 cfd46a25af71
child 469632 35aed2f899c3
push id35878
push userapavel@mozilla.com
push dateTue, 16 Apr 2019 15:43:40 +0000
treeherdermozilla-central@258af4e91151 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1544343
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544343 - part 2: Make factory methods take mozilla::PresShell instead of nsIPresShell r=emilio Additionally, this patch makes `nsFrame.h` stop including `nsIPresShell.h` and makes each users include `mozilla/PresShell.h` instead. So, this improves rebuild performance of `nsIPresShell.h` (and `mozilla/PresShell.h` in the future). Note that due to `nsIFrame::PresShell()`, `mozilla::` prefix is necessary for `PresShell` in a lot of classes which are derived from `nsIFrame` even in `.cpp` files. Differential Revision: https://phabricator.services.mozilla.com/D27476
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/forms/nsCheckboxRadioFrame.cpp
layout/forms/nsColorControlFrame.cpp
layout/forms/nsColorControlFrame.h
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsDateTimeControlFrame.cpp
layout/forms/nsDateTimeControlFrame.h
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsGfxButtonControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsImageControlFrame.cpp
layout/forms/nsLegendFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/forms/nsMeterFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsNumberControlFrame.h
layout/forms/nsProgressFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsRangeFrame.h
layout/forms/nsSelectsAreaFrame.cpp
layout/forms/nsSelectsAreaFrame.h
layout/forms/nsTextControlFrame.cpp
layout/generic/BRFrame.cpp
layout/generic/ColumnSetWrapperFrame.cpp
layout/generic/ColumnSetWrapperFrame.h
layout/generic/DetailsFrame.cpp
layout/generic/ViewportFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFlexContainerFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsGridContainerFrame.cpp
layout/generic/nsGridContainerFrame.h
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsHTMLCanvasFrame.h
layout/generic/nsHTMLParts.h
layout/generic/nsImageFrame.cpp
layout/generic/nsImageFrame.h
layout/generic/nsInlineFrame.cpp
layout/generic/nsInlineFrame.h
layout/generic/nsPageContentFrame.cpp
layout/generic/nsPageContentFrame.h
layout/generic/nsPageFrame.cpp
layout/generic/nsPageFrame.h
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsPlaceholderFrame.h
layout/generic/nsPluginFrame.cpp
layout/generic/nsPluginFrame.h
layout/generic/nsRubyBaseContainerFrame.cpp
layout/generic/nsRubyBaseContainerFrame.h
layout/generic/nsRubyBaseFrame.cpp
layout/generic/nsRubyBaseFrame.h
layout/generic/nsRubyFrame.cpp
layout/generic/nsRubyFrame.h
layout/generic/nsRubyTextContainerFrame.cpp
layout/generic/nsRubyTextContainerFrame.h
layout/generic/nsRubyTextFrame.cpp
layout/generic/nsRubyTextFrame.h
layout/generic/nsSimplePageSequenceFrame.cpp
layout/generic/nsSimplePageSequenceFrame.h
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrame.cpp
layout/generic/nsVideoFrame.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLContainerFrame.h
layout/mathml/nsMathMLParts.h
layout/mathml/nsMathMLTokenFrame.cpp
layout/mathml/nsMathMLTokenFrame.h
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmactionFrame.h
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmencloseFrame.h
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmfencedFrame.h
layout/mathml/nsMathMLmfracFrame.cpp
layout/mathml/nsMathMLmfracFrame.h
layout/mathml/nsMathMLmmultiscriptsFrame.cpp
layout/mathml/nsMathMLmmultiscriptsFrame.h
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmoFrame.h
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmpaddedFrame.h
layout/mathml/nsMathMLmrootFrame.cpp
layout/mathml/nsMathMLmrootFrame.h
layout/mathml/nsMathMLmrowFrame.cpp
layout/mathml/nsMathMLmrowFrame.h
layout/mathml/nsMathMLmspaceFrame.cpp
layout/mathml/nsMathMLmspaceFrame.h
layout/mathml/nsMathMLmsqrtFrame.cpp
layout/mathml/nsMathMLmsqrtFrame.h
layout/mathml/nsMathMLmtableFrame.cpp
layout/mathml/nsMathMLmtableFrame.h
layout/mathml/nsMathMLmunderoverFrame.cpp
layout/mathml/nsMathMLmunderoverFrame.h
layout/mathml/nsMathMLsemanticsFrame.cpp
layout/mathml/nsMathMLsemanticsFrame.h
layout/svg/SVGFEContainerFrame.cpp
layout/svg/SVGFEImageFrame.cpp
layout/svg/SVGFELeafFrame.cpp
layout/svg/SVGFEUnstyledLeafFrame.cpp
layout/svg/SVGGeometryFrame.cpp
layout/svg/SVGGeometryFrame.h
layout/svg/SVGTextFrame.cpp
layout/svg/SVGTextFrame.h
layout/svg/SVGViewFrame.cpp
layout/svg/nsSVGAFrame.cpp
layout/svg/nsSVGClipPathFrame.cpp
layout/svg/nsSVGClipPathFrame.h
layout/svg/nsSVGContainerFrame.cpp
layout/svg/nsSVGContainerFrame.h
layout/svg/nsSVGFilterFrame.cpp
layout/svg/nsSVGFilterFrame.h
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGForeignObjectFrame.h
layout/svg/nsSVGGFrame.cpp
layout/svg/nsSVGGFrame.h
layout/svg/nsSVGGenericContainerFrame.cpp
layout/svg/nsSVGGenericContainerFrame.h
layout/svg/nsSVGGradientFrame.cpp
layout/svg/nsSVGGradientFrame.h
layout/svg/nsSVGImageFrame.cpp
layout/svg/nsSVGImageFrame.h
layout/svg/nsSVGInnerSVGFrame.cpp
layout/svg/nsSVGInnerSVGFrame.h
layout/svg/nsSVGMarkerFrame.cpp
layout/svg/nsSVGMarkerFrame.h
layout/svg/nsSVGMaskFrame.cpp
layout/svg/nsSVGMaskFrame.h
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGOuterSVGFrame.h
layout/svg/nsSVGPatternFrame.cpp
layout/svg/nsSVGPatternFrame.h
layout/svg/nsSVGStopFrame.cpp
layout/svg/nsSVGSwitchFrame.cpp
layout/svg/nsSVGSymbolFrame.cpp
layout/svg/nsSVGSymbolFrame.h
layout/svg/nsSVGUseFrame.cpp
layout/svg/nsSVGUseFrame.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableCellFrame.h
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColFrame.h
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableColGroupFrame.h
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
layout/tables/nsTableWrapperFrame.cpp
layout/tables/nsTableWrapperFrame.h
layout/xul/grid/nsGridLayout2.cpp
layout/xul/grid/nsGridLayout2.h
layout/xul/grid/nsGridRowGroupFrame.cpp
layout/xul/grid/nsGridRowLeafFrame.cpp
layout/xul/grid/nsGridRowLeafFrame.h
layout/xul/nsBoxFrame.cpp
layout/xul/nsBoxFrame.h
layout/xul/nsButtonBoxFrame.cpp
layout/xul/nsButtonBoxFrame.h
layout/xul/nsDeckFrame.cpp
layout/xul/nsDeckFrame.h
layout/xul/nsDocElementBoxFrame.cpp
layout/xul/nsGroupBoxFrame.cpp
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsImageBoxFrame.h
layout/xul/nsLeafBoxFrame.cpp
layout/xul/nsLeafBoxFrame.h
layout/xul/nsMenuBarFrame.cpp
layout/xul/nsMenuBarFrame.h
layout/xul/nsMenuFrame.cpp
layout/xul/nsMenuFrame.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsMenuPopupFrame.h
layout/xul/nsPopupSetFrame.cpp
layout/xul/nsPopupSetFrame.h
layout/xul/nsResizerFrame.cpp
layout/xul/nsResizerFrame.h
layout/xul/nsRootBoxFrame.cpp
layout/xul/nsScrollbarButtonFrame.cpp
layout/xul/nsScrollbarButtonFrame.h
layout/xul/nsScrollbarFrame.cpp
layout/xul/nsScrollbarFrame.h
layout/xul/nsSliderFrame.cpp
layout/xul/nsSliderFrame.h
layout/xul/nsSplitterFrame.cpp
layout/xul/nsSplitterFrame.h
layout/xul/nsStackFrame.cpp
layout/xul/nsStackFrame.h
layout/xul/nsTextBoxFrame.cpp
layout/xul/nsTextBoxFrame.h
layout/xul/nsTitleBarFrame.cpp
layout/xul/nsTitleBarFrame.h
layout/xul/nsXULLabelFrame.cpp
layout/xul/nsXULLabelFrame.h
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeBodyFrame.h
layout/xul/tree/nsTreeColFrame.cpp
layout/xul/tree/nsTreeColFrame.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -126,66 +126,59 @@
 #include "nsIPresShellInlines.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // An alias for convenience.
 static const nsIFrame::ChildListID kPrincipalList = nsIFrame::kPrincipalList;
 
-nsIFrame* NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle);
-
-nsIFrame* NS_NewHTMLVideoFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewHTMLCanvasFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewHTMLVideoFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsContainerFrame* NS_NewSVGOuterSVGFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle);
-nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(PresShell* aPresShell,
                                                   ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGGFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGInnerSVGFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGGeometryFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGGFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGGenericContainerFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle);
-nsContainerFrame* NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGForeignObjectFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGAFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGSwitchFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGSymbolFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGTextFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell,
-                                  ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGUseFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGViewFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-extern nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGAFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGSwitchFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGSymbolFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGTextFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGContainerFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGUseFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGViewFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+extern nsIFrame* NS_NewSVGLinearGradientFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle);
-extern nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell,
+extern nsIFrame* NS_NewSVGRadialGradientFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle);
-extern nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell,
+extern nsIFrame* NS_NewSVGStopFrame(PresShell* aPresShell,
                                     ComputedStyle* aStyle);
-nsContainerFrame* NS_NewSVGMarkerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGMarkerFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle);
-nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
-extern nsIFrame* NS_NewSVGImageFrame(nsIPresShell* aPresShell,
+extern nsIFrame* NS_NewSVGImageFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGClipPathFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGFilterFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGMaskFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGClipPathFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGFilterFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGPatternFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGMaskFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGFEContainerFrame(PresShell* aPresShell,
                                     ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGFEImageFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle);
-nsIFrame* NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGFELeafFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGFEImageFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewSVGFEUnstyledLeafFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
 #include "mozilla/dom/NodeInfo.h"
 #include "prenv.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 
 #ifdef DEBUG
@@ -213,84 +206,81 @@ static FrameCtorDebugFlags gFlags[] = {
 #  include "nsMenuFrame.h"
 #  include "nsPopupSetFrame.h"
 #  include "nsTreeColFrame.h"
 #  include "nsIBoxObject.h"
 #  include "nsXULLabelFrame.h"
 
 //------------------------------------------------------------------
 
-nsContainerFrame* NS_NewRootBoxFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRootBoxFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle);
 
-nsContainerFrame* NS_NewDocElementBoxFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewDocElementBoxFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle);
 
-nsIFrame* NS_NewDeckFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewLeafBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewStackFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewRangeFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewImageBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewGroupBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewButtonBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewSplitterFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewMenuPopupFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewPopupSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewMenuFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle,
+nsIFrame* NS_NewDeckFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewStackFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewRangeFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewImageBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewTextBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewGroupBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewButtonBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewSplitterFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewMenuPopupFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewPopupSetFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewMenuFrame(PresShell* aPresShell, ComputedStyle* aStyle,
                           uint32_t aFlags);
 
-nsIFrame* NS_NewMenuBarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewTreeBodyFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewMenuBarFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewTreeBodyFrame(PresShell* aPresShell, ComputedStyle* aStyle);
 
 // grid
-nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout);
-nsIFrame* NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle);
-nsIFrame* NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
-                                  ComputedStyle* aStyle);
+nsresult NS_NewGridLayout2(nsBoxLayout** aNewLayout);
+nsIFrame* NS_NewGridRowLeafFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewGridRowGroupFrame(PresShell* aPresShell, ComputedStyle* aStyle);
 
 // end grid
 
-nsIFrame* NS_NewTitleBarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewResizerFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
+nsIFrame* NS_NewTitleBarFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewResizerFrame(PresShell* aPresShell, ComputedStyle* aStyle);
 
 #endif
 
-nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
+nsHTMLScrollFrame* NS_NewHTMLScrollFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle, bool aIsRoot);
 
-nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
+nsXULScrollFrame* NS_NewXULScrollFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle, bool aIsRoot,
                                        bool aClipAllDescendants);
 
-nsIFrame* NS_NewSliderFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
-
-nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSliderFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewScrollbarFrame(PresShell* aPresShell, ComputedStyle* aStyle);
+
+nsIFrame* NS_NewScrollbarButtonFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle);
 
-nsIFrame* NS_NewImageFrameForContentProperty(nsIPresShell*, ComputedStyle*);
-
-nsIFrame* NS_NewImageFrameForGeneratedContentIndex(nsIPresShell*,
-                                                   ComputedStyle*);
+nsIFrame* NS_NewImageFrameForContentProperty(PresShell*, ComputedStyle*);
+
+nsIFrame* NS_NewImageFrameForGeneratedContentIndex(PresShell*, ComputedStyle*);
 
 // Returns true if aFrame is an anonymous flex/grid item.
 static inline bool IsAnonymousFlexOrGridItem(const nsIFrame* aFrame) {
   auto pseudoType = aFrame->Style()->GetPseudoType();
   return pseudoType == PseudoStyleType::anonymousFlexItem ||
          pseudoType == PseudoStyleType::anonymousGridItem;
 }
 
@@ -3947,20 +3937,20 @@ static bool IsXULDisplayType(const nsSty
   { nsGkAtoms::_tag, SCROLLABLE_XUL_FCDATA(_func) }
 #define SIMPLE_XUL_DISPLAY_CREATE(_display, _func) \
   FCDATA_FOR_DISPLAY(_display, SIMPLE_XUL_FCDATA(_func))
 #define SCROLLABLE_XUL_DISPLAY_CREATE(_display, _func) \
   FCDATA_FOR_DISPLAY(_display, SCROLLABLE_XUL_FCDATA(_func))
 #define SCROLLABLE_ABSPOS_CONTAINER_XUL_DISPLAY_CREATE(_display, _func) \
   FCDATA_FOR_DISPLAY(_display, SCROLLABLE_ABSPOS_CONTAINER_XUL_FCDATA(_func))
 
-static nsIFrame* NS_NewGridBoxFrame(nsIPresShell* aPresShell,
+static nsIFrame* NS_NewGridBoxFrame(PresShell* aPresShell,
                                     ComputedStyle* aComputedStyle) {
   nsCOMPtr<nsBoxLayout> layout;
-  NS_NewGridLayout2(aPresShell, getter_AddRefs(layout));
+  NS_NewGridLayout2(getter_AddRefs(layout));
   return NS_NewBoxFrame(aPresShell, aComputedStyle, false, layout);
 }
 
 /* static */
 const nsCSSFrameConstructor::FrameConstructionData*
 nsCSSFrameConstructor::FindXULTagData(const Element& aElement,
                                       ComputedStyle& aStyle) {
   MOZ_ASSERT(aElement.IsXULElement());
@@ -4057,17 +4047,17 @@ nsCSSFrameConstructor::FindXULLabelData(
     return &sXULTextBoxData;
   }
 
   static const FrameConstructionData sLabelData =
       SIMPLE_XUL_FCDATA(NS_NewXULLabelFrame);
   return &sLabelData;
 }
 
-static nsIFrame* NS_NewXULDescriptionFrame(nsIPresShell* aPresShell,
+static nsIFrame* NS_NewXULDescriptionFrame(PresShell* aPresShell,
                                            ComputedStyle* aContext) {
   // XXXbz do we really need to set up the block formatting context root? If the
   // parent is not a block we'll get it anyway, and if it is, do we want it?
   return NS_NewBlockFormattingContext(aPresShell, aContext);
 }
 
 /* static */
 const nsCSSFrameConstructor::FrameConstructionData*
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -556,24 +556,23 @@ class nsCSSFrameConstructor final : publ
     return (aParentType == eTypeTable || aParentType == eTypeRow ||
             aParentType == eTypeRowGroup || aParentType == eTypeColGroup);
   }
 
   /* A constructor function that just creates an nsIFrame object.  The caller
      is responsible for initializing the object, adding it to frame lists,
      constructing frames for the children, etc.
 
-     @param nsIPresShell the presshell whose arena should be used to allocate
-                         the frame.
+     @param PresShell the presshell whose arena should be used to allocate
+                      the frame.
      @param ComputedStyle the style to use for the frame. */
-  typedef nsIFrame* (*FrameCreationFunc)(nsIPresShell*, ComputedStyle*);
-  typedef nsContainerFrame* (*ContainerFrameCreationFunc)(nsIPresShell*,
+  typedef nsIFrame* (*FrameCreationFunc)(PresShell*, ComputedStyle*);
+  typedef nsContainerFrame* (*ContainerFrameCreationFunc)(PresShell*,
                                                           ComputedStyle*);
-  typedef nsBlockFrame* (*BlockFrameCreationFunc)(nsIPresShell*,
-                                                  ComputedStyle*);
+  typedef nsBlockFrame* (*BlockFrameCreationFunc)(PresShell*, ComputedStyle*);
 
   /* A function that can be used to get a FrameConstructionData.  Such
      a function is allowed to return null.
 
      @param nsIContent the node for which the frame is being constructed.
      @param ComputedStyle the style to be used for the frame.
   */
   struct FrameConstructionData;
--- a/layout/forms/nsCheckboxRadioFrame.cpp
+++ b/layout/forms/nsCheckboxRadioFrame.cpp
@@ -6,26 +6,27 @@
 
 #include "nsCheckboxRadioFrame.h"
 
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/LookAndFeel.h"
+#include "mozilla/PresShell.h"
 #include "nsDeviceContext.h"
 #include "nsIContent.h"
 #include "nsStyleConsts.h"
 
 using namespace mozilla;
 using mozilla::dom::HTMLInputElement;
 
 //#define FCF_NOISY
 
-nsCheckboxRadioFrame* NS_NewCheckboxRadioFrame(nsIPresShell* aPresShell,
+nsCheckboxRadioFrame* NS_NewCheckboxRadioFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsCheckboxRadioFrame(aStyle, aPresShell->GetPresContext());
 }
 
 nsCheckboxRadioFrame::nsCheckboxRadioFrame(ComputedStyle* aStyle,
                                            nsPresContext* aPresContext)
     : nsAtomicContainerFrame(aStyle, aPresContext, kClassID) {}
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -7,30 +7,31 @@
 #include "nsColorControlFrame.h"
 
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIFormControl.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/Document.h"
 
 using namespace mozilla;
 using mozilla::dom::CallerType;
 using mozilla::dom::Document;
 using mozilla::dom::Element;
 using mozilla::dom::HTMLInputElement;
 
 nsColorControlFrame::nsColorControlFrame(ComputedStyle* aStyle,
                                          nsPresContext* aPresContext)
     : nsHTMLButtonControlFrame(aStyle, aPresContext, kClassID) {}
 
-nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewColorControlFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   return new (aPresShell)
       nsColorControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsColorControlFrame)
 
 NS_QUERYFRAME_HEAD(nsColorControlFrame)
--- a/layout/forms/nsColorControlFrame.h
+++ b/layout/forms/nsColorControlFrame.h
@@ -8,27 +8,28 @@
 #define nsColorControlFrame_h___
 
 #include "nsCOMPtr.h"
 #include "nsHTMLButtonControlFrame.h"
 #include "nsIAnonymousContentCreator.h"
 
 namespace mozilla {
 enum class PseudoStyleType : uint8_t;
+class PresShell;
 }  // namespace mozilla
 
 // Class which implements the input type=color
 
 class nsColorControlFrame final : public nsHTMLButtonControlFrame,
                                   public nsIAnonymousContentCreator {
   typedef mozilla::PseudoStyleType PseudoStyleType;
   typedef mozilla::dom::Element Element;
 
  public:
-  friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewColorControlFrame(mozilla::PresShell* aPresShell,
                                            ComputedStyle* aStyle);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsColorControlFrame)
 
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -106,17 +106,17 @@ class nsComboButtonListener final : publ
   nsComboboxControlFrame* mComboBox;
 };
 
 NS_IMPL_ISUPPORTS(nsComboButtonListener, nsIDOMEventListener)
 
 // static class data member for Bug 32920
 nsComboboxControlFrame* nsComboboxControlFrame::sFocused = nullptr;
 
-nsComboboxControlFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell,
+nsComboboxControlFrame* NS_NewComboboxControlFrame(PresShell* aPresShell,
                                                    ComputedStyle* aStyle,
                                                    nsFrameState aStateFlags) {
   nsComboboxControlFrame* it = new (aPresShell)
       nsComboboxControlFrame(aStyle, aPresShell->GetPresContext());
 
   if (it) {
     // set the state flags (if any are provided)
     it->AddStateBits(aStateFlags);
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -33,32 +33,34 @@
 
 class nsListControlFrame;
 class nsComboboxDisplayFrame;
 class nsIDOMEventListener;
 class nsIScrollableFrame;
 class nsTextNode;
 
 namespace mozilla {
+class PresShell;
 namespace gfx {
 class DrawTarget;
 }  // namespace gfx
 }  // namespace mozilla
 
 class nsComboboxControlFrame final : public nsBlockFrame,
                                      public nsIFormControlFrame,
                                      public nsIAnonymousContentCreator,
                                      public nsISelectControlFrame,
                                      public nsIRollupListener,
                                      public nsIStatefulFrame {
   typedef mozilla::gfx::DrawTarget DrawTarget;
 
  public:
   friend nsComboboxControlFrame* NS_NewComboboxControlFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle, nsFrameState aFlags);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle,
+      nsFrameState aFlags);
   friend class nsComboboxDisplayFrame;
 
   explicit nsComboboxControlFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext);
   ~nsComboboxControlFrame();
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsComboboxControlFrame)
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -11,28 +11,29 @@
 
 #include "nsDateTimeControlFrame.h"
 
 #include "nsContentUtils.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsGkAtoms.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "nsNodeInfoManager.h"
 #include "nsIObserverService.h"
 #include "jsapi.h"
 #include "nsJSUtils.h"
 #include "nsThreadUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewDateTimeControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewDateTimeControlFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell)
       nsDateTimeControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsDateTimeControlFrame)
 
 NS_QUERYFRAME_HEAD(nsDateTimeControlFrame)
--- a/layout/forms/nsDateTimeControlFrame.h
+++ b/layout/forms/nsDateTimeControlFrame.h
@@ -17,29 +17,30 @@
 #define nsDateTimeControlFrame_h__
 
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsCOMPtr.h"
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 struct DateTimeValue;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsDateTimeControlFrame final : public nsContainerFrame {
   typedef mozilla::dom::DateTimeValue DateTimeValue;
 
   explicit nsDateTimeControlFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext);
 
  public:
-  friend nsIFrame* NS_NewDateTimeControlFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewDateTimeControlFrame(mozilla::PresShell* aPresShell,
                                               ComputedStyle* aStyle);
 
   void ContentStatesChanged(mozilla::EventStates aStates) override;
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsDateTimeControlFrame)
 
 #ifdef DEBUG_FRAME_DUMP
   nsresult GetFrameName(nsAString& aResult) const override {
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -5,31 +5,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsFieldSetFrame.h"
 
 #include <algorithm>
 #include "gfxContext.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Likely.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/Maybe.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSRendering.h"
 #include "nsDisplayList.h"
 #include "nsGkAtoms.h"
 #include "nsIFrameInlines.h"
 #include "nsLayoutUtils.h"
 #include "nsLegendFrame.h"
 #include "nsStyleConsts.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layout;
 
-nsContainerFrame* NS_NewFieldSetFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewFieldSetFrame(PresShell* aPresShell,
                                       ComputedStyle* aStyle) {
   return new (aPresShell) nsFieldSetFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFieldSetFrame)
 
 nsFieldSetFrame::nsFieldSetFrame(ComputedStyle* aStyle,
                                  nsPresContext* aPresContext)
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -16,30 +16,30 @@
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/DragEvent.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/FileList.h"
 #include "mozilla/dom/HTMLButtonElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/StaticPrefs.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsUnicodeProperties.h"
 #include "mozilla/EventStates.h"
 #include "nsTextNode.h"
 #include "nsTextFrame.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewFileControlFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewFileControlFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsFileControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFileControlFrame)
 
 nsFileControlFrame::nsFileControlFrame(ComputedStyle* aStyle,
                                        nsPresContext* aPresContext)
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -2,27 +2,28 @@
 /* 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 "nsGfxButtonControlFrame.h"
 #include "nsIFormControl.h"
 #include "nsGkAtoms.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsContentUtils.h"
 #include "nsTextNode.h"
 
 using namespace mozilla;
 
 nsGfxButtonControlFrame::nsGfxButtonControlFrame(ComputedStyle* aStyle,
                                                  nsPresContext* aPresContext)
     : nsHTMLButtonControlFrame(aStyle, aPresContext, kClassID) {}
 
-nsContainerFrame* NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewGfxButtonControlFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle) {
   return new (aPresShell)
       nsGfxButtonControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsGfxButtonControlFrame)
 
 void nsGfxButtonControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -1,31 +1,32 @@
 /* -*- 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 "nsHTMLButtonControlFrame.h"
 
+#include "mozilla/PresShell.h"
 #include "nsContainerFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsButtonFrameRenderer.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsNameSpaceManager.h"
 #include "nsDisplayList.h"
 #include <algorithm>
 
 using namespace mozilla;
 
-nsContainerFrame* NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewHTMLButtonControlFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsHTMLButtonControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsHTMLButtonControlFrame)
 
 nsHTMLButtonControlFrame::nsHTMLButtonControlFrame(ComputedStyle* aStyle,
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -1,22 +1,24 @@
 /* -*- 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 "nsImageFrame.h"
+
+#include "mozilla/MouseEvents.h"
+#include "mozilla/PresShell.h"
 #include "nsIFormControlFrame.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsLayoutUtils.h"
-#include "mozilla/MouseEvents.h"
 #include "nsIContent.h"
 
 using namespace mozilla;
 
 class nsImageControlFrame final : public nsImageFrame,
                                   public nsIFormControlFrame {
  public:
   explicit nsImageControlFrame(ComputedStyle* aStyle,
@@ -66,17 +68,17 @@ nsImageControlFrame::~nsImageControlFram
 void nsImageControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
                                       PostDestroyData& aPostDestroyData) {
   if (!GetPrevInFlow()) {
     nsCheckboxRadioFrame::RegUnRegAccessKey(this, false);
   }
   nsImageFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
-nsIFrame* NS_NewImageControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewImageControlFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   return new (aPresShell)
       nsImageControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsImageControlFrame)
 
 void nsImageControlFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -1,29 +1,30 @@
 /* -*- 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 "nsLegendFrame.h"
 
+#include "mozilla/PresShell.h"
 #include "ComputedStyle.h"
 #include "nsIContent.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsHTMLParts.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsCheckboxRadioFrame.h"
 #include "WritingModes.h"
 
 using namespace mozilla;
 
-nsIFrame* NS_NewLegendFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewLegendFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
 #ifdef DEBUG
   const nsStyleDisplay* disp = aStyle->StyleDisplay();
   NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle() && !disp->IsFloatingStyle(),
                "Legends should not be positioned and should not float");
 #endif
 
   nsIFrame* f =
       new (aPresShell) nsLegendFrame(aStyle, aPresShell->GetPresContext());
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -75,17 +75,17 @@ class nsListEventListener final : public
 
  private:
   ~nsListEventListener() {}
 
   nsListControlFrame* mFrame;
 };
 
 //---------------------------------------------------------
-nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewListControlFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle) {
   nsListControlFrame* it =
       new (aPresShell) nsListControlFrame(aStyle, aPresShell->GetPresContext());
 
   it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
 
   return it;
 }
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -28,16 +28,17 @@
 #  undef KeyPress
 #endif
 
 class nsComboboxControlFrame;
 class nsPresContext;
 class nsListEventListener;
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 class Event;
 class HTMLOptionElement;
 class HTMLSelectElement;
 class HTMLOptionsCollection;
 }  // namespace dom
 }  // namespace mozilla
 
@@ -46,18 +47,18 @@ class HTMLOptionsCollection;
  */
 
 class nsListControlFrame final : public nsHTMLScrollFrame,
                                  public nsIFormControlFrame,
                                  public nsISelectControlFrame {
  public:
   typedef mozilla::dom::HTMLOptionElement HTMLOptionElement;
 
-  friend nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell,
-                                                  ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewListControlFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsListControlFrame)
 
   // nsIFrame
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -21,17 +21,17 @@
 #include "nsCSSPseudoElements.h"
 #include "nsStyleConsts.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::dom::Element;
 using mozilla::dom::HTMLMeterElement;
 
-nsIFrame* NS_NewMeterFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewMeterFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsMeterFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMeterFrame)
 
 nsMeterFrame::nsMeterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     : nsContainerFrame(aStyle, aPresContext, kClassID), mBarDiv(nullptr) {}
 
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -1,43 +1,43 @@
 /* -*- 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 "nsNumberControlFrame.h"
 
+#include "mozilla/BasicEvents.h"
+#include "mozilla/EventStates.h"
+#include "mozilla/FloatingPoint.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/MutationEventBinding.h"
 #include "HTMLInputElement.h"
 #include "ICUUtils.h"
 #include "nsIFocusManager.h"
-#include "nsIPresShell.h"
 #include "nsFocusManager.h"
 #include "nsFontMetrics.h"
 #include "nsCheckboxRadioFrame.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsStyleConsts.h"
-#include "mozilla/BasicEvents.h"
-#include "mozilla/EventStates.h"
 #include "nsContentUtils.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsCSSPseudoElements.h"
 #include "nsThreadUtils.h"
-#include "mozilla/FloatingPoint.h"
-#include "mozilla/dom/MutationEventBinding.h"
 
 #ifdef ACCESSIBILITY
 #  include "mozilla/a11y/AccTypes.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewNumberControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewNumberControlFrame(PresShell* aPresShell,
                                    ComputedStyle* aStyle) {
   return new (aPresShell)
       nsNumberControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsNumberControlFrame)
 
 NS_QUERYFRAME_HEAD(nsNumberControlFrame)
--- a/layout/forms/nsNumberControlFrame.h
+++ b/layout/forms/nsNumberControlFrame.h
@@ -13,30 +13,31 @@
 #include "nsIAnonymousContentCreator.h"
 #include "nsCOMPtr.h"
 
 class nsITextControlFrame;
 class nsPresContext;
 
 namespace mozilla {
 enum class PseudoStyleType : uint8_t;
+class PresShell;
 class WidgetEvent;
 class WidgetGUIEvent;
 namespace dom {
 class HTMLInputElement;
 }  // namespace dom
 }  // namespace mozilla
 
 /**
  * This frame type is used for <input type=number>.
  */
 class nsNumberControlFrame final : public nsContainerFrame,
                                    public nsIAnonymousContentCreator,
                                    public nsIFormControlFrame {
-  friend nsIFrame* NS_NewNumberControlFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewNumberControlFrame(mozilla::PresShell* aPresShell,
                                             ComputedStyle* aStyle);
 
   typedef mozilla::PseudoStyleType PseudoStyleType;
   typedef mozilla::dom::Element Element;
   typedef mozilla::dom::HTMLInputElement HTMLInputElement;
   typedef mozilla::WidgetEvent WidgetEvent;
   typedef mozilla::WidgetGUIEvent WidgetGUIEvent;
 
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -20,17 +20,17 @@
 #include "nsFontMetrics.h"
 #include "nsCSSPseudoElements.h"
 #include "nsStyleConsts.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewProgressFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewProgressFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsProgressFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsProgressFrame)
 
 nsProgressFrame::nsProgressFrame(ComputedStyle* aStyle,
                                  nsPresContext* aPresContext)
     : nsContainerFrame(aStyle, aPresContext, kClassID), mBarDiv(nullptr) {}
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -36,17 +36,17 @@
 #define CROSS_AXIS_EM_SIZE 1.3f
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::image;
 
 NS_IMPL_ISUPPORTS(nsRangeFrame::DummyTouchListener, nsIDOMEventListener)
 
-nsIFrame* NS_NewRangeFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewRangeFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsRangeFrame(aStyle, aPresShell->GetPresContext());
 }
 
 nsRangeFrame::nsRangeFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     : nsContainerFrame(aStyle, aPresContext, kClassID) {}
 
 nsRangeFrame::~nsRangeFrame() {}
 
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -13,24 +13,25 @@
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIDOMEventListener.h"
 #include "nsCOMPtr.h"
 
 class nsDisplayRangeFocusRing;
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 class Event;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsRangeFrame final : public nsContainerFrame,
                            public nsIAnonymousContentCreator {
-  friend nsIFrame* NS_NewRangeFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewRangeFrame(mozilla::PresShell* aPresShell,
                                     ComputedStyle* aStyle);
 
   friend class nsDisplayRangeFocusRing;
 
   explicit nsRangeFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
   virtual ~nsRangeFrame();
 
   typedef mozilla::PseudoStyleType PseudoStyleType;
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -1,22 +1,24 @@
 /* -*- 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 "nsSelectsAreaFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "nsIContent.h"
 #include "nsListControlFrame.h"
 #include "nsDisplayList.h"
 #include "WritingModes.h"
 
 using namespace mozilla;
 
-nsContainerFrame* NS_NewSelectsAreaFrame(nsIPresShell* aShell,
+nsContainerFrame* NS_NewSelectsAreaFrame(PresShell* aShell,
                                          ComputedStyle* aStyle,
                                          nsFrameState aFlags) {
   nsSelectsAreaFrame* it =
       new (aShell) nsSelectsAreaFrame(aStyle, aShell->GetPresContext());
 
   // We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
   // aren't expanded by right floats outside the select.
   it->AddStateBits(aFlags | NS_BLOCK_FLOAT_MGR);
--- a/layout/forms/nsSelectsAreaFrame.h
+++ b/layout/forms/nsSelectsAreaFrame.h
@@ -4,21 +4,25 @@
  * 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 nsSelectsAreaFrame_h___
 #define nsSelectsAreaFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsBlockFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSelectsAreaFrame final : public nsBlockFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSelectsAreaFrame)
 
-  friend nsContainerFrame* NS_NewSelectsAreaFrame(nsIPresShell* aShell,
+  friend nsContainerFrame* NS_NewSelectsAreaFrame(mozilla::PresShell* aShell,
                                                   ComputedStyle* aStyle,
                                                   nsFrameState aFlags);
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
   void BuildDisplayListInternal(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists);
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -46,18 +46,17 @@
 #include "mozilla/MathAlgorithms.h"
 #include "nsFrameSelection.h"
 
 #define DEFAULT_COLUMN_WIDTH 20
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewTextControlFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewTextControlFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsTextControlFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTextControlFrame)
 
 NS_QUERYFRAME_HEAD(nsTextControlFrame)
   NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
--- a/layout/generic/BRFrame.cpp
+++ b/layout/generic/BRFrame.cpp
@@ -1,16 +1,17 @@
 /* -*- 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/. */
 
 /* rendering object for HTML <br> elements */
 
+#include "mozilla/PresShell.h"
 #include "gfxContext.h"
 #include "nsCOMPtr.h"
 #include "nsContainerFrame.h"
 #include "nsFontMetrics.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
 #include "nsLineLayout.h"
 #include "nsStyleConsts.h"
@@ -24,17 +25,17 @@
 using namespace mozilla;
 
 namespace mozilla {
 
 class BRFrame final : public nsFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(BRFrame)
 
-  friend nsIFrame* ::NS_NewBRFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* ::NS_NewBRFrame(mozilla::PresShell* aPresShell,
                                    ComputedStyle* aStyle);
 
   ContentOffsets CalcContentOffsetsFromFramePoint(
       const nsPoint& aPoint) override;
 
   virtual FrameSearchResult PeekOffsetNoAmount(bool aForward,
                                                int32_t* aOffset) override;
   virtual FrameSearchResult PeekOffsetCharacter(
@@ -73,17 +74,17 @@ class BRFrame final : public nsFrame {
 
   virtual ~BRFrame();
 
   nscoord mAscent;
 };
 
 }  // namespace mozilla
 
-nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewBRFrame(mozilla::PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) BRFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(BRFrame)
 
 BRFrame::~BRFrame() {}
 
 void BRFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
--- a/layout/generic/ColumnSetWrapperFrame.cpp
+++ b/layout/generic/ColumnSetWrapperFrame.cpp
@@ -1,23 +1,24 @@
 /* -*- 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 https://mozilla.org/MPL/2.0/. */
 
 #include "ColumnSetWrapperFrame.h"
 
+#include "mozilla/PresShell.h"
 #include "nsContentUtils.h"
 #include "nsIFrame.h"
 #include "nsIFrameInlines.h"
 
 using namespace mozilla;
 
-nsBlockFrame* NS_NewColumnSetWrapperFrame(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewColumnSetWrapperFrame(PresShell* aPresShell,
                                           ComputedStyle* aStyle,
                                           nsFrameState aStateFlags) {
   ColumnSetWrapperFrame* frame = new (aPresShell)
       ColumnSetWrapperFrame(aStyle, aPresShell->GetPresContext());
 
   // CSS Multi-column level 1 section 2: A multi-column container
   // establishes a new block formatting context, as per CSS 2.1 section
   // 9.4.1.
--- a/layout/generic/ColumnSetWrapperFrame.h
+++ b/layout/generic/ColumnSetWrapperFrame.h
@@ -9,33 +9,35 @@
 
 #ifndef mozilla_ColumnSetWrapperFrame_h
 #define mozilla_ColumnSetWrapperFrame_h
 
 #include "nsBlockFrame.h"
 
 namespace mozilla {
 
+class PresShell;
+
 // This class is a wrapper for nsColumnSetFrames and column-span frame.
 // Essentially, we divide the *original* nsColumnSetFrame into multiple
 // nsColumnSetFrames on the basis of the number and position of spanning
 // elements.
 //
 // This wrapper is necessary for implementing column-span as it allows us to
 // maintain each nsColumnSetFrame as an independent set of columns, and each
 // column-span element then becomes just a block level element.
 //
 class ColumnSetWrapperFrame final : public nsBlockFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(ColumnSetWrapperFrame)
   NS_DECL_QUERYFRAME
 
-  friend nsBlockFrame* ::NS_NewColumnSetWrapperFrame(nsIPresShell* aPresShell,
-                                                     ComputedStyle* aStyle,
-                                                     nsFrameState aStateFlags);
+  friend nsBlockFrame* ::NS_NewColumnSetWrapperFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle,
+      nsFrameState aStateFlags);
 
   void Init(nsIContent* aContent, nsContainerFrame* aParent,
             nsIFrame* aPrevInFlow) override;
 
   nsContainerFrame* GetContentInsertionFrame() override;
 
   void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
 
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -2,34 +2,34 @@
 /* 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 "DetailsFrame.h"
 
 #include "mozilla/Attributes.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/HTMLDetailsElement.h"
 #include "mozilla/dom/HTMLSummaryElement.h"
 #include "nsContentUtils.h"
 #include "nsPlaceholderFrame.h"
 #include "nsTextNode.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_FRAMEARENA_HELPERS(DetailsFrame)
 
 NS_QUERYFRAME_HEAD(DetailsFrame)
   NS_QUERYFRAME_ENTRY(DetailsFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
 NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
 
-nsBlockFrame* NS_NewDetailsFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsBlockFrame* NS_NewDetailsFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) DetailsFrame(aStyle, aPresShell->GetPresContext());
 }
 
 namespace mozilla {
 
 DetailsFrame::DetailsFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     : nsBlockFrame(aStyle, aPresContext, kClassID) {}
 
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -21,17 +21,17 @@
 #include "nsAbsoluteContainingBlock.h"
 #include "GeckoProfiler.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsPlaceholderFrame.h"
 
 using namespace mozilla;
 typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
 
-ViewportFrame* NS_NewViewportFrame(nsIPresShell* aPresShell,
+ViewportFrame* NS_NewViewportFrame(PresShell* aPresShell,
                                    ComputedStyle* aStyle) {
   return new (aPresShell) ViewportFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(ViewportFrame)
 NS_QUERYFRAME_HEAD(ViewportFrame)
   NS_QUERYFRAME_ENTRY(ViewportFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -278,22 +278,21 @@ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVE
 NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowOutOfFlowsProperty)
 NS_DECLARE_FRAME_PROPERTY_FRAMELIST(PushedFloatProperty)
 NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OutsideMarkerProperty)
 NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(InsideMarkerProperty, nsIFrame)
 NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BlockEndEdgeOfChildrenProperty, nscoord)
 
 //----------------------------------------------------------------------
 
-nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsBlockFrame* NS_NewBlockFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsBlockFrame(aStyle, aPresShell->GetPresContext());
 }
 
-nsBlockFrame* NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewBlockFormattingContext(PresShell* aPresShell,
                                            ComputedStyle* aComputedStyle) {
   nsBlockFrame* blockFrame = NS_NewBlockFrame(aPresShell, aComputedStyle);
   blockFrame->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
   return blockFrame;
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsBlockFrame)
 
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -39,16 +39,17 @@ enum class LineReflowStatus {
   // the next page or column if it's not the first line on the current
   // page/column.
   Truncated
 };
 
 class nsBlockInFlowLineIterator;
 namespace mozilla {
 class BlockReflowInput;
+class PresShell;
 class ServoRestyleState;
 class ServoStyleSet;
 }  // namespace mozilla
 
 /**
  * Some invariants:
  * -- The overflow out-of-flows list contains the out-of-
  * flow frames whose placeholders are in the overflow list.
@@ -96,17 +97,17 @@ class nsBlockFrame : public nsContainerF
   ReverseLineIterator LinesREnd() { return mLines.rend(); }
   ConstReverseLineIterator LinesRBegin() const { return mLines.rbegin(); }
   ConstReverseLineIterator LinesREnd() const { return mLines.rend(); }
   LineIterator LinesBeginFrom(nsLineBox* aList) { return mLines.begin(aList); }
   ReverseLineIterator LinesRBeginFrom(nsLineBox* aList) {
     return mLines.rbegin(aList);
   }
 
-  friend nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
+  friend nsBlockFrame* NS_NewBlockFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
   // nsQueryFrame
   NS_DECL_QUERYFRAME
 
   // nsIFrame
   void Init(nsIContent* aContent, nsContainerFrame* aParent,
             nsIFrame* aPrevInFlow) override;
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -50,17 +50,17 @@
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 using namespace mozilla::layout;
 using mozilla::dom::Document;
 
-nsIFrame* NS_NewBulletFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewBulletFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsBulletFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(FontSizeInflationProperty, float)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsBulletFrame)
 
 #ifdef DEBUG
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -37,18 +37,17 @@
 //#define DEBUG_CANVAS_FOCUS
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layout;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
-nsCanvasFrame* NS_NewCanvasFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsCanvasFrame* NS_NewCanvasFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsCanvasFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsCanvasFrame)
 
 NS_QUERYFRAME_HEAD(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for css3 multi-column layout */
 
 #include "nsColumnSetFrame.h"
 
 #include "mozilla/Logging.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/ToString.h"
 #include "nsCSSRendering.h"
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
 // To see this log, use $ MOZ_LOG=ColumnSet:4 ./mach run
 static LazyLogModule sColumnSetLog("ColumnSet");
@@ -94,17 +95,17 @@ bool nsDisplayColumnRule::CreateWebRende
 /**
  * Tracking issues:
  *
  * XXX cursor movement around the top and bottom of colums seems to make the
  * editor lose the caret.
  *
  * XXX should we support CSS columns applied to table elements?
  */
-nsContainerFrame* NS_NewColumnSetFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewColumnSetFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle,
                                        nsFrameState aStateFlags) {
   nsColumnSetFrame* it =
       new (aPresShell) nsColumnSetFrame(aStyle, aPresShell->GetPresContext());
   it->AddStateBits(aStateFlags);
   return it;
 }
 
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -19,17 +19,17 @@
 #include "nsGkAtoms.h"
 #include "nsFrameManager.h"
 #include "nsPlaceholderFrame.h"
 #include "nsCSSFrameConstructor.h"
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
-nsFirstLetterFrame* NS_NewFirstLetterFrame(nsIPresShell* aPresShell,
+nsFirstLetterFrame* NS_NewFirstLetterFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle) {
   return new (aPresShell)
       nsFirstLetterFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
 
 NS_QUERYFRAME_HEAD(nsFirstLetterFrame)
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -2315,17 +2315,17 @@ class MOZ_STACK_CLASS SingleLineCrossAxi
 // =======================
 
 NS_QUERYFRAME_HEAD(nsFlexContainerFrame)
   NS_QUERYFRAME_ENTRY(nsFlexContainerFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFlexContainerFrame)
 
-nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewFlexContainerFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle) {
   return new (aPresShell)
       nsFlexContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsFlexContainerFrame Method Implementations
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -14,19 +14,20 @@
 #include "mozilla/dom/FlexBinding.h"
 
 class nsStyleCoord;
 
 namespace mozilla {
 template <class T>
 class LinkedList;
 class LogicalPoint;
+class PresShell;
 }  // namespace mozilla
 
-nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewFlexContainerFrame(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle);
 
 /**
  * These structures are used to capture data during reflow to be
  * extracted by devtools via Chrome APIs. The structures are only
  * created when requested in GetFlexFrameWithComputedInfo(), and
  * the structures are attached to the nsFlexContainerFrame via the
  * FlexContainerInfo property.
@@ -93,18 +94,18 @@ struct ComputedFlexContainerInfo {
  * -- but only inside of a "display:-webkit-{inline-}box" container.)
  */
 class nsFlexContainerFrame final : public nsContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsFlexContainerFrame)
   NS_DECL_QUERYFRAME
 
   // Factory method:
-  friend nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
-                                                    ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewFlexContainerFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   // Forward-decls of helper classes
   class FlexItem;
   class FlexLine;
   class FlexboxAxisTracker;
   struct StrutInfo;
   class CachedMeasuringReflowResult;
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -464,17 +464,17 @@ void WeakFrame::Init(nsIFrame* aFrame) {
     if (presShell) {
       presShell->AddWeakFrame(this);
     } else {
       mFrame = nullptr;
     }
   }
 }
 
-nsIFrame* NS_NewEmptyFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewEmptyFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsFrame(aStyle, aPresShell->GetPresContext());
 }
 
 nsFrame::nsFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                  ClassID aID)
     : nsBox(aStyle, aPresContext, aID) {
   MOZ_COUNT_CTOR(nsFrame);
 }
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -10,23 +10,23 @@
 #define nsFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/Likely.h"
 #include "nsBox.h"
 #include "mozilla/Logging.h"
 
-#include "nsIPresShell.h"
 #include "mozilla/ReflowInput.h"
 #include "nsHTMLParts.h"
 #include "nsISelectionDisplay.h"
 
 namespace mozilla {
 enum class TableSelection : uint32_t;
+class PresShell;
 }  // namespace mozilla
 
 /**
  * nsFrame logging constants. We redefine the nspr
  * PRLogModuleInfo.level field to be a bitfield.  Each bit controls a
  * specific type of logging. Each logging operation has associated
  * inline methods defined below.
  *
@@ -126,17 +126,17 @@ struct nsRect;
  * behavior is to keep the frame and view position and size in sync.
  */
 class nsFrame : public nsBox {
  public:
   /**
    * Create a new "empty" frame that maps a given piece of content into a
    * 0,0 area.
    */
-  friend nsIFrame* NS_NewEmptyFrame(nsIPresShell* aShell,
+  friend nsIFrame* NS_NewEmptyFrame(mozilla::PresShell* aShell,
                                     ComputedStyle* aStyle);
 
  private:
   // Left undefined; nsFrame objects are never allocated from the heap.
   void* operator new(size_t sz) CPP_THROW_NEW;
 
  protected:
   // Overridden to prevent the global delete from being called, since
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1254,17 +1254,17 @@ void nsHTMLFramesetFrame::MouseDrag(nsPr
 }
 
 void nsHTMLFramesetFrame::EndMouseDrag(nsPresContext* aPresContext) {
   nsIPresShell::SetCapturingContent(nullptr, 0);
   mDragger = nullptr;
   gDragInProgress = false;
 }
 
-nsIFrame* NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewHTMLFramesetFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
 #ifdef DEBUG
   const nsStyleDisplay* disp = aStyle->StyleDisplay();
   NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle() && !disp->IsFloatingStyle(),
                "Framesets should not be positioned and should not float");
 #endif
 
   return new (aPresShell)
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -105,17 +105,17 @@ static uint32_t GetOverflowChange(const 
   }
   return result;
 }
 
 //----------------------------------------------------------------------
 
 //----------nsHTMLScrollFrame-------------------------------------------
 
-nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
+nsHTMLScrollFrame* NS_NewHTMLScrollFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle, bool aIsRoot) {
   return new (aPresShell)
       nsHTMLScrollFrame(aStyle, aPresShell->GetPresContext(), aIsRoot);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsHTMLScrollFrame)
 
 nsHTMLScrollFrame::nsHTMLScrollFrame(ComputedStyle* aStyle,
@@ -1209,17 +1209,17 @@ NS_QUERYFRAME_HEAD(nsHTMLScrollFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
   NS_QUERYFRAME_ENTRY(nsIScrollableFrame)
   NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
   NS_QUERYFRAME_ENTRY(nsIScrollbarMediator)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 //----------nsXULScrollFrame-------------------------------------------
 
-nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
+nsXULScrollFrame* NS_NewXULScrollFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle, bool aIsRoot,
                                        bool aClipAllDescendants) {
   return new (aPresShell) nsXULScrollFrame(aStyle, aPresShell->GetPresContext(),
                                            aIsRoot, aClipAllDescendants);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsXULScrollFrame)
 
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -23,22 +23,22 @@
 #include "nsRefreshDriver.h"
 #include "nsExpirationTracker.h"
 #include "TextOverflow.h"
 #include "ScrollVelocityQueue.h"
 #include "mozilla/PresState.h"
 #include "mozilla/layout/ScrollAnchorContainer.h"
 
 class nsPresContext;
-class nsIPresShell;
 class nsIContent;
 class nsAtom;
 class nsIScrollPositionListener;
 
 namespace mozilla {
+class PresShell;
 struct ScrollReflowInput;
 namespace layers {
 class Layer;
 class LayerManager;
 }  // namespace layers
 namespace layout {
 class ScrollbarActivity;
 }  // namespace layout
@@ -803,19 +803,18 @@ class nsHTMLScrollFrame : public nsConta
                           public nsIScrollableFrame,
                           public nsIAnonymousContentCreator,
                           public nsIStatefulFrame {
  public:
   typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
   typedef mozilla::CSSIntPoint CSSIntPoint;
   typedef mozilla::ScrollReflowInput ScrollReflowInput;
   typedef mozilla::layout::ScrollAnchorContainer ScrollAnchorContainer;
-  friend nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
-                                                  ComputedStyle* aStyle,
-                                                  bool aIsRoot);
+  friend nsHTMLScrollFrame* NS_NewHTMLScrollFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle, bool aIsRoot);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsHTMLScrollFrame)
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override {
     mHelper.BuildDisplayList(aBuilder, aLists);
   }
@@ -1289,17 +1288,17 @@ class nsXULScrollFrame final : public ns
  public:
   typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
   typedef mozilla::CSSIntPoint CSSIntPoint;
   typedef mozilla::layout::ScrollAnchorContainer ScrollAnchorContainer;
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsXULScrollFrame)
 
-  friend nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
+  friend nsXULScrollFrame* NS_NewXULScrollFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle,
                                                 bool aIsRoot,
                                                 bool aClipAllDescendants);
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override {
     mHelper.BuildDisplayList(aBuilder, aLists);
   }
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -2486,17 +2486,17 @@ static uint16_t GetAlignJustifyFallbackI
 // =======================
 
 NS_QUERYFRAME_HEAD(nsGridContainerFrame)
   NS_QUERYFRAME_ENTRY(nsGridContainerFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsGridContainerFrame)
 
-nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewGridContainerFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle) {
   return new (aPresShell)
       nsGridContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsGridContainerFrame Method Implementations
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -10,21 +10,25 @@
 #define nsGridContainerFrame_h___
 
 #include "mozilla/Maybe.h"
 #include "mozilla/TypeTraits.h"
 #include "nsContainerFrame.h"
 #include "nsHashKeys.h"
 #include "nsTHashtable.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsGridContainerFrame (infallible)
  */
-nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewGridContainerFrame(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle);
 
 namespace mozilla {
 
 // Forward-declare typedefs for grid item iterator helper-class:
 template <typename Iterator>
 class CSSOrderAwareFrameIteratorT;
 typedef CSSOrderAwareFrameIteratorT<nsFrameList::iterator>
@@ -270,18 +274,18 @@ class nsGridContainerFrame final : publi
   struct Grid;
   struct GridArea;
   class LineNameMap;
   struct LineRange;
   struct SharedGridData;
   struct TrackSizingFunctions;
   struct Tracks;
   struct TranslatedLineRange;
-  friend nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
-                                                    ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewGridContainerFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
   explicit nsGridContainerFrame(ComputedStyle* aStyle,
                                 nsPresContext* aPresContext)
       : nsContainerFrame(aStyle, aPresContext, kClassID),
         mCachedMinISize(NS_INTRINSIC_WIDTH_UNKNOWN),
         mCachedPrefISize(NS_INTRINSIC_WIDTH_UNKNOWN) {
     mBaseline[0][0] = NS_INTRINSIC_WIDTH_UNKNOWN;
     mBaseline[0][1] = NS_INTRINSIC_WIDTH_UNKNOWN;
     mBaseline[1][0] = NS_INTRINSIC_WIDTH_UNKNOWN;
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for the HTML <canvas> element */
 
 #include "nsHTMLCanvasFrame.h"
 
 #include "nsGkAtoms.h"
 #include "mozilla/Assertions.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "mozilla/layers/WebRenderBridgeChild.h"
 #include "mozilla/layers/WebRenderCanvasRenderer.h"
 #include "mozilla/layers/RenderRootStateManager.h"
 #include "nsDisplayList.h"
 #include "nsLayoutUtils.h"
 #include "nsStyleUtil.h"
 #include "ImageLayers.h"
@@ -221,18 +222,17 @@ class nsDisplayCanvas final : public nsD
   // "white"
   virtual bool IsContentful() const override {
     nsHTMLCanvasFrame* f = static_cast<nsHTMLCanvasFrame*>(Frame());
     HTMLCanvasElement* canvas = HTMLCanvasElement::FromNode(f->GetContent());
     return canvas->MaybeModified();
   }
 };
 
-nsIFrame* NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle) {
+nsIFrame* NS_NewHTMLCanvasFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsHTMLCanvasFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_QUERYFRAME_HEAD(nsHTMLCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsHTMLCanvasFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -10,27 +10,28 @@
 #define nsHTMLCanvasFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsStringFwd.h"
 #include "FrameLayerBuilder.h"
 
 namespace mozilla {
+class PresShell;
 namespace layers {
 class Layer;
 class LayerManager;
 class WebRenderCanvasData;
 }  // namespace layers
 }  // namespace mozilla
 
 class nsPresContext;
 class nsDisplayItem;
 
-nsIFrame* NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewHTMLCanvasFrame(PresShell* aPresShell,
                                 mozilla::ComputedStyle* aStyle);
 
 class nsHTMLCanvasFrame final : public nsContainerFrame {
  public:
   typedef mozilla::layers::CanvasRenderer CanvasRenderer;
   typedef mozilla::layers::Layer Layer;
   typedef mozilla::layers::LayerManager LayerManager;
   typedef mozilla::layers::WebRenderCanvasData WebRenderCanvasData;
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -17,20 +17,20 @@ class nsCheckboxRadioFrame;
 class nsAtom;
 class nsNodeInfoManager;
 class nsIContent;
 
 class nsIFrame;
 class nsIHTMLContentSink;
 class nsIFragmentContentSink;
 class nsIURI;
-class nsIPresShell;
 class nsIChannel;
 class nsTableColFrame;
 namespace mozilla {
+class PresShell;
 class ViewportFrame;
 }  // namespace mozilla
 
 // These are all the block specific frame bits, they are copied from
 // the prev-in-flow to a newly created next-in-flow, except for the
 // NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below.
 #define NS_BLOCK_FLAGS_MASK                                                    \
   (NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS | NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \
@@ -43,157 +43,157 @@ class ViewportFrame;
 #define NS_BLOCK_FLAGS_NON_INHERITED_MASK                                \
   (NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER | NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
    NS_BLOCK_FRAME_HAS_INSIDE_MARKER)
 
 // Factory methods for creating html layout objects
 
 // Create a frame that supports "display: block" layout behavior
 class nsBlockFrame;
-nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewBlockFrame(mozilla::PresShell* aPresShell,
                                mozilla::ComputedStyle* aStyle);
 
 // Special Generated Content Node. It contains text taken from an
 // attribute of its *grandparent* content node.
 nsresult NS_NewAttributeContent(nsNodeInfoManager* aNodeInfoManager,
                                 int32_t aNameSpaceID, nsAtom* aAttrName,
                                 nsIContent** aResult);
 
 // Create a basic area frame but the GetFrameForPoint is overridden to always
 // return the option frame
 // By default, area frames will extend
 // their height to cover any children that "stick out".
-nsContainerFrame* NS_NewSelectsAreaFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSelectsAreaFrame(mozilla::PresShell* aPresShell,
                                          mozilla::ComputedStyle* aStyle,
                                          nsFrameState aFlags);
 
 // Create a block formatting context blockframe
-nsBlockFrame* NS_NewBlockFormattingContext(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewBlockFormattingContext(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle);
 
-nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewBRFrame(mozilla::PresShell* aPresShell,
                         mozilla::ComputedStyle* aStyle);
 
-nsIFrame* NS_NewCommentFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewCommentFrame(mozilla::PresShell* aPresShell,
                              mozilla::ComputedStyle* aStyle);
 
 // <frame> and <iframe>
-nsIFrame* NS_NewSubDocumentFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSubDocumentFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
 // <frameset>
-nsIFrame* NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewHTMLFramesetFrame(mozilla::PresShell* aPresShell,
                                   mozilla::ComputedStyle* aStyle);
 
-mozilla::ViewportFrame* NS_NewViewportFrame(nsIPresShell* aPresShell,
+mozilla::ViewportFrame* NS_NewViewportFrame(mozilla::PresShell* aPresShell,
                                             mozilla::ComputedStyle* aStyle);
 class nsCanvasFrame;
-nsCanvasFrame* NS_NewCanvasFrame(nsIPresShell* aPresShell,
+nsCanvasFrame* NS_NewCanvasFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewImageFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewImageFrame(mozilla::PresShell* aPresShell,
                            mozilla::ComputedStyle* aStyle);
 class nsInlineFrame;
-nsInlineFrame* NS_NewInlineFrame(nsIPresShell* aPresShell,
+nsInlineFrame* NS_NewInlineFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewObjectFrame(mozilla::PresShell* aPresShell,
                             mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewTextFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewTextFrame(mozilla::PresShell* aPresShell,
                           mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewContinuingTextFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewContinuingTextFrame(mozilla::PresShell* aPresShell,
                                     mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewEmptyFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewEmptyFrame(mozilla::PresShell* aPresShell,
                            mozilla::ComputedStyle* aStyle);
-inline nsIFrame* NS_NewWBRFrame(nsIPresShell* aPresShell,
+inline nsIFrame* NS_NewWBRFrame(mozilla::PresShell* aPresShell,
                                 mozilla::ComputedStyle* aStyle) {
   return NS_NewEmptyFrame(aPresShell, aStyle);
 }
 
-nsBlockFrame* NS_NewColumnSetWrapperFrame(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewColumnSetWrapperFrame(mozilla::PresShell* aPresShell,
                                           mozilla::ComputedStyle* aStyle,
                                           nsFrameState aStateFlags);
-nsContainerFrame* NS_NewColumnSetFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewColumnSetFrame(mozilla::PresShell* aPresShell,
                                        mozilla::ComputedStyle* aStyle,
                                        nsFrameState aStateFlags);
 
 class nsSimplePageSequenceFrame;
 nsSimplePageSequenceFrame* NS_NewSimplePageSequenceFrame(
-    nsIPresShell* aPresShell, mozilla::ComputedStyle* aStyle);
+    mozilla::PresShell* aPresShell, mozilla::ComputedStyle* aStyle);
 class nsPageFrame;
-nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
+nsPageFrame* NS_NewPageFrame(mozilla::PresShell* aPresShell,
                              mozilla::ComputedStyle* aStyle);
 class nsPageContentFrame;
-nsPageContentFrame* NS_NewPageContentFrame(nsIPresShell* aPresShell,
+nsPageContentFrame* NS_NewPageContentFrame(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewPageBreakFrame(mozilla::PresShell* aPresShell,
                                mozilla::ComputedStyle* aStyle);
 class nsFirstLetterFrame;
-nsFirstLetterFrame* NS_NewFirstLetterFrame(nsIPresShell* aPresShell,
+nsFirstLetterFrame* NS_NewFirstLetterFrame(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle);
 class nsFirstLineFrame;
-nsFirstLineFrame* NS_NewFirstLineFrame(nsIPresShell* aPresShell,
+nsFirstLineFrame* NS_NewFirstLineFrame(mozilla::PresShell* aPresShell,
                                        mozilla::ComputedStyle* aStyle);
 
 // forms
-nsContainerFrame* NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewGfxButtonControlFrame(mozilla::PresShell* aPresShell,
                                               mozilla::ComputedStyle* aStyle);
-nsCheckboxRadioFrame* NS_NewCheckboxRadioFrame(nsIPresShell* aPresShell,
+nsCheckboxRadioFrame* NS_NewCheckboxRadioFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewImageControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewImageControlFrame(mozilla::PresShell* aPresShell,
                                   mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewHTMLButtonControlFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewFieldSetFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewFieldSetFrame(mozilla::PresShell* aPresShell,
                                       mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewFileControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewFileControlFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewColorControlFrame(mozilla::PresShell* aPresShell,
                                   mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewLegendFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewLegendFrame(mozilla::PresShell* aPresShell,
                             mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewTextControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewTextControlFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewListControlFrame(mozilla::PresShell* aPresShell,
                                          mozilla::ComputedStyle* aStyle);
 nsComboboxControlFrame* NS_NewComboboxControlFrame(
-    nsIPresShell* aPresShell, mozilla::ComputedStyle* aStyle,
+    mozilla::PresShell* aPresShell, mozilla::ComputedStyle* aStyle,
     nsFrameState aFlags);
-nsIFrame* NS_NewProgressFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewProgressFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMeterFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMeterFrame(mozilla::PresShell* aPresShell,
                            mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewRangeFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewRangeFrame(mozilla::PresShell* aPresShell,
                            mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewNumberControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewNumberControlFrame(mozilla::PresShell* aPresShell,
                                    mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewDateTimeControlFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewDateTimeControlFrame(mozilla::PresShell* aPresShell,
                                      mozilla::ComputedStyle* aStyle);
-nsBlockFrame* NS_NewDetailsFrame(nsIPresShell* aPresShell,
+nsBlockFrame* NS_NewDetailsFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewBulletFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewBulletFrame(mozilla::PresShell* aPresShell,
                             mozilla::ComputedStyle* aStyle);
 
 // Table frame factories
 class nsTableWrapperFrame;
-nsTableWrapperFrame* NS_NewTableWrapperFrame(nsIPresShell* aPresShell,
+nsTableWrapperFrame* NS_NewTableWrapperFrame(mozilla::PresShell* aPresShell,
                                              mozilla::ComputedStyle* aStyle);
 class nsTableFrame;
-nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
+nsTableFrame* NS_NewTableFrame(mozilla::PresShell* aPresShell,
                                mozilla::ComputedStyle* aStyle);
-nsTableColFrame* NS_NewTableColFrame(nsIPresShell* aPresShell,
+nsTableColFrame* NS_NewTableColFrame(mozilla::PresShell* aPresShell,
                                      mozilla::ComputedStyle* aStyle);
 class nsTableColGroupFrame;
-nsTableColGroupFrame* NS_NewTableColGroupFrame(nsIPresShell* aPresShell,
+nsTableColGroupFrame* NS_NewTableColGroupFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
 class nsTableRowFrame;
-nsTableRowFrame* NS_NewTableRowFrame(nsIPresShell* aPresShell,
+nsTableRowFrame* NS_NewTableRowFrame(mozilla::PresShell* aPresShell,
                                      mozilla::ComputedStyle* aStyle);
 class nsTableRowGroupFrame;
-nsTableRowGroupFrame* NS_NewTableRowGroupFrame(nsIPresShell* aPresShell,
+nsTableRowGroupFrame* NS_NewTableRowGroupFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
 class nsTableCellFrame;
-nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
+nsTableCellFrame* NS_NewTableCellFrame(mozilla::PresShell* aPresShell,
                                        mozilla::ComputedStyle* aStyle,
                                        nsTableFrame* aTableFrame);
 
 nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult,
                                mozilla::dom::Document* aDoc, nsIURI* aURL,
                                nsISupports* aContainer,  // e.g. docshell
                                nsIChannel* aChannel);
 nsresult NS_NewHTMLFragmentContentSink(
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -128,28 +128,28 @@ static bool HaveFixedSize(const ReflowIn
                "crappy reflowInput - null stylePosition");
   // Don't try to make this optimization when an image has percentages
   // in its 'width' or 'height'.  The percentages might be treated like
   // auto (especially for intrinsic width calculations and for heights).
   return aReflowInput.mStylePosition->mHeight.ConvertsToLength() &&
          aReflowInput.mStylePosition->mWidth.ConvertsToLength();
 }
 
-nsIFrame* NS_NewImageFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewImageFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsImageFrame(aStyle, aPresShell->GetPresContext(),
                                        nsImageFrame::Kind::ImageElement);
 }
 
-nsIFrame* NS_NewImageFrameForContentProperty(nsIPresShell* aPresShell,
+nsIFrame* NS_NewImageFrameForContentProperty(PresShell* aPresShell,
                                              ComputedStyle* aStyle) {
   return new (aPresShell) nsImageFrame(aStyle, aPresShell->GetPresContext(),
                                        nsImageFrame::Kind::ContentProperty);
 }
 
-nsIFrame* NS_NewImageFrameForGeneratedContentIndex(nsIPresShell* aPresShell,
+nsIFrame* NS_NewImageFrameForGeneratedContentIndex(PresShell* aPresShell,
                                                    ComputedStyle* aStyle) {
   return new (aPresShell)
       nsImageFrame(aStyle, aPresShell->GetPresContext(),
                    nsImageFrame::Kind::ContentPropertyAtIndex);
 }
 
 bool nsImageFrame::ShouldShowBrokenImageIcon() const {
   // NOTE(emilio, https://github.com/w3c/csswg-drafts/issues/2832): WebKit and
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -193,20 +193,20 @@ class nsImageFrame : public nsAtomicCont
     // for the content property.
     ContentPropertyAtIndex,
   };
 
   // Creates a suitable continuing frame for this frame.
   nsImageFrame* CreateContinuingFrame(nsIPresShell*, ComputedStyle*) const;
 
  private:
-  friend nsIFrame* NS_NewImageFrame(nsIPresShell*, ComputedStyle*);
-  friend nsIFrame* NS_NewImageFrameForContentProperty(nsIPresShell*,
+  friend nsIFrame* NS_NewImageFrame(mozilla::PresShell*, ComputedStyle*);
+  friend nsIFrame* NS_NewImageFrameForContentProperty(mozilla::PresShell*,
                                                       ComputedStyle*);
-  friend nsIFrame* NS_NewImageFrameForGeneratedContentIndex(nsIPresShell*,
+  friend nsIFrame* NS_NewImageFrameForGeneratedContentIndex(mozilla::PresShell*,
                                                             ComputedStyle*);
 
   nsImageFrame(ComputedStyle* aStyle, nsPresContext* aPresContext, Kind aKind)
       : nsImageFrame(aStyle, aPresContext, kClassID, aKind) {}
 
   nsImageFrame(ComputedStyle*, nsPresContext* aPresContext, ClassID, Kind);
 
  protected:
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -4,44 +4,44 @@
  * 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/. */
 
 /* rendering object for CSS display:inline objects */
 
 #include "nsInlineFrame.h"
 
 #include "gfxContext.h"
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/Likely.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/ServoStyleSet.h"
 #include "nsLineLayout.h"
 #include "nsBlockFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsPresContextInlines.h"
 #include "nsCSSAnonBoxes.h"
-#include "mozilla/RestyleManager.h"
 #include "nsDisplayList.h"
-#include "mozilla/Likely.h"
 #include "SVGTextFrame.h"
 #include "nsStyleChangeList.h"
-#include "mozilla/ComputedStyle.h"
-#include "mozilla/ServoStyleSet.h"
 
 #ifdef DEBUG
 #  undef NOISY_PUSHING
 #endif
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
 //////////////////////////////////////////////////////////////////////
 
 // Basic nsInlineFrame methods
 
-nsInlineFrame* NS_NewInlineFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsInlineFrame* NS_NewInlineFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsInlineFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsInlineFrame)
 
 NS_QUERYFRAME_HEAD(nsInlineFrame)
   NS_QUERYFRAME_ENTRY(nsInlineFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
@@ -927,17 +927,17 @@ void nsInlineFrame::UpdateStyleOfOwnedAn
     blockFrame = nextInline->GetProperty(nsIFrame::IBSplitSibling());
   }
 }
 
 //////////////////////////////////////////////////////////////////////
 
 // nsLineFrame implementation
 
-nsFirstLineFrame* NS_NewFirstLineFrame(nsIPresShell* aPresShell,
+nsFirstLineFrame* NS_NewFirstLineFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       nsFirstLineFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsFirstLineFrame)
 
 void nsFirstLineFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -9,28 +9,32 @@
 #ifndef nsInlineFrame_h___
 #define nsInlineFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 
 class nsLineLayout;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Inline frame class.
  *
  * This class manages a list of child frames that are inline frames. Working
  * with nsLineLayout, the class will reflow and place inline frames on a line.
  */
 class nsInlineFrame : public nsContainerFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsInlineFrame)
 
-  friend nsInlineFrame* NS_NewInlineFrame(nsIPresShell* aPresShell,
+  friend nsInlineFrame* NS_NewInlineFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   // nsIFrame overrides
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
 #ifdef ACCESSIBILITY
   virtual mozilla::a11y::AccType AccessibleType() override;
@@ -182,17 +186,17 @@ class nsInlineFrame : public nsContainer
 /**
  * Variation on inline-frame used to manage lines for line layout in
  * special situations (:first-line style in particular).
  */
 class nsFirstLineFrame final : public nsInlineFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsFirstLineFrame)
 
-  friend nsFirstLineFrame* NS_NewFirstLineFrame(nsIPresShell* aPresShell,
+  friend nsFirstLineFrame* NS_NewFirstLineFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
 #endif
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -9,17 +9,17 @@
 
 #include "nsCSSFrameConstructor.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsSimplePageSequenceFrame.h"
 
 using namespace mozilla;
 
-nsPageContentFrame* NS_NewPageContentFrame(nsIPresShell* aPresShell,
+nsPageContentFrame* NS_NewPageContentFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle) {
   return new (aPresShell)
       nsPageContentFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPageContentFrame)
 
 void nsPageContentFrame::Reflow(nsPresContext* aPresContext,
--- a/layout/generic/nsPageContentFrame.h
+++ b/layout/generic/nsPageContentFrame.h
@@ -7,23 +7,27 @@
 #define nsPageContentFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ViewportFrame.h"
 
 class nsPageFrame;
 class nsSharedPageData;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 // Page frame class used by the simple page sequence frame
 class nsPageContentFrame final : public mozilla::ViewportFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsPageContentFrame)
 
-  friend nsPageContentFrame* NS_NewPageContentFrame(nsIPresShell* aPresShell,
-                                                    ComputedStyle* aStyle);
+  friend nsPageContentFrame* NS_NewPageContentFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
   friend class nsPageFrame;
 
   // nsIFrame
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override {
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -23,17 +23,17 @@
 
 #include "mozilla/Logging.h"
 extern mozilla::LazyLogModule gLayoutPrintingLog;
 #define PR_PL(_p1) MOZ_LOG(gLayoutPrintingLog, mozilla::LogLevel::Debug, _p1)
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
-nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsPageFrame* NS_NewPageFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsPageFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPageFrame)
 
 NS_QUERYFRAME_HEAD(nsPageFrame)
   NS_QUERYFRAME_ENTRY(nsPageFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
@@ -623,18 +623,17 @@ void nsPageFrame::SetSharedPageData(nsSh
 
 void nsPageFrame::AppendDirectlyOwnedAnonBoxes(
     nsTArray<OwnedAnonBox>& aResult) {
   MOZ_ASSERT(mFrames.FirstChild() && mFrames.FirstChild()->IsPageContentFrame(),
              "pageFrame must have a pageContentFrame child");
   aResult.AppendElement(mFrames.FirstChild());
 }
 
-nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewPageBreakFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   MOZ_ASSERT(aPresShell, "null PresShell");
   // check that we are only creating page break frames when printing
   NS_ASSERTION(aPresShell->GetPresContext()->IsPaginated(),
                "created a page break frame while not printing");
 
   return new (aPresShell)
       nsPageBreakFrame(aStyle, aPresShell->GetPresContext());
 }
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -8,23 +8,27 @@
 
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsLeafFrame.h"
 
 class nsFontMetrics;
 class nsSharedPageData;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 // Page frame class used by the simple page sequence frame
 class nsPageFrame final : public nsContainerFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsPageFrame)
 
-  friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
+  friend nsPageFrame* NS_NewPageFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
@@ -101,13 +105,13 @@ class nsPageBreakFrame final : public ns
 #endif
 
  protected:
   virtual nscoord GetIntrinsicISize() override;
   virtual nscoord GetIntrinsicBSize() override;
 
   bool mHaveReflowed;
 
-  friend nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewPageBreakFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 };
 
 #endif /* nsPageFrame_h___ */
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -23,17 +23,17 @@
 #include "nsPresContext.h"
 #include "nsIFrameInlines.h"
 #include "nsIContentInlines.h"
 #include "nsIPresShellInlines.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
-nsPlaceholderFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell,
+nsPlaceholderFrame* NS_NewPlaceholderFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle,
                                            nsFrameState aTypeBits) {
   return new (aPresShell)
       nsPlaceholderFrame(aStyle, aPresShell->GetPresContext(), aTypeBits);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPlaceholderFrame)
 
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -34,18 +34,22 @@
 
 #ifndef nsPlaceholderFrame_h___
 #define nsPlaceholderFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsPlaceholderFrame;
-nsPlaceholderFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell,
+nsPlaceholderFrame* NS_NewPlaceholderFrame(mozilla::PresShell* aPresShell,
                                            mozilla::ComputedStyle* aStyle,
                                            nsFrameState aTypeBits);
 
 #define PLACEHOLDER_TYPE_MASK                                                  \
   (PLACEHOLDER_FOR_FLOAT | PLACEHOLDER_FOR_ABSPOS | PLACEHOLDER_FOR_FIXEDPOS | \
    PLACEHOLDER_FOR_POPUP | PLACEHOLDER_FOR_TOPLAYER)
 
 /**
@@ -58,19 +62,19 @@ class nsPlaceholderFrame final : public 
 #ifdef DEBUG
   NS_DECL_QUERYFRAME
 #endif
 
   /**
    * Create a new placeholder frame.  aTypeBit must be one of the
    * PLACEHOLDER_FOR_* constants above.
    */
-  friend nsPlaceholderFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell,
-                                                    ComputedStyle* aStyle,
-                                                    nsFrameState aTypeBits);
+  friend nsPlaceholderFrame* NS_NewPlaceholderFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle,
+      nsFrameState aTypeBits);
 
   nsPlaceholderFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                      nsFrameState aTypeBits)
       : nsFrame(aStyle, aPresContext, kClassID), mOutOfFlowFrame(nullptr) {
     MOZ_ASSERT(
         aTypeBits == PLACEHOLDER_FOR_FLOAT ||
             aTypeBits == PLACEHOLDER_FOR_ABSPOS ||
             aTypeBits == PLACEHOLDER_FOR_FIXEDPOS ||
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1676,17 +1676,17 @@ void nsPluginFrame::EndSwapDocShells(nsI
     }
   }
 
   if (objectFrame->mInstanceOwner) {
     objectFrame->RegisterPluginForGeometryUpdates();
   }
 }
 
-nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewObjectFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsPluginFrame(aStyle, aPresShell->GetPresContext());
 }
 
 bool nsPluginFrame::IsPaintedByGecko() const {
 #ifdef XP_MACOSX
   return true;
 #else
   return !mWidget;
--- a/layout/generic/nsPluginFrame.h
+++ b/layout/generic/nsPluginFrame.h
@@ -36,16 +36,17 @@
 
 class nsPresContext;
 class nsRootPresContext;
 class nsDisplayPlugin;
 class PluginBackgroundSink;
 class nsPluginInstanceOwner;
 
 namespace mozilla {
+class PresShell;
 namespace layers {
 class ImageContainer;
 class Layer;
 class LayerManager;
 }  // namespace layers
 }  // namespace mozilla
 
 class PluginFrameDidCompositeObserver;
@@ -64,17 +65,17 @@ class nsPluginFrame final : public nsFra
   typedef mozilla::layers::StackingContextHelper StackingContextHelper;
   typedef mozilla::layers::RenderRootStateManager RenderRootStateManager;
   typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand;
   typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
 
   NS_DECL_FRAMEARENA_HELPERS(nsPluginFrame)
   NS_DECL_QUERYFRAME
 
-  friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewObjectFrame(mozilla::PresShell* aPresShell,
                                      ComputedStyle* aStyle);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
   virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
   virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -8,16 +8,17 @@
 
 #include "nsRubyBaseContainerFrame.h"
 #include "nsRubyTextContainerFrame.h"
 #include "nsRubyBaseFrame.h"
 #include "nsRubyTextFrame.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/WritingModes.h"
 #include "nsLayoutUtils.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 #include "nsStyleStructInlines.h"
 #include "nsTextFrame.h"
 #include "RubyUtils.h"
 
@@ -30,17 +31,17 @@ using namespace mozilla::gfx;
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyBaseContainerFrame)
   NS_QUERYFRAME_ENTRY(nsRubyBaseContainerFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame)
 
-nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyBaseContainerFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsRubyBaseContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsRubyBaseContainerFrame Method Implementations
--- a/layout/generic/nsRubyBaseContainerFrame.h
+++ b/layout/generic/nsRubyBaseContainerFrame.h
@@ -7,21 +7,25 @@
 /* rendering object for CSS "display: ruby-base-container" */
 
 #ifndef nsRubyBaseContainerFrame_h___
 #define nsRubyBaseContainerFrame_h___
 
 #include "nsContainerFrame.h"
 #include "RubyUtils.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsRubyBaseContainerFrame (infallible)
  */
-nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyBaseContainerFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
 
 class nsRubyBaseContainerFrame final : public nsContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
@@ -51,17 +55,17 @@ class nsRubyBaseContainerFrame final : p
     mDescendantLeadings.Update(aLeadings);
   }
   mozilla::RubyBlockLeadings GetDescendantLeadings() const {
     return mDescendantLeadings;
   }
 
  protected:
   friend nsContainerFrame* NS_NewRubyBaseContainerFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   explicit nsRubyBaseContainerFrame(ComputedStyle* aStyle,
                                     nsPresContext* aPresContext)
       : nsContainerFrame(aStyle, aPresContext, kClassID) {}
 
   struct RubyReflowInput;
   nscoord ReflowColumns(const RubyReflowInput& aReflowInput,
                         nsReflowStatus& aStatus);
--- a/layout/generic/nsRubyBaseFrame.cpp
+++ b/layout/generic/nsRubyBaseFrame.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: ruby-base" */
 
 #include "nsRubyBaseFrame.h"
 
 #include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/WritingModes.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 
 using namespace mozilla;
 
 //----------------------------------------------------------------------
 
@@ -21,17 +22,17 @@ using namespace mozilla;
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyBaseFrame)
   NS_QUERYFRAME_ENTRY(nsRubyBaseFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsRubyContentFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyBaseFrame)
 
-nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyBaseFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle) {
   return new (aPresShell) nsRubyBaseFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsRubyBaseFrame Method Implementations
 // ======================================
--- a/layout/generic/nsRubyBaseFrame.h
+++ b/layout/generic/nsRubyBaseFrame.h
@@ -6,32 +6,36 @@
 
 /* rendering object for CSS "display: ruby-base" */
 
 #ifndef nsRubyBaseFrame_h___
 #define nsRubyBaseFrame_h___
 
 #include "nsRubyContentFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsRubyBaseFrame (infallible)
  */
-nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyBaseFrame(mozilla::PresShell* aPresShell,
                                       mozilla::ComputedStyle* aStyle);
 
 class nsRubyBaseFrame final : public nsRubyContentFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseFrame)
   NS_DECL_QUERYFRAME
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
 #endif
 
  protected:
-  friend nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewRubyBaseFrame(mozilla::PresShell* aPresShell,
                                                ComputedStyle* aStyle);
   explicit nsRubyBaseFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsRubyContentFrame(aStyle, aPresContext, kClassID) {}
 };
 
 #endif /* nsRubyBaseFrame_h___ */
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -6,16 +6,17 @@
 
 /* rendering object for CSS "display: ruby" */
 
 #include "nsRubyFrame.h"
 
 #include "RubyUtils.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/WritingModes.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 #include "nsRubyBaseContainerFrame.h"
 #include "nsRubyTextContainerFrame.h"
 
 using namespace mozilla;
 
@@ -25,17 +26,17 @@ using namespace mozilla;
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyFrame)
   NS_QUERYFRAME_ENTRY(nsRubyFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsInlineFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyFrame)
 
-nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   return new (aPresShell) nsRubyFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsRubyFrame Method Implementations
 // ==================================
--- a/layout/generic/nsRubyFrame.h
+++ b/layout/generic/nsRubyFrame.h
@@ -7,21 +7,25 @@
 /* rendering object for CSS "display: ruby" */
 
 #ifndef nsRubyFrame_h___
 #define nsRubyFrame_h___
 
 #include "nsInlineFrame.h"
 #include "RubyUtils.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsRubyFrame (infallible)
  */
-nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyFrame(mozilla::PresShell* aPresShell,
                                   mozilla::ComputedStyle* aStyle);
 
 class nsRubyFrame final : public nsInlineFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsRubyFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
@@ -36,17 +40,17 @@ class nsRubyFrame final : public nsInlin
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
 #endif
 
   mozilla::RubyBlockLeadings GetBlockLeadings() const { return mLeadings; }
 
  protected:
-  friend nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewRubyFrame(mozilla::PresShell* aPresShell,
                                            ComputedStyle* aStyle);
   explicit nsRubyFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsInlineFrame(aStyle, aPresContext, kClassID) {}
 
   void ReflowSegment(nsPresContext* aPresContext,
                      const ReflowInput& aReflowInput,
                      nsRubyBaseContainerFrame* aBaseContainer,
                      nsReflowStatus& aStatus);
--- a/layout/generic/nsRubyTextContainerFrame.cpp
+++ b/layout/generic/nsRubyTextContainerFrame.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: ruby-text-container" */
 
 #include "nsRubyTextContainerFrame.h"
 
 #include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/WritingModes.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 
 using namespace mozilla;
 
 //----------------------------------------------------------------------
@@ -22,17 +23,17 @@ using namespace mozilla;
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyTextContainerFrame)
   NS_QUERYFRAME_ENTRY(nsRubyTextContainerFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextContainerFrame)
 
-nsContainerFrame* NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyTextContainerFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsRubyTextContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsRubyTextContainerFrame Method Implementations
--- a/layout/generic/nsRubyTextContainerFrame.h
+++ b/layout/generic/nsRubyTextContainerFrame.h
@@ -6,21 +6,25 @@
 
 /* rendering object for CSS "display: ruby-text-container" */
 
 #ifndef nsRubyTextContainerFrame_h___
 #define nsRubyTextContainerFrame_h___
 
 #include "nsBlockFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsRubyTextContainerFrame (infallible)
  */
-nsContainerFrame* NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyTextContainerFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
 
 class nsRubyTextContainerFrame final : public nsContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsRubyTextContainerFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
@@ -43,17 +47,17 @@ class nsRubyTextContainerFrame final : p
   virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
 
   bool IsSpanContainer() const {
     return GetStateBits() & NS_RUBY_TEXT_CONTAINER_IS_SPAN;
   }
 
  protected:
   friend nsContainerFrame* NS_NewRubyTextContainerFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   explicit nsRubyTextContainerFrame(ComputedStyle* aStyle,
                                     nsPresContext* aPresContext)
       : nsContainerFrame(aStyle, aPresContext, kClassID), mISize(0) {}
 
   void UpdateSpanFlag();
 
   friend class nsRubyBaseContainerFrame;
--- a/layout/generic/nsRubyTextFrame.cpp
+++ b/layout/generic/nsRubyTextFrame.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: ruby-text" */
 
 #include "nsRubyTextFrame.h"
 
 #include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/WritingModes.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 
 using namespace mozilla;
 
 //----------------------------------------------------------------------
 
@@ -21,17 +22,17 @@ using namespace mozilla;
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyTextFrame)
   NS_QUERYFRAME_ENTRY(nsRubyTextFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsRubyContentFrame)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextFrame)
 
-nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyTextFrame(PresShell* aPresShell,
                                       ComputedStyle* aStyle) {
   return new (aPresShell) nsRubyTextFrame(aStyle, aPresShell->GetPresContext());
 }
 
 //----------------------------------------------------------------------
 
 // nsRubyTextFrame Method Implementations
 // ======================================
--- a/layout/generic/nsRubyTextFrame.h
+++ b/layout/generic/nsRubyTextFrame.h
@@ -6,21 +6,25 @@
 
 /* rendering object for CSS "display: ruby-text" */
 
 #ifndef nsRubyTextFrame_h___
 #define nsRubyTextFrame_h___
 
 #include "nsRubyContentFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Factory function.
  * @return a newly allocated nsRubyTextFrame (infallible)
  */
-nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRubyTextFrame(mozilla::PresShell* aPresShell,
                                       mozilla::ComputedStyle* aStyle);
 
 class nsRubyTextFrame final : public nsRubyContentFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsRubyTextFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
@@ -37,15 +41,15 @@ class nsRubyTextFrame final : public nsR
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
 
   bool IsAutoHidden() const {
     return GetStateBits() & NS_RUBY_TEXT_FRAME_AUTOHIDE;
   }
 
  protected:
-  friend nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewRubyTextFrame(mozilla::PresShell* aPresShell,
                                                ComputedStyle* aStyle);
   explicit nsRubyTextFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsRubyContentFrame(aStyle, aPresContext, kClassID) {}
 };
 
 #endif /* nsRubyTextFrame_h___ */
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -33,17 +33,17 @@ using namespace mozilla;
 using namespace mozilla::dom;
 
 #include "mozilla/Logging.h"
 mozilla::LazyLogModule gLayoutPrintingLog("printing-layout");
 
 #define PR_PL(_p1) MOZ_LOG(gLayoutPrintingLog, mozilla::LogLevel::Debug, _p1)
 
 nsSimplePageSequenceFrame* NS_NewSimplePageSequenceFrame(
-    nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+    PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSimplePageSequenceFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSimplePageSequenceFrame)
 
 nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(
     ComputedStyle* aStyle, nsPresContext* aPresContext)
--- a/layout/generic/nsSimplePageSequenceFrame.h
+++ b/layout/generic/nsSimplePageSequenceFrame.h
@@ -7,16 +7,19 @@
 #define nsSimplePageSequenceFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIPageSequenceFrame.h"
 #include "nsContainerFrame.h"
 #include "nsIPrintSettings.h"
 
 namespace mozilla {
+
+class PresShell;
+
 namespace dom {
 
 class HTMLCanvasElement;
 
 }  // namespace dom
 }  // namespace mozilla
 
 //-----------------------------------------------
@@ -51,17 +54,17 @@ class nsSharedPageData {
   float mShrinkToFitRatio;
 };
 
 // Simple page sequence frame class. Used when we're in paginated mode
 class nsSimplePageSequenceFrame final : public nsContainerFrame,
                                         public nsIPageSequenceFrame {
  public:
   friend nsSimplePageSequenceFrame* NS_NewSimplePageSequenceFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsSimplePageSequenceFrame)
 
   // nsIFrame
   void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
               const ReflowInput& aReflowInput,
               nsReflowStatus& aStatus) override;
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -877,18 +877,17 @@ nsresult nsSubDocumentFrame::AttributeCh
     // Notify the frameloader
     RefPtr<nsFrameLoader> frameloader = FrameLoader();
     if (frameloader) frameloader->MarginsChanged(margins.width, margins.height);
   }
 
   return NS_OK;
 }
 
-nsIFrame* NS_NewSubDocumentFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewSubDocumentFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSubDocumentFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSubDocumentFrame)
 
 class nsHideViewer : public Runnable {
  public:
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4351,17 +4351,17 @@ void nsTextFrame::DestroyFrom(nsIFrame* 
   // Let the base class destroy the frame
   nsFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 class nsContinuingTextFrame final : public nsTextFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsContinuingTextFrame)
 
-  friend nsIFrame* NS_NewContinuingTextFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewContinuingTextFrame(mozilla::PresShell* aPresShell,
                                              ComputedStyle* aStyle);
 
   void Init(nsIContent* aContent, nsContainerFrame* aParent,
             nsIFrame* aPrevInFlow) final;
 
   void DestroyFrom(nsIFrame* aDestructRoot,
                    PostDestroyData& aPostDestroyData) final;
 
@@ -4562,23 +4562,23 @@ static void VerifyNotDirty(nsFrameState 
   bool isDirty = state & NS_FRAME_IS_DIRTY;
   if (!isZero && isDirty) NS_WARNING("internal offsets may be out-of-sync");
 }
 #  define DEBUG_VERIFY_NOT_DIRTY(state) VerifyNotDirty(state)
 #else
 #  define DEBUG_VERIFY_NOT_DIRTY(state)
 #endif
 
-nsIFrame* NS_NewTextFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewTextFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTextFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTextFrame)
 
-nsIFrame* NS_NewContinuingTextFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewContinuingTextFrame(PresShell* aPresShell,
                                     ComputedStyle* aStyle) {
   return new (aPresShell)
       nsContinuingTextFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsContinuingTextFrame)
 
 nsTextFrame::~nsTextFrame() {}
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -6,16 +6,17 @@
 
 /* rendering object for the HTML <video> element */
 
 #include "nsVideoFrame.h"
 
 #include "nsCOMPtr.h"
 #include "nsGkAtoms.h"
 
+#include "mozilla/PresShell.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"
@@ -29,18 +30,17 @@
 #include "nsStyleUtil.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 
-nsIFrame* NS_NewHTMLVideoFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewHTMLVideoFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsVideoFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsVideoFrame)
 
 // A matrix to obtain a correct-rotated video frame.
 static Matrix ComputeRotationMatrix(gfxFloat aRotatedWidth,
                                     gfxFloat aRotatedHeight,
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -1455,31 +1455,31 @@ nsresult nsMathMLContainerFrame::ReportC
 nsresult nsMathMLContainerFrame::ReportInvalidChildError(nsAtom* aChildTag) {
   const char16_t* argv[] = {aChildTag->GetUTF16String(),
                             mContent->NodeInfo()->NameAtom()->GetUTF16String()};
   return ReportErrorToConsole("InvalidChild", argv, 2);
 }
 
 //==========================
 
-nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmathBlockFrame(PresShell* aPresShell,
                                              ComputedStyle* aStyle) {
   auto newFrame = new (aPresShell)
       nsMathMLmathBlockFrame(aStyle, aPresShell->GetPresContext());
   newFrame->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
   return newFrame;
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmathBlockFrame)
 
 NS_QUERYFRAME_HEAD(nsMathMLmathBlockFrame)
   NS_QUERYFRAME_ENTRY(nsMathMLmathBlockFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
 
-nsContainerFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmathInlineFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmathInlineFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmathInlineFrame)
 
 NS_QUERYFRAME_HEAD(nsMathMLmathInlineFrame)
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -10,16 +10,20 @@
 #include "mozilla/Attributes.h"
 #include "nsContainerFrame.h"
 #include "nsBlockFrame.h"
 #include "nsInlineFrame.h"
 #include "nsMathMLOperators.h"
 #include "nsMathMLFrame.h"
 #include "mozilla/Likely.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /*
  * Base class for MathML container frames. It acts like an inferred
  * mrow. By default, this frame uses its Reflow() method to lay its
  * children horizontally and ensure that their baselines are aligned.
  * The Reflow() method relies upon Place() to position children.
  * By overloading Place() in derived classes, it is therefore possible
  * to position children in various customized ways.
  */
@@ -364,18 +368,18 @@ class nsMathMLContainerFrame : public ns
 //    cleaned)
 // Issues: If/when mathml becomes a pluggable component, the separation will be
 // needed.
 class nsMathMLmathBlockFrame final : public nsBlockFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmathBlockFrame)
 
-  friend nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
-                                                      ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewMathMLmathBlockFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   // beware, mFrames is not set by nsBlockFrame
   // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set
   // mFrames
   virtual void SetInitialChildList(ChildListID aListID,
                                    nsFrameList& aChildList) override {
     MOZ_ASSERT(aListID == kPrincipalList || aListID == kBackdropList,
                "unexpected frame list");
@@ -437,18 +441,18 @@ class nsMathMLmathBlockFrame final : pub
 // --------------
 
 class nsMathMLmathInlineFrame final : public nsInlineFrame,
                                       public nsMathMLFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmathInlineFrame)
 
-  friend nsContainerFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell,
-                                                       ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewMathMLmathInlineFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   virtual void SetInitialChildList(ChildListID aListID,
                                    nsFrameList& aChildList) override {
     NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
     nsInlineFrame::SetInitialChildList(aListID, aChildList);
     // re-resolve our subtree to set any mathml-expected data
     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
   }
--- a/layout/mathml/nsMathMLParts.h
+++ b/layout/mathml/nsMathMLParts.h
@@ -7,62 +7,66 @@
 #ifndef nsMathMLParts_h___
 #define nsMathMLParts_h___
 
 #include "nscore.h"
 #include "nsISupports.h"
 
 class nsTableFrame;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 // Factory methods for creating MathML objects
-nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell,
-                                 mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell,
-                              mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell,
-                                mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell,
-                                   mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell,
-                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmsFrame(nsIPresShell* aPresShell,
-                              mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell,
-                                   mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLTokenFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmsubFrame(nsIPresShell* aPresShell,
-                                mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmsupFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmoFrame(mozilla::PresShell* aPresShell,
+                              mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmrowFrame(mozilla::PresShell* aPresShell,
                                 mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmpaddedFrame(mozilla::PresShell* aPresShell,
+                                   mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmspaceFrame(mozilla::PresShell* aPresShell,
+                                  mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmsFrame(mozilla::PresShell* aPresShell,
+                              mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmfencedFrame(mozilla::PresShell* aPresShell,
                                    mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmfracFrame(mozilla::PresShell* aPresShell,
+                                 mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmsubFrame(mozilla::PresShell* aPresShell,
+                                mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmsupFrame(mozilla::PresShell* aPresShell,
+                                mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmsubsupFrame(mozilla::PresShell* aPresShell,
+                                   mozilla::ComputedStyle* aStyle);
+nsIFrame* NS_NewMathMLmunderoverFrame(mozilla::PresShell* aPresShell,
                                       mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmmultiscriptsFrame(mozilla::PresShell* aPresShell,
                                          mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtableOuterFrame(mozilla::PresShell* aPresShell,
                                                mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtableFrame(mozilla::PresShell* aPresShell,
                                           mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtrFrame(mozilla::PresShell* aPresShell,
                                        mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtdFrame(mozilla::PresShell* aPresShell,
                                        mozilla::ComputedStyle* aStyle,
                                        nsTableFrame* aTableFrame);
-nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtdInnerFrame(mozilla::PresShell* aPresShell,
                                             mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmsqrtFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmrootFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmactionFrame(mozilla::PresShell* aPresShell,
                                    mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmencloseFrame(mozilla::PresShell* aPresShell,
                                     mozilla::ComputedStyle* aStyle);
-nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLsemanticsFrame(mozilla::PresShell* aPresShell,
                                      mozilla::ComputedStyle* aStyle);
 
-nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmathBlockFrame(mozilla::PresShell* aPresShell,
                                              mozilla::ComputedStyle* aStyle);
-nsContainerFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmathInlineFrame(mozilla::PresShell* aPresShell,
                                               mozilla::ComputedStyle* aStyle);
 #endif /* nsMathMLParts_h___ */
--- a/layout/mathml/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/nsMathMLTokenFrame.cpp
@@ -1,24 +1,25 @@
 /* -*- 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 "nsMathMLTokenFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "nsPresContext.h"
 #include "nsContentUtils.h"
 #include "nsTextFrame.h"
 #include <algorithm>
 
 using namespace mozilla;
 
-nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLTokenFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLTokenFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLTokenFrame)
 
 nsMathMLTokenFrame::~nsMathMLTokenFrame() {}
 
--- a/layout/mathml/nsMathMLTokenFrame.h
+++ b/layout/mathml/nsMathMLTokenFrame.h
@@ -5,25 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLTokenFrame_h___
 #define nsMathMLTokenFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // Base class to handle token elements
 //
 
 class nsMathMLTokenFrame : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLTokenFrame)
 
-  friend nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLTokenFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   NS_IMETHOD
   TransmitAutomaticData() override {
     // The REC defines the following elements to be space-like:
     // * an mtext, mspace, maligngroup, or malignmark element;
     if (mContent->IsMathMLElement(nsGkAtoms::mtext_)) {
       mPresentationData.flags |= NS_MATHML_SPACE_LIKE;
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -57,17 +57,17 @@ static int32_t GetActionType(nsIContent*
   if (value.EqualsLiteral("toggle")) return NS_MATHML_ACTION_TYPE_TOGGLE;
   if (value.EqualsLiteral("statusline"))
     return NS_MATHML_ACTION_TYPE_STATUSLINE;
   if (value.EqualsLiteral("tooltip")) return NS_MATHML_ACTION_TYPE_TOOLTIP;
 
   return NS_MATHML_ACTION_TYPE_UNKNOWN;
 }
 
-nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmactionFrame(PresShell* aPresShell,
                                    ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmactionFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmactionFrame)
 
 nsMathMLmactionFrame::~nsMathMLmactionFrame() {
--- a/layout/mathml/nsMathMLmactionFrame.h
+++ b/layout/mathml/nsMathMLmactionFrame.h
@@ -7,25 +7,29 @@
 #ifndef nsMathMLmactionFrame_h___
 #define nsMathMLmactionFrame_h___
 
 #include "nsCOMPtr.h"
 #include "nsMathMLSelectedFrame.h"
 #include "nsIDOMEventListener.h"
 #include "mozilla/Attributes.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <maction> -- bind actions to a subexpression
 //
 
 class nsMathMLmactionFrame final : public nsMathMLSelectedFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmactionFrame)
 
-  friend nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmactionFrame(mozilla::PresShell* aPresShell,
                                             ComputedStyle* aStyle);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
   virtual void SetInitialChildList(ChildListID aListID,
                                    nsFrameList& aChildList) override;
 
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMathMLmencloseFrame.h"
 
 #include "gfx2DGlue.h"
 #include "gfxUtils.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/PathHelpers.h"
 #include "nsPresContext.h"
 #include "nsWhitespaceTokenizer.h"
 
 #include "nsDisplayList.h"
 #include "gfxContext.h"
 #include "nsMathMLChar.h"
@@ -34,17 +35,17 @@ static const char16_t kLongDivChar = ')'
 static const char16_t kRadicalChar = 0x221A;
 
 // updiagonalstrike
 static const uint8_t kArrowHeadSize = 10;
 
 // phasorangle
 static const uint8_t kPhasorangleWidth = 8;
 
-nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmencloseFrame(PresShell* aPresShell,
                                     ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmencloseFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmencloseFrame)
 
 nsMathMLmencloseFrame::nsMathMLmencloseFrame(ComputedStyle* aStyle,
--- a/layout/mathml/nsMathMLmencloseFrame.h
+++ b/layout/mathml/nsMathMLmencloseFrame.h
@@ -6,16 +6,20 @@
 
 #ifndef nsMathMLmencloseFrame_h___
 #define nsMathMLmencloseFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EnumSet.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <menclose> -- enclose content with a stretching symbol such
 // as a long division sign.
 //
 
 /*
   The MathML REC describes:
 
@@ -41,17 +45,17 @@ enum nsMencloseNotation {
   NOTATION_UPDIAGONALARROW,
   NOTATION_PHASORANGLE
 };
 
 class nsMathMLmencloseFrame : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmencloseFrame)
 
-  friend nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmencloseFrame(mozilla::PresShell* aPresShell,
                                              ComputedStyle* aStyle);
 
   virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
                          ReflowOutput& aDesiredSize) override;
 
   virtual nsresult MeasureForWidth(DrawTarget* aDrawTarget,
                                    ReflowOutput& aDesiredSize) override;
 
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -1,28 +1,29 @@
 /* -*- 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 "gfxContext.h"
+#include "mozilla/PresShell.h"
 #include "nsMathMLmfencedFrame.h"
 #include "nsMathMLChar.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 using mozilla::gfx::DrawTarget;
 
 //
 // <mfenced> -- surround content with a pair of fences
 //
 
-nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmfencedFrame(PresShell* aPresShell,
                                    ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmfencedFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmfencedFrame)
 
 void nsMathMLmfencedFrame::DestroyFrom(nsIFrame* aDestructRoot,
--- a/layout/mathml/nsMathMLmfencedFrame.h
+++ b/layout/mathml/nsMathMLmfencedFrame.h
@@ -7,25 +7,29 @@
 #ifndef nsMathMLmfencedFrame_h
 #define nsMathMLmfencedFrame_h
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
 class nsFontMetrics;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mfenced> -- surround content with a pair of fences
 //
 
 class nsMathMLmfencedFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmfencedFrame)
 
-  friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmfencedFrame(mozilla::PresShell* aPresShell,
                                             ComputedStyle* aStyle);
 
   void DestroyFrom(nsIFrame* aDestructRoot,
                    PostDestroyData& aPostDestroyData) override;
 
   virtual void SetAdditionalComputedStyle(
       int32_t aIndex, ComputedStyle* aComputedStyle) override;
   virtual ComputedStyle* GetAdditionalComputedStyle(
--- a/layout/mathml/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMathMLmfracFrame.h"
 
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/RefPtr.h"
 #include "nsLayoutUtils.h"
 #include "nsPresContext.h"
 #include "nsDisplayList.h"
 #include "gfxContext.h"
 #include "nsMathMLElement.h"
 #include <algorithm>
 #include "gfxMathTable.h"
@@ -28,18 +29,17 @@ using namespace mozilla::gfx;
 // thickness)
 
 #define THIN_FRACTION_LINE 0.5f
 #define THIN_FRACTION_LINE_MINIMUM_PIXELS 1  // minimum of 1 pixel
 
 #define THICK_FRACTION_LINE 2.0f
 #define THICK_FRACTION_LINE_MINIMUM_PIXELS 2  // minimum of 2 pixels
 
-nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLmfracFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmfracFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmfracFrame)
 
 nsMathMLmfracFrame::~nsMathMLmfracFrame() {}
 
--- a/layout/mathml/nsMathMLmfracFrame.h
+++ b/layout/mathml/nsMathMLmfracFrame.h
@@ -5,16 +5,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmfracFrame_h___
 #define nsMathMLmfracFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mfrac> -- form a fraction from two subexpressions
 //
 
 /*
 The MathML REC describes:
 
 The <mfrac> element is used for fractions. It can also be used to mark up
@@ -49,17 +53,17 @@ These attributes are inherited by every 
 environment, but can be set explicitly only on the <mstyle>
 element.
 */
 
 class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmfracFrame)
 
-  friend nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmfracFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   virtual eMathMLFrameType GetMathMLFrameType() override;
 
   virtual nsresult MeasureForWidth(DrawTarget* aDrawTarget,
                                    ReflowOutput& aDesiredSize) override;
 
   virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
--- a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp
+++ b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp
@@ -1,30 +1,32 @@
 /* -*- 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 "nsMathMLmmultiscriptsFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "nsPresContext.h"
 #include <algorithm>
 #include "gfxContext.h"
 #include "gfxMathTable.h"
 
 using namespace mozilla;
 
 //
 // <mmultiscripts> -- attach prescripts and tensor indices to a base -
 // implementation <msub> -- attach a subscript to a base - implementation
 // <msubsup> -- attach a subscript-superscript pair to a base - implementation
 // <msup> -- attach a superscript to a base - implementation
 //
 
-nsIFrame* NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmmultiscriptsFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmmultiscriptsFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmmultiscriptsFrame)
 
 nsMathMLmmultiscriptsFrame::~nsMathMLmmultiscriptsFrame() {}
--- a/layout/mathml/nsMathMLmmultiscriptsFrame.h
+++ b/layout/mathml/nsMathMLmmultiscriptsFrame.h
@@ -5,29 +5,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmmultiscriptsFrame_h___
 #define nsMathMLmmultiscriptsFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mmultiscripts> -- attach prescripts and tensor indices to a base
 // <msub> -- attach a subscript to a base
 // <msubsup> -- attach a subscript-superscript pair to a base
 // <msup> -- attach a superscript to a base
 //
 
 class nsMathMLmmultiscriptsFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmmultiscriptsFrame)
 
-  friend nsIFrame* NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell,
-                                                  ComputedStyle* aStyle);
+  friend nsIFrame* NS_NewMathMLmmultiscriptsFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_IMETHOD
   TransmitAutomaticData() override;
 
   virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
                          ReflowOutput& aDesiredSize) override;
 
   static nsresult PlaceMultiScript(nsPresContext* aPresContext,
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -1,32 +1,33 @@
 /* -*- 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 "gfxContext.h"
+#include "mozilla/PresShell.h"
 #include "nsMathMLmoFrame.h"
 #include "nsPresContext.h"
 #include "nsContentUtils.h"
 #include "nsFrameSelection.h"
 #include "nsMathMLElement.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 //
 // <mo> -- operator, fence, or separator - implementation
 //
 
 // additional ComputedStyle to be used by our MathMLChar.
 #define NS_MATHML_CHAR_STYLE_CONTEXT_INDEX 0
 
-nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLmoFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsMathMLmoFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmoFrame)
 
 nsMathMLmoFrame::~nsMathMLmoFrame() {}
 
 static const char16_t kApplyFunction = char16_t(0x2061);
--- a/layout/mathml/nsMathMLmoFrame.h
+++ b/layout/mathml/nsMathMLmoFrame.h
@@ -6,25 +6,29 @@
 
 #ifndef nsMathMLmoFrame_h___
 #define nsMathMLmoFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLTokenFrame.h"
 #include "nsMathMLChar.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mo> -- operator, fence, or separator
 //
 
 class nsMathMLmoFrame final : public nsMathMLTokenFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmoFrame)
 
-  friend nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmoFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
   virtual eMathMLFrameType GetMathMLFrameType() override;
 
   virtual void SetAdditionalComputedStyle(
       int32_t aIndex, ComputedStyle* aComputedStyle) override;
   virtual ComputedStyle* GetAdditionalComputedStyle(
       int32_t aIndex) const override;
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -2,16 +2,17 @@
 /* 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 "nsMathMLmpaddedFrame.h"
 #include "nsMathMLElement.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/TextUtils.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 //
 // <mpadded> -- adjust space around content - implementation
 //
@@ -23,17 +24,17 @@ using namespace mozilla;
 
 #define NS_MATHML_PSEUDO_UNIT_UNSPECIFIED 0
 #define NS_MATHML_PSEUDO_UNIT_ITSELF 1  // special
 #define NS_MATHML_PSEUDO_UNIT_WIDTH 2
 #define NS_MATHML_PSEUDO_UNIT_HEIGHT 3
 #define NS_MATHML_PSEUDO_UNIT_DEPTH 4
 #define NS_MATHML_PSEUDO_UNIT_NAMEDSPACE 5
 
-nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmpaddedFrame(PresShell* aPresShell,
                                    ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmpaddedFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
 
 nsMathMLmpaddedFrame::~nsMathMLmpaddedFrame() {}
--- a/layout/mathml/nsMathMLmpaddedFrame.h
+++ b/layout/mathml/nsMathMLmpaddedFrame.h
@@ -5,25 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmpaddedFrame_h___
 #define nsMathMLmpaddedFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mpadded> -- adjust space around content
 //
 
 class nsMathMLmpaddedFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
 
-  friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmpaddedFrame(mozilla::PresShell* aPresShell,
                                             ComputedStyle* aStyle);
 
   NS_IMETHOD
   InheritAutomaticData(nsIFrame* aParent) override;
 
   NS_IMETHOD
   TransmitAutomaticData() override {
     return TransmitAutomaticDataForMrowLikeElement();
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -1,33 +1,34 @@
 /* -*- 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 "nsMathMLmrootFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "nsPresContext.h"
 #include <algorithm>
 #include "gfxContext.h"
 #include "gfxMathTable.h"
 
 using namespace mozilla;
 
 //
 // <mroot> -- form a radical - implementation
 //
 
 // additional ComputedStyle to be used by our MathMLChar.
 #define NS_SQR_CHAR_STYLE_CONTEXT_INDEX 0
 
 static const char16_t kSqrChar = char16_t(0x221A);
 
-nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLmrootFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmrootFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrootFrame)
 
 nsMathMLmrootFrame::nsMathMLmrootFrame(ComputedStyle* aStyle,
                                        nsPresContext* aPresContext)
--- a/layout/mathml/nsMathMLmrootFrame.h
+++ b/layout/mathml/nsMathMLmrootFrame.h
@@ -6,25 +6,29 @@
 
 #ifndef nsMathMLmrootFrame_h___
 #define nsMathMLmrootFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 #include "nsMathMLChar.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <msqrt> and <mroot> -- form a radical
 //
 
 class nsMathMLmrootFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmrootFrame)
 
-  friend nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmrootFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   virtual void SetAdditionalComputedStyle(
       int32_t aIndex, ComputedStyle* aComputedStyle) override;
   virtual ComputedStyle* GetAdditionalComputedStyle(
       int32_t aIndex) const override;
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
--- a/layout/mathml/nsMathMLmrowFrame.cpp
+++ b/layout/mathml/nsMathMLmrowFrame.cpp
@@ -1,25 +1,26 @@
 /* -*- 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 "nsMathMLmrowFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 
 using namespace mozilla;
 
 //
 // <mrow> -- horizontally group any number of subexpressions - implementation
 //
 
-nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLmrowFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmrowFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame)
 
 nsMathMLmrowFrame::~nsMathMLmrowFrame() {}
 
--- a/layout/mathml/nsMathMLmrowFrame.h
+++ b/layout/mathml/nsMathMLmrowFrame.h
@@ -5,27 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmrowFrame_h___
 #define nsMathMLmrowFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mrow> -- horizontally group any number of subexpressions
 // <mphantom> -- make content invisible but preserve its size
 // <mstyle> -- make style changes that affect the rendering of its contents
 //
 
 class nsMathMLmrowFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmrowFrame)
 
-  friend nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmrowFrame(mozilla::PresShell* aPresShell,
                                          ComputedStyle* aStyle);
 
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
   NS_IMETHOD
   InheritAutomaticData(nsIFrame* aParent) override;
 
--- a/layout/mathml/nsMathMLmspaceFrame.cpp
+++ b/layout/mathml/nsMathMLmspaceFrame.cpp
@@ -1,26 +1,27 @@
 /* -*- 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 "nsMathMLmspaceFrame.h"
 #include "nsMathMLElement.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 //
 // <mspace> -- space - implementation
 //
 
-nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmspaceFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmspaceFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmspaceFrame)
 
 nsMathMLmspaceFrame::~nsMathMLmspaceFrame() {}
--- a/layout/mathml/nsMathMLmspaceFrame.h
+++ b/layout/mathml/nsMathMLmspaceFrame.h
@@ -5,25 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmspaceFrame_h___
 #define nsMathMLmspaceFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mspace> -- space
 //
 
 class nsMathMLmspaceFrame final : public nsMathMLContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmspaceFrame)
 
-  friend nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmspaceFrame(mozilla::PresShell* aPresShell,
                                            ComputedStyle* aStyle);
 
   NS_IMETHOD
   TransmitAutomaticData() override {
     // The REC defines the following elements to be space-like:
     // * an mtext, mspace, maligngroup, or malignmark element;
     mPresentationData.flags |= NS_MATHML_SPACE_LIKE;
     return NS_OK;
--- a/layout/mathml/nsMathMLmsqrtFrame.cpp
+++ b/layout/mathml/nsMathMLmsqrtFrame.cpp
@@ -1,25 +1,26 @@
 /* -*- 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 "nsMathMLmsqrtFrame.h"
+
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 
 //
 // <msqrt> -- form a radical - implementation
 //
 
 using namespace mozilla;
 
-nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewMathMLmsqrtFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmsqrtFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
 
 nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(ComputedStyle* aStyle,
                                        nsPresContext* aPresContext)
--- a/layout/mathml/nsMathMLmsqrtFrame.h
+++ b/layout/mathml/nsMathMLmsqrtFrame.h
@@ -5,16 +5,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmsqrtFrame_h___
 #define nsMathMLmsqrtFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLmencloseFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <msqrt> -- form a radical
 //
 
 /*
 The MathML REC describes:
 
 The <msqrt> element is used to display square roots.
@@ -32,17 +36,17 @@ The <mroot> element increments scriptlev
 These attributes are inherited by every element from its rendering environment,
 but can be set explicitly only on <mstyle>. (See Section 3.3.4.)
 */
 
 class nsMathMLmsqrtFrame final : public nsMathMLmencloseFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
 
-  friend nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmsqrtFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
   NS_IMETHOD
   InheritAutomaticData(nsIFrame* aParent) override;
 
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -648,17 +648,17 @@ static void ListMathMLTree(nsIFrame* atL
 
 // --------
 // implementation of nsMathMLmtableWrapperFrame
 
 NS_QUERYFRAME_HEAD(nsMathMLmtableWrapperFrame)
   NS_QUERYFRAME_ENTRY(nsIMathMLFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsTableWrapperFrame)
 
-nsContainerFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtableOuterFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmtableWrapperFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableWrapperFrame)
 
 nsMathMLmtableWrapperFrame::~nsMathMLmtableWrapperFrame() {}
@@ -873,17 +873,17 @@ void nsMathMLmtableWrapperFrame::Reflow(
   mBoundingMetrics.width = aDesiredSize.Width();
   mBoundingMetrics.leftBearing = 0;
   mBoundingMetrics.rightBearing = aDesiredSize.Width();
 
   aDesiredSize.mBoundingMetrics = mBoundingMetrics;
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
 }
 
-nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtableFrame(PresShell* aPresShell,
                                           ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmtableFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableFrame)
 
 nsMathMLmtableFrame::~nsMathMLmtableFrame() {}
@@ -1028,17 +1028,17 @@ void nsMathMLmtableFrame::SetUseCSSSpaci
 
 NS_QUERYFRAME_HEAD(nsMathMLmtableFrame)
   NS_QUERYFRAME_ENTRY(nsMathMLmtableFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsTableFrame)
 
 // --------
 // implementation of nsMathMLmtrFrame
 
-nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtrFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmtrFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtrFrame)
 
 nsMathMLmtrFrame::~nsMathMLmtrFrame() {}
@@ -1070,17 +1070,17 @@ nsresult nsMathMLmtrFrame::AttributeChan
                                              NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 // --------
 // implementation of nsMathMLmtdFrame
 
-nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtdFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle,
                                        nsTableFrame* aTableFrame) {
   return new (aPresShell) nsMathMLmtdFrame(aStyle, aTableFrame);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtdFrame)
 
 nsMathMLmtdFrame::~nsMathMLmtdFrame() {}
@@ -1166,17 +1166,17 @@ nsMargin nsMathMLmtdFrame::GetBorderOver
 
 // --------
 // implementation of nsMathMLmtdInnerFrame
 
 NS_QUERYFRAME_HEAD(nsMathMLmtdInnerFrame)
   NS_QUERYFRAME_ENTRY(nsIMathMLFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
 
-nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewMathMLmtdInnerFrame(PresShell* aPresShell,
                                             ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmtdInnerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtdInnerFrame)
 
 nsMathMLmtdInnerFrame::nsMathMLmtdInnerFrame(ComputedStyle* aStyle,
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -10,25 +10,29 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/UniquePtr.h"
 #include "nsMathMLContainerFrame.h"
 #include "nsBlockFrame.h"
 #include "nsTableWrapperFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableCellFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <mtable> -- table or matrix
 //
 
 class nsMathMLmtableWrapperFrame final : public nsTableWrapperFrame,
                                          public nsMathMLFrame {
  public:
   friend nsContainerFrame* NS_NewMathMLmtableOuterFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtableWrapperFrame)
 
   // overloaded nsTableWrapperFrame methods
 
   virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
@@ -56,18 +60,18 @@ class nsMathMLmtableWrapperFrame final :
 
 // --------------
 
 class nsMathMLmtableFrame final : public nsTableFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtableFrame)
 
-  friend nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
-                                                   ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewMathMLmtableFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   // Overloaded nsTableFrame methods
 
   virtual void SetInitialChildList(ChildListID aListID,
                                    nsFrameList& aChildList) override;
 
   virtual void AppendFrames(ChildListID aListID,
                             nsFrameList& aFrameList) override {
@@ -151,17 +155,17 @@ class nsMathMLmtableFrame final : public
 };  // class nsMathMLmtableFrame
 
 // --------------
 
 class nsMathMLmtrFrame final : public nsTableRowFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtrFrame)
 
-  friend nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewMathMLmtrFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
   // overloaded nsTableRowFrame methods
 
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
   virtual void AppendFrames(ChildListID aListID,
@@ -202,17 +206,17 @@ class nsMathMLmtrFrame final : public ns
 };  // class nsMathMLmtrFrame
 
 // --------------
 
 class nsMathMLmtdFrame final : public nsTableCellFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtdFrame)
 
-  friend nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewMathMLmtdFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle,
                                                 nsTableFrame* aTableFrame);
 
   // overloaded nsTableCellFrame methods
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
@@ -238,18 +242,18 @@ class nsMathMLmtdFrame final : public ns
 
   virtual ~nsMathMLmtdFrame();
 };  // class nsMathMLmtdFrame
 
 // --------------
 
 class nsMathMLmtdInnerFrame final : public nsBlockFrame, public nsMathMLFrame {
  public:
-  friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell,
-                                                     ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmtdInnerFrame)
 
   // Overloaded nsIMathMLFrame methods
 
   NS_IMETHOD
   UpdatePresentationDataFromChildAt(int32_t aFirstIndex, int32_t aLastIndex,
--- a/layout/mathml/nsMathMLmunderoverFrame.cpp
+++ b/layout/mathml/nsMathMLmunderoverFrame.cpp
@@ -18,17 +18,17 @@ using namespace mozilla;
 
 //
 // <munderover> -- attach an underscript-overscript pair to a base
 //                 implementation
 // <mover> -- attach an overscript to a base - implementation
 // <munder> -- attach an underscript to a base - implementation
 //
 
-nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLmunderoverFrame(PresShell* aPresShell,
                                       ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLmunderoverFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmunderoverFrame)
 
 nsMathMLmunderoverFrame::~nsMathMLmunderoverFrame() {}
--- a/layout/mathml/nsMathMLmunderoverFrame.h
+++ b/layout/mathml/nsMathMLmunderoverFrame.h
@@ -6,26 +6,30 @@
 
 #ifndef nsMathMLmunderoverFrame_h___
 #define nsMathMLmunderoverFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIReflowCallback.h"
 #include "nsMathMLContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <munderover> -- attach an underscript-overscript pair to a base
 //
 
 class nsMathMLmunderoverFrame final : public nsMathMLContainerFrame,
                                       public nsIReflowCallback {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmunderoverFrame)
 
-  friend nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLmunderoverFrame(mozilla::PresShell* aPresShell,
                                                ComputedStyle* aStyle);
 
   nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
                  ReflowOutput& aDesiredSize) override;
 
   NS_IMETHOD InheritAutomaticData(nsIFrame* aParent) override;
 
   NS_IMETHOD TransmitAutomaticData() override;
--- a/layout/mathml/nsMathMLsemanticsFrame.cpp
+++ b/layout/mathml/nsMathMLsemanticsFrame.cpp
@@ -1,25 +1,27 @@
 /* -*- 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 "nsMathMLsemanticsFrame.h"
+
 #include "nsMimeTypes.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 
 using namespace mozilla;
 
 //
 // <semantics> -- associate annotations with a MathML expression
 //
 
-nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMathMLsemanticsFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMathMLsemanticsFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLsemanticsFrame)
 
 nsMathMLsemanticsFrame::~nsMathMLsemanticsFrame() {}
--- a/layout/mathml/nsMathMLsemanticsFrame.h
+++ b/layout/mathml/nsMathMLsemanticsFrame.h
@@ -5,25 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLsemanticsFrame_h___
 #define nsMathMLsemanticsFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLSelectedFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 //
 // <semantics> -- associate annotations with a MathML expression
 //
 
 class nsMathMLsemanticsFrame final : public nsMathMLSelectedFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsMathMLsemanticsFrame)
 
-  friend nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewMathMLsemanticsFrame(mozilla::PresShell* aPresShell,
                                               ComputedStyle* aStyle);
 
  protected:
   explicit nsMathMLsemanticsFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext)
       : nsMathMLSelectedFrame(aStyle, aPresContext, kClassID) {}
   virtual ~nsMathMLsemanticsFrame();
 
--- a/layout/svg/SVGFEContainerFrame.cpp
+++ b/layout/svg/SVGFEContainerFrame.cpp
@@ -1,30 +1,31 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
+#include "mozilla/PresShell.h"
 #include "nsContainerFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIFrame.h"
 #include "nsLiteralString.h"
 #include "SVGObserverUtils.h"
 #include "SVGFilters.h"
 
 using namespace mozilla;
 
 /*
  * This frame is used by filter primitive elements that
  * have special child elements that provide parameters.
  */
 class SVGFEContainerFrame final : public nsContainerFrame {
-  friend nsIFrame* NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGFEContainerFrame(mozilla::PresShell* aPresShell,
                                              ComputedStyle* aStyle);
 
  protected:
   explicit SVGFEContainerFrame(ComputedStyle* aStyle,
                                nsPresContext* aPresContext)
       : nsContainerFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
   }
@@ -56,17 +57,17 @@ class SVGFEContainerFrame final : public
                                     int32_t aModType) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
     // We don't maintain a visual overflow rect
     return false;
   }
 };
 
-nsIFrame* NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGFEContainerFrame(PresShell* aPresShell,
                                     ComputedStyle* aStyle) {
   return new (aPresShell)
       SVGFEContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
 
 #ifdef DEBUG
--- a/layout/svg/SVGFEImageFrame.cpp
+++ b/layout/svg/SVGFEImageFrame.cpp
@@ -1,29 +1,30 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/SVGFEImageElement.h"
+#include "mozilla/dom/MutationEventBinding.h"
 #include "nsContainerFrame.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 #include "nsLiteralString.h"
 #include "SVGObserverUtils.h"
 #include "SVGFilters.h"
-#include "mozilla/dom/SVGFEImageElement.h"
-#include "mozilla/dom/MutationEventBinding.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 class SVGFEImageFrame final : public nsFrame {
-  friend nsIFrame* NS_NewSVGFEImageFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGFEImageFrame(mozilla::PresShell* aPresShell,
                                          ComputedStyle* aStyle);
 
  protected:
   explicit SVGFEImageFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
 
     // This frame isn't actually displayed, but it contains an image and we want
@@ -63,18 +64,17 @@ class SVGFEImageFrame final : public nsF
       const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
     // We don't maintain a visual overflow rect
     return false;
   }
 };
 
-nsIFrame* NS_NewSVGFEImageFrame(nsIPresShell* aPresShell,
-                                ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGFEImageFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) SVGFEImageFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGFEImageFrame)
 
 /* virtual */
 void SVGFEImageFrame::DestroyFrom(nsIFrame* aDestructRoot,
                                   PostDestroyData& aPostDestroyData) {
--- a/layout/svg/SVGFELeafFrame.cpp
+++ b/layout/svg/SVGFELeafFrame.cpp
@@ -1,30 +1,31 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
 #include "ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "nsContainerFrame.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 #include "SVGObserverUtils.h"
 #include "SVGFilters.h"
 
 using namespace mozilla;
 
 /*
  * This frame is used by filter primitive elements that don't
  * have special child elements that provide parameters.
  */
 class SVGFELeafFrame final : public nsFrame {
-  friend nsIFrame* NS_NewSVGFELeafFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGFELeafFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
  protected:
   explicit SVGFELeafFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
   }
 
@@ -54,18 +55,17 @@ class SVGFELeafFrame final : public nsFr
                                     int32_t aModType) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
     // We don't maintain a visual overflow rect
     return false;
   }
 };
 
-nsIFrame* NS_NewSVGFELeafFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGFELeafFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) SVGFELeafFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
 
 #ifdef DEBUG
 void SVGFELeafFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                           nsIFrame* aPrevInFlow) {
--- a/layout/svg/SVGFEUnstyledLeafFrame.cpp
+++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp
@@ -1,25 +1,26 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
+#include "mozilla/PresShell.h"
 #include "nsContainerFrame.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 #include "SVGObserverUtils.h"
 #include "SVGFilters.h"
 
 using namespace mozilla;
 
 class SVGFEUnstyledLeafFrame final : public nsFrame {
-  friend nsIFrame* NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
  protected:
   explicit SVGFEUnstyledLeafFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext)
       : nsFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
   }
@@ -48,17 +49,17 @@ class SVGFEUnstyledLeafFrame final : pub
                                     int32_t aModType) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
     // We don't maintain a visual overflow rect
     return false;
   }
 };
 
-nsIFrame* NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGFEUnstyledLeafFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       SVGFEUnstyledLeafFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
 
 nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -9,16 +9,17 @@
 
 // Keep others in (case-insensitive) order:
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Helpers.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/SVGContextPaint.h"
 #include "nsDisplayList.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "SVGObserverUtils.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGMarkerFrame.h"
@@ -32,18 +33,17 @@
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGGeometryFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       SVGGeometryFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGGeometryFrame)
 
 //----------------------------------------------------------------------
 // nsQueryFrame methods
--- a/layout/svg/SVGGeometryFrame.h
+++ b/layout/svg/SVGGeometryFrame.h
@@ -23,30 +23,33 @@ namespace gfx {
 class DrawTarget;
 }  // namespace gfx
 }  // namespace mozilla
 
 class gfxContext;
 class nsDisplaySVGGeometry;
 class nsAtom;
 class nsIFrame;
-class nsIPresShell;
 class nsSVGMarkerFrame;
 
 struct nsRect;
 
-nsIFrame* NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
                                  mozilla::ComputedStyle* aStyle);
 
 namespace mozilla {
 
 class SVGGeometryFrame : public nsFrame, public nsSVGDisplayableFrame {
   typedef mozilla::gfx::DrawTarget DrawTarget;
 
-  friend nsIFrame* ::NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* ::NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
                                             ComputedStyle* aStyle);
 
   friend class ::nsDisplaySVGGeometry;
 
  protected:
   SVGGeometryFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                    nsIFrame::ClassID aID = kClassID)
       : nsFrame(aStyle, aPresContext, aID) {
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -2887,17 +2887,17 @@ void nsDisplaySVGText::Paint(nsDisplayLi
 
 NS_QUERYFRAME_HEAD(SVGTextFrame)
   NS_QUERYFRAME_ENTRY(SVGTextFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
 
 // ---------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGTextFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGTextFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) SVGTextFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGTextFrame)
 
 // ---------------------------------------------------------------------
 // nsIFrame methods
 
--- a/layout/svg/SVGTextFrame.h
+++ b/layout/svg/SVGTextFrame.h
@@ -22,16 +22,17 @@ class gfxContext;
 class nsDisplaySVGText;
 class SVGTextFrame;
 class nsTextFrame;
 
 namespace mozilla {
 
 class CharIterator;
 class nsISVGPoint;
+class PresShell;
 class TextFrameIterator;
 class TextNodeCorrespondenceRecorder;
 struct TextRenderedRun;
 class TextRenderedRunIterator;
 
 namespace dom {
 class SVGIRect;
 class SVGGeometryElement;
@@ -153,17 +154,17 @@ class GlyphMetricsUpdater : public Runna
  * returns a TextRenderedRun for each bit of text to be painted separately.
  *
  * Each rendered run is painted by calling nsTextFrame::PaintText.  If the text
  * formatting is simple enough (solid fill, no stroking, etc.), PaintText will
  * itself do the painting.  Otherwise, a DrawPathCallback is passed to
  * PaintText so that we can fill the text geometry with SVG paint servers.
  */
 class SVGTextFrame final : public nsSVGDisplayContainerFrame {
-  friend nsIFrame* NS_NewSVGTextFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGTextFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
   friend class mozilla::CharIterator;
   friend class mozilla::GlyphMetricsUpdater;
   friend class mozilla::TextFrameIterator;
   friend class mozilla::TextNodeCorrespondenceRecorder;
   friend struct mozilla::TextRenderedRun;
   friend class mozilla::TextRenderedRunIterator;
--- a/layout/svg/SVGViewFrame.cpp
+++ b/layout/svg/SVGViewFrame.cpp
@@ -1,32 +1,33 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/SVGSVGElement.h"
+#include "mozilla/dom/SVGViewElement.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 #include "nsSVGOuterSVGFrame.h"
-#include "mozilla/dom/SVGSVGElement.h"
-#include "mozilla/dom/SVGViewElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /**
  * While views are not directly rendered in SVG they can be linked to
  * and thereby override attributes of an <svg> element via a fragment
  * identifier. The SVGViewFrame class passes on any attribute changes
  * the view receives to the overridden <svg> element (if there is one).
  **/
 class SVGViewFrame final : public nsFrame {
-  friend nsIFrame* NS_NewSVGViewFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGViewFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
  protected:
   explicit SVGViewFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_IS_NONDISPLAY);
   }
 
@@ -56,17 +57,17 @@ class SVGViewFrame final : public nsFram
                                     int32_t aModType) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
     // We don't maintain a visual overflow rect
     return false;
   }
 };
 
-nsIFrame* NS_NewSVGViewFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGViewFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) SVGViewFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(SVGViewFrame)
 
 #ifdef DEBUG
 void SVGViewFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                         nsIFrame* aPrevInFlow) {
--- a/layout/svg/nsSVGAFrame.cpp
+++ b/layout/svg/nsSVGAFrame.cpp
@@ -1,28 +1,29 @@
 /* -*- 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/. */
 
 // Keep in (case-insensitive) order:
 #include "gfxMatrix.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/SVGAElement.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "nsAutoPtr.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGUtils.h"
 #include "SVGLengthList.h"
 
 using namespace mozilla;
 
 class nsSVGAFrame final : public nsSVGDisplayContainerFrame {
-  friend nsIFrame* NS_NewSVGAFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
                                    ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGAFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGAFrame)
@@ -41,17 +42,17 @@ class nsSVGAFrame final : public nsSVGDi
     return MakeFrameName(NS_LITERAL_STRING("SVGA"), aResult);
   }
 #endif
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGAFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGAFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGAFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGAFrame)
 
 //----------------------------------------------------------------------
 // nsIFrame methods
 #ifdef DEBUG
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -6,33 +6,33 @@
 
 // Main header first:
 #include "nsSVGClipPathFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "AutoReferenceChainGuard.h"
 #include "ImgDrawResult.h"
 #include "gfxContext.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/SVGClipPathElement.h"
 #include "nsGkAtoms.h"
 #include "SVGObserverUtils.h"
 #include "SVGGeometryElement.h"
 #include "SVGGeometryFrame.h"
 #include "nsSVGUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGClipPathFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGClipPathFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGClipPathFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGClipPathFrame)
 
 void nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
                                        nsIFrame* aClippedFrame,
--- a/layout/svg/nsSVGClipPathFrame.h
+++ b/layout/svg/nsSVGClipPathFrame.h
@@ -10,18 +10,22 @@
 #include "gfxMatrix.h"
 #include "mozilla/Attributes.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 class nsSVGDisplayableFrame;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGClipPathFrame final : public nsSVGContainerFrame {
-  friend nsIFrame* NS_NewSVGClipPathFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGClipPathFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
   typedef mozilla::gfx::Matrix Matrix;
   typedef mozilla::gfx::SourceSurface SourceSurface;
   typedef mozilla::image::imgDrawingParams imgDrawingParams;
 
  protected:
   explicit nsSVGClipPathFrame(ComputedStyle* aStyle,
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Main header first:
 #include "nsSVGContainerFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "ImgDrawResult.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/RestyleManager.h"
 #include "nsCSSFrameConstructor.h"
 #include "SVGObserverUtils.h"
 #include "SVGElement.h"
 #include "nsSVGUtils.h"
 #include "SVGAnimatedTransformList.h"
 #include "SVGTextFrame.h"
 
@@ -24,17 +25,17 @@ NS_QUERYFRAME_HEAD(nsSVGContainerFrame)
   NS_QUERYFRAME_ENTRY(nsSVGContainerFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 NS_QUERYFRAME_HEAD(nsSVGDisplayContainerFrame)
   NS_QUERYFRAME_ENTRY(nsSVGDisplayContainerFrame)
   NS_QUERYFRAME_ENTRY(nsSVGDisplayableFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrame)
 
-nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGContainerFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   nsIFrame* frame = new (aPresShell) nsSVGContainerFrame(
       aStyle, aPresShell->GetPresContext(), nsSVGContainerFrame::kClassID);
   // If we were called directly, then the frame is for a <defs> or
   // an unknown element type. In both cases we prevent the content
   // from displaying directly.
   frame->AddStateBits(NS_FRAME_IS_NONDISPLAY);
   return frame;
--- a/layout/svg/nsSVGContainerFrame.h
+++ b/layout/svg/nsSVGContainerFrame.h
@@ -14,34 +14,37 @@
 #include "nsSVGDisplayableFrame.h"
 #include "nsQueryFrame.h"
 #include "nsRect.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 class nsFrameList;
 class nsIContent;
-class nsIPresShell;
 
 struct nsRect;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Base class for SVG container frames. Frame sub-classes that do not
  * display their contents directly (such as the frames for <marker> or
  * <pattern>) just inherit this class. Frame sub-classes that do or can
  * display their contents directly (such as the frames for inner-<svg> or
  * <g>) inherit our nsDisplayContainerFrame sub-class.
  *
  *                               *** WARNING ***
  *
  * Do *not* blindly cast to SVG element types in this class's methods (see the
  * warning comment for nsSVGDisplayContainerFrame below).
  */
 class nsSVGContainerFrame : public nsContainerFrame {
-  friend nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGContainerFrame(mozilla::PresShell* aPresShell,
                                            ComputedStyle* aStyle);
 
  protected:
   nsSVGContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                       ClassID aID)
       : nsContainerFrame(aStyle, aPresContext, aID) {
     AddStateBits(NS_FRAME_SVG_LAYOUT);
   }
--- a/layout/svg/nsSVGFilterFrame.cpp
+++ b/layout/svg/nsSVGFilterFrame.cpp
@@ -5,30 +5,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Main header first:
 #include "nsSVGFilterFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "AutoReferenceChainGuard.h"
 #include "gfxUtils.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/SVGFilterElement.h"
 #include "nsGkAtoms.h"
 #include "SVGObserverUtils.h"
 #include "SVGElement.h"
-#include "mozilla/dom/SVGFilterElement.h"
 #include "nsSVGFilterInstance.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGUtils.h"
 #include "nsContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-nsIFrame* NS_NewSVGFilterFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGFilterFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGFilterFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGFilterFrame)
 
 uint16_t nsSVGFilterFrame::GetEnumValue(uint32_t aIndex, nsIContent* aDefault) {
   SVGAnimatedEnumeration& thisEnum =
--- a/layout/svg/nsSVGFilterFrame.h
+++ b/layout/svg/nsSVGFilterFrame.h
@@ -11,29 +11,29 @@
 #include "nsFrame.h"
 #include "nsQueryFrame.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class nsAtom;
 class nsIContent;
 class nsIFrame;
-class nsIPresShell;
 
 struct nsRect;
 
 namespace mozilla {
 class SVGAnimatedLength;
+class PresShell;
 namespace dom {
 class SVGFilterElement;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsSVGFilterFrame final : public nsSVGContainerFrame {
-  friend nsIFrame* NS_NewSVGFilterFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGFilterFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGFilterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGContainerFrame(aStyle, aPresContext, kClassID),
         mLoopFlag(false),
         mNoHRefURI(false) {
     AddStateBits(NS_FRAME_IS_NONDISPLAY);
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -26,17 +26,17 @@
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::image;
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsContainerFrame* NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGForeignObjectFrame(PresShell* aPresShell,
                                               ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGForeignObjectFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGForeignObjectFrame)
 
 nsSVGForeignObjectFrame::nsSVGForeignObjectFrame(ComputedStyle* aStyle,
--- a/layout/svg/nsSVGForeignObjectFrame.h
+++ b/layout/svg/nsSVGForeignObjectFrame.h
@@ -5,27 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSSVGFOREIGNOBJECTFRAME_H__
 #define NSSVGFOREIGNOBJECTFRAME_H__
 
 #include "mozilla/Attributes.h"
 #include "nsAutoPtr.h"
 #include "nsContainerFrame.h"
-#include "nsIPresShell.h"
+#include "nsIPresShell.h"  // for nsIPresShell::IntrinsicDirty
 #include "nsSVGDisplayableFrame.h"
 #include "nsRegion.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGForeignObjectFrame final : public nsContainerFrame,
                                       public nsSVGDisplayableFrame {
-  friend nsContainerFrame* NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell,
-                                                       ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewSVGForeignObjectFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGForeignObjectFrame(ComputedStyle* aStyle,
                                    nsPresContext* aPresContext);
 
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsSVGForeignObjectFrame)
--- a/layout/svg/nsSVGGFrame.cpp
+++ b/layout/svg/nsSVGGFrame.cpp
@@ -3,30 +3,31 @@
 /* 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/. */
 
 // Main header first:
 #include "nsSVGGFrame.h"
 
 // Keep others in (case-insensitive) order:
+#include "mozilla/PresShell.h"
 #include "nsGkAtoms.h"
-#include "SVGTransformableElement.h"
 #include "nsIFrame.h"
-#include "SVGGraphicsElement.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGUtils.h"
+#include "SVGGraphicsElement.h"
+#include "SVGTransformableElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGGFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGGFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGGFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGGFrame)
 
 #ifdef DEBUG
 void nsSVGGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                        nsIFrame* aPrevInFlow) {
--- a/layout/svg/nsSVGGFrame.h
+++ b/layout/svg/nsSVGGFrame.h
@@ -7,18 +7,22 @@
 #ifndef NSSVGGFRAME_H
 #define NSSVGGFRAME_H
 
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
 #include "nsAutoPtr.h"
 #include "nsSVGContainerFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGGFrame : public nsSVGDisplayContainerFrame {
-  friend nsIFrame* NS_NewSVGGFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGGFrame(mozilla::PresShell* aPresShell,
                                    ComputedStyle* aStyle);
   explicit nsSVGGFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGGFrame(aStyle, aPresContext, kClassID) {}
 
  protected:
   nsSVGGFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
               nsIFrame::ClassID aID)
       : nsSVGDisplayContainerFrame(aStyle, aPresContext, aID) {}
--- a/layout/svg/nsSVGGenericContainerFrame.cpp
+++ b/layout/svg/nsSVGGenericContainerFrame.cpp
@@ -3,22 +3,24 @@
 /* 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/. */
 
 // Main header first:
 #include "nsSVGGenericContainerFrame.h"
 #include "nsSVGIntegrationUtils.h"
 
+#include "mozilla/PresShell.h"
+
 using namespace mozilla;
 
 //----------------------------------------------------------------------
 // nsSVGGenericContainerFrame Implementation
 
-nsIFrame* NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGGenericContainerFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGGenericContainerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGGenericContainerFrame)
 
 //----------------------------------------------------------------------
--- a/layout/svg/nsSVGGenericContainerFrame.h
+++ b/layout/svg/nsSVGGenericContainerFrame.h
@@ -11,21 +11,24 @@
 #include "gfxMatrix.h"
 #include "nsFrame.h"
 #include "nsLiteralString.h"
 #include "nsQueryFrame.h"
 #include "nsSVGContainerFrame.h"
 
 class nsAtom;
 class nsIFrame;
-class nsIPresShell;
+
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
 
 class nsSVGGenericContainerFrame final : public nsSVGDisplayContainerFrame {
-  friend nsIFrame* NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell,
-                                                  ComputedStyle* aStyle);
+  friend nsIFrame* NS_NewSVGGenericContainerFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGGenericContainerFrame(ComputedStyle* aStyle,
                                       nsPresContext* aPresContext)
       : nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGGenericContainerFrame)
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -6,16 +6,17 @@
 
 // Main header first:
 #include "nsSVGGradientFrame.h"
 #include <algorithm>
 
 // Keep others in (case-insensitive) order:
 #include "AutoReferenceChainGuard.h"
 #include "gfxPattern.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/SVGGradientElement.h"
 #include "mozilla/dom/SVGGradientElementBinding.h"
 #include "mozilla/dom/SVGStopElement.h"
 #include "mozilla/dom/SVGUnitTypesBinding.h"
 #include "nsContentUtils.h"
 #include "SVGObserverUtils.h"
 #include "SVGAnimatedTransformList.h"
 
@@ -589,23 +590,23 @@ already_AddRefed<gfxPattern> nsSVGRadial
   RefPtr<gfxPattern> pattern = new gfxPattern(fx, fy, fr, cx, cy, r);
   return pattern.forget();
 }
 
 // -------------------------------------------------------------------------
 // Public functions
 // -------------------------------------------------------------------------
 
-nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGLinearGradientFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGLinearGradientFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGLinearGradientFrame)
 
-nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewSVGRadialGradientFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGRadialGradientFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGRadialGradientFrame)
--- a/layout/svg/nsSVGGradientFrame.h
+++ b/layout/svg/nsSVGGradientFrame.h
@@ -13,19 +13,19 @@
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsLiteralString.h"
 #include "nsSVGPaintServerFrame.h"
 
 class gfxPattern;
 class nsAtom;
 class nsIContent;
-class nsIPresShell;
 
 namespace mozilla {
+class PresShell;
 class SVGAnimatedTransformList;
 
 namespace dom {
 class SVGLinearGradientElement;
 class SVGRadialGradientElement;
 }  // namespace dom
 }  // namespace mozilla
 
@@ -104,17 +104,17 @@ class nsSVGGradientFrame : public nsSVGP
   bool mNoHRefURI;
 };
 
 // -------------------------------------------------------------------------
 // Linear Gradients
 // -------------------------------------------------------------------------
 
 class nsSVGLinearGradientFrame final : public nsSVGGradientFrame {
-  friend nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGLinearGradientFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGLinearGradientFrame(ComputedStyle* aStyle,
                                     nsPresContext* aPresContext)
       : nsSVGGradientFrame(aStyle, aPresContext, kClassID) {}
 
  public:
@@ -144,17 +144,17 @@ class nsSVGLinearGradientFrame final : p
   virtual already_AddRefed<gfxPattern> CreateGradient() override;
 };
 
 // -------------------------------------------------------------------------
 // Radial Gradients
 // -------------------------------------------------------------------------
 
 class nsSVGRadialGradientFrame final : public nsSVGGradientFrame {
-  friend nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGRadialGradientFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGRadialGradientFrame(ComputedStyle* aStyle,
                                     nsPresContext* aPresContext)
       : nsSVGGradientFrame(aStyle, aPresContext, kClassID) {}
 
  public:
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -32,17 +32,17 @@ using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 // ---------------------------------------------------------------------
 // nsQueryFrame methods
 NS_QUERYFRAME_HEAD(nsSVGImageFrame)
   NS_QUERYFRAME_ENTRY(nsSVGImageFrame)
 NS_QUERYFRAME_TAIL_INHERITING(SVGGeometryFrame)
 
-nsIFrame* NS_NewSVGImageFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGImageFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGImageFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGImageFrame)
 
 nsSVGImageFrame::~nsSVGImageFrame() {
   // set the frame to null so we don't send messages to a dead object.
   if (mListener) {
--- a/layout/svg/nsSVGImageFrame.h
+++ b/layout/svg/nsSVGImageFrame.h
@@ -22,16 +22,20 @@
 #include "SVGGeometryFrame.h"
 #include "SVGImageContext.h"
 #include "mozilla/dom/SVGImageElement.h"
 #include "nsIReflowCallback.h"
 #include "mozilla/Unused.h"
 
 class nsSVGImageFrame;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGImageListener final : public imgINotificationObserver {
  public:
   explicit nsSVGImageListener(nsSVGImageFrame* aFrame);
 
   NS_DECL_ISUPPORTS
   NS_DECL_IMGINOTIFICATIONOBSERVER
 
   void SetFrame(nsSVGImageFrame* frame) { mFrame = frame; }
@@ -39,17 +43,17 @@ class nsSVGImageListener final : public 
  private:
   ~nsSVGImageListener() {}
 
   nsSVGImageFrame* mFrame;
 };
 
 class nsSVGImageFrame final : public mozilla::SVGGeometryFrame,
                               public nsIReflowCallback {
-  friend nsIFrame* NS_NewSVGImageFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGImageFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGImageFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : SVGGeometryFrame(aStyle, aPresContext, kClassID),
         mReflowCallbackPosted(false),
         mForceSyncDecoding(false) {
     EnableVisibilityTracking();
--- a/layout/svg/nsSVGInnerSVGFrame.cpp
+++ b/layout/svg/nsSVGInnerSVGFrame.cpp
@@ -2,20 +2,21 @@
 /* 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/. */
 
 // Main header first:
 #include "nsSVGInnerSVGFrame.h"
 
+#include "mozilla/PresShell.h"
+
 using namespace mozilla;
 
-nsIFrame* NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGInnerSVGFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGInnerSVGFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGInnerSVGFrame)
 
 //----------------------------------------------------------------------
 // nsIFrame methods
--- a/layout/svg/nsSVGInnerSVGFrame.h
+++ b/layout/svg/nsSVGInnerSVGFrame.h
@@ -4,18 +4,22 @@
  * 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 __NS_SVGINNERSVGFRAME_H__
 #define __NS_SVGINNERSVGFRAME_H__
 
 #include "nsSVGViewportFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGInnerSVGFrame final : public nsSVGViewportFrame {
-  friend nsIFrame* NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGInnerSVGFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGInnerSVGFrame(ComputedStyle* aStyle,
                               nsPresContext* aPresContext)
       : nsSVGViewportFrame(aStyle, aPresContext, kClassID) {}
 
  public:
--- a/layout/svg/nsSVGMarkerFrame.cpp
+++ b/layout/svg/nsSVGMarkerFrame.cpp
@@ -4,27 +4,28 @@
  * 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/. */
 
 // Main header first:
 #include "nsSVGMarkerFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "gfxContext.h"
-#include "SVGObserverUtils.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/SVGMarkerElement.h"
 #include "SVGGeometryElement.h"
 #include "SVGGeometryFrame.h"
+#include "SVGObserverUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
-nsContainerFrame* NS_NewSVGMarkerFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGMarkerFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGMarkerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGMarkerFrame)
 
 //----------------------------------------------------------------------
@@ -208,17 +209,17 @@ nsSVGMarkerFrame::AutoMarkerReferencer::
 
   mFrame->mMarkedFrame = nullptr;
   mFrame->mInUse = false;
 }
 
 //----------------------------------------------------------------------
 // Implementation of nsSVGMarkerAnonChildFrame
 
-nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(PresShell* aPresShell,
                                                 ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGMarkerAnonChildFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGMarkerAnonChildFrame)
 
 #ifdef DEBUG
--- a/layout/svg/nsSVGMarkerFrame.h
+++ b/layout/svg/nsSVGMarkerFrame.h
@@ -15,31 +15,32 @@
 #include "nsQueryFrame.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 
 namespace mozilla {
 
+class PresShell;
 class SVGGeometryFrame;
 
 struct SVGMark;
 
 namespace dom {
 class SVGViewportElement;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsSVGMarkerFrame final : public nsSVGContainerFrame {
   typedef mozilla::SVGMark SVGMark;
   typedef mozilla::image::imgDrawingParams imgDrawingParams;
 
   friend class nsSVGMarkerAnonChildFrame;
-  friend nsContainerFrame* NS_NewSVGMarkerFrame(nsIPresShell* aPresShell,
+  friend nsContainerFrame* NS_NewSVGMarkerFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGMarkerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGContainerFrame(aStyle, aPresContext, kClassID),
         mMarkedFrame(nullptr),
         mInUse(false),
         mInUse2(false) {
@@ -124,17 +125,17 @@ class nsSVGMarkerFrame final : public ns
   bool mInUse2;
 };
 
 ////////////////////////////////////////////////////////////////////////
 // nsMarkerAnonChildFrame class
 
 class nsSVGMarkerAnonChildFrame final : public nsSVGDisplayContainerFrame {
   friend nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   explicit nsSVGMarkerAnonChildFrame(ComputedStyle* aStyle,
                                      nsPresContext* aPresContext)
       : nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGMarkerAnonChildFrame)
 
--- a/layout/svg/nsSVGMaskFrame.cpp
+++ b/layout/svg/nsSVGMaskFrame.cpp
@@ -6,21 +6,22 @@
 
 // Main header first:
 #include "nsSVGMaskFrame.h"
 
 // Keep others in (case-insensitive) order:
 #include "AutoReferenceChainGuard.h"
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
-#include "mozilla/gfx/2D.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/RefPtr.h"
-#include "SVGObserverUtils.h"
 #include "mozilla/dom/SVGMaskElement.h"
 #include "mozilla/dom/SVGUnitTypesBinding.h"
+#include "mozilla/gfx/2D.h"
+#include "SVGObserverUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::SVGUnitTypes_Binding;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 static LuminanceType GetLuminanceType(uint8_t aNSMaskType) {
@@ -31,17 +32,17 @@ static LuminanceType GetLuminanceType(ui
       return LuminanceType::LINEARRGB;
     default: {
       NS_WARNING("Unknown SVG mask type, defaulting to luminance");
       return LuminanceType::LUMINANCE;
     }
   }
 }
 
-nsIFrame* NS_NewSVGMaskFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGMaskFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGMaskFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGMaskFrame)
 
 already_AddRefed<SourceSurface> nsSVGMaskFrame::GetMaskForMaskedFrame(
     MaskParams& aParams) {
   // Make sure we break reference loops and over long reference chains:
--- a/layout/svg/nsSVGMaskFrame.h
+++ b/layout/svg/nsSVGMaskFrame.h
@@ -12,18 +12,22 @@
 #include "mozilla/RefPtr.h"
 #include "gfxPattern.h"
 #include "gfxMatrix.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGMaskFrame final : public nsSVGContainerFrame {
-  friend nsIFrame* NS_NewSVGMaskFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGMaskFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
   typedef mozilla::gfx::Matrix Matrix;
   typedef mozilla::gfx::SourceSurface SourceSurface;
   typedef mozilla::image::imgDrawingParams imgDrawingParams;
 
  protected:
   explicit nsSVGMaskFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -53,17 +53,17 @@ void nsSVGOuterSVGFrame::UnregisterForei
   NS_ASSERTION(mForeignObjectHash && mForeignObjectHash->GetEntry(aFrame),
                "nsSVGForeignObjectFrame not in registry!");
   return mForeignObjectHash->RemoveEntry(aFrame);
 }
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGOuterSVGFrame(PresShell* aPresShell,
                                          ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGOuterSVGFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGOuterSVGFrame)
 
 nsSVGOuterSVGFrame::nsSVGOuterSVGFrame(ComputedStyle* aStyle,
@@ -928,17 +928,17 @@ void nsSVGOuterSVGFrame::AppendDirectlyO
   nsIFrame* anonKid = PrincipalChildList().FirstChild();
   MOZ_ASSERT(anonKid->IsSVGOuterSVGAnonChildFrame());
   aResult.AppendElement(OwnedAnonBox(anonKid));
 }
 
 //----------------------------------------------------------------------
 // Implementation of nsSVGOuterSVGAnonChildFrame
 
-nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(PresShell* aPresShell,
                                                   ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGOuterSVGAnonChildFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGOuterSVGAnonChildFrame)
 
 #ifdef DEBUG
--- a/layout/svg/nsSVGOuterSVGFrame.h
+++ b/layout/svg/nsSVGOuterSVGFrame.h
@@ -11,25 +11,29 @@
 #include "nsAutoPtr.h"
 #include "nsISVGSVGFrame.h"
 #include "nsSVGContainerFrame.h"
 #include "nsRegion.h"
 
 class gfxContext;
 class nsSVGForeignObjectFrame;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 ////////////////////////////////////////////////////////////////////////
 // nsSVGOuterSVGFrame class
 
 class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
                                  public nsISVGSVGFrame {
   typedef mozilla::image::imgDrawingParams imgDrawingParams;
 
-  friend nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell,
-                                                  ComputedStyle* aStyle);
+  friend nsContainerFrame* NS_NewSVGOuterSVGFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGOuterSVGFrame(ComputedStyle* aStyle,
                               nsPresContext* aPresContext);
 
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsSVGOuterSVGFrame)
@@ -211,17 +215,17 @@ class nsSVGOuterSVGFrame final : public 
  * The reason that this class inherit from nsSVGDisplayContainerFrame rather
  * than simply from nsContainerFrame is so that we can avoid having special
  * handling for these inner wrappers in multiple parts of the SVG code. For
  * example, the implementations of IsSVGTransformed and GetCanvasTM assume
  * nsSVGContainerFrame instances all the way up to the nsSVGOuterSVGFrame.
  */
 class nsSVGOuterSVGAnonChildFrame final : public nsSVGDisplayContainerFrame {
   friend nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   explicit nsSVGOuterSVGAnonChildFrame(ComputedStyle* aStyle,
                                        nsPresContext* aPresContext)
       : nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGOuterSVGAnonChildFrame)
 
--- a/layout/svg/nsSVGPatternFrame.cpp
+++ b/layout/svg/nsSVGPatternFrame.cpp
@@ -9,24 +9,25 @@
 
 // Keep others in (case-insensitive) order:
 #include "AutoReferenceChainGuard.h"
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
 #include "gfxMatrix.h"
 #include "gfxPattern.h"
 #include "gfxPlatform.h"
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/SVGPatternElement.h"
+#include "mozilla/dom/SVGUnitTypesBinding.h"
 #include "mozilla/gfx/2D.h"
 #include "nsGkAtoms.h"
 #include "nsSVGDisplayableFrame.h"
-#include "mozilla/ComputedStyle.h"
 #include "SVGObserverUtils.h"
 #include "SVGGeometryFrame.h"
-#include "mozilla/dom/SVGPatternElement.h"
-#include "mozilla/dom/SVGUnitTypesBinding.h"
 #include "nsSVGUtils.h"
 #include "SVGAnimatedTransformList.h"
 #include "SVGContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::SVGUnitTypes_Binding;
 using namespace mozilla::gfx;
@@ -700,13 +701,12 @@ already_AddRefed<gfxPattern> nsSVGPatter
   pattern->SetExtend(ExtendMode::REPEAT);
   return pattern.forget();
 }
 
 // -------------------------------------------------------------------------
 // Public functions
 // -------------------------------------------------------------------------
 
-nsIFrame *NS_NewSVGPatternFrame(nsIPresShell *aPresShell,
-                                ComputedStyle *aStyle) {
+nsIFrame *NS_NewSVGPatternFrame(PresShell *aPresShell, ComputedStyle *aStyle) {
   return new (aPresShell)
       nsSVGPatternFrame(aStyle, aPresShell->GetPresContext());
 }
--- a/layout/svg/nsSVGPatternFrame.h
+++ b/layout/svg/nsSVGPatternFrame.h
@@ -12,30 +12,31 @@
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsAutoPtr.h"
 #include "nsSVGPaintServerFrame.h"
 
 class nsIFrame;
 
 namespace mozilla {
+class PresShell;
 class SVGAnimatedLength;
 class SVGAnimatedPreserveAspectRatio;
 class SVGAnimatedTransformList;
 class SVGAnimatedViewBox;
 class SVGGeometryFrame;
 }  // namespace mozilla
 
 class nsSVGPatternFrame final : public nsSVGPaintServerFrame {
   typedef mozilla::gfx::SourceSurface SourceSurface;
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGPatternFrame)
 
-  friend nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGPatternFrame(mozilla::PresShell* aPresShell,
                                          ComputedStyle* aStyle);
 
   explicit nsSVGPatternFrame(ComputedStyle* aStyle,
                              nsPresContext* aPresContext);
 
   // nsSVGPaintServerFrame methods:
   virtual already_AddRefed<gfxPattern> GetPaintServerPattern(
       nsIFrame* aSource, const DrawTarget* aDrawTarget,
--- a/layout/svg/nsSVGStopFrame.cpp
+++ b/layout/svg/nsSVGStopFrame.cpp
@@ -4,26 +4,27 @@
  * 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/. */
 
 // Keep in (case-insensitive) order:
 #include "nsContainerFrame.h"
 #include "nsFrame.h"
 #include "nsGkAtoms.h"
 #include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "SVGObserverUtils.h"
 
 using namespace mozilla;
 
 // This is a very simple frame whose only purpose is to capture style change
 // events and propagate them to the parent.  Most of the heavy lifting is done
 // within the nsSVGGradientFrame, which is the parent for this frame
 
 class nsSVGStopFrame : public nsFrame {
-  friend nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGStopFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGStopFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsFrame(aStyle, aPresContext, kClassID) {
     AddStateBits(NS_FRAME_IS_NONDISPLAY);
   }
 
@@ -88,11 +89,11 @@ nsresult nsSVGStopFrame::AttributeChange
 
   return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
 
 // -------------------------------------------------------------------------
 // Public functions
 // -------------------------------------------------------------------------
 
-nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGStopFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGStopFrame(aStyle, aPresShell->GetPresContext());
 }
--- a/layout/svg/nsSVGSwitchFrame.cpp
+++ b/layout/svg/nsSVGSwitchFrame.cpp
@@ -3,27 +3,28 @@
 /* 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/. */
 
 // Keep in (case-insensitive) order:
 #include "gfxRect.h"
 #include "SVGObserverUtils.h"
 #include "nsSVGGFrame.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/SVGSwitchElement.h"
 #include "nsSVGUtils.h"
 #include "SVGTextFrame.h"
 #include "nsSVGContainerFrame.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 class nsSVGSwitchFrame final : public nsSVGGFrame {
-  friend nsIFrame* NS_NewSVGSwitchFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGSwitchFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGSwitchFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGGFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSVGSwitchFrame)
@@ -55,18 +56,17 @@ class nsSVGSwitchFrame final : public ns
   nsIFrame* GetActiveChildFrame();
   void ReflowAllSVGTextFramesInsideNonActiveChildren(nsIFrame* aActiveChild);
   static void AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid);
 };
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGSwitchFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGSwitchFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGSwitchFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGSwitchFrame)
 
 #ifdef DEBUG
 void nsSVGSwitchFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
--- a/layout/svg/nsSVGSymbolFrame.cpp
+++ b/layout/svg/nsSVGSymbolFrame.cpp
@@ -2,20 +2,21 @@
 /* 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/. */
 
 // Main header first:
 #include "nsSVGSymbolFrame.h"
 
+#include "mozilla/PresShell.h"
+
 using namespace mozilla;
 
-nsIFrame* NS_NewSVGSymbolFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGSymbolFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsSVGSymbolFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGSymbolFrame)
 
 //----------------------------------------------------------------------
 // nsIFrame methods
--- a/layout/svg/nsSVGSymbolFrame.h
+++ b/layout/svg/nsSVGSymbolFrame.h
@@ -4,18 +4,22 @@
  * 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 __NS_SVGISYMBOLFRAME_H__
 #define __NS_SVGISYMBOLFRAME_H__
 
 #include "nsSVGViewportFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGSymbolFrame final : public nsSVGViewportFrame {
-  friend nsIFrame* NS_NewSVGSymbolFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGSymbolFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGSymbolFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGViewportFrame(aStyle, aPresContext, kClassID) {}
 
  public:
   NS_DECL_QUERYFRAME
--- a/layout/svg/nsSVGUseFrame.cpp
+++ b/layout/svg/nsSVGUseFrame.cpp
@@ -1,27 +1,28 @@
 /* -*- 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 "nsSVGUseFrame.h"
 
+#include "mozilla/PresShell.h"
 #include "mozilla/dom/MutationEvent.h"
 #include "mozilla/dom/SVGUseElement.h"
 #include "SVGObserverUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Implementation
 
-nsIFrame* NS_NewSVGUseFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSVGUseFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSVGUseFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGUseFrame)
 
 //----------------------------------------------------------------------
 // nsIFrame methods:
 
--- a/layout/svg/nsSVGUseFrame.h
+++ b/layout/svg/nsSVGUseFrame.h
@@ -5,18 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __NS_SVGUSEFRAME_H__
 #define __NS_SVGUSEFRAME_H__
 
 // Keep in (case-insensitive) order:
 #include "nsSVGGFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsSVGUseFrame final : public nsSVGGFrame {
-  friend nsIFrame* NS_NewSVGUseFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewSVGUseFrame(mozilla::PresShell* aPresShell,
                                      ComputedStyle* aStyle);
 
  protected:
   explicit nsSVGUseFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsSVGGFrame(aStyle, aPresContext, kClassID),
         mHasValidDimensions(true) {}
 
  public:
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -963,17 +963,17 @@ a11y::AccType nsTableCellFrame::Accessib
 /* This is primarily for editor access via nsITableLayout */
 NS_IMETHODIMP
 nsTableCellFrame::GetCellIndexes(int32_t& aRowIndex, int32_t& aColIndex) {
   aRowIndex = RowIndex();
   aColIndex = mColIndex;
   return NS_OK;
 }
 
-nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
+nsTableCellFrame* NS_NewTableCellFrame(PresShell* aPresShell,
                                        ComputedStyle* aStyle,
                                        nsTableFrame* aTableFrame) {
   if (aTableFrame->IsBorderCollapse())
     return new (aPresShell) nsBCTableCellFrame(aStyle, aTableFrame);
   else
     return new (aPresShell) nsTableCellFrame(aStyle, aTableFrame);
 }
 
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -11,16 +11,20 @@
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsIPercentBSizeObserver.h"
 #include "nsTArray.h"
 #include "nsTableRowFrame.h"
 #include "mozilla/WritingModes.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * nsTableCellFrame
  * data structure to maintain information about a single table cell's frame
  *
  * NOTE:  frames are not ref counted.  We expose addref and release here
  * so we can change that decsion in the future.  Users of nsITableCellLayout
  * should refcount correctly as if this object is being ref counted, though
  * no actual support is under the hood.
@@ -28,17 +32,17 @@
  * @author  sclark
  */
 class nsTableCellFrame : public nsContainerFrame,
                          public nsITableCellLayout,
                          public nsIPercentBSizeObserver {
   typedef mozilla::gfx::DrawTarget DrawTarget;
   typedef mozilla::image::ImgDrawResult ImgDrawResult;
 
-  friend nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
+  friend nsTableCellFrame* NS_NewTableCellFrame(mozilla::PresShell* aPresShell,
                                                 ComputedStyle* aStyle,
                                                 nsTableFrame* aTableFrame);
 
   nsTableCellFrame(ComputedStyle* aStyle, nsTableFrame* aTableFrame)
       : nsTableCellFrame(aStyle, aTableFrame, kClassID) {}
 
  protected:
   typedef mozilla::WritingMode WritingMode;
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -1,22 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsCOMPtr.h"
 #include "nsTableColFrame.h"
 #include "nsTableFrame.h"
 #include "nsContainerFrame.h"
-#include "mozilla/ComputedStyle.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSRendering.h"
 #include "nsIContent.h"
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 
 using namespace mozilla;
 
 #define COL_TYPE_BITS                                                         \
   (NS_FRAME_STATE_BIT(28) | NS_FRAME_STATE_BIT(29) | NS_FRAME_STATE_BIT(30) | \
    NS_FRAME_STATE_BIT(31))
 #define COL_TYPE_OFFSET 28
 
@@ -149,17 +150,17 @@ void nsTableColFrame::Dump(int32_t aInde
          int32_t(mSpanMinCoord), int32_t(mSpanPrefCoord), mSpanPrefPercent,
          int32_t(GetFinalISize()));
   printf("\n%s**END COL DUMP** ", indent);
   delete[] indent;
 }
 #endif
 /* ----- global methods ----- */
 
-nsTableColFrame* NS_NewTableColFrame(nsIPresShell* aPresShell,
+nsTableColFrame* NS_NewTableColFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell) nsTableColFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableColFrame)
 
 nsTableColFrame* nsTableColFrame::GetNextCol() const {
   nsIFrame* childFrame = GetNextSibling();
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -8,16 +8,20 @@
 #include "mozilla/Attributes.h"
 #include "celldata.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsTArray.h"
 #include "nsTableColGroupFrame.h"
 #include "mozilla/WritingModes.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsTableColFrame final : public nsSplittableFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTableColFrame)
 
   enum {
     eWIDTH_SOURCE_NONE = 0,  // no cell has contributed to the width style
     eWIDTH_SOURCE_CELL = 1,  // a cell specified a width
     eWIDTH_SOURCE_CELL_WITH_SPAN = 2  // a cell implicitly specified a width via
@@ -29,17 +33,17 @@ class nsTableColFrame final : public nsS
 
   /**
    * instantiate a new instance of nsTableRowFrame.
    *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
-  friend nsTableColFrame* NS_NewTableColFrame(nsIPresShell* aPresShell,
+  friend nsTableColFrame* NS_NewTableColFrame(mozilla::PresShell* aPresShell,
                                               ComputedStyle* aContext);
 
   // nsIFrame overrides
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override {
     nsSplittableFrame::Init(aContent, aParent, aPrevInFlow);
     if (!aPrevInFlow) {
       mWritingMode = GetTableFrame()->GetWritingMode();
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -401,17 +401,17 @@ void nsTableColGroupFrame::GetContinuous
       GetTableFrame()->GetColFrame(mStartColIndex + mColCount - 1);
   col->GetContinuousBCBorderWidth(aWM, aBorder);
   aBorder.BStart(aWM) = BC_BORDER_END_HALF_COORD(d2a, mBStartContBorderWidth);
   aBorder.BEnd(aWM) = BC_BORDER_START_HALF_COORD(d2a, mBEndContBorderWidth);
 }
 
 /* ----- global methods ----- */
 
-nsTableColGroupFrame* NS_NewTableColGroupFrame(nsIPresShell* aPresShell,
+nsTableColGroupFrame* NS_NewTableColGroupFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsTableColGroupFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
 
 void nsTableColGroupFrame::InvalidateFrame(uint32_t aDisplayItemKey,
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -8,33 +8,37 @@
 #include "mozilla/Attributes.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsTableFrame.h"
 #include "mozilla/WritingModes.h"
 
 class nsTableColFrame;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * nsTableColGroupFrame
  * data structure to maintain information about a single table cell's frame
  */
 class nsTableColGroupFrame final : public nsContainerFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
 
   /**
    * instantiate a new instance of nsTableRowFrame.
    *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
   friend nsTableColGroupFrame* NS_NewTableColGroupFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   // nsIFrame overrides
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override {
     nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
     if (!aPrevInFlow) {
       mWritingMode = GetTableFrame()->GetWritingMode();
     }
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -3863,18 +3863,17 @@ bool nsTableFrame::GetNaturalBaselineBOf
       }
     }
   }
   return false;
 }
 
 /* ----- global methods ----- */
 
-nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsTableFrame* NS_NewTableFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTableFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableFrame)
 
 nsTableFrame* nsTableFrame::GetTableFrame(nsIFrame* aFrame) {
   for (nsIFrame* ancestor = aFrame->GetParent(); ancestor;
        ancestor = ancestor->GetParent()) {
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -21,18 +21,19 @@ struct BCPaintBorderAction;
 class nsTableCellFrame;
 class nsTableCellMap;
 class nsTableColFrame;
 class nsTableRowGroupFrame;
 class nsTableRowFrame;
 class nsTableColGroupFrame;
 class nsITableLayoutStrategy;
 namespace mozilla {
+class LogicalMargin;
+class PresShell;
 class WritingMode;
-class LogicalMargin;
 struct TableReflowInput;
 namespace layers {
 class StackingContextHelper;
 }
 }  // namespace mozilla
 
 struct BCPropertyData;
 
@@ -132,17 +133,17 @@ class nsTableFrame : public nsContainerF
 
   /**
    * instantiate a new instance of nsTableRowFrame.
    *
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
-  friend nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
+  friend nsTableFrame* NS_NewTableFrame(mozilla::PresShell* aPresShell,
                                         ComputedStyle* aStyle);
 
   /** sets defaults for table-specific style.
    * @see nsIFrame::Init
    */
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -1365,17 +1365,17 @@ void nsTableRowFrame::InvalidateFrameWit
   // we get an inactive layer created and this is computed
   // within FrameLayerBuilder
   GetParent()->InvalidateFrameWithRect(aRect + GetPosition(), aDisplayItemKey,
                                        false);
 }
 
 /* ----- global methods ----- */
 
-nsTableRowFrame* NS_NewTableRowFrame(nsIPresShell* aPresShell,
+nsTableRowFrame* NS_NewTableRowFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell) nsTableRowFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableRowFrame)
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult nsTableRowFrame::GetFrameName(nsAString& aResult) const {
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -8,16 +8,17 @@
 #include "mozilla/Attributes.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsTableRowGroupFrame.h"
 #include "mozilla/WritingModes.h"
 
 class nsTableCellFrame;
 namespace mozilla {
+class PresShell;
 struct TableCellReflowInput;
 }  // namespace mozilla
 
 /**
  * nsTableRowFrame is the frame that maps table rows
  * (HTML tag TR). This class cannot be reused
  * outside of an nsTableRowGroupFrame.  It assumes that its parent is an
  * nsTableRowGroupFrame, and its children are nsTableCellFrames.
@@ -50,17 +51,17 @@ class nsTableRowFrame : public nsContain
                             nsFrameList& aFrameList) override;
   virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
 
   /** instantiate a new instance of nsTableRowFrame.
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
-  friend nsTableRowFrame* NS_NewTableRowFrame(nsIPresShell* aPresShell,
+  friend nsTableRowFrame* NS_NewTableRowFrame(mozilla::PresShell* aPresShell,
                                               ComputedStyle* aStyle);
 
   nsTableRowGroupFrame* GetTableRowGroupFrame() const {
     nsIFrame* parent = GetParent();
     MOZ_ASSERT(parent && parent->IsTableRowGroupFrame());
     return static_cast<nsTableRowGroupFrame*>(parent);
   }
 
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1626,17 +1626,17 @@ bool nsTableRowGroupFrame::HasInternalBr
 /** find page break after the last row **/
 bool nsTableRowGroupFrame::HasInternalBreakAfter() const {
   nsIFrame* lastChild = mFrames.LastChild();
   if (!lastChild) return false;
   return lastChild->StyleDisplay()->BreakAfter();
 }
 /* ----- global methods ----- */
 
-nsTableRowGroupFrame* NS_NewTableRowGroupFrame(nsIPresShell* aPresShell,
+nsTableRowGroupFrame* NS_NewTableRowGroupFrame(PresShell* aPresShell,
                                                ComputedStyle* aStyle) {
   return new (aPresShell)
       nsTableRowGroupFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableRowGroupFrame)
 
 #ifdef DEBUG_FRAME_DUMP
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -11,16 +11,17 @@
 #include "nsAtom.h"
 #include "nsILineIterator.h"
 #include "nsTArray.h"
 #include "nsTableFrame.h"
 #include "mozilla/WritingModes.h"
 
 class nsTableRowFrame;
 namespace mozilla {
+class PresShell;
 struct TableRowGroupReflowInput;
 }  // namespace mozilla
 
 #define MIN_ROWS_NEEDING_CURSOR 20
 
 /**
  * nsTableRowGroupFrame is the frame that maps row groups
  * (HTML tags THEAD, TFOOT, and TBODY). This class cannot be reused
@@ -39,17 +40,17 @@ class nsTableRowGroupFrame final : publi
   NS_DECL_FRAMEARENA_HELPERS(nsTableRowGroupFrame)
 
   /** instantiate a new instance of nsTableRowFrame.
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
   friend nsTableRowGroupFrame* NS_NewTableRowGroupFrame(
-      nsIPresShell* aPresShell, ComputedStyle* aStyle);
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
   virtual ~nsTableRowGroupFrame();
 
   // nsIFrame overrides
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override {
     nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
     if (!aPrevInFlow) {
       mWritingMode = GetTableFrame()->GetWritingMode();
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -1003,17 +1003,17 @@ nsIContent* nsTableWrapperFrame::GetCell
   nsTableCellFrame* cell = cellMap->GetCellInfoAt(aRowIdx, aColIdx);
   if (!cell) {
     return nullptr;
   }
 
   return cell->GetContent();
 }
 
-nsTableWrapperFrame* NS_NewTableWrapperFrame(nsIPresShell* aPresShell,
+nsTableWrapperFrame* NS_NewTableWrapperFrame(PresShell* aPresShell,
                                              ComputedStyle* aStyle) {
   return new (aPresShell)
       nsTableWrapperFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableWrapperFrame)
 
 #ifdef DEBUG_FRAME_DUMP
--- a/layout/tables/nsTableWrapperFrame.h
+++ b/layout/tables/nsTableWrapperFrame.h
@@ -7,33 +7,37 @@
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsCellMap.h"
 #include "nsTableFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Primary frame for a table element,
  * the nsTableWrapperFrame contains 0 or one caption frame, and a nsTableFrame
  * pseudo-frame (referred to as the "inner frame').
  */
 class nsTableWrapperFrame : public nsContainerFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsTableWrapperFrame)
 
   /** instantiate a new instance of nsTableRowFrame.
    * @param aPresShell the pres shell for this frame
    *
    * @return           the frame that was created
    */
-  friend nsTableWrapperFrame* NS_NewTableWrapperFrame(nsIPresShell* aPresShell,
-                                                      ComputedStyle* aStyle);
+  friend nsTableWrapperFrame* NS_NewTableWrapperFrame(
+      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
 
   // nsIFrame overrides - see there for a description
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
 
   virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
   virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
--- a/layout/xul/grid/nsGridLayout2.cpp
+++ b/layout/xul/grid/nsGridLayout2.cpp
@@ -14,27 +14,23 @@
 #include "nsGridLayout2.h"
 #include "nsGridRowGroupLayout.h"
 #include "nsGridRow.h"
 #include "nsBox.h"
 #include "nsIScrollableFrame.h"
 #include "nsSprocketLayout.h"
 #include "mozilla/ReflowInput.h"
 
-nsresult NS_NewGridLayout2(nsIPresShell* aPresShell, nsBoxLayout** aNewLayout) {
-  *aNewLayout = new nsGridLayout2(aPresShell);
+nsresult NS_NewGridLayout2(nsBoxLayout** aNewLayout) {
+  *aNewLayout = new nsGridLayout2();
   NS_IF_ADDREF(*aNewLayout);
 
   return NS_OK;
 }
 
-nsGridLayout2::nsGridLayout2(nsIPresShell* aPresShell) : nsStackLayout() {}
-
-nsGridLayout2::~nsGridLayout2() {}
-
 // static
 void nsGridLayout2::AddOffset(nsIFrame* aChild, nsSize& aSize) {
   nsMargin offset;
   GetOffset(aChild, offset);
   aSize.width += offset.left;
   aSize.height += offset.top;
 }
 
--- a/layout/xul/grid/nsGridLayout2.h
+++ b/layout/xul/grid/nsGridLayout2.h
@@ -18,18 +18,17 @@ class nsGridRowLayout;
 class nsGridRow;
 class nsBoxLayoutState;
 
 /**
  * The nsBoxLayout implementation for a grid.
  */
 class nsGridLayout2 final : public nsStackLayout, public nsIGridPart {
  public:
-  friend nsresult NS_NewGridLayout2(nsIPresShell* aPresShell,
-                                    nsBoxLayout** aNewLayout);
+  friend nsresult NS_NewGridLayout2(nsBoxLayout** aNewLayout);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_IMETHOD XULLayout(nsIFrame* aBox,
                        nsBoxLayoutState& aBoxLayoutState) override;
   virtual void IntrinsicISizesDirty(nsIFrame* aBox,
                                     nsBoxLayoutState& aBoxLayoutState) override;
 
@@ -69,18 +68,18 @@ class nsGridLayout2 final : public nsSta
   virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
                            nsIFrame* aChildList) override;
 
   virtual nsIGridPart* AsGridPart() override { return this; }
 
   static void AddOffset(nsIFrame* aChild, nsSize& aSize);
 
  protected:
-  explicit nsGridLayout2(nsIPresShell* aShell);
-  virtual ~nsGridLayout2();
+  explicit nsGridLayout2() = default;
+  virtual ~nsGridLayout2() = default;
   nsGrid mGrid;
 
  private:
   void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
 
 };  // class nsGridLayout2
 
 #endif
--- a/layout/xul/grid/nsGridRowGroupFrame.cpp
+++ b/layout/xul/grid/nsGridRowGroupFrame.cpp
@@ -6,27 +6,28 @@
 
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
+#include "mozilla/PresShell.h"
 #include "nsGridRowGroupFrame.h"
 #include "nsGridRowLeafLayout.h"
 #include "nsGridRow.h"
 #include "nsBoxLayoutState.h"
 #include "nsGridLayout2.h"
 
 using namespace mozilla;
 
 already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
 
-nsIFrame* NS_NewGridRowGroupFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewGridRowGroupFrame(PresShell* aPresShell,
                                   ComputedStyle* aStyle) {
   nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout();
   return new (aPresShell)
       nsGridRowGroupFrame(aStyle, aPresShell->GetPresContext(), layout);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
 
--- a/layout/xul/grid/nsGridRowLeafFrame.cpp
+++ b/layout/xul/grid/nsGridRowLeafFrame.cpp
@@ -6,28 +6,28 @@
 
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
+#include "mozilla/PresShell.h"
 #include "nsGridRowLeafFrame.h"
 #include "nsGridRowLeafLayout.h"
 #include "nsGridRow.h"
 #include "nsBoxLayoutState.h"
 #include "nsGridLayout2.h"
 
 using namespace mozilla;
 
 already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
 
-nsIFrame* NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
-                                 ComputedStyle* aStyle) {
+nsIFrame* NS_NewGridRowLeafFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowLeafLayout();
   return new (aPresShell)
       nsGridRowLeafFrame(aStyle, aPresShell->GetPresContext(), false, layout);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsGridRowLeafFrame)
 
 /*
--- a/layout/xul/grid/nsGridRowLeafFrame.h
+++ b/layout/xul/grid/nsGridRowLeafFrame.h
@@ -13,28 +13,32 @@ one time. So the can be flipped though l
 **/
 
 #ifndef nsGridRowLeafFrame_h___
 #define nsGridRowLeafFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsBoxFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * A frame representing a grid row (or column).  Grid row (and column)
  * elements are the children of row group (or column group) elements,
  * and their children are placed one to a cell.
  */
 // XXXldb This needs a better name that indicates that it's for any grid
 // row.
 class nsGridRowLeafFrame : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsGridRowLeafFrame)
 
-  friend nsIFrame* NS_NewGridRowLeafFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewGridRowLeafFrame(mozilla::PresShell* aPresShell,
                                           ComputedStyle* aStyle);
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override {
     return MakeFrameName(NS_LITERAL_STRING("nsGridRowLeaf"), aResult);
   }
 #endif
 
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -82,24 +82,24 @@
 #include "nsIURI.h"
 
 #include "mozilla/TouchEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 
-nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle,
+nsIFrame* NS_NewBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle,
                          bool aIsRoot, nsBoxLayout* aLayoutManager) {
   return new (aPresShell)
       nsBoxFrame(aStyle, aPresShell->GetPresContext(), nsBoxFrame::kClassID,
                  aIsRoot, aLayoutManager);
 }
 
-nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsBoxFrame)
 
 #ifdef DEBUG
 NS_QUERYFRAME_HEAD(nsBoxFrame)
   NS_QUERYFRAME_ENTRY(nsBoxFrame)
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -18,41 +18,42 @@ horizontally. It lays them out according
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
 #include "nsContainerFrame.h"
 #include "nsBoxLayout.h"
 
 class nsBoxLayoutState;
 
 namespace mozilla {
+class PresShell;
 namespace gfx {
 class DrawTarget;
 }  // namespace gfx
 }  // namespace mozilla
 
-nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                          mozilla::ComputedStyle* aStyle, bool aIsRoot,
                          nsBoxLayout* aLayoutManager);
-nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                          mozilla::ComputedStyle* aStyle);
 
 class nsBoxFrame : public nsContainerFrame {
  protected:
   typedef mozilla::gfx::DrawTarget DrawTarget;
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsBoxFrame)
 #ifdef DEBUG
   NS_DECL_QUERYFRAME
 #endif
 
-  friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                                   ComputedStyle* aStyle, bool aIsRoot,
                                   nsBoxLayout* aLayoutManager);
-  friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                                   ComputedStyle* aStyle);
 
   // gets the rect inside our border and debug border. If you wish to paint
   // inside a box call this method to get the rect so you don't draw on the
   // debug border or outer border.
 
   virtual void SetXULLayoutManager(nsBoxLayout* aLayout) override {
     mLayoutManager = aLayout;
--- a/layout/xul/nsButtonBoxFrame.cpp
+++ b/layout/xul/nsButtonBoxFrame.cpp
@@ -44,18 +44,17 @@ nsresult nsButtonBoxFrame::nsButtonBoxLi
   return NS_OK;
 }
 
 //
 // NS_NewXULButtonFrame
 //
 // Creates a new Button frame and returns it
 //
-nsIFrame* NS_NewButtonBoxFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewButtonBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsButtonBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsButtonBoxFrame)
 
 nsButtonBoxFrame::nsButtonBoxFrame(ComputedStyle* aStyle,
                                    nsPresContext* aPresContext, ClassID aID)
--- a/layout/xul/nsButtonBoxFrame.h
+++ b/layout/xul/nsButtonBoxFrame.h
@@ -5,21 +5,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsButtonBoxFrame_h___
 #define nsButtonBoxFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIDOMEventListener.h"
 #include "nsBoxFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsButtonBoxFrame : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsButtonBoxFrame)
 
-  friend nsIFrame* NS_NewButtonBoxFrame(nsIPresShell* aPresShell);
+  friend nsIFrame* NS_NewButtonBoxFrame(mozilla::PresShell* aPresShell);
 
   nsButtonBoxFrame(ComputedStyle*, nsPresContext*, ClassID = kClassID);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
   virtual void BuildDisplayListForChildren(
       nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) override;
--- a/layout/xul/nsDeckFrame.cpp
+++ b/layout/xul/nsDeckFrame.cpp
@@ -32,17 +32,17 @@
 #include "nsImageFrame.h"
 
 #ifdef ACCESSIBILITY
 #  include "nsAccessibilityService.h"
 #endif
 
 using namespace mozilla;
 
-nsIFrame* NS_NewDeckFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewDeckFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsDeckFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsDeckFrame)
 
 NS_QUERYFRAME_HEAD(nsDeckFrame)
   NS_QUERYFRAME_ENTRY(nsDeckFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
--- a/layout/xul/nsDeckFrame.h
+++ b/layout/xul/nsDeckFrame.h
@@ -13,22 +13,26 @@ one time. So the can be flipped though l
 **/
 
 #ifndef nsDeckFrame_h___
 #define nsDeckFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsBoxFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsDeckFrame final : public nsBoxFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsDeckFrame)
 
-  friend nsIFrame* NS_NewDeckFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewDeckFrame(mozilla::PresShell* aPresShell,
                                    ComputedStyle* aStyle);
 
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aState) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
--- a/layout/xul/nsDocElementBoxFrame.cpp
+++ b/layout/xul/nsDocElementBoxFrame.cpp
@@ -1,43 +1,43 @@
 /* -*- 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/PresShell.h"
+#include "mozilla/dom/Document.h"
+#include "mozilla/dom/Element.h"
+#include "mozilla/dom/FromParser.h"
+#include "mozilla/dom/NodeInfo.h"
 #include "nsHTMLParts.h"
 #include "nsContainerFrame.h"
 #include "nsCSSRendering.h"
-#include "mozilla/dom/Document.h"
 #include "nsPageFrame.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
-#include "nsIPresShell.h"
 #include "nsBoxFrame.h"
 #include "nsStackLayout.h"
 #include "nsIAnonymousContentCreator.h"
-#include "mozilla/dom/NodeInfo.h"
 #include "nsIServiceManager.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
-#include "mozilla/dom/Element.h"
-#include "mozilla/dom/FromParser.h"
 
 //#define DEBUG_REFLOW
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 class nsDocElementBoxFrame final : public nsBoxFrame,
                                    public nsIAnonymousContentCreator {
  public:
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
 
-  friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                                   ComputedStyle* aStyle);
 
   explicit nsDocElementBoxFrame(ComputedStyle* aStyle,
                                 nsPresContext* aPresContext)
       : nsBoxFrame(aStyle, aPresContext, kClassID, true) {}
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsDocElementBoxFrame)
@@ -60,17 +60,17 @@ class nsDocElementBoxFrame final : publi
 #endif
  private:
   nsCOMPtr<Element> mPopupgroupContent;
   nsCOMPtr<Element> mTooltipContent;
 };
 
 //----------------------------------------------------------------------
 
-nsContainerFrame* NS_NewDocElementBoxFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewDocElementBoxFrame(PresShell* aPresShell,
                                            ComputedStyle* aStyle) {
   return new (aPresShell)
       nsDocElementBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsDocElementBoxFrame)
 
 void nsDocElementBoxFrame::DestroyFrom(nsIFrame* aDestructRoot,
--- a/layout/xul/nsGroupBoxFrame.cpp
+++ b/layout/xul/nsGroupBoxFrame.cpp
@@ -4,20 +4,21 @@
  * 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/. */
 
 // YY need to pass isMultiple before create called
 
 #include "nsBoxFrame.h"
 
 #include "gfxContext.h"
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/gfx/2D.h"
 #include "nsCSSRendering.h"
 #include "nsLayoutUtils.h"
-#include "mozilla/ComputedStyle.h"
 #include "nsDisplayList.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 class nsGroupBoxFrame final : public nsBoxFrame {
  public:
@@ -81,17 +82,17 @@ public:
 #endif
 
   // we are always flexible
   virtual bool GetDefaultFlex(int32_t& aFlex) { aFlex = 1; return true; }
 
 };
 */
 
-nsIFrame* NS_NewGroupBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewGroupBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsGroupBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsGroupBoxFrame)
 
 class nsDisplayXULGroupBorder final : public nsDisplayItem {
  public:
   nsDisplayXULGroupBorder(nsDisplayListBuilder* aBuilder,
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -115,17 +115,17 @@ static void FireImageDOMEvent(nsIContent
   }
 }
 
 //
 // NS_NewImageBoxFrame
 //
 // Creates a new image frame and returns it
 //
-nsIFrame* NS_NewImageBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewImageBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsImageBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsImageBoxFrame)
 NS_QUERYFRAME_HEAD(nsImageBoxFrame)
   NS_QUERYFRAME_ENTRY(nsImageBoxFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame)
 
--- a/layout/xul/nsImageBoxFrame.h
+++ b/layout/xul/nsImageBoxFrame.h
@@ -13,16 +13,20 @@
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 
 class imgRequestProxy;
 class nsImageBoxFrame;
 
 class nsDisplayXULImage;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsImageBoxListener final : public imgINotificationObserver {
  public:
   explicit nsImageBoxListener(nsImageBoxFrame* frame);
 
   NS_DECL_ISUPPORTS
   NS_DECL_IMGINOTIFICATIONOBSERVER
 
   void ClearFrame() { mFrame = nullptr; }
@@ -45,17 +49,17 @@ class nsImageBoxFrame final : public nsL
 
   virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
   virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
   virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
   virtual void MarkIntrinsicISizesDirty() override;
 
   nsresult Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
 
-  friend nsIFrame* NS_NewImageBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewImageBoxFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* asPrevInFlow) override;
 
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ b/layout/xul/nsLeafBoxFrame.cpp
@@ -6,39 +6,40 @@
 
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "nsLeafBoxFrame.h"
 #include "nsBoxFrame.h"
 #include "nsCOMPtr.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
-#include "mozilla/ComputedStyle.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(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+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
  */
--- a/layout/xul/nsLeafBoxFrame.h
+++ b/layout/xul/nsLeafBoxFrame.h
@@ -5,21 +5,25 @@
  * 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"
 #include "nsBox.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsLeafBoxFrame : public nsLeafFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsLeafBoxFrame)
 
-  friend nsIFrame* NS_NewLeafBoxFrame(nsIPresShell* aPresShell,
+  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 GetXULFlex() override;
   virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aState) override;
 
--- a/layout/xul/nsMenuBarFrame.cpp
+++ b/layout/xul/nsMenuBarFrame.cpp
@@ -4,45 +4,46 @@
  * 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 "nsMenuBarFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIContent.h"
 #include "nsAtom.h"
 #include "nsPresContext.h"
-#include "mozilla/ComputedStyle.h"
 #include "nsCSSRendering.h"
 #include "nsNameSpaceManager.h"
-#include "mozilla/dom/Document.h"
 #include "nsGkAtoms.h"
 #include "nsMenuFrame.h"
 #include "nsMenuPopupFrame.h"
 #include "nsUnicharUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsCSSFrameConstructor.h"
 #ifdef XP_WIN
 #  include "nsISound.h"
 #  include "nsWidgetsCID.h"
 #endif
 #include "nsUTF8Utils.h"
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/TextEvents.h"
+#include "mozilla/dom/Document.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/KeyboardEvent.h"
 
 using namespace mozilla;
 using mozilla::dom::KeyboardEvent;
 
 //
 // NS_NewMenuBarFrame
 //
 // Wrapper for creating a new menu Bar container
 //
-nsIFrame* NS_NewMenuBarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewMenuBarFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsMenuBarFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMenuBarFrame)
 
 NS_QUERYFRAME_HEAD(nsMenuBarFrame)
   NS_QUERYFRAME_ENTRY(nsMenuBarFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
--- a/layout/xul/nsMenuBarFrame.h
+++ b/layout/xul/nsMenuBarFrame.h
@@ -17,22 +17,23 @@
 #include "nsBoxFrame.h"
 #include "nsMenuFrame.h"
 #include "nsMenuBarListener.h"
 #include "nsMenuParent.h"
 
 class nsIContent;
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 class KeyboardEvent;
 }  // namespace dom
 }  // namespace mozilla
 
-nsIFrame* NS_NewMenuBarFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMenuBarFrame(mozilla::PresShell* aPresShell,
                              mozilla::ComputedStyle* aStyle);
 
 class nsMenuBarFrame final : public nsBoxFrame, public nsMenuParent {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsMenuBarFrame)
 
   explicit nsMenuBarFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -136,24 +136,24 @@ class nsMenuAttributeChangedEvent : publ
   RefPtr<nsAtom> mAttr;
 };
 
 //
 // NS_NewMenuFrame and NS_NewMenuItemFrame
 //
 // Wrappers for creating a new menu popup container
 //
-nsIFrame* NS_NewMenuFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewMenuFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   nsMenuFrame* it =
       new (aPresShell) nsMenuFrame(aStyle, aPresShell->GetPresContext());
   it->SetIsMenu(true);
   return it;
 }
 
-nsIFrame* NS_NewMenuItemFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewMenuItemFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   nsMenuFrame* it =
       new (aPresShell) nsMenuFrame(aStyle, aPresShell->GetPresContext());
   it->SetIsMenu(false);
   return it;
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMenuFrame)
 
--- a/layout/xul/nsMenuFrame.h
+++ b/layout/xul/nsMenuFrame.h
@@ -19,18 +19,23 @@
 #include "nsGkAtoms.h"
 #include "nsMenuParent.h"
 #include "nsXULPopupManager.h"
 #include "nsINamed.h"
 #include "nsIReflowCallback.h"
 #include "nsITimer.h"
 #include "mozilla/Attributes.h"
 
-nsIFrame* NS_NewMenuFrame(nsIPresShell* aPresShell, mozilla::ComputedStyle*);
-nsIFrame* NS_NewMenuItemFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewMenuFrame(mozilla::PresShell* aPresShell,
+                          mozilla::ComputedStyle*);
+nsIFrame* NS_NewMenuItemFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle*);
 
 class nsIContent;
 
 namespace mozilla {
 namespace dom {
 class Element;
 }  // namespace dom
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -74,18 +74,17 @@ uint32_t nsMenuPopupFrame::sTimeoutOfInc
 
 const char kPrefIncrementalSearchTimeout[] =
     "ui.menu.incremental_search.timeout";
 
 // NS_NewMenuPopupFrame
 //
 // Wrapper for creating a new menu popup container
 //
-nsIFrame* NS_NewMenuPopupFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewMenuPopupFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsMenuPopupFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMenuPopupFrame)
 
 NS_QUERYFRAME_HEAD(nsMenuPopupFrame)
   NS_QUERYFRAME_ENTRY(nsMenuPopupFrame)
--- a/layout/xul/nsMenuPopupFrame.h
+++ b/layout/xul/nsMenuPopupFrame.h
@@ -24,16 +24,17 @@
 
 #include "nsITimer.h"
 
 #include "Units.h"
 
 class nsIWidget;
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 class KeyboardEvent;
 }  // namespace dom
 }  // namespace mozilla
 
 // XUL popups can be in several different states. When opening a popup, the
 // state changes as follows:
 //   ePopupClosed - initial state
@@ -132,17 +133,17 @@ enum MenuPopupAnchorType {
 #define POPUPPOSITION_ENDAFTER 7
 #define POPUPPOSITION_OVERLAP 8
 #define POPUPPOSITION_AFTERPOINTER 9
 #define POPUPPOSITION_SELECTION 10
 
 #define POPUPPOSITION_HFLIP(v) (v ^ 1)
 #define POPUPPOSITION_VFLIP(v) (v ^ 2)
 
-nsIFrame* NS_NewMenuPopupFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewMenuPopupFrame(mozilla::PresShell* aPresShell,
                                mozilla::ComputedStyle* aStyle);
 
 class nsView;
 class nsMenuPopupFrame;
 
 // this class is used for dispatching popupshown events asynchronously.
 class nsXULPopupShownEvent final : public mozilla::Runnable,
                                    public nsIDOMEventListener {
--- a/layout/xul/nsPopupSetFrame.cpp
+++ b/layout/xul/nsPopupSetFrame.cpp
@@ -13,17 +13,17 @@
 #include "mozilla/PresShell.h"
 #include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
 #include "nsIPopupContainer.h"
 #include "nsMenuPopupFrame.h"
 
 typedef mozilla::ComputedStyle ComputedStyle;
 
-nsIFrame* NS_NewPopupSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewPopupSetFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsPopupSetFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPopupSetFrame)
 
 void nsPopupSetFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
                            nsIFrame* aPrevInFlow) {
   nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
--- a/layout/xul/nsPopupSetFrame.h
+++ b/layout/xul/nsPopupSetFrame.h
@@ -6,17 +6,21 @@
 
 #ifndef nsPopupSetFrame_h__
 #define nsPopupSetFrame_h__
 
 #include "mozilla/Attributes.h"
 #include "nsAtom.h"
 #include "nsBoxFrame.h"
 
-nsIFrame* NS_NewPopupSetFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewPopupSetFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle* aStyle);
 
 class nsPopupSetFrame final : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsPopupSetFrame)
 
   explicit nsPopupSetFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsBoxFrame(aStyle, aPresContext, kClassID) {}
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -33,17 +33,17 @@
 
 using namespace mozilla;
 
 //
 // NS_NewResizerFrame
 //
 // Creates a new Resizer frame and returns it
 //
-nsIFrame* NS_NewResizerFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewResizerFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsResizerFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsResizerFrame)
 
 nsResizerFrame::nsResizerFrame(ComputedStyle* aStyle,
                                nsPresContext* aPresContext)
     : nsTitleBarFrame(aStyle, aPresContext, kClassID) {}
--- a/layout/xul/nsResizerFrame.h
+++ b/layout/xul/nsResizerFrame.h
@@ -7,30 +7,34 @@
 #define nsResizerFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsTitleBarFrame.h"
 
 class nsIBaseWindow;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsResizerFrame final : public nsTitleBarFrame {
  protected:
   typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
   typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
 
   struct Direction {
     int8_t mHorizontal;
     int8_t mVertical;
   };
 
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsResizerFrame)
 
-  friend nsIFrame* NS_NewResizerFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewResizerFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
   explicit nsResizerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
 
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
 
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -10,16 +10,17 @@
 #include "nsIPresShell.h"
 #include "nsBoxFrame.h"
 #include "nsDisplayList.h"
 #include "nsStackLayout.h"
 #include "nsIPopupContainer.h"
 #include "nsIContent.h"
 #include "nsFrameManager.h"
 #include "mozilla/BasicEvents.h"
+#include "mozilla/PresShell.h"
 
 using namespace mozilla;
 
 // Interface IDs
 
 //#define DEBUG_REFLOW
 
 // static
@@ -46,17 +47,17 @@ nsIPopupContainer* nsIPopupContainer::Ge
     rootBox = do_QueryFrame(rootFrame);
   }
 
   return rootBox;
 }
 
 class nsRootBoxFrame final : public nsBoxFrame, public nsIPopupContainer {
  public:
-  friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewBoxFrame(mozilla::PresShell* aPresShell,
                                   ComputedStyle* aStyle);
 
   explicit nsRootBoxFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsRootBoxFrame)
 
   virtual nsPopupSetFrame* GetPopupSetFrame() override;
@@ -94,17 +95,17 @@ class nsRootBoxFrame final : public nsBo
   nsPopupSetFrame* mPopupSetFrame;
 
  protected:
   Element* mDefaultTooltip;
 };
 
 //----------------------------------------------------------------------
 
-nsContainerFrame* NS_NewRootBoxFrame(nsIPresShell* aPresShell,
+nsContainerFrame* NS_NewRootBoxFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell) nsRootBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRootBoxFrame)
 
 nsRootBoxFrame::nsRootBoxFrame(ComputedStyle* aStyle,
                                nsPresContext* aPresContext)
--- a/layout/xul/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/nsScrollbarButtonFrame.cpp
@@ -18,26 +18,27 @@
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsSliderFrame.h"
 #include "nsScrollbarFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsRepeatService.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
+#include "mozilla/PresShell.h"
 #include "mozilla/Telemetry.h"
 
 using namespace mozilla;
 
 //
 // NS_NewToolbarFrame
 //
 // Creates a new Toolbar frame and returns it
 //
-nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewScrollbarButtonFrame(PresShell* aPresShell,
                                      ComputedStyle* aStyle) {
   return new (aPresShell)
       nsScrollbarButtonFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame)
 
 nsresult nsScrollbarButtonFrame::HandleEvent(nsPresContext* aPresContext,
--- a/layout/xul/nsScrollbarButtonFrame.h
+++ b/layout/xul/nsScrollbarButtonFrame.h
@@ -14,30 +14,34 @@
 #ifndef nsScrollbarButtonFrame_h___
 #define nsScrollbarButtonFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsButtonBoxFrame.h"
 #include "nsITimer.h"
 #include "nsRepeatService.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsScrollbarButtonFrame final : public nsButtonBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame)
 
   explicit nsScrollbarButtonFrame(ComputedStyle* aStyle,
                                   nsPresContext* aPresContext)
       : nsButtonBoxFrame(aStyle, aPresContext, kClassID),
         mCursorOnThis(false) {}
 
   // Overrides
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
 
-  friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewScrollbarButtonFrame(mozilla::PresShell* aPresShell,
                                               ComputedStyle* aStyle);
 
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
 
   static nsresult GetChildWithTag(nsAtom* atom, nsIFrame* start,
                                   nsIFrame*& result);
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -26,18 +26,17 @@
 
 using namespace mozilla;
 
 //
 // NS_NewScrollbarFrame
 //
 // Creates a new scrollbar frame and returns it
 //
-nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell,
-                               ComputedStyle* aStyle) {
+nsIFrame* NS_NewScrollbarFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell)
       nsScrollbarFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsScrollbarFrame)
 
 NS_QUERYFRAME_HEAD(nsScrollbarFrame)
   NS_QUERYFRAME_ENTRY(nsScrollbarFrame)
--- a/layout/xul/nsScrollbarFrame.h
+++ b/layout/xul/nsScrollbarFrame.h
@@ -12,17 +12,21 @@
 #define nsScrollbarFrame_h__
 
 #include "mozilla/Attributes.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsBoxFrame.h"
 
 class nsIScrollbarMediator;
 
-nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewScrollbarFrame(mozilla::PresShell* aPresShell,
                                mozilla::ComputedStyle* aStyle);
 
 class nsScrollbarFrame final : public nsBoxFrame,
                                public nsIAnonymousContentCreator {
  public:
   explicit nsScrollbarFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsBoxFrame(aStyle, aPresContext, kClassID),
         mIncrement(0),
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -63,17 +63,17 @@ int32_t nsSliderFrame::gSnapMultiplier;
 // Turn this on if you want to debug slider frames.
 #undef DEBUG_SLIDER
 
 static already_AddRefed<nsIContent> GetContentOfBox(nsIFrame* aBox) {
   nsCOMPtr<nsIContent> content = aBox->GetContent();
   return content.forget();
 }
 
-nsIFrame* NS_NewSliderFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSliderFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSliderFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSliderFrame)
 
 NS_QUERYFRAME_HEAD(nsSliderFrame)
   NS_QUERYFRAME_ENTRY(nsSliderFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
--- a/layout/xul/nsSliderFrame.h
+++ b/layout/xul/nsSliderFrame.h
@@ -13,17 +13,21 @@
 #include "nsAtom.h"
 #include "nsCOMPtr.h"
 #include "nsITimer.h"
 #include "nsIDOMEventListener.h"
 
 class nsITimer;
 class nsSliderFrame;
 
-nsIFrame* NS_NewSliderFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewSliderFrame(mozilla::PresShell* aPresShell,
                             mozilla::ComputedStyle* aStyle);
 
 class nsSliderMediator final : public nsIDOMEventListener {
  public:
   NS_DECL_ISUPPORTS
 
   nsSliderFrame* mSlider;
 
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -190,17 +190,17 @@ nsSplitterFrameInner::State nsSplitterFr
   return Open;
 }
 
 //
 // NS_NewSplitterFrame
 //
 // Creates a new Toolbar frame and returns it
 //
-nsIFrame* NS_NewSplitterFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewSplitterFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsSplitterFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSplitterFrame)
 
 nsSplitterFrame::nsSplitterFrame(ComputedStyle* aStyle,
                                  nsPresContext* aPresContext)
     : nsBoxFrame(aStyle, aPresContext, kClassID), mInner(0) {}
--- a/layout/xul/nsSplitterFrame.h
+++ b/layout/xul/nsSplitterFrame.h
@@ -11,17 +11,21 @@
 #ifndef nsSplitterFrame_h__
 #define nsSplitterFrame_h__
 
 #include "mozilla/Attributes.h"
 #include "nsBoxFrame.h"
 
 class nsSplitterFrameInner;
 
-nsIFrame* NS_NewSplitterFrame(nsIPresShell* aPresShell,
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
+nsIFrame* NS_NewSplitterFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle* aStyle);
 
 class nsSplitterFrame final : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsSplitterFrame)
 
   explicit nsSplitterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
--- a/layout/xul/nsStackFrame.cpp
+++ b/layout/xul/nsStackFrame.cpp
@@ -7,29 +7,31 @@
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
 #include "nsStackFrame.h"
+
 #include "mozilla/ComputedStyle.h"
+#include "mozilla/PresShell.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
 #include "nsBoxLayoutState.h"
 #include "nsStackLayout.h"
 #include "nsDisplayList.h"
 
 using namespace mozilla;
 
-nsIFrame* NS_NewStackFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewStackFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsStackFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsStackFrame)
 
 nsStackFrame::nsStackFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     : nsBoxFrame(aStyle, aPresContext, kClassID) {
   nsCOMPtr<nsBoxLayout> layout;
--- a/layout/xul/nsStackFrame.h
+++ b/layout/xul/nsStackFrame.h
@@ -13,21 +13,25 @@ one time. So the can be flipped though l
 **/
 
 #ifndef nsStackFrame_h___
 #define nsStackFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsBoxFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsStackFrame final : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsStackFrame)
 
-  friend nsIFrame* NS_NewStackFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewStackFrame(mozilla::PresShell* aPresShell,
                                     ComputedStyle* aStyle);
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override {
     return MakeFrameName(NS_LITERAL_STRING("Stack"), aResult);
   }
 #endif
 
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -54,17 +54,17 @@ class nsAccessKeyInfo {
   nscoord mBeforeWidth, mAccessWidth, mAccessUnderlineSize, mAccessOffset;
 };
 
 bool nsTextBoxFrame::gAlwaysAppendAccessKey = false;
 bool nsTextBoxFrame::gAccessKeyPrefInitialized = false;
 bool nsTextBoxFrame::gInsertSeparatorBeforeAccessKey = false;
 bool nsTextBoxFrame::gInsertSeparatorPrefInitialized = false;
 
-nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewTextBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTextBoxFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTextBoxFrame)
 
 NS_QUERYFRAME_HEAD(nsTextBoxFrame)
   NS_QUERYFRAME_ENTRY(nsTextBoxFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame)
--- a/layout/xul/nsTextBoxFrame.h
+++ b/layout/xul/nsTextBoxFrame.h
@@ -8,30 +8,34 @@
 
 #include "mozilla/Attributes.h"
 #include "nsLeafBoxFrame.h"
 
 class nsAccessKeyInfo;
 class nsAsyncAccesskeyUpdate;
 class nsFontMetrics;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsTextBoxFrame final : public nsLeafBoxFrame {
  public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS(nsTextBoxFrame)
 
   virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
   virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
   virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
   virtual void MarkIntrinsicISizesDirty() override;
 
   enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter, CropAuto };
 
-  friend nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewTextBoxFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* asPrevInFlow) override;
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
 
--- a/layout/xul/nsTitleBarFrame.cpp
+++ b/layout/xul/nsTitleBarFrame.cpp
@@ -22,17 +22,17 @@
 
 using namespace mozilla;
 
 //
 // NS_NewTitleBarFrame
 //
 // Creates a new TitleBar frame and returns it
 //
-nsIFrame* NS_NewTitleBarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewTitleBarFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTitleBarFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTitleBarFrame)
 
 nsTitleBarFrame::nsTitleBarFrame(ComputedStyle* aStyle,
                                  nsPresContext* aPresContext, ClassID aID)
     : nsBoxFrame(aStyle, aPresContext, aID, false) {
--- a/layout/xul/nsTitleBarFrame.h
+++ b/layout/xul/nsTitleBarFrame.h
@@ -5,21 +5,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsTitleBarFrame_h___
 #define nsTitleBarFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsBoxFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsTitleBarFrame : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTitleBarFrame)
 
-  friend nsIFrame* NS_NewTitleBarFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewTitleBarFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
   explicit nsTitleBarFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                            ClassID = kClassID);
 
   virtual void BuildDisplayListForChildren(
       nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) override;
 
--- a/layout/xul/nsXULLabelFrame.cpp
+++ b/layout/xul/nsXULLabelFrame.cpp
@@ -1,24 +1,26 @@
 /* -*- 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/. */
 
 /* derived class of nsBlockFrame used for xul:label elements */
 
+#include "nsXULLabelFrame.h"
+
 #include "mozilla/EventStateManager.h"
-#include "nsXULLabelFrame.h"
+#include "mozilla/PresShell.h"
 #include "nsHTMLParts.h"
 #include "nsNameSpaceManager.h"
 
 using namespace mozilla;
 
-nsIFrame* NS_NewXULLabelFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewXULLabelFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   nsXULLabelFrame* it =
       new (aPresShell) nsXULLabelFrame(aStyle, aPresShell->GetPresContext());
   it->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
   return it;
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsXULLabelFrame)
 
--- a/layout/xul/nsXULLabelFrame.h
+++ b/layout/xul/nsXULLabelFrame.h
@@ -7,21 +7,25 @@
 /* derived class of nsBlockFrame used for xul:label elements */
 
 #ifndef nsXULLabelFrame_h_
 #define nsXULLabelFrame_h_
 
 #include "mozilla/Attributes.h"
 #include "nsBlockFrame.h"
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 class nsXULLabelFrame final : public nsBlockFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsXULLabelFrame)
 
-  friend nsIFrame* NS_NewXULLabelFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewXULLabelFrame(mozilla::PresShell* aPresShell,
                                        ComputedStyle* aStyle);
 
   // nsIFrame
   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
                     nsIFrame* aPrevInFlow) override;
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot,
                            PostDestroyData& aPostDestroyData) override;
@@ -35,12 +39,12 @@ class nsXULLabelFrame final : public nsB
 
  protected:
   explicit nsXULLabelFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsBlockFrame(aStyle, aPresContext, kClassID) {}
 
   nsresult RegUnregAccessKey(bool aDoReg);
 };
 
-nsIFrame* NS_NewXULLabelFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewXULLabelFrame(mozilla::PresShell* aPresShell,
                               mozilla::ComputedStyle* aStyle);
 
 #endif /* !defined(nsXULLabelFrame_h_) */
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -91,17 +91,17 @@ void nsTreeBodyFrame::CancelImageRequest
   }
 }
 
 //
 // NS_NewTreeFrame
 //
 // Creates a new tree frame
 //
-nsIFrame* NS_NewTreeBodyFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewTreeBodyFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTreeBodyFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTreeBodyFrame)
 
 NS_QUERYFRAME_HEAD(nsTreeBodyFrame)
   NS_QUERYFRAME_ENTRY(nsIScrollbarMediator)
   NS_QUERYFRAME_ENTRY(nsTreeBodyFrame)
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -25,16 +25,17 @@
 #include "nsThreadUtils.h"
 #include "mozilla/LookAndFeel.h"
 
 class nsFontMetrics;
 class nsOverflowChecker;
 class nsTreeImageListener;
 
 namespace mozilla {
+class PresShell;
 namespace layout {
 class ScrollbarActivity;
 }  // namespace layout
 }  // namespace mozilla
 
 // An entry in the tree's image cache
 struct nsTreeImageCacheEntry {
   nsTreeImageCacheEntry() = default;
@@ -162,17 +163,17 @@ class nsTreeBodyFrame final : public nsL
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
   virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
 
-  friend nsIFrame* NS_NewTreeBodyFrame(nsIPresShell* aPresShell);
+  friend nsIFrame* NS_NewTreeBodyFrame(mozilla::PresShell* aPresShell);
   friend class nsTreeColumn;
 
   struct ScrollParts {
     nsScrollbarFrame* mVScrollbar;
     RefPtr<Element> mVScrollbarContent;
     nsScrollbarFrame* mHScrollbar;
     RefPtr<Element> mHScrollbarContent;
     nsIFrame* mColumnsFrame;
--- a/layout/xul/tree/nsTreeColFrame.cpp
+++ b/layout/xul/tree/nsTreeColFrame.cpp
@@ -1,36 +1,38 @@
 /* -*- 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 "nsTreeColFrame.h"
+
+#include "mozilla/ComputedStyle.h"
+#include "mozilla/ErrorResult.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/dom/XULTreeElement.h"
 #include "nsCOMPtr.h"
-#include "nsTreeColFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
-#include "mozilla/ComputedStyle.h"
 #include "nsNameSpaceManager.h"
-#include "mozilla/ErrorResult.h"
 #include "nsTreeColumns.h"
 #include "nsDisplayList.h"
 #include "nsTreeBodyFrame.h"
 #include "nsXULElement.h"
-#include "mozilla/dom/XULTreeElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //
 // NS_NewTreeColFrame
 //
 // Creates a new col frame
 //
-nsIFrame* NS_NewTreeColFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
+nsIFrame* NS_NewTreeColFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
   return new (aPresShell) nsTreeColFrame(aStyle, aPresShell->GetPresContext());
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTreeColFrame)
 
 // Destructor
 nsTreeColFrame::~nsTreeColFrame() {}
 
--- a/layout/xul/tree/nsTreeColFrame.h
+++ b/layout/xul/tree/nsTreeColFrame.h
@@ -4,22 +4,23 @@
  * 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/ComputedStyle.h"
 #include "nsBoxFrame.h"
 
 namespace mozilla {
+class PresShell;
 namespace dom {
 class XULTreeElement;
 }
 }  // namespace mozilla
 
-nsIFrame* NS_NewTreeColFrame(nsIPresShell* aPresShell,
+nsIFrame* NS_NewTreeColFrame(mozilla::PresShell* aPresShell,
                              mozilla::ComputedStyle* aStyle);
 
 class nsTreeColFrame final : public nsBoxFrame {
  public:
   NS_DECL_FRAMEARENA_HELPERS(nsTreeColFrame)
 
   explicit nsTreeColFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
       : nsBoxFrame(aStyle, aPresContext, kClassID) {}
@@ -35,17 +36,17 @@ class nsTreeColFrame final : public nsBo
 
   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
                                     int32_t aModType) override;
 
   virtual void SetXULBounds(nsBoxLayoutState& aBoxLayoutState,
                             const nsRect& aRect,
                             bool aRemoveOverflowArea = false) override;
 
-  friend nsIFrame* NS_NewTreeColFrame(nsIPresShell* aPresShell,
+  friend nsIFrame* NS_NewTreeColFrame(mozilla::PresShell* aPresShell,
                                       ComputedStyle* aStyle);
 
  protected:
   virtual ~nsTreeColFrame();
 
   /**
    * @return the tree that this column belongs to, or nullptr.
    */