Bug 493266 - Optimize setting currentTarget, r+sr=bz

This commit is contained in:
Olli Pettay 2009-06-15 13:21:06 +03:00
Родитель 0b62d46a84
Коммит c793d0d750
2 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -218,15 +218,14 @@ nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor& aVisitor,
mTarget->GetListenerManager(PR_FALSE, getter_AddRefs(mManager));
}
if (mManager) {
nsPIDOMEventTarget* currentTarget = CurrentTarget()->GetTargetForDOMEvent();
aVisitor.mEvent->currentTarget = currentTarget;
if (aVisitor.mEvent->currentTarget) {
mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
&aVisitor.mDOMEvent,
currentTarget, aFlags,
&aVisitor.mEventStatus);
aVisitor.mEvent->currentTarget = nsnull;
}
NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
"CurrentTarget should be null!");
mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
&aVisitor.mDOMEvent,
CurrentTarget(), aFlags,
&aVisitor.mEventStatus);
NS_ASSERTION(aVisitor.mEvent->currentTarget == nsnull,
"CurrentTarget should be null!");
}
return NS_OK;
}

Просмотреть файл

@ -1176,6 +1176,12 @@ found:
EmptyString(), aDOMEvent);
}
if (*aDOMEvent) {
if (!aEvent->currentTarget) {
aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent();
if (!aEvent->currentTarget) {
break;
}
}
nsRefPtr<nsIDOMEventListener> kungFuDeathGrip = ls->mListener;
if (useTypeInterface) {
pusher.Pop();
@ -1192,6 +1198,8 @@ found:
}
}
aEvent->currentTarget = nsnull;
if (!hasListener) {
mNoListenerForEvent = aEvent->message;
mNoListenerForEventAtom = aEvent->userType;