From 3172d351884de55175336e426ba798ca251aca98 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 19 Aug 2013 12:12:11 +0200 Subject: [PATCH] mshtml: Added IDispatchEx support to HTMLStyleSheet object. --- dlls/mshtml/htmlstylesheet.c | 34 +++++++++++++++++++++++++--------- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/dom.c | 2 ++ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index e0c74bcf8b6..4b4308238a4 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); struct HTMLStyleSheet { + DispatchEx dispex; IHTMLStyleSheet IHTMLStyleSheet_iface; LONG ref; @@ -412,6 +413,8 @@ static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFI }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) { TRACE("(%p)->(IID_IHTMLStyleSheet %p)\n", This, ppv); *ppv = &This->IHTMLStyleSheet_iface; + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; } if(*ppv) { @@ -449,16 +452,16 @@ static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface) static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - FIXME("(%p)->(%p)\n", This, pctinfo); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, pctinfo); + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid, @@ -466,9 +469,8 @@ static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFII LCID lcid, DISPID *rgDispId) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - return E_NOTIMPL; + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember, @@ -476,9 +478,10 @@ static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispI VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return E_NOTIMPL; + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, + pVarResult, pExcepInfo, puArgErr); } static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v) @@ -676,6 +679,17 @@ static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = { HTMLStyleSheet_get_rules }; +static const tid_t HTMLStyleSheet_iface_tids[] = { + IHTMLStyleSheet_tid, + 0 +}; +static dispex_static_data_t HTMLStyleSheet_dispex = { + NULL, + DispHTMLStyleSheet_tid, + NULL, + HTMLStyleSheet_iface_tids +}; + IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet) { HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet)); @@ -685,6 +699,8 @@ IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet) ret->ref = 1; ret->nsstylesheet = NULL; + init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheet_iface, &HTMLStyleSheet_dispex); + if(nsstylesheet) { nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet, (void**)&ret->nsstylesheet); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 0bbdb9d0417..8063ac58b3a 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -106,6 +106,7 @@ typedef struct event_target_t event_target_t; XDIID(DispHTMLSelectElement) \ XDIID(DispHTMLStyle) \ XDIID(DispHTMLStyleElement) \ + XDIID(DispHTMLStyleSheet) \ XDIID(DispHTMLStyleSheetsCollection) \ XDIID(DispHTMLTable) \ XDIID(DispHTMLTableCell) \ @@ -178,6 +179,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLStyle5) \ XIID(IHTMLStyle6) \ XIID(IHTMLStyleElement) \ + XIID(IHTMLStyleSheet) \ XIID(IHTMLStyleSheetsCollection) \ XIID(IHTMLTable) \ XIID(IHTMLTable2) \ diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8d3b9516259..7abd19b6f65 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5839,6 +5839,8 @@ static void test_stylesheet(IDispatch *disp) IHTMLStyleSheet *stylesheet; HRESULT hres; + test_disp2((IUnknown*)disp, &DIID_DispHTMLStyleSheet, &IID_IHTMLStyleSheet, "[object]"); + hres = IDispatch_QueryInterface(disp, &IID_IHTMLStyleSheet, (void**)&stylesheet); ok(hres == S_OK, "Could not get IHTMLStyleSheet: %08x\n", hres);