adding 'close' xul event handler. part of bug 13695. r:hyatt@netscape.com
This commit is contained in:
Родитель
dfbb3e4b9e
Коммит
a9db94dfe7
|
@ -50,8 +50,8 @@ static char* mEventNames[] = {
|
|||
"mouseout", "mousemove", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "unload", "abort", "error",
|
||||
"submit", "reset", "change", "select", "input", "paint" ,"text",
|
||||
"create", "destroy", "command", "broadcast", "commandupdate", "dragenter", "dragover", "dragexit",
|
||||
"dragdrop", "draggesture"
|
||||
"create", "close", "destroy", "command", "broadcast", "commandupdate",
|
||||
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture"
|
||||
};
|
||||
|
||||
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||
|
@ -855,6 +855,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
|||
return mEventNames[eDOMEvents_focus];
|
||||
case NS_BLUR_CONTENT:
|
||||
return mEventNames[eDOMEvents_blur];
|
||||
case NS_XUL_CLOSE:
|
||||
return mEventNames[eDOMEvents_close];
|
||||
case NS_PAGE_LOAD:
|
||||
case NS_IMAGE_LOAD:
|
||||
return mEventNames[eDOMEvents_load];
|
||||
|
|
|
@ -70,8 +70,9 @@ public:
|
|||
eDOMEvents_select,
|
||||
eDOMEvents_input,
|
||||
eDOMEvents_paint,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_create,
|
||||
eDOMEvents_close,
|
||||
eDOMEvents_destroy,
|
||||
eDOMEvents_command,
|
||||
eDOMEvents_broadcast,
|
||||
|
|
|
@ -388,6 +388,10 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, nsIID& aI
|
|||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_MENU_CREATE;
|
||||
}
|
||||
else if (aType == nsLayoutAtoms::onclose) {
|
||||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_XUL_CLOSE;
|
||||
}
|
||||
else if (aType == nsLayoutAtoms::ondestroy) {
|
||||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_MENU_DESTROY;
|
||||
|
@ -1268,6 +1272,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
|
||||
case NS_MENU_CREATE:
|
||||
case NS_XUL_CLOSE:
|
||||
case NS_MENU_DESTROY:
|
||||
case NS_MENU_ACTION:
|
||||
case NS_XUL_BROADCAST:
|
||||
|
@ -1289,6 +1294,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
case NS_MENU_CREATE:
|
||||
ret = mMenuListener->Create(*aDOMEvent);
|
||||
break;
|
||||
case NS_XUL_CLOSE:
|
||||
ret = mMenuListener->Close(*aDOMEvent);
|
||||
break;
|
||||
case NS_MENU_DESTROY:
|
||||
ret = mMenuListener->Destroy(*aDOMEvent);
|
||||
break;
|
||||
|
@ -1316,6 +1324,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
correctSubType = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
case NS_XUL_CLOSE:
|
||||
subType = NS_EVENT_BITS_XUL_CLOSE;
|
||||
if (ls->mSubType & NS_EVENT_BITS_XUL_CLOSE) {
|
||||
correctSubType = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
case NS_MENU_DESTROY:
|
||||
subType = NS_EVENT_BITS_MENU_DESTROY;
|
||||
if (ls->mSubType & NS_EVENT_BITS_MENU_DESTROY) {
|
||||
|
|
|
@ -184,10 +184,11 @@ protected:
|
|||
//nsIDOMMenuListener
|
||||
#define NS_EVENT_BITS_MENU_NONE 0x00
|
||||
#define NS_EVENT_BITS_MENU_CREATE 0x01
|
||||
#define NS_EVENT_BITS_MENU_DESTROY 0x02
|
||||
#define NS_EVENT_BITS_MENU_ACTION 0x04
|
||||
#define NS_EVENT_BITS_XUL_BROADCAST 0x08
|
||||
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x10
|
||||
#define NS_EVENT_BITS_XUL_CLOSE 0x02
|
||||
#define NS_EVENT_BITS_MENU_DESTROY 0x04
|
||||
#define NS_EVENT_BITS_MENU_ACTION 0x08
|
||||
#define NS_EVENT_BITS_XUL_BROADCAST 0x10
|
||||
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x20
|
||||
|
||||
//nsIDOMDragListener
|
||||
#define NS_EVENT_BITS_DRAG_NONE 0x00
|
||||
|
|
|
@ -117,6 +117,7 @@ LAYOUT_ATOM(onblur, "onblur")
|
|||
LAYOUT_ATOM(onbroadcast, "onbroadcast")
|
||||
LAYOUT_ATOM(onchange, "onchange")
|
||||
LAYOUT_ATOM(onclick, "onclick")
|
||||
LAYOUT_ATOM(onclose, "onclose")
|
||||
LAYOUT_ATOM(oncommand, "oncommand")
|
||||
LAYOUT_ATOM(oncommandupdate, "oncommandupdate")
|
||||
LAYOUT_ATOM(oncreate, "oncreate")
|
||||
|
|
|
@ -206,6 +206,7 @@ nsXULContentUtils::kEventHandlerMap[] = {
|
|||
{ "onerror", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
|
||||
{ "oncreate", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "onclose", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "ondestroy", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "oncommand", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "onbroadcast", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMMENULISTENER_IID)
|
||||
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) = 0;
|
||||
|
|
|
@ -2696,8 +2696,8 @@ GlobalWindowImpl::CheckForEventListener(JSContext *aContext, nsString& aPropName
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (aPropName == "onload" || aPropName == "onunload" || aPropName == "onabort" ||
|
||||
aPropName == "onerror") {
|
||||
else if (aPropName == "onload" || aPropName == "onunload" || aPropName == "onclose" ||
|
||||
aPropName == "onabort" || aPropName == "onerror") {
|
||||
if (NS_OK == GetListenerManager(&mManager)) {
|
||||
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
|
||||
if (NS_OK != mManager->RegisterScriptEventListener(mScriptCX, this, atom, kIDOMLoadListenerIID)) {
|
||||
|
|
|
@ -117,6 +117,7 @@ LAYOUT_ATOM(onblur, "onblur")
|
|||
LAYOUT_ATOM(onbroadcast, "onbroadcast")
|
||||
LAYOUT_ATOM(onchange, "onchange")
|
||||
LAYOUT_ATOM(onclick, "onclick")
|
||||
LAYOUT_ATOM(onclose, "onclose")
|
||||
LAYOUT_ATOM(oncommand, "oncommand")
|
||||
LAYOUT_ATOM(oncommandupdate, "oncommandupdate")
|
||||
LAYOUT_ATOM(oncreate, "oncreate")
|
||||
|
|
|
@ -117,6 +117,7 @@ LAYOUT_ATOM(onblur, "onblur")
|
|||
LAYOUT_ATOM(onbroadcast, "onbroadcast")
|
||||
LAYOUT_ATOM(onchange, "onchange")
|
||||
LAYOUT_ATOM(onclick, "onclick")
|
||||
LAYOUT_ATOM(onclose, "onclose")
|
||||
LAYOUT_ATOM(oncommand, "oncommand")
|
||||
LAYOUT_ATOM(oncommandupdate, "oncommandupdate")
|
||||
LAYOUT_ATOM(oncreate, "oncreate")
|
||||
|
|
|
@ -50,8 +50,8 @@ static char* mEventNames[] = {
|
|||
"mouseout", "mousemove", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "unload", "abort", "error",
|
||||
"submit", "reset", "change", "select", "input", "paint" ,"text",
|
||||
"create", "destroy", "command", "broadcast", "commandupdate", "dragenter", "dragover", "dragexit",
|
||||
"dragdrop", "draggesture"
|
||||
"create", "close", "destroy", "command", "broadcast", "commandupdate",
|
||||
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture"
|
||||
};
|
||||
|
||||
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||
|
@ -855,6 +855,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
|||
return mEventNames[eDOMEvents_focus];
|
||||
case NS_BLUR_CONTENT:
|
||||
return mEventNames[eDOMEvents_blur];
|
||||
case NS_XUL_CLOSE:
|
||||
return mEventNames[eDOMEvents_close];
|
||||
case NS_PAGE_LOAD:
|
||||
case NS_IMAGE_LOAD:
|
||||
return mEventNames[eDOMEvents_load];
|
||||
|
|
|
@ -70,8 +70,9 @@ public:
|
|||
eDOMEvents_select,
|
||||
eDOMEvents_input,
|
||||
eDOMEvents_paint,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_create,
|
||||
eDOMEvents_close,
|
||||
eDOMEvents_destroy,
|
||||
eDOMEvents_command,
|
||||
eDOMEvents_broadcast,
|
||||
|
|
|
@ -388,6 +388,10 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, nsIID& aI
|
|||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_MENU_CREATE;
|
||||
}
|
||||
else if (aType == nsLayoutAtoms::onclose) {
|
||||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_XUL_CLOSE;
|
||||
}
|
||||
else if (aType == nsLayoutAtoms::ondestroy) {
|
||||
aIID = kIDOMMenuListenerIID;
|
||||
*aFlags = NS_EVENT_BITS_MENU_DESTROY;
|
||||
|
@ -1268,6 +1272,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
|
||||
case NS_MENU_CREATE:
|
||||
case NS_XUL_CLOSE:
|
||||
case NS_MENU_DESTROY:
|
||||
case NS_MENU_ACTION:
|
||||
case NS_XUL_BROADCAST:
|
||||
|
@ -1289,6 +1294,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
case NS_MENU_CREATE:
|
||||
ret = mMenuListener->Create(*aDOMEvent);
|
||||
break;
|
||||
case NS_XUL_CLOSE:
|
||||
ret = mMenuListener->Close(*aDOMEvent);
|
||||
break;
|
||||
case NS_MENU_DESTROY:
|
||||
ret = mMenuListener->Destroy(*aDOMEvent);
|
||||
break;
|
||||
|
@ -1316,6 +1324,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
|||
correctSubType = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
case NS_XUL_CLOSE:
|
||||
subType = NS_EVENT_BITS_XUL_CLOSE;
|
||||
if (ls->mSubType & NS_EVENT_BITS_XUL_CLOSE) {
|
||||
correctSubType = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
case NS_MENU_DESTROY:
|
||||
subType = NS_EVENT_BITS_MENU_DESTROY;
|
||||
if (ls->mSubType & NS_EVENT_BITS_MENU_DESTROY) {
|
||||
|
|
|
@ -184,10 +184,11 @@ protected:
|
|||
//nsIDOMMenuListener
|
||||
#define NS_EVENT_BITS_MENU_NONE 0x00
|
||||
#define NS_EVENT_BITS_MENU_CREATE 0x01
|
||||
#define NS_EVENT_BITS_MENU_DESTROY 0x02
|
||||
#define NS_EVENT_BITS_MENU_ACTION 0x04
|
||||
#define NS_EVENT_BITS_XUL_BROADCAST 0x08
|
||||
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x10
|
||||
#define NS_EVENT_BITS_XUL_CLOSE 0x02
|
||||
#define NS_EVENT_BITS_MENU_DESTROY 0x04
|
||||
#define NS_EVENT_BITS_MENU_ACTION 0x08
|
||||
#define NS_EVENT_BITS_XUL_BROADCAST 0x10
|
||||
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x20
|
||||
|
||||
//nsIDOMDragListener
|
||||
#define NS_EVENT_BITS_DRAG_NONE 0x00
|
||||
|
|
|
@ -206,6 +206,7 @@ nsXULContentUtils::kEventHandlerMap[] = {
|
|||
{ "onerror", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
|
||||
{ "oncreate", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "onclose", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "ondestroy", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "oncommand", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "onbroadcast", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
|
|
|
@ -244,18 +244,20 @@ enum nsDragDropEventStatus {
|
|||
|
||||
// Widget is being created
|
||||
#define NS_CREATE (NS_WINDOW_START)
|
||||
// Widget may be destroyed
|
||||
#define NS_XUL_CLOSE (NS_WINDOW_START + 1)
|
||||
// Widget is being destroyed
|
||||
#define NS_DESTROY (NS_WINDOW_START + 1)
|
||||
#define NS_DESTROY (NS_WINDOW_START + 2)
|
||||
// Widget was resized
|
||||
#define NS_SIZE (NS_WINDOW_START + 2)
|
||||
#define NS_SIZE (NS_WINDOW_START + 3)
|
||||
// Widget gained focus
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 3)
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 4)
|
||||
// Widget lost focus
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 4)
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 5)
|
||||
// Widget got activated
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 5)
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 6)
|
||||
// Widget got deactivated
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 6)
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 7)
|
||||
// Widget needs to be repainted
|
||||
#define NS_PAINT (NS_WINDOW_START + 30)
|
||||
// Key is pressed within a window
|
||||
|
|
Загрузка…
Ссылка в новой задаче