Bug 317278. Reland patch that reflows lines again if we detect some already-placed floats need to move to the next line. This time, with changes to nsSpaceManager's PushState/PopState infrastructure so that dynamic allocations are never required; the saved state is always stack-allocated by callers. r+sr=dbaron

git-svn-id: svn://10.0.0.236/trunk@200367 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2006-06-19 23:06:59 +00:00
parent 42cee07ac7
commit d643001e93
9 changed files with 260 additions and 197 deletions

View File

@@ -875,14 +875,20 @@ nsFloatCacheList::nsFloatCacheList() :
nsFloatCacheList::~nsFloatCacheList()
{
nsFloatCache* fc = mHead;
while (fc) {
nsFloatCache* next = fc->mNext;
delete fc;
fc = next;
DeleteAll();
MOZ_COUNT_DTOR(nsFloatCacheList);
}
void
nsFloatCacheList::DeleteAll()
{
nsFloatCache* c = mHead;
while (c) {
nsFloatCache* next = c->Next();
delete c;
c = next;
}
mHead = nsnull;
MOZ_COUNT_DTOR(nsFloatCacheList);
}
nsFloatCache*
@@ -929,17 +935,24 @@ nsFloatCacheList::Find(nsIFrame* aOutOfFlowFrame)
return fc;
}
void
nsFloatCacheList::Remove(nsFloatCache* aElement)
nsFloatCache*
nsFloatCacheList::RemoveAndReturnPrev(nsFloatCache* aElement)
{
nsFloatCache** fcp = &mHead;
nsFloatCache* fc;
while (nsnull != (fc = *fcp)) {
NS_ASSERTION(!aElement->mNext, "Can only remove a singleton element");
nsFloatCache* fc = mHead;
nsFloatCache* prev = nsnull;
while (fc) {
if (fc == aElement) {
*fcp = fc->mNext;
break;
if (prev) {
prev->mNext = fc->mNext;
} else {
mHead = fc->mNext;
}
return prev;
}
fcp = &fc->mNext;
prev = fc;
fc = fc->mNext;
}
}
@@ -975,6 +988,22 @@ nsFloatCacheFreeList::Append(nsFloatCacheList& aList)
aList.mHead = nsnull;
}
void
nsFloatCacheFreeList::Remove(nsFloatCache* aElement)
{
nsFloatCache* prev = nsFloatCacheList::RemoveAndReturnPrev(aElement);
if (mTail == aElement) {
mTail = prev;
}
}
void
nsFloatCacheFreeList::DeleteAll()
{
nsFloatCacheList::DeleteAll();
mTail = nsnull;
}
nsFloatCache*
nsFloatCacheFreeList::Alloc()
{