relanding fix for bug 317278 :-(
git-svn-id: svn://10.0.0.236/trunk@201179 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user