ddraw: Use unsafe_impl_from_IDirect3DViewport for application provided interfaces.
[wine/multimedia.git] / dlls / mshtml / htmlstylesheet.c
blob3fa6c278d6a2a2e6f850e71fe762575458432c25
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"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 struct HTMLStyleSheet {
35 IHTMLStyleSheet IHTMLStyleSheet_iface;
37 LONG ref;
39 nsIDOMCSSStyleSheet *nsstylesheet;
42 struct HTMLStyleSheetsCollection {
43 DispatchEx dispex;
44 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface;
46 LONG ref;
48 nsIDOMStyleSheetList *nslist;
51 struct HTMLStyleSheetRulesCollection {
52 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface;
54 LONG ref;
56 nsIDOMCSSRuleList *nslist;
59 static inline HTMLStyleSheetRulesCollection *impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface)
61 return CONTAINING_RECORD(iface, HTMLStyleSheetRulesCollection, IHTMLStyleSheetRulesCollection_iface);
64 static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface,
65 REFIID riid, void **ppv)
67 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
69 if(IsEqualGUID(&IID_IUnknown, riid)) {
70 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
71 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
72 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection, riid)) {
73 TRACE("(%p)->(IID_IHTMLStyleSheetRulesCollection %p)\n", This, ppv);
74 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
77 if(*ppv) {
78 IUnknown_AddRef((IUnknown*)*ppv);
79 return S_OK;
82 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
83 return E_NOINTERFACE;
86 static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
88 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
89 LONG ref = InterlockedIncrement(&This->ref);
91 TRACE("(%p) ref=%d\n", This, ref);
93 return ref;
96 static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
98 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
99 LONG ref = InterlockedDecrement(&This->ref);
101 TRACE("(%p) ref=%d\n", This, ref);
103 if(!ref) {
104 if(This->nslist)
105 nsIDOMCSSRuleList_Release(This->nslist);
106 heap_free(This);
109 return ref;
112 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(
113 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
115 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
116 FIXME("(%p)->(%p)\n", This, pctinfo);
117 return E_NOTIMPL;
120 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface,
121 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
123 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
124 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
125 return E_NOTIMPL;
128 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface,
129 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
131 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
132 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
133 lcid, rgDispId);
134 return E_NOTIMPL;
137 static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection *iface,
138 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
139 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
141 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
142 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
143 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
148 LONG *p)
150 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
151 PRUint32 len = 0;
153 TRACE("(%p)->(%p)\n", This, p);
155 if(This->nslist) {
156 nsresult nsres;
158 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
159 if(NS_FAILED(nsres))
160 ERR("GetLength failed: %08x\n", nsres);
163 *p = len;
164 return S_OK;
167 static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
168 LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
170 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
171 FIXME("(%p)->(%d %p)\n", This, index, ppHTMLStyleSheetRule);
172 return E_NOTIMPL;
175 static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl = {
176 HTMLStyleSheetRulesCollection_QueryInterface,
177 HTMLStyleSheetRulesCollection_AddRef,
178 HTMLStyleSheetRulesCollection_Release,
179 HTMLStyleSheetRulesCollection_GetTypeInfoCount,
180 HTMLStyleSheetRulesCollection_GetTypeInfo,
181 HTMLStyleSheetRulesCollection_GetIDsOfNames,
182 HTMLStyleSheetRulesCollection_Invoke,
183 HTMLStyleSheetRulesCollection_get_length,
184 HTMLStyleSheetRulesCollection_item
187 static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
189 HTMLStyleSheetRulesCollection *ret;
191 ret = heap_alloc(sizeof(*ret));
192 ret->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl;
193 ret->ref = 1;
194 ret->nslist = nslist;
196 if(nslist)
197 nsIDOMCSSRuleList_AddRef(nslist);
199 return &ret->IHTMLStyleSheetRulesCollection_iface;
202 static inline HTMLStyleSheetsCollection *impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection *iface)
204 return CONTAINING_RECORD(iface, HTMLStyleSheetsCollection, IHTMLStyleSheetsCollection_iface);
207 static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
208 REFIID riid, void **ppv)
210 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
212 *ppv = NULL;
214 if(IsEqualGUID(&IID_IUnknown, riid)) {
215 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
216 *ppv = &This->IHTMLStyleSheetsCollection_iface;
217 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
218 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
219 *ppv = &This->IHTMLStyleSheetsCollection_iface;
220 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
221 TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv);
222 *ppv = &This->IHTMLStyleSheetsCollection_iface;
223 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
224 return *ppv ? S_OK : E_NOINTERFACE;
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 = impl_from_IHTMLStyleSheetsCollection(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 = impl_from_IHTMLStyleSheetsCollection(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 = impl_from_IHTMLStyleSheetsCollection(iface);
266 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
269 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
270 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
272 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
273 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
276 static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
277 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
279 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
280 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
281 lcid, rgDispId);
284 static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
285 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
286 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
288 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
289 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
290 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
293 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
294 LONG *p)
296 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
297 PRUint32 len = 0;
299 TRACE("(%p)->(%p)\n", This, p);
301 if(This->nslist)
302 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
304 *p = len;
305 return S_OK;
308 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
309 IUnknown **p)
311 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
312 FIXME("(%p)->(%p)\n", This, p);
313 return E_NOTIMPL;
316 static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
317 VARIANT *pvarIndex, VARIANT *pvarResult)
319 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
321 TRACE("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
323 switch(V_VT(pvarIndex)) {
324 case VT_I4: {
325 nsIDOMStyleSheet *nsstylesheet;
326 nsresult nsres;
328 TRACE("index=%d\n", V_I4(pvarIndex));
330 nsres = nsIDOMStyleSheetList_Item(This->nslist, V_I4(pvarIndex), &nsstylesheet);
331 if(NS_FAILED(nsres) || !nsstylesheet) {
332 WARN("Item failed: %08x\n", nsres);
333 V_VT(pvarResult) = VT_EMPTY;
334 return E_INVALIDARG;
337 V_VT(pvarResult) = VT_DISPATCH;
338 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
340 return S_OK;
343 case VT_BSTR:
344 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
345 return E_NOTIMPL;
347 default:
348 WARN("Invalid vt=%d\n", V_VT(pvarIndex));
351 return E_INVALIDARG;
354 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
355 HTMLStyleSheetsCollection_QueryInterface,
356 HTMLStyleSheetsCollection_AddRef,
357 HTMLStyleSheetsCollection_Release,
358 HTMLStyleSheetsCollection_GetTypeInfoCount,
359 HTMLStyleSheetsCollection_GetTypeInfo,
360 HTMLStyleSheetsCollection_GetIDsOfNames,
361 HTMLStyleSheetsCollection_Invoke,
362 HTMLStyleSheetsCollection_get_length,
363 HTMLStyleSheetsCollection_get__newEnum,
364 HTMLStyleSheetsCollection_item
367 static const tid_t HTMLStyleSheetsCollection_iface_tids[] = {
368 IHTMLStyleSheetsCollection_tid,
371 static dispex_static_data_t HTMLStyleSheetsCollection_dispex = {
372 NULL,
373 DispHTMLStyleSheetsCollection_tid,
374 NULL,
375 HTMLStyleSheetsCollection_iface_tids
378 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
380 HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection));
382 ret->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl;
383 ret->ref = 1;
385 if(nslist)
386 nsIDOMStyleSheetList_AddRef(nslist);
387 ret->nslist = nslist;
389 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetsCollection_iface,
390 &HTMLStyleSheetsCollection_dispex);
392 return &ret->IHTMLStyleSheetsCollection_iface;
395 static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)
397 return CONTAINING_RECORD(iface, HTMLStyleSheet, IHTMLStyleSheet_iface);
400 static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
402 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
404 *ppv = NULL;
406 if(IsEqualGUID(&IID_IUnknown, riid)) {
407 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
408 *ppv = &This->IHTMLStyleSheet_iface;
409 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
410 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
411 *ppv = &This->IHTMLStyleSheet_iface;
412 }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) {
413 TRACE("(%p)->(IID_IHTMLStyleSheet %p)\n", This, ppv);
414 *ppv = &This->IHTMLStyleSheet_iface;
417 if(*ppv) {
418 IUnknown_AddRef((IUnknown*)*ppv);
419 return S_OK;
422 WARN("unsupported %s\n", debugstr_guid(riid));
423 return E_NOINTERFACE;
426 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
428 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
429 LONG ref = InterlockedIncrement(&This->ref);
431 TRACE("(%p) ref=%d\n", This, ref);
433 return ref;
436 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
438 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
439 LONG ref = InterlockedDecrement(&This->ref);
441 TRACE("(%p) ref=%d\n", This, ref);
443 if(!ref)
444 heap_free(This);
446 return ref;
449 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
451 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
452 FIXME("(%p)->(%p)\n", This, pctinfo);
453 return E_NOTIMPL;
456 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
457 LCID lcid, ITypeInfo **ppTInfo)
459 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
460 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
461 return E_NOTIMPL;
464 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
465 LPOLESTR *rgszNames, UINT cNames,
466 LCID lcid, DISPID *rgDispId)
468 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
469 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
470 lcid, rgDispId);
471 return E_NOTIMPL;
474 static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
475 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
476 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
478 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
479 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
480 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
481 return E_NOTIMPL;
484 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
486 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
487 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
488 return E_NOTIMPL;
491 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
493 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
494 FIXME("(%p)->(%p)\n", This, p);
495 return E_NOTIMPL;
498 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
499 IHTMLStyleSheet **p)
501 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
502 FIXME("(%p)->(%p)\n", This, p);
503 return E_NOTIMPL;
506 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
508 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
509 FIXME("(%p)->(%p)\n", This, p);
510 return E_NOTIMPL;
513 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
515 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
516 FIXME("(%p)->(%x)\n", This, v);
517 return E_NOTIMPL;
520 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
522 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
523 FIXME("(%p)->(%p)\n", This, p);
524 return E_NOTIMPL;
527 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
529 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
530 FIXME("(%p)->(%p)\n", This, p);
531 return E_NOTIMPL;
534 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
535 IHTMLStyleSheetsCollection **p)
537 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
538 FIXME("(%p)->(%p)\n", This, p);
539 return E_NOTIMPL;
542 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
544 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
545 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
546 return E_NOTIMPL;
549 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
551 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
552 FIXME("(%p)->(%p)\n", This, p);
553 return E_NOTIMPL;
556 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
558 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
559 FIXME("(%p)->(%p)\n", This, p);
560 return E_NOTIMPL;
563 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
565 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
566 FIXME("(%p)->(%p)\n", This, p);
567 return E_NOTIMPL;
570 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
571 LONG lIndex, LONG *plIndex)
573 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
574 FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
579 BSTR bstrStyle, LONG lIndex, LONG *plIndex)
581 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
582 FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
583 lIndex, plIndex);
584 return E_NOTIMPL;
587 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
589 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
590 FIXME("(%p)->(%d)\n", This, lIndex);
591 return E_NOTIMPL;
594 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
596 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
597 FIXME("(%p)->(%d)\n", This, lIndex);
598 return E_NOTIMPL;
601 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
603 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
604 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
605 return E_NOTIMPL;
608 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
610 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
611 FIXME("(%p)->(%p)\n", This, p);
612 return E_NOTIMPL;
615 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
617 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
618 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
619 return E_NOTIMPL;
622 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
624 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
625 FIXME("(%p)->(%p)\n", This, p);
626 return E_NOTIMPL;
629 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
630 IHTMLStyleSheetRulesCollection **p)
632 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
633 nsIDOMCSSRuleList *nslist = NULL;
634 nsresult nsres;
636 TRACE("(%p)->(%p)\n", This, p);
638 /* Gecko has buggy security checks and GetCssRules will fail. We have a correct
639 * implementation and it will work when the bug will be fixed in Gecko. */
640 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
641 if(NS_FAILED(nsres))
642 WARN("GetCssRules failed: %08x\n", nsres);
644 *p = HTMLStyleSheetRulesCollection_Create(nslist);
645 return S_OK;
648 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
649 HTMLStyleSheet_QueryInterface,
650 HTMLStyleSheet_AddRef,
651 HTMLStyleSheet_Release,
652 HTMLStyleSheet_GetTypeInfoCount,
653 HTMLStyleSheet_GetTypeInfo,
654 HTMLStyleSheet_GetIDsOfNames,
655 HTMLStyleSheet_Invoke,
656 HTMLStyleSheet_put_title,
657 HTMLStyleSheet_get_title,
658 HTMLStyleSheet_get_parentStyleSheet,
659 HTMLStyleSheet_get_owningElement,
660 HTMLStyleSheet_put_disabled,
661 HTMLStyleSheet_get_disabled,
662 HTMLStyleSheet_get_readOnly,
663 HTMLStyleSheet_get_imports,
664 HTMLStyleSheet_put_href,
665 HTMLStyleSheet_get_href,
666 HTMLStyleSheet_get_type,
667 HTMLStyleSheet_get_id,
668 HTMLStyleSheet_addImport,
669 HTMLStyleSheet_addRule,
670 HTMLStyleSheet_removeImport,
671 HTMLStyleSheet_removeRule,
672 HTMLStyleSheet_put_media,
673 HTMLStyleSheet_get_media,
674 HTMLStyleSheet_put_cssText,
675 HTMLStyleSheet_get_cssText,
676 HTMLStyleSheet_get_rules
679 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
681 HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet));
682 nsresult nsres;
684 ret->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl;
685 ret->ref = 1;
686 ret->nsstylesheet = NULL;
688 if(nsstylesheet) {
689 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
690 (void**)&ret->nsstylesheet);
691 if(NS_FAILED(nsres))
692 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
695 return &ret->IHTMLStyleSheet_iface;