ReactOS 0.4.15-dev-8191-gbc6c731
htmlstylesheet.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "mshtml_private.h"
20
23 IHTMLStyleSheet IHTMLStyleSheet_iface;
24
26
28};
29
32 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface;
33
35
37};
38
41 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface;
42
44
46};
47
48static inline HTMLStyleSheetRulesCollection *impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface)
49{
50 return CONTAINING_RECORD(iface, HTMLStyleSheetRulesCollection, IHTMLStyleSheetRulesCollection_iface);
51}
52
53static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface,
54 REFIID riid, void **ppv)
55{
57
58 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
59
61 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
62 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection, riid)) {
63 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
64 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
65 return *ppv ? S_OK : E_NOINTERFACE;
66 }else {
67 *ppv = NULL;
68 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
69 return E_NOINTERFACE;
70 }
71
72 IUnknown_AddRef((IUnknown*)*ppv);
73 return S_OK;
74}
75
76static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
77{
80
81 TRACE("(%p) ref=%d\n", This, ref);
82
83 return ref;
84}
85
86static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
87{
90
91 TRACE("(%p) ref=%d\n", This, ref);
92
93 if(!ref) {
94 release_dispex(&This->dispex);
95 if(This->nslist)
96 nsIDOMCSSRuleList_Release(This->nslist);
98 }
99
100 return ref;
101}
102
104 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
105{
107 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
108}
109
110static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface,
111 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
112{
114 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
115}
116
117static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface,
118 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
119{
121 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
122 lcid, rgDispId);
123}
124
125static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection *iface,
126 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
127 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
128{
130 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
131 pDispParams, pVarResult, pExcepInfo, puArgErr);
132}
133
134static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
135 LONG *p)
136{
138 UINT32 len = 0;
139
140 TRACE("(%p)->(%p)\n", This, p);
141
142 if(This->nslist) {
143 nsresult nsres;
144
145 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
146 if(NS_FAILED(nsres))
147 ERR("GetLength failed: %08x\n", nsres);
148 }
149
150 *p = len;
151 return S_OK;
152}
153
154static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
155 LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
156{
158 FIXME("(%p)->(%d %p)\n", This, index, ppHTMLStyleSheetRule);
159 return E_NOTIMPL;
160}
161
162static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl = {
172};
173
175 IHTMLStyleSheetRulesCollection_tid,
176 0
177};
179 NULL,
180 DispHTMLStyleSheetRulesCollection_tid,
181 NULL,
183};
184
185static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
186{
188
189 ret = heap_alloc(sizeof(*ret));
190 ret->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl;
191 ret->ref = 1;
192 ret->nslist = nslist;
193
194 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetRulesCollection_iface, &HTMLStyleSheetRulesCollection_dispex);
195
196 if(nslist)
197 nsIDOMCSSRuleList_AddRef(nslist);
198
199 return &ret->IHTMLStyleSheetRulesCollection_iface;
200}
201
202static inline HTMLStyleSheetsCollection *impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection *iface)
203{
204 return CONTAINING_RECORD(iface, HTMLStyleSheetsCollection, IHTMLStyleSheetsCollection_iface);
205}
206
207static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
208 REFIID riid, void **ppv)
209{
211
212 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
213
215 *ppv = &This->IHTMLStyleSheetsCollection_iface;
216 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
217 *ppv = &This->IHTMLStyleSheetsCollection_iface;
218 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
219 *ppv = &This->IHTMLStyleSheetsCollection_iface;
220 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
221 return *ppv ? S_OK : E_NOINTERFACE;
222 }else {
223 *ppv = NULL;
224 WARN("unsupported %s\n", debugstr_mshtml_guid(riid));
225 return E_NOINTERFACE;
226 }
227
228 IUnknown_AddRef((IUnknown*)*ppv);
229 return S_OK;
230}
231
232static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
233{
236
237 TRACE("(%p) ref=%d\n", This, ref);
238
239 return ref;
240}
241
242static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
243{
246
247 TRACE("(%p) ref=%d\n", This, ref);
248
249 if(!ref) {
250 release_dispex(&This->dispex);
251 if(This->nslist)
252 nsIDOMStyleSheetList_Release(This->nslist);
254 }
255
256 return ref;
257}
258
259static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
260 UINT *pctinfo)
261{
263 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
264}
265
266static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
267 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
268{
270 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
271}
272
273static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
274 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
275{
277 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
278 lcid, rgDispId);
279}
280
281static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
282 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
283 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
284{
286 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
287 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
288}
289
290static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
291 LONG *p)
292{
294 UINT32 len = 0;
295
296 TRACE("(%p)->(%p)\n", This, p);
297
298 if(This->nslist)
299 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
300
301 *p = len;
302 return S_OK;
303}
304
305static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
306 IUnknown **p)
307{
309 FIXME("(%p)->(%p)\n", This, p);
310 return E_NOTIMPL;
311}
312
313static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
314 VARIANT *pvarIndex, VARIANT *pvarResult)
315{
317
318 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarIndex), pvarResult);
319
320 switch(V_VT(pvarIndex)) {
321 case VT_I4: {
322 nsIDOMStyleSheet *nsstylesheet;
323 nsresult nsres;
324
325 TRACE("index=%d\n", V_I4(pvarIndex));
326
327 nsres = nsIDOMStyleSheetList_Item(This->nslist, V_I4(pvarIndex), &nsstylesheet);
328 if(NS_FAILED(nsres) || !nsstylesheet) {
329 WARN("Item failed: %08x\n", nsres);
330 V_VT(pvarResult) = VT_EMPTY;
331 return E_INVALIDARG;
332 }
333
334 V_VT(pvarResult) = VT_DISPATCH;
335 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
336
337 return S_OK;
338 }
339
340 case VT_BSTR:
341 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
342 return E_NOTIMPL;
343
344 default:
345 WARN("Invalid index %s\n", debugstr_variant(pvarIndex));
346 }
347
348 return E_INVALIDARG;
349}
350
351static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
362};
363
365 IHTMLStyleSheetsCollection_tid,
366 0
367};
369 NULL,
370 DispHTMLStyleSheetsCollection_tid,
371 NULL,
373};
374
375IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
376{
378
379 ret->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl;
380 ret->ref = 1;
381
382 if(nslist)
383 nsIDOMStyleSheetList_AddRef(nslist);
384 ret->nslist = nslist;
385
386 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetsCollection_iface,
388
389 return &ret->IHTMLStyleSheetsCollection_iface;
390}
391
392static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)
393{
394 return CONTAINING_RECORD(iface, HTMLStyleSheet, IHTMLStyleSheet_iface);
395}
396
397static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
398{
400
401 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
402
404 *ppv = &This->IHTMLStyleSheet_iface;
405 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
406 *ppv = &This->IHTMLStyleSheet_iface;
407 }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) {
408 *ppv = &This->IHTMLStyleSheet_iface;
409 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
410 return *ppv ? S_OK : E_NOINTERFACE;
411 }else {
412 *ppv = NULL;
413 WARN("unsupported %s\n", debugstr_mshtml_guid(riid));
414 return E_NOINTERFACE;
415 }
416
417 IUnknown_AddRef((IUnknown*)*ppv);
418 return S_OK;
419}
420
421static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
422{
425
426 TRACE("(%p) ref=%d\n", This, ref);
427
428 return ref;
429}
430
431static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
432{
435
436 TRACE("(%p) ref=%d\n", This, ref);
437
438 if(!ref) {
439 release_dispex(&This->dispex);
440 if(This->nsstylesheet)
441 nsIDOMCSSStyleSheet_Release(This->nsstylesheet);
443 }
444
445 return ref;
446}
447
448static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
449{
451 TRACE("(%p)->(%p)\n", This, pctinfo);
452 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
453}
454
455static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
456 LCID lcid, ITypeInfo **ppTInfo)
457{
459 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
460}
461
463 LPOLESTR *rgszNames, UINT cNames,
464 LCID lcid, DISPID *rgDispId)
465{
467 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
468}
469
470static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
471 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
472 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
473{
475 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams,
476 pVarResult, pExcepInfo, puArgErr);
477}
478
479static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
480{
482 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
483 return E_NOTIMPL;
484}
485
486static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
487{
489 FIXME("(%p)->(%p)\n", This, p);
490 return E_NOTIMPL;
491}
492
494 IHTMLStyleSheet **p)
495{
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
499}
500
501static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
502{
504 FIXME("(%p)->(%p)\n", This, p);
505 return E_NOTIMPL;
506}
507
509{
511 FIXME("(%p)->(%x)\n", This, v);
512 return E_NOTIMPL;
513}
514
516{
518 FIXME("(%p)->(%p)\n", This, p);
519 return E_NOTIMPL;
520}
521
523{
525 FIXME("(%p)->(%p)\n", This, p);
526 return E_NOTIMPL;
527}
528
529static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
530 IHTMLStyleSheetsCollection **p)
531{
533 FIXME("(%p)->(%p)\n", This, p);
534 return E_NOTIMPL;
535}
536
537static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
538{
540 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
541 return E_NOTIMPL;
542}
543
544static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
545{
547 nsAString href_str;
548 nsresult nsres;
549
550 TRACE("(%p)->(%p)\n", This, p);
551
552 nsAString_Init(&href_str, NULL);
553 nsres = nsIDOMCSSStyleSheet_GetHref(This->nsstylesheet, &href_str);
554 return return_nsstr(nsres, &href_str, p);
555}
556
557static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
558{
560 FIXME("(%p)->(%p)\n", This, p);
561 return E_NOTIMPL;
562}
563
564static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
565{
567 FIXME("(%p)->(%p)\n", This, p);
568 return E_NOTIMPL;
569}
570
571static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
572 LONG lIndex, LONG *plIndex)
573{
575 FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
576 return E_NOTIMPL;
577}
578
579static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
580 BSTR bstrStyle, LONG lIndex, LONG *plIndex)
581{
583 FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
584 lIndex, plIndex);
585 return E_NOTIMPL;
586}
587
588static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
589{
591 FIXME("(%p)->(%d)\n", This, lIndex);
592 return E_NOTIMPL;
593}
594
595static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
596{
598 FIXME("(%p)->(%d)\n", This, lIndex);
599 return E_NOTIMPL;
600}
601
602static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
603{
605 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
606 return E_NOTIMPL;
607}
608
609static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
610{
612 FIXME("(%p)->(%p)\n", This, p);
613 return E_NOTIMPL;
614}
615
616static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
617{
619 nsresult nsres;
620
621 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
622
623 do {
624 nsres = nsIDOMCSSStyleSheet_DeleteRule(This->nsstylesheet, 0);
625 }while(NS_SUCCEEDED(nsres));
626
627 if(v && *v) {
628 nsAString nsstr;
629 UINT32 idx;
630
631 /* FIXME: This won't work for multiple rules in the string. */
632 nsAString_InitDepend(&nsstr, v);
633 nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, 0, &idx);
634 nsAString_Finish(&nsstr);
635 if(NS_FAILED(nsres)) {
636 FIXME("InsertRule failed for string %s. Probably multiple rules passed.\n", debugstr_w(v));
637 return E_FAIL;
638 }
639 }
640
641 return S_OK;
642}
643
644static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
645{
647 nsIDOMCSSRuleList *nslist = NULL;
648 nsIDOMCSSRule *nsrule;
649 nsAString nsstr;
650 UINT32 len;
651 nsresult nsres;
652
653 TRACE("(%p)->(%p)\n", This, p);
654
655 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
656 if(NS_FAILED(nsres)) {
657 ERR("GetCssRules failed: %08x\n", nsres);
658 return E_FAIL;
659 }
660
661 nsres = nsIDOMCSSRuleList_GetLength(nslist, &len);
662 assert(nsres == NS_OK);
663
664 if(len) {
665 nsres = nsIDOMCSSRuleList_Item(nslist, 0, &nsrule);
666 if(NS_FAILED(nsres))
667 ERR("Item failed: %08x\n", nsres);
668 }
669
670 nsIDOMCSSRuleList_Release(nslist);
671 if(NS_FAILED(nsres))
672 return E_FAIL;
673
674 if(!len) {
675 *p = NULL;
676 return S_OK;
677 }
678
679 nsAString_Init(&nsstr, NULL);
680 nsres = nsIDOMCSSRule_GetCssText(nsrule, &nsstr);
681 nsIDOMCSSRule_Release(nsrule);
682 return return_nsstr(nsres, &nsstr, p);
683}
684
685static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
686 IHTMLStyleSheetRulesCollection **p)
687{
689 nsIDOMCSSRuleList *nslist = NULL;
690 nsresult nsres;
691
692 TRACE("(%p)->(%p)\n", This, p);
693
694 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
695 if(NS_FAILED(nsres)) {
696 ERR("GetCssRules failed: %08x\n", nsres);
697 return E_FAIL;
698 }
699
701 return S_OK;
702}
703
704static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
733};
734
736 IHTMLStyleSheet_tid,
737 0
738};
740 NULL,
741 DispHTMLStyleSheet_tid,
742 NULL,
744};
745
746IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
747{
749 nsresult nsres;
750
751 ret->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl;
752 ret->ref = 1;
753 ret->nsstylesheet = NULL;
754
755 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheet_iface, &HTMLStyleSheet_dispex);
756
757 if(nsstylesheet) {
758 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
759 (void**)&ret->nsstylesheet);
760 if(NS_FAILED(nsres))
761 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
762 }
763
764 return &ret->IHTMLStyleSheet_iface;
765}
unsigned int UINT32
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:114
#define WARN(fmt,...)
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:113
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
#define assert(x)
Definition: debug.h:53
unsigned short WORD
Definition: ntddk_ex.h:93
const GLdouble * v
Definition: gl.h:2040
GLuint index
Definition: glext.h:6031
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
static const tid_t HTMLStyleSheetsCollection_iface_tids[]
static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface, IUnknown **p)
static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL, LONG lIndex, LONG *plIndex)
static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface, REFIID riid, void **ppv)
static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
IHTMLStyleSheetsCollection * HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector, BSTR bstrStyle, LONG lIndex, LONG *plIndex)
static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl
static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
static HRESULT WINAPI HTMLStyleSheetRulesCollection_Invoke(IHTMLStyleSheetRulesCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface, LONG *p)
static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
static HTMLStyleSheet * impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)
static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
IHTMLStyleSheet * HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
static dispex_static_data_t HTMLStyleSheetsCollection_dispex
static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface, REFIID riid, void **ppv)
static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl
static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface, LONG *p)
static HTMLStyleSheetRulesCollection * impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface)
static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface, LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
static IHTMLStyleSheetRulesCollection * HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
static const tid_t HTMLStyleSheetRulesCollection_iface_tids[]
static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface, IHTMLStyleSheetsCollection **p)
static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl
static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex
static HTMLStyleSheetsCollection * impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection *iface)
static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface, UINT *pctinfo)
static dispex_static_data_t HTMLStyleSheet_dispex
static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface, IHTMLStyleSheet **p)
static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
static const tid_t HTMLStyleSheet_iface_tids[]
static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface, IHTMLStyleSheetRulesCollection **p)
static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
#define debugstr_w
Definition: kernel32.h:32
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
#define NS_OK
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
#define NS_SUCCEEDED(res)
#define NS_FAILED(res)
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
unsigned int UINT
Definition: ndis.h:50
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_I4(A)
Definition: oleauto.h:247
#define V_DISPATCH(A)
Definition: oleauto.h:239
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface
nsIDOMCSSRuleList * nslist
nsIDOMCSSStyleSheet * nsstylesheet
DispatchEx dispex
IHTMLStyleSheet IHTMLStyleSheet_iface
nsIDOMStyleSheetList * nslist
IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364