From a1d837c341e8c01dba774d459963812de2b423a9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 14 May 2015 13:24:34 +0200 Subject: [PATCH] mshtml: Moved getting event target data pointer to DispatchEx vtbl. --- dlls/mshtml/htmlbody.c | 6 +++--- dlls/mshtml/htmlelem.c | 11 ++++++++++- dlls/mshtml/htmlevent.h | 4 +++- dlls/mshtml/mshtml_private.h | 4 +++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index e91f20eb2bc..e4b7990f3a5 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -824,13 +824,13 @@ static void HTMLBodyElement_unlink(HTMLDOMNode *iface) } } -static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface) +static event_target_t **HTMLBodyElement_get_event_target_ptr(HTMLDOMNode *iface) { HTMLBodyElement *This = impl_from_HTMLDOMNode(iface); return This->textcont.element.node.doc ? &This->textcont.element.node.doc->body_event_target - : &This->textcont.element.node.event_target; + : &This->textcont.element.node.event_target.ptr; } static BOOL HTMLBodyElement_is_text_edit(HTMLDOMNode *iface) @@ -852,7 +852,7 @@ static const NodeImplVtbl HTMLBodyElementImplVtbl = { HTMLElement_clone, HTMLElement_handle_event, HTMLElement_get_attr_col, - HTMLBodyElement_get_event_target, + HTMLBodyElement_get_event_target_ptr, NULL, NULL, NULL, diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 68be24f18e6..77ccc52d978 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -3988,6 +3988,14 @@ static HRESULT HTMLElement_populate_props(DispatchEx *dispex) return S_OK; } +static event_target_t **HTMLElement_get_event_target_ptr(DispatchEx *dispex) +{ + HTMLElement *This = impl_from_DispatchEx(dispex); + return This->node.vtbl->get_event_target_ptr + ? This->node.vtbl->get_event_target_ptr(&This->node) + : &This->node.event_target.ptr; +} + static const tid_t HTMLElement_iface_tids[] = { HTMLELEMENT_TIDS, 0 @@ -3997,7 +4005,8 @@ static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl = { NULL, HTMLElement_get_dispid, HTMLElement_invoke, - HTMLElement_populate_props + HTMLElement_populate_props, + HTMLElement_get_event_target_ptr }; static dispex_static_data_t HTMLElement_dispex = { diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 6d0d9f8b1b9..0c86f8625b8 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -73,7 +73,9 @@ void detach_nsevent(HTMLDocumentNode*,const WCHAR*) DECLSPEC_HIDDEN; static inline event_target_t **get_node_event_target(HTMLDOMNode *node) { - return node->vtbl->get_event_target ? node->vtbl->get_event_target(node) : &node->event_target.ptr; + return node->event_target.dispex.data->vtbl->get_event_target_ptr + ? node->event_target.dispex.data->vtbl->get_event_target_ptr(&node->event_target.dispex) + : &node->event_target.ptr; } static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 92ff5cda574..032ca9ac40e 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -230,6 +230,8 @@ typedef struct { HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*); HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*populate_props)(DispatchEx*); + /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */ + event_target_t **(*get_event_target_ptr)(DispatchEx*); } dispex_static_data_vtbl_t; typedef struct { @@ -642,7 +644,7 @@ typedef struct { HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**); HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*); HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**); - event_target_t **(*get_event_target)(HTMLDOMNode*); + event_target_t **(*get_event_target_ptr)(HTMLDOMNode*); HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*); HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL); HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);