Bug 570160 - Don't create a next-in-flow for a placeholder frame, split the float instead. r=fantasai

This commit is contained in:
Mats Palmgren 2010-06-29 16:32:03 +02:00
Родитель 8e5e0bf0e5
Коммит 3c6c4cdb3c
3 изменённых файлов: 121 добавлений и 69 удалений

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

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html class="reftest-print">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Testcase for bug 570160</title>
<!-- distilled from href="http://www.musicalcriticism.com/concerts/usherhall-rsno-clein-0510.shtml" -->
<style type="text/css">
.manuscript {
position: absolute;
left: 770px;
top: 134px;
width: 233px;
height: 133px;
}
#maintext {
padding: 0px px 15px 15px;
position: absolute;
left: 16px;
top: 299px;
width: 752px;
height: 636px;
}
#maintext img {
padding: 10px 10px 10px 25px;
float: right;
}
</style></head>
<body>
<div class="manuscript"></div>
<div id="maintext">
<div style="height:98%"></div>
<p><img src="yyyyyyy" alt="line" width="750" height="50" /></p>
<p><strong><img src="xxxxx" alt="maxwell davies" width="100" height="100" />Related articles:</strong></p>
<p>The RSNO and Denève in Mahler 6<br />
</div>
</body>
</html>

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

@ -324,4 +324,5 @@ load 547843-1.xhtml
load 551635-1.html
load 564368-1.xhtml
load 564968.xhtml
load 570160.html
load 571618-1.svg

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

@ -718,90 +718,88 @@ nsInlineFrame::ReflowInlineFrame(nsPresContext* aPresContext,
if (NS_FAILED(rv)) {
return rv;
}
if (NS_INLINE_IS_BREAK(aStatus)) {
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
if (aFrame != mFrames.FirstChild()) {
// Change break-before status into break-after since we have
// already placed at least one child frame. This preserves the
// break-type so that it can be propagated upward.
aStatus = NS_FRAME_NOT_COMPLETE |
NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
(aStatus & NS_INLINE_BREAK_TYPE_MASK);
PushFrames(aPresContext, aFrame, irs.mPrevFrame, irs);
}
else {
// Preserve reflow status when breaking-before our first child
// and propagate it upward without modification.
// Note: if we're lazily setting the frame pointer for our child
// frames, then we need to set it now. Don't return and leave the
// remaining child frames in our child list with the wrong parent
// frame pointer...
if (irs.mSetParentPointer) {
if (irs.mLineContainer && irs.mLineContainer->GetPrevContinuation()) {
ReparentFloatsForInlineChild(irs.mLineContainer, aFrame->GetNextSibling(),
PR_TRUE);
}
for (nsIFrame* f = aFrame->GetNextSibling(); f; f = f->GetNextSibling()) {
f->SetParent(this);
if (lineLayout->GetInFirstLine()) {
aPresContext->FrameManager()->ReparentStyleContext(f);
}
}
}
}
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
if (aFrame != mFrames.FirstChild()) {
// Change break-before status into break-after since we have
// already placed at least one child frame. This preserves the
// break-type so that it can be propagated upward.
aStatus = NS_FRAME_NOT_COMPLETE |
NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
(aStatus & NS_INLINE_BREAK_TYPE_MASK);
PushFrames(aPresContext, aFrame, irs.mPrevFrame, irs);
}
else {
// Break-after
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
nsIFrame* newFrame;
rv = CreateNextInFlow(aPresContext, aFrame, newFrame);
if (NS_FAILED(rv)) {
return rv;
// Preserve reflow status when breaking-before our first child
// and propagate it upward without modification.
// Note: if we're lazily setting the frame pointer for our child
// frames, then we need to set it now. Don't return and leave the
// remaining child frames in our child list with the wrong parent
// frame pointer...
if (irs.mSetParentPointer) {
if (irs.mLineContainer && irs.mLineContainer->GetPrevContinuation()) {
ReparentFloatsForInlineChild(irs.mLineContainer, aFrame->GetNextSibling(),
PR_TRUE);
}
}
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
NS_FRAME_SET_INCOMPLETE(aStatus);
PushFrames(aPresContext, nextFrame, aFrame, irs);
}
else if (nsnull != GetNextInFlow()) {
// We must return an incomplete status if there are more child
// frames remaining in a next-in-flow that follows this frame.
nsInlineFrame* nextInFlow = (nsInlineFrame*) GetNextInFlow();
while (nsnull != nextInFlow) {
if (nextInFlow->mFrames.NotEmpty()) {
NS_FRAME_SET_INCOMPLETE(aStatus);
break;
for (nsIFrame* f = aFrame->GetNextSibling(); f; f = f->GetNextSibling()) {
f->SetParent(this);
if (lineLayout->GetInFirstLine()) {
aPresContext->FrameManager()->ReparentStyleContext(f);
}
nextInFlow = (nsInlineFrame*) nextInFlow->GetNextInFlow();
}
}
}
return NS_OK;
}
else if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
// Create a next-in-flow if needed.
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
if (nsGkAtoms::placeholderFrame == aFrame->GetType()) {
nsBlockReflowState* blockRS = lineLayout->mBlockRS;
nsPlaceholderFrame* placeholder = static_cast<nsPlaceholderFrame*>(aFrame);
rv = blockRS->mBlock->SplitFloat(*blockRS, placeholder->GetOutOfFlowFrame(),
nsPlaceholderFrame* placeholder =
static_cast<nsPlaceholderFrame*>(aFrame);
rv = blockRS->mBlock->SplitFloat(*blockRS,
placeholder->GetOutOfFlowFrame(),
aStatus);
// Allow the parent to continue reflowing
// Allow the parent to continue reflowing.
aStatus = NS_FRAME_COMPLETE;
return rv;
}
else {
nsIFrame* newFrame;
rv = CreateNextInFlow(aPresContext, aFrame, newFrame);
if (NS_FAILED(rv)) {
return rv;
}
if (!reflowingFirstLetter) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
PushFrames(aPresContext, nextFrame, aFrame, irs);
}
}
nsIFrame* newFrame;
rv = CreateNextInFlow(aPresContext, aFrame, newFrame);
if (NS_FAILED(rv)) {
return rv;
}
}
return rv;
if (NS_INLINE_IS_BREAK_AFTER(aStatus)) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
NS_FRAME_SET_INCOMPLETE(aStatus);
PushFrames(aPresContext, nextFrame, aFrame, irs);
}
else {
// We must return an incomplete status if there are more child
// frames remaining in a next-in-flow that follows this frame.
nsInlineFrame* nextInFlow = static_cast<nsInlineFrame*>(GetNextInFlow());
while (nextInFlow) {
if (nextInFlow->mFrames.NotEmpty()) {
NS_FRAME_SET_INCOMPLETE(aStatus);
break;
}
nextInFlow = static_cast<nsInlineFrame*>(nextInFlow->GetNextInFlow());
}
}
return NS_OK;
}
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus) && !reflowingFirstLetter) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
PushFrames(aPresContext, nextFrame, aFrame, irs);
}
}
return NS_OK;
}
nsIFrame*