зеркало из https://github.com/mozilla/pjs.git
Bug 700981 part 5. Reduce the amount of time spent calling GetBindingParent(). r=smaug
This commit is contained in:
Родитель
3c1d835acc
Коммит
eec3e8fb77
|
@ -114,8 +114,9 @@ public:
|
|||
* @param aParent The new parent for the content node. May be null if the
|
||||
* node is being bound as a direct child of the document.
|
||||
* @param aBindingParent The new binding parent for the content node.
|
||||
* This is allowed to be null. In that case, the
|
||||
* binding parent of aParent, if any, will be used.
|
||||
* This is must either be non-null if a particular
|
||||
* binding parent is desired or match aParent's binding
|
||||
* parent.
|
||||
* @param aCompileEventHandlers whether to initialize the event handlers in
|
||||
* the document (used by nsXULElement)
|
||||
* @note either aDocument or aParent must be non-null. If both are null,
|
||||
|
|
|
@ -3090,10 +3090,9 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
aBindingParent == aParent,
|
||||
"Native anonymous content must have its parent as its "
|
||||
"own binding parent");
|
||||
|
||||
if (!aBindingParent && aParent) {
|
||||
aBindingParent = aParent->GetBindingParent();
|
||||
}
|
||||
NS_PRECONDITION(aBindingParent || !aParent ||
|
||||
aBindingParent == aParent->GetBindingParent(),
|
||||
"We should be passed the right binding parent");
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// First set the binding parent
|
||||
|
@ -3810,7 +3809,9 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
|||
nsIContent* parent =
|
||||
IsNodeOfType(eDOCUMENT) ? nsnull : static_cast<nsIContent*>(this);
|
||||
|
||||
rv = aKid->BindToTree(doc, parent, nsnull, true);
|
||||
rv = aKid->BindToTree(doc, parent,
|
||||
parent ? parent->GetBindingParent() : nsnull,
|
||||
true);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (GetFirstChild() == aKid) {
|
||||
mFirstChild = aKid->GetNextSibling();
|
||||
|
|
|
@ -1326,7 +1326,8 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
|
|||
// XXXbz this is somewhat screwed up, since it's sort of like anonymous
|
||||
// content... but not.
|
||||
nsresult rv =
|
||||
child->BindToTree(parent->GetCurrentDoc(), parent, nsnull, false);
|
||||
child->BindToTree(parent->GetCurrentDoc(), parent,
|
||||
parent->GetBindingParent(), false);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Well... now what? Just unbind and bail out, I guess...
|
||||
// XXXbz This really shouldn't be a void method!
|
||||
|
@ -1997,7 +1998,8 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
|
|||
if (defaultContent) {
|
||||
xblIns->SetDefaultContent(defaultContent);
|
||||
|
||||
rv = defaultContent->BindToTree(nsnull, content, nsnull, false);
|
||||
rv = defaultContent->BindToTree(nsnull, content,
|
||||
content->GetBindingParent(), false);
|
||||
if (NS_FAILED(rv)) {
|
||||
defaultContent->UnbindFromTree();
|
||||
return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче