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