Bug 1341009 - Convert nsReflowStatus::Reset() to nsReflowStatus::IsEmpty() assertion in ReflowText(). draft
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 14 Sep 2017 16:22:21 +0800
changeset 666706 0ff73d3051012fae86b7802688d5c6cc630a8746
parent 666705 b303367abe280e4af9e232426fd2b3c4fa8a7f66
child 732181 fe046d373bf1ee7592f98a0f8b5c60d1fa6ff922
push id80486
push userbmo:tlin@mozilla.com
push dateTue, 19 Sep 2017 03:52:30 +0000
bugs1341009
milestone57.0a1
Bug 1341009 - Convert nsReflowStatus::Reset() to nsReflowStatus::IsEmpty() assertion in ReflowText(). MozReview-Commit-ID: Fa1Dq7xLP3n
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9359,16 +9359,18 @@ private:
 #endif
 
 void
 nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
                         DrawTarget* aDrawTarget,
                         ReflowOutput& aMetrics,
                         nsReflowStatus& aStatus)
 {
+  MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
+
 #ifdef NOISY_REFLOW
   ListTag(stdout);
   printf(": BeginReflow: availableWidth=%d\n", aAvailableWidth);
 #endif
 
   nsPresContext* presContext = PresContext();
 
 #ifdef ACCESSIBILITY
@@ -9393,17 +9395,16 @@ nsTextFrame::ReflowText(nsLineLayout& aL
   // so that when doing reflow our styles prevail over any part of the
   // textrun we look at. Note that next-in-flows may be mapping the same
   // content; gfxTextRun construction logic will ensure that we take priority.
   int32_t maxContentLength = GetInFlowContentLength();
 
   // We don't need to reflow if there is no content.
   if (!maxContentLength) {
     ClearMetrics(aMetrics);
-    aStatus.Reset();
     return;
   }
 
 #ifdef NOISY_BIDI
     printf("Reflowed textframe\n");
 #endif
 
   const nsStyleText* textStyle = StyleText();
@@ -9552,17 +9553,16 @@ nsTextFrame::ReflowText(nsLineLayout& aL
     ClearTextRuns();
     iter = EnsureTextRun(nsTextFrame::eInflated, aDrawTarget,
                          lineContainer, aLineLayout.GetLine(),
                          &flowEndInTextRun);
   }
 
   if (!mTextRun) {
     ClearMetrics(aMetrics);
-    aStatus.Reset();
     return;
   }
 
   NS_ASSERTION(gfxSkipCharsIterator(iter).ConvertOriginalToSkipped(offset + length)
                     <= mTextRun->GetLength(),
                "Text run does not map enough text for our reflow");
 
   /////////////////////////////////////////////////////////////////////
@@ -9880,17 +9880,16 @@ nsTextFrame::ReflowText(nsLineLayout& aL
       } else {
         aLineLayout.NotifyOptionalBreakPosition(this, length, true,
                                                 gfxBreakPriority::eNormalBreak);
       }
     }
   }
 
   // Compute reflow status
-  aStatus.Reset();
   if (contentLength != maxContentLength) {
     aStatus.SetIncomplete();
   }
 
   if (charsFit == 0 && length > 0 && !usedHyphenation) {
     // Couldn't place any text
     aStatus.SetInlineLineBreakBeforeAndReset();
   } else if (contentLength > 0 && mContentOffset + contentLength - 1 == newLineOffset) {