push 149f0a5527ac85057a8ef03858d34d91c36f97e8
[wine/hacks.git] / dlls / mshtml / htmlstyle.c
blob7a43701f60581cf45c8bb4040cdca7fb2da1f87d
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
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.
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.
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
19 #include <stdarg.h>
20 #include <math.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "mshtmdid.h"
30 #include "mshtml_private.h"
31 #include "htmlstyle.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 static const WCHAR attrBackground[] =
39 {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPositionX[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
46 static const WCHAR attrBackgroundPositionY[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
48 static const WCHAR attrBackgroundRepeat[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
50 static const WCHAR attrBorder[] =
51 {'b','o','r','d','e','r',0};
52 static const WCHAR attrBorderBottom[] =
53 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
54 static const WCHAR attrBorderBottomColor[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
56 static const WCHAR attrBorderBottomStyle[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
58 static const WCHAR attrBorderBottomWidth[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
60 static const WCHAR attrBorderColor[] =
61 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
62 static const WCHAR attrBorderLeft[] =
63 {'b','o','r','d','e','r','-','l','e','f','t',0};
64 static const WCHAR attrBorderLeftColor[] =
65 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
66 static const WCHAR attrBorderLeftStyle[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
68 static const WCHAR attrBorderLeftWidth[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
70 static const WCHAR attrBorderRight[] =
71 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
72 static const WCHAR attrBorderRightColor[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
74 static const WCHAR attrBorderRightStyle[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
76 static const WCHAR attrBorderRightWidth[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
78 static const WCHAR attrBorderTop[] =
79 {'b','o','r','d','e','r','-','t','o','p',0};
80 static const WCHAR attrBorderTopColor[] =
81 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
82 static const WCHAR attrBorderStyle[] =
83 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
84 static const WCHAR attrBorderTopStyle[] =
85 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopWidth[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
88 static const WCHAR attrBorderWidth[] =
89 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
90 static const WCHAR attrBottom[] =
91 {'b','o','t','t','o','m',0};
92 static const WCHAR attrColor[] =
93 {'c','o','l','o','r',0};
94 static const WCHAR attrCursor[] =
95 {'c','u','r','s','o','r',0};
96 static const WCHAR attrDisplay[] =
97 {'d','i','s','p','l','a','y',0};
98 static const WCHAR attrFilter[] =
99 {'f','i','l','e','t','e','r',0};
100 static const WCHAR attrFontFamily[] =
101 {'f','o','n','t','-','f','a','m','i','l','y',0};
102 static const WCHAR attrFontSize[] =
103 {'f','o','n','t','-','s','i','z','e',0};
104 static const WCHAR attrFontStyle[] =
105 {'f','o','n','t','-','s','t','y','l','e',0};
106 static const WCHAR attrFontVariant[] =
107 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
108 static const WCHAR attrFontWeight[] =
109 {'f','o','n','t','-','w','e','i','g','h','t',0};
110 static const WCHAR attrHeight[] =
111 {'h','e','i','g','h','t',0};
112 static const WCHAR attrLeft[] =
113 {'l','e','f','t',0};
114 static const WCHAR attrLetterSpacing[] =
115 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
116 static const WCHAR attrLineHeight[] =
117 {'l','i','n','e','-','h','e','i','g','h','t',0};
118 static const WCHAR attrMargin[] =
119 {'m','a','r','g','i','n',0};
120 static const WCHAR attrMarginBottom[] =
121 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
122 static const WCHAR attrMarginLeft[] =
123 {'m','a','r','g','i','n','-','l','e','f','t',0};
124 static const WCHAR attrMarginRight[] =
125 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
126 static const WCHAR attrMarginTop[] =
127 {'m','a','r','g','i','n','-','t','o','p',0};
128 static const WCHAR attrMinHeight[] =
129 {'m','i','n','-','h','e','i','g','h','t',0};
130 static const WCHAR attrOverflow[] =
131 {'o','v','e','r','f','l','o','w',0};
132 static const WCHAR attrPaddingBottom[] =
133 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
134 static const WCHAR attrPaddingLeft[] =
135 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
136 static const WCHAR attrPaddingRight[] =
137 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
138 static const WCHAR attrPaddingTop[] =
139 {'p','a','d','d','i','n','g','-','t','o','p',0};
140 static const WCHAR attrPosition[] =
141 {'p','o','s','i','t','i','o','n',0};
142 static const WCHAR attrRight[] =
143 {'r','i','g','h','t',0};
144 static const WCHAR attrTextAlign[] =
145 {'t','e','x','t','-','a','l','i','g','n',0};
146 static const WCHAR attrTextDecoration[] =
147 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
148 static const WCHAR attrTextIndent[] =
149 {'t','e','x','t','-','i','n','d','e','n','t',0};
150 static const WCHAR attrTop[] =
151 {'t','o','p',0};
152 static const WCHAR attrVerticalAlign[] =
153 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
154 static const WCHAR attrVisibility[] =
155 {'v','i','s','i','b','i','l','i','t','y',0};
156 static const WCHAR attrWidth[] =
157 {'w','i','d','t','h',0};
158 static const WCHAR attrWordSpacing[] =
159 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
160 static const WCHAR attrWordWrap[] =
161 {'w','o','r','d','-','w','r','a','p',0};
162 static const WCHAR attrZIndex[] =
163 {'z','-','i','n','d','e','x',0};
165 static const struct{
166 const WCHAR *name;
167 DISPID dispid;
168 } style_tbl[] = {
169 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
170 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
171 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
172 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
173 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
174 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
175 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
176 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
177 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
178 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
179 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
180 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
181 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
182 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
183 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
184 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
185 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
186 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
187 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
188 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
189 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
190 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
191 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
192 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
193 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
194 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
195 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
196 {attrColor, DISPID_IHTMLSTYLE_COLOR},
197 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
198 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
199 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
200 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
201 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
202 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
203 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
204 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
205 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
206 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
207 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
208 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
209 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
210 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
211 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
212 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
213 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
214 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
215 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
216 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
217 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
218 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
219 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
220 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
221 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
222 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
223 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
224 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
225 {attrTop, DISPID_IHTMLSTYLE_TOP},
226 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
227 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
228 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
229 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
230 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
231 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
234 static const WCHAR valLineThrough[] =
235 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
236 static const WCHAR valUnderline[] =
237 {'u','n','d','e','r','l','i','n','e',0};
238 static const WCHAR szNormal[] =
239 {'n','o','r','m','a','l',0};
240 static const WCHAR styleNone[] =
241 {'n','o','n','e',0};
242 static const WCHAR valOverline[] =
243 {'o','v','e','r','l','i','n','e',0};
244 static const WCHAR valBlink[] =
245 {'b','l','i','n','k',0};
247 static const WCHAR px_formatW[] = {'%','d','p','x',0};
248 static const WCHAR emptyW[] = {0};
250 static LPWSTR fix_px_value(LPCWSTR val)
252 LPCWSTR ptr = val;
254 while(*ptr) {
255 while(*ptr && isspaceW(*ptr))
256 ptr++;
257 if(!*ptr)
258 break;
260 while(*ptr && isdigitW(*ptr))
261 ptr++;
263 if(!*ptr || isspaceW(*ptr)) {
264 LPWSTR ret, p;
265 int len = strlenW(val)+1;
267 ret = heap_alloc((len+2)*sizeof(WCHAR));
268 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
269 p = ret + (ptr-val);
270 *p++ = 'p';
271 *p++ = 'x';
272 strcpyW(p, ptr);
274 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
276 return ret;
279 while(*ptr && !isspaceW(*ptr))
280 ptr++;
283 return NULL;
286 static LPWSTR fix_url_value(LPCWSTR val)
288 WCHAR *ret, *ptr;
290 static const WCHAR urlW[] = {'u','r','l','('};
292 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
293 return NULL;
295 ret = heap_strdupW(val);
297 for(ptr = ret; *ptr; ptr++) {
298 if(*ptr == '\\')
299 *ptr = '/';
302 return ret;
305 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
307 nsAString str_name, str_value, str_empty;
308 LPWSTR val = NULL;
309 nsresult nsres;
311 static const PRUnichar wszEmpty[] = {0};
313 if(flags & ATTR_FIX_PX)
314 val = fix_px_value(value);
315 if(flags & ATTR_FIX_URL)
316 val = fix_url_value(value);
318 nsAString_Init(&str_name, style_tbl[sid].name);
319 nsAString_Init(&str_value, val ? val : value);
320 nsAString_Init(&str_empty, wszEmpty);
321 heap_free(val);
323 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
324 if(NS_FAILED(nsres))
325 ERR("SetProperty failed: %08x\n", nsres);
327 nsAString_Finish(&str_name);
328 nsAString_Finish(&str_value);
329 nsAString_Finish(&str_empty);
331 return S_OK;
334 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
336 switch(V_VT(value)) {
337 case VT_NULL:
338 return set_nsstyle_attr(nsstyle, sid, emptyW, flags);
340 case VT_BSTR:
341 return set_nsstyle_attr(nsstyle, sid, V_BSTR(value), flags);
343 case VT_BSTR|VT_BYREF:
344 return set_nsstyle_attr(nsstyle, sid, *V_BSTRREF(value), flags);
346 case VT_I4: {
347 WCHAR str[14];
348 static const WCHAR format[] = {'%','d',0};
350 wsprintfW(str, format, V_I4(value));
351 return set_nsstyle_attr(nsstyle, sid, str, flags);
353 default:
354 FIXME("not implemented vt %d\n", V_VT(value));
355 return E_NOTIMPL;
359 return S_OK;
362 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
364 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
367 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
369 nsAString str_name;
370 nsresult nsres;
372 nsAString_Init(&str_name, style_tbl[sid].name);
374 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
375 if(NS_FAILED(nsres)) {
376 ERR("SetProperty failed: %08x\n", nsres);
377 return E_FAIL;
380 nsAString_Finish(&str_name);
382 return NS_OK;
385 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
387 nsAString str_value;
388 const PRUnichar *value;
390 nsAString_Init(&str_value, NULL);
392 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
394 nsAString_GetData(&str_value, &value);
395 *p = *value ? SysAllocString(value) : NULL;
397 nsAString_Finish(&str_value);
399 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
400 return S_OK;
403 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
405 nsAString str_value;
406 const PRUnichar *value;
407 BOOL set = FALSE;
409 nsAString_Init(&str_value, NULL);
411 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
413 nsAString_GetData(&str_value, &value);
415 if(flags & ATTR_STR_TO_INT) {
416 const PRUnichar *ptr = value;
417 BOOL neg = FALSE;
418 INT i = 0;
420 if(*ptr == '-') {
421 neg = TRUE;
422 ptr++;
425 while(isdigitW(*ptr))
426 i = i*10 + (*ptr++ - '0');
428 if(!*ptr) {
429 V_VT(p) = VT_I4;
430 V_I4(p) = neg ? -i : i;
431 set = TRUE;
435 if(!set) {
436 BSTR str = NULL;
438 if(*value) {
439 str = SysAllocString(value);
440 if(!str)
441 return E_OUTOFMEMORY;
444 V_VT(p) = VT_BSTR;
445 V_BSTR(p) = str;
448 nsAString_Finish(&str_value);
450 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
451 return S_OK;
454 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
456 return get_nsstyle_attr(This->nsstyle, sid, p);
459 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
461 nsAString str_value;
462 const PRUnichar *value;
464 nsAString_Init(&str_value, NULL);
466 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
468 nsAString_GetData(&str_value, &value);
469 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
470 nsAString_Finish(&str_value);
472 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
473 return S_OK;
476 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
478 WCHAR szValue[25];
479 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
481 value = floor(value);
483 sprintfW(szValue, szFormat, value);
485 return set_style_attr(This, sid, szValue, 0);
488 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
490 nsAString str_value;
491 HRESULT hres;
492 WCHAR pxW[] = {'p','x',0};
494 TRACE("%p %d %p\n", This, sid, p);
496 *p = 0.0f;
498 nsAString_Init(&str_value, NULL);
500 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
501 if(hres == S_OK)
503 WCHAR *ptr;
504 const PRUnichar *value;
506 nsAString_GetData(&str_value, &value);
507 if(value)
509 *p = strtolW(value, &ptr, 10);
511 if(*ptr && strcmpW(ptr, pxW))
513 nsAString_Finish(&str_value);
514 FIXME("only px values are currently supported\n");
515 return E_FAIL;
520 TRACE("ret %f\n", *p);
522 nsAString_Finish(&str_value);
524 return hres;
527 static BOOL is_valid_border_style(BSTR v)
529 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
530 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
531 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
532 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
533 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
534 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
535 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
536 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
538 TRACE("%s\n", debugstr_w(v));
540 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
541 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
542 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
543 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
544 strcmpiW(v, styleOutset) == 0 )
546 return TRUE;
549 return FALSE;
552 #define HTMLSTYLE_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle, iface)
554 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
556 HTMLStyle *This = HTMLSTYLE_THIS(iface);
558 *ppv = NULL;
560 if(IsEqualGUID(&IID_IUnknown, riid)) {
561 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
562 *ppv = HTMLSTYLE(This);
563 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
564 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
565 *ppv = HTMLSTYLE(This);
566 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
567 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
568 *ppv = HTMLSTYLE2(This);
569 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
570 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
571 *ppv = HTMLSTYLE3(This);
572 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
573 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
574 *ppv = HTMLSTYLE4(This);
575 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
576 return *ppv ? S_OK : E_NOINTERFACE;
579 if(*ppv) {
580 IUnknown_AddRef((IUnknown*)*ppv);
581 return S_OK;
584 WARN("unsupported %s\n", debugstr_guid(riid));
585 return E_NOINTERFACE;
588 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
590 HTMLStyle *This = HTMLSTYLE_THIS(iface);
591 LONG ref = InterlockedIncrement(&This->ref);
593 TRACE("(%p) ref=%d\n", This, ref);
595 return ref;
598 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
600 HTMLStyle *This = HTMLSTYLE_THIS(iface);
601 LONG ref = InterlockedDecrement(&This->ref);
603 TRACE("(%p) ref=%d\n", This, ref);
605 if(!ref) {
606 if(This->nsstyle)
607 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
608 release_dispex(&This->dispex);
609 heap_free(This);
612 return ref;
615 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
617 HTMLStyle *This = HTMLSTYLE_THIS(iface);
618 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
621 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
622 LCID lcid, ITypeInfo **ppTInfo)
624 HTMLStyle *This = HTMLSTYLE_THIS(iface);
625 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
628 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
629 LPOLESTR *rgszNames, UINT cNames,
630 LCID lcid, DISPID *rgDispId)
632 HTMLStyle *This = HTMLSTYLE_THIS(iface);
633 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
636 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
637 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
638 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
640 HTMLStyle *This = HTMLSTYLE_THIS(iface);
641 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
642 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
645 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
647 HTMLStyle *This = HTMLSTYLE_THIS(iface);
649 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
651 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
654 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
656 HTMLStyle *This = HTMLSTYLE_THIS(iface);
658 TRACE("(%p)->(%p)\n", This, p);
660 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
663 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
665 HTMLStyle *This = HTMLSTYLE_THIS(iface);
666 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
667 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
669 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
671 /* fontStyle can only be one of the follow values. */
672 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
673 strcmpiW(szOblique, v) == 0)
675 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
678 return E_INVALIDARG;
681 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
683 HTMLStyle *This = HTMLSTYLE_THIS(iface);
685 TRACE("(%p)->(%p)\n", This, p);
687 return get_style_attr(This, STYLEID_FONT_STYLE, p);
690 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
692 HTMLStyle *This = HTMLSTYLE_THIS(iface);
693 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
695 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
697 /* fontVariant can only be one of the follow values. */
698 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
700 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
703 return E_INVALIDARG;
706 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
708 HTMLStyle *This = HTMLSTYLE_THIS(iface);
709 TRACE("(%p)->(%p)\n", This, p);
711 if(!p)
712 return E_INVALIDARG;
714 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
717 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
719 HTMLStyle *This = HTMLSTYLE_THIS(iface);
720 static const WCHAR styleBold[] = {'b','o','l','d',0};
721 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
722 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
723 static const WCHAR style100[] = {'1','0','0',0};
724 static const WCHAR style200[] = {'2','0','0',0};
725 static const WCHAR style300[] = {'3','0','0',0};
726 static const WCHAR style400[] = {'4','0','0',0};
727 static const WCHAR style500[] = {'5','0','0',0};
728 static const WCHAR style600[] = {'6','0','0',0};
729 static const WCHAR style700[] = {'7','0','0',0};
730 static const WCHAR style800[] = {'8','0','0',0};
731 static const WCHAR style900[] = {'9','0','0',0};
733 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
735 /* fontWeight can only be one of the following */
736 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
737 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
738 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
739 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
740 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
741 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
742 strcmpiW(style900, v) == 0
745 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
748 return E_INVALIDARG;
751 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
753 HTMLStyle *This = HTMLSTYLE_THIS(iface);
755 TRACE("(%p)->(%p)\n", This, p);
757 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
760 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
762 HTMLStyle *This = HTMLSTYLE_THIS(iface);
764 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
766 switch(V_VT(&v)) {
767 case VT_BSTR:
768 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
769 default:
770 FIXME("not supported vt %d\n", V_VT(&v));
773 return S_OK;
776 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
778 HTMLStyle *This = HTMLSTYLE_THIS(iface);
780 TRACE("(%p)->(%p)\n", This, p);
782 V_VT(p) = VT_BSTR;
783 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
786 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
788 HTMLStyle *This = HTMLSTYLE_THIS(iface);
789 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
790 return E_NOTIMPL;
793 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
795 HTMLStyle *This = HTMLSTYLE_THIS(iface);
796 FIXME("(%p)->(%p)\n", This, p);
797 return E_NOTIMPL;
800 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
802 HTMLStyle *This = HTMLSTYLE_THIS(iface);
804 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
806 switch(V_VT(&v)) {
807 case VT_BSTR:
808 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
809 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
811 default:
812 FIXME("unsupported vt=%d\n", V_VT(&v));
815 return E_NOTIMPL;
818 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
820 HTMLStyle *This = HTMLSTYLE_THIS(iface);
822 TRACE("(%p)->(%p)\n", This, p);
824 V_VT(p) = VT_BSTR;
825 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
828 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
830 HTMLStyle *This = HTMLSTYLE_THIS(iface);
832 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
834 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
837 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
839 HTMLStyle *This = HTMLSTYLE_THIS(iface);
841 TRACE("(%p)->(%p)\n", This, p);
843 return get_style_attr(This, STYLEID_BACKGROUND, p);
846 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
848 HTMLStyle *This = HTMLSTYLE_THIS(iface);
850 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
852 switch(V_VT(&v)) {
853 case VT_BSTR:
854 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
855 case VT_I4: {
856 WCHAR value[10];
857 static const WCHAR format[] = {'#','%','0','6','x',0};
859 wsprintfW(value, format, V_I4(&v));
860 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
862 default:
863 FIXME("unsupported vt %d\n", V_VT(&v));
866 return S_OK;
869 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
871 HTMLStyle *This = HTMLSTYLE_THIS(iface);
872 TRACE("(%p)->(%p)\n", This, p);
874 V_VT(p) = VT_BSTR;
875 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
878 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
880 HTMLStyle *This = HTMLSTYLE_THIS(iface);
882 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
884 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
887 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
889 HTMLStyle *This = HTMLSTYLE_THIS(iface);
891 TRACE("(%p)->(%p)\n", This, p);
893 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
896 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
898 HTMLStyle *This = HTMLSTYLE_THIS(iface);
899 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
900 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
901 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
902 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
904 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
906 /* fontWeight can only be one of the following */
907 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
908 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
910 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
913 return E_INVALIDARG;
916 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
918 HTMLStyle *This = HTMLSTYLE_THIS(iface);
920 TRACE("(%p)->(%p)\n", This, p);
922 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
925 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
927 HTMLStyle *This = HTMLSTYLE_THIS(iface);
928 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
929 return E_NOTIMPL;
932 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
934 HTMLStyle *This = HTMLSTYLE_THIS(iface);
935 FIXME("(%p)->(%p)\n", This, p);
936 return E_NOTIMPL;
939 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
941 HTMLStyle *This = HTMLSTYLE_THIS(iface);
942 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
943 return E_NOTIMPL;
946 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
948 HTMLStyle *This = HTMLSTYLE_THIS(iface);
949 FIXME("(%p)->(%p)\n", This, p);
950 return E_NOTIMPL;
953 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
955 HTMLStyle *This = HTMLSTYLE_THIS(iface);
956 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
957 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
960 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
962 HTMLStyle *This = HTMLSTYLE_THIS(iface);
963 TRACE("(%p)->(%p)\n", This, p);
964 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
967 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
969 HTMLStyle *This = HTMLSTYLE_THIS(iface);
970 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
971 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, &v, 0);
974 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
976 HTMLStyle *This = HTMLSTYLE_THIS(iface);
977 TRACE("(%p)->(%p)\n", This, p);
978 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, p, 0);
981 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
983 HTMLStyle *This = HTMLSTYLE_THIS(iface);
984 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
985 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
988 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
990 HTMLStyle *This = HTMLSTYLE_THIS(iface);
991 TRACE("(%p)->(%p)\n", This, p);
992 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
995 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
997 HTMLStyle *This = HTMLSTYLE_THIS(iface);
998 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
999 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1002 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1004 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1005 TRACE("(%p)->(%p)\n", This, p);
1006 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1009 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1011 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1013 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1015 /* textDecoration can only be one of the following */
1016 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1017 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1018 strcmpiW(valBlink, v) == 0)
1020 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1023 return E_INVALIDARG;
1026 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1028 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1030 TRACE("(%p)->(%p)\n", This, p);
1032 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1035 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1037 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1039 TRACE("(%p)->(%x)\n", This, v);
1041 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1044 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1046 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1048 TRACE("(%p)->(%p)\n", This, p);
1050 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1053 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1055 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1057 TRACE("(%p)->(%x)\n", This, v);
1059 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1062 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1064 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1066 TRACE("(%p)->(%p)\n", This, p);
1068 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1071 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1073 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1075 TRACE("(%p)->(%x)\n", This, v);
1077 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1080 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1082 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1084 TRACE("(%p)->(%p)\n", This, p);
1086 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1089 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1091 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1093 TRACE("(%p)->(%x)\n", This, v);
1095 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1098 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1100 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1102 TRACE("(%p)->(%p)\n", This, p);
1104 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1107 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1109 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1111 TRACE("(%p)->(%x)\n", This, v);
1113 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1116 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1118 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1120 TRACE("(%p)->(%p)\n", This, p);
1122 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1125 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1127 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1129 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1131 switch(V_VT(&v)) {
1132 case VT_BSTR:
1133 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1134 default:
1135 FIXME("not implemented vt %d\n", V_VT(&v));
1136 return E_NOTIMPL;
1139 return S_OK;
1142 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1144 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1145 BSTR ret;
1146 HRESULT hres;
1148 TRACE("(%p)->(%p)\n", This, p);
1150 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1151 if(FAILED(hres))
1152 return hres;
1154 V_VT(p) = VT_BSTR;
1155 V_BSTR(p) = ret;
1156 return S_OK;
1159 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1161 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1162 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1163 return E_NOTIMPL;
1166 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1168 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1169 FIXME("(%p)->(%p)\n", This, p);
1170 return E_NOTIMPL;
1173 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1175 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1177 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1179 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1182 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1184 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1186 TRACE("(%p)->(%p)\n", This, p);
1188 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1191 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1193 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1194 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1195 return E_NOTIMPL;
1198 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1200 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1201 FIXME("(%p)->(%p)\n", This, p);
1202 return E_NOTIMPL;
1205 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1207 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1208 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1209 return E_NOTIMPL;
1212 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1214 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1215 FIXME("(%p)->(%p)\n", This, p);
1216 return E_NOTIMPL;
1219 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1221 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1222 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1223 return E_NOTIMPL;
1226 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1228 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1229 FIXME("(%p)->(%p)\n", This, p);
1230 return E_NOTIMPL;
1233 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1235 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1237 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1239 switch(V_VT(&v)) {
1240 case VT_NULL:
1241 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1242 case VT_I4: {
1243 WCHAR buf[14];
1245 wsprintfW(buf, px_formatW, V_I4(&v));
1246 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1248 case VT_BSTR:
1249 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1250 default:
1251 FIXME("Unsupported vt=%d\n", V_VT(&v));
1254 return E_NOTIMPL;
1257 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1259 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1260 TRACE("(%p)->(%p)\n", This, p);
1261 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1264 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1266 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1267 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1268 return E_NOTIMPL;
1271 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1273 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1274 FIXME("(%p)->(%p)\n", This, p);
1275 return E_NOTIMPL;
1278 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1280 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1282 switch(V_VT(&v)) {
1283 case VT_NULL:
1284 TRACE("(%p)->(NULL)\n", This);
1285 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1286 case VT_I4: {
1287 WCHAR buf[14];
1289 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1291 wsprintfW(buf, px_formatW, V_I4(&v));
1292 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1294 case VT_BSTR:
1295 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1296 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1297 default:
1298 FIXME("Unsupported vt=%d\n", V_VT(&v));
1301 return E_NOTIMPL;
1304 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1306 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1308 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1310 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1313 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1315 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1317 TRACE("(%p)->(%p)\n", This, p);
1319 return get_style_attr(This, STYLEID_MARGIN, p);
1322 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1324 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1325 TRACE("(%p)->(%p)\n", This, p);
1326 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1329 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1331 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1332 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1333 return E_NOTIMPL;
1336 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1338 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1339 FIXME("(%p)->(%p)\n", This, p);
1340 return E_NOTIMPL;
1343 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1345 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1346 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1347 return E_NOTIMPL;
1350 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1352 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1353 FIXME("(%p)->(%p)\n", This, p);
1354 return E_NOTIMPL;
1357 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1359 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1360 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1361 return E_NOTIMPL;
1364 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1366 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1367 FIXME("(%p)->(%p)\n", This, p);
1368 return E_NOTIMPL;
1371 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1373 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1375 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1377 switch(V_VT(&v)) {
1378 case VT_I4: {
1379 WCHAR buf[14];
1381 wsprintfW(buf, px_formatW, V_I4(&v));
1382 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1384 case VT_BSTR:
1385 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1386 default:
1387 FIXME("unsupported vt=%d\n", V_VT(&v));
1390 return E_NOTIMPL;
1393 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1395 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1396 BSTR ret;
1397 HRESULT hres;
1399 TRACE("(%p)->(%p)\n", This, p);
1401 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1402 if(FAILED(hres))
1403 return hres;
1405 V_VT(p) = VT_BSTR;
1406 V_BSTR(p) = ret;
1407 return S_OK;
1410 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1412 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1413 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1414 return E_NOTIMPL;
1417 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1419 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1420 FIXME("(%p)->(%p)\n", This, p);
1421 return E_NOTIMPL;
1424 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1426 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1428 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1430 return set_style_attr(This, STYLEID_BORDER, v, 0);
1433 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1435 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1437 TRACE("(%p)->(%p)\n", This, p);
1439 return get_style_attr(This, STYLEID_BORDER, p);
1442 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1444 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1445 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1446 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1449 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1451 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1452 TRACE("(%p)->(%p)\n", This, p);
1453 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1456 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1458 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1459 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1460 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1463 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1465 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1466 TRACE("(%p)->(%p)\n", This, p);
1467 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1470 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1472 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1473 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1474 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1477 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1479 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1480 TRACE("(%p)->(%p)\n", This, p);
1481 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1484 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1486 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1488 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1490 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1493 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1495 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1497 TRACE("(%p)->(%p)\n", This, p);
1499 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1502 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1504 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1506 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1508 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1511 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1513 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1515 TRACE("(%p)->(%p)\n", This, p);
1517 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1520 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1522 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1523 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1524 return E_NOTIMPL;
1527 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1529 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1530 FIXME("(%p)->(%p)\n", This, p);
1531 return E_NOTIMPL;
1534 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1536 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1537 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1538 return E_NOTIMPL;
1541 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1543 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1544 FIXME("(%p)->(%p)\n", This, p);
1545 return E_NOTIMPL;
1548 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1550 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1551 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1552 return E_NOTIMPL;
1555 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1557 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1558 FIXME("(%p)->(%p)\n", This, p);
1559 return E_NOTIMPL;
1562 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1564 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1565 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1566 return E_NOTIMPL;
1569 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1571 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1572 FIXME("(%p)->(%p)\n", This, p);
1573 return E_NOTIMPL;
1576 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1578 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1579 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1580 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1583 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1585 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1586 TRACE("(%p)->(%p)\n", This, p);
1587 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1590 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1592 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1593 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1594 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1597 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1599 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1601 TRACE("(%p)->(%p)\n", This, p);
1603 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1606 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1608 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1609 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1610 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1613 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1615 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1616 TRACE("(%p)->(%p)\n", This, p);
1617 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1620 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1622 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1624 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1625 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1628 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1630 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1631 TRACE("(%p)->(%p)\n", This, p);
1632 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1635 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1637 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1638 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1639 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1642 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1644 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1645 TRACE("(%p)->(%p)\n", This, p);
1646 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1649 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1651 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1652 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1653 HRESULT hres = S_OK;
1654 BSTR pstyle;
1655 int i=0;
1656 int last = 0;
1658 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1660 while(v[i] && hres == S_OK)
1662 if(v[i] == (WCHAR)' ')
1664 pstyle = SysAllocStringLen(&v[last], (i-last));
1665 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1667 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1668 hres = E_INVALIDARG;
1670 SysFreeString(pstyle);
1671 last = i+1;
1673 i++;
1676 if(hres == S_OK)
1678 pstyle = SysAllocStringLen(&v[last], i-last);
1679 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1681 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1682 hres = E_INVALIDARG;
1684 SysFreeString(pstyle);
1687 if(hres == S_OK)
1688 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1690 return hres;
1693 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1695 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1696 TRACE("(%p)->(%p)\n", This, p);
1697 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1700 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1702 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1703 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1705 if(!is_valid_border_style(v))
1706 return E_INVALIDARG;
1708 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1711 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1713 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1714 TRACE("(%p)->(%p)\n", This, p);
1715 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1718 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1720 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1721 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1723 if(!is_valid_border_style(v))
1724 return E_INVALIDARG;
1726 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1729 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1731 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1732 TRACE("(%p)->(%p)\n", This, p);
1733 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1736 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1738 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1739 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1741 if(!is_valid_border_style(v))
1742 return E_INVALIDARG;
1744 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1747 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1749 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1750 TRACE("(%p)->(%p)\n", This, p);
1751 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1754 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1756 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1757 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1759 if(!is_valid_border_style(v))
1760 return E_INVALIDARG;
1762 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1765 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1767 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1768 TRACE("(%p)->(%p)\n", This, p);
1769 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
1772 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
1774 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1776 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1778 switch(V_VT(&v)) {
1779 case VT_BSTR:
1780 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
1781 return set_style_attr(This, STYLEID_WIDTH, V_BSTR(&v), 0);
1782 default:
1783 FIXME("unsupported vt %d\n", V_VT(&v));
1786 return E_NOTIMPL;
1789 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
1791 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1793 TRACE("(%p)->(%p)\n", This, p);
1795 V_VT(p) = VT_BSTR;
1796 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
1799 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
1801 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1803 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1805 switch(V_VT(&v)) {
1806 case VT_BSTR:
1807 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
1808 default:
1809 FIXME("unimplemented vt %d\n", V_VT(&v));
1810 return E_NOTIMPL;
1813 return S_OK;
1816 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
1818 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1819 BSTR ret;
1820 HRESULT hres;
1822 TRACE("(%p)->(%p)\n", This, p);
1824 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
1825 if(FAILED(hres))
1826 return hres;
1828 V_VT(p) = VT_BSTR;
1829 V_BSTR(p) = ret;
1830 return S_OK;
1833 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
1835 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1836 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1837 return E_NOTIMPL;
1840 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
1842 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1843 FIXME("(%p)->(%p)\n", This, p);
1844 return E_NOTIMPL;
1847 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
1849 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1850 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1851 return E_NOTIMPL;
1854 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
1856 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1857 FIXME("(%p)->(%p)\n", This, p);
1858 return E_NOTIMPL;
1861 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
1863 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1865 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1867 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
1870 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
1872 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1874 TRACE("(%p)->(%p)\n", This, p);
1876 return get_style_attr(This, STYLEID_DISPLAY, p);
1879 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
1881 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1883 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1885 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
1888 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
1890 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1892 TRACE("(%p)->(%p)\n", This, p);
1894 return get_style_attr(This, STYLEID_VISIBILITY, p);
1897 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
1899 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1900 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1901 return E_NOTIMPL;
1904 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
1906 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1907 FIXME("(%p)->(%p)\n", This, p);
1908 return E_NOTIMPL;
1911 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
1913 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1914 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1915 return E_NOTIMPL;
1918 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
1920 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1921 FIXME("(%p)->(%p)\n", This, p);
1922 return E_NOTIMPL;
1925 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
1927 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1928 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1929 return E_NOTIMPL;
1932 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
1934 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1935 FIXME("(%p)->(%p)\n", This, p);
1936 return E_NOTIMPL;
1939 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
1941 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1942 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1943 return E_NOTIMPL;
1946 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
1948 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1949 FIXME("(%p)->(%p)\n", This, p);
1950 return E_NOTIMPL;
1953 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
1955 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1956 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1957 return E_NOTIMPL;
1960 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
1962 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1963 FIXME("(%p)->(%p)\n", This, p);
1964 return E_NOTIMPL;
1967 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
1969 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1971 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1973 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
1976 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
1978 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1979 BSTR ret;
1980 HRESULT hres;
1982 TRACE("(%p)->(%p)\n", This, p);
1984 hres = get_style_attr(This, STYLEID_TOP, &ret);
1985 if(FAILED(hres))
1986 return hres;
1988 V_VT(p) = VT_BSTR;
1989 V_BSTR(p) = ret;
1990 return S_OK;
1993 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
1995 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1997 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1999 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2002 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2004 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2005 BSTR ret;
2006 HRESULT hres;
2008 TRACE("(%p)->(%p)\n", This, p);
2010 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2011 if(FAILED(hres))
2012 return hres;
2014 V_VT(p) = VT_BSTR;
2015 V_BSTR(p) = ret;
2016 return S_OK;
2019 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2021 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2022 TRACE("(%p)->(%p)\n", This, p);
2023 return IHTMLStyle2_get_position(HTMLSTYLE2(This), p);
2026 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2028 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2030 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2032 switch(V_VT(&v)) {
2033 case VT_BSTR:
2034 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2035 case VT_I4: {
2036 WCHAR value[14];
2037 static const WCHAR format[] = {'%','d',0};
2039 wsprintfW(value, format, V_I4(&v));
2040 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2042 default:
2043 FIXME("unimplemented vt %d\n", V_VT(&v));
2044 return E_NOTIMPL;
2047 return S_OK;
2050 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2052 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2054 TRACE("(%p)->(%p)\n", This, p);
2056 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2059 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2061 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2062 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2063 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2064 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2065 static const WCHAR szAuto[] = {'a','u','t','o',0};
2067 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2069 /* overflow can only be one of the follow values. */
2070 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2071 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2073 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2076 return E_INVALIDARG;
2080 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2082 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2084 TRACE("(%p)->(%p)\n", This, p);
2086 if(!p)
2087 return E_INVALIDARG;
2089 return get_style_attr(This, STYLEID_OVERFLOW, p);
2092 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2094 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2095 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2096 return E_NOTIMPL;
2099 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2101 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2102 FIXME("(%p)->(%p)\n", This, p);
2103 return E_NOTIMPL;
2106 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2108 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2109 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2110 return E_NOTIMPL;
2113 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2115 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2116 FIXME("(%p)->(%p)\n", This, p);
2117 return E_NOTIMPL;
2120 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2122 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2123 nsAString text_str;
2124 nsresult nsres;
2126 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2128 nsAString_Init(&text_str, v);
2129 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2130 nsAString_Finish(&text_str);
2131 if(NS_FAILED(nsres)) {
2132 FIXME("SetCssStyle failed: %08x\n", nsres);
2133 return E_FAIL;
2136 return S_OK;
2139 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2141 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2142 nsAString text_str;
2143 nsresult nsres;
2145 TRACE("(%p)->(%p)\n", This, p);
2147 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2148 nsAString_Init(&text_str, NULL);
2149 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2150 if(NS_SUCCEEDED(nsres)) {
2151 const PRUnichar *text;
2153 nsAString_GetData(&text_str, &text);
2154 *p = *text ? SysAllocString(text) : NULL;
2155 }else {
2156 FIXME("GetCssStyle failed: %08x\n", nsres);
2157 *p = NULL;
2160 nsAString_Finish(&text_str);
2161 return S_OK;
2164 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2166 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2167 FIXME("(%p)->()\n", This);
2168 return E_NOTIMPL;
2171 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2173 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2174 FIXME("(%p)->()\n", This);
2175 return E_NOTIMPL;
2178 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2180 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2181 FIXME("(%p)->()\n", This);
2182 return E_NOTIMPL;
2185 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2187 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2188 FIXME("(%p)->()\n", This);
2189 return E_NOTIMPL;
2192 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2194 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2195 FIXME("(%p)->()\n", This);
2196 return E_NOTIMPL;
2199 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2201 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2202 FIXME("(%p)->()\n", This);
2203 return E_NOTIMPL;
2206 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2208 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2209 FIXME("(%p)->()\n", This);
2210 return E_NOTIMPL;
2213 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2215 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2216 FIXME("(%p)->()\n", This);
2217 return E_NOTIMPL;
2220 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2222 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2224 TRACE("(%p)->(%f)\n", This, v);
2226 return set_style_pos(This, STYLEID_TOP, v);
2229 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2231 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2233 TRACE("(%p)->(%p)\n", This, p);
2235 if(!p)
2236 return E_POINTER;
2238 return get_nsstyle_pos(This, STYLEID_TOP, p);
2241 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2243 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2245 TRACE("(%p)->(%f)\n", This, v);
2247 return set_style_pos(This, STYLEID_LEFT, v);
2250 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2252 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2254 TRACE("(%p)->(%p)\n", This, p);
2256 if(!p)
2257 return E_POINTER;
2259 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2262 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2264 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2266 TRACE("(%p)->(%f)\n", This, v);
2268 return set_style_pos(This, STYLEID_WIDTH, v);
2271 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2273 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2275 TRACE("(%p)->(%p)\n", This, p);
2277 if(!p)
2278 return E_POINTER;
2280 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2281 *p = 0.0f;
2283 return S_OK;
2286 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2288 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2290 TRACE("(%p)->(%f)\n", This, v);
2292 return set_style_pos(This, STYLEID_HEIGHT, v);
2295 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2297 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2299 TRACE("(%p)->(%p)\n", This, p);
2301 if(!p)
2302 return E_POINTER;
2304 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2305 *p = 0.0f;
2307 return S_OK;
2310 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2312 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2314 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2316 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2319 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2321 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2323 TRACE("(%p)->(%p)\n", This, p);
2325 return get_style_attr(This, STYLEID_CURSOR, p);
2328 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2330 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2331 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2332 return E_NOTIMPL;
2335 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2337 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2338 FIXME("(%p)->(%p)\n", This, p);
2339 return E_NOTIMPL;
2342 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2344 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2346 WARN("(%p)->(%s)\n", This, debugstr_w(v));
2348 /* FIXME: Handle MS-style filters */
2349 return set_style_attr(This, STYLEID_FILTER, v, 0);
2352 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2354 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2356 WARN("(%p)->(%p)\n", This, p);
2358 /* FIXME: Handle MS-style filters */
2359 return get_style_attr(This, STYLEID_FILTER, p);
2362 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2363 VARIANT AttributeValue, LONG lFlags)
2365 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2366 HRESULT hres;
2367 DISPID dispid;
2369 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2370 V_VT(&AttributeValue), lFlags);
2372 if(!strAttributeName)
2373 return E_INVALIDARG;
2375 if(lFlags == 1)
2376 FIXME("Parameter lFlags ignored\n");
2378 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2379 LOCALE_USER_DEFAULT, &dispid);
2380 if(hres == S_OK)
2382 VARIANT ret;
2383 DISPID dispidNamed = DISPID_PROPERTYPUT;
2384 DISPPARAMS params;
2386 params.cArgs = 1;
2387 params.rgvarg = &AttributeValue;
2388 params.cNamedArgs = 1;
2389 params.rgdispidNamedArgs = &dispidNamed;
2391 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2392 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2394 else
2396 FIXME("Custom attributes not supported.\n");
2399 TRACE("ret: %08x\n", hres);
2401 return hres;
2404 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2405 LONG lFlags, VARIANT *AttributeValue)
2407 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2408 HRESULT hres;
2409 DISPID dispid;
2411 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2412 AttributeValue, lFlags);
2414 if(!AttributeValue || !strAttributeName)
2415 return E_INVALIDARG;
2417 if(lFlags == 1)
2418 FIXME("Parameter lFlags ignored\n");
2420 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2421 LOCALE_USER_DEFAULT, &dispid);
2422 if(hres == S_OK)
2424 DISPPARAMS params = {NULL, NULL, 0, 0 };
2426 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2427 DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2429 else
2431 FIXME("Custom attributes not supported.\n");
2434 return hres;
2437 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2438 LONG lFlags, VARIANT_BOOL *pfSuccess)
2440 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2441 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2442 lFlags, pfSuccess);
2443 return E_NOTIMPL;
2446 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2448 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2449 FIXME("(%p)->(%p)\n", This, String);
2450 return E_NOTIMPL;
2453 static HRESULT HTMLStyle_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
2455 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2457 while(min <= max) {
2458 i = (min+max)/2;
2460 c = strcmpW(style_tbl[i].name, name);
2461 if(!c) {
2462 *dispid = style_tbl[i].dispid;
2463 return S_OK;
2466 if(c > 0)
2467 max = i-1;
2468 else
2469 min = i+1;
2472 return DISP_E_UNKNOWNNAME;
2475 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2476 HTMLStyle_QueryInterface,
2477 HTMLStyle_AddRef,
2478 HTMLStyle_Release,
2479 HTMLStyle_GetTypeInfoCount,
2480 HTMLStyle_GetTypeInfo,
2481 HTMLStyle_GetIDsOfNames,
2482 HTMLStyle_Invoke,
2483 HTMLStyle_put_fontFamily,
2484 HTMLStyle_get_fontFamily,
2485 HTMLStyle_put_fontStyle,
2486 HTMLStyle_get_fontStyle,
2487 HTMLStyle_put_fontVariant,
2488 HTMLStyle_get_fontVariant,
2489 HTMLStyle_put_fontWeight,
2490 HTMLStyle_get_fontWeight,
2491 HTMLStyle_put_fontSize,
2492 HTMLStyle_get_fontSize,
2493 HTMLStyle_put_font,
2494 HTMLStyle_get_font,
2495 HTMLStyle_put_color,
2496 HTMLStyle_get_color,
2497 HTMLStyle_put_background,
2498 HTMLStyle_get_background,
2499 HTMLStyle_put_backgroundColor,
2500 HTMLStyle_get_backgroundColor,
2501 HTMLStyle_put_backgroundImage,
2502 HTMLStyle_get_backgroundImage,
2503 HTMLStyle_put_backgroundRepeat,
2504 HTMLStyle_get_backgroundRepeat,
2505 HTMLStyle_put_backgroundAttachment,
2506 HTMLStyle_get_backgroundAttachment,
2507 HTMLStyle_put_backgroundPosition,
2508 HTMLStyle_get_backgroundPosition,
2509 HTMLStyle_put_backgroundPositionX,
2510 HTMLStyle_get_backgroundPositionX,
2511 HTMLStyle_put_backgroundPositionY,
2512 HTMLStyle_get_backgroundPositionY,
2513 HTMLStyle_put_wordSpacing,
2514 HTMLStyle_get_wordSpacing,
2515 HTMLStyle_put_letterSpacing,
2516 HTMLStyle_get_letterSpacing,
2517 HTMLStyle_put_textDecoration,
2518 HTMLStyle_get_textDecoration,
2519 HTMLStyle_put_textDecorationNone,
2520 HTMLStyle_get_textDecorationNone,
2521 HTMLStyle_put_textDecorationUnderline,
2522 HTMLStyle_get_textDecorationUnderline,
2523 HTMLStyle_put_textDecorationOverline,
2524 HTMLStyle_get_textDecorationOverline,
2525 HTMLStyle_put_textDecorationLineThrough,
2526 HTMLStyle_get_textDecorationLineThrough,
2527 HTMLStyle_put_textDecorationBlink,
2528 HTMLStyle_get_textDecorationBlink,
2529 HTMLStyle_put_verticalAlign,
2530 HTMLStyle_get_verticalAlign,
2531 HTMLStyle_put_textTransform,
2532 HTMLStyle_get_textTransform,
2533 HTMLStyle_put_textAlign,
2534 HTMLStyle_get_textAlign,
2535 HTMLStyle_put_textIndent,
2536 HTMLStyle_get_textIndent,
2537 HTMLStyle_put_lineHeight,
2538 HTMLStyle_get_lineHeight,
2539 HTMLStyle_put_marginTop,
2540 HTMLStyle_get_marginTop,
2541 HTMLStyle_put_marginRight,
2542 HTMLStyle_get_marginRight,
2543 HTMLStyle_put_marginBottom,
2544 HTMLStyle_get_marginBottom,
2545 HTMLStyle_put_marginLeft,
2546 HTMLStyle_get_marginLeft,
2547 HTMLStyle_put_margin,
2548 HTMLStyle_get_margin,
2549 HTMLStyle_put_paddingTop,
2550 HTMLStyle_get_paddingTop,
2551 HTMLStyle_put_paddingRight,
2552 HTMLStyle_get_paddingRight,
2553 HTMLStyle_put_paddingBottom,
2554 HTMLStyle_get_paddingBottom,
2555 HTMLStyle_put_paddingLeft,
2556 HTMLStyle_get_paddingLeft,
2557 HTMLStyle_put_padding,
2558 HTMLStyle_get_padding,
2559 HTMLStyle_put_border,
2560 HTMLStyle_get_border,
2561 HTMLStyle_put_borderTop,
2562 HTMLStyle_get_borderTop,
2563 HTMLStyle_put_borderRight,
2564 HTMLStyle_get_borderRight,
2565 HTMLStyle_put_borderBottom,
2566 HTMLStyle_get_borderBottom,
2567 HTMLStyle_put_borderLeft,
2568 HTMLStyle_get_borderLeft,
2569 HTMLStyle_put_borderColor,
2570 HTMLStyle_get_borderColor,
2571 HTMLStyle_put_borderTopColor,
2572 HTMLStyle_get_borderTopColor,
2573 HTMLStyle_put_borderRightColor,
2574 HTMLStyle_get_borderRightColor,
2575 HTMLStyle_put_borderBottomColor,
2576 HTMLStyle_get_borderBottomColor,
2577 HTMLStyle_put_borderLeftColor,
2578 HTMLStyle_get_borderLeftColor,
2579 HTMLStyle_put_borderWidth,
2580 HTMLStyle_get_borderWidth,
2581 HTMLStyle_put_borderTopWidth,
2582 HTMLStyle_get_borderTopWidth,
2583 HTMLStyle_put_borderRightWidth,
2584 HTMLStyle_get_borderRightWidth,
2585 HTMLStyle_put_borderBottomWidth,
2586 HTMLStyle_get_borderBottomWidth,
2587 HTMLStyle_put_borderLeftWidth,
2588 HTMLStyle_get_borderLeftWidth,
2589 HTMLStyle_put_borderStyle,
2590 HTMLStyle_get_borderStyle,
2591 HTMLStyle_put_borderTopStyle,
2592 HTMLStyle_get_borderTopStyle,
2593 HTMLStyle_put_borderRightStyle,
2594 HTMLStyle_get_borderRightStyle,
2595 HTMLStyle_put_borderBottomStyle,
2596 HTMLStyle_get_borderBottomStyle,
2597 HTMLStyle_put_borderLeftStyle,
2598 HTMLStyle_get_borderLeftStyle,
2599 HTMLStyle_put_width,
2600 HTMLStyle_get_width,
2601 HTMLStyle_put_height,
2602 HTMLStyle_get_height,
2603 HTMLStyle_put_styleFloat,
2604 HTMLStyle_get_styleFloat,
2605 HTMLStyle_put_clear,
2606 HTMLStyle_get_clear,
2607 HTMLStyle_put_display,
2608 HTMLStyle_get_display,
2609 HTMLStyle_put_visibility,
2610 HTMLStyle_get_visibility,
2611 HTMLStyle_put_listStyleType,
2612 HTMLStyle_get_listStyleType,
2613 HTMLStyle_put_listStylePosition,
2614 HTMLStyle_get_listStylePosition,
2615 HTMLStyle_put_listStyleImage,
2616 HTMLStyle_get_listStyleImage,
2617 HTMLStyle_put_listStyle,
2618 HTMLStyle_get_listStyle,
2619 HTMLStyle_put_whiteSpace,
2620 HTMLStyle_get_whiteSpace,
2621 HTMLStyle_put_top,
2622 HTMLStyle_get_top,
2623 HTMLStyle_put_left,
2624 HTMLStyle_get_left,
2625 HTMLStyle_get_position,
2626 HTMLStyle_put_zIndex,
2627 HTMLStyle_get_zIndex,
2628 HTMLStyle_put_overflow,
2629 HTMLStyle_get_overflow,
2630 HTMLStyle_put_pageBreakBefore,
2631 HTMLStyle_get_pageBreakBefore,
2632 HTMLStyle_put_pageBreakAfter,
2633 HTMLStyle_get_pageBreakAfter,
2634 HTMLStyle_put_cssText,
2635 HTMLStyle_get_cssText,
2636 HTMLStyle_put_pixelTop,
2637 HTMLStyle_get_pixelTop,
2638 HTMLStyle_put_pixelLeft,
2639 HTMLStyle_get_pixelLeft,
2640 HTMLStyle_put_pixelWidth,
2641 HTMLStyle_get_pixelWidth,
2642 HTMLStyle_put_pixelHeight,
2643 HTMLStyle_get_pixelHeight,
2644 HTMLStyle_put_posTop,
2645 HTMLStyle_get_posTop,
2646 HTMLStyle_put_posLeft,
2647 HTMLStyle_get_posLeft,
2648 HTMLStyle_put_posWidth,
2649 HTMLStyle_get_posWidth,
2650 HTMLStyle_put_posHeight,
2651 HTMLStyle_get_posHeight,
2652 HTMLStyle_put_cursor,
2653 HTMLStyle_get_cursor,
2654 HTMLStyle_put_clip,
2655 HTMLStyle_get_clip,
2656 HTMLStyle_put_filter,
2657 HTMLStyle_get_filter,
2658 HTMLStyle_setAttribute,
2659 HTMLStyle_getAttribute,
2660 HTMLStyle_removeAttribute,
2661 HTMLStyle_toString
2664 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
2665 NULL,
2666 HTMLStyle_get_dispid,
2667 NULL
2670 static const tid_t HTMLStyle_iface_tids[] = {
2671 IHTMLStyle_tid,
2672 IHTMLStyle2_tid,
2673 IHTMLStyle3_tid,
2674 IHTMLStyle4_tid,
2677 static dispex_static_data_t HTMLStyle_dispex = {
2678 &HTMLStyle_dispex_vtbl,
2679 DispHTMLStyle_tid,
2680 NULL,
2681 HTMLStyle_iface_tids
2684 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
2686 HTMLStyle *ret = heap_alloc_zero(sizeof(HTMLStyle));
2688 ret->lpHTMLStyleVtbl = &HTMLStyleVtbl;
2689 ret->ref = 1;
2690 ret->nsstyle = nsstyle;
2691 HTMLStyle2_Init(ret);
2692 HTMLStyle3_Init(ret);
2694 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
2696 init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret), &HTMLStyle_dispex);
2698 return HTMLSTYLE(ret);