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"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
34 struct HTMLStyleSheet
{
36 IHTMLStyleSheet IHTMLStyleSheet_iface
;
40 nsIDOMCSSStyleSheet
*nsstylesheet
;
43 struct HTMLStyleSheetsCollection
{
45 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface
;
49 nsIDOMStyleSheetList
*nslist
;
52 struct HTMLStyleSheetRulesCollection
{
54 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface
;
58 nsIDOMCSSRuleList
*nslist
;
61 static inline HTMLStyleSheetRulesCollection
*impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection
*iface
)
63 return CONTAINING_RECORD(iface
, HTMLStyleSheetRulesCollection
, IHTMLStyleSheetRulesCollection_iface
);
66 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection
*iface
,
67 REFIID riid
, void **ppv
)
69 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
71 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
73 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
74 *ppv
= &This
->IHTMLStyleSheetRulesCollection_iface
;
75 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection
, riid
)) {
76 *ppv
= &This
->IHTMLStyleSheetRulesCollection_iface
;
77 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
78 return *ppv
? S_OK
: E_NOINTERFACE
;
81 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
85 IUnknown_AddRef((IUnknown
*)*ppv
);
89 static ULONG WINAPI
HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection
*iface
)
91 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
92 LONG ref
= InterlockedIncrement(&This
->ref
);
94 TRACE("(%p) ref=%d\n", This
, ref
);
99 static ULONG WINAPI
HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection
*iface
)
101 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
102 LONG ref
= InterlockedDecrement(&This
->ref
);
104 TRACE("(%p) ref=%d\n", This
, ref
);
107 release_dispex(&This
->dispex
);
109 nsIDOMCSSRuleList_Release(This
->nslist
);
116 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfoCount(
117 IHTMLStyleSheetRulesCollection
*iface
, UINT
*pctinfo
)
119 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
120 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
123 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection
*iface
,
124 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
126 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
127 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, 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
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
134 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
138 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection
*iface
,
139 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
140 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
142 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
143 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
144 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
147 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection
*iface
,
150 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
153 TRACE("(%p)->(%p)\n", This
, p
);
158 nsres
= nsIDOMCSSRuleList_GetLength(This
->nslist
, &len
);
160 ERR("GetLength failed: %08x\n", nsres
);
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
);
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 const tid_t HTMLStyleSheetRulesCollection_iface_tids
[] = {
188 IHTMLStyleSheetRulesCollection_tid
,
191 static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex
= {
193 DispHTMLStyleSheetRulesCollection_tid
,
195 HTMLStyleSheetRulesCollection_iface_tids
198 static IHTMLStyleSheetRulesCollection
*HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList
*nslist
)
200 HTMLStyleSheetRulesCollection
*ret
;
202 ret
= heap_alloc(sizeof(*ret
));
203 ret
->IHTMLStyleSheetRulesCollection_iface
.lpVtbl
= &HTMLStyleSheetRulesCollectionVtbl
;
205 ret
->nslist
= nslist
;
207 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLStyleSheetRulesCollection_iface
, &HTMLStyleSheetRulesCollection_dispex
);
210 nsIDOMCSSRuleList_AddRef(nslist
);
212 return &ret
->IHTMLStyleSheetRulesCollection_iface
;
215 static inline HTMLStyleSheetsCollection
*impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection
*iface
)
217 return CONTAINING_RECORD(iface
, HTMLStyleSheetsCollection
, IHTMLStyleSheetsCollection_iface
);
220 static HRESULT WINAPI
HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection
*iface
,
221 REFIID riid
, void **ppv
)
223 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
225 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
227 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
228 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
229 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
230 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
231 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection
, riid
)) {
232 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
233 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
234 return *ppv
? S_OK
: E_NOINTERFACE
;
237 WARN("unsupported %s\n", debugstr_mshtml_guid(riid
));
238 return E_NOINTERFACE
;
241 IUnknown_AddRef((IUnknown
*)*ppv
);
245 static ULONG WINAPI
HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection
*iface
)
247 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
248 LONG ref
= InterlockedIncrement(&This
->ref
);
250 TRACE("(%p) ref=%d\n", This
, ref
);
255 static ULONG WINAPI
HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection
*iface
)
257 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
258 LONG ref
= InterlockedDecrement(&This
->ref
);
260 TRACE("(%p) ref=%d\n", This
, ref
);
263 release_dispex(&This
->dispex
);
265 nsIDOMStyleSheetList_Release(This
->nslist
);
272 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection
*iface
,
275 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
276 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
279 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection
*iface
,
280 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
282 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
283 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
286 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection
*iface
,
287 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
289 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
290 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
294 static HRESULT WINAPI
HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection
*iface
,
295 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
296 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
298 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
299 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
300 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
303 static HRESULT WINAPI
HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection
*iface
,
306 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
309 TRACE("(%p)->(%p)\n", This
, p
);
312 nsIDOMStyleSheetList_GetLength(This
->nslist
, &len
);
318 static HRESULT WINAPI
HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection
*iface
,
321 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
322 FIXME("(%p)->(%p)\n", This
, p
);
326 static HRESULT WINAPI
HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection
*iface
,
327 VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
329 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
331 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarIndex
), pvarResult
);
333 switch(V_VT(pvarIndex
)) {
335 nsIDOMStyleSheet
*nsstylesheet
;
338 TRACE("index=%d\n", V_I4(pvarIndex
));
340 nsres
= nsIDOMStyleSheetList_Item(This
->nslist
, V_I4(pvarIndex
), &nsstylesheet
);
341 if(NS_FAILED(nsres
) || !nsstylesheet
) {
342 WARN("Item failed: %08x\n", nsres
);
343 V_VT(pvarResult
) = VT_EMPTY
;
347 V_VT(pvarResult
) = VT_DISPATCH
;
348 V_DISPATCH(pvarResult
) = (IDispatch
*)HTMLStyleSheet_Create(nsstylesheet
);
354 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult
)));
358 WARN("Invalid index %s\n", debugstr_variant(pvarIndex
));
364 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl
= {
365 HTMLStyleSheetsCollection_QueryInterface
,
366 HTMLStyleSheetsCollection_AddRef
,
367 HTMLStyleSheetsCollection_Release
,
368 HTMLStyleSheetsCollection_GetTypeInfoCount
,
369 HTMLStyleSheetsCollection_GetTypeInfo
,
370 HTMLStyleSheetsCollection_GetIDsOfNames
,
371 HTMLStyleSheetsCollection_Invoke
,
372 HTMLStyleSheetsCollection_get_length
,
373 HTMLStyleSheetsCollection_get__newEnum
,
374 HTMLStyleSheetsCollection_item
377 static const tid_t HTMLStyleSheetsCollection_iface_tids
[] = {
378 IHTMLStyleSheetsCollection_tid
,
381 static dispex_static_data_t HTMLStyleSheetsCollection_dispex
= {
383 DispHTMLStyleSheetsCollection_tid
,
385 HTMLStyleSheetsCollection_iface_tids
388 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*nslist
)
390 HTMLStyleSheetsCollection
*ret
= heap_alloc(sizeof(HTMLStyleSheetsCollection
));
392 ret
->IHTMLStyleSheetsCollection_iface
.lpVtbl
= &HTMLStyleSheetsCollectionVtbl
;
396 nsIDOMStyleSheetList_AddRef(nslist
);
397 ret
->nslist
= nslist
;
399 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLStyleSheetsCollection_iface
,
400 &HTMLStyleSheetsCollection_dispex
);
402 return &ret
->IHTMLStyleSheetsCollection_iface
;
405 static inline HTMLStyleSheet
*impl_from_IHTMLStyleSheet(IHTMLStyleSheet
*iface
)
407 return CONTAINING_RECORD(iface
, HTMLStyleSheet
, IHTMLStyleSheet_iface
);
410 static HRESULT WINAPI
HTMLStyleSheet_QueryInterface(IHTMLStyleSheet
*iface
, REFIID riid
, void **ppv
)
412 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
414 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
416 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
417 *ppv
= &This
->IHTMLStyleSheet_iface
;
418 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
419 *ppv
= &This
->IHTMLStyleSheet_iface
;
420 }else if(IsEqualGUID(&IID_IHTMLStyleSheet
, riid
)) {
421 *ppv
= &This
->IHTMLStyleSheet_iface
;
422 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
423 return *ppv
? S_OK
: E_NOINTERFACE
;
426 WARN("unsupported %s\n", debugstr_mshtml_guid(riid
));
427 return E_NOINTERFACE
;
430 IUnknown_AddRef((IUnknown
*)*ppv
);
434 static ULONG WINAPI
HTMLStyleSheet_AddRef(IHTMLStyleSheet
*iface
)
436 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
437 LONG ref
= InterlockedIncrement(&This
->ref
);
439 TRACE("(%p) ref=%d\n", This
, ref
);
444 static ULONG WINAPI
HTMLStyleSheet_Release(IHTMLStyleSheet
*iface
)
446 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
447 LONG ref
= InterlockedDecrement(&This
->ref
);
449 TRACE("(%p) ref=%d\n", This
, ref
);
452 release_dispex(&This
->dispex
);
453 if(This
->nsstylesheet
)
454 nsIDOMCSSStyleSheet_Release(This
->nsstylesheet
);
461 static HRESULT WINAPI
HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet
*iface
, UINT
*pctinfo
)
463 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
464 TRACE("(%p)->(%p)\n", This
, pctinfo
);
465 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
468 static HRESULT WINAPI
HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet
*iface
, UINT iTInfo
,
469 LCID lcid
, ITypeInfo
**ppTInfo
)
471 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
472 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
475 static HRESULT WINAPI
HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet
*iface
, REFIID riid
,
476 LPOLESTR
*rgszNames
, UINT cNames
,
477 LCID lcid
, DISPID
*rgDispId
)
479 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
480 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
483 static HRESULT WINAPI
HTMLStyleSheet_Invoke(IHTMLStyleSheet
*iface
, DISPID dispIdMember
,
484 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
485 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
487 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
488 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
489 pVarResult
, pExcepInfo
, puArgErr
);
492 static HRESULT WINAPI
HTMLStyleSheet_put_title(IHTMLStyleSheet
*iface
, BSTR v
)
494 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
495 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
499 static HRESULT WINAPI
HTMLStyleSheet_get_title(IHTMLStyleSheet
*iface
, BSTR
*p
)
501 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
502 FIXME("(%p)->(%p)\n", This
, p
);
506 static HRESULT WINAPI
HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet
*iface
,
509 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
510 FIXME("(%p)->(%p)\n", This
, p
);
514 static HRESULT WINAPI
HTMLStyleSheet_get_owningElement(IHTMLStyleSheet
*iface
, IHTMLElement
**p
)
516 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
517 FIXME("(%p)->(%p)\n", This
, p
);
521 static HRESULT WINAPI
HTMLStyleSheet_put_disabled(IHTMLStyleSheet
*iface
, VARIANT_BOOL v
)
523 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
524 FIXME("(%p)->(%x)\n", This
, v
);
528 static HRESULT WINAPI
HTMLStyleSheet_get_disabled(IHTMLStyleSheet
*iface
, VARIANT_BOOL
*p
)
530 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
531 FIXME("(%p)->(%p)\n", This
, p
);
535 static HRESULT WINAPI
HTMLStyleSheet_get_readOnly(IHTMLStyleSheet
*iface
, VARIANT_BOOL
*p
)
537 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
538 FIXME("(%p)->(%p)\n", This
, p
);
542 static HRESULT WINAPI
HTMLStyleSheet_get_imports(IHTMLStyleSheet
*iface
,
543 IHTMLStyleSheetsCollection
**p
)
545 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
546 FIXME("(%p)->(%p)\n", This
, p
);
550 static HRESULT WINAPI
HTMLStyleSheet_put_href(IHTMLStyleSheet
*iface
, BSTR v
)
552 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
553 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
557 static HRESULT WINAPI
HTMLStyleSheet_get_href(IHTMLStyleSheet
*iface
, BSTR
*p
)
559 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
563 TRACE("(%p)->(%p)\n", This
, p
);
565 nsAString_Init(&href_str
, NULL
);
566 nsres
= nsIDOMCSSStyleSheet_GetHref(This
->nsstylesheet
, &href_str
);
567 return return_nsstr(nsres
, &href_str
, p
);
570 static HRESULT WINAPI
HTMLStyleSheet_get_type(IHTMLStyleSheet
*iface
, BSTR
*p
)
572 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
573 FIXME("(%p)->(%p)\n", This
, p
);
577 static HRESULT WINAPI
HTMLStyleSheet_get_id(IHTMLStyleSheet
*iface
, BSTR
*p
)
579 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
580 FIXME("(%p)->(%p)\n", This
, p
);
584 static HRESULT WINAPI
HTMLStyleSheet_addImport(IHTMLStyleSheet
*iface
, BSTR bstrURL
,
585 LONG lIndex
, LONG
*plIndex
)
587 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
588 FIXME("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrURL
), lIndex
, plIndex
);
592 static HRESULT WINAPI
HTMLStyleSheet_addRule(IHTMLStyleSheet
*iface
, BSTR bstrSelector
,
593 BSTR bstrStyle
, LONG lIndex
, LONG
*plIndex
)
595 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
596 FIXME("(%p)->(%s %s %d %p)\n", This
, debugstr_w(bstrSelector
), debugstr_w(bstrStyle
),
601 static HRESULT WINAPI
HTMLStyleSheet_removeImport(IHTMLStyleSheet
*iface
, LONG lIndex
)
603 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
604 FIXME("(%p)->(%d)\n", This
, lIndex
);
608 static HRESULT WINAPI
HTMLStyleSheet_removeRule(IHTMLStyleSheet
*iface
, LONG lIndex
)
610 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
611 FIXME("(%p)->(%d)\n", This
, lIndex
);
615 static HRESULT WINAPI
HTMLStyleSheet_put_media(IHTMLStyleSheet
*iface
, BSTR v
)
617 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
618 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
622 static HRESULT WINAPI
HTMLStyleSheet_get_media(IHTMLStyleSheet
*iface
, BSTR
*p
)
624 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
625 FIXME("(%p)->(%p)\n", This
, p
);
629 static HRESULT WINAPI
HTMLStyleSheet_put_cssText(IHTMLStyleSheet
*iface
, BSTR v
)
631 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
632 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
636 static HRESULT WINAPI
HTMLStyleSheet_get_cssText(IHTMLStyleSheet
*iface
, BSTR
*p
)
638 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
639 FIXME("(%p)->(%p)\n", This
, p
);
643 static HRESULT WINAPI
HTMLStyleSheet_get_rules(IHTMLStyleSheet
*iface
,
644 IHTMLStyleSheetRulesCollection
**p
)
646 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
647 nsIDOMCSSRuleList
*nslist
= NULL
;
650 TRACE("(%p)->(%p)\n", This
, p
);
652 /* Gecko has buggy security checks and GetCssRules will fail. We have a correct
653 * implementation and it will work when the bug will be fixed in Gecko. */
654 nsres
= nsIDOMCSSStyleSheet_GetCssRules(This
->nsstylesheet
, &nslist
);
656 WARN("GetCssRules failed: %08x\n", nsres
);
658 *p
= HTMLStyleSheetRulesCollection_Create(nslist
);
662 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl
= {
663 HTMLStyleSheet_QueryInterface
,
664 HTMLStyleSheet_AddRef
,
665 HTMLStyleSheet_Release
,
666 HTMLStyleSheet_GetTypeInfoCount
,
667 HTMLStyleSheet_GetTypeInfo
,
668 HTMLStyleSheet_GetIDsOfNames
,
669 HTMLStyleSheet_Invoke
,
670 HTMLStyleSheet_put_title
,
671 HTMLStyleSheet_get_title
,
672 HTMLStyleSheet_get_parentStyleSheet
,
673 HTMLStyleSheet_get_owningElement
,
674 HTMLStyleSheet_put_disabled
,
675 HTMLStyleSheet_get_disabled
,
676 HTMLStyleSheet_get_readOnly
,
677 HTMLStyleSheet_get_imports
,
678 HTMLStyleSheet_put_href
,
679 HTMLStyleSheet_get_href
,
680 HTMLStyleSheet_get_type
,
681 HTMLStyleSheet_get_id
,
682 HTMLStyleSheet_addImport
,
683 HTMLStyleSheet_addRule
,
684 HTMLStyleSheet_removeImport
,
685 HTMLStyleSheet_removeRule
,
686 HTMLStyleSheet_put_media
,
687 HTMLStyleSheet_get_media
,
688 HTMLStyleSheet_put_cssText
,
689 HTMLStyleSheet_get_cssText
,
690 HTMLStyleSheet_get_rules
693 static const tid_t HTMLStyleSheet_iface_tids
[] = {
697 static dispex_static_data_t HTMLStyleSheet_dispex
= {
699 DispHTMLStyleSheet_tid
,
701 HTMLStyleSheet_iface_tids
704 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*nsstylesheet
)
706 HTMLStyleSheet
*ret
= heap_alloc(sizeof(HTMLStyleSheet
));
709 ret
->IHTMLStyleSheet_iface
.lpVtbl
= &HTMLStyleSheetVtbl
;
711 ret
->nsstylesheet
= NULL
;
713 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLStyleSheet_iface
, &HTMLStyleSheet_dispex
);
716 nsres
= nsIDOMStyleSheet_QueryInterface(nsstylesheet
, &IID_nsIDOMCSSStyleSheet
,
717 (void**)&ret
->nsstylesheet
);
719 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres
);
722 return &ret
->IHTMLStyleSheet_iface
;