mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Fix a frame creation slowdown caused by XBL. 2-3% speedup. r=danm, sr=waterson
This commit is contained in:
parent
25a2852250
commit
97573598b3
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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++;
|
||||
}
|
||||
};
|
||||
|
@ -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++;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user