Bug 407111. Correctly set whether a break opportunity after non-text content fits. r+sr=dbaron,a=schrep

This commit is contained in:
roc+@cs.cmu.edu 2007-12-07 01:17:19 -08:00
Родитель ca943e063c
Коммит 095643fe53
5 изменённых файлов: 33 добавлений и 7 удалений

Просмотреть файл

@ -1030,9 +1030,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// See if we can place the frame. If we can't fit it, then we
// return now.
PRBool optionalBreakAfterFits;
if (CanPlaceFrame(pfd, reflowState, notSafeToBreak, continuingTextRun,
savedOptionalBreakContent != nsnull, metrics,
aReflowStatus)) {
aReflowStatus, &optionalBreakAfterFits)) {
// Place the frame, updating aBounds with the final size and
// location. Then apply the bottom+right margins (as
// appropriate) to the frame.
@ -1053,7 +1054,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// record soft break opportunity after this content that can't be
// part of a text run. This is not a text frame so we know
// that offset PR_INT32_MAX means "after the content".
if (NotifyOptionalBreakPosition(aFrame->GetContent(), PR_INT32_MAX, PR_TRUE)) {
if (NotifyOptionalBreakPosition(aFrame->GetContent(), PR_INT32_MAX, optionalBreakAfterFits)) {
// If this returns true then we are being told to actually break here.
aReflowStatus = NS_INLINE_LINE_BREAK_AFTER(aReflowStatus);
}
@ -1146,9 +1147,12 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
PRBool aFrameCanContinueTextRun,
PRBool aCanRollBackBeforeFrame,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
nsReflowStatus& aStatus,
PRBool* aOptionalBreakAfterFits)
{
NS_PRECONDITION(pfd && pfd->mFrame, "bad args, null pointers for frame data");
*aOptionalBreakAfterFits = PR_TRUE;
// Compute right margin to use
if (0 != pfd->mBounds.width) {
NS_ASSERTION(aReflowState.mStyleDisplay->mFloats == NS_STYLE_FLOAT_NONE,
@ -1205,6 +1209,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
#endif
return PR_TRUE;
}
*aOptionalBreakAfterFits = PR_FALSE;
// When it doesn't fit, check for a few special conditions where we
// allow it to fit anyway.

Просмотреть файл

@ -250,8 +250,8 @@ public:
*/
PRBool NotifyOptionalBreakPosition(nsIContent* aContent, PRInt32 aOffset,
PRBool aFits) {
NS_ASSERTION(!GetFlag(LL_NEEDBACKUP),
"Shouldn't be updating the break position after we've already flagged an overrun");
NS_ASSERTION(!aFits || !GetFlag(LL_NEEDBACKUP),
"Shouldn't be updating the break position with a break that fits after we've already flagged an overrun");
// Remember the last break position that fits; if there was no break that fit,
// just remember the first break
if (aFits || !mLastOptionalBreakContent) {
@ -518,7 +518,8 @@ protected:
PRBool aFrameCanContinueTextRun,
PRBool aCanRollBackBeforeFrame,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus);
nsReflowStatus& aStatus,
PRBool* aOptionalBreakAfterFits);
void PlaceFrame(PerFrameData* pfd,
nsHTMLReflowMetrics& aMetrics);
@ -535,7 +536,6 @@ protected:
PRBool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaWidth);
void ComputeJustificationWeights(PerSpanData* psd, PRInt32* numSpaces, PRInt32* numLetters);
struct FrameJustificationState {

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<style>
b { white-space:nowrap; }
div { border:1px solid black; }
</style>
</head>
<body style="font-size:10px; width:200px; border:1px solid black"><b><img src="mozilla-banner.gif" width="100">T</b><br>
<b><img src="mozilla-banner.gif" width="100">T</b></body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<style>
b { white-space:nowrap; }
div { border:1px solid black; }
</style>
</head>
<body style="font-size:10px; width:200px; border:1px solid black"><b><img src="mozilla-banner.gif" width="100">T</b>
<b><img src="mozilla-banner.gif" width="100">T</b></br></body>
</html>

Просмотреть файл

@ -509,5 +509,6 @@ 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
== 407111-1.html 407111-1-ref.html
== 407227-1.html 407227-1-ref.html