From 2da5890ea1ebaccce69e9b9fc8f2ac1d7c373584 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 8 Nov 2010 12:48:44 +0100 Subject: [PATCH] mshtml: Added IDispatchEx support to HTMLStyleSheetsCollection object. --- dlls/mshtml/dispex.c | 2 ++ dlls/mshtml/htmlstylesheet.c | 31 +++++++++++++++++++++---------- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/dom.c | 2 ++ include/mshtml.idl | 24 ++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index c63181f7979..b774917b051 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -109,6 +109,7 @@ static REFIID tid_ids[] = { &DIID_DispHTMLScriptElement, &DIID_DispHTMLSelectElement, &DIID_DispHTMLStyle, + &DIID_DispHTMLStyleSheetsCollection, &DIID_DispHTMLTable, &DIID_DispHTMLTableRow, &DIID_DispHTMLTextAreaElement, @@ -160,6 +161,7 @@ static REFIID tid_ids[] = { &IID_IHTMLStyle2, &IID_IHTMLStyle3, &IID_IHTMLStyle4, + &IID_IHTMLStyleSheetsCollection, &IID_IHTMLTable, &IID_IHTMLTableRow, &IID_IHTMLTextAreaElement, diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index e39bfb761ce..b54129a2fcf 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -41,6 +41,7 @@ struct HTMLStyleSheet { }; struct HTMLStyleSheetsCollection { + DispatchEx dispex; const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl; LONG ref; @@ -222,6 +223,8 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsC }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) { TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv); *ppv = HTMLSTYLESHEETSCOL(This); + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; } if(*ppv) { @@ -263,25 +266,21 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheet UINT *pctinfo) { HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface); - FIXME("(%p)->(%p)\n", This, pctinfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo); } static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface); - FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface); - FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - return E_NOTIMPL; + return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId); } static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface, @@ -289,9 +288,8 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollectio VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(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(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface, @@ -370,6 +368,17 @@ static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = { HTMLStyleSheetsCollection_item }; +static const tid_t HTMLStyleSheetsCollection_iface_tids[] = { + IHTMLStyleSheetsCollection_tid, + 0 +}; +static dispex_static_data_t HTMLStyleSheetsCollection_dispex = { + NULL, + DispHTMLStyleSheetsCollection_tid, + NULL, + HTMLStyleSheetsCollection_iface_tids +}; + IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist) { HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection)); @@ -381,6 +390,8 @@ IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetLis nsIDOMStyleSheetList_AddRef(nslist); ret->nslist = nslist; + init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLESHEETSCOL(ret), &HTMLStyleSheetsCollection_dispex); + return HTMLSTYLESHEETSCOL(ret); } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index be11bd4b881..c222d3ebe6a 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -91,6 +91,7 @@ typedef enum { DispHTMLScriptElement_tid, DispHTMLSelectElement_tid, DispHTMLStyle_tid, + DispHTMLStyleSheetsCollection_tid, DispHTMLTable_tid, DispHTMLTableRow_tid, DispHTMLTextAreaElement_tid, @@ -142,6 +143,7 @@ typedef enum { IHTMLStyle2_tid, IHTMLStyle3_tid, IHTMLStyle4_tid, + IHTMLStyleSheetsCollection_tid, IHTMLTable_tid, IHTMLTableRow_tid, IHTMLTextAreaElement_tid, diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 2134b311661..c1110ba5e43 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5850,6 +5850,8 @@ static void test_stylesheets(IHTMLDocument2 *doc) ok(hres == S_OK, "get_styleSheets failed: %08x\n", hres); ok(col != NULL, "col == NULL\n"); + test_disp2((IUnknown*)col, &DIID_DispHTMLStyleSheetsCollection, &IID_IHTMLStyleSheetsCollection, "[object]"); + hres = IHTMLStyleSheetsCollection_get_length(col, &len); ok(hres == S_OK, "get_length failed: %08x\n", hres); ok(len == 1, "len=%d\n", len); diff --git a/include/mshtml.idl b/include/mshtml.idl index 55740a722f1..a66aa741fe2 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -6174,6 +6174,30 @@ interface IHTMLStyleSheetsCollection : IDispatch [retval, out] VARIANT *pvarResult); } +/***************************************************************************** + * DispHTMLStyleSheetsCollection dispinterface + */ +[ + hidden, + uuid(3050f547-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLStyleSheetsCollection +{ +properties: +methods: + [propget, id(DISPID_IHTMLSTYLESHEETSCOLLECTION_LENGTH)] + long length(); + + [propget, id(DISPID_IHTMLSTYLESHEETSCOLLECTION__NEWENUM), hidden, restricted] + IUnknown *_newEnum(); + + [id(DISPID_IHTMLSTYLESHEETSCOLLECTION_ITEM)] + VARIANT item([in] VARIANT *pvarIndex); + + [propget, id(DISPID_IHTMLDOMCONSTRUCTOR_CONSTRUCTOR), hidden] + IDispatch *constructor(); +} + /***************************************************************************** * IHTMLTxtRange interface */