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