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 <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29
30 #include "mshtml_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
33
34 struct HTMLStyleSheet {
35 IHTMLStyleSheet IHTMLStyleSheet_iface;
36
37 LONG ref;
38
39 nsIDOMCSSStyleSheet *nsstylesheet;
40 };
41
42 struct HTMLStyleSheetsCollection {
43 DispatchEx dispex;
44 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface;
45
46 LONG ref;
47
48 nsIDOMStyleSheetList *nslist;
49 };
50
51 struct HTMLStyleSheetRulesCollection {
52 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface;
53
54 LONG ref;
55
56 nsIDOMCSSRuleList *nslist;
57 };
58
59 static inline HTMLStyleSheetRulesCollection *impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface)
60 {
61 return CONTAINING_RECORD(iface, HTMLStyleSheetRulesCollection, IHTMLStyleSheetRulesCollection_iface);
62 }
63
64 static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface,
65 REFIID riid, void **ppv)
66 {
67 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
68
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;
75 }
76
77 if(*ppv) {
78 IUnknown_AddRef((IUnknown*)*ppv);
79 return S_OK;
80 }
81
82 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
83 return E_NOINTERFACE;
84 }
85
86 static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
87 {
88 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
89 LONG ref = InterlockedIncrement(&This->ref);
90
91 TRACE("(%p) ref=%d\n", This, ref);
92
93 return ref;
94 }
95
96 static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
97 {
98 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
99 LONG ref = InterlockedDecrement(&This->ref);
100
101 TRACE("(%p) ref=%d\n", This, ref);
102
103 if(!ref) {
104 if(This->nslist)
105 nsIDOMCSSRuleList_Release(This->nslist);
106 heap_free(This);
107 }
108
109 return ref;
110 }
111
112 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(
113 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
114 {
115 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
116 FIXME("(%p)->(%p)\n", This, pctinfo);
117 return E_NOTIMPL;
118 }
119
120 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface,
121 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
122 {
123 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
124 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
125 return E_NOTIMPL;
126 }
127
128 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface,
129 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
130 {
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;
135 }
136
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)
140 {
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;
145 }
146
147 static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
148 LONG *p)
149 {
150 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
151 PRUint32 len = 0;
152
153 TRACE("(%p)->(%p)\n", This, p);
154
155 if(This->nslist) {
156 nsresult nsres;
157
158 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
159 if(NS_FAILED(nsres))
160 ERR("GetLength failed: %08x\n", nsres);
161 }
162
163 *p = len;
164 return S_OK;
165 }
166
167 static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
168 LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
169 {
170 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
171 FIXME("(%p)->(%d %p)\n", This, index, ppHTMLStyleSheetRule);
172 return E_NOTIMPL;
173 }
174
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
185 };
186
187 static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
188 {
189 HTMLStyleSheetRulesCollection *ret;
190
191 ret = heap_alloc(sizeof(*ret));
192 ret->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl;
193 ret->ref = 1;
194 ret->nslist = nslist;
195
196 if(nslist)
197 nsIDOMCSSRuleList_AddRef(nslist);
198
199 return &ret->IHTMLStyleSheetRulesCollection_iface;
200 }
201
202 static inline HTMLStyleSheetsCollection *impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection *iface)
203 {
204 return CONTAINING_RECORD(iface, HTMLStyleSheetsCollection, IHTMLStyleSheetsCollection_iface);
205 }
206
207 static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
208 REFIID riid, void **ppv)
209 {
210 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
211
212 *ppv = NULL;
213
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;
225 }
226
227 if(*ppv) {
228 IUnknown_AddRef((IUnknown*)*ppv);
229 return S_OK;
230 }
231
232 WARN("unsupported %s\n", debugstr_guid(riid));
233 return E_NOINTERFACE;
234 }
235
236 static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
237 {
238 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
239 LONG ref = InterlockedIncrement(&This->ref);
240
241 TRACE("(%p) ref=%d\n", This, ref);
242
243 return ref;
244 }
245
246 static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
247 {
248 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
249 LONG ref = InterlockedDecrement(&This->ref);
250
251 TRACE("(%p) ref=%d\n", This, ref);
252
253 if(!ref) {
254 if(This->nslist)
255 nsIDOMStyleSheetList_Release(This->nslist);
256 heap_free(This);
257 }
258
259 return ref;
260 }
261
262 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
263 UINT *pctinfo)
264 {
265 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
266 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
267 }
268
269 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
270 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
271 {
272 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
273 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
274 }
275
276 static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
277 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
278 {
279 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
280 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
281 lcid, rgDispId);
282 }
283
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)
287 {
288 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
289 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
290 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
291 }
292
293 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
294 LONG *p)
295 {
296 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
297 PRUint32 len = 0;
298
299 TRACE("(%p)->(%p)\n", This, p);
300
301 if(This->nslist)
302 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
303
304 *p = len;
305 return S_OK;
306 }
307
308 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
309 IUnknown **p)
310 {
311 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
312 FIXME("(%p)->(%p)\n", This, p);
313 return E_NOTIMPL;
314 }
315
316 static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
317 VARIANT *pvarIndex, VARIANT *pvarResult)
318 {
319 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
320
321 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarIndex), pvarResult);
322
323 switch(V_VT(pvarIndex)) {
324 case VT_I4: {
325 nsIDOMStyleSheet *nsstylesheet;
326 nsresult nsres;
327
328 TRACE("index=%d\n", V_I4(pvarIndex));
329
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;
335 }
336
337 V_VT(pvarResult) = VT_DISPATCH;
338 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
339
340 return S_OK;
341 }
342
343 case VT_BSTR:
344 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
345 return E_NOTIMPL;
346
347 default:
348 WARN("Invalid index %s\n", debugstr_variant(pvarIndex));
349 }
350
351 return E_INVALIDARG;
352 }
353
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
365 };
366
367 static const tid_t HTMLStyleSheetsCollection_iface_tids[] = {
368 IHTMLStyleSheetsCollection_tid,
369 0
370 };
371 static dispex_static_data_t HTMLStyleSheetsCollection_dispex = {
372 NULL,
373 DispHTMLStyleSheetsCollection_tid,
374 NULL,
375 HTMLStyleSheetsCollection_iface_tids
376 };
377
378 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
379 {
380 HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection));
381
382 ret->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl;
383 ret->ref = 1;
384
385 if(nslist)
386 nsIDOMStyleSheetList_AddRef(nslist);
387 ret->nslist = nslist;
388
389 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetsCollection_iface,
390 &HTMLStyleSheetsCollection_dispex);
391
392 return &ret->IHTMLStyleSheetsCollection_iface;
393 }
394
395 static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)
396 {
397 return CONTAINING_RECORD(iface, HTMLStyleSheet, IHTMLStyleSheet_iface);
398 }
399
400 static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
401 {
402 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
403
404 *ppv = NULL;
405
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;
415 }
416
417 if(*ppv) {
418 IUnknown_AddRef((IUnknown*)*ppv);
419 return S_OK;
420 }
421
422 WARN("unsupported %s\n", debugstr_guid(riid));
423 return E_NOINTERFACE;
424 }
425
426 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
427 {
428 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
429 LONG ref = InterlockedIncrement(&This->ref);
430
431 TRACE("(%p) ref=%d\n", This, ref);
432
433 return ref;
434 }
435
436 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
437 {
438 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
439 LONG ref = InterlockedDecrement(&This->ref);
440
441 TRACE("(%p) ref=%d\n", This, ref);
442
443 if(!ref)
444 heap_free(This);
445
446 return ref;
447 }
448
449 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
450 {
451 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
452 FIXME("(%p)->(%p)\n", This, pctinfo);
453 return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
457 LCID lcid, ITypeInfo **ppTInfo)
458 {
459 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
460 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
461 return E_NOTIMPL;
462 }
463
464 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
465 LPOLESTR *rgszNames, UINT cNames,
466 LCID lcid, DISPID *rgDispId)
467 {
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;
472 }
473
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)
477 {
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;
482 }
483
484 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
485 {
486 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
487 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
488 return E_NOTIMPL;
489 }
490
491 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
492 {
493 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
494 FIXME("(%p)->(%p)\n", This, p);
495 return E_NOTIMPL;
496 }
497
498 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
499 IHTMLStyleSheet **p)
500 {
501 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
502 FIXME("(%p)->(%p)\n", This, p);
503 return E_NOTIMPL;
504 }
505
506 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
507 {
508 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
509 FIXME("(%p)->(%p)\n", This, p);
510 return E_NOTIMPL;
511 }
512
513 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
514 {
515 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
516 FIXME("(%p)->(%x)\n", This, v);
517 return E_NOTIMPL;
518 }
519
520 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
521 {
522 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
523 FIXME("(%p)->(%p)\n", This, p);
524 return E_NOTIMPL;
525 }
526
527 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
528 {
529 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
530 FIXME("(%p)->(%p)\n", This, p);
531 return E_NOTIMPL;
532 }
533
534 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
535 IHTMLStyleSheetsCollection **p)
536 {
537 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
538 FIXME("(%p)->(%p)\n", This, p);
539 return E_NOTIMPL;
540 }
541
542 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
543 {
544 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
545 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
546 return E_NOTIMPL;
547 }
548
549 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
550 {
551 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
552 FIXME("(%p)->(%p)\n", This, p);
553 return E_NOTIMPL;
554 }
555
556 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
557 {
558 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
559 FIXME("(%p)->(%p)\n", This, p);
560 return E_NOTIMPL;
561 }
562
563 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
564 {
565 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
566 FIXME("(%p)->(%p)\n", This, p);
567 return E_NOTIMPL;
568 }
569
570 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
571 LONG lIndex, LONG *plIndex)
572 {
573 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
574 FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
575 return E_NOTIMPL;
576 }
577
578 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
579 BSTR bstrStyle, LONG lIndex, LONG *plIndex)
580 {
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;
585 }
586
587 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
588 {
589 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
590 FIXME("(%p)->(%d)\n", This, lIndex);
591 return E_NOTIMPL;
592 }
593
594 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
595 {
596 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
597 FIXME("(%p)->(%d)\n", This, lIndex);
598 return E_NOTIMPL;
599 }
600
601 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
602 {
603 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
604 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
605 return E_NOTIMPL;
606 }
607
608 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
609 {
610 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
611 FIXME("(%p)->(%p)\n", This, p);
612 return E_NOTIMPL;
613 }
614
615 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
616 {
617 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
618 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
619 return E_NOTIMPL;
620 }
621
622 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
623 {
624 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
625 FIXME("(%p)->(%p)\n", This, p);
626 return E_NOTIMPL;
627 }
628
629 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
630 IHTMLStyleSheetRulesCollection **p)
631 {
632 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
633 nsIDOMCSSRuleList *nslist = NULL;
634 nsresult nsres;
635
636 TRACE("(%p)->(%p)\n", This, p);
637
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);
643
644 *p = HTMLStyleSheetRulesCollection_Create(nslist);
645 return S_OK;
646 }
647
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
677 };
678
679 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
680 {
681 HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet));
682 nsresult nsres;
683
684 ret->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl;
685 ret->ref = 1;
686 ret->nsstylesheet = NULL;
687
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);
693 }
694
695 return &ret->IHTMLStyleSheet_iface;
696 }
697
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.