Bug 1341009 - Convert nsReflowStatus::Reset() to nsReflowStatus::IsEmpty() assertion in ReflowText().
MozReview-Commit-ID: Fa1Dq7xLP3n
--- 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) {