mshtml: Pass DispatchEx pointer instead of outer IUnknown to DispatchEx's vtbl functions.
[wine.git] / dlls / mshtml / htmlstyle.c
blob99611ed5e190c0fbe2223009155e2817fa216cad
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};
355 wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
356 return set_nsstyle_attr(nsstyle, sid, str, flags & ~ATTR_FIX_PX);
358 default:
359 FIXME("not implemented vt %d\n", V_VT(value));
360 return E_NOTIMPL;
364 return S_OK;
367 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
369 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
372 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
374 nsAString str_name;
375 nsresult nsres;
377 nsAString_InitDepend(&str_name, style_tbl[sid].name);
379 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
380 if(NS_FAILED(nsres)) {
381 ERR("SetProperty failed: %08x\n", nsres);
382 return E_FAIL;
385 nsAString_Finish(&str_name);
387 return NS_OK;
390 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
392 nsAString str_value;
393 const PRUnichar *value;
395 nsAString_Init(&str_value, NULL);
397 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
399 nsAString_GetData(&str_value, &value);
400 *p = *value ? SysAllocString(value) : NULL;
402 nsAString_Finish(&str_value);
404 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
405 return S_OK;
408 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
410 nsAString str_value;
411 const PRUnichar *value;
412 BOOL set = FALSE;
414 nsAString_Init(&str_value, NULL);
416 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
418 nsAString_GetData(&str_value, &value);
420 if(flags & ATTR_STR_TO_INT) {
421 const PRUnichar *ptr = value;
422 BOOL neg = FALSE;
423 INT i = 0;
425 if(*ptr == '-') {
426 neg = TRUE;
427 ptr++;
430 while(isdigitW(*ptr))
431 i = i*10 + (*ptr++ - '0');
433 if(!*ptr) {
434 V_VT(p) = VT_I4;
435 V_I4(p) = neg ? -i : i;
436 set = TRUE;
440 if(!set) {
441 BSTR str = NULL;
443 if(*value) {
444 str = SysAllocString(value);
445 if(!str)
446 return E_OUTOFMEMORY;
449 V_VT(p) = VT_BSTR;
450 V_BSTR(p) = str;
453 nsAString_Finish(&str_value);
455 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
456 return S_OK;
459 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
461 return get_nsstyle_attr(This->nsstyle, sid, p);
464 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
466 nsAString str_value;
467 const PRUnichar *value;
469 nsAString_Init(&str_value, NULL);
471 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
473 nsAString_GetData(&str_value, &value);
474 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
475 nsAString_Finish(&str_value);
477 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
478 return S_OK;
481 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
483 WCHAR szValue[25];
484 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
486 value = floor(value);
488 sprintfW(szValue, szFormat, value);
490 return set_style_attr(This, sid, szValue, 0);
493 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
495 nsAString str_value;
496 HRESULT hres;
497 WCHAR pxW[] = {'p','x',0};
499 TRACE("%p %d %p\n", This, sid, p);
501 *p = 0.0f;
503 nsAString_Init(&str_value, NULL);
505 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
506 if(hres == S_OK)
508 WCHAR *ptr;
509 const PRUnichar *value;
511 nsAString_GetData(&str_value, &value);
512 if(value)
514 *p = strtolW(value, &ptr, 10);
516 if(*ptr && strcmpW(ptr, pxW))
518 nsAString_Finish(&str_value);
519 FIXME("only px values are currently supported\n");
520 return E_FAIL;
525 TRACE("ret %f\n", *p);
527 nsAString_Finish(&str_value);
529 return hres;
532 static BOOL is_valid_border_style(BSTR v)
534 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
535 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
536 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
537 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
538 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
539 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
540 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
541 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
543 TRACE("%s\n", debugstr_w(v));
545 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
546 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
547 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
548 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
549 strcmpiW(v, styleOutset) == 0 )
551 return TRUE;
554 return FALSE;
557 #define HTMLSTYLE_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle, iface)
559 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
561 HTMLStyle *This = HTMLSTYLE_THIS(iface);
563 *ppv = NULL;
565 if(IsEqualGUID(&IID_IUnknown, riid)) {
566 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
567 *ppv = HTMLSTYLE(This);
568 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
569 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
570 *ppv = HTMLSTYLE(This);
571 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
572 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
573 *ppv = HTMLSTYLE2(This);
574 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
575 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
576 *ppv = HTMLSTYLE3(This);
577 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
578 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
579 *ppv = HTMLSTYLE4(This);
580 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
581 return *ppv ? S_OK : E_NOINTERFACE;
584 if(*ppv) {
585 IUnknown_AddRef((IUnknown*)*ppv);
586 return S_OK;
589 WARN("unsupported %s\n", debugstr_guid(riid));
590 return E_NOINTERFACE;
593 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
595 HTMLStyle *This = HTMLSTYLE_THIS(iface);
596 LONG ref = InterlockedIncrement(&This->ref);
598 TRACE("(%p) ref=%d\n", This, ref);
600 return ref;
603 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
605 HTMLStyle *This = HTMLSTYLE_THIS(iface);
606 LONG ref = InterlockedDecrement(&This->ref);
608 TRACE("(%p) ref=%d\n", This, ref);
610 if(!ref) {
611 if(This->nsstyle)
612 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
613 release_dispex(&This->dispex);
614 heap_free(This);
617 return ref;
620 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
622 HTMLStyle *This = HTMLSTYLE_THIS(iface);
623 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
626 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
627 LCID lcid, ITypeInfo **ppTInfo)
629 HTMLStyle *This = HTMLSTYLE_THIS(iface);
630 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
633 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
634 LPOLESTR *rgszNames, UINT cNames,
635 LCID lcid, DISPID *rgDispId)
637 HTMLStyle *This = HTMLSTYLE_THIS(iface);
638 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
641 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
642 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
643 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
645 HTMLStyle *This = HTMLSTYLE_THIS(iface);
646 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
647 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
650 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
652 HTMLStyle *This = HTMLSTYLE_THIS(iface);
654 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
656 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
659 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
661 HTMLStyle *This = HTMLSTYLE_THIS(iface);
663 TRACE("(%p)->(%p)\n", This, p);
665 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
668 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
670 HTMLStyle *This = HTMLSTYLE_THIS(iface);
671 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
672 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
674 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
676 /* fontStyle can only be one of the follow values. */
677 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
678 strcmpiW(szOblique, v) == 0)
680 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
683 return E_INVALIDARG;
686 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
688 HTMLStyle *This = HTMLSTYLE_THIS(iface);
690 TRACE("(%p)->(%p)\n", This, p);
692 return get_style_attr(This, STYLEID_FONT_STYLE, p);
695 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
697 HTMLStyle *This = HTMLSTYLE_THIS(iface);
698 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
700 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
702 /* fontVariant can only be one of the follow values. */
703 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
705 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
708 return E_INVALIDARG;
711 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
713 HTMLStyle *This = HTMLSTYLE_THIS(iface);
714 TRACE("(%p)->(%p)\n", This, p);
716 if(!p)
717 return E_INVALIDARG;
719 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
722 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
724 HTMLStyle *This = HTMLSTYLE_THIS(iface);
725 static const WCHAR styleBold[] = {'b','o','l','d',0};
726 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
727 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
728 static const WCHAR style100[] = {'1','0','0',0};
729 static const WCHAR style200[] = {'2','0','0',0};
730 static const WCHAR style300[] = {'3','0','0',0};
731 static const WCHAR style400[] = {'4','0','0',0};
732 static const WCHAR style500[] = {'5','0','0',0};
733 static const WCHAR style600[] = {'6','0','0',0};
734 static const WCHAR style700[] = {'7','0','0',0};
735 static const WCHAR style800[] = {'8','0','0',0};
736 static const WCHAR style900[] = {'9','0','0',0};
738 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
740 /* fontWeight can only be one of the following */
741 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
742 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
743 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
744 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
745 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
746 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
747 strcmpiW(style900, v) == 0
750 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
753 return E_INVALIDARG;
756 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
758 HTMLStyle *This = HTMLSTYLE_THIS(iface);
760 TRACE("(%p)->(%p)\n", This, p);
762 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
765 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
767 HTMLStyle *This = HTMLSTYLE_THIS(iface);
769 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
771 switch(V_VT(&v)) {
772 case VT_BSTR:
773 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
774 default:
775 FIXME("not supported vt %d\n", V_VT(&v));
778 return S_OK;
781 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
783 HTMLStyle *This = HTMLSTYLE_THIS(iface);
785 TRACE("(%p)->(%p)\n", This, p);
787 V_VT(p) = VT_BSTR;
788 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
791 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
793 HTMLStyle *This = HTMLSTYLE_THIS(iface);
794 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
795 return E_NOTIMPL;
798 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
800 HTMLStyle *This = HTMLSTYLE_THIS(iface);
801 FIXME("(%p)->(%p)\n", This, p);
802 return E_NOTIMPL;
805 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
807 HTMLStyle *This = HTMLSTYLE_THIS(iface);
809 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
811 switch(V_VT(&v)) {
812 case VT_BSTR:
813 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
814 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
816 default:
817 FIXME("unsupported vt=%d\n", V_VT(&v));
820 return E_NOTIMPL;
823 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
825 HTMLStyle *This = HTMLSTYLE_THIS(iface);
827 TRACE("(%p)->(%p)\n", This, p);
829 V_VT(p) = VT_BSTR;
830 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
833 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
835 HTMLStyle *This = HTMLSTYLE_THIS(iface);
837 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
839 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
842 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
844 HTMLStyle *This = HTMLSTYLE_THIS(iface);
846 TRACE("(%p)->(%p)\n", This, p);
848 return get_style_attr(This, STYLEID_BACKGROUND, p);
851 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
853 HTMLStyle *This = HTMLSTYLE_THIS(iface);
855 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
857 switch(V_VT(&v)) {
858 case VT_BSTR:
859 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
860 case VT_I4: {
861 WCHAR value[10];
862 static const WCHAR format[] = {'#','%','0','6','x',0};
864 wsprintfW(value, format, V_I4(&v));
865 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
867 default:
868 FIXME("unsupported vt %d\n", V_VT(&v));
871 return S_OK;
874 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
876 HTMLStyle *This = HTMLSTYLE_THIS(iface);
877 TRACE("(%p)->(%p)\n", This, p);
879 V_VT(p) = VT_BSTR;
880 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
883 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
885 HTMLStyle *This = HTMLSTYLE_THIS(iface);
887 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
889 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
892 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
894 HTMLStyle *This = HTMLSTYLE_THIS(iface);
896 TRACE("(%p)->(%p)\n", This, p);
898 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
901 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
903 HTMLStyle *This = HTMLSTYLE_THIS(iface);
904 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
905 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
906 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
907 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
909 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
911 /* fontWeight can only be one of the following */
912 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
913 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
915 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
918 return E_INVALIDARG;
921 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
923 HTMLStyle *This = HTMLSTYLE_THIS(iface);
925 TRACE("(%p)->(%p)\n", This, p);
927 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
930 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
932 HTMLStyle *This = HTMLSTYLE_THIS(iface);
933 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
934 return E_NOTIMPL;
937 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
939 HTMLStyle *This = HTMLSTYLE_THIS(iface);
940 FIXME("(%p)->(%p)\n", This, p);
941 return E_NOTIMPL;
944 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
946 HTMLStyle *This = HTMLSTYLE_THIS(iface);
947 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
948 return E_NOTIMPL;
951 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
953 HTMLStyle *This = HTMLSTYLE_THIS(iface);
954 FIXME("(%p)->(%p)\n", This, p);
955 return E_NOTIMPL;
958 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
960 HTMLStyle *This = HTMLSTYLE_THIS(iface);
961 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
962 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
965 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
967 HTMLStyle *This = HTMLSTYLE_THIS(iface);
968 TRACE("(%p)->(%p)\n", This, p);
969 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
972 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
974 HTMLStyle *This = HTMLSTYLE_THIS(iface);
975 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
976 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, &v, 0);
979 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
981 HTMLStyle *This = HTMLSTYLE_THIS(iface);
982 TRACE("(%p)->(%p)\n", This, p);
983 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_Y, p, 0);
986 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
988 HTMLStyle *This = HTMLSTYLE_THIS(iface);
989 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
990 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
993 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
995 HTMLStyle *This = HTMLSTYLE_THIS(iface);
996 TRACE("(%p)->(%p)\n", This, p);
997 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1000 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1002 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1003 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1004 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1007 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1009 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1010 TRACE("(%p)->(%p)\n", This, p);
1011 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1014 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1016 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1018 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1020 /* textDecoration can only be one of the following */
1021 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1022 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1023 strcmpiW(valBlink, v) == 0)
1025 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1028 return E_INVALIDARG;
1031 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1033 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1035 TRACE("(%p)->(%p)\n", This, p);
1037 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1040 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1042 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1044 TRACE("(%p)->(%x)\n", This, v);
1046 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1049 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1051 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1053 TRACE("(%p)->(%p)\n", This, p);
1055 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1058 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1060 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1062 TRACE("(%p)->(%x)\n", This, v);
1064 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1067 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1069 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1071 TRACE("(%p)->(%p)\n", This, p);
1073 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1076 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1078 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1080 TRACE("(%p)->(%x)\n", This, v);
1082 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1085 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1087 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1089 TRACE("(%p)->(%p)\n", This, p);
1091 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1094 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1096 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1098 TRACE("(%p)->(%x)\n", This, v);
1100 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1103 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1105 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1107 TRACE("(%p)->(%p)\n", This, p);
1109 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1112 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1114 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1116 TRACE("(%p)->(%x)\n", This, v);
1118 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1121 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1123 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1125 TRACE("(%p)->(%p)\n", This, p);
1127 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1130 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1132 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1134 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1136 switch(V_VT(&v)) {
1137 case VT_BSTR:
1138 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1139 default:
1140 FIXME("not implemented vt %d\n", V_VT(&v));
1141 return E_NOTIMPL;
1144 return S_OK;
1147 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1149 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1150 BSTR ret;
1151 HRESULT hres;
1153 TRACE("(%p)->(%p)\n", This, p);
1155 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1156 if(FAILED(hres))
1157 return hres;
1159 V_VT(p) = VT_BSTR;
1160 V_BSTR(p) = ret;
1161 return S_OK;
1164 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1166 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1167 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1168 return E_NOTIMPL;
1171 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1173 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1174 FIXME("(%p)->(%p)\n", This, p);
1175 return E_NOTIMPL;
1178 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1180 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1182 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1184 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1187 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1189 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1191 TRACE("(%p)->(%p)\n", This, p);
1193 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1196 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1198 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1199 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1200 return E_NOTIMPL;
1203 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1205 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1206 FIXME("(%p)->(%p)\n", This, p);
1207 return E_NOTIMPL;
1210 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1212 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1213 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1214 return E_NOTIMPL;
1217 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1219 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1220 FIXME("(%p)->(%p)\n", This, p);
1221 return E_NOTIMPL;
1224 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1226 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1228 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1230 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1233 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1235 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1237 TRACE("(%p)->(%p)\n", This, p);
1239 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1242 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1244 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1246 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1248 switch(V_VT(&v)) {
1249 case VT_NULL:
1250 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1251 case VT_I4: {
1252 WCHAR buf[14];
1254 wsprintfW(buf, px_formatW, V_I4(&v));
1255 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1257 case VT_BSTR:
1258 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1259 default:
1260 FIXME("Unsupported vt=%d\n", V_VT(&v));
1263 return E_NOTIMPL;
1266 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1268 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1269 TRACE("(%p)->(%p)\n", This, p);
1270 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1273 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1275 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1276 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1277 return E_NOTIMPL;
1280 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1282 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1283 FIXME("(%p)->(%p)\n", This, p);
1284 return E_NOTIMPL;
1287 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1289 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1291 switch(V_VT(&v)) {
1292 case VT_NULL:
1293 TRACE("(%p)->(NULL)\n", This);
1294 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1295 case VT_I4: {
1296 WCHAR buf[14];
1298 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1300 wsprintfW(buf, px_formatW, V_I4(&v));
1301 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1303 case VT_BSTR:
1304 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1305 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1306 default:
1307 FIXME("Unsupported vt=%d\n", V_VT(&v));
1310 return E_NOTIMPL;
1313 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1315 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1317 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1319 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1322 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1324 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1326 TRACE("(%p)->(%p)\n", This, p);
1328 return get_style_attr(This, STYLEID_MARGIN, p);
1331 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1333 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1334 TRACE("(%p)->(%p)\n", This, p);
1335 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1338 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1340 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1341 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1342 return E_NOTIMPL;
1345 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1347 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1348 FIXME("(%p)->(%p)\n", This, p);
1349 return E_NOTIMPL;
1352 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1354 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1355 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1356 return E_NOTIMPL;
1359 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1361 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1362 FIXME("(%p)->(%p)\n", This, p);
1363 return E_NOTIMPL;
1366 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1368 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1369 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1370 return E_NOTIMPL;
1373 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1375 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1376 FIXME("(%p)->(%p)\n", This, p);
1377 return E_NOTIMPL;
1380 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1382 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1384 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1386 switch(V_VT(&v)) {
1387 case VT_I4: {
1388 WCHAR buf[14];
1390 wsprintfW(buf, px_formatW, V_I4(&v));
1391 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1393 case VT_BSTR:
1394 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1395 default:
1396 FIXME("unsupported vt=%d\n", V_VT(&v));
1399 return E_NOTIMPL;
1402 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1404 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1405 BSTR ret;
1406 HRESULT hres;
1408 TRACE("(%p)->(%p)\n", This, p);
1410 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1411 if(FAILED(hres))
1412 return hres;
1414 V_VT(p) = VT_BSTR;
1415 V_BSTR(p) = ret;
1416 return S_OK;
1419 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1421 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1423 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1425 return set_style_attr(This, STYLEID_PADDING, v, 0);
1428 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1430 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1432 TRACE("(%p)->(%p)\n", This, p);
1434 return get_style_attr(This, STYLEID_PADDING, p);
1437 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1439 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1441 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1443 return set_style_attr(This, STYLEID_BORDER, v, 0);
1446 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1448 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1450 TRACE("(%p)->(%p)\n", This, p);
1452 return get_style_attr(This, STYLEID_BORDER, p);
1455 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1457 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1458 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1459 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1462 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1464 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1465 TRACE("(%p)->(%p)\n", This, p);
1466 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1469 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1471 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1472 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1473 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1476 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1478 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1479 TRACE("(%p)->(%p)\n", This, p);
1480 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1483 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1485 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1486 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1487 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1490 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1492 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1493 TRACE("(%p)->(%p)\n", This, p);
1494 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1497 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1499 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1501 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1503 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1506 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1508 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1510 TRACE("(%p)->(%p)\n", This, p);
1512 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1515 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1517 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1519 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1521 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1524 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1526 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1528 TRACE("(%p)->(%p)\n", This, p);
1530 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1533 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1535 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1536 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1537 return E_NOTIMPL;
1540 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1542 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1544 TRACE("(%p)->(%p)\n", This, p);
1546 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1549 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1551 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1552 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1553 return E_NOTIMPL;
1556 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1558 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1560 TRACE("(%p)->(%p)\n", This, p);
1562 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1565 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1567 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1568 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1569 return E_NOTIMPL;
1572 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1574 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1576 TRACE("(%p)->(%p)\n", This, p);
1578 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1581 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1583 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1584 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1585 return E_NOTIMPL;
1588 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1590 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1592 TRACE("(%p)->(%p)\n", This, p);
1594 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1597 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1599 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1600 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1601 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1604 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1606 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1607 TRACE("(%p)->(%p)\n", This, p);
1608 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1611 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1613 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1614 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1615 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1618 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1620 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1622 TRACE("(%p)->(%p)\n", This, p);
1624 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1627 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1629 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1630 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1631 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1634 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1636 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1637 TRACE("(%p)->(%p)\n", This, p);
1638 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1641 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1643 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1645 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1646 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1649 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1651 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1652 TRACE("(%p)->(%p)\n", This, p);
1653 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1656 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1658 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1659 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1660 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1663 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1665 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1666 TRACE("(%p)->(%p)\n", This, p);
1667 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1670 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1672 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1673 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1674 HRESULT hres = S_OK;
1675 BSTR pstyle;
1676 int i=0;
1677 int last = 0;
1679 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1681 while(v[i] && hres == S_OK)
1683 if(v[i] == (WCHAR)' ')
1685 pstyle = SysAllocStringLen(&v[last], (i-last));
1686 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1688 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1689 hres = E_INVALIDARG;
1691 SysFreeString(pstyle);
1692 last = i+1;
1694 i++;
1697 if(hres == S_OK)
1699 pstyle = SysAllocStringLen(&v[last], i-last);
1700 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1702 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1703 hres = E_INVALIDARG;
1705 SysFreeString(pstyle);
1708 if(hres == S_OK)
1709 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1711 return hres;
1714 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1716 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1717 TRACE("(%p)->(%p)\n", This, p);
1718 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1721 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1723 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1724 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1726 if(!is_valid_border_style(v))
1727 return E_INVALIDARG;
1729 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1732 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1734 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1735 TRACE("(%p)->(%p)\n", This, p);
1736 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1739 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1741 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1742 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1744 if(!is_valid_border_style(v))
1745 return E_INVALIDARG;
1747 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1750 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1752 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1753 TRACE("(%p)->(%p)\n", This, p);
1754 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1757 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1759 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1760 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1762 if(!is_valid_border_style(v))
1763 return E_INVALIDARG;
1765 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1768 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1770 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1771 TRACE("(%p)->(%p)\n", This, p);
1772 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1775 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1777 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1778 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1780 if(!is_valid_border_style(v))
1781 return E_INVALIDARG;
1783 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1786 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1788 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1789 TRACE("(%p)->(%p)\n", This, p);
1790 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
1793 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
1795 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1797 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1799 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
1802 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
1804 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1806 TRACE("(%p)->(%p)\n", This, p);
1808 V_VT(p) = VT_BSTR;
1809 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
1812 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
1814 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1816 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1818 switch(V_VT(&v)) {
1819 case VT_BSTR:
1820 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
1821 default:
1822 FIXME("unimplemented vt %d\n", V_VT(&v));
1823 return E_NOTIMPL;
1826 return S_OK;
1829 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
1831 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1832 BSTR ret;
1833 HRESULT hres;
1835 TRACE("(%p)->(%p)\n", This, p);
1837 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
1838 if(FAILED(hres))
1839 return hres;
1841 V_VT(p) = VT_BSTR;
1842 V_BSTR(p) = ret;
1843 return S_OK;
1846 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
1848 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1849 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1850 return E_NOTIMPL;
1853 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
1855 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1856 FIXME("(%p)->(%p)\n", This, p);
1857 return E_NOTIMPL;
1860 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
1862 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1863 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1864 return E_NOTIMPL;
1867 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
1869 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1870 FIXME("(%p)->(%p)\n", This, p);
1871 return E_NOTIMPL;
1874 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
1876 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1878 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1880 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
1883 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
1885 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1887 TRACE("(%p)->(%p)\n", This, p);
1889 return get_style_attr(This, STYLEID_DISPLAY, p);
1892 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
1894 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1896 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1898 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
1901 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
1903 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1905 TRACE("(%p)->(%p)\n", This, p);
1907 return get_style_attr(This, STYLEID_VISIBILITY, p);
1910 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
1912 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1913 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1914 return E_NOTIMPL;
1917 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
1919 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1920 FIXME("(%p)->(%p)\n", This, p);
1921 return E_NOTIMPL;
1924 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
1926 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1927 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1928 return E_NOTIMPL;
1931 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
1933 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1934 FIXME("(%p)->(%p)\n", This, p);
1935 return E_NOTIMPL;
1938 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
1940 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1941 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1942 return E_NOTIMPL;
1945 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
1947 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1948 FIXME("(%p)->(%p)\n", This, p);
1949 return E_NOTIMPL;
1952 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
1954 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1955 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1956 return E_NOTIMPL;
1959 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
1961 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1962 FIXME("(%p)->(%p)\n", This, p);
1963 return E_NOTIMPL;
1966 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
1968 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1969 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1970 return E_NOTIMPL;
1973 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
1975 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1976 FIXME("(%p)->(%p)\n", This, p);
1977 return E_NOTIMPL;
1980 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
1982 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1984 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1986 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
1989 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
1991 HTMLStyle *This = HTMLSTYLE_THIS(iface);
1992 BSTR ret;
1993 HRESULT hres;
1995 TRACE("(%p)->(%p)\n", This, p);
1997 hres = get_style_attr(This, STYLEID_TOP, &ret);
1998 if(FAILED(hres))
1999 return hres;
2001 V_VT(p) = VT_BSTR;
2002 V_BSTR(p) = ret;
2003 return S_OK;
2006 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2008 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2010 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2012 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2015 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2017 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2018 BSTR ret;
2019 HRESULT hres;
2021 TRACE("(%p)->(%p)\n", This, p);
2023 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2024 if(FAILED(hres))
2025 return hres;
2027 V_VT(p) = VT_BSTR;
2028 V_BSTR(p) = ret;
2029 return S_OK;
2032 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2034 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2035 TRACE("(%p)->(%p)\n", This, p);
2036 return IHTMLStyle2_get_position(HTMLSTYLE2(This), p);
2039 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2041 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2043 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2045 switch(V_VT(&v)) {
2046 case VT_BSTR:
2047 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2048 case VT_I4: {
2049 WCHAR value[14];
2050 static const WCHAR format[] = {'%','d',0};
2052 wsprintfW(value, format, V_I4(&v));
2053 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2055 default:
2056 FIXME("unimplemented vt %d\n", V_VT(&v));
2057 return E_NOTIMPL;
2060 return S_OK;
2063 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2065 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2067 TRACE("(%p)->(%p)\n", This, p);
2069 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2072 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2074 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2075 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2076 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2077 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2078 static const WCHAR szAuto[] = {'a','u','t','o',0};
2080 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2082 /* overflow can only be one of the follow values. */
2083 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2084 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2086 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2089 return E_INVALIDARG;
2093 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2095 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2097 TRACE("(%p)->(%p)\n", This, p);
2099 if(!p)
2100 return E_INVALIDARG;
2102 return get_style_attr(This, STYLEID_OVERFLOW, p);
2105 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2107 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2108 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2109 return E_NOTIMPL;
2112 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2114 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2115 FIXME("(%p)->(%p)\n", This, p);
2116 return E_NOTIMPL;
2119 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2121 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2122 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2123 return E_NOTIMPL;
2126 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2128 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2129 FIXME("(%p)->(%p)\n", This, p);
2130 return E_NOTIMPL;
2133 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2135 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2136 nsAString text_str;
2137 nsresult nsres;
2139 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2141 nsAString_InitDepend(&text_str, v);
2142 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2143 nsAString_Finish(&text_str);
2144 if(NS_FAILED(nsres)) {
2145 FIXME("SetCssStyle failed: %08x\n", nsres);
2146 return E_FAIL;
2149 return S_OK;
2152 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2154 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2155 nsAString text_str;
2156 nsresult nsres;
2158 TRACE("(%p)->(%p)\n", This, p);
2160 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2161 nsAString_Init(&text_str, NULL);
2162 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2163 if(NS_SUCCEEDED(nsres)) {
2164 const PRUnichar *text;
2166 nsAString_GetData(&text_str, &text);
2167 *p = *text ? SysAllocString(text) : NULL;
2168 }else {
2169 FIXME("GetCssStyle failed: %08x\n", nsres);
2170 *p = NULL;
2173 nsAString_Finish(&text_str);
2174 return S_OK;
2177 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2179 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2180 FIXME("(%p)->()\n", This);
2181 return E_NOTIMPL;
2184 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2186 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2187 FIXME("(%p)->()\n", This);
2188 return E_NOTIMPL;
2191 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2193 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2194 FIXME("(%p)->()\n", This);
2195 return E_NOTIMPL;
2198 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2200 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2201 FIXME("(%p)->()\n", This);
2202 return E_NOTIMPL;
2205 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2207 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2208 FIXME("(%p)->()\n", This);
2209 return E_NOTIMPL;
2212 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2214 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2215 FIXME("(%p)->()\n", This);
2216 return E_NOTIMPL;
2219 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2221 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2222 FIXME("(%p)->()\n", This);
2223 return E_NOTIMPL;
2226 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2228 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2229 FIXME("(%p)->()\n", This);
2230 return E_NOTIMPL;
2233 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2235 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2237 TRACE("(%p)->(%f)\n", This, v);
2239 return set_style_pos(This, STYLEID_TOP, v);
2242 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2244 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2246 TRACE("(%p)->(%p)\n", This, p);
2248 if(!p)
2249 return E_POINTER;
2251 return get_nsstyle_pos(This, STYLEID_TOP, p);
2254 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2256 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2258 TRACE("(%p)->(%f)\n", This, v);
2260 return set_style_pos(This, STYLEID_LEFT, v);
2263 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2265 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2267 TRACE("(%p)->(%p)\n", This, p);
2269 if(!p)
2270 return E_POINTER;
2272 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2275 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2277 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2279 TRACE("(%p)->(%f)\n", This, v);
2281 return set_style_pos(This, STYLEID_WIDTH, v);
2284 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2286 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2288 TRACE("(%p)->(%p)\n", This, p);
2290 if(!p)
2291 return E_POINTER;
2293 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2294 *p = 0.0f;
2296 return S_OK;
2299 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2301 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2303 TRACE("(%p)->(%f)\n", This, v);
2305 return set_style_pos(This, STYLEID_HEIGHT, v);
2308 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2310 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2312 TRACE("(%p)->(%p)\n", This, p);
2314 if(!p)
2315 return E_POINTER;
2317 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2318 *p = 0.0f;
2320 return S_OK;
2323 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2325 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2327 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2329 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2332 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2334 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2336 TRACE("(%p)->(%p)\n", This, p);
2338 return get_style_attr(This, STYLEID_CURSOR, p);
2341 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2343 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2344 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2345 return E_NOTIMPL;
2348 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2350 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2351 FIXME("(%p)->(%p)\n", This, p);
2352 return E_NOTIMPL;
2355 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2357 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2359 WARN("(%p)->(%s)\n", This, debugstr_w(v));
2361 /* FIXME: Handle MS-style filters */
2362 return set_style_attr(This, STYLEID_FILTER, v, 0);
2365 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2367 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2369 WARN("(%p)->(%p)\n", This, p);
2371 /* FIXME: Handle MS-style filters */
2372 return get_style_attr(This, STYLEID_FILTER, p);
2375 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2376 VARIANT AttributeValue, LONG lFlags)
2378 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2379 HRESULT hres;
2380 DISPID dispid;
2382 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2383 V_VT(&AttributeValue), lFlags);
2385 if(!strAttributeName)
2386 return E_INVALIDARG;
2388 if(lFlags == 1)
2389 FIXME("Parameter lFlags ignored\n");
2391 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2392 LOCALE_USER_DEFAULT, &dispid);
2393 if(hres == S_OK)
2395 VARIANT ret;
2396 DISPID dispidNamed = DISPID_PROPERTYPUT;
2397 DISPPARAMS params;
2399 params.cArgs = 1;
2400 params.rgvarg = &AttributeValue;
2401 params.cNamedArgs = 1;
2402 params.rgdispidNamedArgs = &dispidNamed;
2404 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2405 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2407 else
2409 FIXME("Custom attributes not supported.\n");
2412 TRACE("ret: %08x\n", hres);
2414 return hres;
2417 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2418 LONG lFlags, VARIANT *AttributeValue)
2420 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2421 HRESULT hres;
2422 DISPID dispid;
2424 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2425 AttributeValue, lFlags);
2427 if(!AttributeValue || !strAttributeName)
2428 return E_INVALIDARG;
2430 if(lFlags == 1)
2431 FIXME("Parameter lFlags ignored\n");
2433 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2434 LOCALE_USER_DEFAULT, &dispid);
2435 if(hres == S_OK)
2437 DISPPARAMS params = {NULL, NULL, 0, 0 };
2439 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2440 DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2442 else
2444 FIXME("Custom attributes not supported.\n");
2447 return hres;
2450 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2451 LONG lFlags, VARIANT_BOOL *pfSuccess)
2453 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2454 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2455 lFlags, pfSuccess);
2456 return E_NOTIMPL;
2459 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2461 HTMLStyle *This = HTMLSTYLE_THIS(iface);
2462 FIXME("(%p)->(%p)\n", This, String);
2463 return E_NOTIMPL;
2466 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2467 HTMLStyle_QueryInterface,
2468 HTMLStyle_AddRef,
2469 HTMLStyle_Release,
2470 HTMLStyle_GetTypeInfoCount,
2471 HTMLStyle_GetTypeInfo,
2472 HTMLStyle_GetIDsOfNames,
2473 HTMLStyle_Invoke,
2474 HTMLStyle_put_fontFamily,
2475 HTMLStyle_get_fontFamily,
2476 HTMLStyle_put_fontStyle,
2477 HTMLStyle_get_fontStyle,
2478 HTMLStyle_put_fontVariant,
2479 HTMLStyle_get_fontVariant,
2480 HTMLStyle_put_fontWeight,
2481 HTMLStyle_get_fontWeight,
2482 HTMLStyle_put_fontSize,
2483 HTMLStyle_get_fontSize,
2484 HTMLStyle_put_font,
2485 HTMLStyle_get_font,
2486 HTMLStyle_put_color,
2487 HTMLStyle_get_color,
2488 HTMLStyle_put_background,
2489 HTMLStyle_get_background,
2490 HTMLStyle_put_backgroundColor,
2491 HTMLStyle_get_backgroundColor,
2492 HTMLStyle_put_backgroundImage,
2493 HTMLStyle_get_backgroundImage,
2494 HTMLStyle_put_backgroundRepeat,
2495 HTMLStyle_get_backgroundRepeat,
2496 HTMLStyle_put_backgroundAttachment,
2497 HTMLStyle_get_backgroundAttachment,
2498 HTMLStyle_put_backgroundPosition,
2499 HTMLStyle_get_backgroundPosition,
2500 HTMLStyle_put_backgroundPositionX,
2501 HTMLStyle_get_backgroundPositionX,
2502 HTMLStyle_put_backgroundPositionY,
2503 HTMLStyle_get_backgroundPositionY,
2504 HTMLStyle_put_wordSpacing,
2505 HTMLStyle_get_wordSpacing,
2506 HTMLStyle_put_letterSpacing,
2507 HTMLStyle_get_letterSpacing,
2508 HTMLStyle_put_textDecoration,
2509 HTMLStyle_get_textDecoration,
2510 HTMLStyle_put_textDecorationNone,
2511 HTMLStyle_get_textDecorationNone,
2512 HTMLStyle_put_textDecorationUnderline,
2513 HTMLStyle_get_textDecorationUnderline,
2514 HTMLStyle_put_textDecorationOverline,
2515 HTMLStyle_get_textDecorationOverline,
2516 HTMLStyle_put_textDecorationLineThrough,
2517 HTMLStyle_get_textDecorationLineThrough,
2518 HTMLStyle_put_textDecorationBlink,
2519 HTMLStyle_get_textDecorationBlink,
2520 HTMLStyle_put_verticalAlign,
2521 HTMLStyle_get_verticalAlign,
2522 HTMLStyle_put_textTransform,
2523 HTMLStyle_get_textTransform,
2524 HTMLStyle_put_textAlign,
2525 HTMLStyle_get_textAlign,
2526 HTMLStyle_put_textIndent,
2527 HTMLStyle_get_textIndent,
2528 HTMLStyle_put_lineHeight,
2529 HTMLStyle_get_lineHeight,
2530 HTMLStyle_put_marginTop,
2531 HTMLStyle_get_marginTop,
2532 HTMLStyle_put_marginRight,
2533 HTMLStyle_get_marginRight,
2534 HTMLStyle_put_marginBottom,
2535 HTMLStyle_get_marginBottom,
2536 HTMLStyle_put_marginLeft,
2537 HTMLStyle_get_marginLeft,
2538 HTMLStyle_put_margin,
2539 HTMLStyle_get_margin,
2540 HTMLStyle_put_paddingTop,
2541 HTMLStyle_get_paddingTop,
2542 HTMLStyle_put_paddingRight,
2543 HTMLStyle_get_paddingRight,
2544 HTMLStyle_put_paddingBottom,
2545 HTMLStyle_get_paddingBottom,
2546 HTMLStyle_put_paddingLeft,
2547 HTMLStyle_get_paddingLeft,
2548 HTMLStyle_put_padding,
2549 HTMLStyle_get_padding,
2550 HTMLStyle_put_border,
2551 HTMLStyle_get_border,
2552 HTMLStyle_put_borderTop,
2553 HTMLStyle_get_borderTop,
2554 HTMLStyle_put_borderRight,
2555 HTMLStyle_get_borderRight,
2556 HTMLStyle_put_borderBottom,
2557 HTMLStyle_get_borderBottom,
2558 HTMLStyle_put_borderLeft,
2559 HTMLStyle_get_borderLeft,
2560 HTMLStyle_put_borderColor,
2561 HTMLStyle_get_borderColor,
2562 HTMLStyle_put_borderTopColor,
2563 HTMLStyle_get_borderTopColor,
2564 HTMLStyle_put_borderRightColor,
2565 HTMLStyle_get_borderRightColor,
2566 HTMLStyle_put_borderBottomColor,
2567 HTMLStyle_get_borderBottomColor,
2568 HTMLStyle_put_borderLeftColor,
2569 HTMLStyle_get_borderLeftColor,
2570 HTMLStyle_put_borderWidth,
2571 HTMLStyle_get_borderWidth,
2572 HTMLStyle_put_borderTopWidth,
2573 HTMLStyle_get_borderTopWidth,
2574 HTMLStyle_put_borderRightWidth,
2575 HTMLStyle_get_borderRightWidth,
2576 HTMLStyle_put_borderBottomWidth,
2577 HTMLStyle_get_borderBottomWidth,
2578 HTMLStyle_put_borderLeftWidth,
2579 HTMLStyle_get_borderLeftWidth,
2580 HTMLStyle_put_borderStyle,
2581 HTMLStyle_get_borderStyle,
2582 HTMLStyle_put_borderTopStyle,
2583 HTMLStyle_get_borderTopStyle,
2584 HTMLStyle_put_borderRightStyle,
2585 HTMLStyle_get_borderRightStyle,
2586 HTMLStyle_put_borderBottomStyle,
2587 HTMLStyle_get_borderBottomStyle,
2588 HTMLStyle_put_borderLeftStyle,
2589 HTMLStyle_get_borderLeftStyle,
2590 HTMLStyle_put_width,
2591 HTMLStyle_get_width,
2592 HTMLStyle_put_height,
2593 HTMLStyle_get_height,
2594 HTMLStyle_put_styleFloat,
2595 HTMLStyle_get_styleFloat,
2596 HTMLStyle_put_clear,
2597 HTMLStyle_get_clear,
2598 HTMLStyle_put_display,
2599 HTMLStyle_get_display,
2600 HTMLStyle_put_visibility,
2601 HTMLStyle_get_visibility,
2602 HTMLStyle_put_listStyleType,
2603 HTMLStyle_get_listStyleType,
2604 HTMLStyle_put_listStylePosition,
2605 HTMLStyle_get_listStylePosition,
2606 HTMLStyle_put_listStyleImage,
2607 HTMLStyle_get_listStyleImage,
2608 HTMLStyle_put_listStyle,
2609 HTMLStyle_get_listStyle,
2610 HTMLStyle_put_whiteSpace,
2611 HTMLStyle_get_whiteSpace,
2612 HTMLStyle_put_top,
2613 HTMLStyle_get_top,
2614 HTMLStyle_put_left,
2615 HTMLStyle_get_left,
2616 HTMLStyle_get_position,
2617 HTMLStyle_put_zIndex,
2618 HTMLStyle_get_zIndex,
2619 HTMLStyle_put_overflow,
2620 HTMLStyle_get_overflow,
2621 HTMLStyle_put_pageBreakBefore,
2622 HTMLStyle_get_pageBreakBefore,
2623 HTMLStyle_put_pageBreakAfter,
2624 HTMLStyle_get_pageBreakAfter,
2625 HTMLStyle_put_cssText,
2626 HTMLStyle_get_cssText,
2627 HTMLStyle_put_pixelTop,
2628 HTMLStyle_get_pixelTop,
2629 HTMLStyle_put_pixelLeft,
2630 HTMLStyle_get_pixelLeft,
2631 HTMLStyle_put_pixelWidth,
2632 HTMLStyle_get_pixelWidth,
2633 HTMLStyle_put_pixelHeight,
2634 HTMLStyle_get_pixelHeight,
2635 HTMLStyle_put_posTop,
2636 HTMLStyle_get_posTop,
2637 HTMLStyle_put_posLeft,
2638 HTMLStyle_get_posLeft,
2639 HTMLStyle_put_posWidth,
2640 HTMLStyle_get_posWidth,
2641 HTMLStyle_put_posHeight,
2642 HTMLStyle_get_posHeight,
2643 HTMLStyle_put_cursor,
2644 HTMLStyle_get_cursor,
2645 HTMLStyle_put_clip,
2646 HTMLStyle_get_clip,
2647 HTMLStyle_put_filter,
2648 HTMLStyle_get_filter,
2649 HTMLStyle_setAttribute,
2650 HTMLStyle_getAttribute,
2651 HTMLStyle_removeAttribute,
2652 HTMLStyle_toString
2655 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
2657 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2659 while(min <= max) {
2660 i = (min+max)/2;
2662 c = strcmpW(style_tbl[i].name, name);
2663 if(!c) {
2664 *dispid = style_tbl[i].dispid;
2665 return S_OK;
2668 if(c > 0)
2669 max = i-1;
2670 else
2671 min = i+1;
2674 return DISP_E_UNKNOWNNAME;
2677 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
2678 NULL,
2679 HTMLStyle_get_dispid,
2680 NULL
2683 static const tid_t HTMLStyle_iface_tids[] = {
2684 IHTMLStyle_tid,
2685 IHTMLStyle2_tid,
2686 IHTMLStyle3_tid,
2687 IHTMLStyle4_tid,
2690 static dispex_static_data_t HTMLStyle_dispex = {
2691 &HTMLStyle_dispex_vtbl,
2692 DispHTMLStyle_tid,
2693 NULL,
2694 HTMLStyle_iface_tids
2697 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
2699 HTMLStyle *ret = heap_alloc_zero(sizeof(HTMLStyle));
2701 ret->lpHTMLStyleVtbl = &HTMLStyleVtbl;
2702 ret->ref = 1;
2703 ret->nsstyle = nsstyle;
2704 HTMLStyle2_Init(ret);
2705 HTMLStyle3_Init(ret);
2707 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
2709 init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret), &HTMLStyle_dispex);
2711 return HTMLSTYLE(ret);