Commit 1cfbcab7 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Move the MessageEvent construction to a helper.

parent f9bda73b
...@@ -2790,6 +2790,15 @@ static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_ ...@@ -2790,6 +2790,15 @@ static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_
return &progress_event->event; return &progress_event->event;
} }
static DOMEvent *message_event_ctor(nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode)
{
DOMMessageEvent *message_event = event_ctor(sizeof(DOMMessageEvent), &DOMMessageEvent_dispex,
DOMMessageEvent_query_interface, DOMMessageEvent_destroy, nsevent, event_id, compat_mode);
if(!message_event) return NULL;
message_event->IDOMMessageEvent_iface.lpVtbl = &DOMMessageEventVtbl;
return &message_event->event;
}
static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, eventid_t event_id) static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, eventid_t event_id)
{ {
static const struct { static const struct {
...@@ -2805,14 +2814,8 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev ...@@ -2805,14 +2814,8 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev
DOMEvent *event; DOMEvent *event;
unsigned i; unsigned i;
if(event_id == EVENTID_MESSAGE) { if(event_id == EVENTID_MESSAGE)
DOMMessageEvent *message_event = event_ctor(sizeof(DOMMessageEvent), &DOMMessageEvent_dispex, return message_event_ctor(nsevent, event_id, compat_mode);
DOMMessageEvent_query_interface, DOMMessageEvent_destroy, nsevent, event_id, compat_mode);
if(!message_event)
return NULL;
message_event->IDOMMessageEvent_iface.lpVtbl = &DOMMessageEventVtbl;
return &message_event->event;
}
for(i = 0; i < ARRAY_SIZE(types_table); i++) { for(i = 0; i < ARRAY_SIZE(types_table); i++) {
void *iface; void *iface;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment