Bug 1443402 - Fix some -Wmissing-prototypes warnings in layout. r?dholbert draft
authorChris Peterson <cpeterson@mozilla.com>
Thu, 22 Feb 2018 21:03:45 -0800
changeset 763593 7e8d0a2a13808fedc77ff151913996f0787d262e
parent 763557 709eae4e54ffa3f3518745516dd5d27a05255af2
push id101483
push usercpeterson@mozilla.com
push dateTue, 06 Mar 2018 07:13:28 +0000
reviewersdholbert
bugs1443402
milestone60.0a1
Bug 1443402 - Fix some -Wmissing-prototypes warnings in layout. r?dholbert -Wmissing-prototypes is a new optional warning available in clang ToT. It warns about global functions that have no previous function declaration (e.g. from an #included header file). These functions can probably be made static (allowing the compiler to better optimize them) or they may be unused. Confusingly, clang's -Wmissing-prototypes is equivalent to gcc's -Wmissing-declarations, not gcc's -Wmissing-prototypes. A function prototype is a function declaration that specifies the function's argument types. C++ requires that all function declarations specify their argument types, but C does not. As such, gcc's -Wmissing-prototypes is a C-only warning about C functions that have no previous function *prototypes* (with argument types), even if a previous function *declaration* (without argument types) was seen. MozReview-Commit-ID: FGKVLzeQ2oK
layout/base/PresShell.cpp
layout/base/RestyleManager.cpp
layout/base/ZoomConstraintsClient.cpp
layout/base/gtest/TestAccessibleCaretEventHub.cpp
layout/base/nsLayoutDebugger.cpp
layout/base/nsLayoutUtils.cpp
layout/build/nsContentDLF.cpp
layout/build/nsLayoutModule.cpp
layout/generic/ReflowInput.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsSimplePageSequenceFrame.cpp
layout/generic/nsTextFrame.cpp
layout/ipc/RenderFrameParent.cpp
layout/mathml/nsMathMLmactionFrame.cpp
layout/painting/DisplayItemClip.cpp
layout/painting/FrameLayerBuilder.cpp
layout/painting/RetainedDisplayListBuilder.cpp
layout/painting/nsCSSRendering.cpp
layout/painting/nsCSSRenderingBorders.cpp
layout/painting/nsDisplayList.cpp
layout/style/ImageLoader.cpp
layout/style/ServoBindings.cpp
layout/style/StyleAnimationValue.cpp
layout/style/nsCSSProps.cpp
layout/svg/nsSVGIntegrationUtils.cpp
layout/tables/nsTableRowFrame.cpp
layout/xul/nsBoxFrame.cpp
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsSliderFrame.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -3742,17 +3742,17 @@ PresShell::ScheduleViewManagerFlush(Pain
 
   nsPresContext* presContext = GetPresContext();
   if (presContext) {
     presContext->RefreshDriver()->ScheduleViewManagerFlush();
   }
   SetNeedLayoutFlush();
 }
 
-bool
+static bool
 FlushLayoutRecursive(nsIDocument* aDocument,
                      void* aData = nullptr)
 {
   MOZ_ASSERT(!aData);
   nsCOMPtr<nsIDocument> kungFuDeathGrip(aDocument);
   aDocument->EnumerateSubDocuments(FlushLayoutRecursive, nullptr);
   aDocument->FlushPendingNotifications(FlushType::Layout);
   return true;
@@ -6735,17 +6735,18 @@ PresShell::RecordMouseLocation(WidgetGUI
     printf("[ps=%p]got mouse exit for %p\n",
            this, aEvent->mWidget);
     printf("[ps=%p]clearing mouse location\n",
            this);
 #endif
   }
 }
 
-nsIFrame* GetNearestFrameContainingPresShell(nsIPresShell* aPresShell)
+static nsIFrame*
+GetNearestFrameContainingPresShell(nsIPresShell* aPresShell)
 {
   nsView* view = aPresShell->GetViewManager()->GetRootView();
   while (view && !view->GetFrame()) {
     view = view->GetParent();
   }
 
   nsIFrame* frame = nullptr;
   if (view) {
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -845,17 +845,17 @@ GetFrameForChildrenOnlyTransformHint(nsI
   MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer),
              "Children-only transforms only expected on SVG frames");
   return aFrame;
 }
 
 // Returns true if this function managed to successfully move a frame, and
 // false if it could not process the position change, and a reflow should
 // be performed instead.
-bool
+static bool
 RecomputePosition(nsIFrame* aFrame)
 {
   // Don't process position changes on table frames, since we already handle
   // the dynamic position change on the table wrapper frame, and the
   // reflow-based fallback code path also ignores positions on inner table
   // frames.
   if (aFrame->IsTableFrame()) {
     return true;
--- a/layout/base/ZoomConstraintsClient.cpp
+++ b/layout/base/ZoomConstraintsClient.cpp
@@ -171,17 +171,17 @@ ZoomConstraintsClient::Observe(nsISuppor
 
 void
 ZoomConstraintsClient::ScreenSizeChanged()
 {
   ZCC_LOG("Got a screen-size change notification in %p\n", this);
   RefreshZoomConstraints();
 }
 
-mozilla::layers::ZoomConstraints
+static mozilla::layers::ZoomConstraints
 ComputeZoomConstraintsFromViewportInfo(const nsViewportInfo& aViewportInfo)
 {
   mozilla::layers::ZoomConstraints constraints;
   constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() && gfxPrefs::APZAllowZooming();
   constraints.mAllowDoubleTapZoom = constraints.mAllowZoom;
   if (constraints.mAllowZoom) {
     constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
     constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;
--- a/layout/base/gtest/TestAccessibleCaretEventHub.cpp
+++ b/layout/base/gtest/TestAccessibleCaretEventHub.cpp
@@ -86,18 +86,19 @@ public:
 
   MockAccessibleCaretManager* GetMockAccessibleCaretManager()
   {
     return static_cast<MockAccessibleCaretManager*>(mManager.get());
   }
 };
 
 // Print the name of the state for debugging.
-::std::ostream& operator<<(::std::ostream& aOstream,
-                           const MockAccessibleCaretEventHub::State* aState)
+static ::std::ostream&
+operator<<(::std::ostream& aOstream,
+           const MockAccessibleCaretEventHub::State* aState)
 {
   return aOstream << aState->Name();
 }
 
 class AccessibleCaretEventHubTester : public ::testing::Test
 {
 public:
   AccessibleCaretEventHubTester()
--- a/layout/base/nsLayoutDebugger.cpp
+++ b/layout/base/nsLayoutDebugger.cpp
@@ -87,17 +87,19 @@ NS_IMETHODIMP
 nsLayoutDebugger::GetShowEventTargetFrameBorder(bool* aResult)
 {
   *aResult = nsFrame::GetShowEventTargetFrameBorder();
   return NS_OK;
 }
 
 #endif
 
-std::ostream& operator<<(std::ostream& os, const nsPrintfCString& rhs) {
+static std::ostream&
+operator<<(std::ostream& os, const nsPrintfCString& rhs)
+{
   os << rhs.get();
   return os;
 }
 
 static void
 PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
                    std::stringstream& aStream, uint32_t aIndent, bool aDumpHtml);
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -828,17 +828,17 @@ nsLayoutUtils::FindContentFor(ViewID aId
 
   if (exists) {
     return content;
   } else {
     return nullptr;
   }
 }
 
-nsIFrame*
+static nsIFrame*
 GetScrollFrameFromContent(nsIContent* aContent)
 {
   nsIFrame* frame = aContent->GetPrimaryFrame();
   if (aContent->OwnerDoc()->GetRootElement() == aContent) {
     nsIPresShell* presShell = frame ? frame->PresShell() : nullptr;
     if (!presShell) {
       presShell = aContent->OwnerDoc()->GetShell();
     }
@@ -1311,17 +1311,17 @@ GetDisplayPortImpl(nsIContent* aContent,
       }
     }
   }
 
   *aResult = result;
   return true;
 }
 
-void
+static void
 TranslateFromScrollPortToScrollFrame(nsIContent* aContent, nsRect* aRect)
 {
   MOZ_ASSERT(aRect);
   nsIFrame* frame = GetScrollFrameFromContent(aContent);
   nsIScrollableFrame* scrollableFrame = frame ? frame->GetScrollTargetFrame() : nullptr;
   if (scrollableFrame) {
     *aRect += scrollableFrame->GetScrollPortRect().TopLeft();
   }
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -112,17 +112,17 @@ nsContentDLF::nsContentDLF()
 
 nsContentDLF::~nsContentDLF()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsContentDLF,
                   nsIDocumentLoaderFactory)
 
-bool
+static bool
 MayUseXULXBL(nsIChannel* aChannel)
 {
   nsIScriptSecurityManager *securityManager =
     nsContentUtils::GetSecurityManager();
   if (!securityManager) {
     return false;
   }
 
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -260,18 +260,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(Noti
 NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier)
 
 //-----------------------------------------------------------------------------
 
 static bool gInitialized = false;
 
 // Perform our one-time intialization for this module
 
-// static
-nsresult
+static nsresult
 Initialize()
 {
   if (gInitialized) {
     MOZ_CRASH("Recursive layout module initialization");
     return NS_ERROR_FAILURE;
   }
   if (XRE_GetProcessType() == GeckoProcessType_GPU) {
     // We mark the layout module as being available in the GPU process so that
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -1974,17 +1974,17 @@ ReflowInput::InitAbsoluteConstraints(nsP
   ComputedISize() = computedSize.ConvertTo(wm, cbwm).ISize(wm);
 
   SetComputedLogicalOffsets(offsets.ConvertTo(wm, cbwm));
   SetComputedLogicalMargin(margin.ConvertTo(wm, cbwm));
 }
 
 // This will not be converted to abstract coordinates because it's only
 // used in CalcQuirkContainingBlockHeight
-nscoord
+static nscoord
 GetBlockMarginBorderPadding(const ReflowInput* aReflowInput)
 {
   nscoord result = 0;
   if (!aReflowInput) return result;
 
   // zero auto margins
   nsMargin margin = aReflowInput->ComputedPhysicalMargin();
   if (NS_AUTOMARGIN == margin.top)
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1067,17 +1067,17 @@ BuildStrutInfoFromCollapsedItems(const F
         aStruts.AppendElement(StrutInfo(itemIdxInContainer,
                                         line->GetLineCrossSize()));
       }
       itemIdxInContainer++;
     }
   }
 }
 
-uint8_t
+static uint8_t
 SimplifyAlignOrJustifyContentForOneItem(uint16_t aAlignmentVal,
                                         bool aIsAlign)
 {
   // Mask away any explicit fallback, to get the main (non-fallback) part of
   // the specified value:
   uint16_t specified = aAlignmentVal & NS_STYLE_ALIGN_ALL_BITS;
 
   // XXX strip off <overflow-position> bits until we implement it (bug 1311892)
@@ -2315,17 +2315,17 @@ nsFlexContainerFrame::GetLogicalBaseline
 }
 
 // Helper for BuildDisplayList, to implement this special-case for flex items
 // from the spec:
 //    Flex items paint exactly the same as block-level elements in the
 //    normal flow, except that 'z-index' values other than 'auto' create
 //    a stacking context even if 'position' is 'static'.
 // http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#painting
-uint32_t
+static uint32_t
 GetDisplayFlagsForFlexItem(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame->IsFlexItem(), "Should only be called on flex items");
 
   const nsStylePosition* pos = aFrame->StylePosition();
   if (pos->mZIndex.GetUnit() == eStyleUnit_Integer) {
     return nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT;
   }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5059,18 +5059,18 @@ static FrameTarget GetSelectionClosestFr
       if (nsSVGUtils::IsInSVGTextSubtree(closest.mFrame))
         return FrameTarget(closest.mFrame, false, false);
       return GetSelectionClosestFrameForChild(closest.mFrame, aPoint, aFlags);
     }
   }
   return FrameTarget(aFrame, false, false);
 }
 
-nsIFrame::ContentOffsets OffsetsForSingleFrame(nsIFrame* aFrame,
-                                               const nsPoint& aPoint)
+static nsIFrame::ContentOffsets
+OffsetsForSingleFrame(nsIFrame* aFrame, const nsPoint& aPoint)
 {
   nsIFrame::ContentOffsets offsets;
   FrameContentRange range = GetRangeForFrame(aFrame);
   offsets.content = range.content;
   // If there are continuations (meaning it's not one rectangle), this is the
   // best this function can do
   if (aFrame->GetNextContinuation() || aFrame->GetPrevContinuation()) {
     offsets.offset = range.start;
@@ -6985,17 +6985,17 @@ static void InvalidateRenderingObservers
 
   if (!aFrameChanged) {
     return;
   }
 
   aFrame->MarkNeedsDisplayItemRebuild();
 }
 
-void
+static void
 SchedulePaintInternal(nsIFrame* aDisplayRoot, nsIFrame* aFrame,
                       nsIFrame::PaintType aType = nsIFrame::PAINT_DEFAULT)
 {
   MOZ_ASSERT(aDisplayRoot == nsLayoutUtils::GetDisplayRootFrame(aFrame));
   nsPresContext* pres = aDisplayRoot->PresContext()->GetRootPresContext();
 
   // No need to schedule a paint for an external document since they aren't
   // painted directly.
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -866,17 +866,17 @@ GetBrowserRoot(nsIContent* aContent)
 // child depends on the offset to the scroll frame, which changes as we scroll.
 // This perspective transform can cause the element to move relative to the
 // scrolled inner frame, which would cause the scrollable length changes during
 // scrolling if we didn't account for it. Since we don't want scrollHeight/Width
 // and the size of scrollbar thumbs to change during scrolling, we compute the
 // scrollable overflow by determining the scroll position at which the child
 // becomes completely visible within the scrollport rather than using the union
 // of the overflow areas at their current position.
-void
+static void
 GetScrollableOverflowForPerspective(nsIFrame* aScrolledFrame,
                                     nsIFrame* aCurrentFrame,
                                     const nsRect aScrollPort,
                                     nsPoint aOffset,
                                     nsRect& aScrolledFrameOverflowArea)
 {
   // Iterate over all children except pop-ups.
   FrameChildListIDs skip = nsIFrame::kSelectPopupList | nsIFrame::kPopupList;
@@ -2526,17 +2526,17 @@ bool ScrollFrameHelper::IsAlwaysActive()
 
   // If we're overflow:hidden, then start as inactive until
   // we get scrolled manually.
   ScrollbarStyles styles = GetScrollbarStylesFromFrame();
   return (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
           styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
 }
 
-/*static*/ void
+static void
 RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure)
 {
   ScrollFrameHelper* helper = static_cast<ScrollFrameHelper*>(aClosure);
 
   // This function only ever gets called from the expiry timer, so it must
   // be non-null here. Set it to null here so that we don't keep resetting
   // it unnecessarily in MarkRecentlyScrolled().
   MOZ_ASSERT(helper->mDisplayPortExpiryTimer);
@@ -6310,17 +6310,17 @@ nsIScrollableFrame::GetPerceivedScrollin
   }
   return directions;
 }
 
 /**
  * Collect the scroll-snap-coordinates of frames in the subtree rooted at
  * |aFrame|, relative to |aScrolledFrame|, into |aOutCoords|.
  */
-void
+static void
 CollectScrollSnapCoordinates(nsIFrame* aFrame, nsIFrame* aScrolledFrame,
                              nsTArray<nsPoint>& aOutCoords)
 {
   nsIFrame::ChildListIterator childLists(aFrame);
   for (; !childLists.IsDone(); childLists.Next()) {
     nsFrameList::Enumerator childFrames(childLists.CurrentList());
     for (; !childFrames.AtEnd(); childFrames.Next()) {
       nsIFrame* f = childFrames.get();
@@ -6351,17 +6351,17 @@ CollectScrollSnapCoordinates(nsIFrame* a
         }
       }
 
       CollectScrollSnapCoordinates(f, aScrolledFrame, aOutCoords);
     }
   }
 }
 
-layers::ScrollSnapInfo
+static layers::ScrollSnapInfo
 ComputeScrollSnapInfo(const ScrollFrameHelper& aScrollFrame)
 {
   ScrollSnapInfo result;
 
   ScrollbarStyles styles = aScrollFrame.GetScrollbarStylesFromFrame();
 
   if (styles.mScrollSnapTypeY == NS_STYLE_SCROLL_SNAP_TYPE_NONE &&
       styles.mScrollSnapTypeX == NS_STYLE_SCROLL_SNAP_TYPE_NONE) {
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -435,18 +435,19 @@ nsSimplePageSequenceFrame::StartPrint(ns
   // Begin printing of the document
   nsresult rv = NS_OK;
 
   mPageNum = 1;
 
   return rv;
 }
 
-void
-GetPrintCanvasElementsInFrame(nsIFrame* aFrame, nsTArray<RefPtr<HTMLCanvasElement> >* aArr)
+static void
+GetPrintCanvasElementsInFrame(nsIFrame* aFrame,
+                              nsTArray<RefPtr<HTMLCanvasElement> >* aArr)
 {
   if (!aFrame) {
     return;
   }
   for (nsIFrame::ChildListIterator childLists(aFrame);
     !childLists.IsDone(); childLists.Next()) {
 
     nsFrameList children = childLists.CurrentList();
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5534,17 +5534,17 @@ struct EmphasisMarkInfo
 {
   RefPtr<gfxTextRun> textRun;
   gfxFloat advance;
   gfxFloat baselineOffset;
 };
 
 NS_DECLARE_FRAME_PROPERTY_DELETABLE(EmphasisMarkProperty, EmphasisMarkInfo)
 
-already_AddRefed<gfxTextRun>
+static already_AddRefed<gfxTextRun>
 GenerateTextRunForEmphasisMarks(nsTextFrame* aFrame,
                                 nsFontMetrics* aFontMetrics,
                                 nsStyleContext* aStyleContext,
                                 const nsStyleText* aStyleText)
 {
   const nsString& emphasisString = aStyleText->mTextEmphasisStyleString;
   RefPtr<DrawTarget> dt = CreateReferenceDrawTarget(aFrame);
   auto appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -71,17 +71,17 @@ GetContentRectLayerOffset(nsIFrame* aCon
 // widget, and hence in non-retained mode.
 inline static bool
 IsTempLayerManager(LayerManager* aManager)
 {
   return (mozilla::layers::LayersBackend::LAYERS_BASIC == aManager->GetBackendType() &&
           !static_cast<BasicLayerManager*>(aManager)->IsRetained());
 }
 
-already_AddRefed<LayerManager>
+static already_AddRefed<LayerManager>
 GetLayerManager(nsFrameLoader* aFrameLoader)
 {
   if (nsIContent* content = aFrameLoader->GetOwnerContent()) {
     RefPtr<LayerManager> lm = nsContentUtils::LayerManagerForContent(content);
     if (lm) {
       return lm.forget();
     }
   }
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -241,17 +241,17 @@ nsMathMLmactionFrame::AttributeChanged(i
 // ################################################################
 
 NS_IMPL_ISUPPORTS(nsMathMLmactionFrame::MouseListener,
                   nsIDOMEventListener)
 
 
 // helper to show a msg on the status bar
 // curled from nsPluginFrame.cpp ...
-void
+static void
 ShowStatus(nsPresContext* aPresContext, nsString& aStatusMsg)
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellItem(aPresContext->GetDocShell());
   if (docShellItem) {
     nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
     docShellItem->GetTreeOwner(getter_AddRefs(treeOwner));
     if (treeOwner) {
       nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(treeOwner));
--- a/layout/painting/DisplayItemClip.cpp
+++ b/layout/painting/DisplayItemClip.cpp
@@ -180,18 +180,19 @@ DisplayItemClip::ApproximateIntersectInw
     nsRegion rgn = nsLayoutUtils::RoundedRectIntersectRect(rr.mRect, rr.mRadii, r);
     r = rgn.GetLargestRectangle();
   }
   return r;
 }
 
 // Test if (aXPoint, aYPoint) is in the ellipse with center (aXCenter, aYCenter)
 // and radii aXRadius, aYRadius.
-bool IsInsideEllipse(nscoord aXRadius, nscoord aXCenter, nscoord aXPoint,
-                     nscoord aYRadius, nscoord aYCenter, nscoord aYPoint)
+static bool
+IsInsideEllipse(nscoord aXRadius, nscoord aXCenter, nscoord aXPoint,
+                nscoord aYRadius, nscoord aYCenter, nscoord aYPoint)
 {
   float scaledX = float(aXPoint - aXCenter) / float(aXRadius);
   float scaledY = float(aYPoint - aYCenter) / float(aYRadius);
   return scaledX * scaledX + scaledY * scaledY < 1.0f;
 }
 
 bool
 DisplayItemClip::IsRectClippedByRoundedCorner(const nsRect& aRect) const
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -1833,17 +1833,18 @@ private:
 
   bool mTextureClientLocked;
   gfx::IntSize mSize;
   LayerManager* mLayerManager;
   RefPtr<gfx::DrawTarget> mDrawTarget;
   RefPtr<TextureClient> mTextureClient;
 };
 
-PaintedDisplayItemLayerUserData* GetPaintedDisplayItemLayerUserData(Layer* aLayer)
+static PaintedDisplayItemLayerUserData*
+GetPaintedDisplayItemLayerUserData(Layer* aLayer)
 {
   return static_cast<PaintedDisplayItemLayerUserData*>(
     aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
 }
 
 /* static */ void
 FrameLayerBuilder::Shutdown()
 {
@@ -1886,41 +1887,43 @@ FrameLayerBuilder::GetDisplayItemData(ns
     if (item->mDisplayItemKey == aKey &&
         item->mLayer->Manager() == mRetainingManager) {
       return item;
     }
   }
   return nullptr;
 }
 
-nsACString&
+#ifdef MOZ_DUMP_PAINTING
+static nsACString&
 AppendToString(nsACString& s, const nsIntRect& r,
                const char* pfx="", const char* sfx="")
 {
   s += pfx;
   s += nsPrintfCString(
     "(x=%d, y=%d, w=%d, h=%d)",
     r.x, r.y, r.width, r.height);
   return s += sfx;
 }
 
-nsACString&
+static nsACString&
 AppendToString(nsACString& s, const nsIntRegion& r,
                const char* pfx="", const char* sfx="")
 {
   s += pfx;
 
   s += "< ";
   for (auto iter = r.RectIter(); !iter.Done(); iter.Next()) {
     AppendToString(s, iter.Get()) += "; ";
   }
   s += ">";
 
   return s += sfx;
 }
+#endif // MOZ_DUMP_PAINTING
 
 /**
  * Invalidate aRegion in aLayer. aLayer is in the coordinate system
  * *after* aTranslation has been applied, so we need to
  * apply the inverse of that transform before calling InvalidateRegion.
  */
 static void
 InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsIntRegion& aRegion,
@@ -4033,27 +4036,27 @@ GetASRForPerspective(const ActiveScrolle
     nsIFrame* scrolledFrame = asr->mScrollableFrame->GetScrolledFrame();
     if (nsLayoutUtils::IsAncestorFrameCrossDoc(scrolledFrame, aPerspectiveFrame)) {
       return asr;
     }
   }
   return nullptr;
 }
 
-CSSMaskLayerUserData*
+static CSSMaskLayerUserData*
 GetCSSMaskLayerUserData(Layer* aMaskLayer)
 {
   if (!aMaskLayer) {
     return nullptr;
   }
 
   return static_cast<CSSMaskLayerUserData*>(aMaskLayer->GetUserData(&gCSSMaskLayerUserData));
 }
 
-void
+static void
 SetCSSMaskLayerUserData(Layer* aMaskLayer)
 {
   MOZ_ASSERT(aMaskLayer);
 
   aMaskLayer->SetUserData(&gCSSMaskLayerUserData,
                           new CSSMaskLayerUserData());
 }
 
@@ -5127,18 +5130,19 @@ FindOpaqueRegionEntry(nsTArray<OpaqueReg
     if (d->mAnimatedGeometryRoot == aAnimatedGeometryRoot &&
         d->mASR == aASR) {
       return d;
     }
   }
   return nullptr;
 }
 
-const ActiveScrolledRoot*
-FindDirectChildASR(const ActiveScrolledRoot* aParent, const ActiveScrolledRoot* aDescendant)
+static const ActiveScrolledRoot*
+FindDirectChildASR(const ActiveScrolledRoot* aParent,
+                   const ActiveScrolledRoot* aDescendant)
 {
   MOZ_ASSERT(aDescendant, "can't start at the root when looking for a child");
   MOZ_ASSERT(ActiveScrolledRoot::IsAncestor(aParent, aDescendant));
   const ActiveScrolledRoot* directChild = aDescendant;
   while (directChild->mParent != aParent) {
     directChild = directChild->mParent;
     MOZ_RELEASE_ASSERT(directChild, "this must not be null");
   }
@@ -6356,27 +6360,27 @@ ContainerState::SetupMaskLayer(Layer *aL
   if (!maskLayer) {
     return 0;
   }
 
   aLayer->SetMaskLayer(maskLayer);
   return aRoundedRectClipCount;
 }
 
-MaskLayerUserData*
+static MaskLayerUserData*
 GetMaskLayerUserData(Layer* aMaskLayer)
 {
   if (!aMaskLayer) {
     return nullptr;
   }
 
   return static_cast<MaskLayerUserData*>(aMaskLayer->GetUserData(&gMaskLayerUserData));
 }
 
-void
+static void
 SetMaskLayerUserData(Layer* aMaskLayer)
 {
   MOZ_ASSERT(aMaskLayer);
 
   aMaskLayer->SetUserData(&gMaskLayerUserData,
                           new MaskLayerUserData());
 }
 
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -35,17 +35,18 @@
  * ordering in the DAG, since they need to intersect to have an ordering and
  * we would have built both in the new list if they intersected. Given that, we
  * can align items that appear in both lists, and any items that appear between
  * matched items can be inserted into the merged list in any order.
  */
 
 using namespace mozilla;
 
-void MarkFramesWithItemsAndImagesModified(nsDisplayList* aList)
+static void
+MarkFramesWithItemsAndImagesModified(nsDisplayList* aList)
 {
   for (nsDisplayItem* i = aList->GetBottom(); i != nullptr; i = i->GetAbove()) {
     if (!i->HasDeletedFrame() && i->CanBeReused() && !i->Frame()->IsFrameModified()) {
       // If we have existing cached geometry for this item, then check that for
       // whether we need to invalidate for a sync decode. If we don't, then
       // use the item's flags.
       DisplayItemData* data = FrameLayerBuilder::GetOldDataFor(i);
       bool invalidate = false;
@@ -64,17 +65,18 @@ void MarkFramesWithItemsAndImagesModifie
       }
     }
     if (i->GetChildren()) {
       MarkFramesWithItemsAndImagesModified(i->GetChildren());
     }
   }
 }
 
-bool IsAnyAncestorModified(nsIFrame* aFrame)
+static bool
+IsAnyAncestorModified(nsIFrame* aFrame)
 {
   nsIFrame* f = aFrame;
   while (f) {
     if (f->IsFrameModified()) {
       return true;
     }
     f = nsLayoutUtils::GetCrossDocParentFrame(f);
   }
@@ -141,17 +143,18 @@ RetainedDisplayListBuilder::PreProcessDi
 
     saved.AppendToTop(i);
   }
   aList->AppendToTop(&saved);
   aList->RestoreState();
   return modified;
 }
 
-bool IsSameItem(nsDisplayItem* aFirst, nsDisplayItem* aSecond)
+static bool
+IsSameItem(nsDisplayItem* aFirst, nsDisplayItem* aSecond)
 {
   if (!aFirst || !aSecond) {
     return aFirst == aSecond;
   }
   return aFirst->Frame() == aSecond->Frame() &&
          aFirst->GetPerFrameKey() == aSecond->GetPerFrameKey();
 }
 
@@ -304,18 +307,19 @@ RetainedDisplayListBuilder::IncrementSub
   MOZ_ASSERT(subDocFrame);
 
   nsIPresShell* presShell = subDocFrame->GetSubdocumentPresShellForPainting(0);
   MOZ_ASSERT(presShell);
 
   mBuilder.IncrementPresShellPaintCount(presShell);
 }
 
-void UpdateASR(nsDisplayItem* aItem,
-               Maybe<const ActiveScrolledRoot*>& aContainerASR)
+static void
+UpdateASR(nsDisplayItem* aItem,
+          Maybe<const ActiveScrolledRoot*>& aContainerASR)
 {
   if (!aContainerASR) {
     return;
   }
 
   nsDisplayWrapList* wrapList = aItem->AsDisplayWrapList();
   if (!wrapList) {
     aItem->SetActiveScrolledRoot(aContainerASR.value());
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -782,17 +782,17 @@ nsCSSRendering::CreateWebRenderCommandsF
   }
 
   bir->CreateWebRenderCommands(aItem, aForFrame, aBuilder, aResources, aSc,
                                aManager, aDisplayListBuilder);
 
   return true;
 }
 
-nsCSSBorderRenderer
+static nsCSSBorderRenderer
 ConstructBorderRenderer(nsPresContext* aPresContext,
                         nsStyleContext* aStyleContext,
                         DrawTarget* aDrawTarget,
                         nsIFrame* aForFrame,
                         const nsRect& aDirtyRect,
                         const nsRect& aBorderArea,
                         const nsStyleBorder& aStyleBorder,
                         Sides aSkipSides,
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -2613,17 +2613,18 @@ nsCSSBorderRenderer::AllBordersSolid()
       continue;
     }
     return false;
   }
 
   return true;
 }
 
-bool IsVisible(int aStyle)
+static bool
+IsVisible(int aStyle)
 {
   if (aStyle != NS_STYLE_BORDER_STYLE_NONE &&
       aStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
         return true;
   }
   return false;
 }
 
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2893,17 +2893,18 @@ struct FramesWithDepth
     return this == &aOther;
   }
 
   float mDepth;
   nsTArray<nsIFrame*> mFrames;
 };
 
 // Sort the frames by depth and then moves all the contained frames to the destination
-void FlushFramesArray(nsTArray<FramesWithDepth>& aSource, nsTArray<nsIFrame*>* aDest)
+static void
+FlushFramesArray(nsTArray<FramesWithDepth>& aSource, nsTArray<nsIFrame*>* aDest)
 {
   if (aSource.IsEmpty()) {
     return;
   }
   aSource.Sort();
   uint32_t length = aSource.Length();
   for (uint32_t i = 0; i < length; i++) {
     aDest->AppendElements(Move(aSource[i].mFrames));
@@ -3602,17 +3603,17 @@ static nsIFrame* GetBackgroundStyleConte
       return nullptr;
     }
 
     f = aFrame;
   }
   return f;
 }
 
-/* static */ void
+static void
 SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
                         nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
                         const nsStyleImageLayers::Layer& aLayer,
                         const nsRect& aBackgroundRect,
                         bool aWillPaintBorder)
 {
   nsCSSRendering::ImageLayerClipState clip;
   nsCSSRendering::GetImageLayerClip(aLayer, aFrame, *aFrame->StyleBorder(),
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -312,17 +312,18 @@ ImageLoader::GetPresContext()
 static bool
 IsRenderNoImages(uint32_t aDisplayItemKey)
 {
   DisplayItemType type = GetDisplayItemTypeFromKey(aDisplayItemKey);
   uint8_t flags = GetDisplayItemFlagsForType(type);
   return flags & TYPE_RENDERS_NO_IMAGES;
 }
 
-void InvalidateImages(nsIFrame* aFrame)
+static void
+InvalidateImages(nsIFrame* aFrame)
 {
   bool invalidateFrame = false;
   const SmallPointerArray<DisplayItemData>& array = aFrame->DisplayItemData();
   for (uint32_t i = 0; i < array.Length(); i++) {
     DisplayItemData* data = DisplayItemData::AssertDisplayItemData(array.ElementAt(i));
     uint32_t displayItemKey = data->GetDisplayItemKey();
     if (displayItemKey != 0 && !IsRenderNoImages(displayItemKey)) {
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -436,17 +436,17 @@ Gecko_UnsetDirtyStyleAttr(RawGeckoElemen
     // XXX This can happen when nodes are adopted from a Gecko-style-backend
     //     document into a Servo-style-backend document.  See bug 1330051.
     NS_WARNING("stylo: requesting a Gecko declaration block?");
     return;
   }
   decl->UnsetDirty();
 }
 
-const RawServoDeclarationBlockStrong*
+static const RawServoDeclarationBlockStrong*
 AsRefRawStrong(const RefPtr<RawServoDeclarationBlock>& aDecl)
 {
   static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
                 sizeof(RawServoDeclarationBlockStrong),
                 "RefPtr should just be a pointer");
   return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&aDecl);
 }
 
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -459,17 +459,17 @@ CalcValueToCSSValue(const PixelCalcValue
     arr->Item(0).SetArrayValue(arr2, eCSSUnit_Calc_Plus);
     arr2->Item(0).SetFloatValue(aCalc.mLength, eCSSUnit_Pixel);
     arr2->Item(1).SetPercentValue(aCalc.mPercent);
   }
 
   aValue.SetArrayValue(arr, eCSSUnit_Calc);
 }
 
-double
+static double
 CalcPositionSquareDistance(const nsCSSValue& aPos1,
                            const nsCSSValue& aPos2)
 {
   NS_ASSERTION(aPos1.GetUnit() == eCSSUnit_Array &&
                aPos2.GetUnit() == eCSSUnit_Array,
                "Expected two arrays");
 
   PixelCalcValue calcVal[4];
@@ -515,17 +515,17 @@ CalcBackgroundCoord(const nsCSSValue& aC
   nsCSSValue::Array* array = aCoord.GetArrayValue();
   MOZ_ASSERT(array->Count() == 2 &&
              array->Item(0).GetUnit() == eCSSUnit_Null &&
              array->Item(1).GetUnit() != eCSSUnit_Null,
              "Invalid position value");
   return ExtractCalcValue(array->Item(1));
 }
 
-double
+static double
 CalcPositionCoordSquareDistance(const nsCSSValue& aPos1,
                                 const nsCSSValue& aPos2)
 {
   PixelCalcValue calcVal1 = CalcBackgroundCoord(aPos1);
   PixelCalcValue calcVal2 = CalcBackgroundCoord(aPos2);
 
   float difflen = calcVal2.mLength - calcVal1.mLength;
   float diffpct = calcVal2.mPercent - calcVal1.mPercent;
@@ -2026,33 +2026,33 @@ AddWeightedColorsAndClamp(double aCoeff1
   // But unpremultiplication in AddWeightedColors() does not work well
   // for such cases, so we use another function named DiluteColor() which
   // has a similar logic to AddWeightedColors().
   return aCoeff2 == 0.0
     ? DiluteColor(aValue1, aCoeff1)
     : AddWeightedColors(aCoeff1, aValue1, aCoeff2, aValue2).ToColor();
 }
 
-void
+static void
 AppendToCSSValueList(UniquePtr<nsCSSValueList>& aHead,
                      UniquePtr<nsCSSValueList>&& aValueToAppend,
                      nsCSSValueList** aTail)
 {
   MOZ_ASSERT(!aHead == !*aTail,
              "Can't have head w/o tail, & vice versa");
 
   if (!aHead) {
     aHead = Move(aValueToAppend);
     *aTail = aHead.get();
   } else {
     (*aTail) = (*aTail)->mNext = aValueToAppend.release();
   }
 }
 
-void
+static void
 AppendToCSSValuePairList(UniquePtr<nsCSSValuePairList>& aHead,
                          UniquePtr<nsCSSValuePairList>&& aValueToAppend,
                          nsCSSValuePairList** aTail)
 {
   MOZ_ASSERT(!aHead == !*aTail,
              "Can't have head w/o tail, & vice versa");
 
   if (!aHead) {
@@ -3414,17 +3414,17 @@ StyleAnimationValue::Accumulate(nsCSSPro
                             1.0, result,
                             aCount, aA,
                             result);
       break;
   }
   return result;
 }
 
-already_AddRefed<css::StyleRule>
+static already_AddRefed<css::StyleRule>
 BuildStyleRule(nsCSSPropertyID aProperty,
                dom::Element* aTargetElement,
                const nsAString& aSpecifiedValue,
                bool aUseSVGMode)
 {
   // Set up an empty CSS Declaration
   RefPtr<css::Declaration> declaration(new css::Declaration());
   declaration->InitializeEmpty();
@@ -3449,17 +3449,17 @@ BuildStyleRule(nsCSSPropertyID aProperty
   }
 
   RefPtr<css::StyleRule> rule = new css::StyleRule(nullptr,
                                                      declaration,
                                                      0, 0);
   return rule.forget();
 }
 
-already_AddRefed<css::StyleRule>
+static already_AddRefed<css::StyleRule>
 BuildStyleRule(nsCSSPropertyID aProperty,
                dom::Element* aTargetElement,
                const nsCSSValue& aSpecifiedValue,
                bool aUseSVGMode)
 {
   MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty),
              "Should be a longhand property");
 
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -156,17 +156,17 @@ enum {
 // The names are in kCSSRawProperties.
 static nsCSSPropertyID gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = {
 #define CSS_PROP_ALIAS(aliasname_, aliasid_, propid_, aliasmethod_, pref_)  \
   eCSSProperty_##propid_ ,
 #include "nsCSSPropAliasList.h"
 #undef CSS_PROP_ALIAS
 };
 
-nsStaticCaseInsensitiveNameTable*
+static nsStaticCaseInsensitiveNameTable*
 CreateStaticTable(const char* const aRawTable[], int32_t aLength)
 {
   auto table = new nsStaticCaseInsensitiveNameTable(aRawTable, aLength);
 #ifdef DEBUG
   // Partially verify the entries.
   for (int32_t index = 0; index < aLength; ++index) {
     nsAutoCString temp(aRawTable[index]);
     MOZ_ASSERT(-1 == temp.FindChar('_'),
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -650,17 +650,17 @@ struct EffectOffsets {
   // The offset between the reference frame and the bounding box of the
   // target frame in app unit.
   nsPoint  offsetToUserSpace;
   // The offset between the reference frame and the bounding box of the
   // target frame in device unit.
   gfxPoint offsetToUserSpaceInDevPx;
 };
 
-EffectOffsets
+static EffectOffsets
 ComputeEffectOffset(nsIFrame* aFrame, const PaintFramesParams& aParams)
 {
   EffectOffsets result;
 
   result.offsetToBoundingBox =
     aParams.builder->ToReferenceFrame(aFrame) -
     nsSVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
   if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -303,17 +303,17 @@ nsTableRowFrame::GetUsedBorder() const
 }
 
 /* virtual */ nsMargin
 nsTableRowFrame::GetUsedPadding() const
 {
   return nsMargin(0,0,0,0);
 }
 
-nscoord
+static nscoord
 GetBSizeOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
                                 nsTableFrame&     aTableFrame,
                                 const WritingMode aWM)
 {
   nscoord bsize = 0;
   int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
   // add in bsize of rows spanned beyond the 1st one
   nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
@@ -686,17 +686,17 @@ CalcAvailISize(nsTableFrame&     aTableF
     if (spanX > 0 &&
         aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
       cellAvailISize += aTableFrame.GetColSpacing(colIndex + spanX - 1);
     }
   }
   return cellAvailISize;
 }
 
-nscoord
+static nscoord
 GetSpaceBetween(int32_t       aPrevColIndex,
                 int32_t       aColIndex,
                 int32_t       aColSpan,
                 nsTableFrame& aTableFrame,
                 bool          aCheckVisibility)
 {
   nscoord space = 0;
   int32_t colIdx;
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -1922,17 +1922,17 @@ nsBoxFrame::AppendDirectlyOwnedAnonBoxes
 {
   if (GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) {
     aResult.AppendElement(OwnedAnonBox(PrincipalChildList().FirstChild()));
   }
 }
 
 // Helper less-than-or-equal function, used in CheckBoxOrder() as a
 // template-parameter for the sorting functions.
-bool
+static bool
 IsBoxOrdinalLEQ(nsIFrame* aFrame1,
                 nsIFrame* aFrame2)
 {
   // If we've got a placeholder frame, use its out-of-flow frame's ordinal val.
   nsIFrame* aRealFrame1 = nsPlaceholderFrame::GetRealFrameFor(aFrame1);
   nsIFrame* aRealFrame2 = nsPlaceholderFrame::GetRealFrameFor(aFrame2);
   return aRealFrame1->GetXULOrdinal() <= aRealFrame2->GetXULOrdinal();
 }
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -101,18 +101,17 @@ nsImageBoxFrameEvent::Run()
 
 // Fire off an event that'll asynchronously call the image elements
 // onload handler once handled. This is needed since the image library
 // can't decide if it wants to call its observer methods
 // synchronously or asynchronously. If an image is loaded from the
 // cache the notifications come back synchronously, but if the image
 // is loaded from the network the notifications come back
 // asynchronously.
-
-void
+static void
 FireImageDOMEvent(nsIContent* aContent, EventMessage aMessage)
 {
   NS_ASSERTION(aMessage == eLoad || aMessage == eLoadError,
                "invalid message");
 
   nsCOMPtr<nsIRunnable> event = new nsImageBoxFrameEvent(aContent, aMessage);
   nsresult rv = aContent->OwnerDoc()->Dispatch(TaskCategory::Other,
                                                event.forget());
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -1042,24 +1042,24 @@ public:
   }
 
 private:
   RefPtr<nsIPresShell> mPresShell;
   RefPtr<nsIWidget> mWidget;
   AsyncDragMetrics mDragMetrics;
 };
 
-bool
+static bool
 UsesSVGEffects(nsIFrame* aFrame)
 {
   return aFrame->StyleEffects()->HasFilters()
       || nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(aFrame);
 }
 
-bool
+static bool
 ScrollFrameWillBuildScrollInfoLayer(nsIFrame* aScrollFrame)
 {
   nsIFrame* current = aScrollFrame;
   while (current) {
     if (UsesSVGEffects(current)) {
       return true;
     }
     current = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(current);