wininet/tests: Don't crash on W2K and below.
[wine] / dlls / mshtml / htmlcurstyle.c
1 /*
2  * Copyright 2008 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 "mshtml_private.h"
29 #include "htmlstyle.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 typedef struct {
36     DispatchEx dispex;
37     const IHTMLCurrentStyleVtbl *lpIHTMLCurrentStyleVtbl;
38
39     LONG ref;
40
41     nsIDOMCSSStyleDeclaration *nsstyle;
42 } HTMLCurrentStyle;
43
44 #define HTMLCURSTYLE(x)  ((IHTMLCurrentStyle*)  &(x)->lpIHTMLCurrentStyleVtbl)
45
46 #define HTMLCURSTYLE_THIS(iface) DEFINE_THIS(HTMLCurrentStyle, IHTMLCurrentStyle, iface)
47
48 static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
49 {
50     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
51
52     *ppv = NULL;
53
54     if(IsEqualGUID(&IID_IUnknown, riid)) {
55         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56         *ppv = HTMLCURSTYLE(This);
57     }else if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid)) {
58         TRACE("(%p)->(IID_IHTMLCurrentStyle %p)\n", This, ppv);
59         *ppv = HTMLCURSTYLE(This);
60     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
61         return *ppv ? S_OK : E_NOINTERFACE;
62     }
63
64     if(*ppv) {
65         IUnknown_AddRef((IUnknown*)*ppv);
66         return S_OK;
67     }
68
69     WARN("unsupported %s\n", debugstr_guid(riid));
70     return E_NOINTERFACE;
71 }
72
73 static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface)
74 {
75     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
76     LONG ref = InterlockedIncrement(&This->ref);
77
78     TRACE("(%p) ref=%d\n", This, ref);
79
80     return ref;
81 }
82
83 static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
84 {
85     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
86     LONG ref = InterlockedDecrement(&This->ref);
87
88     TRACE("(%p) ref=%d\n", This, ref);
89
90     if(!ref) {
91         if(This->nsstyle)
92             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
93         heap_free(This);
94     }
95
96     return ref;
97 }
98
99 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo)
100 {
101     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
102     FIXME("(%p)\n", This);
103     return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo,
107         LCID lcid, ITypeInfo **ppTInfo)
108 {
109     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
110     FIXME("(%p)\n", This);
111     return E_NOTIMPL;
112 }
113
114 static HRESULT WINAPI HTMLCurrentStyle_GetIDsOfNames(IHTMLCurrentStyle *iface, REFIID riid,
115         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
116 {
117     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
118     FIXME("(%p)\n", This);
119     return E_NOTIMPL;
120 }
121
122 static HRESULT WINAPI HTMLCurrentStyle_Invoke(IHTMLCurrentStyle *iface, DISPID dispIdMember,
123         REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
124         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
125 {
126     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
127     FIXME("(%p)\n", This);
128     return E_NOTIMPL;
129 }
130
131 static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p)
132 {
133     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
134     FIXME("(%p)->(%p)\n", This, p);
135     return E_NOTIMPL;
136 }
137
138 static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p)
139 {
140     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
141     FIXME("(%p)->(%p)\n", This, p);
142     return E_NOTIMPL;
143 }
144
145 static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p)
146 {
147     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
148     FIXME("(%p)->(%p)\n", This, p);
149     return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p)
153 {
154     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
155     FIXME("(%p)->(%p)\n", This, p);
156     return E_NOTIMPL;
157 }
158
159 static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p)
160 {
161     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
162     FIXME("(%p)->(%p)\n", This, p);
163     return E_NOTIMPL;
164 }
165
166 static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p)
167 {
168     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
169     FIXME("(%p)->(%p)\n", This, p);
170     return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p)
174 {
175     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
176     FIXME("(%p)->(%p)\n", This, p);
177     return E_NOTIMPL;
178 }
179
180 static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p)
181 {
182     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
183     FIXME("(%p)->(%p)\n", This, p);
184     return E_NOTIMPL;
185 }
186
187 static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p)
188 {
189     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
190     FIXME("(%p)->(%p)\n", This, p);
191     return E_NOTIMPL;
192 }
193
194 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p)
195 {
196     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
197     FIXME("(%p)->(%p)\n", This, p);
198     return E_NOTIMPL;
199 }
200
201 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p)
202 {
203     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
204     FIXME("(%p)->(%p)\n", This, p);
205     return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p)
209 {
210     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
211     FIXME("(%p)->(%p)\n", This, p);
212     return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p)
216 {
217     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
218     FIXME("(%p)->(%p)\n", This, p);
219     return E_NOTIMPL;
220 }
221
222 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
223 {
224     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
225     FIXME("(%p)->(%p)\n", This, p);
226     return E_NOTIMPL;
227 }
228
229 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
230 {
231     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
232     FIXME("(%p)->(%p)\n", This, p);
233     return E_NOTIMPL;
234 }
235
236 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
237 {
238     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
239     FIXME("(%p)->(%p)\n", This, p);
240     return E_NOTIMPL;
241 }
242
243 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
244 {
245     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
246     FIXME("(%p)->(%p)\n", This, p);
247     return E_NOTIMPL;
248 }
249
250 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
251 {
252     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
253     FIXME("(%p)->(%p)\n", This, p);
254     return E_NOTIMPL;
255 }
256
257 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p)
258 {
259     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
260     FIXME("(%p)->(%p)\n", This, p);
261     return E_NOTIMPL;
262 }
263
264 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p)
265 {
266     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
267     FIXME("(%p)->(%p)\n", This, p);
268     return E_NOTIMPL;
269 }
270
271 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p)
272 {
273     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
274     FIXME("(%p)->(%p)\n", This, p);
275     return E_NOTIMPL;
276 }
277
278 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p)
279 {
280     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
281     FIXME("(%p)->(%p)\n", This, p);
282     return E_NOTIMPL;
283 }
284
285 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p)
286 {
287     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
288     FIXME("(%p)->(%p)\n", This, p);
289     return E_NOTIMPL;
290 }
291
292 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p)
293 {
294     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
295     FIXME("(%p)->(%p)\n", This, p);
296     return E_NOTIMPL;
297 }
298
299 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p)
300 {
301     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
302     FIXME("(%p)->(%p)\n", This, p);
303     return E_NOTIMPL;
304 }
305
306 static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p)
307 {
308     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
309     FIXME("(%p)->(%p)\n", This, p);
310     return E_NOTIMPL;
311 }
312
313 static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p)
314 {
315     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
316     FIXME("(%p)->(%p)\n", This, p);
317     return E_NOTIMPL;
318 }
319
320 static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p)
321 {
322     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
323     FIXME("(%p)->(%p)\n", This, p);
324     return E_NOTIMPL;
325 }
326
327 static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p)
328 {
329     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
330     FIXME("(%p)->(%p)\n", This, p);
331     return E_NOTIMPL;
332 }
333
334 static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p)
335 {
336     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
337     FIXME("(%p)->(%p)\n", This, p);
338     return E_NOTIMPL;
339 }
340
341 static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
342 {
343     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
344     FIXME("(%p)->(%p)\n", This, p);
345     return E_NOTIMPL;
346 }
347
348 static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
349 {
350     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
351     FIXME("(%p)->(%p)\n", This, p);
352     return E_NOTIMPL;
353 }
354
355 static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
356 {
357     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
358     FIXME("(%p)->(%p)\n", This, p);
359     return E_NOTIMPL;
360 }
361
362 static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
363 {
364     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
365     FIXME("(%p)->(%p)\n", This, p);
366     return E_NOTIMPL;
367 }
368
369 static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p)
370 {
371     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
372     FIXME("(%p)->(%p)\n", This, p);
373     return E_NOTIMPL;
374 }
375
376 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
377 {
378     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
379
380     TRACE("(%p)->(%p)\n", This, p);
381
382     return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
383 }
384
385 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
386 {
387     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
388     FIXME("(%p)->(%p)\n", This, p);
389     return E_NOTIMPL;
390 }
391
392 static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p)
393 {
394     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
395     FIXME("(%p)->(%p)\n", This, p);
396     return E_NOTIMPL;
397 }
398
399 static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
400 {
401     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
402     FIXME("(%p)->(%p)\n", This, p);
403     return E_NOTIMPL;
404 }
405
406 static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
407 {
408     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
409     FIXME("(%p)->(%p)\n", This, p);
410     return E_NOTIMPL;
411 }
412
413 static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
414 {
415     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
416     FIXME("(%p)->(%p)\n", This, p);
417     return E_NOTIMPL;
418 }
419
420 static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
421 {
422     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
423     FIXME("(%p)->(%p)\n", This, p);
424     return E_NOTIMPL;
425 }
426
427 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p)
428 {
429     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
430     FIXME("(%p)->(%p)\n", This, p);
431     return E_NOTIMPL;
432 }
433
434 static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
435 {
436     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
437     FIXME("(%p)->(%p)\n", This, p);
438     return E_NOTIMPL;
439 }
440
441 static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
442 {
443     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
444     FIXME("(%p)->(%p)\n", This, p);
445     return E_NOTIMPL;
446 }
447
448 static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
449 {
450     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
451     FIXME("(%p)->(%p)\n", This, p);
452     return E_NOTIMPL;
453 }
454
455 static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
456 {
457     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
458     FIXME("(%p)->(%p)\n", This, p);
459     return E_NOTIMPL;
460 }
461
462 static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p)
463 {
464     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
465     FIXME("(%p)->(%p)\n", This, p);
466     return E_NOTIMPL;
467 }
468
469 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p)
470 {
471     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
472     FIXME("(%p)->(%p)\n", This, p);
473     return E_NOTIMPL;
474 }
475
476 static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p)
477 {
478     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
479     FIXME("(%p)->(%p)\n", This, p);
480     return E_NOTIMPL;
481 }
482
483 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p)
484 {
485     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
486     FIXME("(%p)->(%p)\n", This, p);
487     return E_NOTIMPL;
488 }
489
490 static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p)
491 {
492     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
493     FIXME("(%p)->(%p)\n", This, p);
494     return E_NOTIMPL;
495 }
496
497 static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p)
498 {
499     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
500     FIXME("(%p)->(%p)\n", This, p);
501     return E_NOTIMPL;
502 }
503
504 static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p)
505 {
506     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
507     FIXME("(%p)->(%p)\n", This, p);
508     return E_NOTIMPL;
509 }
510
511 static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p)
512 {
513     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
514     FIXME("(%p)->(%p)\n", This, p);
515     return E_NOTIMPL;
516 }
517
518 static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p)
519 {
520     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
521     FIXME("(%p)->(%p)\n", This, p);
522     return E_NOTIMPL;
523 }
524
525 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p)
526 {
527     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
528     FIXME("(%p)->(%p)\n", This, p);
529     return E_NOTIMPL;
530 }
531
532 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p)
533 {
534     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
535     FIXME("(%p)->(%p)\n", This, p);
536     return E_NOTIMPL;
537 }
538
539 static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p)
540 {
541     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
542     FIXME("(%p)->(%p)\n", This, p);
543     return E_NOTIMPL;
544 }
545
546 static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p)
547 {
548     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
549     FIXME("(%p)->(%p)\n", This, p);
550     return E_NOTIMPL;
551 }
552
553 static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p)
554 {
555     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
556     FIXME("(%p)->(%p)\n", This, p);
557     return E_NOTIMPL;
558 }
559
560 static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p)
561 {
562     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
563     FIXME("(%p)->(%p)\n", This, p);
564     return E_NOTIMPL;
565 }
566
567 static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p)
568 {
569     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
570     FIXME("(%p)->(%p)\n", This, p);
571     return E_NOTIMPL;
572 }
573
574 static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName,
575         LONG lFlags, VARIANT *AttributeValue)
576 {
577     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
578     FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
579     return E_NOTIMPL;
580 }
581
582 static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p)
583 {
584     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
585     FIXME("(%p)->(%p)\n", This, p);
586     return E_NOTIMPL;
587 }
588
589 static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
590 {
591     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
592     FIXME("(%p)->(%p)\n", This, p);
593     return E_NOTIMPL;
594 }
595
596 static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
597 {
598     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
599     FIXME("(%p)->(%p)\n", This, p);
600     return E_NOTIMPL;
601 }
602
603 static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
604 {
605     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
606     FIXME("(%p)->(%p)\n", This, p);
607     return E_NOTIMPL;
608 }
609
610 static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p)
611 {
612     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
613     FIXME("(%p)->(%p)\n", This, p);
614     return E_NOTIMPL;
615 }
616
617 static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p)
618 {
619     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
620     FIXME("(%p)->(%p)\n", This, p);
621     return E_NOTIMPL;
622 }
623
624 static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p)
625 {
626     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
627     FIXME("(%p)->(%p)\n", This, p);
628     return E_NOTIMPL;
629 }
630
631 static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p)
632 {
633     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
634     FIXME("(%p)->(%p)\n", This, p);
635     return E_NOTIMPL;
636 }
637
638 static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p)
639 {
640     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
641     FIXME("(%p)->(%p)\n", This, p);
642     return E_NOTIMPL;
643 }
644
645 static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p)
646 {
647     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
648     FIXME("(%p)->(%p)\n", This, p);
649     return E_NOTIMPL;
650 }
651
652 static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p)
653 {
654     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
655     FIXME("(%p)->(%p)\n", This, p);
656     return E_NOTIMPL;
657 }
658
659 static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p)
660 {
661     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
662     FIXME("(%p)->(%p)\n", This, p);
663     return E_NOTIMPL;
664 }
665
666 static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p)
667 {
668     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
669     FIXME("(%p)->(%p)\n", This, p);
670     return E_NOTIMPL;
671 }
672
673 static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p)
674 {
675     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
676     FIXME("(%p)->(%p)\n", This, p);
677     return E_NOTIMPL;
678 }
679
680 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p)
681 {
682     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
683     FIXME("(%p)->(%p)\n", This, p);
684     return E_NOTIMPL;
685 }
686
687 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p)
688 {
689     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
690     FIXME("(%p)->(%p)\n", This, p);
691     return E_NOTIMPL;
692 }
693
694 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p)
695 {
696     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
697     FIXME("(%p)->(%p)\n", This, p);
698     return E_NOTIMPL;
699 }
700
701 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p)
702 {
703     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
704     FIXME("(%p)->(%p)\n", This, p);
705     return E_NOTIMPL;
706 }
707
708 static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p)
709 {
710     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
711     FIXME("(%p)->(%p)\n", This, p);
712     return E_NOTIMPL;
713 }
714
715 static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p)
716 {
717     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
718     FIXME("(%p)->(%p)\n", This, p);
719     return E_NOTIMPL;
720 }
721
722 static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p)
723 {
724     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
725     FIXME("(%p)->(%p)\n", This, p);
726     return E_NOTIMPL;
727 }
728
729 static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p)
730 {
731     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
732     FIXME("(%p)->(%p)\n", This, p);
733     return E_NOTIMPL;
734 }
735
736 static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p)
737 {
738     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
739     FIXME("(%p)->(%p)\n", This, p);
740     return E_NOTIMPL;
741 }
742
743 static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p)
744 {
745     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
746     FIXME("(%p)->(%p)\n", This, p);
747     return E_NOTIMPL;
748 }
749
750 static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p)
751 {
752     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
753     FIXME("(%p)->(%p)\n", This, p);
754     return E_NOTIMPL;
755 }
756
757 static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p)
758 {
759     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
760     FIXME("(%p)->(%p)\n", This, p);
761     return E_NOTIMPL;
762 }
763
764 static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p)
765 {
766     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
767     FIXME("(%p)->(%p)\n", This, p);
768     return E_NOTIMPL;
769 }
770
771 #undef HTMLCURSTYLE_THIS
772
773 static const IHTMLCurrentStyleVtbl HTMLCurrentStyleVtbl = {
774     HTMLCurrentStyle_QueryInterface,
775     HTMLCurrentStyle_AddRef,
776     HTMLCurrentStyle_Release,
777     HTMLCurrentStyle_GetTypeInfoCount,
778     HTMLCurrentStyle_GetTypeInfo,
779     HTMLCurrentStyle_GetIDsOfNames,
780     HTMLCurrentStyle_Invoke,
781     HTMLCurrentStyle_get_position,
782     HTMLCurrentStyle_get_styleFloat,
783     HTMLCurrentStyle_get_color,
784     HTMLCurrentStyle_get_backgroundColor,
785     HTMLCurrentStyle_get_fontFamily,
786     HTMLCurrentStyle_get_fontStyle,
787     HTMLCurrentStyle_get_fontVariant,
788     HTMLCurrentStyle_get_fontWeight,
789     HTMLCurrentStyle_get_fontSize,
790     HTMLCurrentStyle_get_backgroundImage,
791     HTMLCurrentStyle_get_backgroundPositionX,
792     HTMLCurrentStyle_get_backgroundPositionY,
793     HTMLCurrentStyle_get_backgroundRepeat,
794     HTMLCurrentStyle_get_borderLeftColor,
795     HTMLCurrentStyle_get_borderTopColor,
796     HTMLCurrentStyle_get_borderRightColor,
797     HTMLCurrentStyle_get_borderBottomColor,
798     HTMLCurrentStyle_get_borderTopStyle,
799     HTMLCurrentStyle_get_borderRightStyle,
800     HTMLCurrentStyle_get_borderBottomStyle,
801     HTMLCurrentStyle_get_borderLeftStyle,
802     HTMLCurrentStyle_get_borderTopWidth,
803     HTMLCurrentStyle_get_borderRightWidth,
804     HTMLCurrentStyle_get_borderBottomWidth,
805     HTMLCurrentStyle_get_borderLeftWidth,
806     HTMLCurrentStyle_get_left,
807     HTMLCurrentStyle_get_top,
808     HTMLCurrentStyle_get_width,
809     HTMLCurrentStyle_get_height,
810     HTMLCurrentStyle_get_paddingLeft,
811     HTMLCurrentStyle_get_paddingTop,
812     HTMLCurrentStyle_get_paddingRight,
813     HTMLCurrentStyle_get_paddingBottom,
814     HTMLCurrentStyle_get_textAlign,
815     HTMLCurrentStyle_get_textDecoration,
816     HTMLCurrentStyle_get_display,
817     HTMLCurrentStyle_get_visibility,
818     HTMLCurrentStyle_get_zIndex,
819     HTMLCurrentStyle_get_letterSpacing,
820     HTMLCurrentStyle_get_lineHeight,
821     HTMLCurrentStyle_get_textIndent,
822     HTMLCurrentStyle_get_verticalAlign,
823     HTMLCurrentStyle_get_backgroundAttachment,
824     HTMLCurrentStyle_get_marginTop,
825     HTMLCurrentStyle_get_marginRight,
826     HTMLCurrentStyle_get_marginBottom,
827     HTMLCurrentStyle_get_marginLeft,
828     HTMLCurrentStyle_get_clear,
829     HTMLCurrentStyle_get_listStyleType,
830     HTMLCurrentStyle_get_listStylePosition,
831     HTMLCurrentStyle_get_listStyleImage,
832     HTMLCurrentStyle_get_clipTop,
833     HTMLCurrentStyle_get_clipRight,
834     HTMLCurrentStyle_get_clipBottom,
835     HTMLCurrentStyle_get_clipLeft,
836     HTMLCurrentStyle_get_overflow,
837     HTMLCurrentStyle_get_pageBreakBefore,
838     HTMLCurrentStyle_get_pageBreakAfter,
839     HTMLCurrentStyle_get_cursor,
840     HTMLCurrentStyle_get_tableLayout,
841     HTMLCurrentStyle_get_borderCollapse,
842     HTMLCurrentStyle_get_direction,
843     HTMLCurrentStyle_get_behavior,
844     HTMLCurrentStyle_getAttribute,
845     HTMLCurrentStyle_get_unicodeBidi,
846     HTMLCurrentStyle_get_right,
847     HTMLCurrentStyle_get_bottom,
848     HTMLCurrentStyle_get_imeMode,
849     HTMLCurrentStyle_get_rubyAlign,
850     HTMLCurrentStyle_get_rubyPosition,
851     HTMLCurrentStyle_get_rubyOverhang,
852     HTMLCurrentStyle_get_textAutospace,
853     HTMLCurrentStyle_get_lineBreak,
854     HTMLCurrentStyle_get_wordBreak,
855     HTMLCurrentStyle_get_textJustify,
856     HTMLCurrentStyle_get_textJustifyTrim,
857     HTMLCurrentStyle_get_textKashida,
858     HTMLCurrentStyle_get_blockDirection,
859     HTMLCurrentStyle_get_layoutGridChar,
860     HTMLCurrentStyle_get_layoutGridLine,
861     HTMLCurrentStyle_get_layoutGridMode,
862     HTMLCurrentStyle_get_layoutGridType,
863     HTMLCurrentStyle_get_borderStyle,
864     HTMLCurrentStyle_get_borderColor,
865     HTMLCurrentStyle_get_borderWidth,
866     HTMLCurrentStyle_get_padding,
867     HTMLCurrentStyle_get_margin,
868     HTMLCurrentStyle_get_accelerator,
869     HTMLCurrentStyle_get_overflowX,
870     HTMLCurrentStyle_get_overflowY,
871     HTMLCurrentStyle_get_textTransform
872 };
873
874 static const tid_t HTMLCurrentStyle_iface_tids[] = {
875     IHTMLCurrentStyle_tid,
876     0
877 };
878 static dispex_static_data_t HTMLCurrentStyle_dispex = {
879     NULL,
880     DispHTMLCurrentStyle_tid,
881     NULL,
882     HTMLCurrentStyle_iface_tids
883 };
884
885 HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
886 {
887     nsIDOMCSSStyleDeclaration *nsstyle;
888     nsIDOMDocumentView *nsdocview;
889     nsIDOMAbstractView *nsview;
890     nsIDOMViewCSS *nsviewcss;
891     nsIDOMDocument *nsdoc;
892     nsAString nsempty_str;
893     HTMLCurrentStyle *ret;
894     nsresult nsres;
895
896     nsres = nsIWebNavigation_GetDocument(elem->node.doc->nscontainer->navigation, &nsdoc);
897     if(NS_FAILED(nsres)) {
898         ERR("GetDocument failed: %08x\n", nsres);
899         return E_FAIL;
900     }
901
902     nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
903     nsIDOMDocument_Release(nsdoc);
904     if(NS_FAILED(nsres)) {
905         ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
906         return E_FAIL;
907     }
908
909     nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
910     nsIDOMDocumentView_Release(nsdocview);
911     if(NS_FAILED(nsres)) {
912         ERR("GetDefaultView failed: %08x\n", nsres);
913         return E_FAIL;
914     }
915
916     nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMViewCSS, (void**)&nsviewcss);
917     nsIDOMAbstractView_Release(nsview);
918     if(NS_FAILED(nsres)) {
919         ERR("Could not get nsIDOMViewCSS: %08x\n", nsres);
920         return E_FAIL;
921     }
922
923     nsAString_Init(&nsempty_str, NULL);
924     nsres = nsIDOMViewCSS_GetComputedStyle(nsviewcss, (nsIDOMElement*)elem->nselem, &nsempty_str, &nsstyle);
925     nsIDOMViewCSS_Release(nsviewcss);
926     nsAString_Finish(&nsempty_str);
927     if(NS_FAILED(nsres)) {
928         ERR("GetComputedStyle failed: %08x\n", nsres);
929         return E_FAIL;
930     }
931
932     ret = heap_alloc_zero(sizeof(HTMLCurrentStyle));
933     if(!ret) {
934         nsIDOMCSSStyleDeclaration_Release(nsstyle);
935         return E_OUTOFMEMORY;
936     }
937
938     ret->lpIHTMLCurrentStyleVtbl = &HTMLCurrentStyleVtbl;
939     ret->ref = 1;
940     ret->nsstyle = nsstyle;
941
942     init_dispex(&ret->dispex, (IUnknown*)HTMLCURSTYLE(ret),  &HTMLCurrentStyle_dispex);
943
944     *p = HTMLCURSTYLE(ret);
945     return S_OK;
946 }