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 @@ + + + +
+ diff --git a/layout/reftests/bugs/440149-1.html b/layout/reftests/bugs/440149-1.html new file mode 100644 --- /dev/null +++ b/layout/reftests/bugs/440149-1.html @@ -0,0 +1,13 @@ + + + +
+ diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -924,16 +924,17 @@ random == 429849-1.html 429849-1-ref.htm == 438987-1.html 438987-1-ref.html == 438987-2a.html 438987-2-ref.html == 438987-2b.html 438987-2-ref.html == 438987-2c.html 438987-2-ref.html != about:blank 438987-2-ref.html # check that backgrounds work at all == 439004-1.html 439004-1-ref.html == 439639-1.html 439639-1-ref.html == 439910.html 439910-ref.html +== 440149-1.html 440149-1-ref.html == 441259-1.html 441259-1-ref.html fails == 441259-2.html 441259-2-ref.html # bug 441400 == 442542-1.html 442542-1-ref.html == 444015-1.html 444015-1-ref.html == 444375-1.html 444375-1-ref.html == 444928-1.html 444928-1-ref.html == 444928-2.html 444928-2-ref.html != 444928-3.html 444928-3-notref.html