diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index de478f3be42..f434545e8f5 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -1767,7 +1767,7 @@ void dispex_unlink(DispatchEx *This)
}
}
-const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx *dispex)
+const void *dispex_get_vtbl(DispatchEx *dispex)
{
return dispex->info->desc->vtbl;
}
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index c6bc7ac2dd4..fc2d6767471 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -5024,18 +5024,20 @@ static compat_mode_t HTMLDocumentNode_get_compat_mode(DispatchEx *dispex)
return This->document_mode;
}
-static void HTMLDocumentNode_bind_event(DispatchEx *dispex, int eid)
+static void HTMLDocumentNode_bind_event(DispatchEx *dispex, eventid_t eid)
{
HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
ensure_doc_nsevent_handler(This, eid);
}
-static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
- NULL,
- NULL,
- HTMLDocumentNode_invoke,
- HTMLDocumentNode_get_compat_mode,
- NULL,
+static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = {
+ {
+ NULL,
+ NULL,
+ HTMLDocumentNode_invoke,
+ HTMLDocumentNode_get_compat_mode,
+ NULL
+ },
HTMLDocumentNode_bind_event
};
@@ -5076,7 +5078,7 @@ static void HTMLDocumentNode_init_dispex_info(dispex_data_t *info, compat_mode_t
}
static dispex_static_data_t HTMLDocumentNode_dispex = {
- &HTMLDocumentNode_dispex_vtbl,
+ &HTMLDocumentNode_event_target_vtbl.dispex_vtbl,
DispHTMLDocument_tid,
HTMLDocumentNode_iface_tids,
HTMLDocumentNode_init_dispex_info
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 9cf143d67b4..3cd85e64ccb 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -5332,7 +5332,7 @@ static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
return S_OK;
}
-static void HTMLElement_bind_event(DispatchEx *dispex, int eid)
+static void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
{
HTMLElement *This = impl_from_DispatchEx(dispex);
@@ -5343,7 +5343,7 @@ static void HTMLElement_bind_event(DispatchEx *dispex, int eid)
add_nsevent_listener(This->node.doc, This->node.nsnode, loadW);
return;
default:
- dispex_get_vtbl(&This->node.doc->node.event_target.dispex)->bind_event(&This->node.doc->node.event_target.dispex, eid);
+ ensure_doc_nsevent_handler(This->node.doc, eid);
}
}
@@ -5369,17 +5369,19 @@ static const tid_t HTMLElement_iface_tids[] = {
0
};
-static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl = {
- NULL,
- HTMLElement_get_dispid,
- HTMLElement_invoke,
- NULL,
- HTMLElement_populate_props,
+static event_target_vtbl_t HTMLElement_event_target_vtbl = {
+ {
+ NULL,
+ HTMLElement_get_dispid,
+ HTMLElement_invoke,
+ NULL,
+ HTMLElement_populate_props
+ },
HTMLElement_bind_event
};
static dispex_static_data_t HTMLElement_dispex = {
- &HTMLElement_dispex_vtbl,
+ &HTMLElement_event_target_vtbl.dispex_vtbl,
DispHTMLUnknownElement_tid,
HTMLElement_iface_tids,
HTMLElement_init_dispex_info
@@ -5398,7 +5400,7 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
if(dispex_data && !dispex_data->vtbl)
- dispex_data->vtbl = &HTMLElement_dispex_vtbl;
+ dispex_data->vtbl = &HTMLElement_event_target_vtbl.dispex_vtbl;
if(nselem) {
HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLElement_dispex);
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 1c27c13c8c4..1e72220205e 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -843,7 +843,7 @@ HRESULT create_event_obj(IHTMLEventObj **ret)
static handler_vector_t *get_handler_vector(EventTarget *event_target, eventid_t eid, BOOL alloc)
{
- const dispex_static_data_vtbl_t *vtbl;
+ const event_target_vtbl_t *vtbl;
handler_vector_t *handler_vector;
struct wine_rb_entry *entry;
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index eda6013ec74..7da2f5b390d 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -79,6 +79,12 @@ void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR) DECLSPEC_HIDDEN;
void detach_nsevent(HTMLDocumentNode*,const WCHAR*) DECLSPEC_HIDDEN;
+/* We extend dispex vtbl for EventTarget functions to avoid separated vtbl. */
+typedef struct {
+ dispex_static_data_vtbl_t dispex_vtbl;
+ void (*bind_event)(DispatchEx*,eventid_t);
+} event_target_vtbl_t;
+
static inline EventTarget *get_node_event_prop_target(HTMLDOMNode *node, eventid_t eid)
{
return node->vtbl->get_event_prop_target ? node->vtbl->get_event_prop_target(node, eid) : &node->event_target;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 13963da44e8..2999ef0ec7d 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -2995,10 +2995,10 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
return hres;
}
-static void HTMLWindow_bind_event(DispatchEx *dispex, int eid)
+static void HTMLWindow_bind_event(DispatchEx *dispex, eventid_t eid)
{
HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
- dispex_get_vtbl(&This->doc->node.event_target.dispex)->bind_event(&This->doc->node.event_target.dispex, eid);
+ ensure_doc_nsevent_handler(This->doc, eid);
}
static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
@@ -3006,12 +3006,14 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa
dispex_info_add_interface(info, IHTMLWindow5_tid, NULL);
}
-static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl = {
- NULL,
- NULL,
- HTMLWindow_invoke,
- NULL,
- NULL,
+static const event_target_vtbl_t HTMLWindow_event_target_vtbl = {
+ {
+ NULL,
+ NULL,
+ HTMLWindow_invoke,
+ NULL,
+ NULL
+ },
HTMLWindow_bind_event
};
@@ -3024,7 +3026,7 @@ static const tid_t HTMLWindow_iface_tids[] = {
};
static dispex_static_data_t HTMLWindow_dispex = {
- &HTMLWindow_dispex_vtbl,
+ &HTMLWindow_event_target_vtbl.dispex_vtbl,
DispHTMLWindow2_tid,
HTMLWindow_iface_tids,
HTMLWindow_init_dispex_info
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index ae2f6cb1a93..93d3ff75a65 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -270,8 +270,6 @@ typedef struct {
HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
compat_mode_t (*get_compat_mode)(DispatchEx*);
HRESULT (*populate_props)(DispatchEx*);
- /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
- void (*bind_event)(DispatchEx*,int);
} dispex_static_data_vtbl_t;
typedef struct {
@@ -330,7 +328,7 @@ void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_H
void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
void release_typelib(void) DECLSPEC_HIDDEN;
HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
-const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
+const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
void dispex_info_add_interface(dispex_data_t*,tid_t,const DISPID*) DECLSPEC_HIDDEN;
compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c
index f868c3a242d..0b02a2c1c90 100644
--- a/dlls/mshtml/xmlhttprequest.c
+++ b/dlls/mshtml/xmlhttprequest.c
@@ -733,7 +733,7 @@ static inline HTMLXMLHttpRequest *impl_from_DispatchEx(DispatchEx *iface)
return CONTAINING_RECORD(iface, HTMLXMLHttpRequest, event_target.dispex);
}
-static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, int eid)
+static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, eventid_t eid)
{
HTMLXMLHttpRequest *This = impl_from_DispatchEx(dispex);
nsIDOMEventTarget *nstarget;
@@ -768,12 +768,8 @@ static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, int eid)
ERR("AddEventListener failed: %08x\n", nsres);
}
-static dispex_static_data_vtbl_t HTMLXMLHttpRequest_dispex_vtbl = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+static event_target_vtbl_t HTMLXMLHttpRequest_event_target_vtbl = {
+ {NULL},
HTMLXMLHttpRequest_bind_event
};
@@ -782,7 +778,7 @@ static const tid_t HTMLXMLHttpRequest_iface_tids[] = {
0
};
static dispex_static_data_t HTMLXMLHttpRequest_dispex = {
- &HTMLXMLHttpRequest_dispex_vtbl,
+ &HTMLXMLHttpRequest_event_target_vtbl.dispex_vtbl,
DispHTMLXMLHttpRequest_tid,
HTMLXMLHttpRequest_iface_tids
};