Bug 467291 - Reduce Addrefing while creating event target chain, r+sr=jst

This commit is contained in:
Olli Pettay
2008-12-03 11:26:38 +02:00
parent cc0c961dfc
commit ba780927bd
3 changed files with 19 additions and 7 deletions

View File

@@ -2802,7 +2802,9 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
}
}
nsCOMPtr<nsIContent> parent = aContent->GetParent();
nsIContent* parent = aContent->GetParent();
// Event may need to be retargeted if aContent is the root of a native
// anonymous content subtree or event is dispatched somewhere inside XBL.
if (isAnonForEvents) {
// If a DOM event is explicitly dispatched using node.dispatchEvent(), then
// all the events are allowed even in the native anonymous content..
@@ -2810,7 +2812,7 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
aVisitor.mDOMEvent,
"Mutation event dispatched in native anonymous content!?!");
aVisitor.mEventTargetAtParent = parent;
} else if (parent) {
} else if (parent && aVisitor.mOriginalTargetIsInAnon) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->target));
if (content && content->GetBindingParent() == parent) {
aVisitor.mEventTargetAtParent = parent;