diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 68375601dcd..935e93d9758 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -1267,21 +1267,29 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, } if (aFrameCanContinueTextRun) { - // Let it fit, but we reserve the right to roll back - // to before the text run! Note that we usually won't get here because - // a text frame will break itself to avoid exceeding the available width. + // Let it fit, but we reserve the right to roll back. + // Note that we usually won't get here because a text frame will break + // itself to avoid exceeding the available width. // We'll only get here for text frames that couldn't break early enough. #ifdef NOISY_CAN_PLACE_FRAME printf(" ==> placing overflowing textrun, requesting backup\n"); #endif + + // We will want to try backup. + SetFlag(LL_NEEDBACKUP, PR_TRUE); + if (!aCanRollBackBeforeFrame) { // Nowhere to roll back to, so make this fit return PR_TRUE; } - - // We have something to roll back to. So, signal that we will to roll back, - // and fall through to not place this frame. - SetFlag(LL_NEEDBACKUP, PR_TRUE); + if (pfd->mSpan) { + // Allow spans to fit here. We don't want a span to fail to fit just + // because one of its children didn't fit; there may be a break opportunity + // we can roll back to inside the span. + return PR_TRUE; + } + // There is a break opportunity before the frame, so we can stop line + // reflow now. } #ifdef NOISY_CAN_PLACE_FRAME diff --git a/mozilla/layout/reftests/bugs/402950-1-ref.html b/mozilla/layout/reftests/bugs/402950-1-ref.html new file mode 100644 index 00000000000..40911b5e6cf --- /dev/null +++ b/mozilla/layout/reftests/bugs/402950-1-ref.html @@ -0,0 +1,15 @@ + + + + + +

mmmmmmmmmm
+mmmmmmmmmm

+

m mmmmmmmmmm
+mmmmmmmmmm

+ + diff --git a/mozilla/layout/reftests/bugs/402950-1.html b/mozilla/layout/reftests/bugs/402950-1.html new file mode 100644 index 00000000000..923678d66ee --- /dev/null +++ b/mozilla/layout/reftests/bugs/402950-1.html @@ -0,0 +1,21 @@ + + + + + + +

mmmmmmmmmm +mmmmmmmmmm

+ +

m mmmmmmmmmm +mmmmmmmmmm

+ + diff --git a/mozilla/layout/reftests/bugs/reftest.list b/mozilla/layout/reftests/bugs/reftest.list index 49100e017f5..e5b4dc1be6c 100644 --- a/mozilla/layout/reftests/bugs/reftest.list +++ b/mozilla/layout/reftests/bugs/reftest.list @@ -450,6 +450,7 @@ fails == 386310-1d.html 386310-1-ref.html == 400171-2c.html 400171-2-ref.html == 400421-1.html 400421-1-ref.html == 400826-1.html 400826-1-ref.html +== 402950-1.html 402950-1-ref.html == 403129-1.html 403129-1-ref.html == 403129-2.html 403129-2-ref.html == 403129-3.html 403129-3-ref.html