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