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