Added construct and destruct events to the DOM.

This commit is contained in:
hyatt%netscape.com 1999-06-08 05:10:13 +00:00
parent b520345abb
commit 1605014d5e
8 changed files with 62 additions and 4 deletions

View File

@ -36,7 +36,8 @@ static char* mEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mouseout", "mousemove", "keydown", "keyup", "keypress",
"focus", "blur", "load", "unload", "abort", "error",
"submit", "reset", "change", "paint" ,"text"
"submit", "reset", "change", "paint" ,"text",
"construct", "destruct"
};
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
@ -471,6 +472,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_paint];
case NS_TEXT_EVENT:
return mEventNames[eDOMEvents_text];
case NS_POPUP_CONSTRUCT:
return mEventNames[eDOMEvents_construct];
case NS_POPUP_DESTRUCT:
return mEventNames[eDOMEvents_destruct];
default:
break;
}

View File

@ -56,7 +56,9 @@ public:
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_paint,
eDOMEvents_text
eDOMEvents_text,
eDOMEvents_construct,
eDOMEvents_destruct
};
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent);

View File

@ -340,6 +340,14 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMPaintListenerIID;
*aFlags = NS_EVENT_BITS_PAINT_PAINT;
} // extened this to handle IME related events
else if (aType == "construct") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_CONSTRUCT;
}
else if (aType == "destruct") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_DESTRUCT;
}
else {
return NS_ERROR_FAILURE;
}
@ -883,6 +891,8 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_PAGE_LOAD:
case NS_PAGE_UNLOAD:
case NS_POPUP_CONSTRUCT:
case NS_POPUP_DESTRUCT:
if (nsnull != mLoadListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -921,6 +931,16 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_POPUP_CONSTRUCT:
if (ls->mSubType & NS_EVENT_BITS_LOAD_CONSTRUCT) {
correctSubType = PR_TRUE;
}
break;
case NS_POPUP_DESTRUCT:
if (ls->mSubType & NS_EVENT_BITS_LOAD_DESTRUCT) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}

View File

@ -161,6 +161,8 @@ protected:
#define NS_EVENT_BITS_LOAD_UNLOAD 0x02
#define NS_EVENT_BITS_LOAD_ABORT 0x04
#define NS_EVENT_BITS_LOAD_ERROR 0x08
#define NS_EVENT_BITS_LOAD_CONSTRUCT 0x10
#define NS_EVENT_BITS_LOAD_DESTRUCT 0x20
//nsIDOMDragListener
#define NS_EVENT_BITS_DRAG_NONE 0x00

View File

@ -36,7 +36,8 @@ static char* mEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mouseout", "mousemove", "keydown", "keyup", "keypress",
"focus", "blur", "load", "unload", "abort", "error",
"submit", "reset", "change", "paint" ,"text"
"submit", "reset", "change", "paint" ,"text",
"construct", "destruct"
};
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
@ -471,6 +472,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_paint];
case NS_TEXT_EVENT:
return mEventNames[eDOMEvents_text];
case NS_POPUP_CONSTRUCT:
return mEventNames[eDOMEvents_construct];
case NS_POPUP_DESTRUCT:
return mEventNames[eDOMEvents_destruct];
default:
break;
}

View File

@ -56,7 +56,9 @@ public:
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_paint,
eDOMEvents_text
eDOMEvents_text,
eDOMEvents_construct,
eDOMEvents_destruct
};
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent);

View File

@ -340,6 +340,14 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMPaintListenerIID;
*aFlags = NS_EVENT_BITS_PAINT_PAINT;
} // extened this to handle IME related events
else if (aType == "construct") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_CONSTRUCT;
}
else if (aType == "destruct") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_DESTRUCT;
}
else {
return NS_ERROR_FAILURE;
}
@ -883,6 +891,8 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_PAGE_LOAD:
case NS_PAGE_UNLOAD:
case NS_POPUP_CONSTRUCT:
case NS_POPUP_DESTRUCT:
if (nsnull != mLoadListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -921,6 +931,16 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_POPUP_CONSTRUCT:
if (ls->mSubType & NS_EVENT_BITS_LOAD_CONSTRUCT) {
correctSubType = PR_TRUE;
}
break;
case NS_POPUP_DESTRUCT:
if (ls->mSubType & NS_EVENT_BITS_LOAD_DESTRUCT) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}

View File

@ -161,6 +161,8 @@ protected:
#define NS_EVENT_BITS_LOAD_UNLOAD 0x02
#define NS_EVENT_BITS_LOAD_ABORT 0x04
#define NS_EVENT_BITS_LOAD_ERROR 0x08
#define NS_EVENT_BITS_LOAD_CONSTRUCT 0x10
#define NS_EVENT_BITS_LOAD_DESTRUCT 0x20
//nsIDOMDragListener
#define NS_EVENT_BITS_DRAG_NONE 0x00