Bug 407227. Include end-of-linebreaker-textrun break opportunity in min-width calculation. r+sr=dbaron,a=schrep

This commit is contained in:
roc+@cs.cmu.edu 2007-12-06 19:16:07 -08:00
parent 21900626e0
commit 079aadfbec
4 changed files with 35 additions and 6 deletions

View File

@ -4723,23 +4723,23 @@ nsTextFrame::PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool
do {
PRBool isPunctuation = cIter.IsPunctuation();
PRBool isWhitespace = cIter.IsWhitespace();
if (aWordSelectEatSpace == isWhitespace && !aState->mSawBeforeType) {
if (aWordSelectEatSpace == cIter.IsWhitespace() && !aState->mSawBeforeType) {
aState->SetSawBeforeType();
aState->Update(isPunctuation, isWhitespace);
aState->Update(isPunctuation);
continue;
}
// See if we can break before the current cluster
if (!aState->mAtStart) {
PRBool canBreak = isPunctuation != aState->mLastCharWasPunctuation
? BreakWordBetweenPunctuation(aState, isPunctuation, isWhitespace, aIsKeyboardSelect)
? BreakWordBetweenPunctuation(aForward ? aState->mLastCharWasPunctuation : isPunctuation,
aIsKeyboardSelect)
: cIter.HaveWordBreakBefore() && aState->mSawBeforeType;
if (canBreak) {
*aOffset = cIter.GetBeforeOffset() - mContentOffset;
return PR_TRUE;
}
}
aState->Update(isPunctuation, isWhitespace);
aState->Update(isPunctuation);
} while (cIter.NextCluster());
*aOffset = cIter.GetAfterOffset() - mContentOffset;
@ -4918,7 +4918,9 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
}
}
if (i < flowEndInTextRun) {
if (i < flowEndInTextRun ||
(i == mTextRun->GetLength() &&
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
if (preformattedNewline) {
aData->ForceBreak(aRenderingContext);
} else {

View File

@ -0,0 +1,13 @@
<html>
<body>
<table bgcolor="lightgray" width="70">
<tbody>
<tr>
<td bgcolor="red">
<img width="50" height="50"><br><img width="50" height="50">
</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<body>
<table bgcolor="lightgray" width="70">
<tbody>
<tr>
<td bgcolor="red">
<img width="50" height="50"> <img width="50" height="50">
</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -509,4 +509,5 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 405584-1.html 405584-1-ref.html
== 406484-1.html 406484-1-ref.html
== 406568-1.html 406568-1-ref.html
== 407227-1.html 407227-1-ref.html