crypt32: NULL ptr could leak into function (Coverity).
[wine] / dlls / mshtml / htmlstyle.c
1 /*
2  * Copyright 2006 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 #include <math.h>
21
22 #define COBJMACROS
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "mshtmdid.h"
29
30 #include "mshtml_private.h"
31 #include "htmlstyle.h"
32
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37
38 static const WCHAR attrBackground[] =
39     {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor[] =
41     {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage[] =
43     {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPositionX[] =
45     {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
46 static const WCHAR attrBackgroundPositionY[] =
47     {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
48 static const WCHAR attrBackgroundRepeat[] =
49     {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
50 static const WCHAR attrBorder[] =
51     {'b','o','r','d','e','r',0};
52 static const WCHAR attrBorderBottom[] =
53     {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
54 static const WCHAR attrBorderBottomColor[] =
55     {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
56 static const WCHAR attrBorderBottomStyle[] =
57     {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
58 static const WCHAR attrBorderBottomWidth[] =
59     {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
60 static const WCHAR attrBorderColor[] =
61     {'b','o','r','d','e','r','-','c','o','l','o','r',0};
62 static const WCHAR attrBorderLeft[] =
63     {'b','o','r','d','e','r','-','l','e','f','t',0};
64 static const WCHAR attrBorderLeftColor[] =
65     {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
66 static const WCHAR attrBorderLeftStyle[] =
67     {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
68 static const WCHAR attrBorderLeftWidth[] =
69     {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
70 static const WCHAR attrBorderRight[] =
71     {'b','o','r','d','e','r','-','r','i','g','h','t',0};
72 static const WCHAR attrBorderRightColor[] =
73     {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
74 static const WCHAR attrBorderRightStyle[] =
75     {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
76 static const WCHAR attrBorderRightWidth[] =
77     {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
78 static const WCHAR attrBorderTop[] =
79     {'b','o','r','d','e','r','-','t','o','p',0};
80 static const WCHAR attrBorderTopColor[] =
81     {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
82 static const WCHAR attrBorderStyle[] =
83     {'b','o','r','d','e','r','-','s','t','y','l','e',0};
84 static const WCHAR attrBorderTopStyle[] =
85     {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopWidth[] =
87     {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
88 static const WCHAR attrBorderWidth[] =
89     {'b','o','r','d','e','r','-','w','i','d','t','h',0};
90 static const WCHAR attrBottom[] =
91     {'b','o','t','t','o','m',0};
92 static const WCHAR attrColor[] =
93     {'c','o','l','o','r',0};
94 static const WCHAR attrCursor[] =
95     {'c','u','r','s','o','r',0};
96 static const WCHAR attrDisplay[] =
97     {'d','i','s','p','l','a','y',0};
98 static const WCHAR attrFilter[] =
99     {'f','i','l','e','t','e','r',0};
100 static const WCHAR attrFontFamily[] =
101     {'f','o','n','t','-','f','a','m','i','l','y',0};
102 static const WCHAR attrFontSize[] =
103     {'f','o','n','t','-','s','i','z','e',0};
104 static const WCHAR attrFontStyle[] =
105     {'f','o','n','t','-','s','t','y','l','e',0};
106 static const WCHAR attrFontVariant[] =
107     {'f','o','n','t','-','v','a','r','i','a','n','t',0};
108 static const WCHAR attrFontWeight[] =
109     {'f','o','n','t','-','w','e','i','g','h','t',0};
110 static const WCHAR attrHeight[] =
111     {'h','e','i','g','h','t',0};
112 static const WCHAR attrLeft[] =
113     {'l','e','f','t',0};
114 static const WCHAR attrLetterSpacing[] =
115     {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
116 static const WCHAR attrLineHeight[] =
117     {'l','i','n','e','-','h','e','i','g','h','t',0};
118 static const WCHAR attrMargin[] =
119     {'m','a','r','g','i','n',0};
120 static const WCHAR attrMarginBottom[] =
121     {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
122 static const WCHAR attrMarginLeft[] =
123     {'m','a','r','g','i','n','-','l','e','f','t',0};
124 static const WCHAR attrMarginRight[] =
125     {'m','a','r','g','i','n','-','r','i','g','h','t',0};
126 static const WCHAR attrMarginTop[] =
127     {'m','a','r','g','i','n','-','t','o','p',0};
128 static const WCHAR attrMinHeight[] =
129     {'m','i','n','-','h','e','i','g','h','t',0};
130 static const WCHAR attrOverflow[] =
131     {'o','v','e','r','f','l','o','w',0};
132 static const WCHAR attrPadding[] =
133     {'p','a','d','d','i','n','g',0};
134 static const WCHAR attrPaddingBottom[] =
135     {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
136 static const WCHAR attrPaddingLeft[] =
137     {'p','a','d','d','i','n','g','-','l','e','f','t',0};
138 static const WCHAR attrPaddingRight[] =
139     {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
140 static const WCHAR attrPaddingTop[] =
141     {'p','a','d','d','i','n','g','-','t','o','p',0};
142 static const WCHAR attrPosition[] =
143     {'p','o','s','i','t','i','o','n',0};
144 static const WCHAR attrRight[] =
145     {'r','i','g','h','t',0};
146 static const WCHAR attrTextAlign[] =
147     {'t','e','x','t','-','a','l','i','g','n',0};
148 static const WCHAR attrTextDecoration[] =
149     {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
150 static const WCHAR attrTextIndent[] =
151     {'t','e','x','t','-','i','n','d','e','n','t',0};
152 static const WCHAR attrTop[] =
153     {'t','o','p',0};
154 static const WCHAR attrVerticalAlign[] =
155     {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
156 static const WCHAR attrVisibility[] =
157     {'v','i','s','i','b','i','l','i','t','y',0};
158 static const WCHAR attrWidth[] =
159     {'w','i','d','t','h',0};
160 static const WCHAR attrWordSpacing[] =
161     {'w','o','r','d','-','s','p','a','c','i','n','g',0};
162 static const WCHAR attrWordWrap[] =
163     {'w','o','r','d','-','w','r','a','p',0};
164 static const WCHAR attrZIndex[] =
165     {'z','-','i','n','d','e','x',0};
166
167 static const struct{
168     const WCHAR *name;
169     DISPID dispid;
170 } style_tbl[] = {
171     {attrBackground,           DISPID_IHTMLSTYLE_BACKGROUND},
172     {attrBackgroundColor,      DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
173     {attrBackgroundImage,      DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
174     {attrBackgroundPositionX,  DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
175     {attrBackgroundPositionY,  DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
176     {attrBackgroundRepeat,     DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
177     {attrBorder,               DISPID_IHTMLSTYLE_BORDER},
178     {attrBorderBottom,         DISPID_IHTMLSTYLE_BORDERBOTTOM},
179     {attrBorderBottomColor,    DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
180     {attrBorderBottomStyle,    DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
181     {attrBorderBottomWidth,    DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
182     {attrBorderColor,          DISPID_IHTMLSTYLE_BORDERCOLOR},
183     {attrBorderLeft,           DISPID_IHTMLSTYLE_BORDERLEFT},
184     {attrBorderLeftColor,      DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
185     {attrBorderLeftStyle,      DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
186     {attrBorderLeftWidth,      DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
187     {attrBorderRight,          DISPID_IHTMLSTYLE_BORDERRIGHT},
188     {attrBorderRightColor,     DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
189     {attrBorderRightStyle,     DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
190     {attrBorderRightWidth,     DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
191     {attrBorderStyle,          DISPID_IHTMLSTYLE_BORDERSTYLE},
192     {attrBorderTop,            DISPID_IHTMLSTYLE_BORDERTOP},
193     {attrBorderTopColor,       DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
194     {attrBorderTopStyle,       DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
195     {attrBorderTopWidth,       DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
196     {attrBorderWidth,          DISPID_IHTMLSTYLE_BORDERWIDTH},
197     {attrBottom,               DISPID_IHTMLSTYLE2_BOTTOM},
198     {attrColor,                DISPID_IHTMLSTYLE_COLOR},
199     {attrCursor,               DISPID_IHTMLSTYLE_CURSOR},
200     {attrDisplay,              DISPID_IHTMLSTYLE_DISPLAY},
201     {attrFilter,               DISPID_IHTMLSTYLE_FILTER},
202     {attrFontFamily,           DISPID_IHTMLSTYLE_FONTFAMILY},
203     {attrFontSize,             DISPID_IHTMLSTYLE_FONTSIZE},
204     {attrFontStyle,            DISPID_IHTMLSTYLE_FONTSTYLE},
205     {attrFontVariant,          DISPID_IHTMLSTYLE_FONTVARIANT},
206     {attrFontWeight,           DISPID_IHTMLSTYLE_FONTWEIGHT},
207     {attrHeight,               DISPID_IHTMLSTYLE_HEIGHT},
208     {attrLeft,                 DISPID_IHTMLSTYLE_LEFT},
209     {attrLetterSpacing,        DISPID_IHTMLSTYLE_LETTERSPACING},
210     {attrLineHeight,           DISPID_IHTMLSTYLE_LINEHEIGHT},
211     {attrMargin,               DISPID_IHTMLSTYLE_MARGIN},
212     {attrMarginBottom,         DISPID_IHTMLSTYLE_MARGINBOTTOM},
213     {attrMarginLeft,           DISPID_IHTMLSTYLE_MARGINLEFT},
214     {attrMarginRight,          DISPID_IHTMLSTYLE_MARGINRIGHT},
215     {attrMarginTop,            DISPID_IHTMLSTYLE_MARGINTOP},
216     {attrMinHeight,            DISPID_IHTMLSTYLE4_MINHEIGHT},
217     {attrOverflow,             DISPID_IHTMLSTYLE_OVERFLOW},
218     {attrPadding,              DISPID_IHTMLSTYLE_PADDING},
219     {attrPaddingBottom,        DISPID_IHTMLSTYLE_PADDINGBOTTOM},
220     {attrPaddingLeft,          DISPID_IHTMLSTYLE_PADDINGLEFT},
221     {attrPaddingRight,         DISPID_IHTMLSTYLE_PADDINGRIGHT},
222     {attrPaddingTop,           DISPID_IHTMLSTYLE_PADDINGTOP},
223     {attrPosition,             DISPID_IHTMLSTYLE2_POSITION},
224     {attrRight,                DISPID_IHTMLSTYLE2_RIGHT},
225     {attrTextAlign,            DISPID_IHTMLSTYLE_TEXTALIGN},
226     {attrTextDecoration,       DISPID_IHTMLSTYLE_TEXTDECORATION},
227     {attrTextIndent,           DISPID_IHTMLSTYLE_TEXTINDENT},
228     {attrTop,                  DISPID_IHTMLSTYLE_TOP},
229     {attrVerticalAlign,        DISPID_IHTMLSTYLE_VERTICALALIGN},
230     {attrVisibility,           DISPID_IHTMLSTYLE_VISIBILITY},
231     {attrWidth,                DISPID_IHTMLSTYLE_WIDTH},
232     {attrWordSpacing,          DISPID_IHTMLSTYLE_WORDSPACING},
233     {attrWordWrap,             DISPID_IHTMLSTYLE3_WORDWRAP},
234     {attrZIndex,               DISPID_IHTMLSTYLE_ZINDEX}
235 };
236
237 static const WCHAR valLineThrough[] =
238     {'l','i','n','e','-','t','h','r','o','u','g','h',0};
239 static const WCHAR valUnderline[] =
240     {'u','n','d','e','r','l','i','n','e',0};
241 static const WCHAR szNormal[] =
242     {'n','o','r','m','a','l',0};
243 static const WCHAR styleNone[] =
244     {'n','o','n','e',0};
245 static const WCHAR valOverline[] =
246     {'o','v','e','r','l','i','n','e',0};
247 static const WCHAR valBlink[] =
248     {'b','l','i','n','k',0};
249
250 static const WCHAR px_formatW[] = {'%','d','p','x',0};
251 static const WCHAR emptyW[] = {0};
252
253 static LPWSTR fix_px_value(LPCWSTR val)
254 {
255     LPCWSTR ptr = val;
256
257     while(*ptr) {
258         while(*ptr && isspaceW(*ptr))
259             ptr++;
260         if(!*ptr)
261             break;
262
263         while(*ptr && isdigitW(*ptr))
264             ptr++;
265
266         if(!*ptr || isspaceW(*ptr)) {
267             LPWSTR ret, p;
268             int len = strlenW(val)+1;
269
270             ret = heap_alloc((len+2)*sizeof(WCHAR));
271             memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
272             p = ret + (ptr-val);
273             *p++ = 'p';
274             *p++ = 'x';
275             strcpyW(p, ptr);
276
277             TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
278
279             return ret;
280         }
281
282         while(*ptr && !isspaceW(*ptr))
283             ptr++;
284     }
285
286     return NULL;
287 }
288
289 static LPWSTR fix_url_value(LPCWSTR val)
290 {
291     WCHAR *ret, *ptr;
292
293     static const WCHAR urlW[] = {'u','r','l','('};
294
295     if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
296         return NULL;
297
298     ret = heap_strdupW(val);
299
300     for(ptr = ret; *ptr; ptr++) {
301         if(*ptr == '\\')
302             *ptr = '/';
303     }
304
305     return ret;
306 }
307
308 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
309 {
310     nsAString str_name, str_value, str_empty;
311     LPWSTR val = NULL;
312     nsresult nsres;
313
314     static const PRUnichar wszEmpty[] = {0};
315
316     if(flags & ATTR_FIX_PX)
317         val = fix_px_value(value);
318     if(flags & ATTR_FIX_URL)
319         val = fix_url_value(value);
320
321     nsAString_InitDepend(&str_name, style_tbl[sid].name);
322     nsAString_InitDepend(&str_value, val ? val : value);
323     nsAString_InitDepend(&str_empty, wszEmpty);
324     heap_free(val);
325
326     nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
327     if(NS_FAILED(nsres))
328         ERR("SetProperty failed: %08x\n", nsres);
329
330     nsAString_Finish(&str_name);
331     nsAString_Finish(&str_value);
332     nsAString_Finish(&str_empty);
333
334     return S_OK;
335 }
336
337 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
338 {
339     switch(V_VT(value)) {
340     case VT_NULL:
341         return set_nsstyle_attr(nsstyle, sid, emptyW, flags);
342
343     case VT_BSTR:
344         return set_nsstyle_attr(nsstyle, sid, V_BSTR(value), flags);
345
346     case VT_BSTR|VT_BYREF:
347         return set_nsstyle_attr(nsstyle, sid, *V_BSTRREF(value), flags);
348
349     case VT_I4: {
350         WCHAR str[14];
351
352         static const WCHAR format[] = {'%','d',0};
353         static const WCHAR px_format[] = {'%','d','p','x',0};
354
355         wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
356         return set_nsstyle_attr(nsstyle, sid, str, flags & ~ATTR_FIX_PX);
357     }
358     default:
359         FIXME("not implemented vt %d\n", V_VT(value));
360         return E_NOTIMPL;
361
362     }
363
364     return S_OK;
365 }
366
367 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
368 {
369     return set_nsstyle_attr(This->nsstyle, sid, value, flags);
370 }
371
372 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
373 {
374     nsAString str_name;
375     nsresult nsres;
376
377     nsAString_InitDepend(&str_name, style_tbl[sid].name);
378
379     nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
380     if(NS_FAILED(nsres)) {
381         ERR("SetProperty failed: %08x\n", nsres);
382         return E_FAIL;
383     }
384
385     nsAString_Finish(&str_name);
386
387     return NS_OK;
388 }
389
390 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
391 {
392     nsAString str_value;
393     const PRUnichar *value;
394
395     nsAString_Init(&str_value, NULL);
396
397     get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
398
399     nsAString_GetData(&str_value, &value);
400     *p = *value ? SysAllocString(value) : NULL;
401
402     nsAString_Finish(&str_value);
403
404     TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
405     return S_OK;
406 }
407
408 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
409 {
410     nsAString str_value;
411     const PRUnichar *value;
412     BOOL set = FALSE;
413
414     nsAString_Init(&str_value, NULL);
415
416     get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
417
418     nsAString_GetData(&str_value, &value);
419
420     if(flags & ATTR_STR_TO_INT) {
421         const PRUnichar *ptr = value;
422         BOOL neg = FALSE;
423         INT i = 0;
424
425         if(*ptr == '-') {
426             neg = TRUE;
427             ptr++;
428         }
429
430         while(isdigitW(*ptr))
431             i = i*10 + (*ptr++ - '0');
432
433         if(!*ptr) {
434             V_VT(p) = VT_I4;
435             V_I4(p) = neg ? -i : i;
436             set = TRUE;
437         }
438     }
439
440     if(!set) {
441         BSTR str = NULL;
442
443         if(*value) {
444             str = SysAllocString(value);
445             if(!str)
446                 return E_OUTOFMEMORY;
447         }
448
449         V_VT(p) = VT_BSTR;
450         V_BSTR(p) = str;
451     }
452
453     nsAString_Finish(&str_value);
454
455     TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
456     return S_OK;
457 }
458
459 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
460 {
461     return get_nsstyle_attr(This->nsstyle, sid, p);
462 }
463
464 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
465 {
466     nsAString str_value;
467     const PRUnichar *value;
468
469     nsAString_Init(&str_value, NULL);
470
471     get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
472
473     nsAString_GetData(&str_value, &value);
474     *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
475     nsAString_Finish(&str_value);
476
477     TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
478     return S_OK;
479 }
480
481 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
482 {
483     WCHAR szValue[25];
484     WCHAR szFormat[] = {'%','.','0','f','p','x',0};
485
486     value = floor(value);
487
488     sprintfW(szValue, szFormat, value);
489
490     return set_style_attr(This, sid, szValue, 0);
491 }
492
493 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
494 {
495     nsAString str_value;
496     HRESULT hres;
497     WCHAR pxW[] = {'p','x',0};
498
499     TRACE("%p %d %p\n", This, sid, p);
500
501     *p = 0.0f;
502
503     nsAString_Init(&str_value, NULL);
504
505     hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
506     if(hres == S_OK)
507     {
508         WCHAR *ptr;
509         const PRUnichar *value;
510
511         nsAString_GetData(&str_value, &value);
512         if(value)
513         {
514             *p = strtolW(value, &ptr, 10);
515
516             if(*ptr && strcmpW(ptr, pxW))
517             {
518                 nsAString_Finish(&str_value);
519                 FIXME("only px values are currently supported\n");
520                 return E_FAIL;
521             }
522         }
523     }
524
525     TRACE("ret %f\n", *p);
526
527     nsAString_Finish(&str_value);
528
529     return hres;
530 }
531
532 static BOOL is_valid_border_style(BSTR v)
533 {
534     static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
535     static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
536     static const WCHAR styleSolid[]  = {'s','o','l','i','d',0};
537     static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
538     static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
539     static const WCHAR styleRidge[]  = {'r','i','d','g','e',0};
540     static const WCHAR styleInset[]  = {'i','n','s','e','t',0};
541     static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
542
543     TRACE("%s\n", debugstr_w(v));
544
545     if(!v || strcmpiW(v, styleNone)   == 0 || strcmpiW(v, styleDotted) == 0 ||
546              strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid)  == 0 ||
547              strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
548              strcmpiW(v, styleRidge)  == 0 || strcmpiW(v, styleInset)  == 0 ||
549              strcmpiW(v, styleOutset) == 0 )
550     {
551         return TRUE;
552     }
553
554     return FALSE;
555 }
556
557 #define HTMLSTYLE_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle, iface)
558
559 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
560 {
561     HTMLStyle *This = HTMLSTYLE_THIS(iface);
562
563     *ppv = NULL;
564
565     if(IsEqualGUID(&IID_IUnknown, riid)) {
566         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
567         *ppv = HTMLSTYLE(This);
568     }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
569         TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
570         *ppv = HTMLSTYLE(This);
571     }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
572         TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
573         *ppv = HTMLSTYLE2(This);
574     }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
575         TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
576         *ppv = HTMLSTYLE3(This);
577     }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
578         TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
579         *ppv = HTMLSTYLE4(This);
580     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
581         return *ppv ? S_OK : E_NOINTERFACE;
582     }
583
584     if(*ppv) {
585         IUnknown_AddRef((IUnknown*)*ppv);
586         return S_OK;
587     }
588
589     WARN("unsupported %s\n", debugstr_guid(riid));
590     return E_NOINTERFACE;
591 }
592
593 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
594 {
595     HTMLStyle *This = HTMLSTYLE_THIS(iface);
596     LONG ref = InterlockedIncrement(&This->ref);
597
598     TRACE("(%p) ref=%d\n", This, ref);
599
600     return ref;
601 }
602
603 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
604 {
605     HTMLStyle *This = HTMLSTYLE_THIS(iface);
606     LONG ref = InterlockedDecrement(&This->ref);
607
608     TRACE("(%p) ref=%d\n", This, ref);
609
610     if(!ref) {
611         if(This->nsstyle)
612             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
613         release_dispex(&This->dispex);
614         heap_free(This);
615     }
616
617     return ref;
618 }
619
620 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
621 {
622     HTMLStyle *This = HTMLSTYLE_THIS(iface);
623     return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
624 }
625
626 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
627                                               LCID lcid, ITypeInfo **ppTInfo)
628 {
629     HTMLStyle *This = HTMLSTYLE_THIS(iface);
630     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
631 }
632
633 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
634                                                 LPOLESTR *rgszNames, UINT cNames,
635                                                 LCID lcid, DISPID *rgDispId)
636 {
637     HTMLStyle *This = HTMLSTYLE_THIS(iface);
638     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
639             lcid, rgDispId);
640 }
641
642 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
643                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
644                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
645 {
646     HTMLStyle *This = HTMLSTYLE_THIS(iface);
647     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
648             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
649 }
650
651 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
652 {
653     HTMLStyle *This = HTMLSTYLE_THIS(iface);
654
655     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
656
657     return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
658 }
659
660 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
661 {
662     HTMLStyle *This = HTMLSTYLE_THIS(iface);
663
664     TRACE("(%p)->(%p)\n", This, p);
665
666     return get_style_attr(This, STYLEID_FONT_FAMILY, p);
667 }
668
669 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
670 {
671     HTMLStyle *This = HTMLSTYLE_THIS(iface);
672     static const WCHAR szItalic[]  = {'i','t','a','l','i','c',0};
673     static const WCHAR szOblique[]  = {'o','b','l','i','q','u','e',0};
674
675     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
676
677     /* fontStyle can only be one of the follow values. */
678     if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
679              strcmpiW(szOblique, v) == 0)
680     {
681         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
682     }
683
684     return E_INVALIDARG;
685 }
686
687 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
688 {
689     HTMLStyle *This = HTMLSTYLE_THIS(iface);
690
691     TRACE("(%p)->(%p)\n", This, p);
692
693     return get_style_attr(This, STYLEID_FONT_STYLE, p);
694 }
695
696 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
697 {
698     HTMLStyle *This = HTMLSTYLE_THIS(iface);
699     static const WCHAR szCaps[]  = {'s','m','a','l','l','-','c','a','p','s',0};
700
701     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
702
703     /* fontVariant can only be one of the follow values. */
704     if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
705     {
706         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
707     }
708
709     return E_INVALIDARG;
710 }
711
712 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
713 {
714     HTMLStyle *This = HTMLSTYLE_THIS(iface);
715     TRACE("(%p)->(%p)\n", This, p);
716
717     if(!p)
718        return E_INVALIDARG;
719
720     return get_style_attr(This, STYLEID_FONT_VARIANT, p);
721 }
722
723 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
724 {
725     HTMLStyle *This = HTMLSTYLE_THIS(iface);
726     static const WCHAR styleBold[] = {'b','o','l','d',0};
727     static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
728     static const WCHAR styleLighter[]  = {'l','i','g','h','t','e','r',0};
729     static const WCHAR style100[] = {'1','0','0',0};
730     static const WCHAR style200[] = {'2','0','0',0};
731     static const WCHAR style300[] = {'3','0','0',0};
732     static const WCHAR style400[] = {'4','0','0',0};
733     static const WCHAR style500[] = {'5','0','0',0};
734     static const WCHAR style600[] = {'6','0','0',0};
735     static const WCHAR style700[] = {'7','0','0',0};
736     static const WCHAR style800[] = {'8','0','0',0};
737     static const WCHAR style900[] = {'9','0','0',0};
738
739     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
740
741     /* fontWeight can only be one of the following */
742     if(!v || strcmpiW(szNormal, v) == 0    || strcmpiW(styleBold, v) == 0    ||
743              strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
744              strcmpiW(style100, v) == 0    || strcmpiW(style200, v) == 0     ||
745              strcmpiW(style300, v) == 0    || strcmpiW(style400, v) == 0     ||
746              strcmpiW(style500, v) == 0    || strcmpiW(style600, v) == 0     ||
747              strcmpiW(style700, v) == 0    || strcmpiW(style800, v) == 0     ||
748              strcmpiW(style900, v) == 0
749              )
750     {
751         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
752     }
753
754     return E_INVALIDARG;
755 }
756
757 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
758 {
759     HTMLStyle *This = HTMLSTYLE_THIS(iface);
760
761     TRACE("(%p)->(%p)\n", This, p);
762
763     return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
764 }
765
766 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
767 {
768     HTMLStyle *This = HTMLSTYLE_THIS(iface);
769
770     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
771
772     switch(V_VT(&v)) {
773     case VT_BSTR:
774         return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
775     default:
776         FIXME("not supported vt %d\n", V_VT(&v));
777     }
778
779     return S_OK;
780 }
781
782 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
783 {
784     HTMLStyle *This = HTMLSTYLE_THIS(iface);
785
786     TRACE("(%p)->(%p)\n", This, p);
787
788     V_VT(p) = VT_BSTR;
789     return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
790 }
791
792 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
793 {
794     HTMLStyle *This = HTMLSTYLE_THIS(iface);
795     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
796     return E_NOTIMPL;
797 }
798
799 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
800 {
801     HTMLStyle *This = HTMLSTYLE_THIS(iface);
802     FIXME("(%p)->(%p)\n", This, p);
803     return E_NOTIMPL;
804 }
805
806 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
807 {
808     HTMLStyle *This = HTMLSTYLE_THIS(iface);
809
810     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
811
812     switch(V_VT(&v)) {
813     case VT_BSTR:
814         TRACE("%s\n", debugstr_w(V_BSTR(&v)));
815         return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
816
817     default:
818         FIXME("unsupported vt=%d\n", V_VT(&v));
819     }
820
821     return E_NOTIMPL;
822 }
823
824 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
825 {
826     HTMLStyle *This = HTMLSTYLE_THIS(iface);
827
828     TRACE("(%p)->(%p)\n", This, p);
829
830     V_VT(p) = VT_BSTR;
831     return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
832 }
833
834 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
835 {
836     HTMLStyle *This = HTMLSTYLE_THIS(iface);
837
838     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
839
840     return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
841 }
842
843 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
844 {
845     HTMLStyle *This = HTMLSTYLE_THIS(iface);
846
847     TRACE("(%p)->(%p)\n", This, p);
848
849     return get_style_attr(This, STYLEID_BACKGROUND, p);
850 }
851
852 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
853 {
854     HTMLStyle *This = HTMLSTYLE_THIS(iface);
855
856     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
857
858     switch(V_VT(&v)) {
859     case VT_BSTR:
860         return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
861     case VT_I4: {
862         WCHAR value[10];
863         static const WCHAR format[] = {'#','%','0','6','x',0};
864
865         wsprintfW(value, format, V_I4(&v));
866         return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
867     }
868     default:
869         FIXME("unsupported vt %d\n", V_VT(&v));
870     }
871
872     return S_OK;
873 }
874
875 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
876 {
877     HTMLStyle *This = HTMLSTYLE_THIS(iface);
878     TRACE("(%p)->(%p)\n", This, p);
879
880     V_VT(p) = VT_BSTR;
881     return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
882 }
883
884 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
885 {
886     HTMLStyle *This = HTMLSTYLE_THIS(iface);
887
888     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
889
890     return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
891 }
892
893 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
894 {
895     HTMLStyle *This = HTMLSTYLE_THIS(iface);
896
897     TRACE("(%p)->(%p)\n", This, p);
898
899     return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
900 }
901
902 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
903 {
904     HTMLStyle *This = HTMLSTYLE_THIS(iface);
905     static const WCHAR styleRepeat[]   = {'r','e','p','e','a','t',0};
906     static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
907     static const WCHAR styleRepeatX[]  = {'r','e','p','e','a','t','-','x',0};
908     static const WCHAR styleRepeatY[]  = {'r','e','p','e','a','t','-','y',0};
909
910     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
911
912     /* fontWeight can only be one of the following */
913     if(!v || strcmpiW(styleRepeat, v) == 0    || strcmpiW(styleNoRepeat, v) == 0    ||
914              strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
915     {
916         return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
917     }
918
919     return E_INVALIDARG;
920 }
921
922 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
923 {
924     HTMLStyle *This = HTMLSTYLE_THIS(iface);
925
926     TRACE("(%p)->(%p)\n", This, p);
927
928     return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
929 }
930
931 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
932 {
933     HTMLStyle *This = HTMLSTYLE_THIS(iface);
934     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
935     return E_NOTIMPL;
936 }
937
938 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
939 {
940     HTMLStyle *This = HTMLSTYLE_THIS(iface);
941     FIXME("(%p)->(%p)\n", This, p);
942     return E_NOTIMPL;
943 }
944
945 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
946 {
947     HTMLStyle *This = HTMLSTYLE_THIS(iface);
948     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
949     return E_NOTIMPL;
950 }
951
952 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
953 {
954     HTMLStyle *This = HTMLSTYLE_THIS(iface);
955     FIXME("(%p)->(%p)\n", This, p);
956     return E_NOTIMPL;
957 }
958
959 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
960 {
961     HTMLStyle *This = HTMLSTYLE_THIS(iface);
962     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
963     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
964 }
965
966 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
967 {
968     HTMLStyle *This = HTMLSTYLE_THIS(iface);
969     TRACE("(%p)->(%p)\n", This, p);
970     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
971 }
972
973 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
974 {
975     HTMLStyle *This = HTMLSTYLE_THIS(iface);
976     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
977     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, &v, 0);
978 }
979
980 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
981 {
982     HTMLStyle *This = HTMLSTYLE_THIS(iface);
983     TRACE("(%p)->(%p)\n", This, p);
984     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, p, 0);
985 }
986
987 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
988 {
989     HTMLStyle *This = HTMLSTYLE_THIS(iface);
990     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
991     return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
992 }
993
994 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
995 {
996     HTMLStyle *This = HTMLSTYLE_THIS(iface);
997     TRACE("(%p)->(%p)\n", This, p);
998     return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
999 }
1000
1001 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1002 {
1003     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1004     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1005     return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1006 }
1007
1008 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1009 {
1010     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1011     TRACE("(%p)->(%p)\n", This, p);
1012     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1013 }
1014
1015 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1016 {
1017     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1018
1019     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1020
1021     /* textDecoration can only be one of the following */
1022     if(!v || strcmpiW(styleNone, v)   == 0 || strcmpiW(valUnderline, v)   == 0 ||
1023              strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1024              strcmpiW(valBlink, v)    == 0)
1025     {
1026         return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1027     }
1028
1029     return E_INVALIDARG;
1030 }
1031
1032 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1033 {
1034     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1035
1036     TRACE("(%p)->(%p)\n", This, p);
1037
1038     return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1039 }
1040
1041 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1042 {
1043     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1044
1045     TRACE("(%p)->(%x)\n", This, v);
1046
1047     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1048 }
1049
1050 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1051 {
1052     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1053
1054     TRACE("(%p)->(%p)\n", This, p);
1055
1056     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1057 }
1058
1059 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1060 {
1061     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1062
1063     TRACE("(%p)->(%x)\n", This, v);
1064
1065     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1066 }
1067
1068 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1069 {
1070     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1071
1072     TRACE("(%p)->(%p)\n", This, p);
1073
1074     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1075 }
1076
1077 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1078 {
1079     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1080
1081     TRACE("(%p)->(%x)\n", This, v);
1082
1083     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1084 }
1085
1086 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1087 {
1088     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1089
1090     TRACE("(%p)->(%p)\n", This, p);
1091
1092     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1093 }
1094
1095 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1096 {
1097     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1098
1099     TRACE("(%p)->(%x)\n", This, v);
1100
1101     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1102 }
1103
1104 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1105 {
1106     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1107
1108     TRACE("(%p)->(%p)\n", This, p);
1109
1110     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1111 }
1112
1113 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1114 {
1115     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1116
1117     TRACE("(%p)->(%x)\n", This, v);
1118
1119     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1120 }
1121
1122 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1123 {
1124     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1125
1126     TRACE("(%p)->(%p)\n", This, p);
1127
1128     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1129 }
1130
1131 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1132 {
1133     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1134
1135     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1136
1137     switch(V_VT(&v)) {
1138     case VT_BSTR:
1139         return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1140     default:
1141         FIXME("not implemented vt %d\n", V_VT(&v));
1142         return E_NOTIMPL;
1143     }
1144
1145     return S_OK;
1146 }
1147
1148 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1149 {
1150     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1151     BSTR ret;
1152     HRESULT hres;
1153
1154     TRACE("(%p)->(%p)\n", This, p);
1155
1156     hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1157     if(FAILED(hres))
1158         return hres;
1159
1160     V_VT(p) = VT_BSTR;
1161     V_BSTR(p) = ret;
1162     return S_OK;
1163 }
1164
1165 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1166 {
1167     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1168     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1169     return E_NOTIMPL;
1170 }
1171
1172 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1173 {
1174     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1175     FIXME("(%p)->(%p)\n", This, p);
1176     return E_NOTIMPL;
1177 }
1178
1179 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1180 {
1181     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1182
1183     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1184
1185     return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1186 }
1187
1188 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1189 {
1190     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1191
1192     TRACE("(%p)->(%p)\n", This, p);
1193
1194     return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1195 }
1196
1197 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1198 {
1199     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1200     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1201     return E_NOTIMPL;
1202 }
1203
1204 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1205 {
1206     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1207     FIXME("(%p)->(%p)\n", This, p);
1208     return E_NOTIMPL;
1209 }
1210
1211 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1212 {
1213     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1214     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1215     return E_NOTIMPL;
1216 }
1217
1218 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1219 {
1220     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1221     FIXME("(%p)->(%p)\n", This, p);
1222     return E_NOTIMPL;
1223 }
1224
1225 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1226 {
1227     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1228
1229     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1230
1231     return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1232 }
1233
1234 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1235 {
1236     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1237
1238     TRACE("(%p)->(%p)\n", This, p);
1239
1240     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1241 }
1242
1243 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1244 {
1245     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1246
1247     TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1248
1249     switch(V_VT(&v)) {
1250     case VT_NULL:
1251         return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1252     case VT_I4: {
1253         WCHAR buf[14];
1254
1255         wsprintfW(buf, px_formatW, V_I4(&v));
1256         return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1257     }
1258     case VT_BSTR:
1259         return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1260     default:
1261         FIXME("Unsupported vt=%d\n", V_VT(&v));
1262     }
1263
1264     return E_NOTIMPL;
1265 }
1266
1267 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1268 {
1269     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1270     TRACE("(%p)->(%p)\n", This, p);
1271     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1272 }
1273
1274 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1275 {
1276     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1277     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1278     return E_NOTIMPL;
1279 }
1280
1281 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1282 {
1283     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1284     FIXME("(%p)->(%p)\n", This, p);
1285     return E_NOTIMPL;
1286 }
1287
1288 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1289 {
1290     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1291
1292     switch(V_VT(&v)) {
1293     case VT_NULL:
1294         TRACE("(%p)->(NULL)\n", This);
1295         return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1296     case VT_I4: {
1297         WCHAR buf[14];
1298
1299         TRACE("(%p)->(%d)\n", This, V_I4(&v));
1300
1301         wsprintfW(buf, px_formatW, V_I4(&v));
1302         return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1303     }
1304     case VT_BSTR:
1305         TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1306         return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1307     default:
1308         FIXME("Unsupported vt=%d\n", V_VT(&v));
1309     }
1310
1311     return E_NOTIMPL;
1312 }
1313
1314 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1315 {
1316     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1317
1318     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1319
1320     return set_style_attr(This, STYLEID_MARGIN, v, 0);
1321 }
1322
1323 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1324 {
1325     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1326
1327     TRACE("(%p)->(%p)\n", This, p);
1328
1329     return get_style_attr(This, STYLEID_MARGIN, p);
1330 }
1331
1332 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1333 {
1334     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1335     TRACE("(%p)->(%p)\n", This, p);
1336     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1337 }
1338
1339 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1340 {
1341     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1342     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1343     return E_NOTIMPL;
1344 }
1345
1346 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1347 {
1348     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1349     FIXME("(%p)->(%p)\n", This, p);
1350     return E_NOTIMPL;
1351 }
1352
1353 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1354 {
1355     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1356     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1357     return E_NOTIMPL;
1358 }
1359
1360 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1361 {
1362     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1363     FIXME("(%p)->(%p)\n", This, p);
1364     return E_NOTIMPL;
1365 }
1366
1367 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1368 {
1369     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1370     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1371     return E_NOTIMPL;
1372 }
1373
1374 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1375 {
1376     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1377     FIXME("(%p)->(%p)\n", This, p);
1378     return E_NOTIMPL;
1379 }
1380
1381 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1382 {
1383     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1384
1385     TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1386
1387     switch(V_VT(&v)) {
1388     case VT_I4: {
1389         WCHAR buf[14];
1390
1391         wsprintfW(buf, px_formatW, V_I4(&v));
1392         return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1393     }
1394     case VT_BSTR:
1395         return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1396     default:
1397         FIXME("unsupported vt=%d\n", V_VT(&v));
1398     }
1399
1400     return E_NOTIMPL;
1401 }
1402
1403 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1404 {
1405     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1406     BSTR ret;
1407     HRESULT hres;
1408
1409     TRACE("(%p)->(%p)\n", This, p);
1410
1411     hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1412     if(FAILED(hres))
1413         return hres;
1414
1415     V_VT(p) = VT_BSTR;
1416     V_BSTR(p) = ret;
1417     return S_OK;
1418 }
1419
1420 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1421 {
1422     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1423
1424     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1425
1426     return set_style_attr(This, STYLEID_PADDING, v, 0);
1427 }
1428
1429 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1430 {
1431     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1432
1433     TRACE("(%p)->(%p)\n", This, p);
1434
1435     return get_style_attr(This, STYLEID_PADDING, p);
1436 }
1437
1438 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1439 {
1440     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1441
1442     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1443
1444     return set_style_attr(This, STYLEID_BORDER, v, 0);
1445 }
1446
1447 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1448 {
1449     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1450
1451     TRACE("(%p)->(%p)\n", This, p);
1452
1453     return get_style_attr(This, STYLEID_BORDER, p);
1454 }
1455
1456 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1457 {
1458     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1459     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1460     return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1461 }
1462
1463 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1464 {
1465     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1466     TRACE("(%p)->(%p)\n", This, p);
1467     return get_style_attr(This, STYLEID_BORDER_TOP, p);
1468 }
1469
1470 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1471 {
1472     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1473     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1474     return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1475 }
1476
1477 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1478 {
1479     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1480     TRACE("(%p)->(%p)\n", This, p);
1481     return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1482 }
1483
1484 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1485 {
1486     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1487     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1488     return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1489 }
1490
1491 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1492 {
1493     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1494     TRACE("(%p)->(%p)\n", This, p);
1495     return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1496 }
1497
1498 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1499 {
1500     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1501
1502     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1503
1504     return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1505 }
1506
1507 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1508 {
1509     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1510
1511     TRACE("(%p)->(%p)\n", This, p);
1512
1513     return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1514 }
1515
1516 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1517 {
1518     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1519
1520     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1521
1522     return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1523 }
1524
1525 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1526 {
1527     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1528
1529     TRACE("(%p)->(%p)\n", This, p);
1530
1531     return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1532 }
1533
1534 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1535 {
1536     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1537     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1538     return E_NOTIMPL;
1539 }
1540
1541 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1542 {
1543     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1544
1545     TRACE("(%p)->(%p)\n", This, p);
1546
1547     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1548 }
1549
1550 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1551 {
1552     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1553     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1554     return E_NOTIMPL;
1555 }
1556
1557 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1558 {
1559     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1560
1561     TRACE("(%p)->(%p)\n", This, p);
1562
1563     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1564 }
1565
1566 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1567 {
1568     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1569     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1570     return E_NOTIMPL;
1571 }
1572
1573 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1574 {
1575     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1576
1577     TRACE("(%p)->(%p)\n", This, p);
1578
1579     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1580 }
1581
1582 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1583 {
1584     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1585     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1586     return E_NOTIMPL;
1587 }
1588
1589 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1590 {
1591     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1592
1593     TRACE("(%p)->(%p)\n", This, p);
1594
1595     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1596 }
1597
1598 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1599 {
1600     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1601     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1602     return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1603 }
1604
1605 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1606 {
1607     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1608     TRACE("(%p)->(%p)\n", This, p);
1609     return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1610 }
1611
1612 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1613 {
1614     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1615     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1616     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1617 }
1618
1619 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1620 {
1621     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1622
1623     TRACE("(%p)->(%p)\n", This, p);
1624
1625     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1626 }
1627
1628 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1629 {
1630     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1631     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1632     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1633 }
1634
1635 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1636 {
1637     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1638     TRACE("(%p)->(%p)\n", This, p);
1639     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1640 }
1641
1642 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1643 {
1644     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1645
1646     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1647     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1648 }
1649
1650 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1651 {
1652     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1653     TRACE("(%p)->(%p)\n", This, p);
1654     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1655 }
1656
1657 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1658 {
1659     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1660     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1661     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1662 }
1663
1664 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1665 {
1666     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1667     TRACE("(%p)->(%p)\n", This, p);
1668     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1669 }
1670
1671 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1672 {
1673     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1674     static const WCHAR styleWindowInset[]  = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1675     HRESULT hres = S_OK;
1676     BSTR pstyle;
1677     int i=0;
1678     int last = 0;
1679
1680     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1681
1682     while(v[i] && hres == S_OK)
1683     {
1684         if(v[i] == (WCHAR)' ')
1685         {
1686             pstyle = SysAllocStringLen(&v[last], (i-last));
1687             if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1688             {
1689                 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1690                 hres = E_INVALIDARG;
1691             }
1692             SysFreeString(pstyle);
1693             last = i+1;
1694         }
1695         i++;
1696     }
1697
1698     if(hres == S_OK)
1699     {
1700         pstyle = SysAllocStringLen(&v[last], i-last);
1701         if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1702         {
1703             TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1704             hres = E_INVALIDARG;
1705         }
1706         SysFreeString(pstyle);
1707     }
1708
1709     if(hres == S_OK)
1710         hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1711
1712     return hres;
1713 }
1714
1715 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1716 {
1717     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1718     TRACE("(%p)->(%p)\n", This, p);
1719     return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1720 }
1721
1722 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1723 {
1724     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1725     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1726
1727     if(!is_valid_border_style(v))
1728         return E_INVALIDARG;
1729
1730     return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1731 }
1732
1733 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1734 {
1735     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1736     TRACE("(%p)->(%p)\n", This, p);
1737     return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1738 }
1739
1740 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1741 {
1742     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1743     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1744
1745     if(!is_valid_border_style(v))
1746         return E_INVALIDARG;
1747
1748     return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1749 }
1750
1751 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1752 {
1753     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1754     TRACE("(%p)->(%p)\n", This, p);
1755     return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1756 }
1757
1758 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1759 {
1760     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1761     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1762
1763     if(!is_valid_border_style(v))
1764         return E_INVALIDARG;
1765
1766     return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1767 }
1768
1769 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1770 {
1771     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1772     TRACE("(%p)->(%p)\n", This, p);
1773     return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1774 }
1775
1776 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1777 {
1778     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1779     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1780
1781     if(!is_valid_border_style(v))
1782         return E_INVALIDARG;
1783
1784     return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1785 }
1786
1787 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1788 {
1789     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1790     TRACE("(%p)->(%p)\n", This, p);
1791     return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
1792 }
1793
1794 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
1795 {
1796     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1797
1798     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1799
1800     return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
1801 }
1802
1803 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
1804 {
1805     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1806
1807     TRACE("(%p)->(%p)\n", This, p);
1808
1809     V_VT(p) = VT_BSTR;
1810     return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
1811 }
1812
1813 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
1814 {
1815     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1816
1817     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1818
1819     switch(V_VT(&v)) {
1820     case VT_BSTR:
1821         return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
1822     default:
1823         FIXME("unimplemented vt %d\n", V_VT(&v));
1824         return E_NOTIMPL;
1825     }
1826
1827     return S_OK;
1828 }
1829
1830 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
1831 {
1832     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1833     BSTR ret;
1834     HRESULT hres;
1835
1836     TRACE("(%p)->(%p)\n", This, p);
1837
1838     hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
1839     if(FAILED(hres))
1840         return hres;
1841
1842     V_VT(p) = VT_BSTR;
1843     V_BSTR(p) = ret;
1844     return S_OK;
1845 }
1846
1847 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
1848 {
1849     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1850     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1851     return E_NOTIMPL;
1852 }
1853
1854 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
1855 {
1856     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1857     FIXME("(%p)->(%p)\n", This, p);
1858     return E_NOTIMPL;
1859 }
1860
1861 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
1862 {
1863     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1864     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1865     return E_NOTIMPL;
1866 }
1867
1868 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
1869 {
1870     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1871     FIXME("(%p)->(%p)\n", This, p);
1872     return E_NOTIMPL;
1873 }
1874
1875 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
1876 {
1877     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1878
1879     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1880
1881     return set_style_attr(This, STYLEID_DISPLAY, v, 0);
1882 }
1883
1884 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
1885 {
1886     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1887
1888     TRACE("(%p)->(%p)\n", This, p);
1889
1890     return get_style_attr(This, STYLEID_DISPLAY, p);
1891 }
1892
1893 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
1894 {
1895     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1896
1897     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1898
1899     return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
1900 }
1901
1902 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
1903 {
1904     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1905
1906     TRACE("(%p)->(%p)\n", This, p);
1907
1908     return get_style_attr(This, STYLEID_VISIBILITY, p);
1909 }
1910
1911 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
1912 {
1913     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1914     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1915     return E_NOTIMPL;
1916 }
1917
1918 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
1919 {
1920     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1921     FIXME("(%p)->(%p)\n", This, p);
1922     return E_NOTIMPL;
1923 }
1924
1925 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
1926 {
1927     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1928     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1929     return E_NOTIMPL;
1930 }
1931
1932 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
1933 {
1934     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1935     FIXME("(%p)->(%p)\n", This, p);
1936     return E_NOTIMPL;
1937 }
1938
1939 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
1940 {
1941     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1942     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1943     return E_NOTIMPL;
1944 }
1945
1946 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
1947 {
1948     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1949     FIXME("(%p)->(%p)\n", This, p);
1950     return E_NOTIMPL;
1951 }
1952
1953 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
1954 {
1955     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1956     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1957     return E_NOTIMPL;
1958 }
1959
1960 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
1961 {
1962     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1963     FIXME("(%p)->(%p)\n", This, p);
1964     return E_NOTIMPL;
1965 }
1966
1967 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
1968 {
1969     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1970     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1971     return E_NOTIMPL;
1972 }
1973
1974 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
1975 {
1976     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1977     FIXME("(%p)->(%p)\n", This, p);
1978     return E_NOTIMPL;
1979 }
1980
1981 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
1982 {
1983     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1984
1985     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1986
1987     return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
1988 }
1989
1990 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
1991 {
1992     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1993     BSTR ret;
1994     HRESULT hres;
1995
1996     TRACE("(%p)->(%p)\n", This, p);
1997
1998     hres = get_style_attr(This, STYLEID_TOP, &ret);
1999     if(FAILED(hres))
2000         return hres;
2001
2002     V_VT(p) = VT_BSTR;
2003     V_BSTR(p) = ret;
2004     return S_OK;
2005 }
2006
2007 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2008 {
2009     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2010
2011     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2012
2013     return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2014 }
2015
2016 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2017 {
2018     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2019     BSTR ret;
2020     HRESULT hres;
2021
2022     TRACE("(%p)->(%p)\n", This, p);
2023
2024     hres = get_style_attr(This, STYLEID_LEFT, &ret);
2025     if(FAILED(hres))
2026         return hres;
2027
2028     V_VT(p) = VT_BSTR;
2029     V_BSTR(p) = ret;
2030     return S_OK;
2031 }
2032
2033 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2034 {
2035     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2036     TRACE("(%p)->(%p)\n", This, p);
2037     return IHTMLStyle2_get_position(HTMLSTYLE2(This), p);
2038 }
2039
2040 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2041 {
2042     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2043
2044     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2045
2046     switch(V_VT(&v)) {
2047     case VT_BSTR:
2048         return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2049     case VT_I4: {
2050         WCHAR value[14];
2051         static const WCHAR format[] = {'%','d',0};
2052
2053         wsprintfW(value, format, V_I4(&v));
2054         return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2055     }
2056     default:
2057         FIXME("unimplemented vt %d\n", V_VT(&v));
2058         return E_NOTIMPL;
2059     }
2060
2061     return S_OK;
2062 }
2063
2064 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2065 {
2066     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2067
2068     TRACE("(%p)->(%p)\n", This, p);
2069
2070     return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2071 }
2072
2073 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2074 {
2075     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2076     static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2077     static const WCHAR szScroll[]  = {'s','c','r','o','l','l',0};
2078     static const WCHAR szHidden[]  = {'h','i','d','d','e','n',0};
2079     static const WCHAR szAuto[]    = {'a','u','t','o',0};
2080
2081     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2082
2083     /* overflow can only be one of the follow values. */
2084     if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2085              strcmpiW(szHidden, v) == 0  || strcmpiW(szAuto, v) == 0)
2086     {
2087         return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2088     }
2089
2090     return E_INVALIDARG;
2091 }
2092
2093
2094 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2095 {
2096     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2097
2098     TRACE("(%p)->(%p)\n", This, p);
2099
2100     if(!p)
2101        return E_INVALIDARG;
2102
2103     return get_style_attr(This, STYLEID_OVERFLOW, p);
2104 }
2105
2106 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2107 {
2108     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2109     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2110     return E_NOTIMPL;
2111 }
2112
2113 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2114 {
2115     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2116     FIXME("(%p)->(%p)\n", This, p);
2117     return E_NOTIMPL;
2118 }
2119
2120 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2121 {
2122     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2123     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2124     return E_NOTIMPL;
2125 }
2126
2127 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2128 {
2129     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2130     FIXME("(%p)->(%p)\n", This, p);
2131     return E_NOTIMPL;
2132 }
2133
2134 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2135 {
2136     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2137     nsAString text_str;
2138     nsresult nsres;
2139
2140     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2141
2142     nsAString_InitDepend(&text_str, v);
2143     nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2144     nsAString_Finish(&text_str);
2145     if(NS_FAILED(nsres)) {
2146         FIXME("SetCssStyle failed: %08x\n", nsres);
2147         return E_FAIL;
2148     }
2149
2150     return S_OK;
2151 }
2152
2153 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2154 {
2155     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2156     nsAString text_str;
2157     nsresult nsres;
2158
2159     TRACE("(%p)->(%p)\n", This, p);
2160
2161     /* FIXME: Gecko style formatting is different than IE (uppercase). */
2162     nsAString_Init(&text_str, NULL);
2163     nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2164     if(NS_SUCCEEDED(nsres)) {
2165         const PRUnichar *text;
2166
2167         nsAString_GetData(&text_str, &text);
2168         *p = *text ? SysAllocString(text) : NULL;
2169     }else {
2170         FIXME("GetCssStyle failed: %08x\n", nsres);
2171         *p = NULL;
2172     }
2173
2174     nsAString_Finish(&text_str);
2175     return S_OK;
2176 }
2177
2178 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2179 {
2180     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2181     FIXME("(%p)->()\n", This);
2182     return E_NOTIMPL;
2183 }
2184
2185 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2186 {
2187     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2188     FIXME("(%p)->()\n", This);
2189     return E_NOTIMPL;
2190 }
2191
2192 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2193 {
2194     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2195     FIXME("(%p)->()\n", This);
2196     return E_NOTIMPL;
2197 }
2198
2199 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2200 {
2201     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2202     FIXME("(%p)->()\n", This);
2203     return E_NOTIMPL;
2204 }
2205
2206 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2207 {
2208     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2209     FIXME("(%p)->()\n", This);
2210     return E_NOTIMPL;
2211 }
2212
2213 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2214 {
2215     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2216     FIXME("(%p)->()\n", This);
2217     return E_NOTIMPL;
2218 }
2219
2220 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2221 {
2222     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2223     FIXME("(%p)->()\n", This);
2224     return E_NOTIMPL;
2225 }
2226
2227 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2228 {
2229     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2230     FIXME("(%p)->()\n", This);
2231     return E_NOTIMPL;
2232 }
2233
2234 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2235 {
2236     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2237
2238     TRACE("(%p)->(%f)\n", This, v);
2239
2240     return set_style_pos(This, STYLEID_TOP, v);
2241 }
2242
2243 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2244 {
2245     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2246
2247     TRACE("(%p)->(%p)\n", This, p);
2248
2249     if(!p)
2250         return E_POINTER;
2251
2252     return get_nsstyle_pos(This, STYLEID_TOP, p);
2253 }
2254
2255 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2256 {
2257     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2258
2259     TRACE("(%p)->(%f)\n", This, v);
2260
2261     return set_style_pos(This, STYLEID_LEFT, v);
2262 }
2263
2264 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2265 {
2266     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2267
2268     TRACE("(%p)->(%p)\n", This, p);
2269
2270     if(!p)
2271         return E_POINTER;
2272
2273     return get_nsstyle_pos(This, STYLEID_LEFT, p);
2274 }
2275
2276 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2277 {
2278     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2279
2280     TRACE("(%p)->(%f)\n", This, v);
2281
2282     return set_style_pos(This, STYLEID_WIDTH, v);
2283 }
2284
2285 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2286 {
2287     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2288
2289     TRACE("(%p)->(%p)\n", This, p);
2290
2291     if(!p)
2292         return E_POINTER;
2293
2294     if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2295         *p = 0.0f;
2296
2297     return S_OK;
2298 }
2299
2300 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2301 {
2302     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2303
2304     TRACE("(%p)->(%f)\n", This, v);
2305
2306     return set_style_pos(This, STYLEID_HEIGHT, v);
2307 }
2308
2309 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2310 {
2311     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2312
2313     TRACE("(%p)->(%p)\n", This, p);
2314
2315     if(!p)
2316         return E_POINTER;
2317
2318     if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2319         *p = 0.0f;
2320
2321     return S_OK;
2322 }
2323
2324 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2325 {
2326     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2327
2328     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2329
2330     return set_style_attr(This, STYLEID_CURSOR, v, 0);
2331 }
2332
2333 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2334 {
2335     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2336
2337     TRACE("(%p)->(%p)\n", This, p);
2338
2339     return get_style_attr(This, STYLEID_CURSOR, p);
2340 }
2341
2342 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2343 {
2344     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2345     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2346     return E_NOTIMPL;
2347 }
2348
2349 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2350 {
2351     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2352     FIXME("(%p)->(%p)\n", This, p);
2353     return E_NOTIMPL;
2354 }
2355
2356 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2357 {
2358     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2359
2360     WARN("(%p)->(%s)\n", This, debugstr_w(v));
2361
2362     /* FIXME: Handle MS-style filters */
2363     return set_style_attr(This, STYLEID_FILTER, v, 0);
2364 }
2365
2366 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2367 {
2368     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2369
2370     WARN("(%p)->(%p)\n", This, p);
2371
2372     /* FIXME: Handle MS-style filters */
2373     return get_style_attr(This, STYLEID_FILTER, p);
2374 }
2375
2376 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2377         VARIANT AttributeValue, LONG lFlags)
2378 {
2379     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2380     HRESULT hres;
2381     DISPID dispid;
2382
2383     TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2384            V_VT(&AttributeValue), lFlags);
2385
2386     if(!strAttributeName)
2387         return E_INVALIDARG;
2388
2389     if(lFlags == 1)
2390         FIXME("Parameter lFlags ignored\n");
2391
2392     hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2393                         LOCALE_USER_DEFAULT, &dispid);
2394     if(hres == S_OK)
2395     {
2396         VARIANT ret;
2397         DISPID dispidNamed = DISPID_PROPERTYPUT;
2398         DISPPARAMS params;
2399
2400         params.cArgs = 1;
2401         params.rgvarg = &AttributeValue;
2402         params.cNamedArgs = 1;
2403         params.rgdispidNamedArgs = &dispidNamed;
2404
2405         hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2406             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2407     }
2408     else
2409     {
2410         FIXME("Custom attributes not supported.\n");
2411     }
2412
2413     TRACE("ret: %08x\n", hres);
2414
2415     return hres;
2416 }
2417
2418 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2419         LONG lFlags, VARIANT *AttributeValue)
2420 {
2421     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2422     HRESULT hres;
2423     DISPID dispid;
2424
2425     TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2426           AttributeValue, lFlags);
2427
2428     if(!AttributeValue || !strAttributeName)
2429         return E_INVALIDARG;
2430
2431     if(lFlags == 1)
2432         FIXME("Parameter lFlags ignored\n");
2433
2434     hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2435                         LOCALE_USER_DEFAULT, &dispid);
2436     if(hres == S_OK)
2437     {
2438         DISPPARAMS params = {NULL, NULL, 0, 0 };
2439
2440         hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2441             DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2442     }
2443     else
2444     {
2445         FIXME("Custom attributes not supported.\n");
2446     }
2447
2448     return hres;
2449 }
2450
2451 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2452                                                 LONG lFlags, VARIANT_BOOL *pfSuccess)
2453 {
2454     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2455     FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2456          lFlags, pfSuccess);
2457     return E_NOTIMPL;
2458 }
2459
2460 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2461 {
2462     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2463     FIXME("(%p)->(%p)\n", This, String);
2464     return E_NOTIMPL;
2465 }
2466
2467 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2468     HTMLStyle_QueryInterface,
2469     HTMLStyle_AddRef,
2470     HTMLStyle_Release,
2471     HTMLStyle_GetTypeInfoCount,
2472     HTMLStyle_GetTypeInfo,
2473     HTMLStyle_GetIDsOfNames,
2474     HTMLStyle_Invoke,
2475     HTMLStyle_put_fontFamily,
2476     HTMLStyle_get_fontFamily,
2477     HTMLStyle_put_fontStyle,
2478     HTMLStyle_get_fontStyle,
2479     HTMLStyle_put_fontVariant,
2480     HTMLStyle_get_fontVariant,
2481     HTMLStyle_put_fontWeight,
2482     HTMLStyle_get_fontWeight,
2483     HTMLStyle_put_fontSize,
2484     HTMLStyle_get_fontSize,
2485     HTMLStyle_put_font,
2486     HTMLStyle_get_font,
2487     HTMLStyle_put_color,
2488     HTMLStyle_get_color,
2489     HTMLStyle_put_background,
2490     HTMLStyle_get_background,
2491     HTMLStyle_put_backgroundColor,
2492     HTMLStyle_get_backgroundColor,
2493     HTMLStyle_put_backgroundImage,
2494     HTMLStyle_get_backgroundImage,
2495     HTMLStyle_put_backgroundRepeat,
2496     HTMLStyle_get_backgroundRepeat,
2497     HTMLStyle_put_backgroundAttachment,
2498     HTMLStyle_get_backgroundAttachment,
2499     HTMLStyle_put_backgroundPosition,
2500     HTMLStyle_get_backgroundPosition,
2501     HTMLStyle_put_backgroundPositionX,
2502     HTMLStyle_get_backgroundPositionX,
2503     HTMLStyle_put_backgroundPositionY,
2504     HTMLStyle_get_backgroundPositionY,
2505     HTMLStyle_put_wordSpacing,
2506     HTMLStyle_get_wordSpacing,
2507     HTMLStyle_put_letterSpacing,
2508     HTMLStyle_get_letterSpacing,
2509     HTMLStyle_put_textDecoration,
2510     HTMLStyle_get_textDecoration,
2511     HTMLStyle_put_textDecorationNone,
2512     HTMLStyle_get_textDecorationNone,
2513     HTMLStyle_put_textDecorationUnderline,
2514     HTMLStyle_get_textDecorationUnderline,
2515     HTMLStyle_put_textDecorationOverline,
2516     HTMLStyle_get_textDecorationOverline,
2517     HTMLStyle_put_textDecorationLineThrough,
2518     HTMLStyle_get_textDecorationLineThrough,
2519     HTMLStyle_put_textDecorationBlink,
2520     HTMLStyle_get_textDecorationBlink,
2521     HTMLStyle_put_verticalAlign,
2522     HTMLStyle_get_verticalAlign,
2523     HTMLStyle_put_textTransform,
2524     HTMLStyle_get_textTransform,
2525     HTMLStyle_put_textAlign,
2526     HTMLStyle_get_textAlign,
2527     HTMLStyle_put_textIndent,
2528     HTMLStyle_get_textIndent,
2529     HTMLStyle_put_lineHeight,
2530     HTMLStyle_get_lineHeight,
2531     HTMLStyle_put_marginTop,
2532     HTMLStyle_get_marginTop,
2533     HTMLStyle_put_marginRight,
2534     HTMLStyle_get_marginRight,
2535     HTMLStyle_put_marginBottom,
2536     HTMLStyle_get_marginBottom,
2537     HTMLStyle_put_marginLeft,
2538     HTMLStyle_get_marginLeft,
2539     HTMLStyle_put_margin,
2540     HTMLStyle_get_margin,
2541     HTMLStyle_put_paddingTop,
2542     HTMLStyle_get_paddingTop,
2543     HTMLStyle_put_paddingRight,
2544     HTMLStyle_get_paddingRight,
2545     HTMLStyle_put_paddingBottom,
2546     HTMLStyle_get_paddingBottom,
2547     HTMLStyle_put_paddingLeft,
2548     HTMLStyle_get_paddingLeft,
2549     HTMLStyle_put_padding,
2550     HTMLStyle_get_padding,
2551     HTMLStyle_put_border,
2552     HTMLStyle_get_border,
2553     HTMLStyle_put_borderTop,
2554     HTMLStyle_get_borderTop,
2555     HTMLStyle_put_borderRight,
2556     HTMLStyle_get_borderRight,
2557     HTMLStyle_put_borderBottom,
2558     HTMLStyle_get_borderBottom,
2559     HTMLStyle_put_borderLeft,
2560     HTMLStyle_get_borderLeft,
2561     HTMLStyle_put_borderColor,
2562     HTMLStyle_get_borderColor,
2563     HTMLStyle_put_borderTopColor,
2564     HTMLStyle_get_borderTopColor,
2565     HTMLStyle_put_borderRightColor,
2566     HTMLStyle_get_borderRightColor,
2567     HTMLStyle_put_borderBottomColor,
2568     HTMLStyle_get_borderBottomColor,
2569     HTMLStyle_put_borderLeftColor,
2570     HTMLStyle_get_borderLeftColor,
2571     HTMLStyle_put_borderWidth,
2572     HTMLStyle_get_borderWidth,
2573     HTMLStyle_put_borderTopWidth,
2574     HTMLStyle_get_borderTopWidth,
2575     HTMLStyle_put_borderRightWidth,
2576     HTMLStyle_get_borderRightWidth,
2577     HTMLStyle_put_borderBottomWidth,
2578     HTMLStyle_get_borderBottomWidth,
2579     HTMLStyle_put_borderLeftWidth,
2580     HTMLStyle_get_borderLeftWidth,
2581     HTMLStyle_put_borderStyle,
2582     HTMLStyle_get_borderStyle,
2583     HTMLStyle_put_borderTopStyle,
2584     HTMLStyle_get_borderTopStyle,
2585     HTMLStyle_put_borderRightStyle,
2586     HTMLStyle_get_borderRightStyle,
2587     HTMLStyle_put_borderBottomStyle,
2588     HTMLStyle_get_borderBottomStyle,
2589     HTMLStyle_put_borderLeftStyle,
2590     HTMLStyle_get_borderLeftStyle,
2591     HTMLStyle_put_width,
2592     HTMLStyle_get_width,
2593     HTMLStyle_put_height,
2594     HTMLStyle_get_height,
2595     HTMLStyle_put_styleFloat,
2596     HTMLStyle_get_styleFloat,
2597     HTMLStyle_put_clear,
2598     HTMLStyle_get_clear,
2599     HTMLStyle_put_display,
2600     HTMLStyle_get_display,
2601     HTMLStyle_put_visibility,
2602     HTMLStyle_get_visibility,
2603     HTMLStyle_put_listStyleType,
2604     HTMLStyle_get_listStyleType,
2605     HTMLStyle_put_listStylePosition,
2606     HTMLStyle_get_listStylePosition,
2607     HTMLStyle_put_listStyleImage,
2608     HTMLStyle_get_listStyleImage,
2609     HTMLStyle_put_listStyle,
2610     HTMLStyle_get_listStyle,
2611     HTMLStyle_put_whiteSpace,
2612     HTMLStyle_get_whiteSpace,
2613     HTMLStyle_put_top,
2614     HTMLStyle_get_top,
2615     HTMLStyle_put_left,
2616     HTMLStyle_get_left,
2617     HTMLStyle_get_position,
2618     HTMLStyle_put_zIndex,
2619     HTMLStyle_get_zIndex,
2620     HTMLStyle_put_overflow,
2621     HTMLStyle_get_overflow,
2622     HTMLStyle_put_pageBreakBefore,
2623     HTMLStyle_get_pageBreakBefore,
2624     HTMLStyle_put_pageBreakAfter,
2625     HTMLStyle_get_pageBreakAfter,
2626     HTMLStyle_put_cssText,
2627     HTMLStyle_get_cssText,
2628     HTMLStyle_put_pixelTop,
2629     HTMLStyle_get_pixelTop,
2630     HTMLStyle_put_pixelLeft,
2631     HTMLStyle_get_pixelLeft,
2632     HTMLStyle_put_pixelWidth,
2633     HTMLStyle_get_pixelWidth,
2634     HTMLStyle_put_pixelHeight,
2635     HTMLStyle_get_pixelHeight,
2636     HTMLStyle_put_posTop,
2637     HTMLStyle_get_posTop,
2638     HTMLStyle_put_posLeft,
2639     HTMLStyle_get_posLeft,
2640     HTMLStyle_put_posWidth,
2641     HTMLStyle_get_posWidth,
2642     HTMLStyle_put_posHeight,
2643     HTMLStyle_get_posHeight,
2644     HTMLStyle_put_cursor,
2645     HTMLStyle_get_cursor,
2646     HTMLStyle_put_clip,
2647     HTMLStyle_get_clip,
2648     HTMLStyle_put_filter,
2649     HTMLStyle_get_filter,
2650     HTMLStyle_setAttribute,
2651     HTMLStyle_getAttribute,
2652     HTMLStyle_removeAttribute,
2653     HTMLStyle_toString
2654 };
2655
2656 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
2657 {
2658     int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2659
2660     while(min <= max) {
2661         i = (min+max)/2;
2662
2663         c = strcmpW(style_tbl[i].name, name);
2664         if(!c) {
2665             *dispid = style_tbl[i].dispid;
2666             return S_OK;
2667         }
2668
2669         if(c > 0)
2670             max = i-1;
2671         else
2672             min = i+1;
2673     }
2674
2675     return DISP_E_UNKNOWNNAME;
2676 }
2677
2678 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
2679     NULL,
2680     HTMLStyle_get_dispid,
2681     NULL
2682 };
2683
2684 static const tid_t HTMLStyle_iface_tids[] = {
2685     IHTMLStyle_tid,
2686     IHTMLStyle2_tid,
2687     IHTMLStyle3_tid,
2688     IHTMLStyle4_tid,
2689     0
2690 };
2691 static dispex_static_data_t HTMLStyle_dispex = {
2692     &HTMLStyle_dispex_vtbl,
2693     DispHTMLStyle_tid,
2694     NULL,
2695     HTMLStyle_iface_tids
2696 };
2697
2698 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
2699 {
2700     HTMLStyle *ret = heap_alloc_zero(sizeof(HTMLStyle));
2701
2702     ret->lpHTMLStyleVtbl = &HTMLStyleVtbl;
2703     ret->ref = 1;
2704     ret->nsstyle = nsstyle;
2705     HTMLStyle2_Init(ret);
2706     HTMLStyle3_Init(ret);
2707
2708     nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
2709
2710     init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret),  &HTMLStyle_dispex);
2711
2712     return HTMLSTYLE(ret);
2713 }