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