Fix a frame creation slowdown caused by XBL. 2-3% speedup. r=danm, sr=waterson

This commit is contained in:
hyatt%netscape.com 2001-02-21 03:18:45 +00:00
parent 25a2852250
commit 97573598b3
3 changed files with 24 additions and 3 deletions

View File

@ -785,6 +785,8 @@ nsBindingManager::SetAnonymousNodesFor(nsIContent* aContent, nsISupportsArray* a
NS_IMETHODIMP
nsBindingManager::GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult)
{
*aResult = nsnull;
PRUint32 length;
// Retrieve the anonymous content that we should build.
@ -798,9 +800,12 @@ nsBindingManager::GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aRe
// We may have an altered list of children from XBL insertion points.
// If we don't have any anonymous kids, we next check to see if we have
// insertion points.
if (! *aResult)
GetContentListFor(aContent, aResult);
if (! *aResult) {
if (mContentListTable) {
nsISupportsKey key(aContent);
*aResult = NS_STATIC_CAST(nsIDOMNodeList*, mContentListTable->Get(&key));
}
}
return NS_OK;
}

View File

@ -49,6 +49,7 @@
#include "nsStyleConsts.h"
#include "nsTableOuterFrame.h"
#include "nsIXMLDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIWebShell.h"
#include "nsHTMLContainerFrame.h"
#include "nsINameSpaceManager.h"
@ -814,6 +815,11 @@ struct ChildIterator
mBindingManager->GetXBLChildNodesFor(mContent, getter_AddRefs(mNodes));
if (mNodes)
mNodes->GetLength(&mLength);
else {
PRInt32 l;
mContent->ChildCount(l);
mLength = l;
}
}
PRBool HasMoreChildren() {
@ -826,6 +832,8 @@ struct ChildIterator
mNodes->Item(mIndex, getter_AddRefs(node));
node->QueryInterface(NS_GET_IID(nsIContent), (void**)aChild);
}
else
mContent->ChildAt(mIndex, *aChild); // Addref happens here.
mIndex++;
}
};

View File

@ -49,6 +49,7 @@
#include "nsStyleConsts.h"
#include "nsTableOuterFrame.h"
#include "nsIXMLDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIWebShell.h"
#include "nsHTMLContainerFrame.h"
#include "nsINameSpaceManager.h"
@ -814,6 +815,11 @@ struct ChildIterator
mBindingManager->GetXBLChildNodesFor(mContent, getter_AddRefs(mNodes));
if (mNodes)
mNodes->GetLength(&mLength);
else {
PRInt32 l;
mContent->ChildCount(l);
mLength = l;
}
}
PRBool HasMoreChildren() {
@ -826,6 +832,8 @@ struct ChildIterator
mNodes->Item(mIndex, getter_AddRefs(node));
node->QueryInterface(NS_GET_IID(nsIContent), (void**)aChild);
}
else
mContent->ChildAt(mIndex, *aChild); // Addref happens here.
mIndex++;
}
};