зеркало из https://github.com/mozilla/gecko-dev.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:
Родитель
428fcedaae
Коммит
0c7b650a86
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the last new frame if necessary
|
||||
if (!lastNewFrame) {
|
||||
nsFrameList tmp(aFrameList);
|
||||
nsIFrame* lastNewFrame = tmp.LastChild();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the last new frame if necessary
|
||||
if (!lastNewFrame) {
|
||||
nsFrameList tmp(aFrameList);
|
||||
nsIFrame* lastNewFrame = tmp.LastChild();
|
||||
lastNewFrame = tmp.LastChild();
|
||||
}
|
||||
|
||||
// Link the new frames into the child list
|
||||
if (nsnull == aPrevSibling) {
|
||||
lastNewFrame->SetNextSibling(mFirstChild);
|
||||
mFirstChild = aFrameList;
|
||||
|
|
Загрузка…
Ссылка в новой задаче