diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index a1669c1b797..2abd77f2564 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -50,6 +50,7 @@ struct HTMLStyleSheetsCollection { }; struct HTMLStyleSheetRulesCollection { + DispatchEx dispex; IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface; LONG ref; @@ -73,15 +74,16 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleShe }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection, riid)) { TRACE("(%p)->(IID_IHTMLStyleSheetRulesCollection %p)\n", This, ppv); *ppv = &This->IHTMLStyleSheetRulesCollection_iface; + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; + }else { + *ppv = NULL; + FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + return E_NOINTERFACE; } - if(*ppv) { - IUnknown_AddRef((IUnknown*)*ppv); - return S_OK; - } - - FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); - return E_NOINTERFACE; + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; } static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface) @@ -102,6 +104,7 @@ static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCo TRACE("(%p) ref=%d\n", This, ref); if(!ref) { + release_dispex(&This->dispex); if(This->nslist) nsIDOMCSSRuleList_Release(This->nslist); heap_free(This); @@ -114,25 +117,22 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount( IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - FIXME("(%p)->(%p)\n", This, pctinfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - return E_NOTIMPL; + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); } static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection *iface, @@ -140,9 +140,8 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesC VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - FIXME("(%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 HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface, @@ -185,6 +184,17 @@ static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtb HTMLStyleSheetRulesCollection_item }; +static const tid_t HTMLStyleSheetRulesCollection_iface_tids[] = { + IHTMLStyleSheetRulesCollection_tid, + 0 +}; +static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex = { + NULL, + DispHTMLStyleSheetRulesCollection_tid, + NULL, + HTMLStyleSheetRulesCollection_iface_tids +}; + static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist) { HTMLStyleSheetRulesCollection *ret; @@ -194,6 +204,8 @@ static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsID ret->ref = 1; ret->nslist = nslist; + init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetRulesCollection_iface, &HTMLStyleSheetRulesCollection_dispex); + if(nslist) nsIDOMCSSRuleList_AddRef(nslist); @@ -460,7 +472,6 @@ static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iT LCID lcid, ITypeInfo **ppTInfo) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } @@ -469,7 +480,6 @@ static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFII LCID lcid, DISPID *rgDispId) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - 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); } @@ -478,8 +488,6 @@ static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispI VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), - lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2b59c8ac359..ccfec4a0682 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -107,6 +107,7 @@ typedef struct event_target_t event_target_t; XDIID(DispHTMLStyle) \ XDIID(DispHTMLStyleElement) \ XDIID(DispHTMLStyleSheet) \ + XDIID(DispHTMLStyleSheetRulesCollection) \ XDIID(DispHTMLStyleSheetsCollection) \ XDIID(DispHTMLTable) \ XDIID(DispHTMLTableCell) \ @@ -180,6 +181,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLStyle6) \ XIID(IHTMLStyleElement) \ XIID(IHTMLStyleSheet) \ + XIID(IHTMLStyleSheetRulesCollection) \ XIID(IHTMLStyleSheetsCollection) \ XIID(IHTMLTable) \ XIID(IHTMLTable2) \ diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 4378ad3a6f3..08c6c296849 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -6241,6 +6241,8 @@ static void test_stylesheet(IDispatch *disp) hres = IHTMLStyleSheet_get_rules(stylesheet, &col); ok(hres == S_OK, "get_rules failed: %08x\n", hres); ok(col != NULL, "col == NULL\n"); + + test_disp2((IUnknown*)col, &DIID_DispHTMLStyleSheetRulesCollection, &IID_IHTMLStyleSheetRulesCollection, "[object]"); IHTMLStyleSheetRulesCollection_Release(col); href = (void*)0xdeadbeef;