Commit 908cfec3 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Use query_interface in the dispex vtbl for DOM and Text Ranges.

parent c4cf5bf7
......@@ -814,24 +814,12 @@ static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID r
{
HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IHTMLTxtRange_iface;
}else if(IsEqualGUID(&IID_IHTMLTxtRange, riid)) {
*ppv = &This->IHTMLTxtRange_iface;
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
*ppv = &This->IOleCommandTarget_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
if(dispex_query_interface(&This->dispex, riid, ppv))
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
*ppv = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI HTMLTxtRange_AddRef(IHTMLTxtRange *iface)
......@@ -1710,6 +1698,18 @@ static inline HTMLTxtRange *HTMLTxtRange_from_DispatchEx(DispatchEx *iface)
return CONTAINING_RECORD(iface, HTMLTxtRange, dispex);
}
static void *HTMLTxtRange_query_interface(DispatchEx *dispex, REFIID riid)
{
HTMLTxtRange *This = HTMLTxtRange_from_DispatchEx(dispex);
if(IsEqualGUID(&IID_IHTMLTxtRange, riid))
return &This->IHTMLTxtRange_iface;
if(IsEqualGUID(&IID_IOleCommandTarget, riid))
return &This->IOleCommandTarget_iface;
return NULL;
}
static void HTMLTxtRange_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
{
HTMLTxtRange *This = HTMLTxtRange_from_DispatchEx(dispex);
......@@ -1734,6 +1734,7 @@ static void HTMLTxtRange_destructor(DispatchEx *dispex)
}
static const dispex_static_data_vtbl_t HTMLTxtRange_dispex_vtbl = {
.query_interface = HTMLTxtRange_query_interface,
.destructor = HTMLTxtRange_destructor,
.traverse = HTMLTxtRange_traverse,
.unlink = HTMLTxtRange_unlink
......@@ -1784,22 +1785,12 @@ static HRESULT WINAPI HTMLDOMRange_QueryInterface(IHTMLDOMRange *iface, REFIID r
{
HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IHTMLDOMRange_iface;
}else if(IsEqualGUID(&IID_IHTMLDOMRange, riid)) {
*ppv = &This->IHTMLDOMRange_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
if(dispex_query_interface(&This->dispex, riid, ppv))
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
*ppv = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI HTMLDOMRange_AddRef(IHTMLDOMRange *iface)
......@@ -2081,6 +2072,18 @@ static inline HTMLDOMRange *HTMLDOMRange_from_DispatchEx(DispatchEx *iface)
return CONTAINING_RECORD(iface, HTMLDOMRange, dispex);
}
static void *HTMLDOMRange_query_interface(DispatchEx *dispex, REFIID riid)
{
HTMLDOMRange *This = HTMLDOMRange_from_DispatchEx(dispex);
if(IsEqualGUID(&IID_IUnknown, riid))
return &This->IHTMLDOMRange_iface;
if(IsEqualGUID(&IID_IHTMLDOMRange, riid))
return &This->IHTMLDOMRange_iface;
return NULL;
}
static void HTMLDOMRange_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
{
HTMLDOMRange *This = HTMLDOMRange_from_DispatchEx(dispex);
......@@ -2101,6 +2104,7 @@ static void HTMLDOMRange_destructor(DispatchEx *dispex)
}
static const dispex_static_data_vtbl_t HTMLDOMRange_dispex_vtbl = {
.query_interface = HTMLDOMRange_query_interface,
.destructor = HTMLDOMRange_destructor,
.traverse = HTMLDOMRange_traverse,
.unlink = HTMLDOMRange_unlink
......
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