2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 const IHTMLStyleSheetVtbl *lpHTMLStyleSheetVtbl;
40 nsIDOMCSSStyleSheet *nsstylesheet;
44 const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl;
48 nsIDOMStyleSheetList *nslist;
49 } HTMLStyleSheetsCollection;
52 const IHTMLStyleSheetRulesCollectionVtbl *lpHTMLStyleSheetRulesCollectionVtbl;
56 nsIDOMCSSRuleList *nslist;
57 } HTMLStyleSheetRulesCollection;
59 #define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
60 #define HTMLSTYLESHEETSCOL(x) ((IHTMLStyleSheetsCollection*) &(x)->lpHTMLStyleSheetsCollectionVtbl);
61 #define HTMLSTYLERULESCOL(x) ((IHTMLStyleSheetRulesCollection*) &(x)->lpHTMLStyleSheetRulesCollectionVtbl)
63 #define HTMLSTYLERULESCOL_THIS(iface) \
64 DEFINE_THIS(HTMLStyleSheetRulesCollection, HTMLStyleSheetRulesCollection, iface)
66 static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface,
67 REFIID riid, void **ppv)
69 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
71 if(IsEqualGUID(&IID_IUnknown, riid)) {
72 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
73 *ppv = HTMLSTYLERULESCOL(This);
74 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection, riid)) {
75 TRACE("(%p)->(IID_IHTMLStyleSheetRulesCollection %p)\n", This, ppv);
76 *ppv = HTMLSTYLERULESCOL(This);
80 IUnknown_AddRef((IUnknown*)*ppv);
84 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
88 static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
90 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
91 LONG ref = InterlockedIncrement(&This->ref);
93 TRACE("(%p) ref=%d\n", This, ref);
98 static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
100 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
101 LONG ref = InterlockedDecrement(&This->ref);
103 TRACE("(%p) ref=%d\n", This, ref);
107 nsIDOMCSSRuleList_Release(This->nslist);
114 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(
115 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
117 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
118 FIXME("(%p)->(%p)\n", This, pctinfo);
122 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface,
123 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
125 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
126 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
130 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface,
131 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
133 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
134 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
139 static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection *iface,
140 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
141 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
143 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
144 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
145 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
149 static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
152 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
155 TRACE("(%p)->(%p)\n", This, p);
160 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
162 ERR("GetLength failed: %08x\n", nsres);
169 static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
170 long index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
172 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
173 FIXME("(%p)->(%ld %p)\n", This, index, ppHTMLStyleSheetRule);
177 #undef HTMLSTYLERULECOL_THIS
179 static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl = {
180 HTMLStyleSheetRulesCollection_QueryInterface,
181 HTMLStyleSheetRulesCollection_AddRef,
182 HTMLStyleSheetRulesCollection_Release,
183 HTMLStyleSheetRulesCollection_GetTypeInfoCount,
184 HTMLStyleSheetRulesCollection_GetTypeInfo,
185 HTMLStyleSheetRulesCollection_GetIDsOfNames,
186 HTMLStyleSheetRulesCollection_Invoke,
187 HTMLStyleSheetRulesCollection_get_length,
188 HTMLStyleSheetRulesCollection_item
191 static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
193 HTMLStyleSheetRulesCollection *ret;
195 ret = heap_alloc(sizeof(*ret));
196 ret->lpHTMLStyleSheetRulesCollectionVtbl = &HTMLStyleSheetRulesCollectionVtbl;
198 ret->nslist = nslist;
201 nsIDOMCSSRuleList_AddRef(nslist);
203 return HTMLSTYLERULESCOL(ret);
206 #define HTMLSTYLESHEETSCOL_THIS(iface) \
207 DEFINE_THIS(HTMLStyleSheetsCollection, HTMLStyleSheetsCollection, iface)
209 static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
210 REFIID riid, void **ppv)
212 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
216 if(IsEqualGUID(&IID_IUnknown, riid)) {
217 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
218 *ppv = HTMLSTYLESHEETSCOL(This);
219 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
220 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
221 *ppv = HTMLSTYLESHEETSCOL(This);
222 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
223 TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv);
224 *ppv = HTMLSTYLESHEETSCOL(This);
228 IUnknown_AddRef((IUnknown*)*ppv);
232 WARN("unsupported %s\n", debugstr_guid(riid));
233 return E_NOINTERFACE;
236 static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
238 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
239 LONG ref = InterlockedIncrement(&This->ref);
241 TRACE("(%p) ref=%d\n", This, ref);
246 static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
248 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
249 LONG ref = InterlockedDecrement(&This->ref);
251 TRACE("(%p) ref=%d\n", This, ref);
255 nsIDOMStyleSheetList_Release(This->nslist);
262 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
265 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
266 FIXME("(%p)->(%p)\n", This, pctinfo);
270 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
271 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
273 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
274 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
278 static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
279 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
281 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
282 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
287 static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
288 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
289 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
291 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
292 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
293 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
297 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
300 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
303 TRACE("(%p)->(%p)\n", This, p);
306 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
312 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
315 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
316 FIXME("(%p)->(%p)\n", This, p);
320 static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
321 VARIANT *pvarIndex, VARIANT *pvarResult)
323 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
325 TRACE("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
327 switch(V_VT(pvarIndex)) {
329 nsIDOMStyleSheet *nsstylesheet;
332 TRACE("index=%d\n", V_I4(pvarIndex));
334 nsres = nsIDOMStyleSheetList_Item(This->nslist, V_I4(pvarIndex), &nsstylesheet);
335 if(NS_FAILED(nsres) || !nsstylesheet) {
336 WARN("Item failed: %08x\n", nsres);
337 V_VT(pvarResult) = VT_EMPTY;
341 V_VT(pvarResult) = VT_DISPATCH;
342 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
348 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
352 WARN("Invalid vt=%d\n", V_VT(pvarIndex));
358 #undef HTMLSTYLESHEETSCOL_THIS
360 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
361 HTMLStyleSheetsCollection_QueryInterface,
362 HTMLStyleSheetsCollection_AddRef,
363 HTMLStyleSheetsCollection_Release,
364 HTMLStyleSheetsCollection_GetTypeInfoCount,
365 HTMLStyleSheetsCollection_GetTypeInfo,
366 HTMLStyleSheetsCollection_GetIDsOfNames,
367 HTMLStyleSheetsCollection_Invoke,
368 HTMLStyleSheetsCollection_get_length,
369 HTMLStyleSheetsCollection_get__newEnum,
370 HTMLStyleSheetsCollection_item
373 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
375 HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection));
377 ret->lpHTMLStyleSheetsCollectionVtbl = &HTMLStyleSheetsCollectionVtbl;
381 nsIDOMStyleSheetList_AddRef(nslist);
382 ret->nslist = nslist;
384 return HTMLSTYLESHEETSCOL(ret);
387 #define HTMLSTYLESHEET_THIS(iface) DEFINE_THIS(HTMLStyleSheet, HTMLStyleSheet, iface)
389 static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
391 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
395 if(IsEqualGUID(&IID_IUnknown, riid)) {
396 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
397 *ppv = HTMLSTYLESHEET(This);
398 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
399 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
400 *ppv = HTMLSTYLESHEET(This);
401 }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) {
402 TRACE("(%p)->(IID_IHTMLStyleSheet %p)\n", This, ppv);
403 *ppv = HTMLSTYLESHEET(This);
407 IUnknown_AddRef((IUnknown*)*ppv);
411 WARN("unsupported %s\n", debugstr_guid(riid));
412 return E_NOINTERFACE;
415 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
417 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
418 LONG ref = InterlockedIncrement(&This->ref);
420 TRACE("(%p) ref=%d\n", This, ref);
425 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
427 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
428 LONG ref = InterlockedDecrement(&This->ref);
430 TRACE("(%p) ref=%d\n", This, ref);
438 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
440 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
441 FIXME("(%p)->(%p)\n", This, pctinfo);
445 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
446 LCID lcid, ITypeInfo **ppTInfo)
448 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
449 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
453 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
454 LPOLESTR *rgszNames, UINT cNames,
455 LCID lcid, DISPID *rgDispId)
457 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
458 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
463 static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
464 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
465 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
467 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
468 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
469 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
473 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
475 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
476 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
480 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
482 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
483 FIXME("(%p)->(%p)\n", This, p);
487 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
490 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
491 FIXME("(%p)->(%p)\n", This, p);
495 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
497 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
502 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
504 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
505 FIXME("(%p)->(%x)\n", This, v);
509 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
511 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
512 FIXME("(%p)->(%p)\n", This, p);
516 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
518 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
519 FIXME("(%p)->(%p)\n", This, p);
523 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
524 IHTMLStyleSheetsCollection **p)
526 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
527 FIXME("(%p)->(%p)\n", This, p);
531 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
533 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
534 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
538 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
540 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
541 FIXME("(%p)->(%p)\n", This, p);
545 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
547 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
548 FIXME("(%p)->(%p)\n", This, p);
552 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
554 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
555 FIXME("(%p)->(%p)\n", This, p);
559 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
560 long lIndex, long *plIndex)
562 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
563 FIXME("(%p)->(%s %ld %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
567 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
568 BSTR bstrStyle, long lIndex, long *plIndex)
570 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
571 FIXME("(%p)->(%s %s %ld %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
576 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, long lIndex)
578 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
579 FIXME("(%p)->(%ld)\n", This, lIndex);
583 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, long lIndex)
585 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
586 FIXME("(%p)->(%ld)\n", This, lIndex);
590 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
592 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
593 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
597 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
599 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
600 FIXME("(%p)->(%p)\n", This, p);
604 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
606 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
607 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
611 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
613 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
614 FIXME("(%p)->(%p)\n", This, p);
618 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
619 IHTMLStyleSheetRulesCollection **p)
621 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
622 nsIDOMCSSRuleList *nslist = NULL;
625 TRACE("(%p)->(%p)\n", This, p);
627 /* Gecko has buggy security checks and GetCssRules will fail. We have a correct
628 * implementation and it will work when the bug will be fixed in Gecko. */
629 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
631 WARN("GetCssRules failed: %08x\n", nsres);
633 *p = HTMLStyleSheetRulesCollection_Create(nslist);
637 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
638 HTMLStyleSheet_QueryInterface,
639 HTMLStyleSheet_AddRef,
640 HTMLStyleSheet_Release,
641 HTMLStyleSheet_GetTypeInfoCount,
642 HTMLStyleSheet_GetTypeInfo,
643 HTMLStyleSheet_GetIDsOfNames,
644 HTMLStyleSheet_Invoke,
645 HTMLStyleSheet_put_title,
646 HTMLStyleSheet_get_title,
647 HTMLStyleSheet_get_parentStyleSheet,
648 HTMLStyleSheet_get_owningElement,
649 HTMLStyleSheet_put_disabled,
650 HTMLStyleSheet_get_disabled,
651 HTMLStyleSheet_get_readOnly,
652 HTMLStyleSheet_get_imports,
653 HTMLStyleSheet_put_href,
654 HTMLStyleSheet_get_href,
655 HTMLStyleSheet_get_type,
656 HTMLStyleSheet_get_id,
657 HTMLStyleSheet_addImport,
658 HTMLStyleSheet_addRule,
659 HTMLStyleSheet_removeImport,
660 HTMLStyleSheet_removeRule,
661 HTMLStyleSheet_put_media,
662 HTMLStyleSheet_get_media,
663 HTMLStyleSheet_put_cssText,
664 HTMLStyleSheet_get_cssText,
665 HTMLStyleSheet_get_rules
668 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
670 HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet));
673 ret->lpHTMLStyleSheetVtbl = &HTMLStyleSheetVtbl;
675 ret->nsstylesheet = NULL;
678 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
679 (void**)&ret->nsstylesheet);
681 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
684 return HTMLSTYLESHEET(ret);