Bug 1606192 - Remove some unused nsresult return value in layout code. r=dbaron
authorXidorn Quan <me@upsuper.org>
Sat, 28 Dec 2019 03:27:13 +0000
changeset 508462 9d135cd098b700c8f0fd28b8fd374aedda89445f
parent 508461 27d3433d99eb929e27156f7e0d1d420b80d8e84b
child 508463 1837aaf09bda74374a6a7a89946c4ca8ec1d8a53
push id104005
push usermozilla@upsuper.org
push dateSat, 28 Dec 2019 05:14:49 +0000
treeherderautoland@9d135cd098b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1606192
milestone73.0a1
first release with
nightly linux32
9d135cd098b7 / 73.0a1 / 20191228094408 / files
nightly linux64
9d135cd098b7 / 73.0a1 / 20191228094408 / files
nightly mac
9d135cd098b7 / 73.0a1 / 20191228094408 / files
nightly win32
9d135cd098b7 / 73.0a1 / 20191228094408 / files
nightly win64
9d135cd098b7 / 73.0a1 / 20191228094408 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1606192 - Remove some unused nsresult return value in layout code. r=dbaron Differential Revision: https://phabricator.services.mozilla.com/D58342
layout/base/nsBidiPresUtils.cpp
layout/base/nsBidiPresUtils.h
layout/generic/nsContainerFrame.cpp
layout/generic/nsContainerFrame.h
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFirstLetterFrame.h
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -598,19 +598,18 @@ static bool IsBidiLeaf(nsIFrame* aFrame)
  * Create non-fluid continuations for the ancestors of a given frame all the way
  * up the frame tree until we hit a non-splittable frame (a line or a block).
  *
  * @param aParent the first parent frame to be split
  * @param aFrame the child frames after this frame are reparented to the
  *        newly-created continuation of aParent.
  *        If aFrame is null, all the children of aParent are reparented.
  */
-static nsresult SplitInlineAncestors(nsContainerFrame* aParent,
-                                     nsLineList::iterator aLine,
-                                     nsIFrame* aFrame) {
+static void SplitInlineAncestors(nsContainerFrame* aParent,
+                                 nsLineList::iterator aLine, nsIFrame* aFrame) {
   nsPresContext* presContext = aParent->PresContext();
   PresShell* presShell = presContext->PresShell();
   nsIFrame* frame = aFrame;
   nsContainerFrame* parent = aParent;
   nsContainerFrame* newParent;
 
   while (IsBidiSplittable(parent)) {
     nsContainerFrame* grandparent = parent->GetParent();
@@ -622,21 +621,17 @@ static nsresult SplitInlineAncestors(nsC
     if (!frame || frame->GetNextSibling()) {
       newParent = static_cast<nsContainerFrame*>(
           presShell->FrameConstructor()->CreateContinuingFrame(
               presContext, parent, grandparent, false));
 
       nsFrameList tail = parent->StealFramesAfter(frame);
 
       // Reparent views as necessary
-      nsresult rv;
-      rv = nsContainerFrame::ReparentFrameViewList(tail, parent, newParent);
-      if (NS_FAILED(rv)) {
-        return rv;
-      }
+      nsContainerFrame::ReparentFrameViewList(tail, parent, newParent);
 
       // The parent's continuation adopts the siblings after the split.
       MOZ_ASSERT(!newParent->IsBlockFrameOrSubclass(),
                  "blocks should not be IsBidiSplittable");
       newParent->InsertFrames(nsIFrame::kNoReflowPrincipalList, nullptr,
                               nullptr, tail);
 
       // While passing &aLine to InsertFrames for a non-block isn't harmful
@@ -656,18 +651,16 @@ static nsresult SplitInlineAncestors(nsC
       nsFrameList temp(newParent, newParent);
       grandparent->InsertFrames(nsIFrame::kNoReflowPrincipalList, parent,
                                 parentLine, temp);
     }
 
     frame = parent;
     parent = grandparent;
   }
-
-  return NS_OK;
 }
 
 static void MakeContinuationFluid(nsIFrame* aFrame, nsIFrame* aNext) {
   NS_ASSERTION(!aFrame->GetNextInFlow() || aFrame->GetNextInFlow() == aNext,
                "next-in-flow is not next continuation!");
   aFrame->SetNextInFlow(aNext);
 
   NS_ASSERTION(!aNext->GetPrevInFlow() || aNext->GetPrevInFlow() == aFrame,
@@ -700,19 +693,19 @@ static void JoinInlineAncestors(nsIFrame
       MakeContinuationFluid(frame, next);
     }
     // Join the parent only as long as we're its last child.
     if (frame->GetNextSibling()) break;
     frame = frame->GetParent();
   }
 }
 
-static nsresult CreateContinuation(nsIFrame* aFrame,
-                                   const nsLineList::iterator aLine,
-                                   nsIFrame** aNewFrame, bool aIsFluid) {
+static void CreateContinuation(nsIFrame* aFrame,
+                               const nsLineList::iterator aLine,
+                               nsIFrame** aNewFrame, bool aIsFluid) {
   MOZ_ASSERT(aNewFrame, "null OUT ptr");
   MOZ_ASSERT(aFrame, "null ptr");
 
   *aNewFrame = nullptr;
 
   nsPresContext* presContext = aFrame->PresContext();
   PresShell* presShell = presContext->PresShell();
   NS_ASSERTION(presShell,
@@ -731,46 +724,39 @@ static nsresult CreateContinuation(nsIFr
   const nsLineList::iterator* parentLine;
   if (parent->IsBlockFrameOrSubclass()) {
     MOZ_ASSERT(aLine->Contains(aFrame));
     parentLine = &aLine;
   } else {
     parentLine = nullptr;
   }
 
-  nsresult rv = NS_OK;
-
   // Have to special case floating first letter frames because the continuation
   // doesn't go in the first letter frame. The continuation goes with the rest
   // of the text that the first letter frame was made out of.
   if (parent->IsLetterFrame() && parent->IsFloating()) {
     nsFirstLetterFrame* letterFrame = do_QueryFrame(parent);
-    rv = letterFrame->CreateContinuationForFloatingParent(presContext, aFrame,
-                                                          aNewFrame, aIsFluid);
-    return rv;
+    letterFrame->CreateContinuationForFloatingParent(presContext, aFrame,
+                                                     aNewFrame, aIsFluid);
+    return;
   }
 
   *aNewFrame = presShell->FrameConstructor()->CreateContinuingFrame(
       presContext, aFrame, parent, aIsFluid);
 
   // The list name kNoReflowPrincipalList would indicate we don't want reflow
   // XXXbz this needs higher-level framelist love
   nsFrameList temp(*aNewFrame, *aNewFrame);
   parent->InsertFrames(nsIFrame::kNoReflowPrincipalList, aFrame, parentLine,
                        temp);
 
   if (!aIsFluid) {
     // Split inline ancestor frames
-    rv = SplitInlineAncestors(parent, aLine, aFrame);
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
+    SplitInlineAncestors(parent, aLine, aFrame);
   }
-
-  return NS_OK;
 }
 
 /*
  * Overview of the implementation of Resolve():
  *
  *  Walk through the descendants of aBlockFrame and build:
  *   * mLogicalFrames: an nsTArray of nsIFrame* pointers in logical order
  *   * mBuffer: an nsString containing a representation of
@@ -1028,21 +1014,18 @@ nsresult nsBidiPresUtils::ResolveParagra
           /*
            * The text in this frame continues beyond the end of this directional
            * run. Create a non-fluid continuation frame for the next directional
            * run.
            */
           currentLine->MarkDirty();
           nsIFrame* nextBidi;
           int32_t runEnd = contentOffset + runLength;
-          rv = EnsureBidiContinuation(frame, currentLine, &nextBidi,
-                                      contentOffset, runEnd);
-          if (NS_FAILED(rv)) {
-            break;
-          }
+          EnsureBidiContinuation(frame, currentLine, &nextBidi, contentOffset,
+                                 runEnd);
           nextBidi->AdjustOffsetsForBidi(runEnd,
                                          contentOffset + fragmentLength);
           frame = nextBidi;
           frameInfo.mFrame = frame;
           contentOffset = runEnd;
 
           aBpd->mCurrentResolveLine.AdvanceToFrame(frame);
         }  // if (runLength < fragmentLength)
@@ -1937,24 +1920,24 @@ nsIFrame* nsBidiPresUtils::GetFrameToLef
     if (bld.VisualFrameAt(i) == aFrame) {
       return bld.VisualFrameAt(i - 1);
     }
   }
 
   return nullptr;
 }
 
-inline nsresult nsBidiPresUtils::EnsureBidiContinuation(
+inline void nsBidiPresUtils::EnsureBidiContinuation(
     nsIFrame* aFrame, const nsLineList::iterator aLine, nsIFrame** aNewFrame,
     int32_t aStart, int32_t aEnd) {
   MOZ_ASSERT(aNewFrame, "null OUT ptr");
   MOZ_ASSERT(aFrame, "aFrame is null");
 
   aFrame->AdjustOffsetsForBidi(aStart, aEnd);
-  return CreateContinuation(aFrame, aLine, aNewFrame, false);
+  CreateContinuation(aFrame, aLine, aNewFrame, false);
 }
 
 void nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData* aBpd,
                                              nsIFrame* aFrame,
                                              int32_t aFirstIndex,
                                              int32_t aLastIndex) {
   FrameBidiData bidiData = aFrame->GetBidiData();
   bidiData.precedingControl = kBidiLevelNone;
--- a/layout/base/nsBidiPresUtils.h
+++ b/layout/base/nsBidiPresUtils.h
@@ -541,19 +541,20 @@ class nsBidiPresUtils {
    * @param aNewFrame    [OUT] the new frame that was created
    * @param aStart       [IN] the start of the content mapped by aFrame (and
    *                          any fluid continuations)
    * @param aEnd         [IN] the offset of the end of the single-directional
    *                          text run.
    * @see Resolve()
    * @see RemoveBidiContinuation()
    */
-  static inline nsresult EnsureBidiContinuation(
-      nsIFrame* aFrame, const nsLineList::iterator aLine, nsIFrame** aNewFrame,
-      int32_t aStart, int32_t aEnd);
+  static inline void EnsureBidiContinuation(nsIFrame* aFrame,
+                                            const nsLineList::iterator aLine,
+                                            nsIFrame** aNewFrame,
+                                            int32_t aStart, int32_t aEnd);
 
   /**
    * Helper method for Resolve()
    * Convert one or more bidi continuation frames created in a previous reflow
    * by EnsureBidiContinuation() into fluid continuations.
    * @param aFrame       the frame whose continuations are to be removed
    * @param aFirstIndex  index of aFrame in mLogicalFrames
    * @param aLastIndex   index of the last frame to be removed
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -470,19 +470,19 @@ nsresult nsContainerFrame::ReparentFrame
     // They're not so we need to reparent any child views
     aChildFrame->ReparentFrameViewTo(oldParentView->GetViewManager(),
                                      newParentView, oldParentView);
   }
 
   return NS_OK;
 }
 
-nsresult nsContainerFrame::ReparentFrameViewList(
-    const nsFrameList& aChildFrameList, nsIFrame* aOldParentFrame,
-    nsIFrame* aNewParentFrame) {
+void nsContainerFrame::ReparentFrameViewList(const nsFrameList& aChildFrameList,
+                                             nsIFrame* aOldParentFrame,
+                                             nsIFrame* aNewParentFrame) {
   MOZ_ASSERT(aChildFrameList.NotEmpty(), "empty child frame list");
   MOZ_ASSERT(aOldParentFrame, "null old parent frame pointer");
   MOZ_ASSERT(aNewParentFrame, "null new parent frame pointer");
   MOZ_ASSERT(aOldParentFrame != aNewParentFrame,
              "same old and new parent frame");
 
   // See if either the old parent frame or the new parent frame have a view
   while (!aOldParentFrame->HasView() && !aNewParentFrame->HasView()) {
@@ -507,17 +507,17 @@ nsresult nsContainerFrame::ReparentFrame
   }
 
   // See if we found a common parent frame
   if (aOldParentFrame == aNewParentFrame) {
     // We found a common parent and there are no views between the old parent
     // and the common parent or the new parent frame and the common parent.
     // Because neither the old parent frame nor the new parent frame have views,
     // then any child views don't need reparenting
-    return NS_OK;
+    return;
   }
 
   // We found views for one or both of the ancestor frames before we
   // found a common ancestor.
   nsView* oldParentView = aOldParentFrame->GetClosestView();
   nsView* newParentView = aNewParentFrame->GetClosestView();
 
   // See if the old parent frame and the new parent frame are in the
@@ -526,18 +526,16 @@ nsresult nsContainerFrame::ReparentFrame
   if (oldParentView != newParentView) {
     nsViewManager* viewManager = oldParentView->GetViewManager();
 
     // They're not so we need to reparent any child views
     for (nsFrameList::Enumerator e(aChildFrameList); !e.AtEnd(); e.Next()) {
       e.get()->ReparentFrameViewTo(viewManager, newParentView, oldParentView);
     }
   }
-
-  return NS_OK;
 }
 
 static nsIWidget* GetPresContextContainerWidget(nsPresContext* aPresContext) {
   nsCOMPtr<nsISupports> container = aPresContext->Document()->GetContainer();
   nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
   if (!baseWindow) return nullptr;
 
   nsCOMPtr<nsIWidget> mainWidget;
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -149,19 +149,19 @@ class nsContainerFrame : public nsSplitt
 
   // Positions the frame's view based on the frame's origin
   static void PositionFrameView(nsIFrame* aKidFrame);
 
   static nsresult ReparentFrameView(nsIFrame* aChildFrame,
                                     nsIFrame* aOldParentFrame,
                                     nsIFrame* aNewParentFrame);
 
-  static nsresult ReparentFrameViewList(const nsFrameList& aChildFrameList,
-                                        nsIFrame* aOldParentFrame,
-                                        nsIFrame* aNewParentFrame);
+  static void ReparentFrameViewList(const nsFrameList& aChildFrameList,
+                                    nsIFrame* aOldParentFrame,
+                                    nsIFrame* aNewParentFrame);
 
   // Set the view's size and position after its frame has been reflowed.
   //
   // Flags:
   // NoMoveView - don't position the frame's view. Set this if you
   //    don't want to automatically sync the frame and view
   // NoSizeView - don't size the view
   static void SyncFrameViewAfterReflow(
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -277,17 +277,17 @@ void nsFirstLetterFrame::Reflow(nsPresCo
 }
 
 /* virtual */
 bool nsFirstLetterFrame::CanContinueTextRun() const {
   // We can continue a text run through a first-letter frame.
   return true;
 }
 
-nsresult nsFirstLetterFrame::CreateContinuationForFloatingParent(
+void nsFirstLetterFrame::CreateContinuationForFloatingParent(
     nsPresContext* aPresContext, nsIFrame* aChild, nsIFrame** aContinuation,
     bool aIsFluid) {
   NS_ASSERTION(IsFloating(),
                "can only call this on floating first letter frames");
   MOZ_ASSERT(aContinuation, "bad args");
 
   *aContinuation = nullptr;
 
@@ -317,17 +317,16 @@ nsresult nsFirstLetterFrame::CreateConti
   // XXX Bidi may not be involved but we have to use the list name
   // kNoReflowPrincipalList because this is just like creating a continuation
   // except we have to insert it in a different place and we don't want a
   // reflow command to try to be issued.
   nsFrameList temp(continuation, continuation);
   parent->InsertFrames(kNoReflowPrincipalList, placeholderFrame, nullptr, temp);
 
   *aContinuation = continuation;
-  return NS_OK;
 }
 
 void nsFirstLetterFrame::DrainOverflowFrames(nsPresContext* aPresContext) {
   // Check for an overflow list with our prev-in-flow
   nsFirstLetterFrame* prevInFlow = (nsFirstLetterFrame*)GetPrevInFlow();
   if (prevInFlow) {
     AutoFrameListPtr overflowFrames(aPresContext,
                                     prevInFlow->StealOverflowFrames());
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -69,20 +69,20 @@ class nsFirstLetterFrame final : public 
       nsIFrame** outChildFrame) override;
 
   nscoord GetFirstLetterBaseline() const { return mBaseline; }
 
   // For floating first letter frames, create a continuation for aChild and
   // place it in the correct place. aContinuation is an outparam for the
   // continuation that is created. aIsFluid determines if the continuation is
   // fluid or not.
-  nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
-                                               nsIFrame* aChild,
-                                               nsIFrame** aContinuation,
-                                               bool aIsFluid);
+  void CreateContinuationForFloatingParent(nsPresContext* aPresContext,
+                                           nsIFrame* aChild,
+                                           nsIFrame** aContinuation,
+                                           bool aIsFluid);
 
  protected:
   nscoord mBaseline;
 
   void DrainOverflowFrames(nsPresContext* aPresContext);
 };
 
 #endif /* nsFirstLetterFrame_h__ */