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
31 #include "mshtml_private.h"
32 #include "htmlstyle.h"
34 #include "wine/debug.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[] =
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 attrDirection[] =
101 {'d','i','r','e','c','t','i','o','n',0};
102 static const WCHAR attrDisplay[] =
103 {'d','i','s','p','l','a','y',0};
104 static const WCHAR attrFilter[] =
105 {'f','i','l','e','t','e','r',0};
106 static const WCHAR attrFontFamily[] =
107 {'f','o','n','t','-','f','a','m','i','l','y',0};
108 static const WCHAR attrFontSize[] =
109 {'f','o','n','t','-','s','i','z','e',0};
110 static const WCHAR attrFontStyle[] =
111 {'f','o','n','t','-','s','t','y','l','e',0};
112 static const WCHAR attrFontVariant[] =
113 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
114 static const WCHAR attrFontWeight[] =
115 {'f','o','n','t','-','w','e','i','g','h','t',0};
116 static const WCHAR attrHeight[] =
117 {'h','e','i','g','h','t',0};
118 static const WCHAR attrLeft[] =
120 static const WCHAR attrLetterSpacing[] =
121 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
122 static const WCHAR attrLineHeight[] =
123 {'l','i','n','e','-','h','e','i','g','h','t',0};
124 static const WCHAR attrMargin[] =
125 {'m','a','r','g','i','n',0};
126 static const WCHAR attrMarginBottom[] =
127 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
128 static const WCHAR attrMarginLeft[] =
129 {'m','a','r','g','i','n','-','l','e','f','t',0};
130 static const WCHAR attrMarginRight[] =
131 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
132 static const WCHAR attrMarginTop[] =
133 {'m','a','r','g','i','n','-','t','o','p',0};
134 static const WCHAR attrMinHeight[] =
135 {'m','i','n','-','h','e','i','g','h','t',0};
136 static const WCHAR attrOverflow[] =
137 {'o','v','e','r','f','l','o','w',0};
138 static const WCHAR attrOverflowX[] =
139 {'o','v','e','r','f','l','o','w','-','x',0};
140 static const WCHAR attrOverflowY[] =
141 {'o','v','e','r','f','l','o','w','-','y',0};
142 static const WCHAR attrPadding[] =
143 {'p','a','d','d','i','n','g',0};
144 static const WCHAR attrPaddingBottom[] =
145 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
146 static const WCHAR attrPaddingLeft[] =
147 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
148 static const WCHAR attrPaddingRight[] =
149 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
150 static const WCHAR attrPaddingTop[] =
151 {'p','a','d','d','i','n','g','-','t','o','p',0};
152 static const WCHAR attrPageBreakAfter[] =
153 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
154 static const WCHAR attrPageBreakBefore[] =
155 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
156 static const WCHAR attrPosition[] =
157 {'p','o','s','i','t','i','o','n',0};
158 static const WCHAR attrRight[] =
159 {'r','i','g','h','t',0};
160 static const WCHAR attrTextAlign[] =
161 {'t','e','x','t','-','a','l','i','g','n',0};
162 static const WCHAR attrTextDecoration[] =
163 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
164 static const WCHAR attrTextIndent[] =
165 {'t','e','x','t','-','i','n','d','e','n','t',0};
166 static const WCHAR attrTop[] =
168 static const WCHAR attrVerticalAlign[] =
169 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
170 static const WCHAR attrVisibility[] =
171 {'v','i','s','i','b','i','l','i','t','y',0};
172 static const WCHAR attrWidth[] =
173 {'w','i','d','t','h',0};
174 static const WCHAR attrWordSpacing[] =
175 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
176 static const WCHAR attrWordWrap[] =
177 {'w','o','r','d','-','w','r','a','p',0};
178 static const WCHAR attrZIndex[] =
179 {'z','-','i','n','d','e','x',0};
186 static const style_tbl_entry_t style_tbl[] = {
187 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
188 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
189 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
190 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
191 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
192 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
193 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
194 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
195 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
196 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
197 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
198 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
199 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
200 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
201 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
202 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
203 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
204 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
205 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
206 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
207 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
208 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
209 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
210 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
211 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
212 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
213 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
214 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
215 {attrClip, DISPID_IHTMLSTYLE_CLIP},
216 {attrColor, DISPID_IHTMLSTYLE_COLOR},
217 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
218 {attrDirection, DISPID_IHTMLSTYLE2_DIRECTION},
219 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
220 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
221 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
222 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
223 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
224 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
225 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
226 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
227 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
228 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
229 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
230 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
231 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
232 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
233 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
234 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
235 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
236 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
237 {attrOverflowX, DISPID_IHTMLSTYLE2_OVERFLOWX},
238 {attrOverflowY, DISPID_IHTMLSTYLE2_OVERFLOWY},
239 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
240 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
241 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
242 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
243 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
244 {attrPageBreakAfter, DISPID_IHTMLSTYLE_PAGEBREAKAFTER},
245 {attrPageBreakBefore, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE},
246 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
247 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
248 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
249 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
250 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
251 {attrTop, DISPID_IHTMLSTYLE_TOP},
252 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
253 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
254 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
255 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
256 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
257 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
260 static const WCHAR valLineThrough[] =
261 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
262 static const WCHAR valUnderline[] =
263 {'u','n','d','e','r','l','i','n','e',0};
264 static const WCHAR szNormal[] =
265 {'n','o','r','m','a','l',0};
266 static const WCHAR styleNone[] =
268 static const WCHAR valOverline[] =
269 {'o','v','e','r','l','i','n','e',0};
270 static const WCHAR valBlink[] =
271 {'b','l','i','n','k',0};
273 static const WCHAR px_formatW[] = {'%','d','p','x',0};
274 static const WCHAR emptyW[] = {0};
276 static const style_tbl_entry_t *lookup_style_tbl(const WCHAR *name)
278 int c, i, min = 0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
283 c = strcmpW(style_tbl[i].name, name);
296 static LPWSTR fix_px_value(LPCWSTR val)
301 while(*ptr && isspaceW(*ptr))
306 while(*ptr && isdigitW(*ptr))
309 if(!*ptr || isspaceW(*ptr)) {
311 int len = strlenW(val)+1;
313 ret = heap_alloc((len+2)*sizeof(WCHAR));
314 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
320 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
325 while(*ptr && !isspaceW(*ptr))
332 static LPWSTR fix_url_value(LPCWSTR val)
336 static const WCHAR urlW[] = {'u','r','l','('};
338 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
341 ret = heap_strdupW(val);
343 for(ptr = ret; *ptr; ptr++) {
351 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
353 nsAString str_name, str_value, str_empty;
357 if(flags & ATTR_FIX_PX)
358 val = fix_px_value(value);
359 if(flags & ATTR_FIX_URL)
360 val = fix_url_value(value);
362 nsAString_InitDepend(&str_name, style_tbl[sid].name);
363 nsAString_InitDepend(&str_value, val ? val : value);
364 nsAString_InitDepend(&str_empty, emptyW);
366 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
368 ERR("SetProperty failed: %08x\n", nsres);
370 nsAString_Finish(&str_name);
371 nsAString_Finish(&str_value);
372 nsAString_Finish(&str_empty);
378 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
389 case VT_BSTR|VT_BYREF:
390 *ret = *V_BSTRREF(v);
394 static const WCHAR formatW[] = {'%','d',0};
395 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
397 if(flags & ATTR_HEX_INT)
398 wsprintfW(buf, hex_formatW, V_I4(v));
399 else if(flags & ATTR_FIX_PX)
400 wsprintfW(buf, px_formatW, V_I4(v));
402 wsprintfW(buf, formatW, V_I4(v));
408 FIXME("not implemented for %s\n", debugstr_variant(v));
414 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
420 hres = var_to_styleval(value, buf, flags, &val);
424 return set_nsstyle_attr(nsstyle, sid, val, flags);
427 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
429 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
432 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
437 nsAString_InitDepend(&str_name, style_tbl[sid].name);
439 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
440 if(NS_FAILED(nsres)) {
441 ERR("SetProperty failed: %08x\n", nsres);
445 nsAString_Finish(&str_name);
450 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
460 ret = SysAllocString(val);
462 return E_OUTOFMEMORY;
464 len = SysStringLen(ret);
466 if(flags & ATTR_REMOVE_COMMA) {
470 for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
476 new_ret = SysAllocStringLen(NULL, new_len);
479 return E_OUTOFMEMORY;
482 for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
496 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p, DWORD flags)
499 const PRUnichar *value;
502 nsAString_Init(&str_value, NULL);
504 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
506 nsAString_GetData(&str_value, &value);
507 hres = nsstyle_to_bstr(value, flags, p);
508 nsAString_Finish(&str_value);
510 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
514 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
517 const PRUnichar *value;
521 nsAString_Init(&str_value, NULL);
523 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
525 nsAString_GetData(&str_value, &value);
527 if(flags & ATTR_STR_TO_INT) {
528 const PRUnichar *ptr = value;
537 while(isdigitW(*ptr))
538 i = i*10 + (*ptr++ - '0');
542 V_I4(p) = neg ? -i : i;
550 hres = nsstyle_to_bstr(value, flags, &str);
551 if(SUCCEEDED(hres)) {
557 nsAString_Finish(&str_value);
559 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
563 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
565 return get_nsstyle_attr(This->nsstyle, sid, p, 0);
568 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
571 const PRUnichar *value;
573 nsAString_Init(&str_value, NULL);
575 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
577 nsAString_GetData(&str_value, &value);
578 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
579 nsAString_Finish(&str_value);
581 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
585 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
588 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
590 value = floor(value);
592 sprintfW(szValue, szFormat, value);
594 return set_style_attr(This, sid, szValue, 0);
597 static HRESULT set_style_pxattr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LONG value)
601 sprintfW(value_str, px_formatW, value);
603 return set_nsstyle_attr(nsstyle, sid, value_str, 0);
606 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
610 WCHAR pxW[] = {'p','x',0};
612 TRACE("%p %d %p\n", This, sid, p);
616 nsAString_Init(&str_value, NULL);
618 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
622 const PRUnichar *value;
624 nsAString_GetData(&str_value, &value);
627 *p = strtolW(value, &ptr, 10);
629 if(*ptr && strcmpW(ptr, pxW))
631 nsAString_Finish(&str_value);
632 FIXME("only px values are currently supported\n");
638 TRACE("ret %f\n", *p);
640 nsAString_Finish(&str_value);
645 static BOOL is_valid_border_style(BSTR v)
647 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
648 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
649 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
650 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
651 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
652 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
653 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
654 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
656 TRACE("%s\n", debugstr_w(v));
658 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
659 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
660 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
661 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
662 strcmpiW(v, styleOutset) == 0 )
670 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
672 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
675 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
677 HTMLStyle *This = impl_from_IHTMLStyle(iface);
681 if(IsEqualGUID(&IID_IUnknown, riid)) {
682 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
683 *ppv = &This->IHTMLStyle_iface;
684 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
685 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
686 *ppv = &This->IHTMLStyle_iface;
687 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
688 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
689 *ppv = &This->IHTMLStyle2_iface;
690 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
691 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
692 *ppv = &This->IHTMLStyle3_iface;
693 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
694 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
695 *ppv = &This->IHTMLStyle4_iface;
696 }else if(IsEqualGUID(&IID_IHTMLStyle5, riid)) {
697 TRACE("(%p)->(IID_IHTMLStyle5 %p)\n", This, ppv);
698 *ppv = &This->IHTMLStyle5_iface;
699 }else if(IsEqualGUID(&IID_IHTMLStyle6, riid)) {
700 TRACE("(%p)->(IID_IHTMLStyle6 %p)\n", This, ppv);
701 *ppv = &This->IHTMLStyle6_iface;
702 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
703 return *ppv ? S_OK : E_NOINTERFACE;
707 IUnknown_AddRef((IUnknown*)*ppv);
711 WARN("unsupported %s\n", debugstr_guid(riid));
712 return E_NOINTERFACE;
715 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
717 HTMLStyle *This = impl_from_IHTMLStyle(iface);
718 LONG ref = InterlockedIncrement(&This->ref);
720 TRACE("(%p) ref=%d\n", This, ref);
725 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
727 HTMLStyle *This = impl_from_IHTMLStyle(iface);
728 LONG ref = InterlockedDecrement(&This->ref);
730 TRACE("(%p) ref=%d\n", This, ref);
735 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
736 release_dispex(&This->dispex);
743 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
745 HTMLStyle *This = impl_from_IHTMLStyle(iface);
746 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
749 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
750 LCID lcid, ITypeInfo **ppTInfo)
752 HTMLStyle *This = impl_from_IHTMLStyle(iface);
753 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
756 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
757 LPOLESTR *rgszNames, UINT cNames,
758 LCID lcid, DISPID *rgDispId)
760 HTMLStyle *This = impl_from_IHTMLStyle(iface);
761 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
765 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
766 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
767 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
769 HTMLStyle *This = impl_from_IHTMLStyle(iface);
770 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
771 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
774 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
776 HTMLStyle *This = impl_from_IHTMLStyle(iface);
778 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
780 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
783 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
785 HTMLStyle *This = impl_from_IHTMLStyle(iface);
787 TRACE("(%p)->(%p)\n", This, p);
789 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
792 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
794 HTMLStyle *This = impl_from_IHTMLStyle(iface);
795 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
796 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
798 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
800 /* fontStyle can only be one of the follow values. */
801 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
802 strcmpiW(szOblique, v) == 0)
804 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
810 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
812 HTMLStyle *This = impl_from_IHTMLStyle(iface);
814 TRACE("(%p)->(%p)\n", This, p);
816 return get_style_attr(This, STYLEID_FONT_STYLE, p);
819 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
821 HTMLStyle *This = impl_from_IHTMLStyle(iface);
822 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
824 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
826 /* fontVariant can only be one of the follow values. */
827 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
829 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
835 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
837 HTMLStyle *This = impl_from_IHTMLStyle(iface);
838 TRACE("(%p)->(%p)\n", This, p);
843 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
846 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
848 HTMLStyle *This = impl_from_IHTMLStyle(iface);
849 static const WCHAR styleBold[] = {'b','o','l','d',0};
850 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
851 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
852 static const WCHAR style100[] = {'1','0','0',0};
853 static const WCHAR style200[] = {'2','0','0',0};
854 static const WCHAR style300[] = {'3','0','0',0};
855 static const WCHAR style400[] = {'4','0','0',0};
856 static const WCHAR style500[] = {'5','0','0',0};
857 static const WCHAR style600[] = {'6','0','0',0};
858 static const WCHAR style700[] = {'7','0','0',0};
859 static const WCHAR style800[] = {'8','0','0',0};
860 static const WCHAR style900[] = {'9','0','0',0};
862 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
864 /* fontWeight can only be one of the following */
865 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
866 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
867 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
868 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
869 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
870 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
871 strcmpiW(style900, v) == 0
874 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
880 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
882 HTMLStyle *This = impl_from_IHTMLStyle(iface);
884 TRACE("(%p)->(%p)\n", This, p);
886 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
889 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
891 HTMLStyle *This = impl_from_IHTMLStyle(iface);
893 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
895 return set_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, &v, ATTR_FIX_PX);
898 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
900 HTMLStyle *This = impl_from_IHTMLStyle(iface);
902 TRACE("(%p)->(%p)\n", This, p);
904 return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
907 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
909 HTMLStyle *This = impl_from_IHTMLStyle(iface);
910 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
914 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
916 HTMLStyle *This = impl_from_IHTMLStyle(iface);
917 FIXME("(%p)->(%p)\n", This, p);
921 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
923 HTMLStyle *This = impl_from_IHTMLStyle(iface);
925 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
927 return set_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, &v, ATTR_HEX_INT);
930 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
932 HTMLStyle *This = impl_from_IHTMLStyle(iface);
934 TRACE("(%p)->(%p)\n", This, p);
936 return get_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, p, 0);
939 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
941 HTMLStyle *This = impl_from_IHTMLStyle(iface);
943 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
945 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
948 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
950 HTMLStyle *This = impl_from_IHTMLStyle(iface);
952 TRACE("(%p)->(%p)\n", This, p);
954 return get_style_attr(This, STYLEID_BACKGROUND, p);
957 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
959 HTMLStyle *This = impl_from_IHTMLStyle(iface);
961 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
963 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, &v, ATTR_HEX_INT);
966 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
968 HTMLStyle *This = impl_from_IHTMLStyle(iface);
970 TRACE("(%p)->(%p)\n", This, p);
972 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
975 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
977 HTMLStyle *This = impl_from_IHTMLStyle(iface);
979 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
981 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
984 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
986 HTMLStyle *This = impl_from_IHTMLStyle(iface);
988 TRACE("(%p)->(%p)\n", This, p);
990 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
993 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
995 HTMLStyle *This = impl_from_IHTMLStyle(iface);
996 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
997 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
998 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
999 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
1001 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1003 /* fontWeight can only be one of the following */
1004 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
1005 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
1007 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
1010 return E_INVALIDARG;
1013 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
1015 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1017 TRACE("(%p)->(%p)\n", This, p);
1019 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1022 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1025 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1029 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1031 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1032 FIXME("(%p)->(%p)\n", This, p);
1036 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1038 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1040 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1042 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1045 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1047 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1049 TRACE("(%p)->(%p)\n", This, p);
1051 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1054 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1056 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1057 WCHAR buf[14], *pos_val;
1063 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1065 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1069 val_len = val ? strlenW(val) : 0;
1071 nsAString_Init(&pos_str, NULL);
1072 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1073 if(SUCCEEDED(hres)) {
1074 const PRUnichar *pos, *posy;
1077 nsAString_GetData(&pos_str, &pos);
1078 posy = strchrW(pos, ' ');
1080 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1082 TRACE("no space in %s\n", debugstr_w(pos));
1086 posy_len = strlenW(posy);
1087 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1090 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1092 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1093 pos_val[val_len+posy_len] = 0;
1095 hres = E_OUTOFMEMORY;
1098 nsAString_Finish(&pos_str);
1102 TRACE("setting position to %s\n", debugstr_w(pos_val));
1103 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1108 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1110 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1115 TRACE("(%p)->(%p)\n", This, p);
1117 nsAString_Init(&pos_str, NULL);
1118 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1119 if(SUCCEEDED(hres)) {
1120 const PRUnichar *pos, *space;
1122 nsAString_GetData(&pos_str, &pos);
1123 space = strchrW(pos, ' ');
1125 WARN("no space in %s\n", debugstr_w(pos));
1126 space = pos + strlenW(pos);
1130 ret = SysAllocStringLen(pos, space-pos);
1132 hres = E_OUTOFMEMORY;
1137 nsAString_Finish(&pos_str);
1141 TRACE("returning %s\n", debugstr_w(ret));
1147 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1149 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1150 WCHAR buf[14], *pos_val;
1156 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1158 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1162 val_len = val ? strlenW(val) : 0;
1164 nsAString_Init(&pos_str, NULL);
1165 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1166 if(SUCCEEDED(hres)) {
1167 const PRUnichar *pos, *space;
1170 nsAString_GetData(&pos_str, &pos);
1171 space = strchrW(pos, ' ');
1175 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1177 TRACE("no space in %s\n", debugstr_w(pos));
1179 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1182 posx_len = space-pos;
1184 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1186 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1188 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1189 pos_val[posx_len+val_len] = 0;
1191 hres = E_OUTOFMEMORY;
1194 nsAString_Finish(&pos_str);
1198 TRACE("setting position to %s\n", debugstr_w(pos_val));
1199 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1204 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1206 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1211 TRACE("(%p)->(%p)\n", This, p);
1213 nsAString_Init(&pos_str, NULL);
1214 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1215 if(SUCCEEDED(hres)) {
1216 const PRUnichar *pos, *posy;
1218 nsAString_GetData(&pos_str, &pos);
1219 posy = strchrW(pos, ' ');
1221 ret = SysAllocString(posy+1);
1223 hres = E_OUTOFMEMORY;
1228 nsAString_Finish(&pos_str);
1232 TRACE("returning %s\n", debugstr_w(ret));
1238 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1240 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1242 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1244 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1247 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1249 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1250 TRACE("(%p)->(%p)\n", This, p);
1251 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1254 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1256 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1258 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1260 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1263 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1265 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1266 TRACE("(%p)->(%p)\n", This, p);
1267 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1270 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1272 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1274 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1276 /* textDecoration can only be one of the following */
1277 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1278 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1279 strcmpiW(valBlink, v) == 0)
1281 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1284 return E_INVALIDARG;
1287 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1289 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1291 TRACE("(%p)->(%p)\n", This, p);
1293 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1296 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1298 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1300 TRACE("(%p)->(%x)\n", This, v);
1302 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1305 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1307 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1309 TRACE("(%p)->(%p)\n", This, p);
1311 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1314 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1316 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1318 TRACE("(%p)->(%x)\n", This, v);
1320 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1323 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1325 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1327 TRACE("(%p)->(%p)\n", This, p);
1329 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1332 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1334 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1336 TRACE("(%p)->(%x)\n", This, v);
1338 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1341 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1343 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1345 TRACE("(%p)->(%p)\n", This, p);
1347 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1350 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1352 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1354 TRACE("(%p)->(%x)\n", This, v);
1356 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1359 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1361 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1363 TRACE("(%p)->(%p)\n", This, p);
1365 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1368 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1370 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1372 TRACE("(%p)->(%x)\n", This, v);
1374 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1377 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1379 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1381 TRACE("(%p)->(%p)\n", This, p);
1383 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1386 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1388 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1390 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1392 return set_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, &v, ATTR_FIX_PX);
1395 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1397 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1399 TRACE("(%p)->(%p)\n", This, p);
1401 return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
1404 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1406 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1407 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1411 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1413 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1414 FIXME("(%p)->(%p)\n", This, p);
1418 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1420 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1422 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1424 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1427 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1429 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1431 TRACE("(%p)->(%p)\n", This, p);
1433 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1436 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1438 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1439 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1443 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1445 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1446 FIXME("(%p)->(%p)\n", This, p);
1450 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1452 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1453 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1457 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1459 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1460 FIXME("(%p)->(%p)\n", This, p);
1464 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1466 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1468 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1470 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, ATTR_FIX_PX);
1473 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1475 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1477 TRACE("(%p)->(%p)\n", This, p);
1479 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1482 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1484 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1486 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1488 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, &v, ATTR_FIX_PX);
1491 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1493 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1494 TRACE("(%p)->(%p)\n", This, p);
1495 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1498 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1500 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1502 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1504 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, &v, ATTR_FIX_PX);
1507 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1509 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1511 TRACE("(%p)->(%p)\n", This, p);
1513 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
1516 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1518 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1520 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1522 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, &v, ATTR_FIX_PX);
1525 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1527 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1529 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1531 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1534 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1536 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1538 TRACE("(%p)->(%p)\n", This, p);
1540 return get_style_attr(This, STYLEID_MARGIN, p);
1543 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1545 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1546 TRACE("(%p)->(%p)\n", This, p);
1547 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1550 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1552 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1554 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1556 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, &v, ATTR_FIX_PX);
1559 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1561 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1563 TRACE("(%p)->(%p)\n", This, p);
1565 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
1568 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1570 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1572 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1574 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, &v, ATTR_FIX_PX);
1577 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1579 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1581 TRACE("(%p)->(%p)\n", This, p);
1583 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
1586 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1588 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1590 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1592 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, &v, ATTR_FIX_PX);
1595 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1597 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1599 TRACE("(%p)->(%p)\n", This, p);
1601 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
1604 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1606 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1608 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1610 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, &v, ATTR_FIX_PX);
1613 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1615 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1617 TRACE("(%p)->(%p)\n", This, p);
1619 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
1622 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1624 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1626 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1628 return set_style_attr(This, STYLEID_PADDING, v, 0);
1631 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1633 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1635 TRACE("(%p)->(%p)\n", This, p);
1637 return get_style_attr(This, STYLEID_PADDING, p);
1640 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1642 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1644 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1646 return set_style_attr(This, STYLEID_BORDER, v, 0);
1649 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1651 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1653 TRACE("(%p)->(%p)\n", This, p);
1655 return get_style_attr(This, STYLEID_BORDER, p);
1658 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1660 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1661 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1662 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1665 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1667 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1668 TRACE("(%p)->(%p)\n", This, p);
1669 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1672 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1674 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1675 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1676 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1679 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1681 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1682 TRACE("(%p)->(%p)\n", This, p);
1683 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1686 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1688 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1689 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1690 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1693 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1695 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1696 TRACE("(%p)->(%p)\n", This, p);
1697 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1700 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1702 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1704 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1706 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1709 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1711 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1713 TRACE("(%p)->(%p)\n", This, p);
1715 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1718 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1720 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1722 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1724 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1727 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1729 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1731 TRACE("(%p)->(%p)\n", This, p);
1733 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1736 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1738 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1740 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1742 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1745 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1747 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1749 TRACE("(%p)->(%p)\n", This, p);
1751 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1754 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1756 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1758 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1760 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1763 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1765 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1767 TRACE("(%p)->(%p)\n", This, p);
1769 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1772 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1774 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1776 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1778 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1781 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1783 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1785 TRACE("(%p)->(%p)\n", This, p);
1787 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1790 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1792 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1794 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1796 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1799 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1801 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1803 TRACE("(%p)->(%p)\n", This, p);
1805 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1808 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1810 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1811 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1812 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1815 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1817 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1818 TRACE("(%p)->(%p)\n", This, p);
1819 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1822 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1824 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1826 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1828 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1831 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1833 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1835 TRACE("(%p)->(%p)\n", This, p);
1837 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1840 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1842 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1844 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1846 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1849 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1851 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1853 TRACE("(%p)->(%p)\n", This, p);
1855 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1858 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1860 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1862 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1864 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1867 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1869 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1870 TRACE("(%p)->(%p)\n", This, p);
1871 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1874 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1876 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1878 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1880 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1883 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1885 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1886 TRACE("(%p)->(%p)\n", This, p);
1887 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1890 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1892 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1893 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1894 HRESULT hres = S_OK;
1899 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1901 while(v[i] && hres == S_OK)
1903 if(v[i] == (WCHAR)' ')
1905 pstyle = SysAllocStringLen(&v[last], (i-last));
1906 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1908 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1909 hres = E_INVALIDARG;
1911 SysFreeString(pstyle);
1919 pstyle = SysAllocStringLen(&v[last], i-last);
1920 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1922 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1923 hres = E_INVALIDARG;
1925 SysFreeString(pstyle);
1929 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1934 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1936 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1937 TRACE("(%p)->(%p)\n", This, p);
1938 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1941 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1943 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1944 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1946 if(!is_valid_border_style(v))
1947 return E_INVALIDARG;
1949 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1952 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1954 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1955 TRACE("(%p)->(%p)\n", This, p);
1956 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1959 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1961 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1962 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1964 if(!is_valid_border_style(v))
1965 return E_INVALIDARG;
1967 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1970 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1972 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1973 TRACE("(%p)->(%p)\n", This, p);
1974 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1977 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1979 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1980 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1982 if(!is_valid_border_style(v))
1983 return E_INVALIDARG;
1985 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1988 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1990 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1991 TRACE("(%p)->(%p)\n", This, p);
1992 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1995 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1997 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1998 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2000 if(!is_valid_border_style(v))
2001 return E_INVALIDARG;
2003 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
2006 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
2008 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2009 TRACE("(%p)->(%p)\n", This, p);
2010 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2013 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2015 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2017 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2019 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2022 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2026 TRACE("(%p)->(%p)\n", This, p);
2028 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
2031 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2033 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2035 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2037 return set_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, &v, ATTR_FIX_PX);
2040 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2042 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2044 TRACE("(%p)->(%p)\n", This, p);
2046 return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
2049 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2051 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2052 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2056 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2058 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2059 FIXME("(%p)->(%p)\n", This, p);
2063 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2065 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2066 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2070 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2072 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2073 FIXME("(%p)->(%p)\n", This, p);
2077 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2079 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2081 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2083 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2086 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2088 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2090 TRACE("(%p)->(%p)\n", This, p);
2092 return get_style_attr(This, STYLEID_DISPLAY, p);
2095 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2097 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2099 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2101 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2104 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2106 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2108 TRACE("(%p)->(%p)\n", This, p);
2110 return get_style_attr(This, STYLEID_VISIBILITY, p);
2113 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2115 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2116 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2120 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2122 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2123 FIXME("(%p)->(%p)\n", This, p);
2127 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2129 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2130 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2134 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2136 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2137 FIXME("(%p)->(%p)\n", This, p);
2141 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2143 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2144 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2148 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2150 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2151 FIXME("(%p)->(%p)\n", This, p);
2155 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2157 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2158 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2162 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2164 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2165 FIXME("(%p)->(%p)\n", This, p);
2169 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2171 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2172 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2176 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2178 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2179 FIXME("(%p)->(%p)\n", This, p);
2183 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2185 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2187 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2189 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2192 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2194 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2196 TRACE("(%p)->(%p)\n", This, p);
2198 return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
2201 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2203 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2205 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2207 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2210 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2212 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2214 TRACE("(%p)->(%p)\n", This, p);
2216 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
2219 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2221 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2222 TRACE("(%p)->(%p)\n", This, p);
2223 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2226 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2228 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2230 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2232 return set_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, &v, 0);
2235 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2237 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2239 TRACE("(%p)->(%p)\n", This, p);
2241 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2244 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2246 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2247 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2248 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2249 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2250 static const WCHAR szAuto[] = {'a','u','t','o',0};
2252 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2254 /* overflow can only be one of the follow values. */
2255 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2256 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2258 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2261 return E_INVALIDARG;
2265 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2267 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2269 TRACE("(%p)->(%p)\n", This, p);
2272 return E_INVALIDARG;
2274 return get_style_attr(This, STYLEID_OVERFLOW, p);
2277 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2279 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2281 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2283 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, v, 0);
2286 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2288 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2290 TRACE("(%p)->(%p)\n", This, p);
2292 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, p, 0);
2295 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2297 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2299 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2301 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, v, 0);
2304 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2306 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2308 TRACE("(%p)->(%p)\n", This, p);
2310 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, p, 0);
2313 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2315 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2319 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2321 nsAString_InitDepend(&text_str, v);
2322 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2323 nsAString_Finish(&text_str);
2324 if(NS_FAILED(nsres)) {
2325 FIXME("SetCssStyle failed: %08x\n", nsres);
2332 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2334 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2338 TRACE("(%p)->(%p)\n", This, p);
2340 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2341 nsAString_Init(&text_str, NULL);
2342 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2343 if(NS_SUCCEEDED(nsres)) {
2344 const PRUnichar *text;
2346 nsAString_GetData(&text_str, &text);
2347 *p = *text ? SysAllocString(text) : NULL;
2349 FIXME("GetCssStyle failed: %08x\n", nsres);
2353 nsAString_Finish(&text_str);
2357 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2359 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2360 FIXME("(%p)->()\n", This);
2364 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2366 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2367 FIXME("(%p)->()\n", This);
2371 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2373 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2374 FIXME("(%p)->()\n", This);
2378 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2380 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2381 FIXME("(%p)->()\n", This);
2385 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2387 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2389 TRACE("(%p)->()\n", This);
2391 return set_style_pxattr(This->nsstyle, STYLEID_WIDTH, v);
2394 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2396 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2397 FIXME("(%p)->()\n", This);
2401 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2403 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2404 FIXME("(%p)->()\n", This);
2408 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2410 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2411 FIXME("(%p)->()\n", This);
2415 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2417 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2419 TRACE("(%p)->(%f)\n", This, v);
2421 return set_style_pos(This, STYLEID_TOP, v);
2424 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2426 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2428 TRACE("(%p)->(%p)\n", This, p);
2433 return get_nsstyle_pos(This, STYLEID_TOP, p);
2436 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2438 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2440 TRACE("(%p)->(%f)\n", This, v);
2442 return set_style_pos(This, STYLEID_LEFT, v);
2445 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2447 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2449 TRACE("(%p)->(%p)\n", This, p);
2454 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2457 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2459 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2461 TRACE("(%p)->(%f)\n", This, v);
2463 return set_style_pos(This, STYLEID_WIDTH, v);
2466 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2468 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2470 TRACE("(%p)->(%p)\n", This, p);
2475 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2481 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2483 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2485 TRACE("(%p)->(%f)\n", This, v);
2487 return set_style_pos(This, STYLEID_HEIGHT, v);
2490 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2492 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2494 TRACE("(%p)->(%p)\n", This, p);
2499 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2505 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2507 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2509 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2511 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2514 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2516 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2518 TRACE("(%p)->(%p)\n", This, p);
2520 return get_style_attr(This, STYLEID_CURSOR, p);
2523 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2525 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2527 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2529 return set_style_attr(This, STYLEID_CLIP, v, 0);
2532 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2534 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2536 TRACE("(%p)->(%p)\n", This, p);
2538 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2541 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2543 nsAString name_str, val_str, empty_str;
2546 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2548 TRACE("%s\n", debugstr_w(val));
2550 nsAString_InitDepend(&name_str, opacityW);
2551 nsAString_InitDepend(&val_str, val);
2552 nsAString_InitDepend(&empty_str, emptyW);
2554 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2555 if(NS_FAILED(nsres))
2556 ERR("SetProperty failed: %08x\n", nsres);
2558 nsAString_Finish(&name_str);
2559 nsAString_Finish(&val_str);
2560 nsAString_Finish(&empty_str);
2563 static void update_filter(HTMLStyle *This)
2565 const WCHAR *ptr = This->elem->filter, *ptr2;
2567 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2570 set_opacity(This, emptyW);
2575 while(isspaceW(*ptr))
2581 while(isalnumW(*ptr))
2584 WARN("unexpected char '%c'\n", *ptr);
2588 WARN("expected '('\n");
2592 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2593 static const WCHAR formatW[] = {'%','f',0};
2594 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2598 while(isspaceW(*ptr))
2602 while(*ptr && *ptr != ',' && *ptr != ')')
2605 WARN("unexpected end of string\n");
2609 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2610 float fval = 0.0f, e = 0.1f;
2613 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2615 while(isdigitW(*ptr2))
2616 fval = fval*10.0f + (float)(*ptr2++ - '0');
2619 while(isdigitW(*++ptr2)) {
2620 fval += e * (float)(*ptr2++ - '0');
2625 sprintfW(buf, formatW, fval * 0.01f);
2626 set_opacity(This, buf);
2628 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2633 }while(*ptr != ')');
2635 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2636 ptr = strchrW(ptr, ')');
2644 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2646 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2647 WCHAR *new_filter = NULL;
2649 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2652 FIXME("Element already destroyed\n");
2653 return E_UNEXPECTED;
2657 new_filter = heap_strdupW(v);
2659 return E_OUTOFMEMORY;
2662 heap_free(This->elem->filter);
2663 This->elem->filter = new_filter;
2665 update_filter(This);
2669 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2671 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2673 TRACE("(%p)->(%p)\n", This, p);
2676 FIXME("Element already destroyed\n");
2677 return E_UNEXPECTED;
2680 if(This->elem->filter) {
2681 *p = SysAllocString(This->elem->filter);
2683 return E_OUTOFMEMORY;
2691 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2692 VARIANT AttributeValue, LONG lFlags)
2694 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2698 TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName),
2699 debugstr_variant(&AttributeValue), lFlags);
2701 if(!strAttributeName)
2702 return E_INVALIDARG;
2705 FIXME("Parameter lFlags ignored\n");
2707 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2708 LOCALE_USER_DEFAULT, &dispid);
2712 DISPID dispidNamed = DISPID_PROPERTYPUT;
2716 params.rgvarg = &AttributeValue;
2717 params.cNamedArgs = 1;
2718 params.rgdispidNamedArgs = &dispidNamed;
2720 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2721 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2725 FIXME("Custom attributes not supported.\n");
2728 TRACE("ret: %08x\n", hres);
2733 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2734 LONG lFlags, VARIANT *AttributeValue)
2736 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2740 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2741 AttributeValue, lFlags);
2743 if(!AttributeValue || !strAttributeName)
2744 return E_INVALIDARG;
2747 FIXME("Parameter lFlags ignored\n");
2749 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2750 LOCALE_USER_DEFAULT, &dispid);
2753 DISPPARAMS params = {NULL, NULL, 0, 0 };
2755 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2756 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2760 FIXME("Custom attributes not supported.\n");
2766 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2767 LONG lFlags, VARIANT_BOOL *pfSuccess)
2769 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2770 const style_tbl_entry_t *style_entry;
2771 nsAString name_str, ret_str;
2775 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
2777 style_entry = lookup_style_tbl(strAttributeName);
2782 hres = IDispatchEx_GetDispID(&This->dispex.IDispatchEx_iface, strAttributeName,
2783 (lFlags&1) ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
2785 *pfSuccess = VARIANT_FALSE;
2789 for(i=0; i < sizeof(style_tbl)/sizeof(*style_tbl); i++) {
2790 if(dispid == style_tbl[i].dispid)
2794 if(i == sizeof(style_tbl)/sizeof(*style_tbl))
2795 return remove_prop(&This->dispex, strAttributeName, pfSuccess);
2796 style_entry = style_tbl+i;
2799 /* filter property is a special case */
2800 if(style_entry->dispid == DISPID_IHTMLSTYLE_FILTER) {
2801 *pfSuccess = This->elem->filter && *This->elem->filter ? VARIANT_TRUE : VARIANT_FALSE;
2802 heap_free(This->elem->filter);
2803 This->elem->filter = NULL;
2804 update_filter(This);
2808 nsAString_InitDepend(&name_str, style_entry->name);
2809 nsAString_Init(&ret_str, NULL);
2810 nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->nsstyle, &name_str, &ret_str);
2811 if(NS_SUCCEEDED(nsres)) {
2812 const PRUnichar *ret;
2813 nsAString_GetData(&ret_str, &ret);
2814 *pfSuccess = *ret ? VARIANT_TRUE : VARIANT_FALSE;
2816 ERR("RemoveProperty failed: %08x\n", nsres);
2818 nsAString_Finish(&name_str);
2819 nsAString_Finish(&ret_str);
2820 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
2823 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2825 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2826 FIXME("(%p)->(%p)\n", This, String);
2830 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2831 HTMLStyle_QueryInterface,
2834 HTMLStyle_GetTypeInfoCount,
2835 HTMLStyle_GetTypeInfo,
2836 HTMLStyle_GetIDsOfNames,
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,
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,
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,
3011 HTMLStyle_put_filter,
3012 HTMLStyle_get_filter,
3013 HTMLStyle_setAttribute,
3014 HTMLStyle_getAttribute,
3015 HTMLStyle_removeAttribute,
3019 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3021 const style_tbl_entry_t *style_entry;
3023 style_entry = lookup_style_tbl(name);
3025 *dispid = style_entry->dispid;
3029 return DISP_E_UNKNOWNNAME;
3032 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3034 HTMLStyle_get_dispid,
3039 static const tid_t HTMLStyle_iface_tids[] = {
3048 static dispex_static_data_t HTMLStyle_dispex = {
3049 &HTMLStyle_dispex_vtbl,
3052 HTMLStyle_iface_tids
3055 HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret)
3057 nsIDOMElementCSSInlineStyle *nselemstyle;
3058 nsIDOMCSSStyleDeclaration *nsstyle;
3063 FIXME("NULL nselem\n");
3067 nsres = nsIDOMHTMLElement_QueryInterface(elem->nselem, &IID_nsIDOMElementCSSInlineStyle,
3068 (void**)&nselemstyle);
3069 assert(nsres == NS_OK);
3071 nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
3072 nsIDOMElementCSSInlineStyle_Release(nselemstyle);
3073 if(NS_FAILED(nsres)) {
3074 ERR("GetStyle failed: %08x\n", nsres);
3078 style = heap_alloc_zero(sizeof(HTMLStyle));
3080 nsIDOMCSSStyleDeclaration_Release(nsstyle);
3081 return E_OUTOFMEMORY;
3084 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3086 style->nsstyle = nsstyle;
3088 HTMLStyle2_Init(style);
3089 HTMLStyle3_Init(style);
3091 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3093 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);