Bug 1230863 - Remove unused nsPresContext args from many functions. r=roc.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 06 Dec 2015 17:15:53 -0800
changeset 310000 8d8cd6abab67245413e684769b8bc4321a4e2300
parent 309999 faacb2337f8e082b60a4b080163a87e931e2fc4b
child 310001 c0c2e2df018067a165ff5de407e48acdae35e7b8
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1230863
milestone45.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 1230863 - Remove unused nsPresContext args from many functions. r=roc.
dom/events/EventStateManager.cpp
dom/events/EventStateManager.h
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLChar.h
layout/mathml/nsMathMLOperators.cpp
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmrootFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/mathml/nsMathMLmtableFrame.h
layout/style/AnimationCommon.cpp
layout/style/nsMediaFeatures.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
layout/xul/nsBoxFrame.cpp
layout/xul/nsBoxFrame.h
layout/xul/nsGroupBoxFrame.cpp
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsListBoxBodyFrame.h
layout/xul/nsMenuBarFrame.cpp
layout/xul/nsMenuFrame.cpp
layout/xul/nsMenuFrame.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsScrollbarButtonFrame.cpp
layout/xul/nsScrollbarButtonFrame.h
layout/xul/nsSplitterFrame.cpp
layout/xul/nsTextBoxFrame.cpp
layout/xul/nsTextBoxFrame.h
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULPopupManager.h
widget/nsBaseDragService.cpp
widget/nsBaseDragService.h
widget/windows/nsNativeThemeWin.cpp
widget/windows/nsNativeThemeWin.h
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -605,43 +605,43 @@ EventStateManager::PreHandleEvent(nsPres
       return NS_ERROR_DOM_INVALID_STATE_ERR;
     }
     break;
   case eMouseDown: {
     switch (mouseEvent->button) {
     case WidgetMouseEvent::eLeftButton:
       BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
       mLClickCount = mouseEvent->clickCount;
-      SetClickCount(aPresContext, mouseEvent, aStatus);
+      SetClickCount(mouseEvent, aStatus);
       sNormalLMouseEventInProcess = true;
       break;
     case WidgetMouseEvent::eMiddleButton:
       mMClickCount = mouseEvent->clickCount;
-      SetClickCount(aPresContext, mouseEvent, aStatus);
+      SetClickCount(mouseEvent, aStatus);
       break;
     case WidgetMouseEvent::eRightButton:
       mRClickCount = mouseEvent->clickCount;
-      SetClickCount(aPresContext, mouseEvent, aStatus);
+      SetClickCount(mouseEvent, aStatus);
       break;
     }
     break;
   }
   case eMouseUp: {
     switch (mouseEvent->button) {
       case WidgetMouseEvent::eLeftButton:
         if (Prefs::ClickHoldContextMenu()) {
           KillClickHoldTimer();
         }
         StopTrackingDragGesture();
         sNormalLMouseEventInProcess = false;
         // then fall through...
         MOZ_FALLTHROUGH;
       case WidgetMouseEvent::eRightButton:
       case WidgetMouseEvent::eMiddleButton:
-        SetClickCount(aPresContext, mouseEvent, aStatus);
+        SetClickCount(mouseEvent, aStatus);
         break;
     }
     break;
   }
   case eMouseEnterIntoWidget:
     // In some cases on e10s eMouseEnterIntoWidget
     // event was sent twice into child process of content.
     // (From specific widget code (sending is not permanent) and
@@ -3107,17 +3107,17 @@ EventStateManager::PostHandleEvent(nsPre
       ClearGlobalActiveContent(this);
       WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
       if (mouseEvent && mouseEvent->IsReal()) {
         if (!mCurrentTarget) {
           GetEventTarget();
         }
         // Make sure to dispatch the click even if there is no frame for
         // the current target element. This is required for Web compatibility.
-        ret = CheckForAndDispatchClick(presContext, mouseEvent, aStatus);
+        ret = CheckForAndDispatchClick(mouseEvent, aStatus);
       }
 
       nsIPresShell *shell = presContext->GetPresShell();
       if (shell) {
         RefPtr<nsFrameSelection> frameSelection = shell->FrameSelection();
         frameSelection->SetDragState(false);
       }
     }
@@ -4547,18 +4547,17 @@ EventStateManager::UpdateDragDataTransfe
       nsAutoString mozCursor;
       dragEvent->dataTransfer->GetMozCursor(mozCursor);
       initialDataTransfer->SetMozCursor(mozCursor);
     }
   }
 }
 
 nsresult
-EventStateManager::SetClickCount(nsPresContext* aPresContext,
-                                 WidgetMouseEvent* aEvent,
+EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
                                  nsEventStatus* aStatus)
 {
   nsCOMPtr<nsIContent> mouseContent;
   nsIContent* mouseContentParent = nullptr;
   if (mCurrentTarget) {
     mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(mouseContent));
   }
   if (mouseContent) {
@@ -4625,18 +4624,17 @@ EventStateManager::SetClickCount(nsPresC
     }
     break;
   }
 
   return NS_OK;
 }
 
 nsresult
-EventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
-                                            WidgetMouseEvent* aEvent,
+EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
                                             nsEventStatus* aStatus)
 {
   nsresult ret = NS_OK;
 
   //If mouse is still over same element, clickcount will be > 1.
   //If it has moved it will be zero, so no click.
   if (0 != aEvent->clickCount) {
     //Check that the window isn't disabled before firing a click
--- a/dom/events/EventStateManager.h
+++ b/dom/events/EventStateManager.h
@@ -395,21 +395,18 @@ protected:
                            nsIContent* aTargetContent,
                            nsWeakFrame& aTargetFrame);
   /**
    * Update the initial drag session data transfer with any changes that occur
    * on cloned data transfer objects used for events.
    */
   void UpdateDragDataTransfer(WidgetDragEvent* dragEvent);
 
-  nsresult SetClickCount(nsPresContext* aPresContext,
-                         WidgetMouseEvent* aEvent,
-                         nsEventStatus* aStatus);
-  nsresult CheckForAndDispatchClick(nsPresContext* aPresContext,
-                                    WidgetMouseEvent* aEvent,
+  nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus);
+  nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
                                     nsEventStatus* aStatus);
   void EnsureDocument(nsPresContext* aPresContext);
   void FlushPendingEvents(nsPresContext* aPresContext);
 
   /**
    * The phases of HandleAccessKey processing. See below.
    */
   typedef enum {
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1996,18 +1996,18 @@ VerifySameTree(nsStyleContext* aContext1
       break;
     top2 = parent;
   }
   NS_ASSERTION(top1 == top2,
                "Style contexts are not in the same style context tree");
 }
 
 static void
-VerifyContextParent(nsPresContext* aPresContext, nsIFrame* aFrame,
-                    nsStyleContext* aContext, nsStyleContext* aParentContext)
+VerifyContextParent(nsIFrame* aFrame, nsStyleContext* aContext,
+                    nsStyleContext* aParentContext)
 {
   // get the contexts not provided
   if (!aContext) {
     aContext = aFrame->StyleContext();
   }
 
   if (!aParentContext) {
     nsIFrame* providerFrame;
@@ -2057,65 +2057,64 @@ VerifyContextParent(nsPresContext* aPres
           aContext->GetParent()->GetStyleIfVisited())) {
     NS_ERROR("Visited style has wrong parent");
     DumpContext(aFrame, aContext);
     fputs("\n", stdout);
   }
 }
 
 static void
-VerifyStyleTree(nsPresContext* aPresContext, nsIFrame* aFrame,
-                nsStyleContext* aParentContext)
+VerifyStyleTree(nsIFrame* aFrame, nsStyleContext* aParentContext)
 {
   nsStyleContext*  context = aFrame->StyleContext();
-  VerifyContextParent(aPresContext, aFrame, context, nullptr);
+  VerifyContextParent(aFrame, context, nullptr);
 
   nsIFrame::ChildListIterator lists(aFrame);
   for (; !lists.IsDone(); lists.Next()) {
     for (nsIFrame* child : lists.CurrentList()) {
       if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
         // only do frames that are in flow
         if (nsGkAtoms::placeholderFrame == child->GetType()) {
           // placeholder: first recurse and verify the out of flow frame,
           // then verify the placeholder's context
           nsIFrame* outOfFlowFrame =
             nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
 
           // recurse to out of flow frame, letting the parent context get resolved
           do {
-            VerifyStyleTree(aPresContext, outOfFlowFrame, nullptr);
+            VerifyStyleTree(outOfFlowFrame, nullptr);
           } while ((outOfFlowFrame = outOfFlowFrame->GetNextContinuation()));
 
           // verify placeholder using the parent frame's context as
           // parent context
-          VerifyContextParent(aPresContext, child, nullptr, nullptr);
+          VerifyContextParent(child, nullptr, nullptr);
         }
         else { // regular frame
-          VerifyStyleTree(aPresContext, child, nullptr);
+          VerifyStyleTree(child, nullptr);
         }
       }
     }
   }
 
   // do additional contexts
   int32_t contextIndex = 0;
   for (nsStyleContext* extraContext;
        (extraContext = aFrame->GetAdditionalStyleContext(contextIndex));
        ++contextIndex) {
-    VerifyContextParent(aPresContext, aFrame, extraContext, context);
+    VerifyContextParent(aFrame, extraContext, context);
   }
 }
 
 void
 RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
 {
   if (aFrame) {
     nsStyleContext* context = aFrame->StyleContext();
     nsStyleContext* parentContext = context->GetParent();
-    VerifyStyleTree(mPresContext, aFrame, parentContext);
+    VerifyStyleTree(aFrame, parentContext);
   }
 }
 
 #endif // DEBUG
 
 // aContent must be the content for the frame in question, which may be
 // :before/:after content
 /* static */ bool
@@ -2523,17 +2522,17 @@ RestyleManager::ReparentStyleContext(nsI
             NS_ASSERTION(!(styleChange & nsChangeHint_ReconstructFrame),
                          "Our frame tree is likely to be bogus!");
           }
 
           aFrame->SetAdditionalStyleContext(contextIndex, newExtraContext);
         }
       }
 #ifdef DEBUG
-      VerifyStyleTree(mPresContext, aFrame, newParentContext);
+      VerifyStyleTree(aFrame, newParentContext);
 #endif
     }
   }
 
   return NS_OK;
 }
 
 ElementRestyler::ElementRestyler(nsPresContext* aPresContext,
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1422,18 +1422,17 @@ nsFrameConstructorSaveState::~nsFrameCon
  */
 // XXXbz Since this is only used for {ib} splits, could we just copy the view
 // bits from aOldParent to aNewParent and then use the
 // nsFrameList::ApplySetParent?  That would still leave us doing two passes
 // over the list, of course; if we really wanted to we could factor out the
 // relevant part of ReparentFrameViewList, I suppose...  Or just get rid of
 // views, which would make most of this function go away.
 static void
-MoveChildrenTo(nsPresContext* aPresContext,
-               nsIFrame* aOldParent,
+MoveChildrenTo(nsIFrame* aOldParent,
                nsContainerFrame* aNewParent,
                nsFrameList& aFrameList)
 {
   bool sameGrandParent = aOldParent->GetParent() == aNewParent->GetParent();
 
   if (aNewParent->HasView() || aOldParent->HasView() || !sameGrandParent) {
     // Move the frames into the new view
     nsContainerFrame::ReparentFrameViewList(aFrameList, aOldParent, aNewParent);
@@ -2810,18 +2809,17 @@ nsCSSFrameConstructor::SetUpDocElementCo
     FinishBuildingScrollFrame(parentFrame, rootFrame);
   }
 
   if (isPaginated) {
     // Create the first page
     // Set the initial child lists
     nsContainerFrame* canvasFrame;
     nsContainerFrame* pageFrame =
-      ConstructPageFrame(mPresShell, presContext, rootFrame, nullptr,
-                         canvasFrame);
+      ConstructPageFrame(mPresShell, rootFrame, nullptr, canvasFrame);
     SetInitialSingleChild(rootFrame, pageFrame);
 
     // The eventual parent of the document element frame.
     // XXX should this be set for every new page (in ConstructPageFrame)?
     mDocElementContainingBlock = canvasFrame;
     mHasRootAbsPosContainingBlock = true;
   }
 
@@ -2852,17 +2850,16 @@ nsCSSFrameConstructor::ConstructAnonymou
 
   nsFrameItems frameItems;
   ConstructFramesFromItemList(aState, itemsToConstruct, frameAsContainer, frameItems);
   frameAsContainer->AppendFrames(kPrincipalList, frameItems);
 }
 
 nsContainerFrame*
 nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell*  aPresShell,
-                                          nsPresContext* aPresContext,
                                           nsContainerFrame* aParentFrame,
                                           nsIFrame*      aPrevPageFrame,
                                           nsContainerFrame*& aCanvasFrame)
 {
   nsStyleContext* parentStyleContext = aParentFrame->StyleContext();
   nsStyleSet *styleSet = aPresShell->StyleSet();
 
   RefPtr<nsStyleContext> pagePseudoStyle;
@@ -6188,17 +6185,17 @@ nsCSSFrameConstructor::AppendFramesToPar
           FindFirstNonBlock(aFrameList);
         nsFrameList blockKids = aFrameList.ExtractHead(firstNonBlockEnumerator);
         NS_ASSERTION(blockKids.NotEmpty(), "No blocks?");
 
         nsContainerFrame* prevBlock = GetIBSplitPrevSibling(firstContinuation);
         prevBlock = static_cast<nsContainerFrame*>(prevBlock->LastContinuation());
         NS_ASSERTION(prevBlock, "Should have previous block here");
 
-        MoveChildrenTo(aState.mPresContext, aParentFrame, prevBlock, blockKids);
+        MoveChildrenTo(aParentFrame, prevBlock, blockKids);
       }
     }
 
     // We want to put some of the frames into this inline frame.
     nsFrameList::FrameLinkEnumerator firstBlockEnumerator(aFrameList);
     FindFirstBlock(firstBlockEnumerator);
 
     nsFrameList inlineKids = aFrameList.ExtractHead(firstBlockEnumerator);
@@ -7120,18 +7117,17 @@ nsCSSFrameConstructor::ContentAppended(n
     haveFirstLetterStyle = HasFirstLetterStyle(containingBlock);
     haveFirstLineStyle =
       ShouldHaveFirstLineStyle(containingBlock->GetContent(),
                                containingBlock->StyleContext());
   }
 
   if (haveFirstLetterStyle) {
     // Before we get going, remove the current letter frames
-    RemoveLetterFrames(state.mPresContext, state.mPresShell,
-                       containingBlock);
+    RemoveLetterFrames(state.mPresShell, containingBlock);
   }
 
   nsIAtom* frameType = parentFrame->GetType();
 
   FlattenedChildIterator iter(aContainer);
   bool haveNoXBLChildren = (!iter.XBLInvolved() || !iter.GetNextChild());
   FrameConstructionItemList items;
   if (aFirstNewContent->GetPreviousSibling() &&
@@ -7284,17 +7280,17 @@ bool NotifyListBoxBody(nsPresContext*   
       // Except if we have an aChildFrame and its parent is not the right
       // thing, then we don't do this.  Pseudo frames are so much fun....
       if (!aChildFrame || aChildFrame->GetParent() == listBoxBodyFrame) {
         listBoxBodyFrame->OnContentRemoved(aPresContext, aContainer,
                                            aChildFrame, aOldNextSibling);
         return true;
       }
     } else {
-      listBoxBodyFrame->OnContentInserted(aPresContext, aChild);
+      listBoxBodyFrame->OnContentInserted(aChild);
       return true;
     }
   }
 
   return false;
 }
 #endif // MOZ_XUL
 
@@ -7616,18 +7612,17 @@ nsCSSFrameConstructor::ContentRangeInser
           NS_ASSERTION(placeholderFrame, "No placeholder for out-of-flow?");
           insertion.mParentFrame = placeholderFrame->GetParent();
         } else {
           insertion.mParentFrame = insertion.mParentFrame->GetParent();
         }
       }
 
       // Remove the old letter frames before doing the insertion
-      RemoveLetterFrames(state.mPresContext, mPresShell,
-                         state.mFloatedItems.containingBlock);
+      RemoveLetterFrames(mPresShell, state.mFloatedItems.containingBlock);
 
       // Removing the letterframes messes around with the frame tree, removing
       // and creating frames.  We need to reget our prevsibling, parent frame,
       // etc.
       prevSibling = GetInsertionPrevSibling(&insertion, aStartChild, &isAppend,
                                             &isRangeInsertSafe);
 
       // Need check whether a range insert is still safe.
@@ -8108,17 +8103,17 @@ nsCSSFrameConstructor::ContentRemoved(ns
       printf(" childFrame=");
       nsFrame::ListTag(stdout, childFrame);
       printf("\n");
 #endif
 
       // First update the containing blocks structure by removing the
       // existing letter frames. This makes the subsequent logic
       // simpler.
-      RemoveLetterFrames(presContext, mPresShell, containingBlock);
+      RemoveLetterFrames(mPresShell, containingBlock);
 
       // Recover childFrame and parentFrame
       childFrame = aChild->GetPrimaryFrame();
       if (!childFrame || childFrame->GetContent() != aChild) {
         // XXXbz the GetContent() != aChild check is needed due to bug 135040.
         // Remove it once that's fixed.
         ClearUndisplayedContentIn(aChild, aContainer);
         return NS_OK;
@@ -8322,18 +8317,17 @@ nsCSSFrameConstructor::CharacterDataChan
     // just lead us to come back into this notification (e.g. if quotes or
     // counters are involved), leading to a loop.
     nsContainerFrame* block = GetFloatContainingBlock(frame);
     bool haveFirstLetterStyle = false;
     if (block) {
       // See if the block has first-letter style applied to it.
       haveFirstLetterStyle = HasFirstLetterStyle(block);
       if (haveFirstLetterStyle) {
-        RemoveLetterFrames(mPresShell->GetPresContext(), mPresShell,
-                           block);
+        RemoveLetterFrames(mPresShell, block);
         // Reget |frame|, since we might have killed it.
         // Do we really need to call CharacterDataChanged in this case, though?
         frame = aContent->GetPrimaryFrame();
         NS_ASSERTION(frame, "Should have frame here!");
       }
     }
 
     frame->CharacterDataChanged(aInfo);
@@ -8475,17 +8469,16 @@ nsCSSFrameConstructor::CreateContinuingO
   // Set the outer table's initial child list
   newFrame->SetInitialChildList(kPrincipalList, newChildFrames);
 
   return newFrame;
 }
 
 nsIFrame*
 nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell*     aPresShell,
-                                                  nsPresContext*    aPresContext,
                                                   nsIFrame*         aFrame,
                                                   nsContainerFrame* aParentFrame,
                                                   nsIContent*       aContent,
                                                   nsStyleContext*   aStyleContext)
 {
   nsTableFrame* newFrame = NS_NewTableFrame(aPresShell, aStyleContext);
 
   newFrame->Init(aContent, aParentFrame, aFrame);
@@ -8528,17 +8521,17 @@ nsCSSFrameConstructor::CreateContinuingT
       ProcessChildren(state, headerFooter, rowGroupFrame->StyleContext(),
                       headerFooterFrame, true, childItems, false,
                       nullptr);
       NS_ASSERTION(state.mFloatedItems.IsEmpty(), "unexpected floated element");
       headerFooterFrame->SetInitialChildList(kPrincipalList, childItems);
       headerFooterFrame->SetRepeatable(true);
 
       // Table specific initialization
-      headerFooterFrame->InitRepeatedFrame(aPresContext, rowGroupFrame);
+      headerFooterFrame->InitRepeatedFrame(rowGroupFrame);
 
       // XXX Deal with absolute and fixed frames...
       childFrames.AddChild(headerFooterFrame);
     }
   }
 
   // Set the table frame's initial child list
   newFrame->SetInitialChildList(kPrincipalList, childFrames);
@@ -8583,26 +8576,25 @@ nsCSSFrameConstructor::CreateContinuingF
 #endif
   } else if (nsGkAtoms::columnSetFrame == frameType) {
     MOZ_ASSERT(!aFrame->IsTableCaption(),
                "no support for fragmenting table captions yet");
     newFrame = NS_NewColumnSetFrame(shell, styleContext, nsFrameState(0));
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (nsGkAtoms::pageFrame == frameType) {
     nsContainerFrame* canvasFrame;
-    newFrame = ConstructPageFrame(shell, aPresContext, aParentFrame, aFrame,
-                                  canvasFrame);
+    newFrame = ConstructPageFrame(shell, aParentFrame, aFrame, canvasFrame);
   } else if (nsGkAtoms::tableOuterFrame == frameType) {
     newFrame =
       CreateContinuingOuterTableFrame(shell, aPresContext, aFrame, aParentFrame,
                                       content, styleContext);
 
   } else if (nsGkAtoms::tableFrame == frameType) {
     newFrame =
-      CreateContinuingTableFrame(shell, aPresContext, aFrame, aParentFrame,
+      CreateContinuingTableFrame(shell, aFrame, aParentFrame,
                                  content, styleContext);
 
   } else if (nsGkAtoms::tableRowGroupFrame == frameType) {
     newFrame = NS_NewTableRowGroupFrame(shell, styleContext);
     newFrame->Init(content, aParentFrame, aFrame);
     if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
       nsTableFrame::RegisterPositionedTablePart(newFrame);
     }
@@ -11025,17 +11017,16 @@ FindFirstLetterFrame(nsIFrame* aFrame, n
       return e.get();
     }
   }
   return nullptr;
 }
 
 nsresult
 nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
-  nsPresContext* aPresContext,
   nsIPresShell* aPresShell,
   nsIFrame* aBlockFrame,
   bool* aStopLooking)
 {
   // Look for the first letter frame on the kFloatList, then kPushedFloatsList.
   nsIFrame* floatFrame =
     ::FindFirstLetterFrame(aBlockFrame, nsIFrame::kFloatList);
   if (!floatFrame) {
@@ -11116,18 +11107,17 @@ nsCSSFrameConstructor::RemoveFloatingFir
   if (offsetsNeedFixing) {
     prevSibling->RemoveStateBits(TEXT_OFFSETS_NEED_FIXING);
   }
 
   return NS_OK;
 }
 
 nsresult
-nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
-                                               nsIPresShell* aPresShell,
+nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresShell* aPresShell,
                                                nsContainerFrame* aFrame,
                                                nsContainerFrame* aBlockFrame,
                                                bool* aStopLooking)
 {
   nsIFrame* prevSibling = nullptr;
   nsIFrame* kid = aFrame->GetFirstPrincipalChild();
 
   while (kid) {
@@ -11179,47 +11169,45 @@ nsCSSFrameConstructor::RemoveFirstLetter
                    "should have the first continuation here");
       aBlockFrame->RemoveStateBits(NS_BLOCK_HAS_FIRST_LETTER_CHILD);
       break;
     }
     else if (IsInlineFrame(kid)) {
       nsContainerFrame* kidAsContainerFrame = do_QueryFrame(kid);
       if (kidAsContainerFrame) {
         // Look inside child inline frame for the letter frame.
-        RemoveFirstLetterFrames(aPresContext, aPresShell,
-                                kidAsContainerFrame,
+        RemoveFirstLetterFrames(aPresShell, kidAsContainerFrame,
                                 aBlockFrame, aStopLooking);
         if (*aStopLooking) {
           break;
         }
       }
     }
     prevSibling = kid;
     kid = kid->GetNextSibling();
   }
 
   return NS_OK;
 }
 
 nsresult
-nsCSSFrameConstructor::RemoveLetterFrames(nsPresContext* aPresContext,
-                                          nsIPresShell* aPresShell,
+nsCSSFrameConstructor::RemoveLetterFrames(nsIPresShell* aPresShell,
                                           nsContainerFrame* aBlockFrame)
 {
   aBlockFrame =
     static_cast<nsContainerFrame*>(aBlockFrame->FirstContinuation());
   nsContainerFrame* continuation = aBlockFrame;
 
   bool stopLooking = false;
   nsresult rv;
   do {
-    rv = RemoveFloatingFirstLetterFrames(aPresContext, aPresShell,
+    rv = RemoveFloatingFirstLetterFrames(aPresShell,
                                          continuation, &stopLooking);
     if (NS_SUCCEEDED(rv) && !stopLooking) {
-      rv = RemoveFirstLetterFrames(aPresContext, aPresShell,
+      rv = RemoveFirstLetterFrames(aPresShell,
                                    continuation, aBlockFrame, &stopLooking);
     }
     if (stopLooking) {
       break;
     }
     continuation =
       static_cast<nsContainerFrame*>(continuation->GetNextContinuation());
   }  while (continuation);
@@ -11262,18 +11250,17 @@ nsCSSFrameConstructor::RecoverLetterFram
   }
 }
 
 //----------------------------------------------------------------------
 
 // listbox Widget Routines
 
 nsresult
-nsCSSFrameConstructor::CreateListBoxContent(nsPresContext*         aPresContext,
-                                            nsContainerFrame*      aParentFrame,
+nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame*      aParentFrame,
                                             nsIFrame*              aPrevFrame,
                                             nsIContent*            aChild,
                                             nsIFrame**             aNewFrame,
                                             bool                   aIsAppend,
                                             bool                   aIsScrollbar,
                                             nsILayoutHistoryState* aFrameState)
 {
 #ifdef MOZ_XUL
@@ -11581,17 +11568,17 @@ nsCSSFrameConstructor::CreateIBSiblings(
     InitAndRestoreFrame(aState, content, parentFrame, blockFrame, false);
 
     // Find the first non-block child which defines the end of our block kids
     // and the start of our next inline's kids
     nsFrameList::FrameLinkEnumerator firstNonBlock =
       FindFirstNonBlock(aChildItems);
     nsFrameList blockKids = aChildItems.ExtractHead(firstNonBlock);
 
-    MoveChildrenTo(aState.mPresContext, aInitialInline, blockFrame, blockKids);
+    MoveChildrenTo(aInitialInline, blockFrame, blockKids);
 
     SetFrameIsIBSplit(lastNewInline, blockFrame);
     aSiblings.AddChild(blockFrame);
 
     // Now grab the initial inlines in aChildItems and put them into an inline
     // frame.
     nsInlineFrame* inlineFrame = NS_NewInlineFrame(mPresShell, styleContext);
     InitAndRestoreFrame(aState, content, parentFrame, inlineFrame, false);
@@ -11601,18 +11588,17 @@ nsCSSFrameConstructor::CreateIBSiblings(
       inlineFrame->MarkAsAbsoluteContainingBlock();
     }
 
     if (aChildItems.NotEmpty()) {
       nsFrameList::FrameLinkEnumerator firstBlock(aChildItems);
       FindFirstBlock(firstBlock);
       nsFrameList inlineKids = aChildItems.ExtractHead(firstBlock);
 
-      MoveChildrenTo(aState.mPresContext, aInitialInline, inlineFrame,
-                     inlineKids);
+      MoveChildrenTo(aInitialInline, inlineFrame, inlineKids);
     }
 
     SetFrameIsIBSplit(blockFrame, inlineFrame);
     aSiblings.AddChild(inlineFrame);
     lastNewInline = inlineFrame;
   } while (aChildItems.NotEmpty());
 
   SetFrameIsIBSplit(lastNewInline, nullptr);
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -295,18 +295,17 @@ public:
   // Copy over fixed frames from aParentFrame's prev-in-flow
   nsresult ReplicateFixedFrames(nsPageContentFrame* aParentFrame);
 
   /**
    * Get the XBL insertion point for aChild in aContainer.
    */
   InsertionPoint GetInsertionPoint(nsIContent* aContainer, nsIContent* aChild);
 
-  nsresult CreateListBoxContent(nsPresContext*    aPresContext,
-                                nsContainerFrame* aParentFrame,
+  nsresult CreateListBoxContent(nsContainerFrame* aParentFrame,
                                 nsIFrame*         aPrevFrame,
                                 nsIContent*       aChild,
                                 nsIFrame**        aResult,
                                 bool              aIsAppend,
                                 bool              aIsScrollbar,
                                 nsILayoutHistoryState* aFrameState);
 
   // GetInitialContainingBlock() is deprecated in favor of GetRootElementFrame();
@@ -331,17 +330,16 @@ public:
     return mTempFrameTreeState;
   }
 
 private:
   struct FrameConstructionItem;
   class FrameConstructionItemList;
 
   nsContainerFrame* ConstructPageFrame(nsIPresShell*      aPresShell,
-                                       nsPresContext*     aPresContext,
                                        nsContainerFrame*  aParentFrame,
                                        nsIFrame*          aPrevPageFrame,
                                        nsContainerFrame*& aCanvasFrame);
 
   void InitAndRestoreFrame (const nsFrameConstructorState& aState,
                             nsIContent*                    aContent,
                             nsContainerFrame*              aParentFrame,
                             nsIFrame*                      aNewFrame,
@@ -1689,17 +1687,16 @@ private:
   nsIFrame* CreateContinuingOuterTableFrame(nsIPresShell*     aPresShell,
                                             nsPresContext*    aPresContext,
                                             nsIFrame*         aFrame,
                                             nsContainerFrame* aParentFrame,
                                             nsIContent*       aContent,
                                             nsStyleContext*   aStyleContext);
 
   nsIFrame* CreateContinuingTableFrame(nsIPresShell*     aPresShell,
-                                       nsPresContext*    aPresContext,
                                        nsIFrame*         aFrame,
                                        nsContainerFrame* aParentFrame,
                                        nsIContent*       aContent,
                                        nsStyleContext*   aStyleContext);
 
   //----------------------------------------
 
   // Methods support creating block frames and their children
@@ -1866,30 +1863,27 @@ private:
                                     nsIFrame**         aTextFrame,
                                     nsIFrame**         aPrevFrame,
                                     nsFrameItems&      aLetterFrames,
                                     bool*              aStopLooking);
 
   void RecoverLetterFrames(nsContainerFrame* aBlockFrame);
 
   //
-  nsresult RemoveLetterFrames(nsPresContext*    aPresContext,
-                              nsIPresShell*     aPresShell,
+  nsresult RemoveLetterFrames(nsIPresShell*     aPresShell,
                               nsContainerFrame* aBlockFrame);
 
   // Recursive helper for RemoveLetterFrames
-  nsresult RemoveFirstLetterFrames(nsPresContext*    aPresContext,
-                                   nsIPresShell*     aPresShell,
+  nsresult RemoveFirstLetterFrames(nsIPresShell*     aPresShell,
                                    nsContainerFrame* aFrame,
                                    nsContainerFrame* aBlockFrame,
                                    bool*             aStopLooking);
 
   // Special remove method for those pesky floating first-letter frames
-  nsresult RemoveFloatingFirstLetterFrames(nsPresContext*  aPresContext,
-                                           nsIPresShell*    aPresShell,
+  nsresult RemoveFloatingFirstLetterFrames(nsIPresShell*    aPresShell,
                                            nsIFrame*        aBlockFrame,
                                            bool*          aStopLooking);
 
   // 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/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -2741,17 +2741,16 @@ nsDisplayBackgroundImage::ComputeVisibil
   // Return false if the background was propagated away from this
   // frame. We don't want this display item to show up and confuse
   // anything.
   return mBackgroundStyle;
 }
 
 /* static */ nsRegion
 nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
-                                              nsPresContext* aPresContext,
                                               uint8_t aClip, const nsRect& aRect,
                                               bool* aSnap)
 {
   nsRegion result;
   if (aRect.IsEmpty())
     return result;
 
   nsIFrame *frame = aItem->Frame();
@@ -2797,18 +2796,17 @@ nsDisplayBackgroundImage::GetOpaqueRegio
   // which expects frames to be sent to it in content order, not reverse
   // content order which we'll produce here.
   // Of course, if there's only one frame in the flow, it doesn't matter.
   if (mFrame->StyleBorder()->mBoxDecorationBreak ==
         NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
       (!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
     const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
     if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL) {
-      nsPresContext* presContext = mFrame->PresContext();
-      result = GetInsideClipRegion(this, presContext, layer.mClip, mBounds, aSnap);
+      result = GetInsideClipRegion(this, layer.mClip, mBounds, aSnap);
     }
   }
 
   return result;
 }
 
 bool
 nsDisplayBackgroundImage::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) {
@@ -3205,18 +3203,18 @@ nsDisplayBackgroundColor::GetOpaqueRegio
 
   if (!mBackgroundStyle)
     return nsRegion();
 
   *aSnap = true;
 
   const nsStyleBackground::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
   nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
-  nsPresContext* presContext = mFrame->PresContext();
-  return nsDisplayBackgroundImage::GetInsideClipRegion(this, presContext, bottomLayer.mClip, borderBox, aSnap);
+  return nsDisplayBackgroundImage::GetInsideClipRegion(this, bottomLayer.mClip,
+                                                       borderBox, aSnap);
 }
 
 bool
 nsDisplayBackgroundColor::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
 {
   *aColor = mColor.ToABGR();
   return true;
 }
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2677,17 +2677,17 @@ public:
   
   virtual bool CanOptimizeToImageLayer(LayerManager* aManager,
                                        nsDisplayListBuilder* aBuilder) override;
   virtual already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
                                                         nsDisplayListBuilder *aBuilder) override;
   virtual void ConfigureLayer(ImageLayer* aLayer,
                               const ContainerLayerParameters& aParameters) override;
 
-  static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, nsPresContext* aPresContext, uint8_t aClip,
+  static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, uint8_t aClip,
                                       const nsRect& aRect, bool* aSnap);
 
   virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override;
 
   AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
     return mAnimatedGeometryRootForScrollMetadata;
   }
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3148,18 +3148,17 @@ nsFrame::SelectByTypeAtPoint(nsPresConte
     PresContext()->GetPresShell()->ConstFrameSelection();
   nsIFrame* theFrame = frameSelection->
     GetFrameForNodeOffset(offsets.content, offsets.offset,
                           offsets.associate, &offset);
   if (!theFrame)
     return NS_ERROR_FAILURE;
 
   nsFrame* frame = static_cast<nsFrame*>(theFrame);
-  return frame->PeekBackwardAndForward(aBeginAmountType, aEndAmountType, 
-                                       offset, aPresContext,
+  return frame->PeekBackwardAndForward(aBeginAmountType, aEndAmountType, offset,
                                        aBeginAmountType != eSelectWord,
                                        aSelectFlags);
 }
 
 /**
   * Multiple Mouse Press -- line or paragraph selection -- for the frame.
   * Wouldn't it be nice if this didn't have to be hardwired into Frame code?
  */
@@ -3208,17 +3207,16 @@ nsFrame::HandleMultiplePress(nsPresConte
   return SelectByTypeAtPoint(aPresContext, relPoint, beginAmount, endAmount,
                              (aControlHeld ? SELECT_ACCUMULATE : 0));
 }
 
 nsresult
 nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
                                 nsSelectionAmount aAmountForward,
                                 int32_t aStartPos,
-                                nsPresContext* aPresContext,
                                 bool aJumpLines,
                                 uint32_t aSelectFlags)
 {
   nsIFrame* baseFrame = this;
   int32_t baseOffset = aStartPos;
   nsresult rv;
 
   if (aAmountBack == eSelectWord) {
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -389,17 +389,16 @@ public:
                            mozilla::WidgetGUIEvent* aEvent,
                            nsEventStatus* aEventStatus);
 
   enum { SELECT_ACCUMULATE = 0x01 };
 
   nsresult PeekBackwardAndForward(nsSelectionAmount aAmountBack,
                                   nsSelectionAmount aAmountForward,
                                   int32_t aStartPos,
-                                  nsPresContext* aPresContext,
                                   bool aJumpLines,
                                   uint32_t aSelectFlags);
 
   nsresult SelectByTypeAtPoint(nsPresContext* aPresContext,
                                const nsPoint& aPoint,
                                nsSelectionAmount aBeginAmountType,
                                nsSelectionAmount aEndAmountType,
                                uint32_t aSelectFlags);
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -710,17 +710,17 @@ nsGlyphTableList::GetGlyphTableFor(const
   }
   // Fall back to default Unicode table
   return &mUnicodeTable;
 }
 
 // -----------------------------------------------------------------------------
 
 static nsresult
-InitGlobals(nsPresContext* aPresContext)
+InitCharGlobals()
 {
   NS_ASSERTION(!gGlyphTableInitialized, "Error -- already initialized");
   gGlyphTableInitialized = true;
 
   // Allocate the placeholders for the preferred parts and variants
   nsresult rv = NS_ERROR_OUT_OF_MEMORY;
   RefPtr<nsGlyphTableList> glyphTableList = new nsGlyphTableList();
   if (glyphTableList) {
@@ -771,21 +771,20 @@ nsMathMLChar::SetStyleContext(nsStyleCon
     if (aStyleContext) {
       mStyleContext = aStyleContext;
       aStyleContext->AddRef();
     }
   }
 }
 
 void
-nsMathMLChar::SetData(nsPresContext* aPresContext,
-                      nsString&       aData)
+nsMathMLChar::SetData(nsString& aData)
 {
   if (!gGlyphTableInitialized) {
-    InitGlobals(aPresContext);
+    InitCharGlobals();
   }
   mData = aData;
   // some assumptions until proven otherwise
   // note that mGlyph is not initialized
   mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED;
   mBoundingMetrics = nsBoundingMetrics();
   // check if stretching is applicable ...
   if (gGlyphTableList && (1 == mData.Length())) {
@@ -873,17 +872,17 @@ nsMathMLChar::SetData(nsPresContext* aPr
 // -----------------------------------------------------------------------------
 
 
 // plain TeX settings (TeXbook p.152)
 #define NS_MATHML_DELIMITER_FACTOR             0.901f
 #define NS_MATHML_DELIMITER_SHORTFALL_POINTS   5.0f
 
 static bool
-IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, uint32_t aHint)
+IsSizeOK(nscoord a, nscoord b, uint32_t aHint)
 {
   // Normal: True if 'a' is around +/-10% of the target 'b' (10% is
   // 1-DelimiterFactor). This often gives a chance to the base size to
   // win, especially in the context of <mfenced> without tall elements
   // or in sloppy markups without protective <mrow></mrow>
   bool isNormal =
     (aHint & NS_STRETCH_NORMAL) &&
     Abs<float>(a - b) < (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b);
@@ -1238,18 +1237,17 @@ StretchEnumContext::TryVariants(nsGlyphT
     // If this a largeop only operator, we stop if the glyph is large enough.
     if (largeopOnly && (bm.ascent + bm.descent) >= displayOperatorMinHeight) {
       break;
     }
     ++size;
   }
 
   return haveBetter &&
-    (largeopOnly ||
-     IsSizeOK(mPresContext, bestSize, mTargetSize, mStretchHint));
+    (largeopOnly || IsSizeOK(bestSize, mTargetSize, mStretchHint));
 }
 
 // 3. Build by parts.
 // Returns true if the size is OK, false to keep searching.
 // Always updates the char if a better match is found.
 bool
 nsMathMLChar::StretchEnumContext::TryParts(nsGlyphTable* aGlyphTable,
                                            RefPtr<gfxFontGroup>* aFontGroup,
@@ -1410,17 +1408,17 @@ nsMathMLChar::StretchEnumContext::TryPar
 
   // reset
   mChar->mDraw = DRAW_PARTS;
   for (int32_t i = 0; i < 4; i++) {
     mChar->mGlyphs[i] = textRun[i];
     mChar->mBmData[i] = bmdata[i];
   }
 
-  return IsSizeOK(mPresContext, computedSize, mTargetSize, mStretchHint);
+  return IsSizeOK(computedSize, mTargetSize, mStretchHint);
 }
 
 // This is called for each family, whether it exists or not
 bool
 nsMathMLChar::StretchEnumContext::EnumCallback(const FontFamilyName& aFamily,
                                                bool aGeneric, void *aData)
 {
   StretchEnumContext* context = static_cast<StretchEnumContext*>(aData);
@@ -1635,17 +1633,17 @@ nsMathMLChar::StretchInternal(nsPresCont
 
   bool done = false;
 
   if (!maxWidth && !largeop) {
     // Doing Stretch() not GetMaxWidth(),
     // and not a largeop in display mode; we're done if size fits
     if ((targetSize <= 0) || 
         ((isVertical && charSize >= targetSize) ||
-         IsSizeOK(aPresContext, charSize, targetSize, aStretchHint)))
+         IsSizeOK(charSize, targetSize, aStretchHint)))
       done = true;
   }
 
   //////////////////////////////////////////////////////////////////////////////
   // 2/3. Search for a glyph or set of part glyphs of appropriate size
   //////////////////////////////////////////////////////////////////////////////
 
   bool glyphFound = false;
--- a/layout/mathml/nsMathMLChar.h
+++ b/layout/mathml/nsMathMLChar.h
@@ -118,18 +118,17 @@ public:
           float                    aFontSizeInflation,
           nsStretchDirection       aStretchDirection,
           const nsBoundingMetrics& aContainerSize,
           nsBoundingMetrics&       aDesiredStretchSize,
           uint32_t                 aStretchHint,
           bool                     aRTL);
 
   void
-  SetData(nsPresContext* aPresContext,
-          nsString&       aData);
+  SetData(nsString& aData);
 
   void
   GetData(nsString& aData) {
     aData = mData;
   }
 
   int32_t
   Length() {
--- a/layout/mathml/nsMathMLOperators.cpp
+++ b/layout/mathml/nsMathMLOperators.cpp
@@ -287,17 +287,17 @@ InitOperators(void)
         }
       }
     }
   }
   return NS_OK;
 }
 
 static nsresult
-InitGlobals()
+InitOperatorGlobals()
 {
   gGlobalsInitialized = true;
   nsresult rv = NS_ERROR_OUT_OF_MEMORY;
   gOperatorTable = new nsDataHashtable<nsStringHashKey, OperatorData*>();
   if (gOperatorTable) {
     rv = InitOperators();
   }
   if (NS_FAILED(rv))
@@ -343,17 +343,17 @@ GetOperatorData(const nsString& aOperato
 bool
 nsMathMLOperators::LookupOperator(const nsString&       aOperator,
                                   const nsOperatorFlags aForm,
                                   nsOperatorFlags*      aFlags,
                                   float*                aLeadingSpace,
                                   float*                aTrailingSpace)
 {
   if (!gGlobalsInitialized) {
-    InitGlobals();
+    InitOperatorGlobals();
   }
   if (gOperatorTable) {
     NS_ASSERTION(aFlags && aLeadingSpace && aTrailingSpace, "bad usage");
     NS_ASSERTION(aForm > 0 && aForm < 4, "*** invalid call ***");
 
     // The MathML REC says:
     // If the operator does not occur in the dictionary with the specified form,
     // the renderer should use one of the forms which is available there, in the
@@ -388,17 +388,17 @@ nsMathMLOperators::LookupOperator(const 
 
 void
 nsMathMLOperators::LookupOperators(const nsString&       aOperator,
                                    nsOperatorFlags*      aFlags,
                                    float*                aLeadingSpace,
                                    float*                aTrailingSpace)
 {
   if (!gGlobalsInitialized) {
-    InitGlobals();
+    InitOperatorGlobals();
   }
 
   aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
   aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
   aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
 
   aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
   aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -77,17 +77,17 @@ nsresult nsMathMLmencloseFrame::Allocate
     Char.Assign(kLongDivChar);
     mLongDivCharIndex = i;
   } else if (mask == NOTATION_RADICAL) {
     Char.Assign(kRadicalChar);
     mRadicalCharIndex = i;
   }
 
   nsPresContext *presContext = PresContext();
-  mMathMLChar[i].SetData(presContext, Char);
+  mMathMLChar[i].SetData(Char);
   ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar[i]);
 
   return NS_OK;
 }
 
 /*
  * Add a notation to draw, if the argument is the name of a known notation.
  * @param aNotation string name of a notation
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -103,31 +103,31 @@ nsMathMLmfencedFrame::CreateFencesAndSep
   if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::open, value)) {
     value = char16_t('('); // default as per the MathML REC
   } else {
     value.CompressWhitespace();
   }
 
   if (!value.IsEmpty()) {
     mOpenChar = new nsMathMLChar;
-    mOpenChar->SetData(aPresContext, value);
+    mOpenChar->SetData(value);
     ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mOpenChar);
   }
 
   //////////////
   // see if the closing fence is there ...
   if(!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::close, value)) {
     value = char16_t(')'); // default as per the MathML REC
   } else {
     value.CompressWhitespace();
   }
 
   if (!value.IsEmpty()) {
     mCloseChar = new nsMathMLChar;
-    mCloseChar->SetData(aPresContext, value);
+    mCloseChar->SetData(value);
     ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mCloseChar);
   }
 
   //////////////
   // see if separators are there ...
   if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::separators_, value)) {
     value = char16_t(','); // default as per the MathML REC
   } else {
@@ -142,17 +142,17 @@ nsMathMLmfencedFrame::CreateFencesAndSep
       nsAutoString sepChar;
       for (int32_t i = 0; i < sepCount; i++) {
         if (i < mSeparatorsCount) {
           sepChar = value[i];
         }
         else {
           sepChar = value[mSeparatorsCount-1];
         }
-        mSeparatorsChar[i].SetData(aPresContext, sepChar);
+        mSeparatorsChar[i].SetData(sepChar);
         ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mSeparatorsChar[i]);
       }
       mSeparatorsCount = sepCount;
     } else {
       // No separators.  Note that sepCount can be -1 here, so don't
       // set mSeparatorsCount to it.
       mSeparatorsCount = 0;
     }
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -128,17 +128,17 @@ nsMathMLmoFrame::ProcessTextData()
        ch == kInvisibleTimes)) {
     mFlags |= NS_MATHML_OPERATOR_INVISIBLE;
   }
 
   // don't bother doing anything special if we don't have a single child
   nsPresContext* presContext = PresContext();
   if (mFrames.GetLength() != 1) {
     data.Truncate(); // empty data to reset the char
-    mMathMLChar.SetData(presContext, data);
+    mMathMLChar.SetData(data);
     ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar);
     return;
   }
 
   // special... in math mode, the usual minus sign '-' looks too short, so
   // what we do here is to remap <mo>-</mo> to the official Unicode minus
   // sign (U+2212) which looks much better. For background on this, see
   // http://groups.google.com/groups?hl=en&th=66488daf1ade7635&rnum=1
@@ -172,17 +172,17 @@ nsMathMLmoFrame::ProcessTextData()
         (ch == 0x2264) || // &le;
         (ch == 0x2265) || // &ge;
         (ch == 0x00D7)) { // &times;
       mFlags |= NS_MATHML_OPERATOR_CENTERED;
     }
   }
 
   // cache the operator
-  mMathMLChar.SetData(presContext, data);
+  mMathMLChar.SetData(data);
 
   // cache the native direction -- beware of bug 133429...
   // mEmbellishData.direction must always retain our native direction, whereas
   // mMathMLChar.GetStretchDirection() may change later, when Stretch() is called
   mEmbellishData.direction = mMathMLChar.GetStretchDirection();
 
   bool isMutable =
     NS_MATHML_OPERATOR_IS_LARGEOP(allFlags) ||
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -46,17 +46,17 @@ nsMathMLmrootFrame::Init(nsIContent*    
   nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow);
   
   nsPresContext *presContext = PresContext();
 
   // No need to track the style context given to our MathML char. 
   // The Style System will use Get/SetAdditionalStyleContext() to keep it
   // up-to-date if dynamic changes arise.
   nsAutoString sqrChar; sqrChar.Assign(kSqrChar);
-  mSqrChar.SetData(presContext, sqrChar);
+  mSqrChar.SetData(sqrChar);
   ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mSqrChar);
 }
 
 NS_IMETHODIMP
 nsMathMLmrootFrame::TransmitAutomaticData()
 {
   // 1. The REC says:
   //    The <mroot> element increments scriptlevel by 2, and sets displaystyle to
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -776,18 +776,17 @@ nsMathMLmtableOuterFrame::AttributeChang
   // Explicitly request a reflow in our subtree to pick up any changes
   presContext->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 nsIFrame*
-nsMathMLmtableOuterFrame::GetRowFrameAt(nsPresContext* aPresContext,
-                                        int32_t         aRowIndex)
+nsMathMLmtableOuterFrame::GetRowFrameAt(int32_t aRowIndex)
 {
   int32_t rowCount = GetRowCount();
 
   // Negative indices mean to find upwards from the end.
   if (aRowIndex < 0) {
     aRowIndex = rowCount + aRowIndex;
   } else {
     // aRowIndex is 1-based, so convert it to a 0-based index
@@ -841,17 +840,17 @@ nsMathMLmtableOuterFrame::Reflow(nsPresC
   // (conceptually: when there is no row of reference, picture the table as if
   // it is wrapped in a single big fictional row at dy = 0, this way of
   // doing so allows us to have a single code path for all cases).
   nscoord dy = 0;
   WritingMode wm = aDesiredSize.GetWritingMode();
   nscoord blockSize = aDesiredSize.BSize(wm);
   nsIFrame* rowFrame = nullptr;
   if (rowIndex) {
-    rowFrame = GetRowFrameAt(aPresContext, rowIndex);
+    rowFrame = GetRowFrameAt(rowIndex);
     if (rowFrame) {
       // translate the coordinates to be relative to us and in our writing mode
       nsIFrame* frame = rowFrame;
       LogicalRect rect(wm, frame->GetRect(),
                        aReflowState.ComputedSizeAsContainerIfConstrained());
       blockSize = rect.BSize(wm);
       do {
         dy += rect.BStart(wm);
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -48,18 +48,17 @@ public:
 protected:
   explicit nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableOuterFrame(aContext) {}
   virtual ~nsMathMLmtableOuterFrame();
 
   // helper to find the row frame at a given index, positive or negative, e.g.,
   // 1..n means the first row down to the last row, -1..-n means the last row
   // up to the first row. Used for alignments that are relative to a given row
   nsIFrame*
-  GetRowFrameAt(nsPresContext* aPresContext,
-                int32_t         aRowIndex);
+  GetRowFrameAt(int32_t aRowIndex);
 }; // class nsMathMLmtableOuterFrame
 
 // --------------
 
 class nsMathMLmtableFrame : public nsTableFrame
 {
 public:
   NS_DECL_QUERYFRAME_TARGET(nsMathMLmtableFrame)
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -581,18 +581,17 @@ AnimationCollection::UpdateAnimationGene
   mAnimationGeneration =
     aPresContext->RestyleManager()->GetAnimationGeneration();
 }
 
 void
 AnimationCollection::UpdateCheckGeneration(
   nsPresContext* aPresContext)
 {
-  mCheckGeneration =
-    aPresContext->RestyleManager()->GetAnimationGeneration();
+  mCheckGeneration = aPresContext->RestyleManager()->GetAnimationGeneration();
 }
 
 nsPresContext*
 OwningElementRef::GetRenderedPresContext() const
 {
   if (!mElement) {
     return nullptr;
   }
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -367,17 +367,17 @@ GetWindowsTheme(nsPresContext* aPresCont
             break;
         }
     }
 #endif
     return NS_OK;
 }
 
 static nsresult
-GetOperatinSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
+GetOperatingSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
                          nsCSSValue& aResult)
 {
     aResult.Reset();
     if (ShouldResistFingerprinting(aPresContext)) {
         return NS_OK;
     }
 
 #ifdef XP_WIN
@@ -710,17 +710,17 @@ nsMediaFeatures::features[] = {
         GetWindowsTheme
     },
     {
         &nsGkAtoms::_moz_os_version,
         nsMediaFeature::eMinMaxNotAllowed,
         nsMediaFeature::eIdent,
         nsMediaFeature::eNoRequirements,
         { nullptr },
-        GetOperatinSystemVersion
+        GetOperatingSystemVersion
     },
 
     {
         &nsGkAtoms::_moz_swipe_animation_enabled,
         nsMediaFeature::eMinMaxNotAllowed,
         nsMediaFeature::eBoolInteger,
         nsMediaFeature::eNoRequirements,
         { &nsGkAtoms::swipe_animation_enabled },
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -820,20 +820,19 @@ void DebugCheckChildSize(nsIFrame*      
   }
 }
 #endif
 
 // the computed bsize for the cell, which descendants use for percent bsize calculations
 // it is the bsize (minus border, padding) of the cell's first in flow during its final
 // reflow without an unconstrained bsize.
 static nscoord
-CalcUnpaginatedBSize(nsPresContext*     aPresContext,
-                      nsTableCellFrame& aCellFrame,
-                      nsTableFrame&     aTableFrame,
-                      nscoord           aBlockDirBorderPadding)
+CalcUnpaginatedBSize(nsTableCellFrame& aCellFrame,
+                     nsTableFrame&     aTableFrame,
+                     nscoord           aBlockDirBorderPadding)
 {
   const nsTableCellFrame* firstCellInFlow =
     static_cast<nsTableCellFrame*>(aCellFrame.FirstInFlow());
   nsTableFrame* firstTableInFlow  =
     static_cast<nsTableFrame*>(aTableFrame.FirstInFlow());
   nsTableRowFrame* row =
     static_cast<nsTableRowFrame*>(firstCellInFlow->GetParent());
   nsTableRowGroupFrame* firstRGInFlow =
@@ -847,17 +846,17 @@ CalcUnpaginatedBSize(nsPresContext*     
                                                           rowIndex + rowSpan - 1);
   computedBSize -= aBlockDirBorderPadding;
   int32_t rowX;
   for (row = firstRGInFlow->GetFirstRow(), rowX = 0; row; row = row->GetNextRow(), rowX++) {
     if (rowX > rowIndex + rowSpan - 1) {
       break;
     }
     else if (rowX >= rowIndex) {
-      computedBSize += row->GetUnpaginatedBSize(aPresContext);
+      computedBSize += row->GetUnpaginatedBSize();
     }
   }
   return computedBSize;
 }
 
 void
 nsTableCellFrame::Reflow(nsPresContext*           aPresContext,
                          nsHTMLReflowMetrics&     aDesiredSize,
@@ -905,17 +904,17 @@ nsTableCellFrame::Reflow(nsPresContext* 
 
   if (aReflowState.mFlags.mSpecialBSizeReflow) {
     const_cast<nsHTMLReflowState&>(aReflowState).
       SetComputedBSize(BSize(wm) - borderPadding.BStartEnd(wm));
     DISPLAY_REFLOW_CHANGE();
   }
   else if (aPresContext->IsPaginated()) {
     nscoord computedUnpaginatedBSize =
-      CalcUnpaginatedBSize(aPresContext, (nsTableCellFrame&)*this,
+      CalcUnpaginatedBSize((nsTableCellFrame&)*this,
                            *tableFrame, borderPadding.BStartEnd(wm));
     if (computedUnpaginatedBSize > 0) {
       const_cast<nsHTMLReflowState&>(aReflowState).SetComputedBSize(computedUnpaginatedBSize);
       DISPLAY_REFLOW_CHANGE();
     }
   }
   else {
     SetHasPctOverBSize(false);
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -770,25 +770,24 @@ GetSpaceBetween(int32_t       aPrevColIn
       space += aTableFrame.GetColSpacing(colIdx - 1);
     }
   }
   return space;
 }
 
 // subtract the bsizes of aRow's prev in flows from the unpaginated bsize
 static
-nscoord CalcBSizeFromUnpaginatedBSize(nsPresContext*   aPresContext,
-                                      nsTableRowFrame& aRow,
+nscoord CalcBSizeFromUnpaginatedBSize(nsTableRowFrame& aRow,
                                       WritingMode      aWM)
 {
   nscoord bsize = 0;
   nsTableRowFrame* firstInFlow =
     static_cast<nsTableRowFrame*>(aRow.FirstInFlow());
   if (firstInFlow->HasUnpaginatedBSize()) {
-    bsize = firstInFlow->GetUnpaginatedBSize(aPresContext);
+    bsize = firstInFlow->GetUnpaginatedBSize();
     for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
          prevInFlow = prevInFlow->GetPrevInFlow()) {
       bsize -= prevInFlow->BSize(aWM);
     }
   }
   return std::max(bsize, 0);
 }
 
@@ -1033,34 +1032,33 @@ nsTableRowFrame::ReflowChildren(nsPresCo
   // The table will calculate the isize and not use our value.
   aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
 
   if (aReflowState.mFlags.mSpecialBSizeReflow) {
     aDesiredSize.BSize(wm) = BSize(wm);
   } else if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableBSize()) {
     aDesiredSize.BSize(wm) = CalcBSize(aReflowState);
     if (GetPrevInFlow()) {
-      nscoord bsize = CalcBSizeFromUnpaginatedBSize(aPresContext, *this, wm);
+      nscoord bsize = CalcBSizeFromUnpaginatedBSize(*this, wm);
       aDesiredSize.BSize(wm) = std::max(aDesiredSize.BSize(wm), bsize);
     } else {
       if (isPaginated && HasStyleBSize()) {
         // set the unpaginated bsize so next in flows can try to honor it
         SetHasUnpaginatedBSize(true);
         SetUnpaginatedBSize(aPresContext, aDesiredSize.BSize(wm));
       }
       if (isPaginated && HasUnpaginatedBSize()) {
         aDesiredSize.BSize(wm) = std::max(aDesiredSize.BSize(wm),
-                                          GetUnpaginatedBSize(aPresContext));
+                                          GetUnpaginatedBSize());
       }
     }
   } else { // constrained bsize, paginated
     // Compute the bsize we should have from style (subtracting the
     // bsize from our prev-in-flows from the style bsize)
-    nscoord styleBSize = CalcBSizeFromUnpaginatedBSize(aPresContext, *this,
-                                                       wm);
+    nscoord styleBSize = CalcBSizeFromUnpaginatedBSize(*this, wm);
     if (styleBSize > aReflowState.AvailableBSize()) {
       styleBSize = aReflowState.AvailableBSize();
       NS_FRAME_SET_INCOMPLETE(aStatus);
     }
     aDesiredSize.BSize(wm) = std::max(cellMaxBSize, styleBSize);
   }
 
   if (wm.IsVerticalRL()) {
@@ -1427,17 +1425,17 @@ nsTableRowFrame::SetUnpaginatedBSize(nsP
 {
   NS_ASSERTION(!GetPrevInFlow(), "program error");
   // Get the property
   aPresContext->PropertyTable()->
     Set(this, RowUnpaginatedHeightProperty(), NS_INT32_TO_PTR(aValue));
 }
 
 nscoord
-nsTableRowFrame::GetUnpaginatedBSize(nsPresContext* aPresContext)
+nsTableRowFrame::GetUnpaginatedBSize()
 {
   FrameProperties props = FirstInFlow()->Properties();
   return NS_PTR_TO_INT32(props.Get(RowUnpaginatedHeightProperty()));
 }
 
 void nsTableRowFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
                                                  BCPixelSize aPixelValue)
 {
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -204,17 +204,17 @@ public:
                        bool aForce = false);
 
   nscoord GetInitialBSize(nscoord aBasis = 0) const;
 
   nsTableRowFrame* GetNextRow() const;
 
   bool    HasUnpaginatedBSize();
   void    SetHasUnpaginatedBSize(bool aValue);
-  nscoord GetUnpaginatedBSize(nsPresContext* aPresContext);
+  nscoord GetUnpaginatedBSize();
   void    SetUnpaginatedBSize(nsPresContext* aPresContext, nscoord aValue);
 
   nscoord GetBStartBCBorderWidth() const { return mBStartBorderWidth; }
   nscoord GetBEndBCBorderWidth() const { return mBEndBorderWidth; }
   void SetBStartBCBorderWidth(BCPixelSize aWidth) { mBStartBorderWidth = aWidth; }
   void SetBEndBCBorderWidth(BCPixelSize aWidth) { mBEndBorderWidth = aWidth; }
   mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
                              
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -87,18 +87,17 @@ void  nsTableRowGroupFrame::AdjustRowInd
     if (NS_STYLE_DISPLAY_TABLE_ROW==rowFrame->StyleDisplay()->mDisplay) {
       int32_t index = ((nsTableRowFrame*)rowFrame)->GetRowIndex();
       if (index >= aRowIndex)
         ((nsTableRowFrame *)rowFrame)->SetRowIndex(index+anAdjustment);
     }
   }
 }
 nsresult
-nsTableRowGroupFrame::InitRepeatedFrame(nsPresContext*        aPresContext,
-                                        nsTableRowGroupFrame* aHeaderFooterFrame)
+nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame)
 {
   nsTableRowFrame* copyRowFrame = GetFirstRow();
   nsTableRowFrame* originalRowFrame = aHeaderFooterFrame->GetFirstRow();
   AddStateBits(NS_REPEATED_ROW_OR_ROWGROUP);
   while (copyRowFrame && originalRowFrame) {
     copyRowFrame->AddStateBits(NS_REPEATED_ROW_OR_ROWGROUP);
     int rowIndex = originalRowFrame->GetRowIndex();
     copyRowFrame->SetRowIndex(rowIndex);
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -150,18 +150,17 @@ public:
    * Used for header and footer row group frames that are repeated when
    * splitting a table frame.
    *
    * Performs any table specific initialization
    *
    * @param aHeaderFooterFrame the original header or footer row group frame
    * that was repeated
    */
-  nsresult  InitRepeatedFrame(nsPresContext*        aPresContext,
-                              nsTableRowGroupFrame* aHeaderFooterFrame);
+  nsresult  InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame);
 
 
   /**
    * Get the total bsize of all the row rects
    */
   nscoord GetBSizeBasis(const nsHTMLReflowState& aReflowState);
 
   mozilla::LogicalMargin GetBCBorderWidth(mozilla::WritingMode aWM);
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -180,18 +180,19 @@ nsBoxFrame::Init(nsIContent*       aCont
   }
 
   MarkIntrinsicISizesDirty();
 
   CacheAttributes();
 
 #ifdef DEBUG_LAYOUT
     // if we are root and this
-  if (mState & NS_STATE_IS_ROOT) 
-      GetDebugPref(GetPresContext());
+  if (mState & NS_STATE_IS_ROOT) {
+    GetDebugPref();
+  }
 #endif
 
   UpdateMouseThrough();
 
   // register access key
   RegUnregAccessKey(true);
 }
 
@@ -1254,19 +1255,19 @@ nsBoxFrame::AttributeChanged(int32_t aNa
       FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
   }
 
   return rv;
 }
 
 #ifdef DEBUG_LAYOUT
 void
-nsBoxFrame::GetDebugPref(nsPresContext* aPresContext)
+nsBoxFrame::GetDebugPref()
 {
-    gDebug = Preferences::GetBool("xul.debug.box");
+  gDebug = Preferences::GetBool("xul.debug.box");
 }
 
 class nsDisplayXULDebug : public nsDisplayItem {
 public:
   nsDisplayXULDebug(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) :
     nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayXULDebug);
   }
@@ -1403,23 +1404,23 @@ nsBoxFrame::PaintXULDebugBackground(nsRe
 
   nsMargin debugBorder;
   nsMargin debugMargin;
   nsMargin debugPadding;
 
   bool isHorizontal = IsHorizontal();
 
   GetDebugBorder(debugBorder);
-  PixelMarginToTwips(GetPresContext(), debugBorder);
+  PixelMarginToTwips(debugBorder);
 
   GetDebugMargin(debugMargin);
-  PixelMarginToTwips(GetPresContext(), debugMargin);
+  PixelMarginToTwips(debugMargin);
 
   GetDebugPadding(debugPadding);
-  PixelMarginToTwips(GetPresContext(), debugPadding);
+  PixelMarginToTwips(debugPadding);
 
   nsRect inner(mRect);
   inner.MoveTo(aPt);
   inner.Deflate(debugMargin);
   inner.Deflate(border);
   //nsRect borderRect(inner);
 
   int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
@@ -1463,17 +1464,17 @@ nsBoxFrame::PaintXULDebugBackground(nsRe
 void
 nsBoxFrame::PaintXULDebugOverlay(DrawTarget& aDrawTarget, nsPoint aPt)
 {
   nsMargin border;
   GetBorder(border);
 
   nsMargin debugMargin;
   GetDebugMargin(debugMargin);
-  PixelMarginToTwips(GetPresContext(), debugMargin);
+  PixelMarginToTwips(debugMargin);
 
   nsRect inner(mRect);
   inner.MoveTo(aPt);
   inner.Deflate(debugMargin);
   inner.Deflate(border);
 
   nscoord onePixel = GetPresContext()->IntScaledPixelsToTwips(1);
 
@@ -1666,17 +1667,17 @@ nsBoxFrame::GetDebugMargin(nsMargin& aIn
 
 void
 nsBoxFrame::GetDebugPadding(nsMargin& aPadding)
 {
     aPadding.SizeTo(2,2,2,2);
 }
 
 void 
-nsBoxFrame::PixelMarginToTwips(nsPresContext* aPresContext, nsMargin& aMarginPixels)
+nsBoxFrame::PixelMarginToTwips(nsMargin& aMarginPixels)
 {
   nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
   aMarginPixels.left   *= onePixel;
   aMarginPixels.right  *= onePixel;
   aMarginPixels.top    *= onePixel;
   aMarginPixels.bottom *= onePixel;
 }
 
@@ -1737,20 +1738,20 @@ nsBoxFrame::DisplayDebugInfoFor(nsIFrame
     //printf("%%%%%% inside box %%%%%%%\n");
 
     int count = 0;
     nsIFrame* child = nsBox::GetChildBox(aBox);
 
     nsMargin m;
     nsMargin m2;
     GetDebugBorder(m);
-    PixelMarginToTwips(aPresContext, m);
+    PixelMarginToTwips(m);
 
     GetDebugMargin(m2);
-    PixelMarginToTwips(aPresContext, m2);
+    PixelMarginToTwips(m2);
 
     m += m2;
 
     if ((isHorizontal && y < insideBorder.y + m.top) ||
         (!isHorizontal && x < insideBorder.x + m.left)) {
         //printf("**** inside debug border *******\n");
         while (child) 
         {
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -217,25 +217,25 @@ protected:
 
   void CheckBoxOrder();
 
 private: 
 
 #ifdef DEBUG_LAYOUT
     nsresult SetDebug(nsPresContext* aPresContext, bool aDebug);
     bool GetInitialDebug(bool& aDebug);
-    void GetDebugPref(nsPresContext* aPresContext);
+    void GetDebugPref();
 
     void GetDebugBorder(nsMargin& aInset);
     void GetDebugPadding(nsMargin& aInset);
     void GetDebugMargin(nsMargin& aInset);
 
     nsresult GetFrameSizeWithMargin(nsIFrame* aBox, nsSize& aSize);
 
-    void PixelMarginToTwips(nsPresContext* aPresContext, nsMargin& aMarginPixels);
+    void PixelMarginToTwips(nsMargin& aMarginPixels);
 
     void GetValue(nsPresContext* aPresContext, const nsSize& a, const nsSize& b, char* value);
     void GetValue(nsPresContext* aPresContext, int32_t a, int32_t b, char* value);
     void DrawSpacer(nsPresContext* aPresContext, DrawTarget& aDrawTarget, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize);
     void DrawLine(DrawTarget& aDrawTarget,  bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
     void FillRect(DrawTarget& aDrawTarget,  bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height);
 #endif
     virtual void UpdateMouseThrough();
--- a/layout/xul/nsGroupBoxFrame.cpp
+++ b/layout/xul/nsGroupBoxFrame.cpp
@@ -46,17 +46,17 @@ public:
   // make sure we our kids get our orient and align instead of us.
   // our child box has no content node so it will search for a parent with one.
   // that will be us.
   virtual void GetInitialOrientation(bool& aHorizontal) override { aHorizontal = false; }
   virtual bool GetInitialHAlignment(Halignment& aHalign) override { aHalign = hAlign_Left; return true; } 
   virtual bool GetInitialVAlignment(Valignment& aValign) override { aValign = vAlign_Top; return true; } 
   virtual bool GetInitialAutoStretch(bool& aStretch) override { aStretch = true; return true; } 
 
-  nsIFrame* GetCaptionBox(nsPresContext* aPresContext, nsRect& aCaptionRect);
+  nsIFrame* GetCaptionBox(nsRect& aCaptionRect);
 };
 
 /*
 class nsGroupBoxInnerFrame : public nsBoxFrame {
 public:
 
     nsGroupBoxInnerFrame(nsIPresShell* aShell, nsStyleContext* aContext):
       nsBoxFrame(aShell, aContext) {}
@@ -167,17 +167,17 @@ nsGroupBoxFrame::PaintBorderBackground(n
 
   Sides skipSides;
   const nsStyleBorder* borderStyleData = StyleBorder();
   const nsMargin& border = borderStyleData->GetComputedBorder();
   nscoord yoff = 0;
   nsPresContext* presContext = PresContext();
 
   nsRect groupRect;
-  nsIFrame* groupBox = GetCaptionBox(presContext, groupRect);
+  nsIFrame* groupBox = GetCaptionBox(groupRect);
 
   if (groupBox) {        
     // if the border is smaller than the legend. Move the border down
     // to be centered on the legend. 
     nsMargin groupMargin;
     groupBox->StyleMargin()->GetMargin(groupMargin);
     groupRect.Inflate(groupMargin);
  
@@ -248,17 +248,17 @@ nsGroupBoxFrame::PaintBorderBackground(n
                                   mStyleContext,
                                   PaintBorderFlags::SYNC_DECODE_IMAGES, skipSides);
   }
 
   return result;
 }
 
 nsIFrame*
-nsGroupBoxFrame::GetCaptionBox(nsPresContext* aPresContext, nsRect& aCaptionRect)
+nsGroupBoxFrame::GetCaptionBox(nsRect& aCaptionRect)
 {
     // first child is our grouped area
     nsIFrame* box = nsBox::GetChildBox(this);
 
     // no area fail.
     if (!box)
       return nullptr;
 
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ b/layout/xul/nsListBoxBodyFrame.cpp
@@ -1174,17 +1174,17 @@ nsListBoxBodyFrame::GetFirstItemBox(int3
     // Either append the new frame, or prepend it (at index 0)
     // XXX check here if frame was even created, it may not have been if
     //     display: none was on listitem content
     bool isAppend = mRowsToPrepend <= 0;
     
     nsPresContext* presContext = PresContext();
     nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
     nsIFrame* topFrame = nullptr;
-    fc->CreateListBoxContent(presContext, this, nullptr, startContent,
+    fc->CreateListBoxContent(this, nullptr, startContent,
                              &topFrame, isAppend, false, nullptr);
     mTopFrame = topFrame;
     if (mTopFrame) {
       if (aCreated)
         *aCreated = true;
 
       mBottomFrame = mTopFrame;
 
@@ -1227,17 +1227,17 @@ nsListBoxBodyFrame::GetNextItemBox(nsIFr
       }
       if (!existingFrame) {
         // Either append the new frame, or insert it after the current frame
         bool isAppend = result != mLinkupFrame && mRowsToPrepend <= 0;
         nsIFrame* prevFrame = isAppend ? nullptr : aBox;
       
         nsPresContext* presContext = PresContext();
         nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor();
-        fc->CreateListBoxContent(presContext, this, prevFrame, nextContent,
+        fc->CreateListBoxContent(this, prevFrame, nextContent,
                                  &result, isAppend, false, nullptr);
 
         if (result) {
           if (aCreated)
             *aCreated = true;
         } else
           return GetNextItemBox(aBox, ++aOffset, aCreated);
       } else {
@@ -1334,18 +1334,18 @@ nsListBoxBodyFrame::ListBoxInsertFrames(
                      NS_FRAME_HAS_DIRTY_CHILDREN);
 
   return NS_OK;
 }
 
 // 
 // Called by nsCSSFrameConstructor when a new listitem content is inserted.
 //
-void 
-nsListBoxBodyFrame::OnContentInserted(nsPresContext* aPresContext, nsIContent* aChildContent)
+void
+nsListBoxBodyFrame::OnContentInserted(nsIContent* aChildContent)
 {
   if (mRowCount >= 0)
     ++mRowCount;
 
   // The RDF content builder will build content nodes such that they are all 
   // ready when OnContentInserted is first called, meaning the first call
   // to CreateRows will create all the frames, but OnContentInserted will
   // still be called again for each content node - so we need to make sure
--- a/layout/xul/nsListBoxBodyFrame.h
+++ b/layout/xul/nsListBoxBodyFrame.h
@@ -117,17 +117,17 @@ public:
   void CreateRows();
   void DestroyRows(int32_t& aRowsToLose);
   void ReverseDestroyRows(int32_t& aRowsToLose);
   nsIFrame* GetFirstItemBox(int32_t aOffset, bool* aCreated);
   nsIFrame* GetNextItemBox(nsIFrame* aBox, int32_t aOffset, bool* aCreated);
   bool ContinueReflow(nscoord height);
   NS_IMETHOD ListBoxAppendFrames(nsFrameList& aFrameList);
   NS_IMETHOD ListBoxInsertFrames(nsIFrame* aPrevFrame, nsFrameList& aFrameList);
-  void OnContentInserted(nsPresContext* aPresContext, nsIContent* aContent);
+  void OnContentInserted(nsIContent* aContent);
   void OnContentRemoved(nsPresContext* aPresContext,  nsIContent* aContainer,
                         nsIFrame* aChildFrame, nsIContent* aOldNextSibling);
 
   void GetListItemContentAt(int32_t aIndex, nsIContent** aContent);
   void GetListItemNextSibling(nsIContent* aListItem, nsIContent** aContent, int32_t& aSiblingIndex);
 
   void PostReflowCallback();
 
--- a/layout/xul/nsMenuBarFrame.cpp
+++ b/layout/xul/nsMenuBarFrame.cpp
@@ -185,17 +185,17 @@ nsMenuBarFrame::FindMenuWithShortcut(nsI
   nsIFrame* foundMenu = nullptr;
   size_t foundIndex = accessKeys.NoIndex;
   nsIFrame* currFrame = immediateParent->GetFirstPrincipalChild();
 
   while (currFrame) {
     nsIContent* current = currFrame->GetContent();
 
     // See if it's a menu item.
-    if (nsXULPopupManager::IsValidMenuItem(PresContext(), current, false)) {
+    if (nsXULPopupManager::IsValidMenuItem(current, false)) {
       // Get the shortcut attribute.
       nsAutoString shortcutKey;
       current->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, shortcutKey);
       if (!shortcutKey.IsEmpty()) {
         ToLowerCase(shortcutKey);
         const char16_t* start = shortcutKey.BeginReading();
         const char16_t* end = shortcutKey.EndReading();
         uint32_t ch = UTF16CharEnumerator::NextChar(&start, end);
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -120,27 +120,27 @@ public:
   {
   }
 
   NS_IMETHOD Run() override
   {
     nsMenuFrame* frame = static_cast<nsMenuFrame*>(mFrame.GetFrame());
     NS_ENSURE_STATE(frame);
     if (mAttr == nsGkAtoms::checked) {
-      frame->UpdateMenuSpecialState(frame->PresContext());
+      frame->UpdateMenuSpecialState();
     } else if (mAttr == nsGkAtoms::acceltext) {
       // someone reset the accelText attribute,
       // so clear the bit that says *we* set it
       frame->RemoveStateBits(NS_STATE_ACCELTEXT_IS_DERIVED);
       frame->BuildAcceleratorText(true);
     }
     else if (mAttr == nsGkAtoms::key) {
       frame->BuildAcceleratorText(true);
     } else if (mAttr == nsGkAtoms::type || mAttr == nsGkAtoms::name) {
-      frame->UpdateMenuType(frame->PresContext());
+      frame->UpdateMenuType();
     }
     return NS_OK;
   }
 protected:
   nsWeakFrame       mFrame;
   nsCOMPtr<nsIAtom> mAttr;
 };
 
@@ -206,17 +206,17 @@ public:
   {
   }
 
   virtual bool ReflowFinished() override
   {
     bool shouldFlush = false;
     nsMenuFrame* menu = do_QueryFrame(mWeakFrame.GetFrame());
     if (menu) {
-      menu->UpdateMenuType(menu->PresContext());
+      menu->UpdateMenuType();
       shouldFlush = true;
     }
     delete this;
     return shouldFlush;
   }
 
   virtual void ReflowCallbackCanceled() override
   {
@@ -908,17 +908,17 @@ nsMenuFrame::Notify(nsITimer* aTimer)
 bool 
 nsMenuFrame::IsDisabled()
 {
   return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                                nsGkAtoms::_true, eCaseMatters);
 }
 
 void
-nsMenuFrame::UpdateMenuType(nsPresContext* aPresContext)
+nsMenuFrame::UpdateMenuType()
 {
   static nsIContent::AttrValuesArray strings[] =
     {&nsGkAtoms::checkbox, &nsGkAtoms::radio, nullptr};
   switch (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
                                     strings, eCaseMatters)) {
     case 0: mType = eMenuType_Checkbox; break;
     case 1:
       mType = eMenuType_Radio;
@@ -930,22 +930,22 @@ nsMenuFrame::UpdateMenuType(nsPresContex
         nsWeakFrame weakFrame(this);
         mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::checked,
                             true);
         ENSURE_TRUE(weakFrame.IsAlive());
       }
       mType = eMenuType_Normal;
       break;
   }
-  UpdateMenuSpecialState(aPresContext);
+  UpdateMenuSpecialState();
 }
 
 /* update checked-ness for type="checkbox" and type="radio" */
 void
-nsMenuFrame::UpdateMenuSpecialState(nsPresContext* aPresContext)
+nsMenuFrame::UpdateMenuSpecialState()
 {
   bool newChecked =
     mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
                           nsGkAtoms::_true, eCaseMatters); 
   if (newChecked == mChecked) {
     /* checked state didn't change */
 
     if (mType != eMenuType_Radio)
--- a/layout/xul/nsMenuFrame.h
+++ b/layout/xul/nsMenuFrame.h
@@ -230,20 +230,20 @@ protected:
 
   /**
    * Destroy the popup list property.  The list must exist and be empty.
    */
   void DestroyPopupList();
 
   // Update the menu's type (normal, checkbox, radio).
   // This method can destroy the frame.
-  void UpdateMenuType(nsPresContext* aPresContext);
+  void UpdateMenuType();
   // Update the checked state of the menu, and for radios, clear any other
   // checked items. This method can destroy the frame.
-  void UpdateMenuSpecialState(nsPresContext* aPresContext);
+  void UpdateMenuSpecialState();
 
   // Examines the key node and builds the accelerator.
   void BuildAcceleratorText(bool aNotify);
 
   // Called to execute our command handler. This method can destroy the frame.
   void Execute(mozilla::WidgetGUIEvent *aEvent);
 
   // This method can destroy the frame
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -1742,17 +1742,17 @@ void nsMenuPopupFrame::ChangeByPage(bool
     bool lastWasValid = false;
 
     // Look for the next child which is just past the target position. This child
     // will need to be selected.
     while (currentMenu) {
       // Only consider menu frames.
       nsMenuFrame* menuFrame = do_QueryFrame(currentMenu);
       if (menuFrame &&
-          nsXULPopupManager::IsValidMenuItem(PresContext(), menuFrame->GetContent(), true)) {
+          nsXULPopupManager::IsValidMenuItem(menuFrame->GetContent(), true)) {
 
         // If the right position was found, break out. Otherwise, look for another item.
         if ((!aIsUp && currentMenu->GetRect().YMost() > targetPosition) ||
             (aIsUp && currentMenu->GetRect().y < targetPosition)) {
 
           // If the last visible child was not a valid menuitem or was disabled,
           // use this as the menu to select, skipping over any non-valid items at
           // the edge of the page.
--- a/layout/xul/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/nsScrollbarButtonFrame.cpp
@@ -225,18 +225,17 @@ void
 nsScrollbarButtonFrame::MouseClicked(nsPresContext* aPresContext,
                                      WidgetGUIEvent* aEvent) 
 {
   nsButtonBoxFrame::MouseClicked(aPresContext, aEvent);
   //MouseClicked();
 }
 
 nsresult
-nsScrollbarButtonFrame::GetChildWithTag(nsPresContext* aPresContext,
-                                        nsIAtom* atom, nsIFrame* start,
+nsScrollbarButtonFrame::GetChildWithTag(nsIAtom* atom, nsIFrame* start,
                                         nsIFrame*& result)
 {
   // recursively search our children
   nsIFrame* childFrame = start->GetFirstPrincipalChild();
   while (nullptr != childFrame) 
   {    
     // get the content node
     nsIContent* child = childFrame->GetContent();
@@ -247,17 +246,17 @@ nsScrollbarButtonFrame::GetChildWithTag(
        {
          result = childFrame;
 
          return NS_OK;
        }
     }
 
      // recursive search the child
-     GetChildWithTag(aPresContext, atom, childFrame, result);
+     GetChildWithTag(atom, childFrame, result);
      if (result != nullptr) 
        return NS_OK;
 
     childFrame = childFrame->GetNextSibling();
   }
 
   result = nullptr;
   return NS_OK;
--- a/layout/xul/nsScrollbarButtonFrame.h
+++ b/layout/xul/nsScrollbarButtonFrame.h
@@ -30,18 +30,17 @@ public:
   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
 
   friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
                                mozilla::WidgetGUIEvent* aEvent,
                                nsEventStatus* aEventStatus) override;
 
-  static nsresult GetChildWithTag(nsPresContext* aPresContext,
-                                  nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
+  static nsresult GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
   static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
 
   bool HandleButtonPress(nsPresContext* aPresContext,
                          mozilla::WidgetGUIEvent* aEvent,
                          nsEventStatus* aEventStatus);
 
   NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
                                  mozilla::WidgetGUIEvent* aEvent,
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -79,27 +79,26 @@ public:
   void AdjustChildren(nsPresContext* aPresContext);
   void AdjustChildren(nsPresContext* aPresContext, nsSplitterInfo* aChildInfos, int32_t aCount, bool aIsHorizontal);
 
   void AddRemoveSpace(nscoord aDiff,
                     nsSplitterInfo* aChildInfos,
                     int32_t aCount,
                     int32_t& aSpaceLeft);
 
-  void ResizeChildTo(nsPresContext* aPresContext,
-                   nscoord& aDiff, 
-                   nsSplitterInfo* aChildrenBeforeInfos, 
-                   nsSplitterInfo* aChildrenAfterInfos, 
-                   int32_t aChildrenBeforeCount, 
-                   int32_t aChildrenAfterCount, 
-                   bool aBounded);
+  void ResizeChildTo(nscoord& aDiff,
+                     nsSplitterInfo* aChildrenBeforeInfos,
+                     nsSplitterInfo* aChildrenAfterInfos,
+                     int32_t aChildrenBeforeCount,
+                     int32_t aChildrenAfterCount,
+                     bool aBounded);
 
   void UpdateState();
 
-  void AddListener(nsPresContext* aPresContext);
+  void AddListener();
   void RemoveListener();
 
   enum ResizeType { Closest, Farthest, Flex, Grow };
   enum State { Open, CollapsedBefore, CollapsedAfter, Dragging };
   enum CollapseDirection { Before, After };
 
   ResizeType GetResizeBefore();
   ResizeType GetResizeAfter();
@@ -244,17 +243,17 @@ nsSplitterFrame::AttributeChanged(int32_
 {
   nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                              aModType);
   // if the alignment changed. Let the grippy know
   if (aAttribute == nsGkAtoms::align) {
     // tell the slider its attribute changed so it can 
     // update itself
     nsIFrame* grippy = nullptr;
-    nsScrollbarButtonFrame::GetChildWithTag(PresContext(), nsGkAtoms::grippy, this, grippy);
+    nsScrollbarButtonFrame::GetChildWithTag(nsGkAtoms::grippy, this, grippy);
     if (grippy)
       grippy->AttributeChanged(aNameSpaceID, aAttribute, aModType);
   } else if (aAttribute == nsGkAtoms::state) {
     mInner->UpdateState();
   }
 
   return rv;
 }
@@ -290,17 +289,17 @@ nsSplitterFrame::Init(nsIContent*       
         SetStyleContextWithoutNotification(newContext);
       }
     }
   }
 
   nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
 
   mInner->mState = nsSplitterFrameInner::Open;
-  mInner->AddListener(PresContext());
+  mInner->AddListener();
   mInner->mParentBox = nullptr;
 }
 
 NS_IMETHODIMP
 nsSplitterFrame::DoLayout(nsBoxLayoutState& aState)
 {
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW) 
   {
@@ -405,17 +404,17 @@ nsSplitterFrame::HandleEvent(nsPresConte
 }
 
 void
 nsSplitterFrameInner::MouseUp(nsPresContext* aPresContext,
                               WidgetGUIEvent* aEvent)
 {
   if (mDragging && mOuter) {
     AdjustChildren(aPresContext);
-    AddListener(aPresContext);
+    AddListener();
     nsIPresShell::SetCapturingContent(nullptr, 0); // XXXndeakin is this needed?
     mDragging = false;
     State newState = GetState(); 
     // if the state is dragging then make it Open.
     if (newState == Dragging)
       mOuter->mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::state, EmptyString(), true);
 
     mPressed = false;
@@ -470,17 +469,17 @@ nsSplitterFrameInner::MouseDrag(nsPresCo
     for (i=0; i < mChildInfosBeforeCount; i++) 
       mChildInfosBefore[i].changed = mChildInfosBefore[i].current;
 
     for (i=0; i < mChildInfosAfterCount; i++) 
       mChildInfosAfter[i].changed = mChildInfosAfter[i].current;
 
     nscoord oldPos = pos;
 
-    ResizeChildTo(aPresContext, pos,
+    ResizeChildTo(pos,
                   mChildInfosBefore.get(), mChildInfosAfter.get(),
                   mChildInfosBeforeCount, mChildInfosAfterCount, bounded);
 
     State currentState = GetState();
     bool supportsBefore = SupportsCollapseDirection(Before);
     bool supportsAfter = SupportsCollapseDirection(After);
 
     const bool isRTL = mOuter->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
@@ -537,17 +536,17 @@ nsSplitterFrameInner::MouseDrag(nsPresCo
       AdjustChildren(aPresContext);
     }
 
     mDidDrag = true;
   }
 }
 
 void
-nsSplitterFrameInner::AddListener(nsPresContext* aPresContext)
+nsSplitterFrameInner::AddListener()
 {
   mOuter->GetContent()->
     AddEventListener(NS_LITERAL_STRING("mouseup"), this, false, false);
   mOuter->GetContent()->
     AddEventListener(NS_LITERAL_STRING("mousedown"), this, false, false);
   mOuter->GetContent()->
     AddEventListener(NS_LITERAL_STRING("mousemove"), this, false, false);
   mOuter->GetContent()->
@@ -1018,24 +1017,23 @@ nsSplitterFrameInner::AddRemoveSpace(nsc
 /**
  * Ok if we want to resize a child we will know the actual size in pixels we want it to be.
  * This is not the preferred size. But they only way we can change a child is my manipulating its
  * preferred size. So give the actual pixel size this return method will return figure out the preferred
  * size and set it.
  */
 
 void
-nsSplitterFrameInner::ResizeChildTo(nsPresContext* aPresContext,
-                                   nscoord& aDiff, 
-                                   nsSplitterInfo* aChildrenBeforeInfos, 
-                                   nsSplitterInfo* aChildrenAfterInfos, 
-                                   int32_t aChildrenBeforeCount, 
-                                   int32_t aChildrenAfterCount, 
-                                   bool aBounded)
-{ 
+nsSplitterFrameInner::ResizeChildTo(nscoord& aDiff,
+                                    nsSplitterInfo* aChildrenBeforeInfos,
+                                    nsSplitterInfo* aChildrenAfterInfos,
+                                    int32_t aChildrenBeforeCount,
+                                    int32_t aChildrenAfterCount,
+                                    bool aBounded)
+{
   nscoord spaceLeft;
   AddRemoveSpace(aDiff, aChildrenBeforeInfos,aChildrenBeforeCount,spaceLeft);
 
   // if there is any space left over remove it from the dif we were originally given
   aDiff -= spaceLeft;
   AddRemoveSpace(-aDiff, aChildrenAfterInfos,aChildrenAfterCount,spaceLeft);
 
   if (spaceLeft != 0) {
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -615,18 +615,17 @@ nsTextBoxFrame::CalculateUnderline(nsRen
          nscoord offset, baseline;
          aFontMetrics.GetUnderline(offset, mAccessKeyInfo->mAccessUnderlineSize);
          baseline = aFontMetrics.MaxAscent();
          mAccessKeyInfo->mAccessOffset = baseline - offset;
     }
 }
 
 nscoord
-nsTextBoxFrame::CalculateTitleForWidth(nsPresContext*      aPresContext,
-                                       nsRenderingContext& aRenderingContext,
+nsTextBoxFrame::CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
                                        nscoord              aWidth)
 {
     if (mTitle.IsEmpty()) {
         mCroppedTitle.Truncate();
         return 0;
     }
 
     RefPtr<nsFontMetrics> fm;
@@ -1011,41 +1010,37 @@ nsTextBoxFrame::ComputesOwnOverflowArea(
 /* virtual */ void
 nsTextBoxFrame::MarkIntrinsicISizesDirty()
 {
     mNeedsRecalc = true;
     nsTextBoxFrameSuper::MarkIntrinsicISizesDirty();
 }
 
 void
-nsTextBoxFrame::GetTextSize(nsPresContext* aPresContext,
-                            nsRenderingContext& aRenderingContext,
+nsTextBoxFrame::GetTextSize(nsRenderingContext& aRenderingContext,
                             const nsString& aString,
                             nsSize& aSize, nscoord& aAscent)
 {
     RefPtr<nsFontMetrics> fontMet;
     nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
     aSize.height = fontMet->MaxHeight();
     aSize.width =
       nsLayoutUtils::AppUnitWidthOfStringBidi(aString, this, *fontMet,
                                               aRenderingContext);
     aAscent = fontMet->MaxAscent();
 }
 
 void
 nsTextBoxFrame::CalcTextSize(nsBoxLayoutState& aBoxLayoutState)
 {
-    if (mNeedsRecalc)
-    {
+    if (mNeedsRecalc) {
         nsSize size;
-        nsPresContext* presContext = aBoxLayoutState.PresContext();
         nsRenderingContext* rendContext = aBoxLayoutState.GetRenderingContext();
         if (rendContext) {
-            GetTextSize(presContext, *rendContext,
-                        mTitle, size, mAscent);
+            GetTextSize(*rendContext, mTitle, size, mAscent);
             if (GetWritingMode().IsVertical()) {
                 Swap(size.width, size.height);
             }
             mTextSize = size;
             mNeedsRecalc = false;
         }
     }
 }
@@ -1056,23 +1051,21 @@ nsTextBoxFrame::CalcDrawRect(nsRendering
     WritingMode wm = GetWritingMode();
 
     LogicalRect textRect(wm, LogicalPoint(wm, 0, 0), GetLogicalSize(wm));
     nsMargin borderPadding;
     GetBorderAndPadding(borderPadding);
     textRect.Deflate(wm, LogicalMargin(wm, borderPadding));
 
     // determine (cropped) title and underline position
-    nsPresContext* presContext = PresContext();
     // determine (cropped) title which fits in aRect, and its width
     // (where "width" is the text measure along its baseline, i.e. actually
     // a physical height in vertical writing modes)
     nscoord titleWidth =
-        CalculateTitleForWidth(presContext, aRenderingContext,
-                               textRect.ISize(wm));
+        CalculateTitleForWidth(aRenderingContext, textRect.ISize(wm));
 
 #ifdef ACCESSIBILITY
     // Make sure to update the accessible tree in case when cropped title is
     // changed.
     nsAccessibilityService* accService = GetAccService();
     if (accService) {
         accService->UpdateLabelValue(PresContext()->PresShell(), mContent,
                                      mCroppedTitle);
--- a/layout/xul/nsTextBoxFrame.h
+++ b/layout/xul/nsTextBoxFrame.h
@@ -89,22 +89,20 @@ protected:
                           nsFontMetrics& aFontMetrics);
 
   void CalcTextSize(nsBoxLayoutState& aBoxLayoutState);
 
   void CalcDrawRect(nsRenderingContext &aRenderingContext);
 
   explicit nsTextBoxFrame(nsStyleContext* aContext);
 
-  nscoord CalculateTitleForWidth(nsPresContext*      aPresContext,
-                                 nsRenderingContext& aRenderingContext,
+  nscoord CalculateTitleForWidth(nsRenderingContext& aRenderingContext,
                                  nscoord              aWidth);
 
-  void GetTextSize(nsPresContext*      aPresContext,
-                   nsRenderingContext& aRenderingContext,
+  void GetTextSize(nsRenderingContext& aRenderingContext,
                    const nsString&      aString,
                    nsSize&              aSize,
                    nscoord&             aAscent);
 
   nsresult RegUnregAccessKey(bool aDoReg);
 
 private:
 
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -2315,17 +2315,17 @@ nsXULPopupManager::GetNextMenuItem(nsCon
       currFrame = aStart->GetParent()->GetNextSibling();
   }
   else
     currFrame = immediateParent->GetFirstPrincipalChild();
 
   while (currFrame) {
     // See if it's a menu item.
     nsIContent* currFrameContent = currFrame->GetContent();
-    if (IsValidMenuItem(presContext, currFrameContent, aIsPopup)) {
+    if (IsValidMenuItem(currFrameContent, aIsPopup)) {
       return do_QueryFrame(currFrame);
     }
     if (currFrameContent->IsXULElement(nsGkAtoms::menugroup) &&
         currFrameContent->GetChildCount() > 0)
       currFrame = currFrame->GetFirstPrincipalChild();
     else if (!currFrame->GetNextSibling() &&
              currFrame->GetParent()->GetContent()->IsXULElement(nsGkAtoms::menugroup))
       currFrame = currFrame->GetParent()->GetNextSibling();
@@ -2334,17 +2334,17 @@ nsXULPopupManager::GetNextMenuItem(nsCon
   }
 
   currFrame = immediateParent->GetFirstPrincipalChild();
 
   // Still don't have anything. Try cycling from the beginning.
   while (currFrame && currFrame != aStart) {
     // See if it's a menu item.
     nsIContent* currFrameContent = currFrame->GetContent();
-    if (IsValidMenuItem(presContext, currFrameContent, aIsPopup)) {
+    if (IsValidMenuItem(currFrameContent, aIsPopup)) {
       return do_QueryFrame(currFrame);
     }
     if (currFrameContent->IsXULElement(nsGkAtoms::menugroup) &&
         currFrameContent->GetChildCount() > 0)
       currFrame = currFrame->GetFirstPrincipalChild();
     else if (!currFrame->GetNextSibling() &&
              currFrame->GetParent()->GetContent()->IsXULElement(nsGkAtoms::menugroup))
       currFrame = currFrame->GetParent()->GetNextSibling();
@@ -2378,17 +2378,17 @@ nsXULPopupManager::GetPreviousMenuItem(n
       currFrame = aStart->GetParent()->GetPrevSibling();
   }
   else
     currFrame = frames.LastChild();
 
   while (currFrame) {
     // See if it's a menu item.
     nsIContent* currFrameContent = currFrame->GetContent();
-    if (IsValidMenuItem(presContext, currFrameContent, aIsPopup)) {
+    if (IsValidMenuItem(currFrameContent, aIsPopup)) {
       return do_QueryFrame(currFrame);
     }
     if (currFrameContent->IsXULElement(nsGkAtoms::menugroup) &&
         currFrameContent->GetChildCount() > 0) {
       const nsFrameList& menugroupFrames(currFrame->PrincipalChildList());
       currFrame = menugroupFrames.LastChild();
     }
     else if (!currFrame->GetPrevSibling() &&
@@ -2399,17 +2399,17 @@ nsXULPopupManager::GetPreviousMenuItem(n
   }
 
   currFrame = frames.LastChild();
 
   // Still don't have anything. Try cycling from the end.
   while (currFrame && currFrame != aStart) {
     // See if it's a menu item.
     nsIContent* currFrameContent = currFrame->GetContent();
-    if (IsValidMenuItem(presContext, currFrameContent, aIsPopup)) {
+    if (IsValidMenuItem(currFrameContent, aIsPopup)) {
       return do_QueryFrame(currFrame);
     }
     if (currFrameContent->IsXULElement(nsGkAtoms::menugroup) &&
         currFrameContent->GetChildCount() > 0) {
       const nsFrameList& menugroupFrames(currFrame->PrincipalChildList());
       currFrame = menugroupFrames.LastChild();
     }
     else if (!currFrame->GetPrevSibling() &&
@@ -2419,19 +2419,17 @@ nsXULPopupManager::GetPreviousMenuItem(n
       currFrame = currFrame->GetPrevSibling();
   }
 
   // No luck. Just return our start value.
   return aStart;
 }
 
 bool
-nsXULPopupManager::IsValidMenuItem(nsPresContext* aPresContext,
-                                   nsIContent* aContent,
-                                   bool aOnPopup)
+nsXULPopupManager::IsValidMenuItem(nsIContent* aContent, bool aOnPopup)
 {
   if (aContent->IsXULElement()) {
     if (!aContent->IsAnyOfXULElements(nsGkAtoms::menu, nsGkAtoms::menuitem)) {
       return false;
     }
   }
   else if (!aOnPopup || !aContent->IsHTMLElement(nsGkAtoms::option)) {
     return false;
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -343,19 +343,17 @@ public:
                                           bool aIsPopup);
   static nsMenuFrame* GetNextMenuItem(nsContainerFrame* aParent,
                                       nsMenuFrame* aStart,
                                       bool aIsPopup);
 
   // returns true if the menu item aContent is a valid menuitem which may
   // be navigated to. aIsPopup should be true for items on a popup, or false
   // for items on a menubar.
-  static bool IsValidMenuItem(nsPresContext* aPresContext,
-                                nsIContent* aContent,
-                                bool aOnPopup);
+  static bool IsValidMenuItem(nsIContent* aContent, bool aOnPopup);
 
   // inform the popup manager that a menu bar has been activated or deactivated,
   // either because one of its menus has opened or closed, or that the menubar
   // has been focused such that its menus may be navigated with the keyboard.
   // aActivate should be true when the menubar should be focused, and false
   // when the active menu bar should be defocused. In the latter case, if
   // aMenuBar isn't currently active, yet another menu bar is, that menu bar
   // will remain active.
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -591,24 +591,24 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
 
   // if a custom image was specified, check if it is an image node and draw
   // using the source rather than the displayed image. But if mImage isn't
   // an image or canvas, fall through to RenderNode below.
   if (mImage) {
     nsCOMPtr<nsIContent> content = do_QueryInterface(dragNode);
     HTMLCanvasElement *canvas = HTMLCanvasElement::FromContentOrNull(content);
     if (canvas) {
-      return DrawDragForImage(*aPresContext, nullptr, canvas, sx, sy,
+      return DrawDragForImage(nullptr, canvas, sx, sy,
                               aScreenDragRect, aSurface);
     }
 
     nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(dragNode);
     // for image nodes, create the drag image from the actual image data
     if (imageLoader) {
-      return DrawDragForImage(*aPresContext, imageLoader, nullptr, sx, sy,
+      return DrawDragForImage(imageLoader, nullptr, sx, sy,
                               aScreenDragRect, aSurface);
     }
 
     // If the image is a popup, use that as the image. This allows custom drag
     // images that can change during the drag, but means that any platform
     // default image handling won't occur.
     // XXXndeakin this should be chrome-only
 
@@ -637,18 +637,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode* 
     aScreenDragRect->x = sx - mImageOffset.x;
     aScreenDragRect->y = sy - mImageOffset.y;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
-                                    nsIImageLoadingContent* aImageLoader,
+nsBaseDragService::DrawDragForImage(nsIImageLoadingContent* aImageLoader,
                                     HTMLCanvasElement* aCanvas,
                                     int32_t aScreenX, int32_t aScreenY,
                                     nsIntRect* aScreenDragRect,
                                     RefPtr<SourceSurface>* aSurface)
 {
   nsCOMPtr<imgIContainer> imgContainer;
   if (aImageLoader) {
     nsCOMPtr<imgIRequest> imgRequest;
--- a/widget/nsBaseDragService.h
+++ b/widget/nsBaseDragService.h
@@ -107,18 +107,17 @@ protected:
                     nsIntRect* aScreenDragRect,
                     RefPtr<SourceSurface>* aSurface,
                     nsPresContext **aPresContext);
 
   /**
    * Draw a drag image for an image node specified by aImageLoader or aCanvas.
    * This is called by DrawDrag.
    */
-  nsresult DrawDragForImage(nsPresContext* aPresContext,
-                            nsIImageLoadingContent* aImageLoader,
+  nsresult DrawDragForImage(nsIImageLoadingContent* aImageLoader,
                             mozilla::dom::HTMLCanvasElement* aCanvas,
                             int32_t aScreenX, int32_t aScreenY,
                             nsIntRect* aScreenDragRect,
                             RefPtr<SourceSurface>* aSurface);
 
   /**
    * Convert aScreenX and aScreenY from CSS pixels into unscaled device pixels.
    */
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -2253,19 +2253,19 @@ NS_IMETHODIMP
 nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
                                        uint8_t aWidgetType,
                                        LayoutDeviceIntSize* aResult, bool* aIsOverridable)
 {
   (*aResult).width = (*aResult).height = 0;
   *aIsOverridable = true;
 
   HANDLE theme = GetTheme(aWidgetType);
-  if (!theme)
-    return ClassicGetMinimumWidgetSize(aPresContext, aFrame, aWidgetType, aResult, aIsOverridable);
-
+  if (!theme) {
+    return ClassicGetMinimumWidgetSize(aFrame, aWidgetType, aResult, aIsOverridable);
+  }
   switch (aWidgetType) {
     case NS_THEME_GROUPBOX:
     case NS_THEME_NUMBER_INPUT:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TOOLBOX:
     case NS_THEME_WIN_MEDIA_TOOLBOX:
     case NS_THEME_WIN_COMMUNICATIONS_TOOLBOX:
     case NS_THEME_WIN_BROWSER_TAB_BAR_TOOLBOX:
@@ -2295,17 +2295,17 @@ nsNativeThemeWin::GetMinimumWidgetSize(n
     case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
     case NS_THEME_SCROLLBAR_BUTTON_UP:
     case NS_THEME_SCROLLBAR_BUTTON_DOWN:
     case NS_THEME_SCROLLBAR_BUTTON_LEFT:
     case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
     case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
     case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
     case NS_THEME_DROPDOWN_BUTTON:
-      return ClassicGetMinimumWidgetSize(aPresContext, aFrame, aWidgetType, aResult, aIsOverridable);
+      return ClassicGetMinimumWidgetSize(aFrame, aWidgetType, aResult, aIsOverridable);
 
     case NS_THEME_MENUITEM:
     case NS_THEME_CHECKMENUITEM:
     case NS_THEME_RADIOMENUITEM:
       if(!IsTopLevelMenu(aFrame))
       {
         SIZE gutterSize(GetGutterSize(theme, nullptr));
         aResult->width = gutterSize.cx;
@@ -2606,24 +2606,24 @@ nsNativeThemeWin::ThemeSupportsWidget(ns
 
   HANDLE theme = nullptr;
   if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
     theme = GetTheme(NS_THEME_CHECKBOX);
   else if (aWidgetType == NS_THEME_RADIO_CONTAINER)
     theme = GetTheme(NS_THEME_RADIO);
   else
     theme = GetTheme(aWidgetType);
-    
+
   if (theme && aWidgetType == NS_THEME_RESIZER)
     return true;
 
-  if ((theme) || (!theme && ClassicThemeSupportsWidget(aPresContext, aFrame, aWidgetType)))
+  if ((theme) || (!theme && ClassicThemeSupportsWidget(aFrame, aWidgetType)))
     // turn off theming for some HTML widgets styled by the page
     return (!IsWidgetStyled(aPresContext, aFrame, aWidgetType));
-  
+
   return false;
 }
 
 bool 
 nsNativeThemeWin::WidgetIsContainer(uint8_t aWidgetType)
 {
   // XXXdwh At some point flesh all of this out.
   if (aWidgetType == NS_THEME_DROPDOWN_BUTTON || 
@@ -2730,20 +2730,19 @@ nsNativeThemeWin::GetWidgetTransparency(
 
   if (IsThemeBackgroundPartiallyTransparent(theme, part, state))
     return eTransparent;
   return eOpaque;
 }
 
 /* Windows 9x/NT/2000/Classic XP Theme Support */
 
-bool 
-nsNativeThemeWin::ClassicThemeSupportsWidget(nsPresContext* aPresContext,
-                                      nsIFrame* aFrame,
-                                      uint8_t aWidgetType)
+bool
+nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
+                                             uint8_t aWidgetType)
 {
   switch (aWidgetType) {
     case NS_THEME_RESIZER:
     {
       // The classic native resizer has an opaque grey background which doesn't
       // match the usually white background of the scrollable container, so
       // only support the native resizer if not in a scrollframe.
       nsIFrame* parentFrame = aFrame->GetParent();
@@ -2909,19 +2908,20 @@ nsNativeThemeWin::ClassicGetWidgetPaddin
       (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 1;
       return true;
     default:
       return false;
   }
 }
 
 nsresult
-nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
-                                       uint8_t aWidgetType,
-                                       LayoutDeviceIntSize* aResult, bool* aIsOverridable)
+nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIFrame* aFrame,
+                                              uint8_t aWidgetType,
+                                              LayoutDeviceIntSize* aResult,
+                                              bool* aIsOverridable)
 {
   (*aResult).width = (*aResult).height = 0;
   *aIsOverridable = true;
   switch (aWidgetType) {
     case NS_THEME_RADIO:
     case NS_THEME_CHECKBOX:
       (*aResult).width = (*aResult).height = 13;
       break;
--- a/widget/windows/nsNativeThemeWin.h
+++ b/widget/windows/nsNativeThemeWin.h
@@ -96,23 +96,20 @@ protected:
   nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext, 
                                   nsIFrame* aFrame,
                                   uint8_t aWidgetType,
                                   nsIntMargin* aResult);
   bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
                                nsIFrame* aFrame,
                                uint8_t aWidgetType,
                                nsIntMargin* aResult);
-  nsresult ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
-                                       uint8_t aWidgetType,
+  nsresult ClassicGetMinimumWidgetSize(nsIFrame* aFrame, uint8_t aWidgetType,
                                        mozilla::LayoutDeviceIntSize* aResult,
                                        bool* aIsOverridable);
-  bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, 
-                                  nsIFrame* aFrame,
-                                  uint8_t aWidgetType);
+  bool ClassicThemeSupportsWidget(nsIFrame* aFrame, uint8_t aWidgetType);
   void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
                        HBRUSH defaultBack);
   uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
   int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);
   bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
   RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect,
                                     bool aIsVertical, bool aIsIndeterminate,
                                     bool aIsClassic);