Bug 1024082: Remove most of the nsIPresShell::FrameManager calls. r=dholbert
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 06 Mar 2018 10:25:21 +0100
changeset 459392 a387ecebd587214959b79c39274f8b33dcafa3c1
parent 459391 5936540dc37961cca6280a0552d80fb20835cad5
child 459393 a0bb325da8310423ce326c784d90a3e239963e75
push id8822
push userarchaeopteryx@coole-files.de
push dateThu, 08 Mar 2018 23:51:23 +0000
treeherdermozilla-beta@e18b07e250b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1024082
milestone60.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 1024082: Remove most of the nsIPresShell::FrameManager calls. r=dholbert Most of them just want GetRootFrame(), and there's no need to explicitly go through the frame manager for that, we have a handy alias in the shell. MozReview-Commit-ID: GriEqkasidY
dom/base/Selection.cpp
dom/base/nsDOMWindowUtils.cpp
dom/events/EventStateManager.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
layout/base/PresShell.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSelection.cpp
layout/generic/nsPluginFrame.cpp
layout/painting/nsCSSRendering.cpp
layout/printing/nsPrintJob.cpp
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsRootBoxFrame.cpp
layout/xul/nsXULPopupManager.cpp
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -218,17 +218,17 @@ public:
       AutoWeakFrame frame =
         mContent ? mPresContext->GetPrimaryFrameFor(mContent) : nullptr;
       if (!frame) {
         return NS_OK;
       }
       mContent = nullptr;
 
       nsPoint pt = mPoint -
-        frame->GetOffsetTo(mPresContext->PresShell()->FrameManager()->GetRootFrame());
+        frame->GetOffsetTo(mPresContext->PresShell()->GetRootFrame());
       RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
       frameSelection->HandleDrag(frame, pt);
       if (!frame.IsAlive()) {
         return NS_OK;
       }
 
       NS_ASSERTION(frame->PresContext() == mPresContext, "document mismatch?");
       mSelection->DoAutoScroll(frame, pt);
@@ -1789,17 +1789,17 @@ Selection::SelectFrames(nsPresContext* a
     // nothing to do
     return NS_OK;
   }
   MOZ_ASSERT(aRange && aRange->IsPositioned());
 
   if (mFrameSelection->GetTableCellSelection()) {
     nsINode* node = aRange->GetCommonAncestor();
     nsIFrame* frame = node->IsContent() ? node->AsContent()->GetPrimaryFrame()
-                                : aPresContext->FrameManager()->GetRootFrame();
+                                : aPresContext->PresShell()->GetRootFrame();
     if (frame) {
       frame->InvalidateFrameSubtree();
     }
     return NS_OK;
   }
 
 
   // Loop through the content iterator for each content node; for each text
@@ -2176,17 +2176,17 @@ Selection::DoAutoScroll(nsIFrame* aFrame
     (void)mAutoScrollTimer->Stop();
   }
 
   nsPresContext* presContext = aFrame->PresContext();
   nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
   nsRootPresContext* rootPC = presContext->GetRootPresContext();
   if (!rootPC)
     return NS_OK;
-  nsIFrame* rootmostFrame = rootPC->PresShell()->FrameManager()->GetRootFrame();
+  nsIFrame* rootmostFrame = rootPC->PresShell()->GetRootFrame();
   AutoWeakFrame weakRootFrame(rootmostFrame);
   AutoWeakFrame weakFrame(aFrame);
   // Get the point relative to the root most frame because the scroll we are
   // about to do will change the coordinates of aFrame.
   nsPoint globalPoint = aPoint + aFrame->GetOffsetToCrossDoc(rootmostFrame);
 
   bool done = false;
   bool didScroll;
@@ -2222,17 +2222,17 @@ Selection::DoAutoScroll(nsIFrame* aFrame
       continue;
     }
     break;
   }
 
   // Start the AutoScroll timer if necessary.
   if (didScroll && mAutoScrollTimer) {
     nsPoint presContextPoint = globalPoint -
-      shell->FrameManager()->GetRootFrame()->GetOffsetToCrossDoc(rootmostFrame);
+      shell->GetRootFrame()->GetOffsetToCrossDoc(rootmostFrame);
     mAutoScrollTimer->Start(presContext, presContextPoint);
   }
 
   return NS_OK;
 }
 
 
 /** RemoveAllRanges zeroes the selection
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -483,17 +483,17 @@ nsDOMWindowUtils::SetDisplayPortForEleme
       // The pres shell needs a special flag set.
       presShell->SetIgnoreViewportScrolling(true);
     }
   }
 
   nsLayoutUtils::InvalidateForDisplayPortChange(content, !!currentData,
     currentData ? currentData->mRect : nsRect(), displayport);
 
-  nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = presShell->GetRootFrame();
   if (rootFrame) {
     rootFrame->SchedulePaint();
 
     // If we are hiding something that is a display root then send empty paint
     // transaction in order to release retained layers because it won't get
     // any more paint requests when it is hidden.
     if (displayport.IsEmpty() &&
         rootFrame == nsLayoutUtils::GetDisplayRootFrame(rootFrame)) {
@@ -3492,17 +3492,17 @@ nsDOMWindowUtils::SelectAtPoint(float aX
   }
 
   nsIPresShell* presShell = GetPresShell();
   if (!presShell) {
     return NS_ERROR_UNEXPECTED;
   }
 
   // The root frame for this content window
-  nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = presShell->GetRootFrame();
   if (!rootFrame) {
     return NS_ERROR_UNEXPECTED;
   }
 
   // Get the target frame at the client coordinates passed to us
   nsPoint offset;
   nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
   LayoutDeviceIntPoint pt =
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2639,17 +2639,17 @@ EventStateManager::ComputeScrollTarget(n
     }
 
     if (canScroll) {
       return frameToScroll;
     }
   }
 
   nsIFrame* newFrame = nsLayoutUtils::GetCrossDocParentFrame(
-      aTargetFrame->PresContext()->FrameManager()->GetRootFrame());
+      aTargetFrame->PresShell()->GetRootFrame());
   aOptions =
     static_cast<ComputeScrollTargetOptions>(aOptions & ~START_FROM_PARENT);
   return newFrame ? ComputeScrollTarget(newFrame, aEvent, aOptions) : nullptr;
 }
 
 nsSize
 EventStateManager::GetScrollAmount(nsPresContext* aPresContext,
                                    WidgetWheelEvent* aEvent,
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2618,17 +2618,17 @@ TabChild::RecvRenderLayers(const bool& a
 
     // We don't use TabChildBase::GetPresShell() here because that would create
     // a content viewer if one doesn't exist yet. Creating a content viewer can
     // cause JS to run, which we want to avoid. nsIDocShell::GetPresShell
     // returns null if no content viewer exists yet.
     if (nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell()) {
       presShell->SetIsActive(true);
 
-      if (nsIFrame* root = presShell->FrameConstructor()->GetRootFrame()) {
+      if (nsIFrame* root = presShell->GetRootFrame()) {
         FrameLayerBuilder::InvalidateAllLayersForFrame(
           nsLayoutUtils::GetDisplayRootFrame(root));
         root->SchedulePaint();
       }
 
       Telemetry::AutoTimer<Telemetry::TABCHILD_PAINT_TIME> timer;
       // If we need to repaint, let's do that right away. No sense waiting until
       // we get back to the event loop again. We suppress the display port so that
@@ -2932,17 +2932,17 @@ TabChild::MakeHidden()
   if (docShell) {
     // Hide all plugins in this tab. We don't use TabChildBase::GetPresShell()
     // here because that would create a content viewer if one doesn't exist yet.
     // Creating a content viewer can cause JS to run, which we want to avoid.
     // nsIDocShell::GetPresShell returns null if no content viewer exists yet.
     if (nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell()) {
       if (nsPresContext* presContext = presShell->GetPresContext()) {
         nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
-        nsIFrame* rootFrame = presShell->FrameConstructor()->GetRootFrame();
+        nsIFrame* rootFrame = presShell->GetRootFrame();
         rootPresContext->ComputePluginGeometryUpdates(rootFrame, nullptr, nullptr);
         rootPresContext->ApplyPluginGeometryUpdates();
       }
       presShell->SetIsActive(false);
     }
   }
 
   if (mPuppetWidget) {
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2100,17 +2100,17 @@ TabParent::GetChildProcessOffset()
   }
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return offset;
   }
 
   nsPresContext* presContext = targetFrame->PresContext();
-  nsIFrame* rootFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
   nsView* rootView = rootFrame ? rootFrame->GetView() : nullptr;
   if (!rootView) {
     return offset;
   }
 
   // Note that we don't want to take into account transforms here:
 #if 0
   nsPoint pt(0, 0);
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -10285,17 +10285,17 @@ int ReflowCountMgr::DoSingleIndi(PLHashE
 void ReflowCountMgr::DoIndiTotalsTree()
 {
   if (nullptr != mCounts) {
     printf("\n------------------------------------------------\n");
     printf("-- Individual Frame Counts\n");
     printf("------------------------------------------------\n");
 
     if (mPresShell) {
-      nsIFrame * rootFrame = mPresShell->FrameManager()->GetRootFrame();
+      nsIFrame* rootFrame = mPresShell->GetRootFrame();
       RecurseIndiTotals(mPresContext, mIndiFrameCounts, rootFrame, 0);
       printf("------------------------------------------------\n");
       printf("-- Individual Counts of Frames not in Root Tree\n");
       printf("------------------------------------------------\n");
       PL_HashTableEnumerateEntries(mIndiFrameCounts, DoSingleIndi, this);
     }
   }
 }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6584,17 +6584,17 @@ nsLayoutUtils::GetClosestLayer(nsIFrame*
   nsIFrame* layer;
   for (layer = aFrame; layer; layer = layer->GetParent()) {
     if (layer->IsAbsPosContainingBlock() ||
         (layer->GetParent() && layer->GetParent()->IsScrollFrame()))
       break;
   }
   if (layer)
     return layer;
-  return aFrame->PresShell()->FrameManager()->GetRootFrame();
+  return aFrame->PresShell()->GetRootFrame();
 }
 
 SamplingFilter
 nsLayoutUtils::GetSamplingFilterForFrame(nsIFrame* aForFrame)
 {
   SamplingFilter defaultFilter = SamplingFilter::GOOD;
   nsStyleContext *sc;
   if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
@@ -7489,17 +7489,17 @@ nsLayoutUtils::IsPopup(nsIFrame* aFrame)
 /* static */ nsIFrame*
 nsLayoutUtils::GetDisplayRootFrame(nsIFrame* aFrame)
 {
   // We could use GetRootPresContext() here if the
   // NS_FRAME_IN_POPUP frame bit is set.
   nsIFrame* f = aFrame;
   for (;;) {
     if (!f->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
-      f = f->PresContext()->FrameManager()->GetRootFrame();
+      f = f->PresShell()->GetRootFrame();
       if (!f) {
         return aFrame;
       }
     } else if (IsPopup(f)) {
       return f;
     }
     nsIFrame* parent = GetCrossDocParentFrame(f);
     if (!parent)
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -725,18 +725,17 @@ nsPresContext::GetUserPreferences()
   SetBidi(bidiOptions);
 }
 
 void
 nsPresContext::InvalidatePaintedLayers()
 {
   if (!mShell)
     return;
-  nsIFrame* rootFrame = mShell->FrameManager()->GetRootFrame();
-  if (rootFrame) {
+  if (nsIFrame* rootFrame = mShell->GetRootFrame()) {
     // FrameLayerBuilder caches invalidation-related values that depend on the
     // appunits-per-dev-pixel ratio, so ensure that all PaintedLayer drawing
     // is completely flushed.
     rootFrame->InvalidateFrameSubtree();
   }
 }
 
 void
@@ -3188,17 +3187,17 @@ nsRootPresContext::ComputePluginGeometry
       // f is not managed by this frame so we should ignore it.
       continue;
     }
     f->SetEmptyWidgetConfiguration();
   }
 
   if (aBuilder) {
     MOZ_ASSERT(aList);
-    nsIFrame* rootFrame = FrameManager()->GetRootFrame();
+    nsIFrame* rootFrame = mShell->GetRootFrame();
 
     if (rootFrame && aBuilder->ContainsPluginItem()) {
       aBuilder->SetForPluginGeometry(true);
       // Merging and flattening has already been done and we should not do it
       // again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
       // again.
       aBuilder->SetAllowMergingAndFlattening(false);
       nsRegion region = rootFrame->GetVisualOverflowRectRelativeToSelf();
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -167,26 +167,26 @@ nsCanvasFrame::DestroyFrom(nsIFrame* aDe
   nsContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 void
 nsCanvasFrame::ScrollPositionWillChange(nscoord aX, nscoord aY)
 {
   if (mDoPaintFocus) {
     mDoPaintFocus = false;
-    PresContext()->FrameManager()->GetRootFrame()->InvalidateFrameSubtree();
+    PresShell()->GetRootFrame()->InvalidateFrameSubtree();
   }
 }
 
 NS_IMETHODIMP
 nsCanvasFrame::SetHasFocus(bool aHasFocus)
 {
   if (mDoPaintFocus != aHasFocus) {
     mDoPaintFocus = aHasFocus;
-    PresContext()->FrameManager()->GetRootFrame()->InvalidateFrameSubtree();
+    PresShell()->GetRootFrame()->InvalidateFrameSubtree();
 
     if (!mAddedScrollPositionListener) {
       nsIScrollableFrame* sf =
         PresContext()->GetPresShell()->GetRootScrollFrameAsScrollable();
       if (sf) {
         sf->AddScrollPositionListener(this);
         mAddedScrollPositionListener = true;
       }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -858,17 +858,17 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
   // object size call the destructor will not avoid an indirect call;
   // the compiler cannot devirtualize the call to the destructor even
   // if it's from a method defined in the same class.
 
   nsQueryFrame::FrameIID id = GetFrameId();
   this->~nsFrame();
 
 #ifdef DEBUG
-  {  
+  {
     nsIFrame* rootFrame = shell->GetRootFrame();
     MOZ_ASSERT(rootFrame);
     if (this != rootFrame) {
       nsTArray<nsIFrame*>* modifiedFrames =
         rootFrame->GetProperty(nsIFrame::ModifiedFrameList());
       if (modifiedFrames) {
         MOZ_ASSERT(!modifiedFrames->Contains(this),
                    "A dtor added this frame to ModifiedFrameList");
@@ -999,33 +999,33 @@ nsIFrame::RemoveDisplayItemDataForDeleti
         i->Frame()->MarkNeedsDisplayItemRebuild();
       }
       i->RemoveFrame(this);
     }
     delete items;
   }
 
   if (IsFrameModified()) {
-    nsIFrame* rootFrame = PresContext()->PresShell()->GetRootFrame();
+    nsIFrame* rootFrame = PresShell()->GetRootFrame();
     MOZ_ASSERT(rootFrame);
 
     nsTArray<nsIFrame*>* modifiedFrames =
       rootFrame->GetProperty(nsIFrame::ModifiedFrameList());
     MOZ_ASSERT(modifiedFrames);
 
     for (auto& frame : *modifiedFrames) {
       if (frame == this) {
         frame = nullptr;
         break;
       }
     }
   }
 
   if (HasOverrideDirtyRegion()) {
-    nsIFrame* rootFrame = PresContext()->PresShell()->GetRootFrame();
+    nsIFrame* rootFrame = PresShell()->GetRootFrame();
     MOZ_ASSERT(rootFrame);
 
     nsTArray<nsIFrame*>* frames =
       rootFrame->GetProperty(nsIFrame::OverriddenDirtyRectFrameList());
     MOZ_ASSERT(frames);
 
     for (auto& frame : *frames) {
       if (frame == this) {
@@ -1056,17 +1056,17 @@ nsIFrame::MarkNeedsDisplayItemRebuild()
 
   RetainedDisplayListBuilder* retainedBuilder =
     displayRoot->GetProperty(RetainedDisplayListBuilder::Cached());
 
   if (!retainedBuilder) {
     return;
   }
 
-  nsIFrame* rootFrame = PresContext()->PresShell()->GetRootFrame();
+  nsIFrame* rootFrame = PresShell()->GetRootFrame();
   MOZ_ASSERT(rootFrame);
 
   if (rootFrame->IsFrameModified()) {
     return;
   }
 
   nsTArray<nsIFrame*>* modifiedFrames =
     rootFrame->GetProperty(nsIFrame::ModifiedFrameList());
@@ -6790,17 +6790,17 @@ CSSIntRect nsIFrame::GetScreenRect() con
 {
   return CSSIntRect::FromAppUnitsToNearest(GetScreenRectInAppUnits());
 }
 
 nsRect nsIFrame::GetScreenRectInAppUnits() const
 {
   nsPresContext* presContext = PresContext();
   nsIFrame* rootFrame =
-    presContext->PresShell()->FrameManager()->GetRootFrame();
+    presContext->PresShell()->GetRootFrame();
   nsPoint rootScreenPos(0, 0);
   nsPoint rootFrameOffsetInParent(0, 0);
   nsIFrame* rootFrameParent =
     nsLayoutUtils::GetCrossDocParentFrame(rootFrame, &rootFrameOffsetInParent);
   if (rootFrameParent) {
     nsRect parentScreenRectAppUnits = rootFrameParent->GetScreenRectInAppUnits();
     nsPresContext* parentPresContext = rootFrameParent->PresContext();
     double parentScale = double(presContext->AppUnitsPerDevPixel())/
@@ -7873,17 +7873,17 @@ nsIFrame::DumpFrameTreeLimited() const
 void
 nsIFrame::RootFrameList(nsPresContext* aPresContext, FILE* out, const char* aPrefix)
 {
   if (!aPresContext || !out)
     return;
 
   nsIPresShell *shell = aPresContext->GetPresShell();
   if (shell) {
-    nsIFrame* frame = shell->FrameManager()->GetRootFrame();
+    nsIFrame* frame = shell->GetRootFrame();
     if(frame) {
       frame->List(out, aPrefix);
     }
   }
 }
 #endif
 
 bool
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -503,17 +503,17 @@ nsFrameSelection::ConstrainFrameAndPoint
       if (capturedContent != content)
       {
         return NS_OK;
       }
 
       // Find the frame under the mouse cursor with the root frame.
       // At this time, don't use the anchor's frame because it may not have
       // fixed positioned frames.
-      nsIFrame* rootFrame = mShell->FrameManager()->GetRootFrame();
+      nsIFrame* rootFrame = mShell->GetRootFrame();
       nsPoint ptInRoot = aPoint + aFrame->GetOffsetTo(rootFrame);
       nsIFrame* cursorFrame =
         nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);
 
       // If the mouse cursor in on a frame which is descendant of same
       // selection root, we can expand the selection to the frame.
       if (cursorFrame && cursorFrame->PresShell() == mShell)
       {
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -275,17 +275,17 @@ nsPluginFrame::PrepForDrawing(nsIWidget 
   nsPresContext* presContext = PresContext();
   nsRootPresContext* rpc = presContext->GetRootPresContext();
   if (!rpc) {
     return NS_ERROR_FAILURE;
   }
 
   if (mWidget) {
     // Disallow windowed plugins in popups
-    nsIFrame* rootFrame = rpc->PresShell()->FrameManager()->GetRootFrame();
+    nsIFrame* rootFrame = rpc->PresShell()->GetRootFrame();
     nsIWidget* parentWidget = rootFrame->GetNearestWidget();
     if (!parentWidget || nsLayoutUtils::GetDisplayRootFrame(this) != rootFrame) {
       return NS_ERROR_FAILURE;
     }
 
     // We can already have mInnerView if our instance owner went away and then
     // came back. So clear the old one before creating a new one.
     if (mInnerView) {
@@ -627,17 +627,17 @@ nsPluginFrame::CallSetWindow(bool aCheck
 
   // Adjust plugin dimensions according to pixel snap results
   // and reduce amount of SetWindow calls
   nsPresContext* presContext = PresContext();
   nsRootPresContext* rootPC = presContext->GetRootPresContext();
   if (!rootPC)
     return NS_ERROR_FAILURE;
   int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
-  nsIFrame* rootFrame = rootPC->PresShell()->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = rootPC->PresShell()->GetRootFrame();
   nsRect bounds = GetContentRectRelativeToSelf() + GetOffsetToCrossDoc(rootFrame);
   nsIntRect intBounds = bounds.ToNearestPixels(appUnitsPerDevPixel);
 
   // In e10s, this returns the offset to the top level window, in non-e10s
   // it return 0,0.
   LayoutDeviceIntPoint intOffset = GetRemoteTabChromeOffset();
   intBounds.x += intOffset.x;
   intBounds.y += intOffset.y;
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -3004,17 +3004,17 @@ nsCSSRendering::ComputeImageLayerPositio
     positionArea.Deflate(border);
   }
 
   nsIFrame* attachedToFrame = aForFrame;
   if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment) {
     // If it's a fixed background attachment, then the image is placed
     // relative to the viewport, which is the area of the root frame
     // in a screen context or the page content frame in a print context.
-    attachedToFrame = aPresContext->PresShell()->FrameManager()->GetRootFrame();
+    attachedToFrame = aPresContext->PresShell()->GetRootFrame();
     NS_ASSERTION(attachedToFrame, "no root frame");
     nsIFrame* pageContentFrame = nullptr;
     if (aPresContext->IsPaginated()) {
       pageContentFrame = nsLayoutUtils::GetClosestFrameOfType(
         aForFrame, LayoutFrameType::PageContent);
       if (pageContentFrame) {
         attachedToFrame = pageContentFrame;
       }
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -2424,17 +2424,17 @@ nsPrintJob::ReflowPrintObject(const Uniq
       nsAutoCString urlStr;
       GetDocTitleAndURL(aPO, docStr, urlStr);
       char filename[256];
       sprintf(filename, "print_dump_%d.txt", gDumpFileNameCnt++);
       // Dump all the frames and view to a a file
       FILE * fd = fopen(filename, "w");
       if (fd) {
         nsIFrame *theRootFrame =
-          aPO->mPresShell->FrameManager()->GetRootFrame();
+          aPO->mPresShell->GetRootFrame();
         fprintf(fd, "Title: %s\n", docStr.get());
         fprintf(fd, "URL:   %s\n", urlStr.get());
         fprintf(fd, "--------------- Frames ----------------\n");
         //RefPtr<gfxContext> renderingContext =
         //  printData->mPrintDocDC->CreateRenderingContext();
         RootFrameList(aPO->mPresContext, fd, 0);
         //DumpFrames(fd, aPO->mPresContext, renderingContext, theRootFrame, 0);
         fprintf(fd, "---------------------------------------\n\n");
@@ -2660,17 +2660,17 @@ nsPrintJob::DoPrint(const UniquePtr<nsPr
     // Ask the page sequence frame to print all the pages
     nsIPageSequenceFrame* pageSequence = poPresShell->GetPageSequenceFrame();
     NS_ASSERTION(nullptr != pageSequence, "no page sequence frame");
 
     // We are done preparing for printing, so we can turn this off
     printData->mPreparingForPrint = false;
 
 #ifdef EXTENDED_DEBUG_PRINTING
-    nsIFrame* rootFrame = poPresShell->FrameManager()->GetRootFrame();
+    nsIFrame* rootFrame = poPresShell->GetRootFrame();
     if (aPO->IsPrintable()) {
       nsAutoCString docStr;
       nsAutoCString urlStr;
       GetDocTitleAndURL(aPO, docStr, urlStr);
       DumpLayoutData(docStr.get(), urlStr.get(), poPresContext,
                      printData->mPrintDC, rootFrame, aPO->mDocShell, nullptr);
     }
 #endif
@@ -3654,17 +3654,17 @@ int RemoveFilesInDir(const char * aDir)
 static void RootFrameList(nsPresContext* aPresContext, FILE* out,
                           const char* aPrefix)
 {
   if (!aPresContext || !out)
     return;
 
   nsIPresShell *shell = aPresContext->GetPresShell();
   if (shell) {
-    nsIFrame* frame = shell->FrameManager()->GetRootFrame();
+    nsIFrame* frame = shell->GetRootFrame();
     if (frame) {
       frame->List(out, aPrefix);
     }
   }
 }
 
 /** ---------------------------------------------------
  *  Dumps Frames for Printing
@@ -3810,17 +3810,17 @@ static void DumpPrintObjectsList(const n
 
   const char types[][3] = {"DC", "FR", "IF", "FS"};
   PR_PL(("Doc List\n***************************************************\n"));
   PR_PL(("T  P A H    PO    DocShell   Seq     Page      Root     Page#    Rect\n"));
   for (nsPrintObject* po : aDocList) {
     NS_ASSERTION(po, "nsPrintObject can't be null!");
     nsIFrame* rootFrame = nullptr;
     if (po->mPresShell) {
-      rootFrame = po->mPresShell->FrameManager()->GetRootFrame();
+      rootFrame = po->mPresShell->GetRootFrame();
       while (rootFrame != nullptr) {
         nsIPageSequenceFrame * sqf = do_QueryFrame(rootFrame);
         if (sqf) {
           break;
         }
         rootFrame = rootFrame->PrincipalChildList().FirstChild();
       }
     }
@@ -3886,17 +3886,17 @@ static void DumpPrintObjectsTreeLayout(c
     fprintf(fd, "***************************************************\n");
     fprintf(fd, "T     PO    DocShell   Seq      Page     Page#    Rect\n");
   } else {
     fd = aFD;
   }
   if (fd) {
     nsIFrame* rootFrame = nullptr;
     if (aPO->mPresShell) {
-      rootFrame = aPO->mPresShell->FrameManager()->GetRootFrame();
+      rootFrame = aPO->mPresShell->GetRootFrame();
     }
     for (int32_t k=0;k<aLevel;k++) fprintf(fd, "  ");
     fprintf(fd, "%s %p %p\n", types[aPO->mFrameType], aPO.get(),
             aPO->mDocShell.get());
     if (aPO->IsPrintable()) {
       nsAutoCString docStr;
       nsAutoCString urlStr;
       GetDocTitleAndURL(aPO, docStr, urlStr);
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -1378,17 +1378,17 @@ nsMenuPopupFrame::FlipOrResize(nscoord& 
 
   return std::min(popupSize, aScreenEnd - aScreenPoint);
 }
 
 nsRect
 nsMenuPopupFrame::ComputeAnchorRect(nsPresContext* aRootPresContext, nsIFrame* aAnchorFrame)
 {
   // Get the root frame for a reference
-  nsIFrame* rootFrame = aRootPresContext->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = aRootPresContext->PresShell()->GetRootFrame();
 
   // The dimensions of the anchor
   nsRect anchorRect = aAnchorFrame->GetRectRelativeToSelf();
 
   // Relative to the root
   anchorRect = nsLayoutUtils::TransformFrameRectToAncestor(aAnchorFrame,
                                                            anchorRect,
                                                            rootFrame);
@@ -1408,17 +1408,17 @@ nsMenuPopupFrame::SetPopupPosition(nsIFr
 
   // If this is due to a move, return early if the popup hasn't been laid out
   // yet. On Windows, this can happen when using a drag popup before it opens.
   if (aIsMove && (mPrefSize.width == -1 || mPrefSize.height == -1)) {
     return NS_OK;
   }
 
   nsPresContext* presContext = PresContext();
-  nsIFrame* rootFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
   NS_ASSERTION(rootFrame->GetView() && GetView() &&
                rootFrame->GetView() == GetView()->GetParent(),
                "rootFrame's view is not our view's parent???");
 
   // For anchored popups, the anchor rectangle. For non-anchored popups, the
   // size will be 0.
   nsRect anchorRect;
 
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -214,17 +214,17 @@ nsResizerFrame::HandleEvent(nsPresContex
             screen->GetRect(&screenRect.x, &screenRect.y,
                             &screenRect.width, &screenRect.height);
             rect.IntersectRect(rect, screenRect);
           }
         }
       }
       else if (menuPopupFrame) {
         nsRect frameRect = menuPopupFrame->GetScreenRectInAppUnits();
-        nsIFrame* rootFrame = aPresContext->PresShell()->FrameManager()->GetRootFrame();
+        nsIFrame* rootFrame = aPresContext->PresShell()->GetRootFrame();
         nsRect rootScreenRect = rootFrame->GetScreenRectInAppUnits();
 
         nsPopupLevel popupLevel = menuPopupFrame->PopupLevel();
         int32_t appPerDev = aPresContext->AppUnitsPerDevPixel();
         LayoutDeviceIntRect screenRect = menuPopupFrame->GetConstraintRect
           (LayoutDeviceIntRect::FromAppUnitsToNearest(frameRect, appPerDev),
            // round using ...ToInside as it's better to be a pixel too small
            // than be too large. If the popup is too large it could get flipped
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -23,17 +23,17 @@ using namespace mozilla;
 
 // static
 nsIRootBox*
 nsIRootBox::GetRootBox(nsIPresShell* aShell)
 {
   if (!aShell) {
     return nullptr;
   }
-  nsIFrame* rootFrame = aShell->FrameManager()->GetRootFrame();
+  nsIFrame* rootFrame = aShell->GetRootFrame();
   if (!rootFrame) {
     return nullptr;
   }
 
   if (rootFrame) {
     rootFrame = rootFrame->PrincipalChildList().FirstChild();
   }
 
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -655,29 +655,29 @@ nsXULPopupManager::InitTriggerEvent(nsID
         nsIPresShell* presShell = doc->GetShell();
         nsPresContext* presContext;
         if (presShell && (presContext = presShell->GetPresContext())) {
           nsPresContext* rootDocPresContext =
             presContext->GetRootPresContext();
           if (!rootDocPresContext)
             return;
           nsIFrame* rootDocumentRootFrame = rootDocPresContext->
-              PresShell()->FrameManager()->GetRootFrame();
+              PresShell()->GetRootFrame();
           if ((event->mClass == eMouseEventClass ||
                event->mClass == eMouseScrollEventClass ||
                event->mClass == eWheelEventClass) &&
                !event->AsGUIEvent()->mWidget) {
             // no widget, so just use the client point if available
             nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
             nsIntPoint clientPt;
             mouseEvent->GetClientX(&clientPt.x);
             mouseEvent->GetClientY(&clientPt.y);
 
             // XXX this doesn't handle IFRAMEs in transforms
-            nsPoint thisDocToRootDocOffset = presShell->FrameManager()->
+            nsPoint thisDocToRootDocOffset = presShell->
               GetRootFrame()->GetOffsetToCrossDoc(rootDocumentRootFrame);
             // convert to device pixels
             mCachedMousePoint.x = presContext->AppUnitsToDevPixels(
                 nsPresContext::CSSPixelsToAppUnits(clientPt.x) + thisDocToRootDocOffset.x);
             mCachedMousePoint.y = presContext->AppUnitsToDevPixels(
                 nsPresContext::CSSPixelsToAppUnits(clientPt.y) + thisDocToRootDocOffset.y);
           }
           else if (rootDocumentRootFrame) {