mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 402950. Allow spans to always be placed on a line, because part of the span may fit even if the whole span doesn't. Also request backup earlier so we always backup if we decline to place a frame. r+sr=dbaron
This commit is contained in:
parent
26affce9de
commit
4d16d41efc
@ -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
|
||||
|
15
layout/reftests/bugs/402950-1-ref.html
Normal file
15
layout/reftests/bugs/402950-1-ref.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<style>
|
||||
p { width: 13em; border: 1px solid black; }
|
||||
p { white-space: nowrap; }
|
||||
a { color:pink; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p><span>mmmmmmmmmm</span><br>
|
||||
<span>mmmmm<a>mmmmm</a></span></p>
|
||||
<p>m <span>mmmmmmmmmm</span><br>
|
||||
<span>m<a>mmmmmmmmm</a></span></p>
|
||||
</body>
|
||||
</html>
|
21
layout/reftests/bugs/402950-1.html
Normal file
21
layout/reftests/bugs/402950-1.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<style>
|
||||
p { width: 13em; border: 1px solid black; }
|
||||
p span { white-space: nowrap; }
|
||||
a { color:pink; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- We should be able to break even when the only break opportunity is within a span
|
||||
that overflows the line width (the break opportunity after the whitespace is treated
|
||||
as a break before the first character of the second span) -->
|
||||
<p><span>mmmmmmmmmm</span>
|
||||
<span>mmmmm<a>mmmmm</a></span></p>
|
||||
<!-- A span that overflows the line width should be allowed to fit, it might have a break
|
||||
opportunity inside it (the break opportunity after the whitespace is treated
|
||||
as a break before the first character of the second span) -->
|
||||
<p>m <span>mmmmmmmmmm</span>
|
||||
<span>m<a>mmmmmmmmm</a></span></p>
|
||||
</body>
|
||||
</html>
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user