Bug 440149. Don't break after empty text at the start of the line, even if we're past the available width. r=smontagu

This commit is contained in:
Robert O'Callahan 2009-01-09 13:13:45 +13:00
parent 0a88efce86
commit ec55ad45cf
4 changed files with 30 additions and 1 deletions

View File

@ -6041,7 +6041,9 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
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

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head><style>
div {
width: 0px;
}
span {
border: 5px solid orange;
margin-left: 50px;
}
</style></head>
<body><div><span><input></span></div></body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head><style>
div {
width: 0px;
}
span {
border: 5px solid orange;
margin-left: 50px;
}
</style></head>
<body><div><span><!--whitespace--> <input></span></div></body>
</html>

View File

@ -929,6 +929,7 @@ random == 429849-1.html 429849-1-ref.html # bug 432288
== 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