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