зеркало из https://github.com/mozilla/pjs.git
b=5588. Performance improvement. Avoids walking the child list
twice when inserting frames at the head of the list
This commit is contained in:
Родитель
8c921c097e
Коммит
532c36edeb
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче