From 632d897c1035d0ec98b2aaaf45f19f9cd26f1515 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 21 Sep 2017 23:25:36 +0200 Subject: [PATCH] mshtml: Introduce EventTarget_QI. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlevent.c | 10 ++++++++++ dlls/mshtml/htmlnode.c | 6 +----- dlls/mshtml/htmlwindow.c | 4 +--- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/xmlhttprequest.c | 6 +----- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index c47b71d0923..00613840425 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1638,6 +1638,16 @@ HRESULT doc_init_events(HTMLDocumentNode *doc) return S_OK; } +HRESULT EventTarget_QI(EventTarget *event_target, REFIID riid, void **ppv) +{ + if(dispex_query_interface(&event_target->dispex, riid, ppv)) + return *ppv ? S_OK : E_NOINTERFACE; + + WARN("(%p)->(%s %p)\n", event_target, debugstr_mshtml_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; +} + static int event_id_cmp(const void *key, const struct wine_rb_entry *entry) { return (INT_PTR)key - WINE_RB_ENTRY_VALUE(entry, handler_vector_t, entry)->event_id; diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 730e2a8962c..8f03b4aebca 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1399,12 +1399,8 @@ HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv) }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) { *ppv = &This->IHTMLDOMNode_iface; return S_OK; - }else if(dispex_query_interface(&This->event_target.dispex, riid, ppv)) { - return *ppv ? S_OK : E_NOINTERFACE; }else { - *ppv = NULL; - WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); - return E_NOINTERFACE; + return EventTarget_QI(&This->event_target, riid, ppv); } IUnknown_AddRef((IUnknown*)*ppv); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index f61aa91cc31..6dd66f2e32a 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -198,9 +198,7 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii assert(!*ppv); return E_NOINTERFACE; }else { - *ppv = NULL; - WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); - return E_NOINTERFACE; + return EventTarget_QI(&This->inner_window->event_target, riid, ppv); } IUnknown_AddRef((IUnknown*)*ppv); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5d4631781b6..f509b438378 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1041,6 +1041,7 @@ void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLEleme void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN; void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN; +HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN; void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index e257bbc954c..7e2da4bb6aa 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -223,12 +223,8 @@ static HRESULT WINAPI HTMLXMLHttpRequest_QueryInterface(IHTMLXMLHttpRequest *ifa *ppv = &This->IProvideClassInfo2_iface; }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) { *ppv = &This->IProvideClassInfo2_iface; - }else if(dispex_query_interface(&This->event_target.dispex, riid, ppv)) { - return *ppv ? S_OK : E_NOINTERFACE; }else { - *ppv = NULL; - WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); - return E_NOINTERFACE; + return EventTarget_QI(&This->event_target, riid, ppv); } IUnknown_AddRef((IUnknown*)*ppv);