This commit is contained in:
hyatt%netscape.com 2001-04-28 05:50:46 +00:00
Родитель 48c7988529
Коммит bc91edac71
3 изменённых файлов: 14 добавлений и 8 удалений

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

@ -149,7 +149,7 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAR
mEvent = PR_NEWZAP(nsEvent);
mEvent->eventStructType = NS_EVENT;
}
else if (eventType.EqualsIgnoreCase("MutationEvent")) {
else if (eventType.EqualsIgnoreCase("MutationEvents")) {
mEvent = PR_NEWZAP(nsMutationEvent);
mEvent->eventStructType = NS_MUTATION_EVENT;
}
@ -1393,9 +1393,14 @@ nsDOMEvent::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsISupports *supports = (nsISupports *)(nsIDOMMouseEvent *)this;
res = NS_NewScriptKeyEvent(aContext, supports, nsnull, (void**)&mScriptObject);
if (mEvent && mEvent->eventStructType == NS_MUTATION_EVENT) {
nsISupports *supports = (nsISupports *)(nsIDOMMutationEvent *)this;
res = NS_NewScriptMutationEvent(aContext, supports, nsnull, (void**)&mScriptObject);
}
else {
nsISupports *supports = (nsISupports *)(nsIDOMMouseEvent *)this;
res = NS_NewScriptKeyEvent(aContext, supports, nsnull, (void**)&mScriptObject);
}
}
*aScriptObject = mScriptObject;

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

@ -43,9 +43,9 @@ class nsDOMMutationEvent : public nsIDOMMutationEvent, public nsDOMEvent
nsDOMMutationEvent::nsDOMMutationEvent(nsIPresContext* aPresContext,
nsEvent* aEvent)
:nsDOMEvent(aPresContext, aEvent, NS_LITERAL_STRING("MutationEvent"))
:nsDOMEvent(aPresContext, aEvent, NS_LITERAL_STRING("MutationEvents"))
{
nsMutationEvent* mutation = (nsMutationEvent*)aEvent;
nsMutationEvent* mutation = (nsMutationEvent*)mEvent;
SetTarget(mutation->mTarget);
}
@ -60,6 +60,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMMutationEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMMutationEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMutationEvent)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
NS_INTERFACE_MAP_END
NS_IMETHODIMP

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

@ -2091,13 +2091,13 @@ nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext,
{
nsAutoString str(aEventType);
if (!aEvent && !str.EqualsIgnoreCase("MouseEvent") && !str.EqualsIgnoreCase("KeyEvent") &&
!str.EqualsIgnoreCase("HTMLEvent") && !str.EqualsIgnoreCase("MutationEvent") &&
!str.EqualsIgnoreCase("HTMLEvent") && !str.EqualsIgnoreCase("MutationEvents") &&
!str.EqualsIgnoreCase("Event")) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
if ((aEvent && aEvent->eventStructType == NS_MUTATION_EVENT) ||
(!aEvent && str.EqualsIgnoreCase("MutationEvent")))
(!aEvent && str.EqualsIgnoreCase("MutationEvents")))
return NS_NewDOMMutationEvent(aDOMEvent, aPresContext, aEvent);
return NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEventType, aEvent);
}