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