user32: Convert menu and string table resources to po files.
[wine.git] / dlls / mshtml / htmlstylesheet.c
blob3b6956b443aa45618f00e891fd4ab5664cf0170e
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLStyleSheet {
36 IHTMLStyleSheet IHTMLStyleSheet_iface;
38 LONG ref;
40 nsIDOMCSSStyleSheet *nsstylesheet;
43 struct HTMLStyleSheetsCollection {
44 DispatchEx dispex;
45 IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface;
47 LONG ref;
49 nsIDOMStyleSheetList *nslist;
52 struct HTMLStyleSheetRulesCollection {
53 IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface;
55 LONG ref;
57 nsIDOMCSSRuleList *nslist;
60 static inline HTMLStyleSheetRulesCollection *impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface)
62 return CONTAINING_RECORD(iface, HTMLStyleSheetRulesCollection, IHTMLStyleSheetRulesCollection_iface);
65 static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleSheetRulesCollection *iface,
66 REFIID riid, void **ppv)
68 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
70 if(IsEqualGUID(&IID_IUnknown, riid)) {
71 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
72 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
73 }else if(IsEqualGUID(&IID_IHTMLStyleSheetRulesCollection, riid)) {
74 TRACE("(%p)->(IID_IHTMLStyleSheetRulesCollection %p)\n", This, ppv);
75 *ppv = &This->IHTMLStyleSheetRulesCollection_iface;
78 if(*ppv) {
79 IUnknown_AddRef((IUnknown*)*ppv);
80 return S_OK;
83 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
84 return E_NOINTERFACE;
87 static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface)
89 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
90 LONG ref = InterlockedIncrement(&This->ref);
92 TRACE("(%p) ref=%d\n", This, ref);
94 return ref;
97 static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface)
99 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
100 LONG ref = InterlockedDecrement(&This->ref);
102 TRACE("(%p) ref=%d\n", This, ref);
104 if(!ref) {
105 if(This->nslist)
106 nsIDOMCSSRuleList_Release(This->nslist);
107 heap_free(This);
110 return ref;
113 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfoCount(
114 IHTMLStyleSheetRulesCollection *iface, UINT *pctinfo)
116 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
117 FIXME("(%p)->(%p)\n", This, pctinfo);
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetTypeInfo(IHTMLStyleSheetRulesCollection *iface,
122 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
124 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
125 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
126 return E_NOTIMPL;
129 static HRESULT WINAPI HTMLStyleSheetRulesCollection_GetIDsOfNames(IHTMLStyleSheetRulesCollection *iface,
130 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
132 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
133 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
134 lcid, rgDispId);
135 return E_NOTIMPL;
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 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
144 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
145 return E_NOTIMPL;
148 static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRulesCollection *iface,
149 LONG *p)
151 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
152 PRUint32 len = 0;
154 TRACE("(%p)->(%p)\n", This, p);
156 if(This->nslist) {
157 nsresult nsres;
159 nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
160 if(NS_FAILED(nsres))
161 ERR("GetLength failed: %08x\n", nsres);
164 *p = len;
165 return S_OK;
168 static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCollection *iface,
169 LONG index, IHTMLStyleSheetRule **ppHTMLStyleSheetRule)
171 HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
172 FIXME("(%p)->(%d %p)\n", This, index, ppHTMLStyleSheetRule);
173 return E_NOTIMPL;
176 static const IHTMLStyleSheetRulesCollectionVtbl HTMLStyleSheetRulesCollectionVtbl = {
177 HTMLStyleSheetRulesCollection_QueryInterface,
178 HTMLStyleSheetRulesCollection_AddRef,
179 HTMLStyleSheetRulesCollection_Release,
180 HTMLStyleSheetRulesCollection_GetTypeInfoCount,
181 HTMLStyleSheetRulesCollection_GetTypeInfo,
182 HTMLStyleSheetRulesCollection_GetIDsOfNames,
183 HTMLStyleSheetRulesCollection_Invoke,
184 HTMLStyleSheetRulesCollection_get_length,
185 HTMLStyleSheetRulesCollection_item
188 static IHTMLStyleSheetRulesCollection *HTMLStyleSheetRulesCollection_Create(nsIDOMCSSRuleList *nslist)
190 HTMLStyleSheetRulesCollection *ret;
192 ret = heap_alloc(sizeof(*ret));
193 ret->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl;
194 ret->ref = 1;
195 ret->nslist = nslist;
197 if(nslist)
198 nsIDOMCSSRuleList_AddRef(nslist);
200 return &ret->IHTMLStyleSheetRulesCollection_iface;
203 static inline HTMLStyleSheetsCollection *impl_from_IHTMLStyleSheetsCollection(IHTMLStyleSheetsCollection *iface)
205 return CONTAINING_RECORD(iface, HTMLStyleSheetsCollection, IHTMLStyleSheetsCollection_iface);
208 static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
209 REFIID riid, void **ppv)
211 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
213 *ppv = NULL;
215 if(IsEqualGUID(&IID_IUnknown, riid)) {
216 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
217 *ppv = &This->IHTMLStyleSheetsCollection_iface;
218 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
219 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
220 *ppv = &This->IHTMLStyleSheetsCollection_iface;
221 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
222 TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv);
223 *ppv = &This->IHTMLStyleSheetsCollection_iface;
224 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
225 return *ppv ? S_OK : E_NOINTERFACE;
228 if(*ppv) {
229 IUnknown_AddRef((IUnknown*)*ppv);
230 return S_OK;
233 WARN("unsupported %s\n", debugstr_guid(riid));
234 return E_NOINTERFACE;
237 static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
239 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
240 LONG ref = InterlockedIncrement(&This->ref);
242 TRACE("(%p) ref=%d\n", This, ref);
244 return ref;
247 static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
249 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
250 LONG ref = InterlockedDecrement(&This->ref);
252 TRACE("(%p) ref=%d\n", This, ref);
254 if(!ref) {
255 if(This->nslist)
256 nsIDOMStyleSheetList_Release(This->nslist);
257 heap_free(This);
260 return ref;
263 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
264 UINT *pctinfo)
266 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
267 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
270 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
271 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
273 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
274 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
277 static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
278 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
280 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
281 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
282 lcid, rgDispId);
285 static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
286 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
287 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
289 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
290 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
291 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
294 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
295 LONG *p)
297 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
298 PRUint32 len = 0;
300 TRACE("(%p)->(%p)\n", This, p);
302 if(This->nslist)
303 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
305 *p = len;
306 return S_OK;
309 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
310 IUnknown **p)
312 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
313 FIXME("(%p)->(%p)\n", This, p);
314 return E_NOTIMPL;
317 static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
318 VARIANT *pvarIndex, VARIANT *pvarResult)
320 HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
322 TRACE("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
324 switch(V_VT(pvarIndex)) {
325 case VT_I4: {
326 nsIDOMStyleSheet *nsstylesheet;
327 nsresult nsres;
329 TRACE("index=%d\n", V_I4(pvarIndex));
331 nsres = nsIDOMStyleSheetList_Item(This->nslist, V_I4(pvarIndex), &nsstylesheet);
332 if(NS_FAILED(nsres) || !nsstylesheet) {
333 WARN("Item failed: %08x\n", nsres);
334 V_VT(pvarResult) = VT_EMPTY;
335 return E_INVALIDARG;
338 V_VT(pvarResult) = VT_DISPATCH;
339 V_DISPATCH(pvarResult) = (IDispatch*)HTMLStyleSheet_Create(nsstylesheet);
341 return S_OK;
344 case VT_BSTR:
345 FIXME("id=%s not implemented\n", debugstr_w(V_BSTR(pvarResult)));
346 return E_NOTIMPL;
348 default:
349 WARN("Invalid vt=%d\n", V_VT(pvarIndex));
352 return E_INVALIDARG;
355 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
356 HTMLStyleSheetsCollection_QueryInterface,
357 HTMLStyleSheetsCollection_AddRef,
358 HTMLStyleSheetsCollection_Release,
359 HTMLStyleSheetsCollection_GetTypeInfoCount,
360 HTMLStyleSheetsCollection_GetTypeInfo,
361 HTMLStyleSheetsCollection_GetIDsOfNames,
362 HTMLStyleSheetsCollection_Invoke,
363 HTMLStyleSheetsCollection_get_length,
364 HTMLStyleSheetsCollection_get__newEnum,
365 HTMLStyleSheetsCollection_item
368 static const tid_t HTMLStyleSheetsCollection_iface_tids[] = {
369 IHTMLStyleSheetsCollection_tid,
372 static dispex_static_data_t HTMLStyleSheetsCollection_dispex = {
373 NULL,
374 DispHTMLStyleSheetsCollection_tid,
375 NULL,
376 HTMLStyleSheetsCollection_iface_tids
379 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
381 HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection));
383 ret->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl;
384 ret->ref = 1;
386 if(nslist)
387 nsIDOMStyleSheetList_AddRef(nslist);
388 ret->nslist = nslist;
390 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetsCollection_iface,
391 &HTMLStyleSheetsCollection_dispex);
393 return &ret->IHTMLStyleSheetsCollection_iface;
396 static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)
398 return CONTAINING_RECORD(iface, HTMLStyleSheet, IHTMLStyleSheet_iface);
401 static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
403 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
405 *ppv = NULL;
407 if(IsEqualGUID(&IID_IUnknown, riid)) {
408 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
409 *ppv = &This->IHTMLStyleSheet_iface;
410 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
411 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
412 *ppv = &This->IHTMLStyleSheet_iface;
413 }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) {
414 TRACE("(%p)->(IID_IHTMLStyleSheet %p)\n", This, ppv);
415 *ppv = &This->IHTMLStyleSheet_iface;
418 if(*ppv) {
419 IUnknown_AddRef((IUnknown*)*ppv);
420 return S_OK;
423 WARN("unsupported %s\n", debugstr_guid(riid));
424 return E_NOINTERFACE;
427 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
429 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
430 LONG ref = InterlockedIncrement(&This->ref);
432 TRACE("(%p) ref=%d\n", This, ref);
434 return ref;
437 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
439 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
440 LONG ref = InterlockedDecrement(&This->ref);
442 TRACE("(%p) ref=%d\n", This, ref);
444 if(!ref)
445 heap_free(This);
447 return ref;
450 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
452 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
453 FIXME("(%p)->(%p)\n", This, pctinfo);
454 return E_NOTIMPL;
457 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
458 LCID lcid, ITypeInfo **ppTInfo)
460 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
461 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
466 LPOLESTR *rgszNames, UINT cNames,
467 LCID lcid, DISPID *rgDispId)
469 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
470 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
471 lcid, rgDispId);
472 return E_NOTIMPL;
475 static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
476 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
477 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
479 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
480 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
481 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
482 return E_NOTIMPL;
485 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
487 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
488 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
489 return E_NOTIMPL;
492 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
494 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
495 FIXME("(%p)->(%p)\n", This, p);
496 return E_NOTIMPL;
499 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
500 IHTMLStyleSheet **p)
502 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
503 FIXME("(%p)->(%p)\n", This, p);
504 return E_NOTIMPL;
507 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
509 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
510 FIXME("(%p)->(%p)\n", This, p);
511 return E_NOTIMPL;
514 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
516 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
517 FIXME("(%p)->(%x)\n", This, v);
518 return E_NOTIMPL;
521 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
523 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
524 FIXME("(%p)->(%p)\n", This, p);
525 return E_NOTIMPL;
528 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
530 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
531 FIXME("(%p)->(%p)\n", This, p);
532 return E_NOTIMPL;
535 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
536 IHTMLStyleSheetsCollection **p)
538 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
539 FIXME("(%p)->(%p)\n", This, p);
540 return E_NOTIMPL;
543 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
545 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
546 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
547 return E_NOTIMPL;
550 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
552 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
553 FIXME("(%p)->(%p)\n", This, p);
554 return E_NOTIMPL;
557 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
559 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
560 FIXME("(%p)->(%p)\n", This, p);
561 return E_NOTIMPL;
564 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
566 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
567 FIXME("(%p)->(%p)\n", This, p);
568 return E_NOTIMPL;
571 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
572 LONG lIndex, LONG *plIndex)
574 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
575 FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
576 return E_NOTIMPL;
579 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
580 BSTR bstrStyle, LONG lIndex, LONG *plIndex)
582 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
583 FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
584 lIndex, plIndex);
585 return E_NOTIMPL;
588 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
590 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
591 FIXME("(%p)->(%d)\n", This, lIndex);
592 return E_NOTIMPL;
595 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
597 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
598 FIXME("(%p)->(%d)\n", This, lIndex);
599 return E_NOTIMPL;
602 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
604 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
605 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
606 return E_NOTIMPL;
609 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
611 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
612 FIXME("(%p)->(%p)\n", This, p);
613 return E_NOTIMPL;
616 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
618 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
619 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
620 return E_NOTIMPL;
623 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
625 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
626 FIXME("(%p)->(%p)\n", This, p);
627 return E_NOTIMPL;
630 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
631 IHTMLStyleSheetRulesCollection **p)
633 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
634 nsIDOMCSSRuleList *nslist = NULL;
635 nsresult nsres;
637 TRACE("(%p)->(%p)\n", This, p);
639 /* Gecko has buggy security checks and GetCssRules will fail. We have a correct
640 * implementation and it will work when the bug will be fixed in Gecko. */
641 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
642 if(NS_FAILED(nsres))
643 WARN("GetCssRules failed: %08x\n", nsres);
645 *p = HTMLStyleSheetRulesCollection_Create(nslist);
646 return S_OK;
649 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
650 HTMLStyleSheet_QueryInterface,
651 HTMLStyleSheet_AddRef,
652 HTMLStyleSheet_Release,
653 HTMLStyleSheet_GetTypeInfoCount,
654 HTMLStyleSheet_GetTypeInfo,
655 HTMLStyleSheet_GetIDsOfNames,
656 HTMLStyleSheet_Invoke,
657 HTMLStyleSheet_put_title,
658 HTMLStyleSheet_get_title,
659 HTMLStyleSheet_get_parentStyleSheet,
660 HTMLStyleSheet_get_owningElement,
661 HTMLStyleSheet_put_disabled,
662 HTMLStyleSheet_get_disabled,
663 HTMLStyleSheet_get_readOnly,
664 HTMLStyleSheet_get_imports,
665 HTMLStyleSheet_put_href,
666 HTMLStyleSheet_get_href,
667 HTMLStyleSheet_get_type,
668 HTMLStyleSheet_get_id,
669 HTMLStyleSheet_addImport,
670 HTMLStyleSheet_addRule,
671 HTMLStyleSheet_removeImport,
672 HTMLStyleSheet_removeRule,
673 HTMLStyleSheet_put_media,
674 HTMLStyleSheet_get_media,
675 HTMLStyleSheet_put_cssText,
676 HTMLStyleSheet_get_cssText,
677 HTMLStyleSheet_get_rules
680 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
682 HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet));
683 nsresult nsres;
685 ret->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl;
686 ret->ref = 1;
687 ret->nsstylesheet = NULL;
689 if(nsstylesheet) {
690 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
691 (void**)&ret->nsstylesheet);
692 if(NS_FAILED(nsres))
693 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
696 return &ret->IHTMLStyleSheet_iface;