b=5588. Performance improvement. Avoids walking the child list

twice when inserting frames at the head of the list
This commit is contained in:
troy%netscape.com 2000-03-12 03:07:52 +00:00
Родитель 428fcedaae
Коммит 0c7b650a86
2 изменённых файлов: 18 добавлений и 4 удалений

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

@ -154,16 +154,23 @@ nsFrameList::InsertFrames(nsIFrame* aParent,
{
NS_PRECONDITION(nsnull != aFrameList, "null ptr");
if (nsnull != aFrameList) {
nsIFrame* lastNewFrame = nsnull;
if (nsnull != aParent) {
nsIFrame* frame = aFrameList;
while (nsnull != frame) {
frame->SetParent(aParent);
lastNewFrame = frame;
frame->GetNextSibling(&frame);
}
}
nsFrameList tmp(aFrameList);
nsIFrame* lastNewFrame = tmp.LastChild();
// Get the last new frame if necessary
if (!lastNewFrame) {
nsFrameList tmp(aFrameList);
lastNewFrame = tmp.LastChild();
}
// Link the new frames into the child list
if (nsnull == aPrevSibling) {
lastNewFrame->SetNextSibling(mFirstChild);
mFirstChild = aFrameList;

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

@ -154,16 +154,23 @@ nsFrameList::InsertFrames(nsIFrame* aParent,
{
NS_PRECONDITION(nsnull != aFrameList, "null ptr");
if (nsnull != aFrameList) {
nsIFrame* lastNewFrame = nsnull;
if (nsnull != aParent) {
nsIFrame* frame = aFrameList;
while (nsnull != frame) {
frame->SetParent(aParent);
lastNewFrame = frame;
frame->GetNextSibling(&frame);
}
}
nsFrameList tmp(aFrameList);
nsIFrame* lastNewFrame = tmp.LastChild();
// Get the last new frame if necessary
if (!lastNewFrame) {
nsFrameList tmp(aFrameList);
lastNewFrame = tmp.LastChild();
}
// Link the new frames into the child list
if (nsnull == aPrevSibling) {
lastNewFrame->SetNextSibling(mFirstChild);
mFirstChild = aFrameList;