mshtml: Correctly set NULL event.
[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     IHTMLCurrentStyle IHTMLCurrentStyle_iface;
38
39     LONG ref;
40
41     nsIDOMCSSStyleDeclaration *nsstyle;
42 };
43
44 static inline HTMLCurrentStyle *impl_from_IHTMLCurrentStyle(IHTMLCurrentStyle *iface)
45 {
46     return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLCurrentStyle_iface);
47 }
48
49 static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
50 {
51     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
52
53     *ppv = NULL;
54
55     if(IsEqualGUID(&IID_IUnknown, riid)) {
56         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
57         *ppv = &This->IHTMLCurrentStyle_iface;
58     }else if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid)) {
59         TRACE("(%p)->(IID_IHTMLCurrentStyle %p)\n", This, ppv);
60         *ppv = &This->IHTMLCurrentStyle_iface;
61     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
62         return *ppv ? S_OK : E_NOINTERFACE;
63     }
64
65     if(*ppv) {
66         IUnknown_AddRef((IUnknown*)*ppv);
67         return S_OK;
68     }
69
70     WARN("unsupported %s\n", debugstr_guid(riid));
71     return E_NOINTERFACE;
72 }
73
74 static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface)
75 {
76     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
77     LONG ref = InterlockedIncrement(&This->ref);
78
79     TRACE("(%p) ref=%d\n", This, ref);
80
81     return ref;
82 }
83
84 static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
85 {
86     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
87     LONG ref = InterlockedDecrement(&This->ref);
88
89     TRACE("(%p) ref=%d\n", This, ref);
90
91     if(!ref) {
92         if(This->nsstyle)
93             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
94         release_dispex(&This->dispex);
95         heap_free(This);
96     }
97
98     return ref;
99 }
100
101 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo)
102 {
103     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
104     return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
105 }
106
107 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo,
108         LCID lcid, ITypeInfo **ppTInfo)
109 {
110     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
111     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
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 = impl_from_IHTMLCurrentStyle(iface);
118     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
119             lcid, rgDispId);
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 = impl_from_IHTMLCurrentStyle(iface);
127     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
128             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
129 }
130
131 static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p)
132 {
133     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
134
135     TRACE("(%p)->(%p)\n", This, p);
136
137     return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p);
138 }
139
140 static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p)
141 {
142     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
143     FIXME("(%p)->(%p)\n", This, p);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p)
148 {
149     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
150     TRACE("(%p)->(%p)\n", This, p);
151     return get_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, p, 0);
152 }
153
154 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p)
155 {
156     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
157     TRACE("(%p)->(%p)\n", This, p);
158     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
159 }
160
161 static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p)
162 {
163     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
164
165     TRACE("(%p)->(%p)\n", This, p);
166
167     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_FAMILY, p);
168 }
169
170 static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p)
171 {
172     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
173     TRACE("(%p)->(%p)\n", This, p);
174     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, p);
175 }
176
177 static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p)
178 {
179     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
180     TRACE("(%p)->(%p)\n", This, p);
181     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, p);
182 }
183
184 static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p)
185 {
186     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
187     TRACE("(%p)->(%p)\n", This, p);
188     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_WEIGHT, p, ATTR_STR_TO_INT);
189 }
190
191 static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p)
192 {
193     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
194     TRACE("(%p)->(%p)\n", This, p);
195     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
196 }
197
198 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p)
199 {
200     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
201     TRACE("(%p)->(%p)\n", This, p);
202     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_IMAGE, p);
203 }
204
205 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p)
206 {
207     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
208     FIXME("(%p)->(%p)\n", This, p);
209     return E_NOTIMPL;
210 }
211
212 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p)
213 {
214     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
215     FIXME("(%p)->(%p)\n", This, p);
216     return E_NOTIMPL;
217 }
218
219 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p)
220 {
221     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
222     TRACE("(%p)->(%p)\n", This, p);
223     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_REPEAT, p);
224 }
225
226 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
227 {
228     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
229     TRACE("(%p)->(%p)\n", This, p);
230     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
231 }
232
233 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
234 {
235     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
236     TRACE("(%p)->(%p)\n", This, p);
237     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
238 }
239
240 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
241 {
242     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
243     TRACE("(%p)->(%p)\n", This, p);
244     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
245 }
246
247 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
248 {
249     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
250     TRACE("(%p)->(%p)\n", This, p);
251     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
252 }
253
254 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
255 {
256     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
257     TRACE("(%p)->(%p)\n", This, p);
258     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_TOP_STYLE, p);
259 }
260
261 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p)
262 {
263     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
264     TRACE("(%p)->(%p)\n", This, p);
265     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_RIGHT_STYLE, p);
266 }
267
268 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p)
269 {
270     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
271     TRACE("(%p)->(%p)\n", This, p);
272     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_BOTTOM_STYLE, p);
273 }
274
275 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p)
276 {
277     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
278     TRACE("(%p)->(%p)\n", This, p);
279     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_LEFT_STYLE, p);
280 }
281
282 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p)
283 {
284     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
285     TRACE("(%p)->(%p)\n", This, p);
286     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
287 }
288
289 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p)
290 {
291     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
292     TRACE("(%p)->(%p)\n", This, p);
293     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
294 }
295
296 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p)
297 {
298     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
299     TRACE("(%p)->(%p)\n", This, p);
300     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
301 }
302
303 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p)
304 {
305     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
306     TRACE("(%p)->(%p)\n", This, p);
307     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
308 }
309
310 static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p)
311 {
312     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
313     TRACE("(%p)->(%p)\n", This, p);
314     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
315 }
316
317 static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p)
318 {
319     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
320     TRACE("(%p)->(%p)\n", This, p);
321     return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
322 }
323
324 static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p)
325 {
326     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
327     TRACE("(%p)->(%p)\n", This, p);
328     return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
329 }
330
331 static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p)
332 {
333     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
334     TRACE("(%p)->(%p)\n", This, p);
335     return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
336 }
337
338 static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p)
339 {
340     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
341     TRACE("(%p)->(%p)\n", This, p);
342     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
343 }
344
345 static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
346 {
347     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
348     TRACE("(%p)->(%p)\n", This, p);
349     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
350 }
351
352 static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
353 {
354     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
355     TRACE("(%p)->(%p)\n", This, p);
356     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
357 }
358
359 static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
360 {
361     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
362     TRACE("(%p)->(%p)\n", This, p);
363     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
364 }
365
366 static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
367 {
368     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
369     TRACE("(%p)->(%p)\n", This, p);
370     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_ALIGN, p);
371 }
372
373 static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p)
374 {
375     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
376     TRACE("(%p)->(%p)\n", This, p);
377     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_DECORATION, p);
378 }
379
380 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
381 {
382     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
383
384     TRACE("(%p)->(%p)\n", This, p);
385
386     return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
387 }
388
389 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
390 {
391     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
392
393     TRACE("(%p)->(%p)\n", This, p);
394
395     return get_nsstyle_attr(This->nsstyle, STYLEID_VISIBILITY, p);
396 }
397
398 static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p)
399 {
400     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
401     TRACE("(%p)->(%p)\n", This, p);
402     return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
403 }
404
405 static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
406 {
407     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
408     TRACE("(%p)->(%p)\n", This, p);
409     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
410 }
411
412 static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
413 {
414     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
415     TRACE("(%p)->(%p)\n", This, p);
416     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LINE_HEIGHT, p, 0);
417 }
418
419 static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
420 {
421     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
422     TRACE("(%p)->(%p)\n", This, p);
423     return get_nsstyle_attr_var(This->nsstyle, STYLEID_TEXT_INDENT, p, 0);
424 }
425
426 static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
427 {
428     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
429     TRACE("(%p)->(%p)\n", This, p);
430     return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
431 }
432
433 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p)
434 {
435     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
436     FIXME("(%p)->(%p)\n", This, p);
437     return E_NOTIMPL;
438 }
439
440 static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
441 {
442     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
443     TRACE("(%p)->(%p)\n", This, p);
444     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
445 }
446
447 static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
448 {
449     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
450     TRACE("(%p)->(%p)\n", This, p);
451     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
452 }
453
454 static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
455 {
456     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
457     TRACE("(%p)->(%p)\n", This, p);
458     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
459 }
460
461 static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
462 {
463     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
464     TRACE("(%p)->(%p)\n", This, p);
465     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
466 }
467
468 static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p)
469 {
470     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
471     FIXME("(%p)->(%p)\n", This, p);
472     return E_NOTIMPL;
473 }
474
475 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p)
476 {
477     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
478     FIXME("(%p)->(%p)\n", This, p);
479     return E_NOTIMPL;
480 }
481
482 static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p)
483 {
484     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
485     FIXME("(%p)->(%p)\n", This, p);
486     return E_NOTIMPL;
487 }
488
489 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p)
490 {
491     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
492     FIXME("(%p)->(%p)\n", This, p);
493     return E_NOTIMPL;
494 }
495
496 static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p)
497 {
498     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
499     FIXME("(%p)->(%p)\n", This, p);
500     return E_NOTIMPL;
501 }
502
503 static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p)
504 {
505     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
506     FIXME("(%p)->(%p)\n", This, p);
507     return E_NOTIMPL;
508 }
509
510 static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p)
511 {
512     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
513     FIXME("(%p)->(%p)\n", This, p);
514     return E_NOTIMPL;
515 }
516
517 static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p)
518 {
519     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
520     FIXME("(%p)->(%p)\n", This, p);
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p)
525 {
526     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
527     TRACE("(%p)->(%p)\n", This, p);
528     return get_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, p);
529 }
530
531 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p)
532 {
533     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
534     FIXME("(%p)->(%p)\n", This, p);
535     return E_NOTIMPL;
536 }
537
538 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p)
539 {
540     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
541     FIXME("(%p)->(%p)\n", This, p);
542     return E_NOTIMPL;
543 }
544
545 static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p)
546 {
547     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
548     TRACE("(%p)->(%p)\n", This, p);
549     return get_nsstyle_attr(This->nsstyle, STYLEID_CURSOR, p);
550 }
551
552 static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p)
553 {
554     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
555     FIXME("(%p)->(%p)\n", This, p);
556     return E_NOTIMPL;
557 }
558
559 static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p)
560 {
561     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
562     FIXME("(%p)->(%p)\n", This, p);
563     return E_NOTIMPL;
564 }
565
566 static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p)
567 {
568     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
569     FIXME("(%p)->(%p)\n", This, p);
570     return E_NOTIMPL;
571 }
572
573 static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p)
574 {
575     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
576     FIXME("(%p)->(%p)\n", This, p);
577     return E_NOTIMPL;
578 }
579
580 static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName,
581         LONG lFlags, VARIANT *AttributeValue)
582 {
583     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
584     FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
585     return E_NOTIMPL;
586 }
587
588 static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p)
589 {
590     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
591     FIXME("(%p)->(%p)\n", This, p);
592     return E_NOTIMPL;
593 }
594
595 static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
596 {
597     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
598     TRACE("(%p)->(%p)\n", This, p);
599     return get_nsstyle_attr_var(This->nsstyle, STYLEID_RIGHT, p, 0);
600 }
601
602 static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
603 {
604     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
605     TRACE("(%p)->(%p)\n", This, p);
606     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BOTTOM, p, 0);
607 }
608
609 static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
610 {
611     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
612     FIXME("(%p)->(%p)\n", This, p);
613     return E_NOTIMPL;
614 }
615
616 static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p)
617 {
618     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
619     FIXME("(%p)->(%p)\n", This, p);
620     return E_NOTIMPL;
621 }
622
623 static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p)
624 {
625     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
626     FIXME("(%p)->(%p)\n", This, p);
627     return E_NOTIMPL;
628 }
629
630 static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p)
631 {
632     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
633     FIXME("(%p)->(%p)\n", This, p);
634     return E_NOTIMPL;
635 }
636
637 static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p)
638 {
639     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
640     FIXME("(%p)->(%p)\n", This, p);
641     return E_NOTIMPL;
642 }
643
644 static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p)
645 {
646     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
647     FIXME("(%p)->(%p)\n", This, p);
648     return E_NOTIMPL;
649 }
650
651 static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p)
652 {
653     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
654     FIXME("(%p)->(%p)\n", This, p);
655     return E_NOTIMPL;
656 }
657
658 static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p)
659 {
660     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
661     FIXME("(%p)->(%p)\n", This, p);
662     return E_NOTIMPL;
663 }
664
665 static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p)
666 {
667     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
668     FIXME("(%p)->(%p)\n", This, p);
669     return E_NOTIMPL;
670 }
671
672 static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p)
673 {
674     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
675     FIXME("(%p)->(%p)\n", This, p);
676     return E_NOTIMPL;
677 }
678
679 static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p)
680 {
681     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
682     FIXME("(%p)->(%p)\n", This, p);
683     return E_NOTIMPL;
684 }
685
686 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p)
687 {
688     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
689     FIXME("(%p)->(%p)\n", This, p);
690     return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p)
694 {
695     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
696     FIXME("(%p)->(%p)\n", This, p);
697     return E_NOTIMPL;
698 }
699
700 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p)
701 {
702     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
703     FIXME("(%p)->(%p)\n", This, p);
704     return E_NOTIMPL;
705 }
706
707 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p)
708 {
709     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
710     FIXME("(%p)->(%p)\n", This, p);
711     return E_NOTIMPL;
712 }
713
714 static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p)
715 {
716     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
717     TRACE("(%p)->(%p)\n", This, p);
718     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, p);
719 }
720
721 static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p)
722 {
723     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
724     TRACE("(%p)->(%p)\n", This, p);
725     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_COLOR, p);
726 }
727
728 static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p)
729 {
730     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
731     TRACE("(%p)->(%p)\n", This, p);
732     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_WIDTH, p);
733 }
734
735 static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p)
736 {
737     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
738     TRACE("(%p)->(%p)\n", This, p);
739     return get_nsstyle_attr(This->nsstyle, STYLEID_PADDING, p);
740 }
741
742 static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p)
743 {
744     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
745     TRACE("(%p)->(%p)\n", This, p);
746     return get_nsstyle_attr(This->nsstyle, STYLEID_MARGIN, p);
747 }
748
749 static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p)
750 {
751     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
752     FIXME("(%p)->(%p)\n", This, p);
753     return E_NOTIMPL;
754 }
755
756 static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p)
757 {
758     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
759     FIXME("(%p)->(%p)\n", This, p);
760     return E_NOTIMPL;
761 }
762
763 static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p)
764 {
765     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
766     FIXME("(%p)->(%p)\n", This, p);
767     return E_NOTIMPL;
768 }
769
770 static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p)
771 {
772     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
773     FIXME("(%p)->(%p)\n", This, p);
774     return E_NOTIMPL;
775 }
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->IHTMLCurrentStyle_iface.lpVtbl = &HTMLCurrentStyleVtbl;
943     ret->ref = 1;
944     ret->nsstyle = nsstyle;
945
946     init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLCurrentStyle_iface,  &HTMLCurrentStyle_dispex);
947
948     *p = &ret->IHTMLCurrentStyle_iface;
949     return S_OK;
950 }