gdiplus/tests: Add a test for GdipCloneBitmapArea called on an already locked bitmap.
[wine.git] / dlls / mshtml / htmlstylesheet.c
blob4b4308238a409b1e300815e6fa99e640f4c2cd87
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"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 struct HTMLStyleSheet {
35 DispatchEx dispex;
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 UINT32 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 UINT32 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)->(%s %p)\n", This, debugstr_variant(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 index %s\n", debugstr_variant(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;
416 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
417 return *ppv ? S_OK : E_NOINTERFACE;
420 if(*ppv) {
421 IUnknown_AddRef((IUnknown*)*ppv);
422 return S_OK;
425 WARN("unsupported %s\n", debugstr_guid(riid));
426 return E_NOINTERFACE;
429 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
431 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
432 LONG ref = InterlockedIncrement(&This->ref);
434 TRACE("(%p) ref=%d\n", This, ref);
436 return ref;
439 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
441 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
442 LONG ref = InterlockedDecrement(&This->ref);
444 TRACE("(%p) ref=%d\n", This, ref);
446 if(!ref)
447 heap_free(This);
449 return ref;
452 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
454 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
455 TRACE("(%p)->(%p)\n", This, pctinfo);
456 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
459 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
460 LCID lcid, ITypeInfo **ppTInfo)
462 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
463 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
464 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
467 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
468 LPOLESTR *rgszNames, UINT cNames,
469 LCID lcid, DISPID *rgDispId)
471 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
472 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
473 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
476 static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
477 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
478 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
480 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
481 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
482 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
483 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams,
484 pVarResult, pExcepInfo, puArgErr);
487 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
489 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
490 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
496 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
501 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
502 IHTMLStyleSheet **p)
504 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
505 FIXME("(%p)->(%p)\n", This, p);
506 return E_NOTIMPL;
509 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
511 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
512 FIXME("(%p)->(%p)\n", This, p);
513 return E_NOTIMPL;
516 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
518 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
519 FIXME("(%p)->(%x)\n", This, v);
520 return E_NOTIMPL;
523 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
525 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
526 FIXME("(%p)->(%p)\n", This, p);
527 return E_NOTIMPL;
530 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
532 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
533 FIXME("(%p)->(%p)\n", This, p);
534 return E_NOTIMPL;
537 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
538 IHTMLStyleSheetsCollection **p)
540 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
541 FIXME("(%p)->(%p)\n", This, p);
542 return E_NOTIMPL;
545 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
547 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
548 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
549 return E_NOTIMPL;
552 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
554 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
555 FIXME("(%p)->(%p)\n", This, p);
556 return E_NOTIMPL;
559 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
561 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
562 FIXME("(%p)->(%p)\n", This, p);
563 return E_NOTIMPL;
566 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
568 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
569 FIXME("(%p)->(%p)\n", This, p);
570 return E_NOTIMPL;
573 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
574 LONG lIndex, LONG *plIndex)
576 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
577 FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
578 return E_NOTIMPL;
581 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
582 BSTR bstrStyle, LONG lIndex, LONG *plIndex)
584 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
585 FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
586 lIndex, plIndex);
587 return E_NOTIMPL;
590 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
592 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
593 FIXME("(%p)->(%d)\n", This, lIndex);
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
599 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
600 FIXME("(%p)->(%d)\n", This, lIndex);
601 return E_NOTIMPL;
604 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
606 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
607 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
608 return E_NOTIMPL;
611 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
613 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
614 FIXME("(%p)->(%p)\n", This, p);
615 return E_NOTIMPL;
618 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
620 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
621 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
622 return E_NOTIMPL;
625 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
627 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
628 FIXME("(%p)->(%p)\n", This, p);
629 return E_NOTIMPL;
632 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
633 IHTMLStyleSheetRulesCollection **p)
635 HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
636 nsIDOMCSSRuleList *nslist = NULL;
637 nsresult nsres;
639 TRACE("(%p)->(%p)\n", This, p);
641 /* Gecko has buggy security checks and GetCssRules will fail. We have a correct
642 * implementation and it will work when the bug will be fixed in Gecko. */
643 nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
644 if(NS_FAILED(nsres))
645 WARN("GetCssRules failed: %08x\n", nsres);
647 *p = HTMLStyleSheetRulesCollection_Create(nslist);
648 return S_OK;
651 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
652 HTMLStyleSheet_QueryInterface,
653 HTMLStyleSheet_AddRef,
654 HTMLStyleSheet_Release,
655 HTMLStyleSheet_GetTypeInfoCount,
656 HTMLStyleSheet_GetTypeInfo,
657 HTMLStyleSheet_GetIDsOfNames,
658 HTMLStyleSheet_Invoke,
659 HTMLStyleSheet_put_title,
660 HTMLStyleSheet_get_title,
661 HTMLStyleSheet_get_parentStyleSheet,
662 HTMLStyleSheet_get_owningElement,
663 HTMLStyleSheet_put_disabled,
664 HTMLStyleSheet_get_disabled,
665 HTMLStyleSheet_get_readOnly,
666 HTMLStyleSheet_get_imports,
667 HTMLStyleSheet_put_href,
668 HTMLStyleSheet_get_href,
669 HTMLStyleSheet_get_type,
670 HTMLStyleSheet_get_id,
671 HTMLStyleSheet_addImport,
672 HTMLStyleSheet_addRule,
673 HTMLStyleSheet_removeImport,
674 HTMLStyleSheet_removeRule,
675 HTMLStyleSheet_put_media,
676 HTMLStyleSheet_get_media,
677 HTMLStyleSheet_put_cssText,
678 HTMLStyleSheet_get_cssText,
679 HTMLStyleSheet_get_rules
682 static const tid_t HTMLStyleSheet_iface_tids[] = {
683 IHTMLStyleSheet_tid,
686 static dispex_static_data_t HTMLStyleSheet_dispex = {
687 NULL,
688 DispHTMLStyleSheet_tid,
689 NULL,
690 HTMLStyleSheet_iface_tids
693 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
695 HTMLStyleSheet *ret = heap_alloc(sizeof(HTMLStyleSheet));
696 nsresult nsres;
698 ret->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl;
699 ret->ref = 1;
700 ret->nsstylesheet = NULL;
702 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheet_iface, &HTMLStyleSheet_dispex);
704 if(nsstylesheet) {
705 nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
706 (void**)&ret->nsstylesheet);
707 if(NS_FAILED(nsres))
708 ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
711 return &ret->IHTMLStyleSheet_iface;