mshtml: Added tests showing that we should return E_NOTIMPL in DeleteMemberByName.
[wine/multimedia.git] / dlls / mshtml / htmlstylesheet.c
blobe39bfb761ce0b9aad2df8dbb672a9ccea33b303f
1 /*
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLStyleSheet {
36 const IHTMLStyleSheetVtbl *lpHTMLStyleSheetVtbl;
38 LONG ref;
40 nsIDOMCSSStyleSheet *nsstylesheet;
43 struct HTMLStyleSheetsCollection {
44 const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl;
46 LONG ref;
48 nsIDOMStyleSheetList *nslist;
51 struct HTMLStyleSheetRulesCollection {
52 const IHTMLStyleSheetRulesCollectionVtbl *lpHTMLStyleSheetRulesCollectionVtbl;
54 LONG ref;
56 nsIDOMCSSRuleList *nslist;
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);
79 if(*ppv) {
80 IUnknown_AddRef((IUnknown*)*ppv);
81 return S_OK;
84 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
85 return E_NOINTERFACE;
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);
95 return 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);
105 if(!ref) {
106 if(This->nslist)
107 nsIDOMCSSRuleList_Release(This->nslist);
108 heap_free(This);
111 return ref;
114 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(
115 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
117 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
118 FIXME("(%p)->(%p)\n", This, pctinfo);
119 return E_NOTIMPL;
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);
127 return E_NOTIMPL;
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,
135 lcid, rgDispId);
136 return E_NOTIMPL;
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);
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
150 LONG *p)
152 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
153 PRUint32 len = 0;
155 TRACE("(%p)->(%p)\n", This, p);
157 if(This->nslist) {
158 nsresult nsres;
160 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
161 if(NS_FAILED(nsres))
162 ERR("GetLength failed: %08x\n", nsres);
165 *p = len;
166 return S_OK;
169 static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
170 LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
172 HTMLStyleSheetRulesCollection *This = HTMLSTYLERULESCOL_THIS(iface);
173 FIXME("(%p)->(%d %p)\n", This, index, ppHTMLStyleSheetRule);
174 return E_NOTIMPL;
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;
197 ret->ref = 1;
198 ret->nslist = nslist;
200 if(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);
214 *ppv = NULL;
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);
227 if(*ppv) {
228 IUnknown_AddRef((IUnknown*)*ppv);
229 return S_OK;
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);
243 return 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);
253 if(!ref) {
254 if(This->nslist)
255 nsIDOMStyleSheetList_Release(This->nslist);
256 heap_free(This);
259 return ref;
262 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
263 UINT *pctinfo)
265 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
266 FIXME("(%p)->(%p)\n", This, pctinfo);
267 return E_NOTIMPL;
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);
275 return E_NOTIMPL;
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,
283 lcid, rgDispId);
284 return E_NOTIMPL;
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);
294 return E_NOTIMPL;
297 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
298 LONG *p)
300 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
301 PRUint32 len = 0;
303 TRACE("(%p)->(%p)\n", This, p);
305 if(This->nslist)
306 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
308 *p = len;
309 return S_OK;
312 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
313 IUnknown **p)
315 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
316 FIXME("(%p)->(%p)\n", This, p);
317 return E_NOTIMPL;
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)) {
328 case VT_I4: {
329 nsIDOMStyleSheet *nsstylesheet;
330 nsresult nsres;
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;
338 return E_INVALIDARG;
341 V_VT(pvarResult) = VT_DISPATCH;
342 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
344 return S_OK;
347 case VT_BSTR:
348 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
349 return E_NOTIMPL;
351 default:
352 WARN("Invalid vt=%d\n", V_VT(pvarIndex));
355 return E_INVALIDARG;
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;
378 ret->ref = 1;
380 if(nslist)
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);
393 *ppv = NULL;
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);
406 if(*ppv) {
407 IUnknown_AddRef((IUnknown*)*ppv);
408 return S_OK;
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);
422 return 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);
432 if(!ref)
433 heap_free(This);
435 return ref;
438 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
440 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
441 FIXME("(%p)->(%p)\n", This, pctinfo);
442 return E_NOTIMPL;
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);
450 return E_NOTIMPL;
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,
459 lcid, rgDispId);
460 return E_NOTIMPL;
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);
470 return E_NOTIMPL;
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));
477 return E_NOTIMPL;
480 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
482 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
483 FIXME("(%p)->(%p)\n", This, p);
484 return E_NOTIMPL;
487 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
488 IHTMLStyleSheet **p)
490 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
491 FIXME("(%p)->(%p)\n", This, p);
492 return E_NOTIMPL;
495 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
497 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
499 return E_NOTIMPL;
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);
506 return E_NOTIMPL;
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);
513 return E_NOTIMPL;
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);
520 return E_NOTIMPL;
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);
528 return E_NOTIMPL;
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));
535 return E_NOTIMPL;
538 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
540 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
541 FIXME("(%p)->(%p)\n", This, p);
542 return E_NOTIMPL;
545 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
547 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
548 FIXME("(%p)->(%p)\n", This, p);
549 return E_NOTIMPL;
552 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
554 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
555 FIXME("(%p)->(%p)\n", This, p);
556 return E_NOTIMPL;
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 %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
564 return E_NOTIMPL;
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 %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
572 lIndex, plIndex);
573 return E_NOTIMPL;
576 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
578 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
579 FIXME("(%p)->(%d)\n", This, lIndex);
580 return E_NOTIMPL;
583 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
585 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
586 FIXME("(%p)->(%d)\n", This, lIndex);
587 return E_NOTIMPL;
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));
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
599 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
600 FIXME("(%p)->(%p)\n", This, p);
601 return E_NOTIMPL;
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));
608 return E_NOTIMPL;
611 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
613 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
614 FIXME("(%p)->(%p)\n", This, p);
615 return E_NOTIMPL;
618 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
619 IHTMLStyleSheetRulesCollection **p)
621 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
622 nsIDOMCSSRuleList *nslist = NULL;
623 nsresult nsres;
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);
630 if(NS_FAILED(nsres))
631 WARN("GetCssRules failed: %08x\n", nsres);
633 *p = HTMLStyleSheetRulesCollection_Create(nslist);
634 return S_OK;
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));
671 nsresult nsres;
673 ret->lpHTMLStyleSheetVtbl = &HTMLStyleSheetVtbl;
674 ret->ref = 1;
675 ret->nsstylesheet = NULL;
677 if(nsstylesheet) {
678 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
679 (void**)&ret->nsstylesheet);
680 if(NS_FAILED(nsres))
681 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
684 return HTMLSTYLESHEET(ret);