urlmon: Implemented PARSE_SITE for CoInternetParseIUri.
[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(DISPATCHEX(&This->dispex), 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(DISPATCHEX(&This->dispex), 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(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
639 }
640
641 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
642                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
643                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
644 {
645     HTMLStyle *This = HTMLSTYLE_THIS(iface);
646     return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
647             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
648 }
649
650 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
651 {
652     HTMLStyle *This = HTMLSTYLE_THIS(iface);
653
654     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
655
656     return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
657 }
658
659 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
660 {
661     HTMLStyle *This = HTMLSTYLE_THIS(iface);
662
663     TRACE("(%p)->(%p)\n", This, p);
664
665     return get_style_attr(This, STYLEID_FONT_FAMILY, p);
666 }
667
668 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
669 {
670     HTMLStyle *This = HTMLSTYLE_THIS(iface);
671     static const WCHAR szItalic[]  = {'i','t','a','l','i','c',0};
672     static const WCHAR szOblique[]  = {'o','b','l','i','q','u','e',0};
673
674     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
675
676     /* fontStyle can only be one of the follow values. */
677     if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
678              strcmpiW(szOblique, v) == 0)
679     {
680         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
681     }
682
683     return E_INVALIDARG;
684 }
685
686 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
687 {
688     HTMLStyle *This = HTMLSTYLE_THIS(iface);
689
690     TRACE("(%p)->(%p)\n", This, p);
691
692     return get_style_attr(This, STYLEID_FONT_STYLE, p);
693 }
694
695 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
696 {
697     HTMLStyle *This = HTMLSTYLE_THIS(iface);
698     static const WCHAR szCaps[]  = {'s','m','a','l','l','-','c','a','p','s',0};
699
700     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
701
702     /* fontVariant can only be one of the follow values. */
703     if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
704     {
705         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
706     }
707
708     return E_INVALIDARG;
709 }
710
711 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
712 {
713     HTMLStyle *This = HTMLSTYLE_THIS(iface);
714     TRACE("(%p)->(%p)\n", This, p);
715
716     if(!p)
717        return E_INVALIDARG;
718
719     return get_style_attr(This, STYLEID_FONT_VARIANT, p);
720 }
721
722 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
723 {
724     HTMLStyle *This = HTMLSTYLE_THIS(iface);
725     static const WCHAR styleBold[] = {'b','o','l','d',0};
726     static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
727     static const WCHAR styleLighter[]  = {'l','i','g','h','t','e','r',0};
728     static const WCHAR style100[] = {'1','0','0',0};
729     static const WCHAR style200[] = {'2','0','0',0};
730     static const WCHAR style300[] = {'3','0','0',0};
731     static const WCHAR style400[] = {'4','0','0',0};
732     static const WCHAR style500[] = {'5','0','0',0};
733     static const WCHAR style600[] = {'6','0','0',0};
734     static const WCHAR style700[] = {'7','0','0',0};
735     static const WCHAR style800[] = {'8','0','0',0};
736     static const WCHAR style900[] = {'9','0','0',0};
737
738     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
739
740     /* fontWeight can only be one of the following */
741     if(!v || strcmpiW(szNormal, v) == 0    || strcmpiW(styleBold, v) == 0    ||
742              strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
743              strcmpiW(style100, v) == 0    || strcmpiW(style200, v) == 0     ||
744              strcmpiW(style300, v) == 0    || strcmpiW(style400, v) == 0     ||
745              strcmpiW(style500, v) == 0    || strcmpiW(style600, v) == 0     ||
746              strcmpiW(style700, v) == 0    || strcmpiW(style800, v) == 0     ||
747              strcmpiW(style900, v) == 0
748              )
749     {
750         return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
751     }
752
753     return E_INVALIDARG;
754 }
755
756 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
757 {
758     HTMLStyle *This = HTMLSTYLE_THIS(iface);
759
760     TRACE("(%p)->(%p)\n", This, p);
761
762     return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
763 }
764
765 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
766 {
767     HTMLStyle *This = HTMLSTYLE_THIS(iface);
768
769     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
770
771     switch(V_VT(&v)) {
772     case VT_BSTR:
773         return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
774     default:
775         FIXME("not supported vt %d\n", V_VT(&v));
776     }
777
778     return S_OK;
779 }
780
781 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
782 {
783     HTMLStyle *This = HTMLSTYLE_THIS(iface);
784
785     TRACE("(%p)->(%p)\n", This, p);
786
787     V_VT(p) = VT_BSTR;
788     return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
789 }
790
791 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
792 {
793     HTMLStyle *This = HTMLSTYLE_THIS(iface);
794     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
795     return E_NOTIMPL;
796 }
797
798 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
799 {
800     HTMLStyle *This = HTMLSTYLE_THIS(iface);
801     FIXME("(%p)->(%p)\n", This, p);
802     return E_NOTIMPL;
803 }
804
805 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
806 {
807     HTMLStyle *This = HTMLSTYLE_THIS(iface);
808
809     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
810
811     switch(V_VT(&v)) {
812     case VT_BSTR:
813         TRACE("%s\n", debugstr_w(V_BSTR(&v)));
814         return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
815
816     default:
817         FIXME("unsupported vt=%d\n", V_VT(&v));
818     }
819
820     return E_NOTIMPL;
821 }
822
823 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
824 {
825     HTMLStyle *This = HTMLSTYLE_THIS(iface);
826
827     TRACE("(%p)->(%p)\n", This, p);
828
829     V_VT(p) = VT_BSTR;
830     return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
831 }
832
833 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
834 {
835     HTMLStyle *This = HTMLSTYLE_THIS(iface);
836
837     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
838
839     return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
840 }
841
842 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
843 {
844     HTMLStyle *This = HTMLSTYLE_THIS(iface);
845
846     TRACE("(%p)->(%p)\n", This, p);
847
848     return get_style_attr(This, STYLEID_BACKGROUND, p);
849 }
850
851 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
852 {
853     HTMLStyle *This = HTMLSTYLE_THIS(iface);
854
855     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
856
857     switch(V_VT(&v)) {
858     case VT_BSTR:
859         return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
860     case VT_I4: {
861         WCHAR value[10];
862         static const WCHAR format[] = {'#','%','0','6','x',0};
863
864         wsprintfW(value, format, V_I4(&v));
865         return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
866     }
867     default:
868         FIXME("unsupported vt %d\n", V_VT(&v));
869     }
870
871     return S_OK;
872 }
873
874 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
875 {
876     HTMLStyle *This = HTMLSTYLE_THIS(iface);
877     TRACE("(%p)->(%p)\n", This, p);
878
879     V_VT(p) = VT_BSTR;
880     return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
881 }
882
883 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
884 {
885     HTMLStyle *This = HTMLSTYLE_THIS(iface);
886
887     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
888
889     return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
890 }
891
892 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
893 {
894     HTMLStyle *This = HTMLSTYLE_THIS(iface);
895
896     TRACE("(%p)->(%p)\n", This, p);
897
898     return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
899 }
900
901 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
902 {
903     HTMLStyle *This = HTMLSTYLE_THIS(iface);
904     static const WCHAR styleRepeat[]   = {'r','e','p','e','a','t',0};
905     static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
906     static const WCHAR styleRepeatX[]  = {'r','e','p','e','a','t','-','x',0};
907     static const WCHAR styleRepeatY[]  = {'r','e','p','e','a','t','-','y',0};
908
909     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
910
911     /* fontWeight can only be one of the following */
912     if(!v || strcmpiW(styleRepeat, v) == 0    || strcmpiW(styleNoRepeat, v) == 0    ||
913              strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
914     {
915         return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
916     }
917
918     return E_INVALIDARG;
919 }
920
921 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
922 {
923     HTMLStyle *This = HTMLSTYLE_THIS(iface);
924
925     TRACE("(%p)->(%p)\n", This, p);
926
927     return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
928 }
929
930 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
931 {
932     HTMLStyle *This = HTMLSTYLE_THIS(iface);
933     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
934     return E_NOTIMPL;
935 }
936
937 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
938 {
939     HTMLStyle *This = HTMLSTYLE_THIS(iface);
940     FIXME("(%p)->(%p)\n", This, p);
941     return E_NOTIMPL;
942 }
943
944 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
945 {
946     HTMLStyle *This = HTMLSTYLE_THIS(iface);
947     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
948     return E_NOTIMPL;
949 }
950
951 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
952 {
953     HTMLStyle *This = HTMLSTYLE_THIS(iface);
954     FIXME("(%p)->(%p)\n", This, p);
955     return E_NOTIMPL;
956 }
957
958 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
959 {
960     HTMLStyle *This = HTMLSTYLE_THIS(iface);
961     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
962     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
963 }
964
965 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
966 {
967     HTMLStyle *This = HTMLSTYLE_THIS(iface);
968     TRACE("(%p)->(%p)\n", This, p);
969     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
970 }
971
972 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
973 {
974     HTMLStyle *This = HTMLSTYLE_THIS(iface);
975     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
976     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, &v, 0);
977 }
978
979 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
980 {
981     HTMLStyle *This = HTMLSTYLE_THIS(iface);
982     TRACE("(%p)->(%p)\n", This, p);
983     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, p, 0);
984 }
985
986 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
987 {
988     HTMLStyle *This = HTMLSTYLE_THIS(iface);
989     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
990     return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
991 }
992
993 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
994 {
995     HTMLStyle *This = HTMLSTYLE_THIS(iface);
996     TRACE("(%p)->(%p)\n", This, p);
997     return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
998 }
999
1000 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1001 {
1002     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1003     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1004     return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1005 }
1006
1007 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1008 {
1009     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1010     TRACE("(%p)->(%p)\n", This, p);
1011     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1012 }
1013
1014 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1015 {
1016     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1017
1018     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1019
1020     /* textDecoration can only be one of the following */
1021     if(!v || strcmpiW(styleNone, v)   == 0 || strcmpiW(valUnderline, v)   == 0 ||
1022              strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1023              strcmpiW(valBlink, v)    == 0)
1024     {
1025         return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1026     }
1027
1028     return E_INVALIDARG;
1029 }
1030
1031 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1032 {
1033     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1034
1035     TRACE("(%p)->(%p)\n", This, p);
1036
1037     return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1038 }
1039
1040 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1041 {
1042     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1043
1044     TRACE("(%p)->(%x)\n", This, v);
1045
1046     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1047 }
1048
1049 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1050 {
1051     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1052
1053     TRACE("(%p)->(%p)\n", This, p);
1054
1055     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1056 }
1057
1058 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1059 {
1060     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1061
1062     TRACE("(%p)->(%x)\n", This, v);
1063
1064     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1065 }
1066
1067 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1068 {
1069     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1070
1071     TRACE("(%p)->(%p)\n", This, p);
1072
1073     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1074 }
1075
1076 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1077 {
1078     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1079
1080     TRACE("(%p)->(%x)\n", This, v);
1081
1082     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1083 }
1084
1085 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1086 {
1087     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1088
1089     TRACE("(%p)->(%p)\n", This, p);
1090
1091     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1092 }
1093
1094 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1095 {
1096     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1097
1098     TRACE("(%p)->(%x)\n", This, v);
1099
1100     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1101 }
1102
1103 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1104 {
1105     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1106
1107     TRACE("(%p)->(%p)\n", This, p);
1108
1109     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1110 }
1111
1112 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1113 {
1114     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1115
1116     TRACE("(%p)->(%x)\n", This, v);
1117
1118     return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1119 }
1120
1121 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1122 {
1123     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1124
1125     TRACE("(%p)->(%p)\n", This, p);
1126
1127     return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1128 }
1129
1130 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1131 {
1132     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1133
1134     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1135
1136     switch(V_VT(&v)) {
1137     case VT_BSTR:
1138         return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1139     default:
1140         FIXME("not implemented vt %d\n", V_VT(&v));
1141         return E_NOTIMPL;
1142     }
1143
1144     return S_OK;
1145 }
1146
1147 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1148 {
1149     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1150     BSTR ret;
1151     HRESULT hres;
1152
1153     TRACE("(%p)->(%p)\n", This, p);
1154
1155     hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1156     if(FAILED(hres))
1157         return hres;
1158
1159     V_VT(p) = VT_BSTR;
1160     V_BSTR(p) = ret;
1161     return S_OK;
1162 }
1163
1164 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1165 {
1166     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1167     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1168     return E_NOTIMPL;
1169 }
1170
1171 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1172 {
1173     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1174     FIXME("(%p)->(%p)\n", This, p);
1175     return E_NOTIMPL;
1176 }
1177
1178 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1179 {
1180     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1181
1182     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1183
1184     return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1185 }
1186
1187 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1188 {
1189     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1190
1191     TRACE("(%p)->(%p)\n", This, p);
1192
1193     return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1194 }
1195
1196 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1197 {
1198     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1199     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1200     return E_NOTIMPL;
1201 }
1202
1203 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1204 {
1205     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1206     FIXME("(%p)->(%p)\n", This, p);
1207     return E_NOTIMPL;
1208 }
1209
1210 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1211 {
1212     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1213     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1214     return E_NOTIMPL;
1215 }
1216
1217 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1218 {
1219     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1220     FIXME("(%p)->(%p)\n", This, p);
1221     return E_NOTIMPL;
1222 }
1223
1224 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1225 {
1226     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1227
1228     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1229
1230     return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1231 }
1232
1233 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1234 {
1235     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1236
1237     TRACE("(%p)->(%p)\n", This, p);
1238
1239     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1240 }
1241
1242 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1243 {
1244     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1245
1246     TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1247
1248     switch(V_VT(&v)) {
1249     case VT_NULL:
1250         return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1251     case VT_I4: {
1252         WCHAR buf[14];
1253
1254         wsprintfW(buf, px_formatW, V_I4(&v));
1255         return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1256     }
1257     case VT_BSTR:
1258         return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1259     default:
1260         FIXME("Unsupported vt=%d\n", V_VT(&v));
1261     }
1262
1263     return E_NOTIMPL;
1264 }
1265
1266 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1267 {
1268     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1269     TRACE("(%p)->(%p)\n", This, p);
1270     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1271 }
1272
1273 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1274 {
1275     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1276     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1277     return E_NOTIMPL;
1278 }
1279
1280 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1281 {
1282     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1283     FIXME("(%p)->(%p)\n", This, p);
1284     return E_NOTIMPL;
1285 }
1286
1287 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1288 {
1289     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1290
1291     switch(V_VT(&v)) {
1292     case VT_NULL:
1293         TRACE("(%p)->(NULL)\n", This);
1294         return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1295     case VT_I4: {
1296         WCHAR buf[14];
1297
1298         TRACE("(%p)->(%d)\n", This, V_I4(&v));
1299
1300         wsprintfW(buf, px_formatW, V_I4(&v));
1301         return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1302     }
1303     case VT_BSTR:
1304         TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1305         return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1306     default:
1307         FIXME("Unsupported vt=%d\n", V_VT(&v));
1308     }
1309
1310     return E_NOTIMPL;
1311 }
1312
1313 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1314 {
1315     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1316
1317     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1318
1319     return set_style_attr(This, STYLEID_MARGIN, v, 0);
1320 }
1321
1322 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1323 {
1324     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1325
1326     TRACE("(%p)->(%p)\n", This, p);
1327
1328     return get_style_attr(This, STYLEID_MARGIN, p);
1329 }
1330
1331 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1332 {
1333     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1334     TRACE("(%p)->(%p)\n", This, p);
1335     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1336 }
1337
1338 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1339 {
1340     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1341     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1342     return E_NOTIMPL;
1343 }
1344
1345 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1346 {
1347     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1348     FIXME("(%p)->(%p)\n", This, p);
1349     return E_NOTIMPL;
1350 }
1351
1352 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1353 {
1354     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1355     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1356     return E_NOTIMPL;
1357 }
1358
1359 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1360 {
1361     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1362     FIXME("(%p)->(%p)\n", This, p);
1363     return E_NOTIMPL;
1364 }
1365
1366 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1367 {
1368     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1369     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1370     return E_NOTIMPL;
1371 }
1372
1373 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1374 {
1375     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1376     FIXME("(%p)->(%p)\n", This, p);
1377     return E_NOTIMPL;
1378 }
1379
1380 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1381 {
1382     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1383
1384     TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1385
1386     switch(V_VT(&v)) {
1387     case VT_I4: {
1388         WCHAR buf[14];
1389
1390         wsprintfW(buf, px_formatW, V_I4(&v));
1391         return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1392     }
1393     case VT_BSTR:
1394         return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1395     default:
1396         FIXME("unsupported vt=%d\n", V_VT(&v));
1397     }
1398
1399     return E_NOTIMPL;
1400 }
1401
1402 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1403 {
1404     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1405     BSTR ret;
1406     HRESULT hres;
1407
1408     TRACE("(%p)->(%p)\n", This, p);
1409
1410     hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1411     if(FAILED(hres))
1412         return hres;
1413
1414     V_VT(p) = VT_BSTR;
1415     V_BSTR(p) = ret;
1416     return S_OK;
1417 }
1418
1419 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1420 {
1421     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1422
1423     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1424
1425     return set_style_attr(This, STYLEID_PADDING, v, 0);
1426 }
1427
1428 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1429 {
1430     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1431
1432     TRACE("(%p)->(%p)\n", This, p);
1433
1434     return get_style_attr(This, STYLEID_PADDING, p);
1435 }
1436
1437 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1438 {
1439     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1440
1441     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1442
1443     return set_style_attr(This, STYLEID_BORDER, v, 0);
1444 }
1445
1446 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1447 {
1448     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1449
1450     TRACE("(%p)->(%p)\n", This, p);
1451
1452     return get_style_attr(This, STYLEID_BORDER, p);
1453 }
1454
1455 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1456 {
1457     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1458     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1459     return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1460 }
1461
1462 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1463 {
1464     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1465     TRACE("(%p)->(%p)\n", This, p);
1466     return get_style_attr(This, STYLEID_BORDER_TOP, p);
1467 }
1468
1469 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1470 {
1471     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1472     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1473     return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1474 }
1475
1476 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1477 {
1478     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1479     TRACE("(%p)->(%p)\n", This, p);
1480     return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1481 }
1482
1483 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1484 {
1485     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1486     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1487     return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1488 }
1489
1490 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1491 {
1492     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1493     TRACE("(%p)->(%p)\n", This, p);
1494     return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1495 }
1496
1497 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1498 {
1499     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1500
1501     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1502
1503     return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1504 }
1505
1506 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1507 {
1508     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1509
1510     TRACE("(%p)->(%p)\n", This, p);
1511
1512     return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1513 }
1514
1515 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1516 {
1517     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1518
1519     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1520
1521     return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1522 }
1523
1524 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1525 {
1526     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1527
1528     TRACE("(%p)->(%p)\n", This, p);
1529
1530     return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1531 }
1532
1533 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1534 {
1535     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1536     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1537     return E_NOTIMPL;
1538 }
1539
1540 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1541 {
1542     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1543
1544     TRACE("(%p)->(%p)\n", This, p);
1545
1546     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1547 }
1548
1549 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1550 {
1551     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1552     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1553     return E_NOTIMPL;
1554 }
1555
1556 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1557 {
1558     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1559
1560     TRACE("(%p)->(%p)\n", This, p);
1561
1562     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1563 }
1564
1565 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1566 {
1567     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1568     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1569     return E_NOTIMPL;
1570 }
1571
1572 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1573 {
1574     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1575
1576     TRACE("(%p)->(%p)\n", This, p);
1577
1578     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1579 }
1580
1581 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1582 {
1583     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1584     FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1585     return E_NOTIMPL;
1586 }
1587
1588 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1589 {
1590     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1591
1592     TRACE("(%p)->(%p)\n", This, p);
1593
1594     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1595 }
1596
1597 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1598 {
1599     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1600     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1601     return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1602 }
1603
1604 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1605 {
1606     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1607     TRACE("(%p)->(%p)\n", This, p);
1608     return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1609 }
1610
1611 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1612 {
1613     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1614     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1615     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1616 }
1617
1618 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1619 {
1620     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1621
1622     TRACE("(%p)->(%p)\n", This, p);
1623
1624     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1625 }
1626
1627 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1628 {
1629     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1630     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1631     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1632 }
1633
1634 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1635 {
1636     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1637     TRACE("(%p)->(%p)\n", This, p);
1638     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1639 }
1640
1641 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1642 {
1643     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1644
1645     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1646     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1647 }
1648
1649 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1650 {
1651     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1652     TRACE("(%p)->(%p)\n", This, p);
1653     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1654 }
1655
1656 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1657 {
1658     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1659     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1660     return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1661 }
1662
1663 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1664 {
1665     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1666     TRACE("(%p)->(%p)\n", This, p);
1667     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1668 }
1669
1670 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1671 {
1672     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1673     static const WCHAR styleWindowInset[]  = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1674     HRESULT hres = S_OK;
1675     BSTR pstyle;
1676     int i=0;
1677     int last = 0;
1678
1679     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1680
1681     while(v[i] && hres == S_OK)
1682     {
1683         if(v[i] == (WCHAR)' ')
1684         {
1685             pstyle = SysAllocStringLen(&v[last], (i-last));
1686             if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1687             {
1688                 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1689                 hres = E_INVALIDARG;
1690             }
1691             SysFreeString(pstyle);
1692             last = i+1;
1693         }
1694         i++;
1695     }
1696
1697     if(hres == S_OK)
1698     {
1699         pstyle = SysAllocStringLen(&v[last], i-last);
1700         if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1701         {
1702             TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1703             hres = E_INVALIDARG;
1704         }
1705         SysFreeString(pstyle);
1706     }
1707
1708     if(hres == S_OK)
1709         hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1710
1711     return hres;
1712 }
1713
1714 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1715 {
1716     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1717     TRACE("(%p)->(%p)\n", This, p);
1718     return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1719 }
1720
1721 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1722 {
1723     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1724     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1725
1726     if(!is_valid_border_style(v))
1727         return E_INVALIDARG;
1728
1729     return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1730 }
1731
1732 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1733 {
1734     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1735     TRACE("(%p)->(%p)\n", This, p);
1736     return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1737 }
1738
1739 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1740 {
1741     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1742     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1743
1744     if(!is_valid_border_style(v))
1745         return E_INVALIDARG;
1746
1747     return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1748 }
1749
1750 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1751 {
1752     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1753     TRACE("(%p)->(%p)\n", This, p);
1754     return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1755 }
1756
1757 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1758 {
1759     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1760     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1761
1762     if(!is_valid_border_style(v))
1763         return E_INVALIDARG;
1764
1765     return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1766 }
1767
1768 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1769 {
1770     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1771     TRACE("(%p)->(%p)\n", This, p);
1772     return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1773 }
1774
1775 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1776 {
1777     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1778     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1779
1780     if(!is_valid_border_style(v))
1781         return E_INVALIDARG;
1782
1783     return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1784 }
1785
1786 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1787 {
1788     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1789     TRACE("(%p)->(%p)\n", This, p);
1790     return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
1791 }
1792
1793 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
1794 {
1795     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1796
1797     TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1798
1799     return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
1800 }
1801
1802 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
1803 {
1804     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1805
1806     TRACE("(%p)->(%p)\n", This, p);
1807
1808     V_VT(p) = VT_BSTR;
1809     return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
1810 }
1811
1812 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
1813 {
1814     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1815
1816     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1817
1818     switch(V_VT(&v)) {
1819     case VT_BSTR:
1820         return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
1821     default:
1822         FIXME("unimplemented vt %d\n", V_VT(&v));
1823         return E_NOTIMPL;
1824     }
1825
1826     return S_OK;
1827 }
1828
1829 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
1830 {
1831     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1832     BSTR ret;
1833     HRESULT hres;
1834
1835     TRACE("(%p)->(%p)\n", This, p);
1836
1837     hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
1838     if(FAILED(hres))
1839         return hres;
1840
1841     V_VT(p) = VT_BSTR;
1842     V_BSTR(p) = ret;
1843     return S_OK;
1844 }
1845
1846 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
1847 {
1848     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1849     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1850     return E_NOTIMPL;
1851 }
1852
1853 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
1854 {
1855     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1856     FIXME("(%p)->(%p)\n", This, p);
1857     return E_NOTIMPL;
1858 }
1859
1860 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
1861 {
1862     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1863     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1864     return E_NOTIMPL;
1865 }
1866
1867 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
1868 {
1869     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1870     FIXME("(%p)->(%p)\n", This, p);
1871     return E_NOTIMPL;
1872 }
1873
1874 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
1875 {
1876     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1877
1878     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1879
1880     return set_style_attr(This, STYLEID_DISPLAY, v, 0);
1881 }
1882
1883 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
1884 {
1885     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1886
1887     TRACE("(%p)->(%p)\n", This, p);
1888
1889     return get_style_attr(This, STYLEID_DISPLAY, p);
1890 }
1891
1892 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
1893 {
1894     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1895
1896     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1897
1898     return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
1899 }
1900
1901 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
1902 {
1903     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1904
1905     TRACE("(%p)->(%p)\n", This, p);
1906
1907     return get_style_attr(This, STYLEID_VISIBILITY, p);
1908 }
1909
1910 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
1911 {
1912     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1913     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1914     return E_NOTIMPL;
1915 }
1916
1917 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
1918 {
1919     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1920     FIXME("(%p)->(%p)\n", This, p);
1921     return E_NOTIMPL;
1922 }
1923
1924 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
1925 {
1926     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1927     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1928     return E_NOTIMPL;
1929 }
1930
1931 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
1932 {
1933     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1934     FIXME("(%p)->(%p)\n", This, p);
1935     return E_NOTIMPL;
1936 }
1937
1938 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
1939 {
1940     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1941     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1942     return E_NOTIMPL;
1943 }
1944
1945 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
1946 {
1947     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1948     FIXME("(%p)->(%p)\n", This, p);
1949     return E_NOTIMPL;
1950 }
1951
1952 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
1953 {
1954     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1955     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1956     return E_NOTIMPL;
1957 }
1958
1959 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
1960 {
1961     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1962     FIXME("(%p)->(%p)\n", This, p);
1963     return E_NOTIMPL;
1964 }
1965
1966 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
1967 {
1968     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1969     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1970     return E_NOTIMPL;
1971 }
1972
1973 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
1974 {
1975     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1976     FIXME("(%p)->(%p)\n", This, p);
1977     return E_NOTIMPL;
1978 }
1979
1980 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
1981 {
1982     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1983
1984     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1985
1986     return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
1987 }
1988
1989 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
1990 {
1991     HTMLStyle *This = HTMLSTYLE_THIS(iface);
1992     BSTR ret;
1993     HRESULT hres;
1994
1995     TRACE("(%p)->(%p)\n", This, p);
1996
1997     hres = get_style_attr(This, STYLEID_TOP, &ret);
1998     if(FAILED(hres))
1999         return hres;
2000
2001     V_VT(p) = VT_BSTR;
2002     V_BSTR(p) = ret;
2003     return S_OK;
2004 }
2005
2006 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2007 {
2008     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2009
2010     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2011
2012     return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2013 }
2014
2015 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2016 {
2017     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2018     BSTR ret;
2019     HRESULT hres;
2020
2021     TRACE("(%p)->(%p)\n", This, p);
2022
2023     hres = get_style_attr(This, STYLEID_LEFT, &ret);
2024     if(FAILED(hres))
2025         return hres;
2026
2027     V_VT(p) = VT_BSTR;
2028     V_BSTR(p) = ret;
2029     return S_OK;
2030 }
2031
2032 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2033 {
2034     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2035     TRACE("(%p)->(%p)\n", This, p);
2036     return IHTMLStyle2_get_position(HTMLSTYLE2(This), p);
2037 }
2038
2039 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2040 {
2041     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2042
2043     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2044
2045     switch(V_VT(&v)) {
2046     case VT_BSTR:
2047         return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2048     case VT_I4: {
2049         WCHAR value[14];
2050         static const WCHAR format[] = {'%','d',0};
2051
2052         wsprintfW(value, format, V_I4(&v));
2053         return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2054     }
2055     default:
2056         FIXME("unimplemented vt %d\n", V_VT(&v));
2057         return E_NOTIMPL;
2058     }
2059
2060     return S_OK;
2061 }
2062
2063 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2064 {
2065     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2066
2067     TRACE("(%p)->(%p)\n", This, p);
2068
2069     return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2070 }
2071
2072 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2073 {
2074     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2075     static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2076     static const WCHAR szScroll[]  = {'s','c','r','o','l','l',0};
2077     static const WCHAR szHidden[]  = {'h','i','d','d','e','n',0};
2078     static const WCHAR szAuto[]    = {'a','u','t','o',0};
2079
2080     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2081
2082     /* overflow can only be one of the follow values. */
2083     if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2084              strcmpiW(szHidden, v) == 0  || strcmpiW(szAuto, v) == 0)
2085     {
2086         return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2087     }
2088
2089     return E_INVALIDARG;
2090 }
2091
2092
2093 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2094 {
2095     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2096
2097     TRACE("(%p)->(%p)\n", This, p);
2098
2099     if(!p)
2100        return E_INVALIDARG;
2101
2102     return get_style_attr(This, STYLEID_OVERFLOW, p);
2103 }
2104
2105 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2106 {
2107     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2108     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2109     return E_NOTIMPL;
2110 }
2111
2112 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2113 {
2114     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2115     FIXME("(%p)->(%p)\n", This, p);
2116     return E_NOTIMPL;
2117 }
2118
2119 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2120 {
2121     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2122     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2123     return E_NOTIMPL;
2124 }
2125
2126 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2127 {
2128     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2129     FIXME("(%p)->(%p)\n", This, p);
2130     return E_NOTIMPL;
2131 }
2132
2133 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2134 {
2135     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2136     nsAString text_str;
2137     nsresult nsres;
2138
2139     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2140
2141     nsAString_InitDepend(&text_str, v);
2142     nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2143     nsAString_Finish(&text_str);
2144     if(NS_FAILED(nsres)) {
2145         FIXME("SetCssStyle failed: %08x\n", nsres);
2146         return E_FAIL;
2147     }
2148
2149     return S_OK;
2150 }
2151
2152 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2153 {
2154     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2155     nsAString text_str;
2156     nsresult nsres;
2157
2158     TRACE("(%p)->(%p)\n", This, p);
2159
2160     /* FIXME: Gecko style formatting is different than IE (uppercase). */
2161     nsAString_Init(&text_str, NULL);
2162     nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2163     if(NS_SUCCEEDED(nsres)) {
2164         const PRUnichar *text;
2165
2166         nsAString_GetData(&text_str, &text);
2167         *p = *text ? SysAllocString(text) : NULL;
2168     }else {
2169         FIXME("GetCssStyle failed: %08x\n", nsres);
2170         *p = NULL;
2171     }
2172
2173     nsAString_Finish(&text_str);
2174     return S_OK;
2175 }
2176
2177 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2178 {
2179     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2180     FIXME("(%p)->()\n", This);
2181     return E_NOTIMPL;
2182 }
2183
2184 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2185 {
2186     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2187     FIXME("(%p)->()\n", This);
2188     return E_NOTIMPL;
2189 }
2190
2191 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2192 {
2193     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2194     FIXME("(%p)->()\n", This);
2195     return E_NOTIMPL;
2196 }
2197
2198 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2199 {
2200     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2201     FIXME("(%p)->()\n", This);
2202     return E_NOTIMPL;
2203 }
2204
2205 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2206 {
2207     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2208     FIXME("(%p)->()\n", This);
2209     return E_NOTIMPL;
2210 }
2211
2212 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2213 {
2214     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2215     FIXME("(%p)->()\n", This);
2216     return E_NOTIMPL;
2217 }
2218
2219 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2220 {
2221     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2222     FIXME("(%p)->()\n", This);
2223     return E_NOTIMPL;
2224 }
2225
2226 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2227 {
2228     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2229     FIXME("(%p)->()\n", This);
2230     return E_NOTIMPL;
2231 }
2232
2233 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2234 {
2235     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2236
2237     TRACE("(%p)->(%f)\n", This, v);
2238
2239     return set_style_pos(This, STYLEID_TOP, v);
2240 }
2241
2242 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2243 {
2244     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2245
2246     TRACE("(%p)->(%p)\n", This, p);
2247
2248     if(!p)
2249         return E_POINTER;
2250
2251     return get_nsstyle_pos(This, STYLEID_TOP, p);
2252 }
2253
2254 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2255 {
2256     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2257
2258     TRACE("(%p)->(%f)\n", This, v);
2259
2260     return set_style_pos(This, STYLEID_LEFT, v);
2261 }
2262
2263 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2264 {
2265     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2266
2267     TRACE("(%p)->(%p)\n", This, p);
2268
2269     if(!p)
2270         return E_POINTER;
2271
2272     return get_nsstyle_pos(This, STYLEID_LEFT, p);
2273 }
2274
2275 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2276 {
2277     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2278
2279     TRACE("(%p)->(%f)\n", This, v);
2280
2281     return set_style_pos(This, STYLEID_WIDTH, v);
2282 }
2283
2284 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2285 {
2286     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2287
2288     TRACE("(%p)->(%p)\n", This, p);
2289
2290     if(!p)
2291         return E_POINTER;
2292
2293     if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2294         *p = 0.0f;
2295
2296     return S_OK;
2297 }
2298
2299 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2300 {
2301     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2302
2303     TRACE("(%p)->(%f)\n", This, v);
2304
2305     return set_style_pos(This, STYLEID_HEIGHT, v);
2306 }
2307
2308 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2309 {
2310     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2311
2312     TRACE("(%p)->(%p)\n", This, p);
2313
2314     if(!p)
2315         return E_POINTER;
2316
2317     if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2318         *p = 0.0f;
2319
2320     return S_OK;
2321 }
2322
2323 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2324 {
2325     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2326
2327     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2328
2329     return set_style_attr(This, STYLEID_CURSOR, v, 0);
2330 }
2331
2332 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2333 {
2334     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2335
2336     TRACE("(%p)->(%p)\n", This, p);
2337
2338     return get_style_attr(This, STYLEID_CURSOR, p);
2339 }
2340
2341 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2342 {
2343     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2344     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2345     return E_NOTIMPL;
2346 }
2347
2348 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2349 {
2350     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2351     FIXME("(%p)->(%p)\n", This, p);
2352     return E_NOTIMPL;
2353 }
2354
2355 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2356 {
2357     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2358
2359     WARN("(%p)->(%s)\n", This, debugstr_w(v));
2360
2361     /* FIXME: Handle MS-style filters */
2362     return set_style_attr(This, STYLEID_FILTER, v, 0);
2363 }
2364
2365 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2366 {
2367     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2368
2369     WARN("(%p)->(%p)\n", This, p);
2370
2371     /* FIXME: Handle MS-style filters */
2372     return get_style_attr(This, STYLEID_FILTER, p);
2373 }
2374
2375 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2376         VARIANT AttributeValue, LONG lFlags)
2377 {
2378     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2379     HRESULT hres;
2380     DISPID dispid;
2381
2382     TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2383            V_VT(&AttributeValue), lFlags);
2384
2385     if(!strAttributeName)
2386         return E_INVALIDARG;
2387
2388     if(lFlags == 1)
2389         FIXME("Parameter lFlags ignored\n");
2390
2391     hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2392                         LOCALE_USER_DEFAULT, &dispid);
2393     if(hres == S_OK)
2394     {
2395         VARIANT ret;
2396         DISPID dispidNamed = DISPID_PROPERTYPUT;
2397         DISPPARAMS params;
2398
2399         params.cArgs = 1;
2400         params.rgvarg = &AttributeValue;
2401         params.cNamedArgs = 1;
2402         params.rgdispidNamedArgs = &dispidNamed;
2403
2404         hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2405             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2406     }
2407     else
2408     {
2409         FIXME("Custom attributes not supported.\n");
2410     }
2411
2412     TRACE("ret: %08x\n", hres);
2413
2414     return hres;
2415 }
2416
2417 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2418         LONG lFlags, VARIANT *AttributeValue)
2419 {
2420     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2421     HRESULT hres;
2422     DISPID dispid;
2423
2424     TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2425           AttributeValue, lFlags);
2426
2427     if(!AttributeValue || !strAttributeName)
2428         return E_INVALIDARG;
2429
2430     if(lFlags == 1)
2431         FIXME("Parameter lFlags ignored\n");
2432
2433     hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2434                         LOCALE_USER_DEFAULT, &dispid);
2435     if(hres == S_OK)
2436     {
2437         DISPPARAMS params = {NULL, NULL, 0, 0 };
2438
2439         hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2440             DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2441     }
2442     else
2443     {
2444         FIXME("Custom attributes not supported.\n");
2445     }
2446
2447     return hres;
2448 }
2449
2450 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2451                                                 LONG lFlags, VARIANT_BOOL *pfSuccess)
2452 {
2453     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2454     FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2455          lFlags, pfSuccess);
2456     return E_NOTIMPL;
2457 }
2458
2459 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2460 {
2461     HTMLStyle *This = HTMLSTYLE_THIS(iface);
2462     FIXME("(%p)->(%p)\n", This, String);
2463     return E_NOTIMPL;
2464 }
2465
2466 static HRESULT HTMLStyle_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
2467 {
2468     int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2469
2470     while(min <= max) {
2471         i = (min+max)/2;
2472
2473         c = strcmpW(style_tbl[i].name, name);
2474         if(!c) {
2475             *dispid = style_tbl[i].dispid;
2476             return S_OK;
2477         }
2478
2479         if(c > 0)
2480             max = i-1;
2481         else
2482             min = i+1;
2483     }
2484
2485     return DISP_E_UNKNOWNNAME;
2486 }
2487
2488 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2489     HTMLStyle_QueryInterface,
2490     HTMLStyle_AddRef,
2491     HTMLStyle_Release,
2492     HTMLStyle_GetTypeInfoCount,
2493     HTMLStyle_GetTypeInfo,
2494     HTMLStyle_GetIDsOfNames,
2495     HTMLStyle_Invoke,
2496     HTMLStyle_put_fontFamily,
2497     HTMLStyle_get_fontFamily,
2498     HTMLStyle_put_fontStyle,
2499     HTMLStyle_get_fontStyle,
2500     HTMLStyle_put_fontVariant,
2501     HTMLStyle_get_fontVariant,
2502     HTMLStyle_put_fontWeight,
2503     HTMLStyle_get_fontWeight,
2504     HTMLStyle_put_fontSize,
2505     HTMLStyle_get_fontSize,
2506     HTMLStyle_put_font,
2507     HTMLStyle_get_font,
2508     HTMLStyle_put_color,
2509     HTMLStyle_get_color,
2510     HTMLStyle_put_background,
2511     HTMLStyle_get_background,
2512     HTMLStyle_put_backgroundColor,
2513     HTMLStyle_get_backgroundColor,
2514     HTMLStyle_put_backgroundImage,
2515     HTMLStyle_get_backgroundImage,
2516     HTMLStyle_put_backgroundRepeat,
2517     HTMLStyle_get_backgroundRepeat,
2518     HTMLStyle_put_backgroundAttachment,
2519     HTMLStyle_get_backgroundAttachment,
2520     HTMLStyle_put_backgroundPosition,
2521     HTMLStyle_get_backgroundPosition,
2522     HTMLStyle_put_backgroundPositionX,
2523     HTMLStyle_get_backgroundPositionX,
2524     HTMLStyle_put_backgroundPositionY,
2525     HTMLStyle_get_backgroundPositionY,
2526     HTMLStyle_put_wordSpacing,
2527     HTMLStyle_get_wordSpacing,
2528     HTMLStyle_put_letterSpacing,
2529     HTMLStyle_get_letterSpacing,
2530     HTMLStyle_put_textDecoration,
2531     HTMLStyle_get_textDecoration,
2532     HTMLStyle_put_textDecorationNone,
2533     HTMLStyle_get_textDecorationNone,
2534     HTMLStyle_put_textDecorationUnderline,
2535     HTMLStyle_get_textDecorationUnderline,
2536     HTMLStyle_put_textDecorationOverline,
2537     HTMLStyle_get_textDecorationOverline,
2538     HTMLStyle_put_textDecorationLineThrough,
2539     HTMLStyle_get_textDecorationLineThrough,
2540     HTMLStyle_put_textDecorationBlink,
2541     HTMLStyle_get_textDecorationBlink,
2542     HTMLStyle_put_verticalAlign,
2543     HTMLStyle_get_verticalAlign,
2544     HTMLStyle_put_textTransform,
2545     HTMLStyle_get_textTransform,
2546     HTMLStyle_put_textAlign,
2547     HTMLStyle_get_textAlign,
2548     HTMLStyle_put_textIndent,
2549     HTMLStyle_get_textIndent,
2550     HTMLStyle_put_lineHeight,
2551     HTMLStyle_get_lineHeight,
2552     HTMLStyle_put_marginTop,
2553     HTMLStyle_get_marginTop,
2554     HTMLStyle_put_marginRight,
2555     HTMLStyle_get_marginRight,
2556     HTMLStyle_put_marginBottom,
2557     HTMLStyle_get_marginBottom,
2558     HTMLStyle_put_marginLeft,
2559     HTMLStyle_get_marginLeft,
2560     HTMLStyle_put_margin,
2561     HTMLStyle_get_margin,
2562     HTMLStyle_put_paddingTop,
2563     HTMLStyle_get_paddingTop,
2564     HTMLStyle_put_paddingRight,
2565     HTMLStyle_get_paddingRight,
2566     HTMLStyle_put_paddingBottom,
2567     HTMLStyle_get_paddingBottom,
2568     HTMLStyle_put_paddingLeft,
2569     HTMLStyle_get_paddingLeft,
2570     HTMLStyle_put_padding,
2571     HTMLStyle_get_padding,
2572     HTMLStyle_put_border,
2573     HTMLStyle_get_border,
2574     HTMLStyle_put_borderTop,
2575     HTMLStyle_get_borderTop,
2576     HTMLStyle_put_borderRight,
2577     HTMLStyle_get_borderRight,
2578     HTMLStyle_put_borderBottom,
2579     HTMLStyle_get_borderBottom,
2580     HTMLStyle_put_borderLeft,
2581     HTMLStyle_get_borderLeft,
2582     HTMLStyle_put_borderColor,
2583     HTMLStyle_get_borderColor,
2584     HTMLStyle_put_borderTopColor,
2585     HTMLStyle_get_borderTopColor,
2586     HTMLStyle_put_borderRightColor,
2587     HTMLStyle_get_borderRightColor,
2588     HTMLStyle_put_borderBottomColor,
2589     HTMLStyle_get_borderBottomColor,
2590     HTMLStyle_put_borderLeftColor,
2591     HTMLStyle_get_borderLeftColor,
2592     HTMLStyle_put_borderWidth,
2593     HTMLStyle_get_borderWidth,
2594     HTMLStyle_put_borderTopWidth,
2595     HTMLStyle_get_borderTopWidth,
2596     HTMLStyle_put_borderRightWidth,
2597     HTMLStyle_get_borderRightWidth,
2598     HTMLStyle_put_borderBottomWidth,
2599     HTMLStyle_get_borderBottomWidth,
2600     HTMLStyle_put_borderLeftWidth,
2601     HTMLStyle_get_borderLeftWidth,
2602     HTMLStyle_put_borderStyle,
2603     HTMLStyle_get_borderStyle,
2604     HTMLStyle_put_borderTopStyle,
2605     HTMLStyle_get_borderTopStyle,
2606     HTMLStyle_put_borderRightStyle,
2607     HTMLStyle_get_borderRightStyle,
2608     HTMLStyle_put_borderBottomStyle,
2609     HTMLStyle_get_borderBottomStyle,
2610     HTMLStyle_put_borderLeftStyle,
2611     HTMLStyle_get_borderLeftStyle,
2612     HTMLStyle_put_width,
2613     HTMLStyle_get_width,
2614     HTMLStyle_put_height,
2615     HTMLStyle_get_height,
2616     HTMLStyle_put_styleFloat,
2617     HTMLStyle_get_styleFloat,
2618     HTMLStyle_put_clear,
2619     HTMLStyle_get_clear,
2620     HTMLStyle_put_display,
2621     HTMLStyle_get_display,
2622     HTMLStyle_put_visibility,
2623     HTMLStyle_get_visibility,
2624     HTMLStyle_put_listStyleType,
2625     HTMLStyle_get_listStyleType,
2626     HTMLStyle_put_listStylePosition,
2627     HTMLStyle_get_listStylePosition,
2628     HTMLStyle_put_listStyleImage,
2629     HTMLStyle_get_listStyleImage,
2630     HTMLStyle_put_listStyle,
2631     HTMLStyle_get_listStyle,
2632     HTMLStyle_put_whiteSpace,
2633     HTMLStyle_get_whiteSpace,
2634     HTMLStyle_put_top,
2635     HTMLStyle_get_top,
2636     HTMLStyle_put_left,
2637     HTMLStyle_get_left,
2638     HTMLStyle_get_position,
2639     HTMLStyle_put_zIndex,
2640     HTMLStyle_get_zIndex,
2641     HTMLStyle_put_overflow,
2642     HTMLStyle_get_overflow,
2643     HTMLStyle_put_pageBreakBefore,
2644     HTMLStyle_get_pageBreakBefore,
2645     HTMLStyle_put_pageBreakAfter,
2646     HTMLStyle_get_pageBreakAfter,
2647     HTMLStyle_put_cssText,
2648     HTMLStyle_get_cssText,
2649     HTMLStyle_put_pixelTop,
2650     HTMLStyle_get_pixelTop,
2651     HTMLStyle_put_pixelLeft,
2652     HTMLStyle_get_pixelLeft,
2653     HTMLStyle_put_pixelWidth,
2654     HTMLStyle_get_pixelWidth,
2655     HTMLStyle_put_pixelHeight,
2656     HTMLStyle_get_pixelHeight,
2657     HTMLStyle_put_posTop,
2658     HTMLStyle_get_posTop,
2659     HTMLStyle_put_posLeft,
2660     HTMLStyle_get_posLeft,
2661     HTMLStyle_put_posWidth,
2662     HTMLStyle_get_posWidth,
2663     HTMLStyle_put_posHeight,
2664     HTMLStyle_get_posHeight,
2665     HTMLStyle_put_cursor,
2666     HTMLStyle_get_cursor,
2667     HTMLStyle_put_clip,
2668     HTMLStyle_get_clip,
2669     HTMLStyle_put_filter,
2670     HTMLStyle_get_filter,
2671     HTMLStyle_setAttribute,
2672     HTMLStyle_getAttribute,
2673     HTMLStyle_removeAttribute,
2674     HTMLStyle_toString
2675 };
2676
2677 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
2678     NULL,
2679     HTMLStyle_get_dispid,
2680     NULL
2681 };
2682
2683 static const tid_t HTMLStyle_iface_tids[] = {
2684     IHTMLStyle_tid,
2685     IHTMLStyle2_tid,
2686     IHTMLStyle3_tid,
2687     IHTMLStyle4_tid,
2688     0
2689 };
2690 static dispex_static_data_t HTMLStyle_dispex = {
2691     &HTMLStyle_dispex_vtbl,
2692     DispHTMLStyle_tid,
2693     NULL,
2694     HTMLStyle_iface_tids
2695 };
2696
2697 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
2698 {
2699     HTMLStyle *ret = heap_alloc_zero(sizeof(HTMLStyle));
2700
2701     ret->lpHTMLStyleVtbl = &HTMLStyleVtbl;
2702     ret->ref = 1;
2703     ret->nsstyle = nsstyle;
2704     HTMLStyle2_Init(ret);
2705     HTMLStyle3_Init(ret);
2706
2707     nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
2708
2709     init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret),  &HTMLStyle_dispex);
2710
2711     return HTMLSTYLE(ret);
2712 }