mshtml: Added IHTMLStyle::clip property implementation.
[wine.git] / dlls / mshtml / htmlstyle.c
blobcd1f6b53e56b79bc8f8fd44f0a3d44f186545e47
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 attrBackgroundPosition[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
46 static const WCHAR attrBackgroundPositionX[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
48 static const WCHAR attrBackgroundPositionY[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
50 static const WCHAR attrBackgroundRepeat[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
52 static const WCHAR attrBorder[] =
53 {'b','o','r','d','e','r',0};
54 static const WCHAR attrBorderBottom[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
56 static const WCHAR attrBorderBottomColor[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
58 static const WCHAR attrBorderBottomStyle[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
60 static const WCHAR attrBorderBottomWidth[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
62 static const WCHAR attrBorderColor[] =
63 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
64 static const WCHAR attrBorderLeft[] =
65 {'b','o','r','d','e','r','-','l','e','f','t',0};
66 static const WCHAR attrBorderLeftColor[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
68 static const WCHAR attrBorderLeftStyle[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
70 static const WCHAR attrBorderLeftWidth[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
72 static const WCHAR attrBorderRight[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
74 static const WCHAR attrBorderRightColor[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
76 static const WCHAR attrBorderRightStyle[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
78 static const WCHAR attrBorderRightWidth[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
80 static const WCHAR attrBorderTop[] =
81 {'b','o','r','d','e','r','-','t','o','p',0};
82 static const WCHAR attrBorderTopColor[] =
83 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
84 static const WCHAR attrBorderStyle[] =
85 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopStyle[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopWidth[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
90 static const WCHAR attrBorderWidth[] =
91 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
92 static const WCHAR attrBottom[] =
93 {'b','o','t','t','o','m',0};
94 static const WCHAR attrClip[] =
95 {'c','l','i','p',0};
96 static const WCHAR attrColor[] =
97 {'c','o','l','o','r',0};
98 static const WCHAR attrCursor[] =
99 {'c','u','r','s','o','r',0};
100 static const WCHAR attrDisplay[] =
101 {'d','i','s','p','l','a','y',0};
102 static const WCHAR attrFilter[] =
103 {'f','i','l','e','t','e','r',0};
104 static const WCHAR attrFontFamily[] =
105 {'f','o','n','t','-','f','a','m','i','l','y',0};
106 static const WCHAR attrFontSize[] =
107 {'f','o','n','t','-','s','i','z','e',0};
108 static const WCHAR attrFontStyle[] =
109 {'f','o','n','t','-','s','t','y','l','e',0};
110 static const WCHAR attrFontVariant[] =
111 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
112 static const WCHAR attrFontWeight[] =
113 {'f','o','n','t','-','w','e','i','g','h','t',0};
114 static const WCHAR attrHeight[] =
115 {'h','e','i','g','h','t',0};
116 static const WCHAR attrLeft[] =
117 {'l','e','f','t',0};
118 static const WCHAR attrLetterSpacing[] =
119 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
120 static const WCHAR attrLineHeight[] =
121 {'l','i','n','e','-','h','e','i','g','h','t',0};
122 static const WCHAR attrMargin[] =
123 {'m','a','r','g','i','n',0};
124 static const WCHAR attrMarginBottom[] =
125 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
126 static const WCHAR attrMarginLeft[] =
127 {'m','a','r','g','i','n','-','l','e','f','t',0};
128 static const WCHAR attrMarginRight[] =
129 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
130 static const WCHAR attrMarginTop[] =
131 {'m','a','r','g','i','n','-','t','o','p',0};
132 static const WCHAR attrMinHeight[] =
133 {'m','i','n','-','h','e','i','g','h','t',0};
134 static const WCHAR attrOverflow[] =
135 {'o','v','e','r','f','l','o','w',0};
136 static const WCHAR attrPadding[] =
137 {'p','a','d','d','i','n','g',0};
138 static const WCHAR attrPaddingBottom[] =
139 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
140 static const WCHAR attrPaddingLeft[] =
141 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
142 static const WCHAR attrPaddingRight[] =
143 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
144 static const WCHAR attrPaddingTop[] =
145 {'p','a','d','d','i','n','g','-','t','o','p',0};
146 static const WCHAR attrPosition[] =
147 {'p','o','s','i','t','i','o','n',0};
148 static const WCHAR attrRight[] =
149 {'r','i','g','h','t',0};
150 static const WCHAR attrTextAlign[] =
151 {'t','e','x','t','-','a','l','i','g','n',0};
152 static const WCHAR attrTextDecoration[] =
153 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
154 static const WCHAR attrTextIndent[] =
155 {'t','e','x','t','-','i','n','d','e','n','t',0};
156 static const WCHAR attrTop[] =
157 {'t','o','p',0};
158 static const WCHAR attrVerticalAlign[] =
159 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
160 static const WCHAR attrVisibility[] =
161 {'v','i','s','i','b','i','l','i','t','y',0};
162 static const WCHAR attrWidth[] =
163 {'w','i','d','t','h',0};
164 static const WCHAR attrWordSpacing[] =
165 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
166 static const WCHAR attrWordWrap[] =
167 {'w','o','r','d','-','w','r','a','p',0};
168 static const WCHAR attrZIndex[] =
169 {'z','-','i','n','d','e','x',0};
171 static const struct{
172 const WCHAR *name;
173 DISPID dispid;
174 } style_tbl[] = {
175 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
176 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
177 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
178 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
179 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
180 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
181 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
182 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
183 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
184 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
185 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
186 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
187 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
188 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
189 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
190 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
191 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
192 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
193 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
194 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
195 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
196 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
197 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
198 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
199 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
200 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
201 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
202 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
203 {attrClip, DISPID_IHTMLSTYLE_CLIP},
204 {attrColor, DISPID_IHTMLSTYLE_COLOR},
205 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
206 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
207 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
208 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
209 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
210 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
211 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
212 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
213 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
214 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
215 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
216 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
217 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
218 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
219 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
220 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
221 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
222 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
223 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
224 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
225 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
226 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
227 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
228 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
229 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
230 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
231 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
232 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
233 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
234 {attrTop, DISPID_IHTMLSTYLE_TOP},
235 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
236 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
237 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
238 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
239 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
240 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
243 static const WCHAR valLineThrough[] =
244 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
245 static const WCHAR valUnderline[] =
246 {'u','n','d','e','r','l','i','n','e',0};
247 static const WCHAR szNormal[] =
248 {'n','o','r','m','a','l',0};
249 static const WCHAR styleNone[] =
250 {'n','o','n','e',0};
251 static const WCHAR valOverline[] =
252 {'o','v','e','r','l','i','n','e',0};
253 static const WCHAR valBlink[] =
254 {'b','l','i','n','k',0};
256 static const WCHAR px_formatW[] = {'%','d','p','x',0};
257 static const WCHAR emptyW[] = {0};
259 static LPWSTR fix_px_value(LPCWSTR val)
261 LPCWSTR ptr = val;
263 while(*ptr) {
264 while(*ptr && isspaceW(*ptr))
265 ptr++;
266 if(!*ptr)
267 break;
269 while(*ptr && isdigitW(*ptr))
270 ptr++;
272 if(!*ptr || isspaceW(*ptr)) {
273 LPWSTR ret, p;
274 int len = strlenW(val)+1;
276 ret = heap_alloc((len+2)*sizeof(WCHAR));
277 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
278 p = ret + (ptr-val);
279 *p++ = 'p';
280 *p++ = 'x';
281 strcpyW(p, ptr);
283 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
285 return ret;
288 while(*ptr && !isspaceW(*ptr))
289 ptr++;
292 return NULL;
295 static LPWSTR fix_url_value(LPCWSTR val)
297 WCHAR *ret, *ptr;
299 static const WCHAR urlW[] = {'u','r','l','('};
301 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
302 return NULL;
304 ret = heap_strdupW(val);
306 for(ptr = ret; *ptr; ptr++) {
307 if(*ptr == '\\')
308 *ptr = '/';
311 return ret;
314 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
316 nsAString str_name, str_value, str_empty;
317 LPWSTR val = NULL;
318 nsresult nsres;
320 if(flags & ATTR_FIX_PX)
321 val = fix_px_value(value);
322 if(flags & ATTR_FIX_URL)
323 val = fix_url_value(value);
325 nsAString_InitDepend(&str_name, style_tbl[sid].name);
326 nsAString_InitDepend(&str_value, val ? val : value);
327 nsAString_InitDepend(&str_empty, emptyW);
329 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
330 if(NS_FAILED(nsres))
331 ERR("SetProperty failed: %08x\n", nsres);
333 nsAString_Finish(&str_name);
334 nsAString_Finish(&str_value);
335 nsAString_Finish(&str_empty);
336 heap_free(val);
338 return S_OK;
341 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
343 switch(V_VT(v)) {
344 case VT_NULL:
345 *ret = emptyW;
346 return S_OK;
348 case VT_BSTR:
349 *ret = V_BSTR(v);
350 return S_OK;
352 case VT_BSTR|VT_BYREF:
353 *ret = *V_BSTRREF(v);
354 return S_OK;
356 case VT_I4: {
357 static const WCHAR formatW[] = {'%','d',0};
358 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
360 if(flags & ATTR_HEX_INT)
361 wsprintfW(buf, hex_formatW, V_I4(v));
362 else if(flags & ATTR_FIX_PX)
363 wsprintfW(buf, px_formatW, V_I4(v));
364 else
365 wsprintfW(buf, formatW, V_I4(v));
367 *ret = buf;
368 return S_OK;
370 default:
371 FIXME("not implemented vt %d\n", V_VT(v));
372 return E_NOTIMPL;
377 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
379 const WCHAR *val;
380 WCHAR buf[14];
381 HRESULT hres;
383 hres = var_to_styleval(value, buf, flags, &val);
384 if(FAILED(hres))
385 return hres;
387 return set_nsstyle_attr(nsstyle, sid, val, flags);
390 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
392 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
395 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
397 nsAString str_name;
398 nsresult nsres;
400 nsAString_InitDepend(&str_name, style_tbl[sid].name);
402 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
403 if(NS_FAILED(nsres)) {
404 ERR("SetProperty failed: %08x\n", nsres);
405 return E_FAIL;
408 nsAString_Finish(&str_name);
410 return NS_OK;
413 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
415 BSTR ret;
416 DWORD len;
418 if(!*val) {
419 *p = NULL;
420 return S_OK;
423 ret = SysAllocString(val);
424 if(!ret)
425 return E_OUTOFMEMORY;
427 len = SysStringLen(ret);
429 if(flags & ATTR_REMOVE_COMMA) {
430 DWORD new_len = len;
431 WCHAR *ptr, *ptr2;
433 for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
434 new_len--;
436 if(new_len != len) {
437 BSTR new_ret;
439 new_ret = SysAllocStringLen(NULL, new_len);
440 if(!new_ret) {
441 SysFreeString(ret);
442 return E_OUTOFMEMORY;
445 for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
446 if(*ptr != ',')
447 *ptr2++ = *ptr;
450 SysFreeString(ret);
451 ret = new_ret;
455 *p = ret;
456 return S_OK;
459 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p, DWORD flags)
461 nsAString str_value;
462 const PRUnichar *value;
463 HRESULT hres;
465 nsAString_Init(&str_value, NULL);
467 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
469 nsAString_GetData(&str_value, &value);
470 hres = nsstyle_to_bstr(value, flags, p);
471 nsAString_Finish(&str_value);
473 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
474 return S_OK;
477 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
479 nsAString str_value;
480 const PRUnichar *value;
481 BOOL set = FALSE;
482 HRESULT hres = S_OK;
484 nsAString_Init(&str_value, NULL);
486 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
488 nsAString_GetData(&str_value, &value);
490 if(flags & ATTR_STR_TO_INT) {
491 const PRUnichar *ptr = value;
492 BOOL neg = FALSE;
493 INT i = 0;
495 if(*ptr == '-') {
496 neg = TRUE;
497 ptr++;
500 while(isdigitW(*ptr))
501 i = i*10 + (*ptr++ - '0');
503 if(!*ptr) {
504 V_VT(p) = VT_I4;
505 V_I4(p) = neg ? -i : i;
506 set = TRUE;
510 if(!set) {
511 BSTR str;
513 hres = nsstyle_to_bstr(value, flags, &str);
514 if(SUCCEEDED(hres)) {
515 V_VT(p) = VT_BSTR;
516 V_BSTR(p) = str;
520 nsAString_Finish(&str_value);
522 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
523 return S_OK;
526 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
528 return get_nsstyle_attr(This->nsstyle, sid, p, 0);
531 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
533 nsAString str_value;
534 const PRUnichar *value;
536 nsAString_Init(&str_value, NULL);
538 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
540 nsAString_GetData(&str_value, &value);
541 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
542 nsAString_Finish(&str_value);
544 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
545 return S_OK;
548 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
550 WCHAR szValue[25];
551 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
553 value = floor(value);
555 sprintfW(szValue, szFormat, value);
557 return set_style_attr(This, sid, szValue, 0);
560 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
562 nsAString str_value;
563 HRESULT hres;
564 WCHAR pxW[] = {'p','x',0};
566 TRACE("%p %d %p\n", This, sid, p);
568 *p = 0.0f;
570 nsAString_Init(&str_value, NULL);
572 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
573 if(hres == S_OK)
575 WCHAR *ptr;
576 const PRUnichar *value;
578 nsAString_GetData(&str_value, &value);
579 if(value)
581 *p = strtolW(value, &ptr, 10);
583 if(*ptr && strcmpW(ptr, pxW))
585 nsAString_Finish(&str_value);
586 FIXME("only px values are currently supported\n");
587 return E_FAIL;
592 TRACE("ret %f\n", *p);
594 nsAString_Finish(&str_value);
596 return hres;
599 static BOOL is_valid_border_style(BSTR v)
601 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
602 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
603 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
604 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
605 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
606 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
607 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
608 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
610 TRACE("%s\n", debugstr_w(v));
612 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
613 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
614 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
615 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
616 strcmpiW(v, styleOutset) == 0 )
618 return TRUE;
621 return FALSE;
624 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
626 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
629 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
631 HTMLStyle *This = impl_from_IHTMLStyle(iface);
633 *ppv = NULL;
635 if(IsEqualGUID(&IID_IUnknown, riid)) {
636 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
637 *ppv = &This->IHTMLStyle_iface;
638 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
639 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
640 *ppv = &This->IHTMLStyle_iface;
641 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
642 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
643 *ppv = &This->IHTMLStyle2_iface;
644 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
645 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
646 *ppv = &This->IHTMLStyle3_iface;
647 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
648 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
649 *ppv = &This->IHTMLStyle4_iface;
650 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
651 return *ppv ? S_OK : E_NOINTERFACE;
654 if(*ppv) {
655 IUnknown_AddRef((IUnknown*)*ppv);
656 return S_OK;
659 WARN("unsupported %s\n", debugstr_guid(riid));
660 return E_NOINTERFACE;
663 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
665 HTMLStyle *This = impl_from_IHTMLStyle(iface);
666 LONG ref = InterlockedIncrement(&This->ref);
668 TRACE("(%p) ref=%d\n", This, ref);
670 return ref;
673 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
675 HTMLStyle *This = impl_from_IHTMLStyle(iface);
676 LONG ref = InterlockedDecrement(&This->ref);
678 TRACE("(%p) ref=%d\n", This, ref);
680 if(!ref) {
681 if(This->nsstyle)
682 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
683 heap_free(This->filter);
684 release_dispex(&This->dispex);
685 heap_free(This);
688 return ref;
691 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
693 HTMLStyle *This = impl_from_IHTMLStyle(iface);
694 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
697 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
698 LCID lcid, ITypeInfo **ppTInfo)
700 HTMLStyle *This = impl_from_IHTMLStyle(iface);
701 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
704 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
705 LPOLESTR *rgszNames, UINT cNames,
706 LCID lcid, DISPID *rgDispId)
708 HTMLStyle *This = impl_from_IHTMLStyle(iface);
709 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
710 lcid, rgDispId);
713 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
714 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
715 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
717 HTMLStyle *This = impl_from_IHTMLStyle(iface);
718 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
719 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
722 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
724 HTMLStyle *This = impl_from_IHTMLStyle(iface);
726 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
728 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
731 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
733 HTMLStyle *This = impl_from_IHTMLStyle(iface);
735 TRACE("(%p)->(%p)\n", This, p);
737 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
740 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
742 HTMLStyle *This = impl_from_IHTMLStyle(iface);
743 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
744 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
746 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
748 /* fontStyle can only be one of the follow values. */
749 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
750 strcmpiW(szOblique, v) == 0)
752 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
755 return E_INVALIDARG;
758 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
760 HTMLStyle *This = impl_from_IHTMLStyle(iface);
762 TRACE("(%p)->(%p)\n", This, p);
764 return get_style_attr(This, STYLEID_FONT_STYLE, p);
767 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
769 HTMLStyle *This = impl_from_IHTMLStyle(iface);
770 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
772 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
774 /* fontVariant can only be one of the follow values. */
775 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
777 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
780 return E_INVALIDARG;
783 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
785 HTMLStyle *This = impl_from_IHTMLStyle(iface);
786 TRACE("(%p)->(%p)\n", This, p);
788 if(!p)
789 return E_INVALIDARG;
791 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
794 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
796 HTMLStyle *This = impl_from_IHTMLStyle(iface);
797 static const WCHAR styleBold[] = {'b','o','l','d',0};
798 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
799 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
800 static const WCHAR style100[] = {'1','0','0',0};
801 static const WCHAR style200[] = {'2','0','0',0};
802 static const WCHAR style300[] = {'3','0','0',0};
803 static const WCHAR style400[] = {'4','0','0',0};
804 static const WCHAR style500[] = {'5','0','0',0};
805 static const WCHAR style600[] = {'6','0','0',0};
806 static const WCHAR style700[] = {'7','0','0',0};
807 static const WCHAR style800[] = {'8','0','0',0};
808 static const WCHAR style900[] = {'9','0','0',0};
810 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
812 /* fontWeight can only be one of the following */
813 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
814 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
815 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
816 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
817 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
818 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
819 strcmpiW(style900, v) == 0
822 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
825 return E_INVALIDARG;
828 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
830 HTMLStyle *This = impl_from_IHTMLStyle(iface);
832 TRACE("(%p)->(%p)\n", This, p);
834 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
837 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
841 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
843 switch(V_VT(&v)) {
844 case VT_BSTR:
845 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
846 default:
847 FIXME("not supported vt %d\n", V_VT(&v));
850 return S_OK;
853 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
855 HTMLStyle *This = impl_from_IHTMLStyle(iface);
857 TRACE("(%p)->(%p)\n", This, p);
859 V_VT(p) = VT_BSTR;
860 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
863 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
865 HTMLStyle *This = impl_from_IHTMLStyle(iface);
866 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
867 return E_NOTIMPL;
870 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
872 HTMLStyle *This = impl_from_IHTMLStyle(iface);
873 FIXME("(%p)->(%p)\n", This, p);
874 return E_NOTIMPL;
877 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
879 HTMLStyle *This = impl_from_IHTMLStyle(iface);
881 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
883 switch(V_VT(&v)) {
884 case VT_BSTR:
885 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
886 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
888 default:
889 FIXME("unsupported vt=%d\n", V_VT(&v));
892 return E_NOTIMPL;
895 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
897 HTMLStyle *This = impl_from_IHTMLStyle(iface);
899 TRACE("(%p)->(%p)\n", This, p);
901 V_VT(p) = VT_BSTR;
902 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
905 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
907 HTMLStyle *This = impl_from_IHTMLStyle(iface);
909 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
911 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
914 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
916 HTMLStyle *This = impl_from_IHTMLStyle(iface);
918 TRACE("(%p)->(%p)\n", This, p);
920 return get_style_attr(This, STYLEID_BACKGROUND, p);
923 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
925 HTMLStyle *This = impl_from_IHTMLStyle(iface);
927 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
929 switch(V_VT(&v)) {
930 case VT_BSTR:
931 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
932 case VT_I4: {
933 WCHAR value[10];
934 static const WCHAR format[] = {'#','%','0','6','x',0};
936 wsprintfW(value, format, V_I4(&v));
937 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
939 default:
940 FIXME("unsupported vt %d\n", V_VT(&v));
943 return S_OK;
946 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
948 HTMLStyle *This = impl_from_IHTMLStyle(iface);
949 TRACE("(%p)->(%p)\n", This, p);
951 V_VT(p) = VT_BSTR;
952 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
955 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
957 HTMLStyle *This = impl_from_IHTMLStyle(iface);
959 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
961 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
964 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
966 HTMLStyle *This = impl_from_IHTMLStyle(iface);
968 TRACE("(%p)->(%p)\n", This, p);
970 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
973 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
975 HTMLStyle *This = impl_from_IHTMLStyle(iface);
976 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
977 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
978 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
979 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
981 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
983 /* fontWeight can only be one of the following */
984 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
985 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
987 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
990 return E_INVALIDARG;
993 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
995 HTMLStyle *This = impl_from_IHTMLStyle(iface);
997 TRACE("(%p)->(%p)\n", This, p);
999 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1002 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1004 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1005 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1006 return E_NOTIMPL;
1009 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1011 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1012 FIXME("(%p)->(%p)\n", This, p);
1013 return E_NOTIMPL;
1016 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1018 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1020 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1022 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1025 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1027 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1029 TRACE("(%p)->(%p)\n", This, p);
1031 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1034 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1036 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1037 WCHAR buf[14], *pos_val;
1038 nsAString pos_str;
1039 const WCHAR *val;
1040 DWORD val_len;
1041 HRESULT hres;
1043 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1045 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1046 if(FAILED(hres))
1047 return hres;
1049 val_len = val ? strlenW(val) : 0;
1051 nsAString_Init(&pos_str, NULL);
1052 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1053 if(SUCCEEDED(hres)) {
1054 const PRUnichar *pos, *posy;
1055 DWORD posy_len;
1057 nsAString_GetData(&pos_str, &pos);
1058 posy = strchrW(pos, ' ');
1059 if(!posy) {
1060 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1062 TRACE("no space in %s\n", debugstr_w(pos));
1063 posy = zero_pxW;
1066 posy_len = strlenW(posy);
1067 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1068 if(pos_val) {
1069 if(val_len)
1070 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1071 if(posy_len)
1072 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1073 pos_val[val_len+posy_len] = 0;
1074 }else {
1075 hres = E_OUTOFMEMORY;
1078 nsAString_Finish(&pos_str);
1079 if(FAILED(hres))
1080 return hres;
1082 TRACE("setting position to %s\n", debugstr_w(pos_val));
1083 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1084 heap_free(pos_val);
1085 return hres;
1088 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1090 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1091 nsAString pos_str;
1092 BSTR ret;
1093 HRESULT hres;
1095 TRACE("(%p)->(%p)\n", This, p);
1097 nsAString_Init(&pos_str, NULL);
1098 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1099 if(SUCCEEDED(hres)) {
1100 const PRUnichar *pos, *space;
1102 nsAString_GetData(&pos_str, &pos);
1103 space = strchrW(pos, ' ');
1104 if(!space) {
1105 WARN("no space in %s\n", debugstr_w(pos));
1106 space = pos + strlenW(pos);
1109 if(space != pos) {
1110 ret = SysAllocStringLen(pos, space-pos);
1111 if(!ret)
1112 hres = E_OUTOFMEMORY;
1113 }else {
1114 ret = NULL;
1117 nsAString_Finish(&pos_str);
1118 if(FAILED(hres))
1119 return hres;
1121 TRACE("returning %s\n", debugstr_w(ret));
1122 V_VT(p) = VT_BSTR;
1123 V_BSTR(p) = ret;
1124 return S_OK;
1127 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1129 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1130 WCHAR buf[14], *pos_val;
1131 nsAString pos_str;
1132 const WCHAR *val;
1133 DWORD val_len;
1134 HRESULT hres;
1136 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1138 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1139 if(FAILED(hres))
1140 return hres;
1142 val_len = val ? strlenW(val) : 0;
1144 nsAString_Init(&pos_str, NULL);
1145 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1146 if(SUCCEEDED(hres)) {
1147 const PRUnichar *pos, *space;
1148 DWORD posx_len;
1150 nsAString_GetData(&pos_str, &pos);
1151 space = strchrW(pos, ' ');
1152 if(space) {
1153 space++;
1154 }else {
1155 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1157 TRACE("no space in %s\n", debugstr_w(pos));
1158 pos = zero_pxW;
1159 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1162 posx_len = space-pos;
1164 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1165 if(pos_val) {
1166 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1167 if(val_len)
1168 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1169 pos_val[posx_len+val_len] = 0;
1170 }else {
1171 hres = E_OUTOFMEMORY;
1174 nsAString_Finish(&pos_str);
1175 if(FAILED(hres))
1176 return hres;
1178 TRACE("setting position to %s\n", debugstr_w(pos_val));
1179 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1180 heap_free(pos_val);
1181 return hres;
1184 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1186 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1187 nsAString pos_str;
1188 BSTR ret;
1189 HRESULT hres;
1191 TRACE("(%p)->(%p)\n", This, p);
1193 nsAString_Init(&pos_str, NULL);
1194 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1195 if(SUCCEEDED(hres)) {
1196 const PRUnichar *pos, *posy;
1198 nsAString_GetData(&pos_str, &pos);
1199 posy = strchrW(pos, ' ');
1200 if(posy) {
1201 ret = SysAllocString(posy+1);
1202 if(!ret)
1203 hres = E_OUTOFMEMORY;
1204 }else {
1205 ret = NULL;
1208 nsAString_Finish(&pos_str);
1209 if(FAILED(hres))
1210 return hres;
1212 TRACE("returning %s\n", debugstr_w(ret));
1213 V_VT(p) = VT_BSTR;
1214 V_BSTR(p) = ret;
1215 return S_OK;
1218 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1220 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1221 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1222 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1225 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1227 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1228 TRACE("(%p)->(%p)\n", This, p);
1229 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1232 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1234 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1235 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1236 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1239 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1241 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1242 TRACE("(%p)->(%p)\n", This, p);
1243 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1246 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1248 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1250 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1252 /* textDecoration can only be one of the following */
1253 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1254 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1255 strcmpiW(valBlink, v) == 0)
1257 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1260 return E_INVALIDARG;
1263 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1265 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1267 TRACE("(%p)->(%p)\n", This, p);
1269 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1272 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1274 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1276 TRACE("(%p)->(%x)\n", This, v);
1278 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1281 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1283 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1285 TRACE("(%p)->(%p)\n", This, p);
1287 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1290 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1292 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1294 TRACE("(%p)->(%x)\n", This, v);
1296 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1299 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1301 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1303 TRACE("(%p)->(%p)\n", This, p);
1305 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1308 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1310 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1312 TRACE("(%p)->(%x)\n", This, v);
1314 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1317 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1319 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1321 TRACE("(%p)->(%p)\n", This, p);
1323 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1326 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1328 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1330 TRACE("(%p)->(%x)\n", This, v);
1332 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1335 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1337 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1339 TRACE("(%p)->(%p)\n", This, p);
1341 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1344 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1346 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1348 TRACE("(%p)->(%x)\n", This, v);
1350 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1353 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1355 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1357 TRACE("(%p)->(%p)\n", This, p);
1359 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1362 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1364 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1366 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1368 switch(V_VT(&v)) {
1369 case VT_BSTR:
1370 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1371 default:
1372 FIXME("not implemented vt %d\n", V_VT(&v));
1373 return E_NOTIMPL;
1376 return S_OK;
1379 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1381 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1382 BSTR ret;
1383 HRESULT hres;
1385 TRACE("(%p)->(%p)\n", This, p);
1387 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1388 if(FAILED(hres))
1389 return hres;
1391 V_VT(p) = VT_BSTR;
1392 V_BSTR(p) = ret;
1393 return S_OK;
1396 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1398 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1399 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1400 return E_NOTIMPL;
1403 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1405 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1406 FIXME("(%p)->(%p)\n", This, p);
1407 return E_NOTIMPL;
1410 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1412 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1414 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1416 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1419 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1421 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1423 TRACE("(%p)->(%p)\n", This, p);
1425 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1428 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1430 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1431 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1432 return E_NOTIMPL;
1435 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1437 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1438 FIXME("(%p)->(%p)\n", This, p);
1439 return E_NOTIMPL;
1442 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1444 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1445 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1446 return E_NOTIMPL;
1449 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1451 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1452 FIXME("(%p)->(%p)\n", This, p);
1453 return E_NOTIMPL;
1456 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1458 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1460 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1462 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1465 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1467 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1469 TRACE("(%p)->(%p)\n", This, p);
1471 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1474 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1476 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1478 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1480 switch(V_VT(&v)) {
1481 case VT_NULL:
1482 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1483 case VT_I4: {
1484 WCHAR buf[14];
1486 wsprintfW(buf, px_formatW, V_I4(&v));
1487 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1489 case VT_BSTR:
1490 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1491 default:
1492 FIXME("Unsupported vt=%d\n", V_VT(&v));
1495 return E_NOTIMPL;
1498 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1500 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1501 TRACE("(%p)->(%p)\n", This, p);
1502 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1505 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1507 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1508 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1509 return E_NOTIMPL;
1512 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1514 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1515 FIXME("(%p)->(%p)\n", This, p);
1516 return E_NOTIMPL;
1519 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1521 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1523 switch(V_VT(&v)) {
1524 case VT_NULL:
1525 TRACE("(%p)->(NULL)\n", This);
1526 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1527 case VT_I4: {
1528 WCHAR buf[14];
1530 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1532 wsprintfW(buf, px_formatW, V_I4(&v));
1533 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1535 case VT_BSTR:
1536 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1537 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1538 default:
1539 FIXME("Unsupported vt=%d\n", V_VT(&v));
1542 return E_NOTIMPL;
1545 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1547 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1549 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1551 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1554 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1556 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1558 TRACE("(%p)->(%p)\n", This, p);
1560 return get_style_attr(This, STYLEID_MARGIN, p);
1563 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1565 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1566 TRACE("(%p)->(%p)\n", This, p);
1567 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1570 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1572 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1573 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1574 return E_NOTIMPL;
1577 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1579 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1580 FIXME("(%p)->(%p)\n", This, p);
1581 return E_NOTIMPL;
1584 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1586 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1587 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1588 return E_NOTIMPL;
1591 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1593 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1594 FIXME("(%p)->(%p)\n", This, p);
1595 return E_NOTIMPL;
1598 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1600 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1601 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1602 return E_NOTIMPL;
1605 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1607 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1608 FIXME("(%p)->(%p)\n", This, p);
1609 return E_NOTIMPL;
1612 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1614 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1616 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1618 switch(V_VT(&v)) {
1619 case VT_I4: {
1620 WCHAR buf[14];
1622 wsprintfW(buf, px_formatW, V_I4(&v));
1623 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1625 case VT_BSTR:
1626 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1627 default:
1628 FIXME("unsupported vt=%d\n", V_VT(&v));
1631 return E_NOTIMPL;
1634 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1636 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1637 BSTR ret;
1638 HRESULT hres;
1640 TRACE("(%p)->(%p)\n", This, p);
1642 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1643 if(FAILED(hres))
1644 return hres;
1646 V_VT(p) = VT_BSTR;
1647 V_BSTR(p) = ret;
1648 return S_OK;
1651 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1653 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1655 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1657 return set_style_attr(This, STYLEID_PADDING, v, 0);
1660 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1662 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1664 TRACE("(%p)->(%p)\n", This, p);
1666 return get_style_attr(This, STYLEID_PADDING, p);
1669 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1671 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1673 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1675 return set_style_attr(This, STYLEID_BORDER, v, 0);
1678 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1680 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1682 TRACE("(%p)->(%p)\n", This, p);
1684 return get_style_attr(This, STYLEID_BORDER, p);
1687 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1689 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1690 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1691 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1694 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1696 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1697 TRACE("(%p)->(%p)\n", This, p);
1698 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1701 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1703 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1704 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1705 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1708 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1710 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1711 TRACE("(%p)->(%p)\n", This, p);
1712 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1715 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1717 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1718 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1719 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1722 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1724 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1725 TRACE("(%p)->(%p)\n", This, p);
1726 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1729 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1731 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1733 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1735 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1738 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1740 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1742 TRACE("(%p)->(%p)\n", This, p);
1744 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1747 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1749 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1751 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1753 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1756 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1758 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1760 TRACE("(%p)->(%p)\n", This, p);
1762 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1765 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1767 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1769 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1771 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1774 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1776 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1778 TRACE("(%p)->(%p)\n", This, p);
1780 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1783 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1785 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1787 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1789 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1792 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1794 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1796 TRACE("(%p)->(%p)\n", This, p);
1798 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1801 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1803 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1805 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1807 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1810 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1812 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1814 TRACE("(%p)->(%p)\n", This, p);
1816 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1819 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1821 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1823 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1825 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1828 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1830 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1832 TRACE("(%p)->(%p)\n", This, p);
1834 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1837 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1840 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1841 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1844 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1846 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1847 TRACE("(%p)->(%p)\n", This, p);
1848 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1851 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1853 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1854 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1855 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1858 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1860 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1862 TRACE("(%p)->(%p)\n", This, p);
1864 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1867 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1869 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1870 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1871 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1874 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1876 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1877 TRACE("(%p)->(%p)\n", This, p);
1878 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1881 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1883 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1885 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1886 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1889 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1891 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1892 TRACE("(%p)->(%p)\n", This, p);
1893 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1896 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1898 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1899 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1900 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1903 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1905 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1906 TRACE("(%p)->(%p)\n", This, p);
1907 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1910 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1912 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1913 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1914 HRESULT hres = S_OK;
1915 BSTR pstyle;
1916 int i=0;
1917 int last = 0;
1919 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1921 while(v[i] && hres == S_OK)
1923 if(v[i] == (WCHAR)' ')
1925 pstyle = SysAllocStringLen(&v[last], (i-last));
1926 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1928 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1929 hres = E_INVALIDARG;
1931 SysFreeString(pstyle);
1932 last = i+1;
1934 i++;
1937 if(hres == S_OK)
1939 pstyle = SysAllocStringLen(&v[last], i-last);
1940 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1942 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1943 hres = E_INVALIDARG;
1945 SysFreeString(pstyle);
1948 if(hres == S_OK)
1949 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1951 return hres;
1954 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1956 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1957 TRACE("(%p)->(%p)\n", This, p);
1958 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1961 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1963 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1964 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1966 if(!is_valid_border_style(v))
1967 return E_INVALIDARG;
1969 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1972 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1974 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1975 TRACE("(%p)->(%p)\n", This, p);
1976 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1979 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1981 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1982 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1984 if(!is_valid_border_style(v))
1985 return E_INVALIDARG;
1987 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1990 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1992 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1993 TRACE("(%p)->(%p)\n", This, p);
1994 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1997 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1999 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2000 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2002 if(!is_valid_border_style(v))
2003 return E_INVALIDARG;
2005 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
2008 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
2010 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2011 TRACE("(%p)->(%p)\n", This, p);
2012 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
2015 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
2017 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2018 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2020 if(!is_valid_border_style(v))
2021 return E_INVALIDARG;
2023 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
2026 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
2028 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2029 TRACE("(%p)->(%p)\n", This, p);
2030 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2033 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2035 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2037 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
2039 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2042 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2044 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2046 TRACE("(%p)->(%p)\n", This, p);
2048 V_VT(p) = VT_BSTR;
2049 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
2052 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2054 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2056 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2058 switch(V_VT(&v)) {
2059 case VT_BSTR:
2060 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
2061 default:
2062 FIXME("unimplemented vt %d\n", V_VT(&v));
2063 return E_NOTIMPL;
2066 return S_OK;
2069 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2071 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2072 BSTR ret;
2073 HRESULT hres;
2075 TRACE("(%p)->(%p)\n", This, p);
2077 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
2078 if(FAILED(hres))
2079 return hres;
2081 V_VT(p) = VT_BSTR;
2082 V_BSTR(p) = ret;
2083 return S_OK;
2086 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2088 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2089 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2090 return E_NOTIMPL;
2093 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2095 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2096 FIXME("(%p)->(%p)\n", This, p);
2097 return E_NOTIMPL;
2100 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2102 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2103 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2104 return E_NOTIMPL;
2107 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2109 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2110 FIXME("(%p)->(%p)\n", This, p);
2111 return E_NOTIMPL;
2114 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2116 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2118 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2120 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2123 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2125 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2127 TRACE("(%p)->(%p)\n", This, p);
2129 return get_style_attr(This, STYLEID_DISPLAY, p);
2132 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2134 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2136 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2138 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2141 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2143 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2145 TRACE("(%p)->(%p)\n", This, p);
2147 return get_style_attr(This, STYLEID_VISIBILITY, p);
2150 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2152 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2153 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2154 return E_NOTIMPL;
2157 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2159 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2160 FIXME("(%p)->(%p)\n", This, p);
2161 return E_NOTIMPL;
2164 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2166 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2167 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2168 return E_NOTIMPL;
2171 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2173 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2174 FIXME("(%p)->(%p)\n", This, p);
2175 return E_NOTIMPL;
2178 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2180 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2181 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2182 return E_NOTIMPL;
2185 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2187 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2188 FIXME("(%p)->(%p)\n", This, p);
2189 return E_NOTIMPL;
2192 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2194 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2195 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2196 return E_NOTIMPL;
2199 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2201 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2202 FIXME("(%p)->(%p)\n", This, p);
2203 return E_NOTIMPL;
2206 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2208 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2209 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2210 return E_NOTIMPL;
2213 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2215 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2216 FIXME("(%p)->(%p)\n", This, p);
2217 return E_NOTIMPL;
2220 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2222 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2224 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2226 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2229 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2231 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2232 BSTR ret;
2233 HRESULT hres;
2235 TRACE("(%p)->(%p)\n", This, p);
2237 hres = get_style_attr(This, STYLEID_TOP, &ret);
2238 if(FAILED(hres))
2239 return hres;
2241 V_VT(p) = VT_BSTR;
2242 V_BSTR(p) = ret;
2243 return S_OK;
2246 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2248 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2250 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2252 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2255 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2257 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2258 BSTR ret;
2259 HRESULT hres;
2261 TRACE("(%p)->(%p)\n", This, p);
2263 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2264 if(FAILED(hres))
2265 return hres;
2267 V_VT(p) = VT_BSTR;
2268 V_BSTR(p) = ret;
2269 return S_OK;
2272 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2274 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2275 TRACE("(%p)->(%p)\n", This, p);
2276 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2279 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2281 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2283 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2285 switch(V_VT(&v)) {
2286 case VT_BSTR:
2287 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2288 case VT_I4: {
2289 WCHAR value[14];
2290 static const WCHAR format[] = {'%','d',0};
2292 wsprintfW(value, format, V_I4(&v));
2293 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2295 default:
2296 FIXME("unimplemented vt %d\n", V_VT(&v));
2297 return E_NOTIMPL;
2300 return S_OK;
2303 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2305 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2307 TRACE("(%p)->(%p)\n", This, p);
2309 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2312 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2314 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2315 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2316 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2317 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2318 static const WCHAR szAuto[] = {'a','u','t','o',0};
2320 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2322 /* overflow can only be one of the follow values. */
2323 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2324 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2326 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2329 return E_INVALIDARG;
2333 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2335 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2337 TRACE("(%p)->(%p)\n", This, p);
2339 if(!p)
2340 return E_INVALIDARG;
2342 return get_style_attr(This, STYLEID_OVERFLOW, p);
2345 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2347 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2348 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2349 return E_NOTIMPL;
2352 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2354 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2355 FIXME("(%p)->(%p)\n", This, p);
2356 return E_NOTIMPL;
2359 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2361 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2362 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2363 return E_NOTIMPL;
2366 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2368 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2369 FIXME("(%p)->(%p)\n", This, p);
2370 return E_NOTIMPL;
2373 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2375 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2376 nsAString text_str;
2377 nsresult nsres;
2379 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2381 nsAString_InitDepend(&text_str, v);
2382 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2383 nsAString_Finish(&text_str);
2384 if(NS_FAILED(nsres)) {
2385 FIXME("SetCssStyle failed: %08x\n", nsres);
2386 return E_FAIL;
2389 return S_OK;
2392 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2394 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2395 nsAString text_str;
2396 nsresult nsres;
2398 TRACE("(%p)->(%p)\n", This, p);
2400 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2401 nsAString_Init(&text_str, NULL);
2402 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2403 if(NS_SUCCEEDED(nsres)) {
2404 const PRUnichar *text;
2406 nsAString_GetData(&text_str, &text);
2407 *p = *text ? SysAllocString(text) : NULL;
2408 }else {
2409 FIXME("GetCssStyle failed: %08x\n", nsres);
2410 *p = NULL;
2413 nsAString_Finish(&text_str);
2414 return S_OK;
2417 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2419 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2420 FIXME("(%p)->()\n", This);
2421 return E_NOTIMPL;
2424 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2426 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2427 FIXME("(%p)->()\n", This);
2428 return E_NOTIMPL;
2431 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2433 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2434 FIXME("(%p)->()\n", This);
2435 return E_NOTIMPL;
2438 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2440 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2441 FIXME("(%p)->()\n", This);
2442 return E_NOTIMPL;
2445 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2447 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2448 FIXME("(%p)->()\n", This);
2449 return E_NOTIMPL;
2452 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2454 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2455 FIXME("(%p)->()\n", This);
2456 return E_NOTIMPL;
2459 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2461 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2462 FIXME("(%p)->()\n", This);
2463 return E_NOTIMPL;
2466 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2468 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2469 FIXME("(%p)->()\n", This);
2470 return E_NOTIMPL;
2473 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2475 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2477 TRACE("(%p)->(%f)\n", This, v);
2479 return set_style_pos(This, STYLEID_TOP, v);
2482 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2484 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2486 TRACE("(%p)->(%p)\n", This, p);
2488 if(!p)
2489 return E_POINTER;
2491 return get_nsstyle_pos(This, STYLEID_TOP, p);
2494 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2496 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2498 TRACE("(%p)->(%f)\n", This, v);
2500 return set_style_pos(This, STYLEID_LEFT, v);
2503 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2505 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2507 TRACE("(%p)->(%p)\n", This, p);
2509 if(!p)
2510 return E_POINTER;
2512 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2515 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2517 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2519 TRACE("(%p)->(%f)\n", This, v);
2521 return set_style_pos(This, STYLEID_WIDTH, v);
2524 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2526 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2528 TRACE("(%p)->(%p)\n", This, p);
2530 if(!p)
2531 return E_POINTER;
2533 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2534 *p = 0.0f;
2536 return S_OK;
2539 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2541 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2543 TRACE("(%p)->(%f)\n", This, v);
2545 return set_style_pos(This, STYLEID_HEIGHT, v);
2548 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2550 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2552 TRACE("(%p)->(%p)\n", This, p);
2554 if(!p)
2555 return E_POINTER;
2557 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2558 *p = 0.0f;
2560 return S_OK;
2563 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2565 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2567 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2569 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2572 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2574 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2576 TRACE("(%p)->(%p)\n", This, p);
2578 return get_style_attr(This, STYLEID_CURSOR, p);
2581 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2583 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2585 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2587 return set_style_attr(This, STYLEID_CLIP, v, 0);
2590 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2592 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2594 TRACE("(%p)->(%p)\n", This, p);
2596 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2599 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2601 nsAString name_str, val_str, empty_str;
2602 nsresult nsres;
2604 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2606 TRACE("%s\n", debugstr_w(val));
2608 nsAString_InitDepend(&name_str, opacityW);
2609 nsAString_InitDepend(&val_str, val);
2610 nsAString_InitDepend(&empty_str, emptyW);
2612 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2613 if(NS_FAILED(nsres))
2614 ERR("SetProperty failed: %08x\n", nsres);
2616 nsAString_Finish(&name_str);
2617 nsAString_Finish(&val_str);
2618 nsAString_Finish(&empty_str);
2621 static void update_filter(HTMLStyle *This)
2623 const WCHAR *ptr = This->filter, *ptr2;
2625 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2627 if(!ptr) {
2628 set_opacity(This, emptyW);
2629 return;
2632 while(1) {
2633 while(isspaceW(*ptr))
2634 ptr++;
2635 if(!*ptr)
2636 break;
2638 ptr2 = ptr;
2639 while(isalnumW(*ptr))
2640 ptr++;
2641 if(ptr == ptr2) {
2642 WARN("unexpected char '%c'\n", *ptr);
2643 break;
2645 if(*ptr != '(') {
2646 WARN("expected '('\n");
2647 continue;
2650 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2651 static const WCHAR formatW[] = {'%','f',0};
2652 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2654 ptr++;
2655 do {
2656 while(isspaceW(*ptr))
2657 ptr++;
2659 ptr2 = ptr;
2660 while(*ptr && *ptr != ',' && *ptr != ')')
2661 ptr++;
2662 if(!*ptr) {
2663 WARN("unexpected end of string\n");
2664 break;
2667 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2668 float fval = 0.0f, e = 0.1f;
2669 WCHAR buf[32];
2671 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2673 while(isdigitW(*ptr2))
2674 fval = fval*10.0f + (float)(*ptr2++ - '0');
2676 if(*ptr2 == '.') {
2677 while(isdigitW(*++ptr2)) {
2678 fval += e * (float)(*ptr2++ - '0');
2679 e *= 0.1f;
2683 sprintfW(buf, formatW, fval * 0.01f);
2684 set_opacity(This, buf);
2685 }else {
2686 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2689 if(*ptr == ',')
2690 ptr++;
2691 }while(*ptr != ')');
2692 }else {
2693 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2694 ptr = strchrW(ptr, ')');
2695 if(!ptr)
2696 break;
2697 ptr++;
2702 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2704 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2705 WCHAR *new_filter = NULL;
2707 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2709 if(v) {
2710 new_filter = heap_strdupW(v);
2711 if(!new_filter)
2712 return E_OUTOFMEMORY;
2715 heap_free(This->filter);
2716 This->filter = new_filter;
2718 update_filter(This);
2719 return S_OK;
2722 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2724 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2726 TRACE("(%p)->(%p)\n", This, p);
2728 if(This->filter) {
2729 *p = SysAllocString(This->filter);
2730 if(!*p)
2731 return E_OUTOFMEMORY;
2732 }else {
2733 *p = NULL;
2736 return S_OK;
2739 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2740 VARIANT AttributeValue, LONG lFlags)
2742 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2743 HRESULT hres;
2744 DISPID dispid;
2746 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2747 V_VT(&AttributeValue), lFlags);
2749 if(!strAttributeName)
2750 return E_INVALIDARG;
2752 if(lFlags == 1)
2753 FIXME("Parameter lFlags ignored\n");
2755 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2756 LOCALE_USER_DEFAULT, &dispid);
2757 if(hres == S_OK)
2759 VARIANT ret;
2760 DISPID dispidNamed = DISPID_PROPERTYPUT;
2761 DISPPARAMS params;
2763 params.cArgs = 1;
2764 params.rgvarg = &AttributeValue;
2765 params.cNamedArgs = 1;
2766 params.rgdispidNamedArgs = &dispidNamed;
2768 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2769 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
2771 else
2773 FIXME("Custom attributes not supported.\n");
2776 TRACE("ret: %08x\n", hres);
2778 return hres;
2781 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2782 LONG lFlags, VARIANT *AttributeValue)
2784 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2785 HRESULT hres;
2786 DISPID dispid;
2788 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2789 AttributeValue, lFlags);
2791 if(!AttributeValue || !strAttributeName)
2792 return E_INVALIDARG;
2794 if(lFlags == 1)
2795 FIXME("Parameter lFlags ignored\n");
2797 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2798 LOCALE_USER_DEFAULT, &dispid);
2799 if(hres == S_OK)
2801 DISPPARAMS params = {NULL, NULL, 0, 0 };
2803 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2804 DISPATCH_PROPERTYGET, &params, AttributeValue, NULL, NULL);
2806 else
2808 FIXME("Custom attributes not supported.\n");
2811 return hres;
2814 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2815 LONG lFlags, VARIANT_BOOL *pfSuccess)
2817 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2818 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2819 lFlags, pfSuccess);
2820 return E_NOTIMPL;
2823 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2825 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2826 FIXME("(%p)->(%p)\n", This, String);
2827 return E_NOTIMPL;
2830 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2831 HTMLStyle_QueryInterface,
2832 HTMLStyle_AddRef,
2833 HTMLStyle_Release,
2834 HTMLStyle_GetTypeInfoCount,
2835 HTMLStyle_GetTypeInfo,
2836 HTMLStyle_GetIDsOfNames,
2837 HTMLStyle_Invoke,
2838 HTMLStyle_put_fontFamily,
2839 HTMLStyle_get_fontFamily,
2840 HTMLStyle_put_fontStyle,
2841 HTMLStyle_get_fontStyle,
2842 HTMLStyle_put_fontVariant,
2843 HTMLStyle_get_fontVariant,
2844 HTMLStyle_put_fontWeight,
2845 HTMLStyle_get_fontWeight,
2846 HTMLStyle_put_fontSize,
2847 HTMLStyle_get_fontSize,
2848 HTMLStyle_put_font,
2849 HTMLStyle_get_font,
2850 HTMLStyle_put_color,
2851 HTMLStyle_get_color,
2852 HTMLStyle_put_background,
2853 HTMLStyle_get_background,
2854 HTMLStyle_put_backgroundColor,
2855 HTMLStyle_get_backgroundColor,
2856 HTMLStyle_put_backgroundImage,
2857 HTMLStyle_get_backgroundImage,
2858 HTMLStyle_put_backgroundRepeat,
2859 HTMLStyle_get_backgroundRepeat,
2860 HTMLStyle_put_backgroundAttachment,
2861 HTMLStyle_get_backgroundAttachment,
2862 HTMLStyle_put_backgroundPosition,
2863 HTMLStyle_get_backgroundPosition,
2864 HTMLStyle_put_backgroundPositionX,
2865 HTMLStyle_get_backgroundPositionX,
2866 HTMLStyle_put_backgroundPositionY,
2867 HTMLStyle_get_backgroundPositionY,
2868 HTMLStyle_put_wordSpacing,
2869 HTMLStyle_get_wordSpacing,
2870 HTMLStyle_put_letterSpacing,
2871 HTMLStyle_get_letterSpacing,
2872 HTMLStyle_put_textDecoration,
2873 HTMLStyle_get_textDecoration,
2874 HTMLStyle_put_textDecorationNone,
2875 HTMLStyle_get_textDecorationNone,
2876 HTMLStyle_put_textDecorationUnderline,
2877 HTMLStyle_get_textDecorationUnderline,
2878 HTMLStyle_put_textDecorationOverline,
2879 HTMLStyle_get_textDecorationOverline,
2880 HTMLStyle_put_textDecorationLineThrough,
2881 HTMLStyle_get_textDecorationLineThrough,
2882 HTMLStyle_put_textDecorationBlink,
2883 HTMLStyle_get_textDecorationBlink,
2884 HTMLStyle_put_verticalAlign,
2885 HTMLStyle_get_verticalAlign,
2886 HTMLStyle_put_textTransform,
2887 HTMLStyle_get_textTransform,
2888 HTMLStyle_put_textAlign,
2889 HTMLStyle_get_textAlign,
2890 HTMLStyle_put_textIndent,
2891 HTMLStyle_get_textIndent,
2892 HTMLStyle_put_lineHeight,
2893 HTMLStyle_get_lineHeight,
2894 HTMLStyle_put_marginTop,
2895 HTMLStyle_get_marginTop,
2896 HTMLStyle_put_marginRight,
2897 HTMLStyle_get_marginRight,
2898 HTMLStyle_put_marginBottom,
2899 HTMLStyle_get_marginBottom,
2900 HTMLStyle_put_marginLeft,
2901 HTMLStyle_get_marginLeft,
2902 HTMLStyle_put_margin,
2903 HTMLStyle_get_margin,
2904 HTMLStyle_put_paddingTop,
2905 HTMLStyle_get_paddingTop,
2906 HTMLStyle_put_paddingRight,
2907 HTMLStyle_get_paddingRight,
2908 HTMLStyle_put_paddingBottom,
2909 HTMLStyle_get_paddingBottom,
2910 HTMLStyle_put_paddingLeft,
2911 HTMLStyle_get_paddingLeft,
2912 HTMLStyle_put_padding,
2913 HTMLStyle_get_padding,
2914 HTMLStyle_put_border,
2915 HTMLStyle_get_border,
2916 HTMLStyle_put_borderTop,
2917 HTMLStyle_get_borderTop,
2918 HTMLStyle_put_borderRight,
2919 HTMLStyle_get_borderRight,
2920 HTMLStyle_put_borderBottom,
2921 HTMLStyle_get_borderBottom,
2922 HTMLStyle_put_borderLeft,
2923 HTMLStyle_get_borderLeft,
2924 HTMLStyle_put_borderColor,
2925 HTMLStyle_get_borderColor,
2926 HTMLStyle_put_borderTopColor,
2927 HTMLStyle_get_borderTopColor,
2928 HTMLStyle_put_borderRightColor,
2929 HTMLStyle_get_borderRightColor,
2930 HTMLStyle_put_borderBottomColor,
2931 HTMLStyle_get_borderBottomColor,
2932 HTMLStyle_put_borderLeftColor,
2933 HTMLStyle_get_borderLeftColor,
2934 HTMLStyle_put_borderWidth,
2935 HTMLStyle_get_borderWidth,
2936 HTMLStyle_put_borderTopWidth,
2937 HTMLStyle_get_borderTopWidth,
2938 HTMLStyle_put_borderRightWidth,
2939 HTMLStyle_get_borderRightWidth,
2940 HTMLStyle_put_borderBottomWidth,
2941 HTMLStyle_get_borderBottomWidth,
2942 HTMLStyle_put_borderLeftWidth,
2943 HTMLStyle_get_borderLeftWidth,
2944 HTMLStyle_put_borderStyle,
2945 HTMLStyle_get_borderStyle,
2946 HTMLStyle_put_borderTopStyle,
2947 HTMLStyle_get_borderTopStyle,
2948 HTMLStyle_put_borderRightStyle,
2949 HTMLStyle_get_borderRightStyle,
2950 HTMLStyle_put_borderBottomStyle,
2951 HTMLStyle_get_borderBottomStyle,
2952 HTMLStyle_put_borderLeftStyle,
2953 HTMLStyle_get_borderLeftStyle,
2954 HTMLStyle_put_width,
2955 HTMLStyle_get_width,
2956 HTMLStyle_put_height,
2957 HTMLStyle_get_height,
2958 HTMLStyle_put_styleFloat,
2959 HTMLStyle_get_styleFloat,
2960 HTMLStyle_put_clear,
2961 HTMLStyle_get_clear,
2962 HTMLStyle_put_display,
2963 HTMLStyle_get_display,
2964 HTMLStyle_put_visibility,
2965 HTMLStyle_get_visibility,
2966 HTMLStyle_put_listStyleType,
2967 HTMLStyle_get_listStyleType,
2968 HTMLStyle_put_listStylePosition,
2969 HTMLStyle_get_listStylePosition,
2970 HTMLStyle_put_listStyleImage,
2971 HTMLStyle_get_listStyleImage,
2972 HTMLStyle_put_listStyle,
2973 HTMLStyle_get_listStyle,
2974 HTMLStyle_put_whiteSpace,
2975 HTMLStyle_get_whiteSpace,
2976 HTMLStyle_put_top,
2977 HTMLStyle_get_top,
2978 HTMLStyle_put_left,
2979 HTMLStyle_get_left,
2980 HTMLStyle_get_position,
2981 HTMLStyle_put_zIndex,
2982 HTMLStyle_get_zIndex,
2983 HTMLStyle_put_overflow,
2984 HTMLStyle_get_overflow,
2985 HTMLStyle_put_pageBreakBefore,
2986 HTMLStyle_get_pageBreakBefore,
2987 HTMLStyle_put_pageBreakAfter,
2988 HTMLStyle_get_pageBreakAfter,
2989 HTMLStyle_put_cssText,
2990 HTMLStyle_get_cssText,
2991 HTMLStyle_put_pixelTop,
2992 HTMLStyle_get_pixelTop,
2993 HTMLStyle_put_pixelLeft,
2994 HTMLStyle_get_pixelLeft,
2995 HTMLStyle_put_pixelWidth,
2996 HTMLStyle_get_pixelWidth,
2997 HTMLStyle_put_pixelHeight,
2998 HTMLStyle_get_pixelHeight,
2999 HTMLStyle_put_posTop,
3000 HTMLStyle_get_posTop,
3001 HTMLStyle_put_posLeft,
3002 HTMLStyle_get_posLeft,
3003 HTMLStyle_put_posWidth,
3004 HTMLStyle_get_posWidth,
3005 HTMLStyle_put_posHeight,
3006 HTMLStyle_get_posHeight,
3007 HTMLStyle_put_cursor,
3008 HTMLStyle_get_cursor,
3009 HTMLStyle_put_clip,
3010 HTMLStyle_get_clip,
3011 HTMLStyle_put_filter,
3012 HTMLStyle_get_filter,
3013 HTMLStyle_setAttribute,
3014 HTMLStyle_getAttribute,
3015 HTMLStyle_removeAttribute,
3016 HTMLStyle_toString
3019 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3021 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
3023 while(min <= max) {
3024 i = (min+max)/2;
3026 c = strcmpW(style_tbl[i].name, name);
3027 if(!c) {
3028 *dispid = style_tbl[i].dispid;
3029 return S_OK;
3032 if(c > 0)
3033 max = i-1;
3034 else
3035 min = i+1;
3038 return DISP_E_UNKNOWNNAME;
3041 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3042 NULL,
3043 HTMLStyle_get_dispid,
3044 NULL
3047 static const tid_t HTMLStyle_iface_tids[] = {
3048 IHTMLStyle_tid,
3049 IHTMLStyle2_tid,
3050 IHTMLStyle3_tid,
3051 IHTMLStyle4_tid,
3054 static dispex_static_data_t HTMLStyle_dispex = {
3055 &HTMLStyle_dispex_vtbl,
3056 DispHTMLStyle_tid,
3057 NULL,
3058 HTMLStyle_iface_tids
3061 HRESULT HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret)
3063 HTMLStyle *style;
3065 style = heap_alloc_zero(sizeof(HTMLStyle));
3066 if(!style)
3067 return E_OUTOFMEMORY;
3069 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3070 style->ref = 1;
3071 style->nsstyle = nsstyle;
3072 HTMLStyle2_Init(style);
3073 HTMLStyle3_Init(style);
3075 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3077 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);
3079 *ret = style;
3080 return S_OK;