mshtml: Implement IHTMLStyle_put_borderLeftColor.
[wine/multimedia.git] / dlls / mshtml / htmlstyle.c
blob51e3fd3171fed1f4663f0e7cb0d450e2b3827d38
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 attrPadding[] =
133 {'p','a','d','d','i','n','g',0};
134 static const WCHAR attrPaddingBottom[] =
135 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
136 static const WCHAR attrPaddingLeft[] =
137 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
138 static const WCHAR attrPaddingRight[] =
139 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
140 static const WCHAR attrPaddingTop[] =
141 {'p','a','d','d','i','n','g','-','t','o','p',0};
142 static const WCHAR attrPosition[] =
143 {'p','o','s','i','t','i','o','n',0};
144 static const WCHAR attrRight[] =
145 {'r','i','g','h','t',0};
146 static const WCHAR attrTextAlign[] =
147 {'t','e','x','t','-','a','l','i','g','n',0};
148 static const WCHAR attrTextDecoration[] =
149 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
150 static const WCHAR attrTextIndent[] =
151 {'t','e','x','t','-','i','n','d','e','n','t',0};
152 static const WCHAR attrTop[] =
153 {'t','o','p',0};
154 static const WCHAR attrVerticalAlign[] =
155 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
156 static const WCHAR attrVisibility[] =
157 {'v','i','s','i','b','i','l','i','t','y',0};
158 static const WCHAR attrWidth[] =
159 {'w','i','d','t','h',0};
160 static const WCHAR attrWordSpacing[] =
161 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
162 static const WCHAR attrWordWrap[] =
163 {'w','o','r','d','-','w','r','a','p',0};
164 static const WCHAR attrZIndex[] =
165 {'z','-','i','n','d','e','x',0};
167 static const struct{
168 const WCHAR *name;
169 DISPID dispid;
170 } style_tbl[] = {
171 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
172 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
173 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
174 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
175 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
176 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
177 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
178 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
179 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
180 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
181 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
182 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
183 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
184 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
185 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
186 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
187 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
188 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
189 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
190 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
191 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
192 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
193 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
194 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
195 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
196 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
197 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
198 {attrColor, DISPID_IHTMLSTYLE_COLOR},
199 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
200 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
201 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
202 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
203 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
204 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
205 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
206 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
207 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
208 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
209 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
210 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
211 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
212 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
213 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
214 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
215 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
216 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
217 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
218 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
219 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
220 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
221 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
222 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
223 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
224 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
225 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
226 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
227 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
228 {attrTop, DISPID_IHTMLSTYLE_TOP},
229 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
230 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
231 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
232 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
233 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
234 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
237 static const WCHAR valLineThrough[] =
238 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
239 static const WCHAR valUnderline[] =
240 {'u','n','d','e','r','l','i','n','e',0};
241 static const WCHAR szNormal[] =
242 {'n','o','r','m','a','l',0};
243 static const WCHAR styleNone[] =
244 {'n','o','n','e',0};
245 static const WCHAR valOverline[] =
246 {'o','v','e','r','l','i','n','e',0};
247 static const WCHAR valBlink[] =
248 {'b','l','i','n','k',0};
250 static const WCHAR px_formatW[] = {'%','d','p','x',0};
251 static const WCHAR emptyW[] = {0};
253 static LPWSTR fix_px_value(LPCWSTR val)
255 LPCWSTR ptr = val;
257 while(*ptr) {
258 while(*ptr && isspaceW(*ptr))
259 ptr++;
260 if(!*ptr)
261 break;
263 while(*ptr && isdigitW(*ptr))
264 ptr++;
266 if(!*ptr || isspaceW(*ptr)) {
267 LPWSTR ret, p;
268 int len = strlenW(val)+1;
270 ret = heap_alloc((len+2)*sizeof(WCHAR));
271 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
272 p = ret + (ptr-val);
273 *p++ = 'p';
274 *p++ = 'x';
275 strcpyW(p, ptr);
277 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
279 return ret;
282 while(*ptr && !isspaceW(*ptr))
283 ptr++;
286 return NULL;
289 static LPWSTR fix_url_value(LPCWSTR val)
291 WCHAR *ret, *ptr;
293 static const WCHAR urlW[] = {'u','r','l','('};
295 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
296 return NULL;
298 ret = heap_strdupW(val);
300 for(ptr = ret; *ptr; ptr++) {
301 if(*ptr == '\\')
302 *ptr = '/';
305 return ret;
308 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
310 nsAString str_name, str_value, str_empty;
311 LPWSTR val = NULL;
312 nsresult nsres;
314 static const PRUnichar wszEmpty[] = {0};
316 if(flags & ATTR_FIX_PX)
317 val = fix_px_value(value);
318 if(flags & ATTR_FIX_URL)
319 val = fix_url_value(value);
321 nsAString_InitDepend(&str_name, style_tbl[sid].name);
322 nsAString_InitDepend(&str_value, val ? val : value);
323 nsAString_InitDepend(&str_empty, wszEmpty);
324 heap_free(val);
326 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
327 if(NS_FAILED(nsres))
328 ERR("SetProperty failed: %08x\n", nsres);
330 nsAString_Finish(&str_name);
331 nsAString_Finish(&str_value);
332 nsAString_Finish(&str_empty);
334 return S_OK;
337 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
339 switch(V_VT(value)) {
340 case VT_NULL:
341 return set_nsstyle_attr(nsstyle, sid, emptyW, flags);
343 case VT_BSTR:
344 return set_nsstyle_attr(nsstyle, sid, V_BSTR(value), flags);
346 case VT_BSTR|VT_BYREF:
347 return set_nsstyle_attr(nsstyle, sid, *V_BSTRREF(value), flags);
349 case VT_I4: {
350 WCHAR str[14];
352 static const WCHAR format[] = {'%','d',0};
353 static const WCHAR px_format[] = {'%','d','p','x',0};
354 static const WCHAR hex_format[] = {'#','%','0','6','x',0};
356 if(flags & ATTR_HEX_INT)
357 wsprintfW(str, hex_format, V_I4(value));
358 else
359 wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
360 return set_nsstyle_attr(nsstyle, sid, str, flags & ~ATTR_FIX_PX);
362 default:
363 FIXME("not implemented vt %d\n", V_VT(value));
364 return E_NOTIMPL;
368 return S_OK;
371 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
373 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
376 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
378 nsAString str_name;
379 nsresult nsres;
381 nsAString_InitDepend(&str_name, style_tbl[sid].name);
383 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
384 if(NS_FAILED(nsres)) {
385 ERR("SetProperty failed: %08x\n", nsres);
386 return E_FAIL;
389 nsAString_Finish(&str_name);
391 return NS_OK;
394 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
396 nsAString str_value;
397 const PRUnichar *value;
399 nsAString_Init(&str_value, NULL);
401 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
403 nsAString_GetData(&str_value, &value);
404 *p = *value ? SysAllocString(value) : NULL;
406 nsAString_Finish(&str_value);
408 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
409 return S_OK;
412 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
414 nsAString str_value;
415 const PRUnichar *value;
416 BOOL set = FALSE;
418 nsAString_Init(&str_value, NULL);
420 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
422 nsAString_GetData(&str_value, &value);
424 if(flags & ATTR_STR_TO_INT) {
425 const PRUnichar *ptr = value;
426 BOOL neg = FALSE;
427 INT i = 0;
429 if(*ptr == '-') {
430 neg = TRUE;
431 ptr++;
434 while(isdigitW(*ptr))
435 i = i*10 + (*ptr++ - '0');
437 if(!*ptr) {
438 V_VT(p) = VT_I4;
439 V_I4(p) = neg ? -i : i;
440 set = TRUE;
444 if(!set) {
445 BSTR str = NULL;
447 if(*value) {
448 str = SysAllocString(value);
449 if(!str)
450 return E_OUTOFMEMORY;
453 V_VT(p) = VT_BSTR;
454 V_BSTR(p) = str;
457 nsAString_Finish(&str_value);
459 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
460 return S_OK;
463 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
465 return get_nsstyle_attr(This->nsstyle, sid, p);
468 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
470 nsAString str_value;
471 const PRUnichar *value;
473 nsAString_Init(&str_value, NULL);
475 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
477 nsAString_GetData(&str_value, &value);
478 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
479 nsAString_Finish(&str_value);
481 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
482 return S_OK;
485 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
487 WCHAR szValue[25];
488 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
490 value = floor(value);
492 sprintfW(szValue, szFormat, value);
494 return set_style_attr(This, sid, szValue, 0);
497 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
499 nsAString str_value;
500 HRESULT hres;
501 WCHAR pxW[] = {'p','x',0};
503 TRACE("%p %d %p\n", This, sid, p);
505 *p = 0.0f;
507 nsAString_Init(&str_value, NULL);
509 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
510 if(hres == S_OK)
512 WCHAR *ptr;
513 const PRUnichar *value;
515 nsAString_GetData(&str_value, &value);
516 if(value)
518 *p = strtolW(value, &ptr, 10);
520 if(*ptr && strcmpW(ptr, pxW))
522 nsAString_Finish(&str_value);
523 FIXME("only px values are currently supported\n");
524 return E_FAIL;
529 TRACE("ret %f\n", *p);
531 nsAString_Finish(&str_value);
533 return hres;
536 static BOOL is_valid_border_style(BSTR v)
538 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
539 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
540 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
541 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
542 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
543 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
544 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
545 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
547 TRACE("%s\n", debugstr_w(v));
549 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
550 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
551 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
552 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
553 strcmpiW(v, styleOutset) == 0 )
555 return TRUE;
558 return FALSE;
561 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
563 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
566 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
568 HTMLStyle *This = impl_from_IHTMLStyle(iface);
570 *ppv = NULL;
572 if(IsEqualGUID(&IID_IUnknown, riid)) {
573 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
574 *ppv = &This->IHTMLStyle_iface;
575 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
576 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
577 *ppv = &This->IHTMLStyle_iface;
578 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
579 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
580 *ppv = &This->IHTMLStyle2_iface;
581 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
582 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
583 *ppv = &This->IHTMLStyle3_iface;
584 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
585 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
586 *ppv = &This->IHTMLStyle4_iface;
587 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
588 return *ppv ? S_OK : E_NOINTERFACE;
591 if(*ppv) {
592 IUnknown_AddRef((IUnknown*)*ppv);
593 return S_OK;
596 WARN("unsupported %s\n", debugstr_guid(riid));
597 return E_NOINTERFACE;
600 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
602 HTMLStyle *This = impl_from_IHTMLStyle(iface);
603 LONG ref = InterlockedIncrement(&This->ref);
605 TRACE("(%p) ref=%d\n", This, ref);
607 return ref;
610 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
612 HTMLStyle *This = impl_from_IHTMLStyle(iface);
613 LONG ref = InterlockedDecrement(&This->ref);
615 TRACE("(%p) ref=%d\n", This, ref);
617 if(!ref) {
618 if(This->nsstyle)
619 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
620 release_dispex(&This->dispex);
621 heap_free(This);
624 return ref;
627 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
629 HTMLStyle *This = impl_from_IHTMLStyle(iface);
630 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
633 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
634 LCID lcid, ITypeInfo **ppTInfo)
636 HTMLStyle *This = impl_from_IHTMLStyle(iface);
637 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
640 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
641 LPOLESTR *rgszNames, UINT cNames,
642 LCID lcid, DISPID *rgDispId)
644 HTMLStyle *This = impl_from_IHTMLStyle(iface);
645 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
646 lcid, rgDispId);
649 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
650 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
651 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
653 HTMLStyle *This = impl_from_IHTMLStyle(iface);
654 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
655 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
658 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
660 HTMLStyle *This = impl_from_IHTMLStyle(iface);
662 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
664 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
667 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
669 HTMLStyle *This = impl_from_IHTMLStyle(iface);
671 TRACE("(%p)->(%p)\n", This, p);
673 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
676 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
678 HTMLStyle *This = impl_from_IHTMLStyle(iface);
679 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
680 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
682 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
684 /* fontStyle can only be one of the follow values. */
685 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
686 strcmpiW(szOblique, v) == 0)
688 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
691 return E_INVALIDARG;
694 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
696 HTMLStyle *This = impl_from_IHTMLStyle(iface);
698 TRACE("(%p)->(%p)\n", This, p);
700 return get_style_attr(This, STYLEID_FONT_STYLE, p);
703 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
705 HTMLStyle *This = impl_from_IHTMLStyle(iface);
706 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
708 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
710 /* fontVariant can only be one of the follow values. */
711 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
713 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
716 return E_INVALIDARG;
719 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
721 HTMLStyle *This = impl_from_IHTMLStyle(iface);
722 TRACE("(%p)->(%p)\n", This, p);
724 if(!p)
725 return E_INVALIDARG;
727 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
730 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
732 HTMLStyle *This = impl_from_IHTMLStyle(iface);
733 static const WCHAR styleBold[] = {'b','o','l','d',0};
734 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
735 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
736 static const WCHAR style100[] = {'1','0','0',0};
737 static const WCHAR style200[] = {'2','0','0',0};
738 static const WCHAR style300[] = {'3','0','0',0};
739 static const WCHAR style400[] = {'4','0','0',0};
740 static const WCHAR style500[] = {'5','0','0',0};
741 static const WCHAR style600[] = {'6','0','0',0};
742 static const WCHAR style700[] = {'7','0','0',0};
743 static const WCHAR style800[] = {'8','0','0',0};
744 static const WCHAR style900[] = {'9','0','0',0};
746 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
748 /* fontWeight can only be one of the following */
749 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
750 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
751 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
752 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
753 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
754 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
755 strcmpiW(style900, v) == 0
758 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
761 return E_INVALIDARG;
764 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
766 HTMLStyle *This = impl_from_IHTMLStyle(iface);
768 TRACE("(%p)->(%p)\n", This, p);
770 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
773 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
775 HTMLStyle *This = impl_from_IHTMLStyle(iface);
777 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
779 switch(V_VT(&v)) {
780 case VT_BSTR:
781 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
782 default:
783 FIXME("not supported vt %d\n", V_VT(&v));
786 return S_OK;
789 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
791 HTMLStyle *This = impl_from_IHTMLStyle(iface);
793 TRACE("(%p)->(%p)\n", This, p);
795 V_VT(p) = VT_BSTR;
796 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
799 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
801 HTMLStyle *This = impl_from_IHTMLStyle(iface);
802 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
803 return E_NOTIMPL;
806 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
808 HTMLStyle *This = impl_from_IHTMLStyle(iface);
809 FIXME("(%p)->(%p)\n", This, p);
810 return E_NOTIMPL;
813 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
815 HTMLStyle *This = impl_from_IHTMLStyle(iface);
817 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
819 switch(V_VT(&v)) {
820 case VT_BSTR:
821 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
822 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
824 default:
825 FIXME("unsupported vt=%d\n", V_VT(&v));
828 return E_NOTIMPL;
831 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
833 HTMLStyle *This = impl_from_IHTMLStyle(iface);
835 TRACE("(%p)->(%p)\n", This, p);
837 V_VT(p) = VT_BSTR;
838 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
841 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
843 HTMLStyle *This = impl_from_IHTMLStyle(iface);
845 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
847 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
850 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
852 HTMLStyle *This = impl_from_IHTMLStyle(iface);
854 TRACE("(%p)->(%p)\n", This, p);
856 return get_style_attr(This, STYLEID_BACKGROUND, p);
859 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
861 HTMLStyle *This = impl_from_IHTMLStyle(iface);
863 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
865 switch(V_VT(&v)) {
866 case VT_BSTR:
867 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
868 case VT_I4: {
869 WCHAR value[10];
870 static const WCHAR format[] = {'#','%','0','6','x',0};
872 wsprintfW(value, format, V_I4(&v));
873 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
875 default:
876 FIXME("unsupported vt %d\n", V_VT(&v));
879 return S_OK;
882 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
884 HTMLStyle *This = impl_from_IHTMLStyle(iface);
885 TRACE("(%p)->(%p)\n", This, p);
887 V_VT(p) = VT_BSTR;
888 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
891 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
893 HTMLStyle *This = impl_from_IHTMLStyle(iface);
895 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
897 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
900 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
902 HTMLStyle *This = impl_from_IHTMLStyle(iface);
904 TRACE("(%p)->(%p)\n", This, p);
906 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
909 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
911 HTMLStyle *This = impl_from_IHTMLStyle(iface);
912 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
913 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
914 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
915 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
917 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
919 /* fontWeight can only be one of the following */
920 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
921 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
923 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
926 return E_INVALIDARG;
929 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
931 HTMLStyle *This = impl_from_IHTMLStyle(iface);
933 TRACE("(%p)->(%p)\n", This, p);
935 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
938 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
940 HTMLStyle *This = impl_from_IHTMLStyle(iface);
941 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
942 return E_NOTIMPL;
945 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
947 HTMLStyle *This = impl_from_IHTMLStyle(iface);
948 FIXME("(%p)->(%p)\n", This, p);
949 return E_NOTIMPL;
952 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
954 HTMLStyle *This = impl_from_IHTMLStyle(iface);
955 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
956 return E_NOTIMPL;
959 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
961 HTMLStyle *This = impl_from_IHTMLStyle(iface);
962 FIXME("(%p)->(%p)\n", This, p);
963 return E_NOTIMPL;
966 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
968 HTMLStyle *This = impl_from_IHTMLStyle(iface);
969 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
970 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
973 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
975 HTMLStyle *This = impl_from_IHTMLStyle(iface);
976 TRACE("(%p)->(%p)\n", This, p);
977 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
980 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
982 HTMLStyle *This = impl_from_IHTMLStyle(iface);
983 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
984 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, &v, 0);
987 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
989 HTMLStyle *This = impl_from_IHTMLStyle(iface);
990 TRACE("(%p)->(%p)\n", This, p);
991 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, p, 0);
994 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
996 HTMLStyle *This = impl_from_IHTMLStyle(iface);
997 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
998 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1001 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1003 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1004 TRACE("(%p)->(%p)\n", This, p);
1005 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1008 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1010 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1011 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1012 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1015 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1017 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1018 TRACE("(%p)->(%p)\n", This, p);
1019 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1022 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1026 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1028 /* textDecoration can only be one of the following */
1029 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1030 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1031 strcmpiW(valBlink, v) == 0)
1033 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1036 return E_INVALIDARG;
1039 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1041 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1043 TRACE("(%p)->(%p)\n", This, p);
1045 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1048 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1050 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1052 TRACE("(%p)->(%x)\n", This, v);
1054 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1057 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1059 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1061 TRACE("(%p)->(%p)\n", This, p);
1063 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1066 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1068 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1070 TRACE("(%p)->(%x)\n", This, v);
1072 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1075 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1077 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1079 TRACE("(%p)->(%p)\n", This, p);
1081 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1084 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1086 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1088 TRACE("(%p)->(%x)\n", This, v);
1090 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1093 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1095 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1097 TRACE("(%p)->(%p)\n", This, p);
1099 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1102 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1104 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1106 TRACE("(%p)->(%x)\n", This, v);
1108 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1111 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1113 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1115 TRACE("(%p)->(%p)\n", This, p);
1117 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1120 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1122 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1124 TRACE("(%p)->(%x)\n", This, v);
1126 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1129 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1131 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1133 TRACE("(%p)->(%p)\n", This, p);
1135 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1138 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1140 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1142 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1144 switch(V_VT(&v)) {
1145 case VT_BSTR:
1146 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1147 default:
1148 FIXME("not implemented vt %d\n", V_VT(&v));
1149 return E_NOTIMPL;
1152 return S_OK;
1155 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1157 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1158 BSTR ret;
1159 HRESULT hres;
1161 TRACE("(%p)->(%p)\n", This, p);
1163 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1164 if(FAILED(hres))
1165 return hres;
1167 V_VT(p) = VT_BSTR;
1168 V_BSTR(p) = ret;
1169 return S_OK;
1172 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1174 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1175 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1176 return E_NOTIMPL;
1179 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1181 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1182 FIXME("(%p)->(%p)\n", This, p);
1183 return E_NOTIMPL;
1186 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1188 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1190 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1192 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1195 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1197 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1199 TRACE("(%p)->(%p)\n", This, p);
1201 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1204 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1206 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1207 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1208 return E_NOTIMPL;
1211 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1213 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1214 FIXME("(%p)->(%p)\n", This, p);
1215 return E_NOTIMPL;
1218 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1220 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1221 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1222 return E_NOTIMPL;
1225 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1227 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1228 FIXME("(%p)->(%p)\n", This, p);
1229 return E_NOTIMPL;
1232 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1234 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1236 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1238 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1241 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1243 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1245 TRACE("(%p)->(%p)\n", This, p);
1247 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1250 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1252 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1254 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1256 switch(V_VT(&v)) {
1257 case VT_NULL:
1258 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1259 case VT_I4: {
1260 WCHAR buf[14];
1262 wsprintfW(buf, px_formatW, V_I4(&v));
1263 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1265 case VT_BSTR:
1266 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1267 default:
1268 FIXME("Unsupported vt=%d\n", V_VT(&v));
1271 return E_NOTIMPL;
1274 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1276 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1277 TRACE("(%p)->(%p)\n", This, p);
1278 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1281 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1283 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1284 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1285 return E_NOTIMPL;
1288 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1290 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1291 FIXME("(%p)->(%p)\n", This, p);
1292 return E_NOTIMPL;
1295 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1297 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1299 switch(V_VT(&v)) {
1300 case VT_NULL:
1301 TRACE("(%p)->(NULL)\n", This);
1302 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1303 case VT_I4: {
1304 WCHAR buf[14];
1306 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1308 wsprintfW(buf, px_formatW, V_I4(&v));
1309 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1311 case VT_BSTR:
1312 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1313 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1314 default:
1315 FIXME("Unsupported vt=%d\n", V_VT(&v));
1318 return E_NOTIMPL;
1321 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1323 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1325 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1327 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1330 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1332 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1334 TRACE("(%p)->(%p)\n", This, p);
1336 return get_style_attr(This, STYLEID_MARGIN, p);
1339 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1341 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1342 TRACE("(%p)->(%p)\n", This, p);
1343 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1346 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1348 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1349 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1350 return E_NOTIMPL;
1353 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1355 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1356 FIXME("(%p)->(%p)\n", This, p);
1357 return E_NOTIMPL;
1360 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1362 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1363 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1364 return E_NOTIMPL;
1367 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1369 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1370 FIXME("(%p)->(%p)\n", This, p);
1371 return E_NOTIMPL;
1374 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1376 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1377 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1378 return E_NOTIMPL;
1381 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1383 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1384 FIXME("(%p)->(%p)\n", This, p);
1385 return E_NOTIMPL;
1388 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1390 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1392 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1394 switch(V_VT(&v)) {
1395 case VT_I4: {
1396 WCHAR buf[14];
1398 wsprintfW(buf, px_formatW, V_I4(&v));
1399 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1401 case VT_BSTR:
1402 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1403 default:
1404 FIXME("unsupported vt=%d\n", V_VT(&v));
1407 return E_NOTIMPL;
1410 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1412 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1413 BSTR ret;
1414 HRESULT hres;
1416 TRACE("(%p)->(%p)\n", This, p);
1418 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1419 if(FAILED(hres))
1420 return hres;
1422 V_VT(p) = VT_BSTR;
1423 V_BSTR(p) = ret;
1424 return S_OK;
1427 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1429 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1431 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1433 return set_style_attr(This, STYLEID_PADDING, v, 0);
1436 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1438 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1440 TRACE("(%p)->(%p)\n", This, p);
1442 return get_style_attr(This, STYLEID_PADDING, p);
1445 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1447 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1449 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1451 return set_style_attr(This, STYLEID_BORDER, v, 0);
1454 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1456 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1458 TRACE("(%p)->(%p)\n", This, p);
1460 return get_style_attr(This, STYLEID_BORDER, p);
1463 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1465 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1466 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1467 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1470 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1472 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1473 TRACE("(%p)->(%p)\n", This, p);
1474 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1477 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1479 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1480 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1481 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1484 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1486 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1487 TRACE("(%p)->(%p)\n", This, p);
1488 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1491 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1493 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1494 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1495 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1498 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1500 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1501 TRACE("(%p)->(%p)\n", This, p);
1502 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1505 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1507 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1509 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1511 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1514 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1516 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1518 TRACE("(%p)->(%p)\n", This, p);
1520 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1523 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1525 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1527 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1529 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1532 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1534 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1536 TRACE("(%p)->(%p)\n", This, p);
1538 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1541 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1543 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1545 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1547 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1550 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1552 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1554 TRACE("(%p)->(%p)\n", This, p);
1556 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1559 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1561 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1563 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1565 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1568 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1570 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1572 TRACE("(%p)->(%p)\n", This, p);
1574 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1577 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1579 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1581 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1583 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1586 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1588 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1590 TRACE("(%p)->(%p)\n", This, p);
1592 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1595 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1597 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1599 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1601 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1604 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1606 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1608 TRACE("(%p)->(%p)\n", This, p);
1610 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1613 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1615 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1616 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1617 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1620 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1622 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1623 TRACE("(%p)->(%p)\n", This, p);
1624 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1627 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1629 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1630 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1631 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1634 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1636 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1638 TRACE("(%p)->(%p)\n", This, p);
1640 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1643 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1645 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1646 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1647 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1650 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1652 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1653 TRACE("(%p)->(%p)\n", This, p);
1654 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1657 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1659 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1661 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1662 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1665 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1667 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1668 TRACE("(%p)->(%p)\n", This, p);
1669 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1672 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1674 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1675 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1676 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1679 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1681 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1682 TRACE("(%p)->(%p)\n", This, p);
1683 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1686 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1688 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1689 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1690 HRESULT hres = S_OK;
1691 BSTR pstyle;
1692 int i=0;
1693 int last = 0;
1695 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1697 while(v[i] && hres == S_OK)
1699 if(v[i] == (WCHAR)' ')
1701 pstyle = SysAllocStringLen(&v[last], (i-last));
1702 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1704 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1705 hres = E_INVALIDARG;
1707 SysFreeString(pstyle);
1708 last = i+1;
1710 i++;
1713 if(hres == S_OK)
1715 pstyle = SysAllocStringLen(&v[last], i-last);
1716 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1718 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1719 hres = E_INVALIDARG;
1721 SysFreeString(pstyle);
1724 if(hres == S_OK)
1725 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1727 return hres;
1730 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1732 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1733 TRACE("(%p)->(%p)\n", This, p);
1734 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1737 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1739 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1740 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1742 if(!is_valid_border_style(v))
1743 return E_INVALIDARG;
1745 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1748 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1750 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1751 TRACE("(%p)->(%p)\n", This, p);
1752 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1755 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1757 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1758 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1760 if(!is_valid_border_style(v))
1761 return E_INVALIDARG;
1763 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1766 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1768 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1769 TRACE("(%p)->(%p)\n", This, p);
1770 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1773 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1775 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1776 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1778 if(!is_valid_border_style(v))
1779 return E_INVALIDARG;
1781 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1784 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1786 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1787 TRACE("(%p)->(%p)\n", This, p);
1788 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1791 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1793 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1794 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1796 if(!is_valid_border_style(v))
1797 return E_INVALIDARG;
1799 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1802 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1804 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1805 TRACE("(%p)->(%p)\n", This, p);
1806 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
1809 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
1811 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1813 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1815 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
1818 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
1820 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1822 TRACE("(%p)->(%p)\n", This, p);
1824 V_VT(p) = VT_BSTR;
1825 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
1828 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
1830 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1832 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1834 switch(V_VT(&v)) {
1835 case VT_BSTR:
1836 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
1837 default:
1838 FIXME("unimplemented vt %d\n", V_VT(&v));
1839 return E_NOTIMPL;
1842 return S_OK;
1845 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
1847 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1848 BSTR ret;
1849 HRESULT hres;
1851 TRACE("(%p)->(%p)\n", This, p);
1853 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
1854 if(FAILED(hres))
1855 return hres;
1857 V_VT(p) = VT_BSTR;
1858 V_BSTR(p) = ret;
1859 return S_OK;
1862 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
1864 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1865 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1866 return E_NOTIMPL;
1869 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
1871 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1872 FIXME("(%p)->(%p)\n", This, p);
1873 return E_NOTIMPL;
1876 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
1878 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1879 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1880 return E_NOTIMPL;
1883 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
1885 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1886 FIXME("(%p)->(%p)\n", This, p);
1887 return E_NOTIMPL;
1890 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
1892 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1894 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1896 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
1899 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
1901 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1903 TRACE("(%p)->(%p)\n", This, p);
1905 return get_style_attr(This, STYLEID_DISPLAY, p);
1908 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
1910 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1912 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1914 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
1917 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
1919 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1921 TRACE("(%p)->(%p)\n", This, p);
1923 return get_style_attr(This, STYLEID_VISIBILITY, p);
1926 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
1928 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1929 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1930 return E_NOTIMPL;
1933 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
1935 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1936 FIXME("(%p)->(%p)\n", This, p);
1937 return E_NOTIMPL;
1940 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
1942 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1943 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1944 return E_NOTIMPL;
1947 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
1949 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1950 FIXME("(%p)->(%p)\n", This, p);
1951 return E_NOTIMPL;
1954 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
1956 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1957 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1958 return E_NOTIMPL;
1961 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
1963 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1964 FIXME("(%p)->(%p)\n", This, p);
1965 return E_NOTIMPL;
1968 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
1970 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1971 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1972 return E_NOTIMPL;
1975 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
1977 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1978 FIXME("(%p)->(%p)\n", This, p);
1979 return E_NOTIMPL;
1982 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
1984 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1985 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1986 return E_NOTIMPL;
1989 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
1991 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1992 FIXME("(%p)->(%p)\n", This, p);
1993 return E_NOTIMPL;
1996 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
1998 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2000 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2002 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2005 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2007 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2008 BSTR ret;
2009 HRESULT hres;
2011 TRACE("(%p)->(%p)\n", This, p);
2013 hres = get_style_attr(This, STYLEID_TOP, &ret);
2014 if(FAILED(hres))
2015 return hres;
2017 V_VT(p) = VT_BSTR;
2018 V_BSTR(p) = ret;
2019 return S_OK;
2022 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2026 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2028 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2031 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2033 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2034 BSTR ret;
2035 HRESULT hres;
2037 TRACE("(%p)->(%p)\n", This, p);
2039 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2040 if(FAILED(hres))
2041 return hres;
2043 V_VT(p) = VT_BSTR;
2044 V_BSTR(p) = ret;
2045 return S_OK;
2048 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2050 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2051 TRACE("(%p)->(%p)\n", This, p);
2052 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2055 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2057 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2059 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2061 switch(V_VT(&v)) {
2062 case VT_BSTR:
2063 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2064 case VT_I4: {
2065 WCHAR value[14];
2066 static const WCHAR format[] = {'%','d',0};
2068 wsprintfW(value, format, V_I4(&v));
2069 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2071 default:
2072 FIXME("unimplemented vt %d\n", V_VT(&v));
2073 return E_NOTIMPL;
2076 return S_OK;
2079 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2081 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2083 TRACE("(%p)->(%p)\n", This, p);
2085 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2088 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2090 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2091 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2092 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2093 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2094 static const WCHAR szAuto[] = {'a','u','t','o',0};
2096 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2098 /* overflow can only be one of the follow values. */
2099 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2100 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2102 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2105 return E_INVALIDARG;
2109 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2111 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2113 TRACE("(%p)->(%p)\n", This, p);
2115 if(!p)
2116 return E_INVALIDARG;
2118 return get_style_attr(This, STYLEID_OVERFLOW, p);
2121 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2123 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2124 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2125 return E_NOTIMPL;
2128 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2130 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2131 FIXME("(%p)->(%p)\n", This, p);
2132 return E_NOTIMPL;
2135 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2137 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2138 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2139 return E_NOTIMPL;
2142 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2144 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2145 FIXME("(%p)->(%p)\n", This, p);
2146 return E_NOTIMPL;
2149 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2151 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2152 nsAString text_str;
2153 nsresult nsres;
2155 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2157 nsAString_InitDepend(&text_str, v);
2158 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2159 nsAString_Finish(&text_str);
2160 if(NS_FAILED(nsres)) {
2161 FIXME("SetCssStyle failed: %08x\n", nsres);
2162 return E_FAIL;
2165 return S_OK;
2168 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2170 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2171 nsAString text_str;
2172 nsresult nsres;
2174 TRACE("(%p)->(%p)\n", This, p);
2176 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2177 nsAString_Init(&text_str, NULL);
2178 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2179 if(NS_SUCCEEDED(nsres)) {
2180 const PRUnichar *text;
2182 nsAString_GetData(&text_str, &text);
2183 *p = *text ? SysAllocString(text) : NULL;
2184 }else {
2185 FIXME("GetCssStyle failed: %08x\n", nsres);
2186 *p = NULL;
2189 nsAString_Finish(&text_str);
2190 return S_OK;
2193 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2195 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2196 FIXME("(%p)->()\n", This);
2197 return E_NOTIMPL;
2200 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2202 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2203 FIXME("(%p)->()\n", This);
2204 return E_NOTIMPL;
2207 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2209 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2210 FIXME("(%p)->()\n", This);
2211 return E_NOTIMPL;
2214 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2216 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2217 FIXME("(%p)->()\n", This);
2218 return E_NOTIMPL;
2221 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2223 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2224 FIXME("(%p)->()\n", This);
2225 return E_NOTIMPL;
2228 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2230 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2231 FIXME("(%p)->()\n", This);
2232 return E_NOTIMPL;
2235 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2237 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2238 FIXME("(%p)->()\n", This);
2239 return E_NOTIMPL;
2242 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2244 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2245 FIXME("(%p)->()\n", This);
2246 return E_NOTIMPL;
2249 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2251 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2253 TRACE("(%p)->(%f)\n", This, v);
2255 return set_style_pos(This, STYLEID_TOP, v);
2258 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2260 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2262 TRACE("(%p)->(%p)\n", This, p);
2264 if(!p)
2265 return E_POINTER;
2267 return get_nsstyle_pos(This, STYLEID_TOP, p);
2270 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2272 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2274 TRACE("(%p)->(%f)\n", This, v);
2276 return set_style_pos(This, STYLEID_LEFT, v);
2279 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2281 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2283 TRACE("(%p)->(%p)\n", This, p);
2285 if(!p)
2286 return E_POINTER;
2288 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2291 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2293 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2295 TRACE("(%p)->(%f)\n", This, v);
2297 return set_style_pos(This, STYLEID_WIDTH, v);
2300 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2302 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2304 TRACE("(%p)->(%p)\n", This, p);
2306 if(!p)
2307 return E_POINTER;
2309 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2310 *p = 0.0f;
2312 return S_OK;
2315 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2317 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2319 TRACE("(%p)->(%f)\n", This, v);
2321 return set_style_pos(This, STYLEID_HEIGHT, v);
2324 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2326 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2328 TRACE("(%p)->(%p)\n", This, p);
2330 if(!p)
2331 return E_POINTER;
2333 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2334 *p = 0.0f;
2336 return S_OK;
2339 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2341 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2343 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2345 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2348 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2350 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2352 TRACE("(%p)->(%p)\n", This, p);
2354 return get_style_attr(This, STYLEID_CURSOR, p);
2357 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2359 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2360 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2361 return E_NOTIMPL;
2364 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2366 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2367 FIXME("(%p)->(%p)\n", This, p);
2368 return E_NOTIMPL;
2371 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2373 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2375 WARN("(%p)->(%s)\n", This, debugstr_w(v));
2377 /* FIXME: Handle MS-style filters */
2378 return set_style_attr(This, STYLEID_FILTER, v, 0);
2381 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2383 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2385 WARN("(%p)->(%p)\n", This, p);
2387 /* FIXME: Handle MS-style filters */
2388 return get_style_attr(This, STYLEID_FILTER, p);
2391 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2392 VARIANT AttributeValue, LONG lFlags)
2394 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2395 HRESULT hres;
2396 DISPID dispid;
2398 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2399 V_VT(&AttributeValue), lFlags);
2401 if(!strAttributeName)
2402 return E_INVALIDARG;
2404 if(lFlags == 1)
2405 FIXME("Parameter lFlags ignored\n");
2407 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2408 LOCALE_USER_DEFAULT, &dispid);
2409 if(hres == S_OK)
2411 VARIANT ret;
2412 DISPID dispidNamed = DISPID_PROPERTYPUT;
2413 DISPPARAMS params;
2415 params.cArgs = 1;
2416 params.rgvarg = &AttributeValue;
2417 params.cNamedArgs = 1;
2418 params.rgdispidNamedArgs = &dispidNamed;
2420 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2421 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2423 else
2425 FIXME("Custom attributes not supported.\n");
2428 TRACE("ret: %08x\n", hres);
2430 return hres;
2433 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2434 LONG lFlags, VARIANT *AttributeValue)
2436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2437 HRESULT hres;
2438 DISPID dispid;
2440 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2441 AttributeValue, lFlags);
2443 if(!AttributeValue || !strAttributeName)
2444 return E_INVALIDARG;
2446 if(lFlags == 1)
2447 FIXME("Parameter lFlags ignored\n");
2449 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2450 LOCALE_USER_DEFAULT, &dispid);
2451 if(hres == S_OK)
2453 DISPPARAMS params = {NULL, NULL, 0, 0 };
2455 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2456 DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2458 else
2460 FIXME("Custom attributes not supported.\n");
2463 return hres;
2466 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2467 LONG lFlags, VARIANT_BOOL *pfSuccess)
2469 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2470 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2471 lFlags, pfSuccess);
2472 return E_NOTIMPL;
2475 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2477 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2478 FIXME("(%p)->(%p)\n", This, String);
2479 return E_NOTIMPL;
2482 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2483 HTMLStyle_QueryInterface,
2484 HTMLStyle_AddRef,
2485 HTMLStyle_Release,
2486 HTMLStyle_GetTypeInfoCount,
2487 HTMLStyle_GetTypeInfo,
2488 HTMLStyle_GetIDsOfNames,
2489 HTMLStyle_Invoke,
2490 HTMLStyle_put_fontFamily,
2491 HTMLStyle_get_fontFamily,
2492 HTMLStyle_put_fontStyle,
2493 HTMLStyle_get_fontStyle,
2494 HTMLStyle_put_fontVariant,
2495 HTMLStyle_get_fontVariant,
2496 HTMLStyle_put_fontWeight,
2497 HTMLStyle_get_fontWeight,
2498 HTMLStyle_put_fontSize,
2499 HTMLStyle_get_fontSize,
2500 HTMLStyle_put_font,
2501 HTMLStyle_get_font,
2502 HTMLStyle_put_color,
2503 HTMLStyle_get_color,
2504 HTMLStyle_put_background,
2505 HTMLStyle_get_background,
2506 HTMLStyle_put_backgroundColor,
2507 HTMLStyle_get_backgroundColor,
2508 HTMLStyle_put_backgroundImage,
2509 HTMLStyle_get_backgroundImage,
2510 HTMLStyle_put_backgroundRepeat,
2511 HTMLStyle_get_backgroundRepeat,
2512 HTMLStyle_put_backgroundAttachment,
2513 HTMLStyle_get_backgroundAttachment,
2514 HTMLStyle_put_backgroundPosition,
2515 HTMLStyle_get_backgroundPosition,
2516 HTMLStyle_put_backgroundPositionX,
2517 HTMLStyle_get_backgroundPositionX,
2518 HTMLStyle_put_backgroundPositionY,
2519 HTMLStyle_get_backgroundPositionY,
2520 HTMLStyle_put_wordSpacing,
2521 HTMLStyle_get_wordSpacing,
2522 HTMLStyle_put_letterSpacing,
2523 HTMLStyle_get_letterSpacing,
2524 HTMLStyle_put_textDecoration,
2525 HTMLStyle_get_textDecoration,
2526 HTMLStyle_put_textDecorationNone,
2527 HTMLStyle_get_textDecorationNone,
2528 HTMLStyle_put_textDecorationUnderline,
2529 HTMLStyle_get_textDecorationUnderline,
2530 HTMLStyle_put_textDecorationOverline,
2531 HTMLStyle_get_textDecorationOverline,
2532 HTMLStyle_put_textDecorationLineThrough,
2533 HTMLStyle_get_textDecorationLineThrough,
2534 HTMLStyle_put_textDecorationBlink,
2535 HTMLStyle_get_textDecorationBlink,
2536 HTMLStyle_put_verticalAlign,
2537 HTMLStyle_get_verticalAlign,
2538 HTMLStyle_put_textTransform,
2539 HTMLStyle_get_textTransform,
2540 HTMLStyle_put_textAlign,
2541 HTMLStyle_get_textAlign,
2542 HTMLStyle_put_textIndent,
2543 HTMLStyle_get_textIndent,
2544 HTMLStyle_put_lineHeight,
2545 HTMLStyle_get_lineHeight,
2546 HTMLStyle_put_marginTop,
2547 HTMLStyle_get_marginTop,
2548 HTMLStyle_put_marginRight,
2549 HTMLStyle_get_marginRight,
2550 HTMLStyle_put_marginBottom,
2551 HTMLStyle_get_marginBottom,
2552 HTMLStyle_put_marginLeft,
2553 HTMLStyle_get_marginLeft,
2554 HTMLStyle_put_margin,
2555 HTMLStyle_get_margin,
2556 HTMLStyle_put_paddingTop,
2557 HTMLStyle_get_paddingTop,
2558 HTMLStyle_put_paddingRight,
2559 HTMLStyle_get_paddingRight,
2560 HTMLStyle_put_paddingBottom,
2561 HTMLStyle_get_paddingBottom,
2562 HTMLStyle_put_paddingLeft,
2563 HTMLStyle_get_paddingLeft,
2564 HTMLStyle_put_padding,
2565 HTMLStyle_get_padding,
2566 HTMLStyle_put_border,
2567 HTMLStyle_get_border,
2568 HTMLStyle_put_borderTop,
2569 HTMLStyle_get_borderTop,
2570 HTMLStyle_put_borderRight,
2571 HTMLStyle_get_borderRight,
2572 HTMLStyle_put_borderBottom,
2573 HTMLStyle_get_borderBottom,
2574 HTMLStyle_put_borderLeft,
2575 HTMLStyle_get_borderLeft,
2576 HTMLStyle_put_borderColor,
2577 HTMLStyle_get_borderColor,
2578 HTMLStyle_put_borderTopColor,
2579 HTMLStyle_get_borderTopColor,
2580 HTMLStyle_put_borderRightColor,
2581 HTMLStyle_get_borderRightColor,
2582 HTMLStyle_put_borderBottomColor,
2583 HTMLStyle_get_borderBottomColor,
2584 HTMLStyle_put_borderLeftColor,
2585 HTMLStyle_get_borderLeftColor,
2586 HTMLStyle_put_borderWidth,
2587 HTMLStyle_get_borderWidth,
2588 HTMLStyle_put_borderTopWidth,
2589 HTMLStyle_get_borderTopWidth,
2590 HTMLStyle_put_borderRightWidth,
2591 HTMLStyle_get_borderRightWidth,
2592 HTMLStyle_put_borderBottomWidth,
2593 HTMLStyle_get_borderBottomWidth,
2594 HTMLStyle_put_borderLeftWidth,
2595 HTMLStyle_get_borderLeftWidth,
2596 HTMLStyle_put_borderStyle,
2597 HTMLStyle_get_borderStyle,
2598 HTMLStyle_put_borderTopStyle,
2599 HTMLStyle_get_borderTopStyle,
2600 HTMLStyle_put_borderRightStyle,
2601 HTMLStyle_get_borderRightStyle,
2602 HTMLStyle_put_borderBottomStyle,
2603 HTMLStyle_get_borderBottomStyle,
2604 HTMLStyle_put_borderLeftStyle,
2605 HTMLStyle_get_borderLeftStyle,
2606 HTMLStyle_put_width,
2607 HTMLStyle_get_width,
2608 HTMLStyle_put_height,
2609 HTMLStyle_get_height,
2610 HTMLStyle_put_styleFloat,
2611 HTMLStyle_get_styleFloat,
2612 HTMLStyle_put_clear,
2613 HTMLStyle_get_clear,
2614 HTMLStyle_put_display,
2615 HTMLStyle_get_display,
2616 HTMLStyle_put_visibility,
2617 HTMLStyle_get_visibility,
2618 HTMLStyle_put_listStyleType,
2619 HTMLStyle_get_listStyleType,
2620 HTMLStyle_put_listStylePosition,
2621 HTMLStyle_get_listStylePosition,
2622 HTMLStyle_put_listStyleImage,
2623 HTMLStyle_get_listStyleImage,
2624 HTMLStyle_put_listStyle,
2625 HTMLStyle_get_listStyle,
2626 HTMLStyle_put_whiteSpace,
2627 HTMLStyle_get_whiteSpace,
2628 HTMLStyle_put_top,
2629 HTMLStyle_get_top,
2630 HTMLStyle_put_left,
2631 HTMLStyle_get_left,
2632 HTMLStyle_get_position,
2633 HTMLStyle_put_zIndex,
2634 HTMLStyle_get_zIndex,
2635 HTMLStyle_put_overflow,
2636 HTMLStyle_get_overflow,
2637 HTMLStyle_put_pageBreakBefore,
2638 HTMLStyle_get_pageBreakBefore,
2639 HTMLStyle_put_pageBreakAfter,
2640 HTMLStyle_get_pageBreakAfter,
2641 HTMLStyle_put_cssText,
2642 HTMLStyle_get_cssText,
2643 HTMLStyle_put_pixelTop,
2644 HTMLStyle_get_pixelTop,
2645 HTMLStyle_put_pixelLeft,
2646 HTMLStyle_get_pixelLeft,
2647 HTMLStyle_put_pixelWidth,
2648 HTMLStyle_get_pixelWidth,
2649 HTMLStyle_put_pixelHeight,
2650 HTMLStyle_get_pixelHeight,
2651 HTMLStyle_put_posTop,
2652 HTMLStyle_get_posTop,
2653 HTMLStyle_put_posLeft,
2654 HTMLStyle_get_posLeft,
2655 HTMLStyle_put_posWidth,
2656 HTMLStyle_get_posWidth,
2657 HTMLStyle_put_posHeight,
2658 HTMLStyle_get_posHeight,
2659 HTMLStyle_put_cursor,
2660 HTMLStyle_get_cursor,
2661 HTMLStyle_put_clip,
2662 HTMLStyle_get_clip,
2663 HTMLStyle_put_filter,
2664 HTMLStyle_get_filter,
2665 HTMLStyle_setAttribute,
2666 HTMLStyle_getAttribute,
2667 HTMLStyle_removeAttribute,
2668 HTMLStyle_toString
2671 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
2673 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2675 while(min <= max) {
2676 i = (min+max)/2;
2678 c = strcmpW(style_tbl[i].name, name);
2679 if(!c) {
2680 *dispid = style_tbl[i].dispid;
2681 return S_OK;
2684 if(c > 0)
2685 max = i-1;
2686 else
2687 min = i+1;
2690 return DISP_E_UNKNOWNNAME;
2693 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
2694 NULL,
2695 HTMLStyle_get_dispid,
2696 NULL
2699 static const tid_t HTMLStyle_iface_tids[] = {
2700 IHTMLStyle_tid,
2701 IHTMLStyle2_tid,
2702 IHTMLStyle3_tid,
2703 IHTMLStyle4_tid,
2706 static dispex_static_data_t HTMLStyle_dispex = {
2707 &HTMLStyle_dispex_vtbl,
2708 DispHTMLStyle_tid,
2709 NULL,
2710 HTMLStyle_iface_tids
2713 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
2715 HTMLStyle *ret = heap_alloc_zero(sizeof(HTMLStyle));
2717 ret->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
2718 ret->ref = 1;
2719 ret->nsstyle = nsstyle;
2720 HTMLStyle2_Init(ret);
2721 HTMLStyle3_Init(ret);
2723 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
2725 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyle_iface, &HTMLStyle_dispex);
2727 return &ret->IHTMLStyle_iface;