Clear the float cache from placeholders that are descendants of the frame we remove. b=337883 r+sr=roc

This commit is contained in:
mats.palmgren%bredband.net 2006-05-25 01:30:34 +00:00
parent 297a8f5ac0
commit a5a64a9fb9
3 changed files with 40 additions and 4 deletions

View File

@ -5573,10 +5573,10 @@ nsBlockFrame::RemoveFrame(nsIAtom* aListName,
nsresult rv = NS_OK;
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": remove ");
nsFrame::ListTag(stdout, aOldFrame);
printf("\n");
ListTag(stdout);
printf(": remove ");
nsFrame::ListTag(stdout, aOldFrame);
printf("\n");
#endif
if (nsnull == aListName) {
@ -5790,6 +5790,13 @@ found_frame:;
nsFrame::ListTag(stdout, aDeletedFrame);
printf(" prevSibling=%p deletedNextContinuation=%p\n", prevSibling, deletedNextContinuation);
#endif
if (!aDeletedFrame->IsFloatContainingBlock()) {
// Clear the float cache from placeholders that are descendants
// of aDeletedFrame (bug 337883).
line->RemovePlaceholderDescendantsOf(aDeletedFrame);
}
if (aDestroyFrames) {
aDeletedFrame->Destroy();
} else {

View File

@ -501,6 +501,34 @@ nsLineBox::RemoveFloat(nsIFrame* aFrame)
return PR_FALSE;
}
void
nsLineBox::RemovePlaceholderDescendantsOf(nsIFrame* aFrame)
{
if (IsInline() && mInlineData) {
nsFloatCache* fc = mInlineData->mFloats.Head();
while (fc) {
nsIFrame* frame = fc->mPlaceholder;
while (frame && frame != aFrame) {
if (frame->IsFloatContainingBlock()) {
frame = nsnull;
break;
}
frame = frame->GetParent();
}
if (NS_UNLIKELY(frame)) {
nsFloatCache* next = fc->Next();
mInlineData->mFloats.Remove(fc);
delete fc;
MaybeFreeData();
fc = next;
}
else {
fc = fc->Next();
}
}
}
}
void
nsLineBox::SetCombinedArea(const nsRect& aCombinedArea)
{

View File

@ -372,6 +372,7 @@ public:
void FreeFloats(nsFloatCacheFreeList& aFreeList);
void AppendFloats(nsFloatCacheFreeList& aFreeList);
PRBool RemoveFloat(nsIFrame* aFrame);
void RemovePlaceholderDescendantsOf(nsIFrame* aFrame);
// Combined area is the area of the line that should influence the
// overflow area of its parent block. The combined area should be