зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1503078. Simplify the Node event handler macros. r=smaug
The old setup made more sense when these were in fact NS_IMETHODs.
This commit is contained in:
Родитель
326c6c435c
Коммит
0b6d8f10c9
|
@ -2716,25 +2716,6 @@ nsINode::AddSizeOfIncludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
|
|||
AddSizeOfExcludingThis(aSizes, aNodeSize);
|
||||
}
|
||||
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
EventHandlerNonNull* nsINode::GetOn##name_() { \
|
||||
EventListenerManager *elm = GetExistingListenerManager(); \
|
||||
return elm ? elm->GetEventHandler(nsGkAtoms::on##name_) : nullptr; \
|
||||
} \
|
||||
void nsINode::SetOn##name_(EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
EventListenerManager *elm = GetOrCreateListenerManager(); \
|
||||
if (elm) { \
|
||||
elm->SetEventHandler(nsGkAtoms::on##name_, handler); \
|
||||
} \
|
||||
}
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
||||
bool
|
||||
nsINode::Contains(const nsINode* aOther) const
|
||||
{
|
||||
|
|
|
@ -1998,17 +1998,20 @@ protected:
|
|||
mozilla::ErrorResult&);
|
||||
|
||||
public:
|
||||
/* Event stuff that documents and elements share. This needs to be
|
||||
NS_IMETHOD because some subclasses implement DOM methods with
|
||||
this exact name and signature and then the calling convention
|
||||
needs to match.
|
||||
/* Event stuff that documents and elements share.
|
||||
|
||||
Note that we include DOCUMENT_ONLY_EVENT events here so that we
|
||||
can forward all the document stuff to this implementation.
|
||||
*/
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
mozilla::dom::EventHandlerNonNull* GetOn##name_(); \
|
||||
void SetOn##name_(mozilla::dom::EventHandlerNonNull* listener);
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
mozilla::dom::EventHandlerNonNull* GetOn##name_() \
|
||||
{ \
|
||||
return GetEventHandler(nsGkAtoms::on##name_); \
|
||||
} \
|
||||
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler) \
|
||||
{ \
|
||||
SetEventHandler(nsGkAtoms::on##name_, handler); \
|
||||
}
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "mozilla/EventNameList.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче