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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
35 struct HTMLStyleSheet
{
37 IHTMLStyleSheet IHTMLStyleSheet_iface
;
38 IHTMLStyleSheet4 IHTMLStyleSheet4_iface
;
42 nsIDOMCSSStyleSheet
*nsstylesheet
;
45 struct HTMLStyleSheetsCollection
{
47 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface
;
51 nsIDOMStyleSheetList
*nslist
;
54 struct HTMLStyleSheetRulesCollection
{
56 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface
;
60 nsIDOMCSSRuleList
*nslist
;
63 struct HTMLStyleSheetRule
{
65 IHTMLStyleSheetRule IHTMLStyleSheetRule_iface
;
69 nsIDOMCSSRule
*nsstylesheetrule
;
72 static inline HTMLStyleSheetRule
*impl_from_IHTMLStyleSheetRule(IHTMLStyleSheetRule
*iface
)
74 return CONTAINING_RECORD(iface
, HTMLStyleSheetRule
, IHTMLStyleSheetRule_iface
);
77 static HRESULT WINAPI
HTMLStyleSheetRule_QueryInterface(IHTMLStyleSheetRule
*iface
,
78 REFIID riid
, void **ppv
)
80 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
82 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
84 if (IsEqualGUID(&IID_IUnknown
, riid
))
85 *ppv
= &This
->IHTMLStyleSheetRule_iface
;
86 else if (IsEqualGUID(&IID_IHTMLStyleSheetRule
, riid
))
87 *ppv
= &This
->IHTMLStyleSheetRule_iface
;
88 else if (dispex_query_interface(&This
->dispex
, riid
, ppv
))
89 return *ppv
? S_OK
: E_NOINTERFACE
;
93 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
97 IUnknown_AddRef((IUnknown
*)*ppv
);
101 static ULONG WINAPI
HTMLStyleSheetRule_AddRef(IHTMLStyleSheetRule
*iface
)
103 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
104 LONG ref
= InterlockedIncrement(&This
->ref
);
106 TRACE("(%p) ref=%d\n", This
, ref
);
111 static ULONG WINAPI
HTMLStyleSheetRule_Release(IHTMLStyleSheetRule
*iface
)
113 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
114 LONG ref
= InterlockedDecrement(&This
->ref
);
116 TRACE("(%p) ref=%d\n", This
, ref
);
119 release_dispex(&This
->dispex
);
120 if(This
->nsstylesheetrule
)
121 nsIDOMCSSRule_Release(This
->nsstylesheetrule
);
128 static HRESULT WINAPI
HTMLStyleSheetRule_GetTypeInfoCount(
129 IHTMLStyleSheetRule
*iface
, UINT
*pctinfo
)
131 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
132 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
135 static HRESULT WINAPI
HTMLStyleSheetRule_GetTypeInfo(IHTMLStyleSheetRule
*iface
,
136 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
138 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
139 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
142 static HRESULT WINAPI
HTMLStyleSheetRule_GetIDsOfNames(IHTMLStyleSheetRule
*iface
,
143 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
145 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
146 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
150 static HRESULT WINAPI
HTMLStyleSheetRule_Invoke(IHTMLStyleSheetRule
*iface
,
151 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
152 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
154 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
155 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
156 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
159 static HRESULT WINAPI
HTMLStyleSheetRule_put_selectorText(IHTMLStyleSheetRule
*iface
, BSTR v
)
161 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
162 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
166 static HRESULT WINAPI
HTMLStyleSheetRule_get_selectorText(IHTMLStyleSheetRule
*iface
, BSTR
*p
)
168 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
169 FIXME("(%p)->(%p)\n", This
, p
);
173 static HRESULT WINAPI
HTMLStyleSheetRule_get_style(IHTMLStyleSheetRule
*iface
, IHTMLRuleStyle
**p
)
175 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
176 FIXME("(%p)->(%p)\n", This
, p
);
180 static HRESULT WINAPI
HTMLStyleSheetRule_get_readOnly(IHTMLStyleSheetRule
*iface
, VARIANT_BOOL
*p
)
182 HTMLStyleSheetRule
*This
= impl_from_IHTMLStyleSheetRule(iface
);
183 FIXME("(%p)->(%p)\n", This
, p
);
187 static const IHTMLStyleSheetRuleVtbl HTMLStyleSheetRuleVtbl
= {
188 HTMLStyleSheetRule_QueryInterface
,
189 HTMLStyleSheetRule_AddRef
,
190 HTMLStyleSheetRule_Release
,
191 HTMLStyleSheetRule_GetTypeInfoCount
,
192 HTMLStyleSheetRule_GetTypeInfo
,
193 HTMLStyleSheetRule_GetIDsOfNames
,
194 HTMLStyleSheetRule_Invoke
,
195 HTMLStyleSheetRule_put_selectorText
,
196 HTMLStyleSheetRule_get_selectorText
,
197 HTMLStyleSheetRule_get_style
,
198 HTMLStyleSheetRule_get_readOnly
201 static const tid_t HTMLStyleSheetRule_iface_tids
[] = {
202 IHTMLStyleSheetRule_tid
,
205 static dispex_static_data_t HTMLStyleSheetRule_dispex
= {
207 DispHTMLStyleSheetRule_tid
,
208 HTMLStyleSheetRule_iface_tids
211 static HRESULT
create_style_sheet_rule(nsIDOMCSSRule
*nsstylesheetrule
, compat_mode_t compat_mode
,
212 IHTMLStyleSheetRule
**ret
)
214 HTMLStyleSheetRule
*rule
;
217 if(!(rule
= heap_alloc(sizeof(*rule
))))
218 return E_OUTOFMEMORY
;
220 rule
->IHTMLStyleSheetRule_iface
.lpVtbl
= &HTMLStyleSheetRuleVtbl
;
222 rule
->nsstylesheetrule
= NULL
;
224 init_dispatch(&rule
->dispex
, (IUnknown
*)&rule
->IHTMLStyleSheetRule_iface
, &HTMLStyleSheetRule_dispex
,
227 if (nsstylesheetrule
)
229 nsres
= nsIDOMCSSRule_QueryInterface(nsstylesheetrule
, &IID_nsIDOMCSSRule
,
230 (void **)&rule
->nsstylesheetrule
);
231 if (NS_FAILED(nsres
))
232 ERR("Could not get nsIDOMCSSRule interface: %08x\n", nsres
);
235 *ret
= &rule
->IHTMLStyleSheetRule_iface
;
239 static inline HTMLStyleSheetRulesCollection
*impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection
*iface
)
241 return CONTAINING_RECORD(iface
, HTMLStyleSheetRulesCollection
, IHTMLStyleSheetRulesCollection_iface
);
244 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection
*iface
,
245 REFIID riid
, void **ppv
)
247 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
249 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
251 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
252 *ppv
= &This
->IHTMLStyleSheetRulesCollection_iface
;
253 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection
, riid
)) {
254 *ppv
= &This
->IHTMLStyleSheetRulesCollection_iface
;
255 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
256 return *ppv
? S_OK
: E_NOINTERFACE
;
259 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
260 return E_NOINTERFACE
;
263 IUnknown_AddRef((IUnknown
*)*ppv
);
267 static ULONG WINAPI
HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection
*iface
)
269 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
270 LONG ref
= InterlockedIncrement(&This
->ref
);
272 TRACE("(%p) ref=%d\n", This
, ref
);
277 static ULONG WINAPI
HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection
*iface
)
279 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
280 LONG ref
= InterlockedDecrement(&This
->ref
);
282 TRACE("(%p) ref=%d\n", This
, ref
);
285 release_dispex(&This
->dispex
);
287 nsIDOMCSSRuleList_Release(This
->nslist
);
294 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfoCount(
295 IHTMLStyleSheetRulesCollection
*iface
, UINT
*pctinfo
)
297 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
298 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
301 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection
*iface
,
302 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
304 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
305 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
308 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection
*iface
,
309 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
311 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
312 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
316 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection
*iface
,
317 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
318 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
320 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
321 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
322 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
325 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection
*iface
,
328 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
331 TRACE("(%p)->(%p)\n", This
, p
);
336 nsres
= nsIDOMCSSRuleList_GetLength(This
->nslist
, &len
);
338 ERR("GetLength failed: %08x\n", nsres
);
345 static HRESULT WINAPI
HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection
*iface
,
346 LONG index
, IHTMLStyleSheetRule
**p
)
348 HTMLStyleSheetRulesCollection
*This
= impl_from_IHTMLStyleSheetRulesCollection(iface
);
349 nsIDOMCSSRule
*nsstylesheetrule
;
352 TRACE("(%p)->(%d %p)\n", This
, index
, p
);
354 nsres
= nsIDOMCSSRuleList_Item(This
->nslist
, index
, &nsstylesheetrule
);
356 return map_nsresult(nsres
);
357 if(!nsstylesheetrule
)
360 return create_style_sheet_rule(nsstylesheetrule
, dispex_compat_mode(&This
->dispex
), p
);
363 static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl
= {
364 HTMLStyleSheetRulesCollection_QueryInterface
,
365 HTMLStyleSheetRulesCollection_AddRef
,
366 HTMLStyleSheetRulesCollection_Release
,
367 HTMLStyleSheetRulesCollection_GetTypeInfoCount
,
368 HTMLStyleSheetRulesCollection_GetTypeInfo
,
369 HTMLStyleSheetRulesCollection_GetIDsOfNames
,
370 HTMLStyleSheetRulesCollection_Invoke
,
371 HTMLStyleSheetRulesCollection_get_length
,
372 HTMLStyleSheetRulesCollection_item
375 static const tid_t HTMLStyleSheetRulesCollection_iface_tids
[] = {
376 IHTMLStyleSheetRulesCollection_tid
,
379 static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex
= {
381 DispHTMLStyleSheetRulesCollection_tid
,
382 HTMLStyleSheetRulesCollection_iface_tids
385 static HRESULT
create_style_sheet_rules_collection(nsIDOMCSSRuleList
*nslist
, compat_mode_t compat_mode
,
386 IHTMLStyleSheetRulesCollection
**ret
)
388 HTMLStyleSheetRulesCollection
*collection
;
390 if(!(collection
= heap_alloc(sizeof(*collection
))))
391 return E_OUTOFMEMORY
;
393 collection
->IHTMLStyleSheetRulesCollection_iface
.lpVtbl
= &HTMLStyleSheetRulesCollectionVtbl
;
395 collection
->nslist
= nslist
;
397 init_dispatch(&collection
->dispex
, (IUnknown
*)&collection
->IHTMLStyleSheetRulesCollection_iface
,
398 &HTMLStyleSheetRulesCollection_dispex
, compat_mode
);
401 nsIDOMCSSRuleList_AddRef(nslist
);
403 *ret
= &collection
->IHTMLStyleSheetRulesCollection_iface
;
407 static inline HTMLStyleSheetsCollection
*impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection
*iface
)
409 return CONTAINING_RECORD(iface
, HTMLStyleSheetsCollection
, IHTMLStyleSheetsCollection_iface
);
412 static HRESULT WINAPI
HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection
*iface
,
413 REFIID riid
, void **ppv
)
415 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
417 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
419 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
420 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
421 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
422 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
423 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection
, riid
)) {
424 *ppv
= &This
->IHTMLStyleSheetsCollection_iface
;
425 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
426 return *ppv
? S_OK
: E_NOINTERFACE
;
429 WARN("unsupported %s\n", debugstr_mshtml_guid(riid
));
430 return E_NOINTERFACE
;
433 IUnknown_AddRef((IUnknown
*)*ppv
);
437 static ULONG WINAPI
HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection
*iface
)
439 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
440 LONG ref
= InterlockedIncrement(&This
->ref
);
442 TRACE("(%p) ref=%d\n", This
, ref
);
447 static ULONG WINAPI
HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection
*iface
)
449 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
450 LONG ref
= InterlockedDecrement(&This
->ref
);
452 TRACE("(%p) ref=%d\n", This
, ref
);
455 release_dispex(&This
->dispex
);
457 nsIDOMStyleSheetList_Release(This
->nslist
);
464 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection
*iface
,
467 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
468 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
471 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection
*iface
,
472 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
474 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
475 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
478 static HRESULT WINAPI
HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection
*iface
,
479 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
481 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
482 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
486 static HRESULT WINAPI
HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection
*iface
,
487 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
488 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
490 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
491 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
492 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
495 static HRESULT WINAPI
HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection
*iface
,
498 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
501 TRACE("(%p)->(%p)\n", This
, p
);
504 nsIDOMStyleSheetList_GetLength(This
->nslist
, &len
);
510 static HRESULT WINAPI
HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection
*iface
,
513 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
514 FIXME("(%p)->(%p)\n", This
, p
);
518 static HRESULT WINAPI
HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection
*iface
,
519 VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
521 HTMLStyleSheetsCollection
*This
= impl_from_IHTMLStyleSheetsCollection(iface
);
523 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarIndex
), pvarResult
);
525 switch(V_VT(pvarIndex
)) {
527 nsIDOMStyleSheet
*nsstylesheet
;
528 IHTMLStyleSheet
*stylesheet
;
532 TRACE("index=%d\n", V_I4(pvarIndex
));
534 nsres
= nsIDOMStyleSheetList_Item(This
->nslist
, V_I4(pvarIndex
), &nsstylesheet
);
535 if(NS_FAILED(nsres
) || !nsstylesheet
) {
536 WARN("Item failed: %08x\n", nsres
);
537 V_VT(pvarResult
) = VT_EMPTY
;
541 hres
= create_style_sheet(nsstylesheet
, dispex_compat_mode(&This
->dispex
), &stylesheet
);
545 V_VT(pvarResult
) = VT_DISPATCH
;
546 V_DISPATCH(pvarResult
) = (IDispatch
*)stylesheet
;
551 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult
)));
555 WARN("Invalid index %s\n", debugstr_variant(pvarIndex
));
561 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl
= {
562 HTMLStyleSheetsCollection_QueryInterface
,
563 HTMLStyleSheetsCollection_AddRef
,
564 HTMLStyleSheetsCollection_Release
,
565 HTMLStyleSheetsCollection_GetTypeInfoCount
,
566 HTMLStyleSheetsCollection_GetTypeInfo
,
567 HTMLStyleSheetsCollection_GetIDsOfNames
,
568 HTMLStyleSheetsCollection_Invoke
,
569 HTMLStyleSheetsCollection_get_length
,
570 HTMLStyleSheetsCollection_get__newEnum
,
571 HTMLStyleSheetsCollection_item
574 static const tid_t HTMLStyleSheetsCollection_iface_tids
[] = {
575 IHTMLStyleSheetsCollection_tid
,
578 static dispex_static_data_t HTMLStyleSheetsCollection_dispex
= {
580 DispHTMLStyleSheetsCollection_tid
,
581 HTMLStyleSheetsCollection_iface_tids
584 HRESULT
create_style_sheet_collection(nsIDOMStyleSheetList
*nslist
, compat_mode_t compat_mode
,
585 IHTMLStyleSheetsCollection
**ret
)
587 HTMLStyleSheetsCollection
*collection
;
589 if(!(collection
= heap_alloc(sizeof(HTMLStyleSheetsCollection
))))
590 return E_OUTOFMEMORY
;
592 collection
->IHTMLStyleSheetsCollection_iface
.lpVtbl
= &HTMLStyleSheetsCollectionVtbl
;
596 nsIDOMStyleSheetList_AddRef(nslist
);
597 collection
->nslist
= nslist
;
599 init_dispatch(&collection
->dispex
, (IUnknown
*)&collection
->IHTMLStyleSheetsCollection_iface
,
600 &HTMLStyleSheetsCollection_dispex
, compat_mode
);
602 *ret
= &collection
->IHTMLStyleSheetsCollection_iface
;
606 static inline HTMLStyleSheet
*impl_from_IHTMLStyleSheet(IHTMLStyleSheet
*iface
)
608 return CONTAINING_RECORD(iface
, HTMLStyleSheet
, IHTMLStyleSheet_iface
);
611 static HRESULT WINAPI
HTMLStyleSheet_QueryInterface(IHTMLStyleSheet
*iface
, REFIID riid
, void **ppv
)
613 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
615 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
617 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
618 *ppv
= &This
->IHTMLStyleSheet_iface
;
619 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
620 *ppv
= &This
->IHTMLStyleSheet_iface
;
621 }else if(IsEqualGUID(&IID_IHTMLStyleSheet
, riid
)) {
622 *ppv
= &This
->IHTMLStyleSheet_iface
;
623 }else if(IsEqualGUID(&IID_IHTMLStyleSheet4
, riid
)) {
624 *ppv
= &This
->IHTMLStyleSheet4_iface
;
625 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
626 return *ppv
? S_OK
: E_NOINTERFACE
;
629 WARN("unsupported %s\n", debugstr_mshtml_guid(riid
));
630 return E_NOINTERFACE
;
633 IUnknown_AddRef((IUnknown
*)*ppv
);
637 static ULONG WINAPI
HTMLStyleSheet_AddRef(IHTMLStyleSheet
*iface
)
639 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
640 LONG ref
= InterlockedIncrement(&This
->ref
);
642 TRACE("(%p) ref=%d\n", This
, ref
);
647 static ULONG WINAPI
HTMLStyleSheet_Release(IHTMLStyleSheet
*iface
)
649 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
650 LONG ref
= InterlockedDecrement(&This
->ref
);
652 TRACE("(%p) ref=%d\n", This
, ref
);
655 release_dispex(&This
->dispex
);
656 if(This
->nsstylesheet
)
657 nsIDOMCSSStyleSheet_Release(This
->nsstylesheet
);
664 static HRESULT WINAPI
HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet
*iface
, UINT
*pctinfo
)
666 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
667 TRACE("(%p)->(%p)\n", This
, pctinfo
);
668 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
671 static HRESULT WINAPI
HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet
*iface
, UINT iTInfo
,
672 LCID lcid
, ITypeInfo
**ppTInfo
)
674 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
675 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
678 static HRESULT WINAPI
HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet
*iface
, REFIID riid
,
679 LPOLESTR
*rgszNames
, UINT cNames
,
680 LCID lcid
, DISPID
*rgDispId
)
682 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
683 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
686 static HRESULT WINAPI
HTMLStyleSheet_Invoke(IHTMLStyleSheet
*iface
, DISPID dispIdMember
,
687 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
688 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
690 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
691 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
692 pVarResult
, pExcepInfo
, puArgErr
);
695 static HRESULT WINAPI
HTMLStyleSheet_put_title(IHTMLStyleSheet
*iface
, BSTR v
)
697 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
698 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
702 static HRESULT WINAPI
HTMLStyleSheet_get_title(IHTMLStyleSheet
*iface
, BSTR
*p
)
704 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
705 FIXME("(%p)->(%p)\n", This
, p
);
709 static HRESULT WINAPI
HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet
*iface
,
712 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
713 FIXME("(%p)->(%p)\n", This
, p
);
717 static HRESULT WINAPI
HTMLStyleSheet_get_owningElement(IHTMLStyleSheet
*iface
, IHTMLElement
**p
)
719 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
720 FIXME("(%p)->(%p)\n", This
, p
);
724 static HRESULT WINAPI
HTMLStyleSheet_put_disabled(IHTMLStyleSheet
*iface
, VARIANT_BOOL v
)
726 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
727 FIXME("(%p)->(%x)\n", This
, v
);
731 static HRESULT WINAPI
HTMLStyleSheet_get_disabled(IHTMLStyleSheet
*iface
, VARIANT_BOOL
*p
)
733 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
734 FIXME("(%p)->(%p)\n", This
, p
);
738 static HRESULT WINAPI
HTMLStyleSheet_get_readOnly(IHTMLStyleSheet
*iface
, VARIANT_BOOL
*p
)
740 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
741 FIXME("(%p)->(%p)\n", This
, p
);
745 static HRESULT WINAPI
HTMLStyleSheet_get_imports(IHTMLStyleSheet
*iface
,
746 IHTMLStyleSheetsCollection
**p
)
748 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
749 FIXME("(%p)->(%p)\n", This
, p
);
753 static HRESULT WINAPI
HTMLStyleSheet_put_href(IHTMLStyleSheet
*iface
, BSTR v
)
755 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
756 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
760 static HRESULT WINAPI
HTMLStyleSheet_get_href(IHTMLStyleSheet
*iface
, BSTR
*p
)
762 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
766 TRACE("(%p)->(%p)\n", This
, p
);
768 nsAString_Init(&href_str
, NULL
);
769 nsres
= nsIDOMCSSStyleSheet_GetHref(This
->nsstylesheet
, &href_str
);
770 return return_nsstr(nsres
, &href_str
, p
);
773 static HRESULT WINAPI
HTMLStyleSheet_get_type(IHTMLStyleSheet
*iface
, BSTR
*p
)
775 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
776 FIXME("(%p)->(%p)\n", This
, p
);
780 static HRESULT WINAPI
HTMLStyleSheet_get_id(IHTMLStyleSheet
*iface
, BSTR
*p
)
782 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
783 FIXME("(%p)->(%p)\n", This
, p
);
787 static HRESULT WINAPI
HTMLStyleSheet_addImport(IHTMLStyleSheet
*iface
, BSTR bstrURL
,
788 LONG lIndex
, LONG
*plIndex
)
790 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
791 FIXME("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrURL
), lIndex
, plIndex
);
795 static HRESULT WINAPI
HTMLStyleSheet_addRule(IHTMLStyleSheet
*iface
, BSTR bstrSelector
,
796 BSTR bstrStyle
, LONG lIndex
, LONG
*plIndex
)
798 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
799 FIXME("(%p)->(%s %s %d %p)\n", This
, debugstr_w(bstrSelector
), debugstr_w(bstrStyle
),
804 static HRESULT WINAPI
HTMLStyleSheet_removeImport(IHTMLStyleSheet
*iface
, LONG lIndex
)
806 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
807 FIXME("(%p)->(%d)\n", This
, lIndex
);
811 static HRESULT WINAPI
HTMLStyleSheet_removeRule(IHTMLStyleSheet
*iface
, LONG lIndex
)
813 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
814 FIXME("(%p)->(%d)\n", This
, lIndex
);
818 static HRESULT WINAPI
HTMLStyleSheet_put_media(IHTMLStyleSheet
*iface
, BSTR v
)
820 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
821 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
825 static HRESULT WINAPI
HTMLStyleSheet_get_media(IHTMLStyleSheet
*iface
, BSTR
*p
)
827 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
828 FIXME("(%p)->(%p)\n", This
, p
);
832 static HRESULT WINAPI
HTMLStyleSheet_put_cssText(IHTMLStyleSheet
*iface
, BSTR v
)
834 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
837 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
840 nsres
= nsIDOMCSSStyleSheet_DeleteRule(This
->nsstylesheet
, 0);
841 }while(NS_SUCCEEDED(nsres
));
847 /* FIXME: This won't work for multiple rules in the string. */
848 nsAString_InitDepend(&nsstr
, v
);
849 nsres
= nsIDOMCSSStyleSheet_InsertRule(This
->nsstylesheet
, &nsstr
, 0, &idx
);
850 nsAString_Finish(&nsstr
);
851 if(NS_FAILED(nsres
)) {
852 FIXME("InsertRule failed for string %s. Probably multiple rules passed.\n", debugstr_w(v
));
860 static HRESULT WINAPI
HTMLStyleSheet_get_cssText(IHTMLStyleSheet
*iface
, BSTR
*p
)
862 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
863 nsIDOMCSSRuleList
*nslist
= NULL
;
864 nsIDOMCSSRule
*nsrule
;
869 TRACE("(%p)->(%p)\n", This
, p
);
871 nsres
= nsIDOMCSSStyleSheet_GetCssRules(This
->nsstylesheet
, &nslist
);
872 if(NS_FAILED(nsres
)) {
873 ERR("GetCssRules failed: %08x\n", nsres
);
877 nsres
= nsIDOMCSSRuleList_GetLength(nslist
, &len
);
878 assert(nsres
== NS_OK
);
881 nsres
= nsIDOMCSSRuleList_Item(nslist
, 0, &nsrule
);
883 ERR("Item failed: %08x\n", nsres
);
886 nsIDOMCSSRuleList_Release(nslist
);
895 nsAString_Init(&nsstr
, NULL
);
896 nsres
= nsIDOMCSSRule_GetCssText(nsrule
, &nsstr
);
897 nsIDOMCSSRule_Release(nsrule
);
898 return return_nsstr(nsres
, &nsstr
, p
);
901 static HRESULT WINAPI
HTMLStyleSheet_get_rules(IHTMLStyleSheet
*iface
,
902 IHTMLStyleSheetRulesCollection
**p
)
904 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet(iface
);
905 nsIDOMCSSRuleList
*nslist
= NULL
;
909 TRACE("(%p)->(%p)\n", This
, p
);
911 nsres
= nsIDOMCSSStyleSheet_GetCssRules(This
->nsstylesheet
, &nslist
);
912 if(NS_FAILED(nsres
)) {
913 ERR("GetCssRules failed: %08x\n", nsres
);
917 hres
= create_style_sheet_rules_collection(nslist
, dispex_compat_mode(&This
->dispex
), p
);
918 nsIDOMCSSRuleList_Release(nslist
);
922 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl
= {
923 HTMLStyleSheet_QueryInterface
,
924 HTMLStyleSheet_AddRef
,
925 HTMLStyleSheet_Release
,
926 HTMLStyleSheet_GetTypeInfoCount
,
927 HTMLStyleSheet_GetTypeInfo
,
928 HTMLStyleSheet_GetIDsOfNames
,
929 HTMLStyleSheet_Invoke
,
930 HTMLStyleSheet_put_title
,
931 HTMLStyleSheet_get_title
,
932 HTMLStyleSheet_get_parentStyleSheet
,
933 HTMLStyleSheet_get_owningElement
,
934 HTMLStyleSheet_put_disabled
,
935 HTMLStyleSheet_get_disabled
,
936 HTMLStyleSheet_get_readOnly
,
937 HTMLStyleSheet_get_imports
,
938 HTMLStyleSheet_put_href
,
939 HTMLStyleSheet_get_href
,
940 HTMLStyleSheet_get_type
,
941 HTMLStyleSheet_get_id
,
942 HTMLStyleSheet_addImport
,
943 HTMLStyleSheet_addRule
,
944 HTMLStyleSheet_removeImport
,
945 HTMLStyleSheet_removeRule
,
946 HTMLStyleSheet_put_media
,
947 HTMLStyleSheet_get_media
,
948 HTMLStyleSheet_put_cssText
,
949 HTMLStyleSheet_get_cssText
,
950 HTMLStyleSheet_get_rules
953 static inline HTMLStyleSheet
*impl_from_IHTMLStyleSheet4(IHTMLStyleSheet4
*iface
)
955 return CONTAINING_RECORD(iface
, HTMLStyleSheet
, IHTMLStyleSheet4_iface
);
958 static HRESULT WINAPI
HTMLStyleSheet4_QueryInterface(IHTMLStyleSheet4
*iface
, REFIID riid
, void **ppv
)
960 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
961 return IHTMLStyleSheet_QueryInterface(&This
->IHTMLStyleSheet_iface
, riid
, ppv
);
964 static ULONG WINAPI
HTMLStyleSheet4_AddRef(IHTMLStyleSheet4
*iface
)
966 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
967 return IHTMLStyleSheet_AddRef(&This
->IHTMLStyleSheet_iface
);
970 static ULONG WINAPI
HTMLStyleSheet4_Release(IHTMLStyleSheet4
*iface
)
972 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
973 return IHTMLStyleSheet_Release(&This
->IHTMLStyleSheet_iface
);
976 static HRESULT WINAPI
HTMLStyleSheet4_GetTypeInfoCount(IHTMLStyleSheet4
*iface
, UINT
*pctinfo
)
978 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
979 TRACE("(%p)->(%p)\n", This
, pctinfo
);
980 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
983 static HRESULT WINAPI
HTMLStyleSheet4_GetTypeInfo(IHTMLStyleSheet4
*iface
, UINT iTInfo
,
984 LCID lcid
, ITypeInfo
**ppTInfo
)
986 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
987 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
990 static HRESULT WINAPI
HTMLStyleSheet4_GetIDsOfNames(IHTMLStyleSheet4
*iface
, REFIID riid
,
991 LPOLESTR
*rgszNames
, UINT cNames
,
992 LCID lcid
, DISPID
*rgDispId
)
994 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
995 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
998 static HRESULT WINAPI
HTMLStyleSheet4_Invoke(IHTMLStyleSheet4
*iface
, DISPID dispIdMember
,
999 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1000 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1002 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1003 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1004 pVarResult
, pExcepInfo
, puArgErr
);
1007 static HRESULT WINAPI
HTMLStyleSheet4_get_type(IHTMLStyleSheet4
*iface
, BSTR
*p
)
1009 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1010 TRACE("(%p)->(%p)\n", This
, p
);
1011 return IHTMLStyleSheet_get_type(&This
->IHTMLStyleSheet_iface
, p
);
1014 static HRESULT WINAPI
HTMLStyleSheet4_get_href(IHTMLStyleSheet4
*iface
, VARIANT
*p
)
1016 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1020 TRACE("(%p)->(%p)\n", This
, p
);
1022 nsAString_Init(&href_str
, NULL
);
1023 nsres
= nsIDOMCSSStyleSheet_GetHref(This
->nsstylesheet
, &href_str
);
1024 return return_nsstr_variant(nsres
, &href_str
, 0, p
);
1027 static HRESULT WINAPI
HTMLStyleSheet4_get_title(IHTMLStyleSheet4
*iface
, BSTR
*p
)
1029 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1030 FIXME("(%p)->(%p)\n", This
, p
);
1034 static HRESULT WINAPI
HTMLStyleSheet4_get_ownerNode(IHTMLStyleSheet4
*iface
, IHTMLElement
**p
)
1036 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1037 FIXME("(%p)->(%p)\n", This
, p
);
1041 static HRESULT WINAPI
HTMLStyleSheet4_get_ownerRule(IHTMLStyleSheet4
*iface
, IHTMLCSSRule
**p
)
1043 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1044 FIXME("(%p)->(%p)\n", This
, p
);
1048 static HRESULT WINAPI
HTMLStyleSheet4_get_cssRules(IHTMLStyleSheet4
*iface
, IHTMLStyleSheetRulesCollection
**p
)
1050 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1051 TRACE("(%p)->(%p)\n", This
, p
);
1052 return IHTMLStyleSheet_get_rules(&This
->IHTMLStyleSheet_iface
, p
);
1055 static HRESULT WINAPI
HTMLStyleSheet4_get_media(IHTMLStyleSheet4
*iface
, VARIANT
*p
)
1057 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1058 FIXME("(%p)->(%p)\n", This
, p
);
1062 static HRESULT WINAPI
HTMLStyleSheet4_insertRule(IHTMLStyleSheet4
*iface
, BSTR rule
, LONG index
, LONG
*p
)
1064 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1065 UINT32 new_index
= 0;
1069 TRACE("(%p)->(%s %d %p)\n", This
, debugstr_w(rule
), index
, p
);
1071 nsAString_InitDepend(&nsstr
, rule
);
1072 nsres
= nsIDOMCSSStyleSheet_InsertRule(This
->nsstylesheet
, &nsstr
, index
, &new_index
);
1073 if(NS_FAILED(nsres
)) WARN("failed: %08x\n", nsres
);
1074 nsAString_Finish(&nsstr
);
1076 return map_nsresult(nsres
);
1079 static HRESULT WINAPI
HTMLStyleSheet4_deleteRule(IHTMLStyleSheet4
*iface
, LONG index
)
1081 HTMLStyleSheet
*This
= impl_from_IHTMLStyleSheet4(iface
);
1082 FIXME("(%p)->(%d)\n", This
, index
);
1086 static const IHTMLStyleSheet4Vtbl HTMLStyleSheet4Vtbl
= {
1087 HTMLStyleSheet4_QueryInterface
,
1088 HTMLStyleSheet4_AddRef
,
1089 HTMLStyleSheet4_Release
,
1090 HTMLStyleSheet4_GetTypeInfoCount
,
1091 HTMLStyleSheet4_GetTypeInfo
,
1092 HTMLStyleSheet4_GetIDsOfNames
,
1093 HTMLStyleSheet4_Invoke
,
1094 HTMLStyleSheet4_get_type
,
1095 HTMLStyleSheet4_get_href
,
1096 HTMLStyleSheet4_get_title
,
1097 HTMLStyleSheet4_get_ownerNode
,
1098 HTMLStyleSheet4_get_ownerRule
,
1099 HTMLStyleSheet4_get_cssRules
,
1100 HTMLStyleSheet4_get_media
,
1101 HTMLStyleSheet4_insertRule
,
1102 HTMLStyleSheet4_deleteRule
,
1105 static void HTMLStyleSheet_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
1107 if(mode
>= COMPAT_MODE_IE9
)
1108 dispex_info_add_interface(info
, IHTMLStyleSheet4_tid
, NULL
);
1111 static const tid_t HTMLStyleSheet_iface_tids
[] = {
1112 IHTMLStyleSheet_tid
,
1115 static dispex_static_data_t HTMLStyleSheet_dispex
= {
1117 DispHTMLStyleSheet_tid
,
1118 HTMLStyleSheet_iface_tids
,
1119 HTMLStyleSheet_init_dispex_info
1122 HRESULT
create_style_sheet(nsIDOMStyleSheet
*nsstylesheet
, compat_mode_t compat_mode
, IHTMLStyleSheet
**ret
)
1124 HTMLStyleSheet
*style_sheet
;
1127 if(!(style_sheet
= heap_alloc(sizeof(HTMLStyleSheet
))))
1128 return E_OUTOFMEMORY
;
1130 style_sheet
->IHTMLStyleSheet_iface
.lpVtbl
= &HTMLStyleSheetVtbl
;
1131 style_sheet
->IHTMLStyleSheet4_iface
.lpVtbl
= &HTMLStyleSheet4Vtbl
;
1132 style_sheet
->ref
= 1;
1133 style_sheet
->nsstylesheet
= NULL
;
1135 init_dispatch(&style_sheet
->dispex
, (IUnknown
*)&style_sheet
->IHTMLStyleSheet_iface
,
1136 &HTMLStyleSheet_dispex
, compat_mode
);
1139 nsres
= nsIDOMStyleSheet_QueryInterface(nsstylesheet
, &IID_nsIDOMCSSStyleSheet
,
1140 (void**)&style_sheet
->nsstylesheet
);
1141 if(NS_FAILED(nsres
))
1142 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres
);
1145 *ret
= &style_sheet
->IHTMLStyleSheet_iface
;