diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -6036,17 +6036,19 @@ nsTextFrame::Reflow(nsPresContext* if (charsFit > 0 && charsFit == length && HasSoftHyphenBefore(frag, mTextRun, offset, end)) { // Record a potential break after final soft hyphen lineLayout.NotifyOptionalBreakPosition(mContent, offset + length, textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth, eNormalBreak); } PRBool breakAfter = forceBreakAfter; - if (!breakAfter && charsFit == length && + // length == 0 means either the text is empty or it's all collapsed away + PRBool emptyTextAtStartOfLine = atStartOfLine && length == 0; + if (!breakAfter && charsFit == length && !emptyTextAtStartOfLine && transformedOffset + transformedLength == mTextRun->GetLength() && (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK)) { // We placed all the text in the textrun and we have a break opportunity at // the end of the textrun. We need to record it because the following // content may not care about nsLineBreaker. // Note that because we didn't break, we can be sure that (thanks to the // code up above) textMetrics.mAdvanceWidth includes the width of any diff --git a/layout/reftests/bugs/440149-1-ref.html b/layout/reftests/bugs/440149-1-ref.html new file mode 100644 --- /dev/null +++ b/layout/reftests/bugs/440149-1-ref.html @@ -0,0 +1,13 @@ + + +
+