Fix some confusion related to popup and popupblocked events and a little other confusion. b=291725 r=jst sr=bzbarsky a=bsmedberg

This commit is contained in:
dbaron%dbaron.org 2005-08-02 20:18:05 +00:00
Родитель 7bf0c43eb4
Коммит 5e2f34ea7b
4 изменённых файлов: 17 добавлений и 5 удалений

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

@ -67,7 +67,7 @@ static const char* const sEventNames[] = {
"DOMSubtreeModified", "DOMNodeInserted", "DOMNodeRemoved",
"DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument",
"DOMAttrModified", "DOMCharacterDataModified",
"popupBlocked", "DOMActivate", "DOMFocusIn", "DOMFocusOut",
"DOMActivate", "DOMFocusIn", "DOMFocusOut",
"pageshow", "pagehide"
};
@ -930,6 +930,11 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
default:
break;
}
// XXXldb We can hit this case in many ways, partly thanks to
// nsDOMEvent::SetEventType being incomplete, and partly due to some
// event types not having message constants at all (e.g., popup
// blocked events). Shouldn't we use the event's userType when we
// can?
return nsnull;
}

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

@ -119,7 +119,6 @@ public:
eDOMEvents_nodeinsertedintodocument,
eDOMEvents_attrmodified,
eDOMEvents_characterdatamodified,
eDOMEvents_popupBlocked,
eDOMEvents_DOMActivate,
eDOMEvents_DOMFocusIn,
eDOMEvents_DOMFocusOut,

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

@ -113,6 +113,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
nsPoint nsDOMUIEvent::GetScreenPoint() {
if (!mEvent ||
// XXXldb Why not NS_MOUSE_SCROLL_EVENT?
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_POPUP_EVENT &&
!NS_IS_DRAG_EVENT(mEvent))) {
@ -131,6 +132,7 @@ nsPoint nsDOMUIEvent::GetScreenPoint() {
nsPoint nsDOMUIEvent::GetClientPoint() {
if (!mEvent ||
// XXXldb Why not NS_MOUSE_SCROLL_EVENT?
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_POPUP_EVENT &&
!NS_IS_DRAG_EVENT(mEvent)) ||

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

@ -1023,6 +1023,10 @@ nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType,
*aArrayType = eEventArrayType_Composition;
*aFlags = NS_EVENT_BITS_COMPOSITION_END;
}
else if (aType == nsLayoutAtoms::ontext) {
*aArrayType = eEventArrayType_Text;
*aFlags = NS_EVENT_BITS_TEXT_TEXT;
}
else if (aType == nsLayoutAtoms::onpageshow) {
*aArrayType = eEventArrayType_PageTransition;
*aFlags = NS_EVENT_BITS_PAGETRANSITION_SHOW;
@ -1731,9 +1735,10 @@ nsEventListenerManager::CreateEvent(nsPresContext* aPresContext,
NS_STATIC_CAST(nsKeyEvent*,aEvent));
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_POPUP_EVENT:
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsInputEvent*,aEvent));
case NS_POPUP_EVENT:
case NS_POPUPBLOCKED_EVENT:
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsPopupBlockedEvent*,
aEvent));
@ -1759,9 +1764,10 @@ nsEventListenerManager::CreateEvent(nsPresContext* aPresContext,
if (aEventType.LowerCaseEqualsLiteral("mouseevent") ||
aEventType.LowerCaseEqualsLiteral("mouseevents") ||
aEventType.LowerCaseEqualsLiteral("mousescrollevents"))
aEventType.LowerCaseEqualsLiteral("mousescrollevents") ||
aEventType.LowerCaseEqualsLiteral("popupevents"))
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsMouseEvent*,aEvent));
NS_STATIC_CAST(nsInputEvent*,aEvent));
if (aEventType.LowerCaseEqualsLiteral("keyboardevent") ||
aEventType.LowerCaseEqualsLiteral("keyevents"))
return NS_NewDOMKeyboardEvent(aDOMEvent, aPresContext,