Commit af3d19fa authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: DispatchEx's QueryInterface implementation clean up.

parent 19be7d62
......@@ -621,6 +621,23 @@ static IDispatchExVtbl DispatchExVtbl = {
DispatchEx_GetNameSpaceParent
};
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
{
if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = DISPATCHEX(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(This);
}else {
return FALSE;
}
if(*ppv)
IUnknown_AddRef((IUnknown*)*ppv);
return TRUE;
}
void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
{
dispex->lpIDispatchExVtbl = &DispatchExVtbl;
......
......@@ -1542,15 +1542,11 @@ static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollectio
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IHTMLElementCollection, riid)) {
TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This);
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
if(*ppv) {
......
......@@ -58,15 +58,11 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_QueryInterface(IHTMLDOMChildrenC
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLCHILDCOL(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLCHILDCOL(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IHTMLDOMChildrenCollection, riid)) {
TRACE("(%p)->(IID_IHTMLDOMChildrenCollection %p)\n", This, ppv);
*ppv = HTMLCHILDCOL(This);
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
if(*ppv) {
......@@ -819,6 +815,8 @@ HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv)
}else if(IsEqualGUID(&IID_IHTMLDOMNode2, riid)) {
TRACE("(%p)->(IID_IHTMLDOMNode2 %p)\n", This, ppv);
*ppv = HTMLDOMNODE2(This);
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
if(*ppv) {
......
......@@ -235,15 +235,11 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLSTYLE(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLSTYLE(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
*ppv = HTMLSTYLE(This);
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
if(*ppv) {
......
......@@ -134,6 +134,7 @@ typedef struct {
} DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
typedef struct {
DispatchEx dispex;
......
......@@ -51,15 +51,11 @@ static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID rii
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = OMNAVIGATOR(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
TRACE("(%p)->(IID_IOmNavigator %p)\n", This, ppv);
*ppv = OMNAVIGATOR(This);
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
if(*ppv) {
......
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