Bug 1544343 - part 1: Make nsFrameManager, nsCSSFrameConstructor and nsFrameConstructorState use mozilla::PresShell directly rather than via nsIPresShell r=emilio
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 16 Apr 2019 07:24:29 +0000
changeset 469630 cfd46a25af71
parent 469629 3fd42eb67a3f
child 469631 4b56de3cd46c
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 1: Make nsFrameManager, nsCSSFrameConstructor and nsFrameConstructorState use mozilla::PresShell directly rather than via nsIPresShell r=emilio Differential Revision: https://phabricator.services.mozilla.com/D27475
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsFrameManager.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -685,17 +685,17 @@ struct PendingBinding : public LinkedLis
 
 // Structure used for maintaining state information during the
 // frame construction process
 class MOZ_STACK_CLASS nsFrameConstructorState {
  public:
   typedef nsIFrame::ChildListID ChildListID;
 
   nsPresContext* mPresContext;
-  nsIPresShell* mPresShell;
+  PresShell* mPresShell;
   nsFrameManager* mFrameManager;
 
 #ifdef MOZ_XUL
   // Frames destined for the kPopupList.
   AbsoluteFrameList mPopupList;
 #endif
 
   // Containing block information for out-of-flow frames.
@@ -736,22 +736,22 @@ class MOZ_STACK_CLASS nsFrameConstructor
   // mode).
   bool mCreatingExtraFrames;
 
   nsCOMArray<nsIContent> mGeneratedTextNodesWithInitializer;
 
   // Constructor
   // Use the passed-in history state.
   nsFrameConstructorState(
-      nsIPresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
+      PresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
       nsContainerFrame* aAbsoluteContainingBlock,
       nsContainerFrame* aFloatContainingBlock,
       already_AddRefed<nsILayoutHistoryState> aHistoryState);
   // Get the history state from the pres context's pres shell.
-  nsFrameConstructorState(nsIPresShell* aPresShell,
+  nsFrameConstructorState(PresShell* aPresShell,
                           nsContainerFrame* aFixedContainingBlock,
                           nsContainerFrame* aAbsoluteContainingBlock,
                           nsContainerFrame* aFloatContainingBlock);
 
   ~nsFrameConstructorState();
 
   // Process the frame insertions for all the out-of-flow nsAbsoluteItems.
   void ProcessFrameInsertionsForAllLists();
@@ -900,17 +900,17 @@ class MOZ_STACK_CLASS nsFrameConstructor
   // Our list of all pending bindings.  When we're done, we need to call
   // AddToAttachedQueue on all of them, in order.
   LinkedList<PendingBinding> mPendingBindings;
 
   PendingBinding* mCurrentPendingBindingInsertionPoint;
 };
 
 nsFrameConstructorState::nsFrameConstructorState(
-    nsIPresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
+    PresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
     nsContainerFrame* aAbsoluteContainingBlock,
     nsContainerFrame* aFloatContainingBlock,
     already_AddRefed<nsILayoutHistoryState> aHistoryState)
     : mPresContext(aPresShell->GetPresContext()),
       mPresShell(aPresShell),
       mFrameManager(aPresShell->FrameConstructor()),
 #ifdef MOZ_XUL
       mPopupList(nullptr),
@@ -938,17 +938,17 @@ nsFrameConstructorState::nsFrameConstruc
   if (popupContainer) {
     mPopupList.containingBlock = popupContainer->GetPopupSetFrame();
   }
 #endif
   MOZ_COUNT_CTOR(nsFrameConstructorState);
 }
 
 nsFrameConstructorState::nsFrameConstructorState(
-    nsIPresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
+    PresShell* aPresShell, nsContainerFrame* aFixedContainingBlock,
     nsContainerFrame* aAbsoluteContainingBlock,
     nsContainerFrame* aFloatContainingBlock)
     : nsFrameConstructorState(
           aPresShell, aFixedContainingBlock, aAbsoluteContainingBlock,
           aFloatContainingBlock,
           aPresShell->GetDocument()->GetLayoutHistoryState()) {}
 
 nsFrameConstructorState::~nsFrameConstructorState() {
@@ -1465,17 +1465,17 @@ static bool ShouldCreateImageFrameForCon
   }
 
   return content.ContentAt(0).GetType() == StyleContentType::Image;
 }
 
 //----------------------------------------------------------------------
 
 nsCSSFrameConstructor::nsCSSFrameConstructor(Document* aDocument,
-                                             nsIPresShell* aPresShell)
+                                             PresShell* aPresShell)
     : nsFrameManager(aPresShell),
       mDocument(aDocument),
       mRootElementFrame(nullptr),
       mRootElementStyleFrame(nullptr),
       mDocElementContainingBlock(nullptr),
       mPageSequenceFrame(nullptr),
       mFirstFreeFCItem(nullptr),
       mFCItemsInUse(0),
@@ -2732,17 +2732,17 @@ void nsCSSFrameConstructor::ConstructAno
 
   nsFrameList frameList;
   ConstructFramesFromItemList(aState, itemsToConstruct, frameAsContainer,
                               /* aParentIsWrapperAnonBox = */ false, frameList);
   frameAsContainer->AppendFrames(kPrincipalList, frameList);
 }
 
 nsContainerFrame* nsCSSFrameConstructor::ConstructPageFrame(
-    nsIPresShell* aPresShell, nsContainerFrame* aParentFrame,
+    PresShell* aPresShell, nsContainerFrame* aParentFrame,
     nsIFrame* aPrevPageFrame, nsContainerFrame*& aCanvasFrame) {
   ComputedStyle* parentComputedStyle = aParentFrame->Style();
   ServoStyleSet* styleSet = aPresShell->StyleSet();
 
   RefPtr<ComputedStyle> pagePseudoStyle;
   pagePseudoStyle = styleSet->ResolveInheritingAnonymousBoxStyle(
       PseudoStyleType::page, parentComputedStyle);
 
@@ -2788,17 +2788,17 @@ nsContainerFrame* nsCSSFrameConstructor:
   }
   aCanvasFrame->Init(nullptr, pageContentFrame, prevCanvasFrame);
   SetInitialSingleChild(pageContentFrame, aCanvasFrame);
   return pageFrame;
 }
 
 /* static */
 nsIFrame* nsCSSFrameConstructor::CreatePlaceholderFrameFor(
-    nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* aFrame,
+    PresShell* aPresShell, nsIContent* aContent, nsIFrame* aFrame,
     nsContainerFrame* aParentFrame, nsIFrame* aPrevInFlow,
     nsFrameState aTypeBit) {
   RefPtr<ComputedStyle> placeholderStyle =
       aPresShell->StyleSet()->ResolveStyleForPlaceholder();
 
   // The placeholder frame gets a pseudo style.
   nsPlaceholderFrame* placeholderFrame =
       NS_NewPlaceholderFrame(aPresShell, placeholderStyle, aTypeBit);
@@ -6330,17 +6330,17 @@ nsContainerFrame* nsCSSFrameConstructor:
   return insertionFrame;
 }
 
 static bool IsSpecialFramesetChild(nsIContent* aContent) {
   // IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init.
   return aContent->IsAnyOfHTMLElements(nsGkAtoms::frameset, nsGkAtoms::frame);
 }
 
-static void InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node);
+static void InvalidateCanvasIfNeeded(PresShell* aPresShell, nsIContent* aNode);
 
 void nsCSSFrameConstructor::AddTextItemIfNeeded(
     nsFrameConstructorState& aState, const InsertionPoint& aInsertion,
     nsIContent* aPossibleTextContent, FrameConstructionItemList& aItems) {
   MOZ_ASSERT(aPossibleTextContent, "Must have node");
   if (!aPossibleTextContent->IsText() ||
       !aPossibleTextContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) ||
       aPossibleTextContent->HasFlag(NODE_NEEDS_FRAME)) {
@@ -7738,45 +7738,44 @@ bool nsCSSFrameConstructor::ContentRemov
 /**
  * This method invalidates the canvas when frames are removed or added for a
  * node that might have its background propagated to the canvas, i.e., a
  * document root node or an HTML BODY which is a child of the root node.
  *
  * @param aFrame a frame for a content node about to be removed or a frame that
  *               was just created for a content node that was inserted.
  */
-static void InvalidateCanvasIfNeeded(nsIPresShell* presShell,
-                                     nsIContent* node) {
-  MOZ_ASSERT(presShell->GetRootFrame(), "What happened here?");
-  MOZ_ASSERT(presShell->GetPresContext(), "Say what?");
+static void InvalidateCanvasIfNeeded(PresShell* aPresShell, nsIContent* aNode) {
+  MOZ_ASSERT(aPresShell->GetRootFrame(), "What happened here?");
+  MOZ_ASSERT(aPresShell->GetPresContext(), "Say what?");
 
   //  Note that both in ContentRemoved and ContentInserted the content node
   //  will still have the right parent pointer, so looking at that is ok.
 
-  nsIContent* parent = node->GetParent();
+  nsIContent* parent = aNode->GetParent();
   if (parent) {
     // Has a parent; might not be what we want
     nsIContent* grandParent = parent->GetParent();
     if (grandParent) {
       // Has a grandparent, so not what we want
       return;
     }
 
     // Check whether it's an HTML body
-    if (!node->IsHTMLElement(nsGkAtoms::body)) {
+    if (!aNode->IsHTMLElement(nsGkAtoms::body)) {
       return;
     }
   }
 
   // At this point the node has no parent or it's an HTML <body> child of the
   // root.  We might not need to invalidate in this case (eg we might be in
   // XHTML or something), but chances are we want to.  Play it safe.
   // Invalidate the viewport.
 
-  nsIFrame* rootFrame = presShell->GetRootFrame();
+  nsIFrame* rootFrame = aPresShell->GetRootFrame();
   rootFrame->InvalidateFrameSubtree();
 }
 
 bool nsCSSFrameConstructor::EnsureFrameForTextNodeIsCreatedAfterFlush(
     CharacterData* aContent) {
   if (!aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) {
     return false;
   }
@@ -7921,17 +7920,17 @@ void nsCSSFrameConstructor::GetAlternate
     // If there's no "value" attribute either, then use the localized string for
     // "Submit" as the alternate text.
     nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                        "Submit", aAltText);
   }
 }
 
 nsIFrame* nsCSSFrameConstructor::CreateContinuingOuterTableFrame(
-    nsIPresShell* aPresShell, nsPresContext* aPresContext, nsIFrame* aFrame,
+    PresShell* aPresShell, nsPresContext* aPresContext, nsIFrame* aFrame,
     nsContainerFrame* aParentFrame, nsIContent* aContent,
     ComputedStyle* aComputedStyle) {
   nsTableWrapperFrame* newFrame =
       NS_NewTableWrapperFrame(aPresShell, aComputedStyle);
 
   newFrame->Init(aContent, aParentFrame, aFrame);
 
   // Create a continuing inner table frame, and if there's a caption then
@@ -7950,17 +7949,17 @@ nsIFrame* nsCSSFrameConstructor::CreateC
 
   // Set the table wrapper's initial child list
   newFrame->SetInitialChildList(kPrincipalList, newChildFrames);
 
   return newFrame;
 }
 
 nsIFrame* nsCSSFrameConstructor::CreateContinuingTableFrame(
-    nsIPresShell* aPresShell, nsIFrame* aFrame, nsContainerFrame* aParentFrame,
+    PresShell* aPresShell, nsIFrame* aFrame, nsContainerFrame* aParentFrame,
     nsIContent* aContent, ComputedStyle* aComputedStyle) {
   nsTableFrame* newFrame = NS_NewTableFrame(aPresShell, aComputedStyle);
 
   newFrame->Init(aContent, aParentFrame, aFrame);
 
   // Replicate any header/footer frames
   nsFrameList childFrames;
   for (nsIFrame* childFrame : aFrame->PrincipalChildList()) {
@@ -8011,70 +8010,70 @@ nsIFrame* nsCSSFrameConstructor::CreateC
   newFrame->SetInitialChildList(kPrincipalList, childFrames);
 
   return newFrame;
 }
 
 nsIFrame* nsCSSFrameConstructor::CreateContinuingFrame(
     nsPresContext* aPresContext, nsIFrame* aFrame,
     nsContainerFrame* aParentFrame, bool aIsFluid) {
-  nsIPresShell* shell = aPresContext->PresShell();
+  PresShell* presShell = aPresContext->PresShell();
   ComputedStyle* computedStyle = aFrame->Style();
   nsIFrame* newFrame = nullptr;
   nsIFrame* nextContinuation = aFrame->GetNextContinuation();
   nsIFrame* nextInFlow = aFrame->GetNextInFlow();
 
   // Use the frame type to determine what type of frame to create
   LayoutFrameType frameType = aFrame->Type();
   nsIContent* content = aFrame->GetContent();
 
   if (LayoutFrameType::Text == frameType) {
-    newFrame = NS_NewContinuingTextFrame(shell, computedStyle);
+    newFrame = NS_NewContinuingTextFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Inline == frameType) {
-    newFrame = NS_NewInlineFrame(shell, computedStyle);
+    newFrame = NS_NewInlineFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Block == frameType) {
     MOZ_ASSERT(!aFrame->IsTableCaption(),
                "no support for fragmenting table captions yet");
-    newFrame = NS_NewBlockFrame(shell, computedStyle);
+    newFrame = NS_NewBlockFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
 #ifdef MOZ_XUL
   } else if (LayoutFrameType::XULLabel == frameType) {
-    newFrame = NS_NewXULLabelFrame(shell, computedStyle);
+    newFrame = NS_NewXULLabelFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
 #endif
   } else if (LayoutFrameType::ColumnSetWrapper == frameType) {
     newFrame =
-        NS_NewColumnSetWrapperFrame(shell, computedStyle, nsFrameState(0));
+        NS_NewColumnSetWrapperFrame(presShell, computedStyle, nsFrameState(0));
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::ColumnSet == frameType) {
     MOZ_ASSERT(!aFrame->IsTableCaption(),
                "no support for fragmenting table captions yet");
-    newFrame = NS_NewColumnSetFrame(shell, computedStyle, nsFrameState(0));
+    newFrame = NS_NewColumnSetFrame(presShell, computedStyle, nsFrameState(0));
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Page == frameType) {
     nsContainerFrame* canvasFrame;
-    newFrame = ConstructPageFrame(shell, aParentFrame, aFrame, canvasFrame);
+    newFrame = ConstructPageFrame(presShell, aParentFrame, aFrame, canvasFrame);
   } else if (LayoutFrameType::TableWrapper == frameType) {
     newFrame = CreateContinuingOuterTableFrame(
-        shell, aPresContext, aFrame, aParentFrame, content, computedStyle);
+        presShell, aPresContext, aFrame, aParentFrame, content, computedStyle);
 
   } else if (LayoutFrameType::Table == frameType) {
-    newFrame = CreateContinuingTableFrame(shell, aFrame, aParentFrame, content,
-                                          computedStyle);
+    newFrame = CreateContinuingTableFrame(presShell, aFrame, aParentFrame,
+                                          content, computedStyle);
 
   } else if (LayoutFrameType::TableRowGroup == frameType) {
-    newFrame = NS_NewTableRowGroupFrame(shell, computedStyle);
+    newFrame = NS_NewTableRowGroupFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
     if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
       nsTableFrame::RegisterPositionedTablePart(newFrame);
     }
   } else if (LayoutFrameType::TableRow == frameType) {
-    nsTableRowFrame* rowFrame = NS_NewTableRowFrame(shell, computedStyle);
+    nsTableRowFrame* rowFrame = NS_NewTableRowFrame(presShell, computedStyle);
 
     rowFrame->Init(content, aParentFrame, aFrame);
     if (rowFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
       nsTableFrame::RegisterPositionedTablePart(rowFrame);
     }
 
     // Create a continuing frame for each table cell frame
     nsFrameList newChildList;
@@ -8094,45 +8093,45 @@ nsIFrame* nsCSSFrameConstructor::CreateC
 
   } else if (IsTableCell(frameType)) {
     // Warning: If you change this and add a wrapper frame around table cell
     // frames, make sure Bug 368554 doesn't regress!
     // See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
     nsTableFrame* tableFrame =
         static_cast<nsTableRowFrame*>(aParentFrame)->GetTableFrame();
     nsTableCellFrame* cellFrame =
-        NS_NewTableCellFrame(shell, computedStyle, tableFrame);
+        NS_NewTableCellFrame(presShell, computedStyle, tableFrame);
 
     cellFrame->Init(content, aParentFrame, aFrame);
     if (cellFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
       nsTableFrame::RegisterPositionedTablePart(cellFrame);
     }
 
     // Create a continuing area frame
     nsIFrame* blockFrame = aFrame->PrincipalChildList().FirstChild();
     nsIFrame* continuingBlockFrame = CreateContinuingFrame(
         aPresContext, blockFrame, static_cast<nsContainerFrame*>(cellFrame));
 
     SetInitialSingleChild(cellFrame, continuingBlockFrame);
     newFrame = cellFrame;
   } else if (LayoutFrameType::Line == frameType) {
-    newFrame = NS_NewFirstLineFrame(shell, computedStyle);
+    newFrame = NS_NewFirstLineFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Letter == frameType) {
-    newFrame = NS_NewFirstLetterFrame(shell, computedStyle);
+    newFrame = NS_NewFirstLetterFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Image == frameType) {
     auto* imageFrame = static_cast<nsImageFrame*>(aFrame);
-    newFrame = imageFrame->CreateContinuingFrame(shell, computedStyle);
+    newFrame = imageFrame->CreateContinuingFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::ImageControl == frameType) {
-    newFrame = NS_NewImageControlFrame(shell, computedStyle);
+    newFrame = NS_NewImageControlFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::FieldSet == frameType) {
-    nsContainerFrame* fieldset = NS_NewFieldSetFrame(shell, computedStyle);
+    nsContainerFrame* fieldset = NS_NewFieldSetFrame(presShell, computedStyle);
 
     fieldset->Init(content, aParentFrame, aFrame);
 
     // Create a continuing area frame
     // XXXbz we really shouldn't have to do this by hand!
     nsContainerFrame* blockFrame = GetFieldSetBlockFrame(aFrame);
     if (blockFrame) {
       nsIFrame* continuingBlockFrame =
@@ -8140,35 +8139,35 @@ nsIFrame* nsCSSFrameConstructor::CreateC
       // Set the fieldset's initial child list
       SetInitialSingleChild(fieldset, continuingBlockFrame);
     } else {
       MOZ_ASSERT(aFrame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER,
                  "FieldSet block may only be null for overflow containers");
     }
     newFrame = fieldset;
   } else if (LayoutFrameType::Legend == frameType) {
-    newFrame = NS_NewLegendFrame(shell, computedStyle);
+    newFrame = NS_NewLegendFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::FlexContainer == frameType) {
-    newFrame = NS_NewFlexContainerFrame(shell, computedStyle);
+    newFrame = NS_NewFlexContainerFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::GridContainer == frameType) {
-    newFrame = NS_NewGridContainerFrame(shell, computedStyle);
+    newFrame = NS_NewGridContainerFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Ruby == frameType) {
-    newFrame = NS_NewRubyFrame(shell, computedStyle);
+    newFrame = NS_NewRubyFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::RubyBaseContainer == frameType) {
-    newFrame = NS_NewRubyBaseContainerFrame(shell, computedStyle);
+    newFrame = NS_NewRubyBaseContainerFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::RubyTextContainer == frameType) {
-    newFrame = NS_NewRubyTextContainerFrame(shell, computedStyle);
+    newFrame = NS_NewRubyTextContainerFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Details == frameType) {
-    newFrame = NS_NewDetailsFrame(shell, computedStyle);
+    newFrame = NS_NewDetailsFrame(presShell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else {
     MOZ_CRASH("unexpected frame type");
   }
 
   // Init() set newFrame to be a fluid continuation of aFrame.
   // If we want a non-fluid continuation, we need to call SetPrevContinuation()
   // to reset NS_FRAME_IS_FLUID_CONTINUATION.
@@ -10302,17 +10301,17 @@ static void ClearHasFirstLetterChildFrom
     parent = static_cast<nsContainerFrame*>(
         parent->GetParent()->FirstContinuation());
   }
   MOZ_ASSERT(parent->HasFirstLetterChild());
   parent->ClearHasFirstLetterChild();
 }
 
 void nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
-    nsIPresShell* aPresShell, nsIFrame* aBlockFrame) {
+    PresShell* aPresShell, nsIFrame* aBlockFrame) {
   // Look for the first letter frame on the kFloatList, then kPushedFloatsList.
   nsIFrame* floatFrame =
       ::FindFirstLetterFrame(aBlockFrame, nsIFrame::kFloatList);
   if (!floatFrame) {
     floatFrame =
         ::FindFirstLetterFrame(aBlockFrame, nsIFrame::kPushedFloatsList);
     if (!floatFrame) {
       return;
@@ -10390,17 +10389,17 @@ void nsCSSFrameConstructor::RemoveFloati
   InsertFrames(parentFrame, kPrincipalList, prevSibling, textList);
 
   if (offsetsNeedFixing) {
     prevSibling->RemoveStateBits(TEXT_OFFSETS_NEED_FIXING);
   }
 }
 
 void nsCSSFrameConstructor::RemoveFirstLetterFrames(
-    nsIPresShell* aPresShell, nsContainerFrame* aFrame,
+    PresShell* aPresShell, nsContainerFrame* aFrame,
     nsContainerFrame* aBlockFrame, bool* aStopLooking) {
   nsIFrame* prevSibling = nullptr;
   nsIFrame* kid = aFrame->PrincipalChildList().FirstChild();
 
   while (kid) {
     if (kid->IsLetterFrame()) {
       ClearHasFirstLetterChildFrom(aFrame);
       nsIFrame* textFrame = kid->PrincipalChildList().FirstChild();
@@ -10459,17 +10458,17 @@ void nsCSSFrameConstructor::RemoveFirstL
         }
       }
     }
     prevSibling = kid;
     kid = kid->GetNextSibling();
   }
 }
 
-void nsCSSFrameConstructor::RemoveLetterFrames(nsIPresShell* aPresShell,
+void nsCSSFrameConstructor::RemoveLetterFrames(PresShell* aPresShell,
                                                nsContainerFrame* aBlockFrame) {
   aBlockFrame =
       static_cast<nsContainerFrame*>(aBlockFrame->FirstContinuation());
   aBlockFrame->RemoveProperty(nsContainerFrame::FirstLetterProperty());
   nsContainerFrame* continuation = aBlockFrame;
 
   bool stopLooking = false;
   do {
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -38,38 +38,40 @@ class nsCSSAnonBoxPseudoStaticAtom;
 class nsPageContentFrame;
 struct PendingBinding;
 
 class nsFrameConstructorState;
 
 namespace mozilla {
 
 class ComputedStyle;
+class PresShell;
 
 namespace dom {
 
 class CharacterData;
 class Text;
 class FlattenedChildIterator;
 
 }  // namespace dom
 }  // namespace mozilla
 
 class nsCSSFrameConstructor final : public nsFrameManager {
  public:
   typedef mozilla::ComputedStyle ComputedStyle;
   typedef mozilla::PseudoStyleType PseudoStyleType;
+  typedef mozilla::PresShell PresShell;
   typedef mozilla::dom::Element Element;
   typedef mozilla::dom::Text Text;
 
   // FIXME(emilio): Is this really needed?
   friend class mozilla::RestyleManager;
 
   nsCSSFrameConstructor(mozilla::dom::Document* aDocument,
-                        nsIPresShell* aPresShell);
+                        PresShell* aPresShell);
   ~nsCSSFrameConstructor() { MOZ_ASSERT(mFCItemsInUse == 0); }
 
   // get the alternate text for a content node
   static void GetAlternateTextFor(Element* aContent,
                                   nsAtom* aTag,  // content object's tag
                                   nsAString& aAltText);
 
  private:
@@ -351,17 +353,17 @@ class nsCSSFrameConstructor final : publ
 
   // temporary - please don't add external uses outside of nsBulletFrame
   nsCounterManager* CounterManager() { return &mCounterManager; }
 
  private:
   struct FrameConstructionItem;
   class FrameConstructionItemList;
 
-  nsContainerFrame* ConstructPageFrame(nsIPresShell* aPresShell,
+  nsContainerFrame* ConstructPageFrame(PresShell* aPresShell,
                                        nsContainerFrame* aParentFrame,
                                        nsIFrame* aPrevPageFrame,
                                        nsContainerFrame*& aCanvasFrame);
 
   void InitAndRestoreFrame(const nsFrameConstructorState& aState,
                            nsIContent* aContent, nsContainerFrame* aParentFrame,
                            nsIFrame* aNewFrame, bool aAllowCounters = true);
 
@@ -1326,28 +1328,23 @@ class nsCSSFrameConstructor final : publ
    */
   inline void CreateNeededPseudoSiblings(nsFrameConstructorState& aState,
                                          FrameConstructionItemList& aItems,
                                          nsIFrame* aParentFrame);
 
   // END TABLE SECTION
 
  protected:
-  static nsIFrame* CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
+  static nsIFrame* CreatePlaceholderFrameFor(PresShell* aPresShell,
                                              nsIContent* aContent,
                                              nsIFrame* aFrame,
                                              nsContainerFrame* aParentFrame,
                                              nsIFrame* aPrevInFlow,
                                              nsFrameState aTypeBit);
 
-  static nsIFrame* CreateBackdropFrameFor(nsIPresShell* aPresShell,
-                                          nsIContent* aContent,
-                                          nsIFrame* aFrame,
-                                          nsContainerFrame* aParentFrame);
-
  private:
   // ConstructSelectFrame puts the new frame in aFrameList and
   // handles the kids of the select.
   nsIFrame* ConstructSelectFrame(nsFrameConstructorState& aState,
                                  FrameConstructionItem& aItem,
                                  nsContainerFrame* aParentFrame,
                                  const nsStyleDisplay* aStyleDisplay,
                                  nsFrameList& aFrameList);
@@ -1711,25 +1708,24 @@ class nsCSSFrameConstructor final : publ
   // If removal of aFrame from the frame tree requires reconstruction of some
   // containing block (either of aFrame or of its parent) due to {ib} splits or
   // table pseudo-frames, recreate the relevant frame subtree.  The return value
   // indicates whether this happened.  aFrame must be the result of a
   // GetPrimaryFrame() call on a content node (which means its parent is also
   // not null).
   bool MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame);
 
-  nsIFrame* CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
+  nsIFrame* CreateContinuingOuterTableFrame(PresShell* aPresShell,
                                             nsPresContext* aPresContext,
                                             nsIFrame* aFrame,
                                             nsContainerFrame* aParentFrame,
                                             nsIContent* aContent,
                                             ComputedStyle* aComputedStyle);
 
-  nsIFrame* CreateContinuingTableFrame(nsIPresShell* aPresShell,
-                                       nsIFrame* aFrame,
+  nsIFrame* CreateContinuingTableFrame(PresShell* aPresShell, nsIFrame* aFrame,
                                        nsContainerFrame* aParentFrame,
                                        nsIContent* aContent,
                                        ComputedStyle* aComputedStyle);
 
   //----------------------------------------
 
   // Methods support creating block frames and their children
 
@@ -1966,27 +1962,25 @@ class nsCSSFrameConstructor final : publ
   void WrapFramesInFirstLetterFrame(
       nsContainerFrame* aBlockFrame, nsContainerFrame* aBlockContinuation,
       nsContainerFrame* aParentFrame, nsIFrame* aParentFrameList,
       nsContainerFrame** aModifiedParent, nsIFrame** aTextFrame,
       nsIFrame** aPrevFrame, nsFrameList& aLetterFrames, bool* aStopLooking);
 
   void RecoverLetterFrames(nsContainerFrame* aBlockFrame);
 
-  void RemoveLetterFrames(nsIPresShell* aPresShell,
-                          nsContainerFrame* aBlockFrame);
+  void RemoveLetterFrames(PresShell* aPresShell, nsContainerFrame* aBlockFrame);
 
   // Recursive helper for RemoveLetterFrames
-  void RemoveFirstLetterFrames(nsIPresShell* aPresShell,
-                               nsContainerFrame* aFrame,
+  void RemoveFirstLetterFrames(PresShell* aPresShell, nsContainerFrame* aFrame,
                                nsContainerFrame* aBlockFrame,
                                bool* aStopLooking);
 
   // Special remove method for those pesky floating first-letter frames
-  void RemoveFloatingFirstLetterFrames(nsIPresShell* aPresShell,
+  void RemoveFloatingFirstLetterFrames(PresShell* aPresShell,
                                        nsIFrame* aBlockFrame);
 
   // Capture state for the frame tree rooted at the frame associated with the
   // content object, aContent
   void CaptureStateForFramesOf(nsIContent* aContent,
                                nsILayoutHistoryState* aHistoryState);
 
   //----------------------------------------
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -11,34 +11,38 @@
 
 #include "nsDebug.h"
 #include "mozilla/Attributes.h"
 #include "nsFrameList.h"
 
 class nsContainerFrame;
 class nsIFrame;
 class nsILayoutHistoryState;
-class nsIPresShell;
 class nsPlaceholderFrame;
 class nsWindowSizes;
 
+namespace mozilla {
+class PresShell;
+}  // namespace mozilla
+
 /**
  * Frame manager interface. The frame manager serves one purpose:
  * <li>handles structural modifications to the frame model. If the frame model
  * lock can be acquired, then the changes are processed immediately; otherwise,
  * they're queued and processed later.
  *
  * FIXME(emilio): The comment above doesn't make any sense, there's no "frame
  * model lock" of any sort afaict.
  */
 class nsFrameManager {
+  typedef mozilla::PresShell PresShell;
   typedef mozilla::layout::FrameChildListID ChildListID;
 
  public:
-  explicit nsFrameManager(nsIPresShell* aPresShell)
+  explicit nsFrameManager(PresShell* aPresShell)
       : mPresShell(aPresShell), mRootFrame(nullptr) {
     MOZ_ASSERT(mPresShell, "need a pres shell");
   }
   ~nsFrameManager();
 
   /*
    * Gets and sets the root frame (typically the viewport). The lifetime of the
    * root frame is controlled by the frame manager. When the frame manager is
@@ -85,13 +89,13 @@ class nsFrameManager {
   void CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
 
   void RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
 
   void AddSizeOfIncludingThis(nsWindowSizes& aSizes) const;
 
  protected:
   // weak link, because the pres shell owns us
-  nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
+  PresShell* MOZ_NON_OWNING_REF mPresShell;
   nsIFrame* mRootFrame;
 };
 
 #endif