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 get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
601 WCHAR pxW[] = {'p','x',0};
603 TRACE("%p %d %p\n", This, sid, p);
607 nsAString_Init(&str_value, NULL);
609 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
613 const PRUnichar *value;
615 nsAString_GetData(&str_value, &value);
618 *p = strtolW(value, &ptr, 10);
620 if(*ptr && strcmpW(ptr, pxW))
622 nsAString_Finish(&str_value);
623 FIXME("only px values are currently supported\n");
629 TRACE("ret %f\n", *p);
631 nsAString_Finish(&str_value);
636 static BOOL is_valid_border_style(BSTR v)
638 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
639 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
640 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
641 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
642 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
643 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
644 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
645 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
647 TRACE("%s\n", debugstr_w(v));
649 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
650 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
651 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
652 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
653 strcmpiW(v, styleOutset) == 0 )
661 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
663 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
666 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
668 HTMLStyle *This = impl_from_IHTMLStyle(iface);
672 if(IsEqualGUID(&IID_IUnknown, riid)) {
673 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
674 *ppv = &This->IHTMLStyle_iface;
675 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
676 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
677 *ppv = &This->IHTMLStyle_iface;
678 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
679 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
680 *ppv = &This->IHTMLStyle2_iface;
681 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
682 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
683 *ppv = &This->IHTMLStyle3_iface;
684 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
685 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
686 *ppv = &This->IHTMLStyle4_iface;
687 }else if(IsEqualGUID(&IID_IHTMLStyle5, riid)) {
688 TRACE("(%p)->(IID_IHTMLStyle5 %p)\n", This, ppv);
689 *ppv = &This->IHTMLStyle5_iface;
690 }else if(IsEqualGUID(&IID_IHTMLStyle6, riid)) {
691 TRACE("(%p)->(IID_IHTMLStyle6 %p)\n", This, ppv);
692 *ppv = &This->IHTMLStyle6_iface;
693 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
694 return *ppv ? S_OK : E_NOINTERFACE;
698 IUnknown_AddRef((IUnknown*)*ppv);
702 WARN("unsupported %s\n", debugstr_guid(riid));
703 return E_NOINTERFACE;
706 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
708 HTMLStyle *This = impl_from_IHTMLStyle(iface);
709 LONG ref = InterlockedIncrement(&This->ref);
711 TRACE("(%p) ref=%d\n", This, ref);
716 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
718 HTMLStyle *This = impl_from_IHTMLStyle(iface);
719 LONG ref = InterlockedDecrement(&This->ref);
721 TRACE("(%p) ref=%d\n", This, ref);
726 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
727 release_dispex(&This->dispex);
734 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
736 HTMLStyle *This = impl_from_IHTMLStyle(iface);
737 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
740 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
741 LCID lcid, ITypeInfo **ppTInfo)
743 HTMLStyle *This = impl_from_IHTMLStyle(iface);
744 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
747 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
748 LPOLESTR *rgszNames, UINT cNames,
749 LCID lcid, DISPID *rgDispId)
751 HTMLStyle *This = impl_from_IHTMLStyle(iface);
752 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
756 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
757 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
758 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
760 HTMLStyle *This = impl_from_IHTMLStyle(iface);
761 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
762 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
765 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
767 HTMLStyle *This = impl_from_IHTMLStyle(iface);
769 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
771 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
774 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
776 HTMLStyle *This = impl_from_IHTMLStyle(iface);
778 TRACE("(%p)->(%p)\n", This, p);
780 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
783 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
785 HTMLStyle *This = impl_from_IHTMLStyle(iface);
786 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
787 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
789 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
791 /* fontStyle can only be one of the follow values. */
792 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
793 strcmpiW(szOblique, v) == 0)
795 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
801 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
803 HTMLStyle *This = impl_from_IHTMLStyle(iface);
805 TRACE("(%p)->(%p)\n", This, p);
807 return get_style_attr(This, STYLEID_FONT_STYLE, p);
810 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
812 HTMLStyle *This = impl_from_IHTMLStyle(iface);
813 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
815 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
817 /* fontVariant can only be one of the follow values. */
818 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
820 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
826 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
828 HTMLStyle *This = impl_from_IHTMLStyle(iface);
829 TRACE("(%p)->(%p)\n", This, p);
834 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
837 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
840 static const WCHAR styleBold[] = {'b','o','l','d',0};
841 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
842 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
843 static const WCHAR style100[] = {'1','0','0',0};
844 static const WCHAR style200[] = {'2','0','0',0};
845 static const WCHAR style300[] = {'3','0','0',0};
846 static const WCHAR style400[] = {'4','0','0',0};
847 static const WCHAR style500[] = {'5','0','0',0};
848 static const WCHAR style600[] = {'6','0','0',0};
849 static const WCHAR style700[] = {'7','0','0',0};
850 static const WCHAR style800[] = {'8','0','0',0};
851 static const WCHAR style900[] = {'9','0','0',0};
853 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
855 /* fontWeight can only be one of the following */
856 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
857 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
858 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
859 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
860 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
861 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
862 strcmpiW(style900, v) == 0
865 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
871 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
873 HTMLStyle *This = impl_from_IHTMLStyle(iface);
875 TRACE("(%p)->(%p)\n", This, p);
877 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
880 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
882 HTMLStyle *This = impl_from_IHTMLStyle(iface);
884 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
886 return set_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, &v, ATTR_FIX_PX);
889 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
891 HTMLStyle *This = impl_from_IHTMLStyle(iface);
893 TRACE("(%p)->(%p)\n", This, p);
895 return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
898 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
900 HTMLStyle *This = impl_from_IHTMLStyle(iface);
901 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
905 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
907 HTMLStyle *This = impl_from_IHTMLStyle(iface);
908 FIXME("(%p)->(%p)\n", This, p);
912 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
914 HTMLStyle *This = impl_from_IHTMLStyle(iface);
916 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
918 return set_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, &v, ATTR_HEX_INT);
921 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
923 HTMLStyle *This = impl_from_IHTMLStyle(iface);
925 TRACE("(%p)->(%p)\n", This, p);
927 return get_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, p, 0);
930 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
932 HTMLStyle *This = impl_from_IHTMLStyle(iface);
934 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
936 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
939 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
941 HTMLStyle *This = impl_from_IHTMLStyle(iface);
943 TRACE("(%p)->(%p)\n", This, p);
945 return get_style_attr(This, STYLEID_BACKGROUND, p);
948 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
950 HTMLStyle *This = impl_from_IHTMLStyle(iface);
952 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
954 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, &v, ATTR_HEX_INT);
957 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
959 HTMLStyle *This = impl_from_IHTMLStyle(iface);
961 TRACE("(%p)->(%p)\n", This, p);
963 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
966 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
968 HTMLStyle *This = impl_from_IHTMLStyle(iface);
970 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
972 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
975 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
977 HTMLStyle *This = impl_from_IHTMLStyle(iface);
979 TRACE("(%p)->(%p)\n", This, p);
981 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
984 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
986 HTMLStyle *This = impl_from_IHTMLStyle(iface);
987 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
988 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
989 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
990 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
992 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
994 /* fontWeight can only be one of the following */
995 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
996 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
998 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
1001 return E_INVALIDARG;
1004 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
1006 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1008 TRACE("(%p)->(%p)\n", This, p);
1010 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1013 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1015 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1016 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1020 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1022 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1023 FIXME("(%p)->(%p)\n", This, p);
1027 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1029 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1031 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1033 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1036 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1038 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1040 TRACE("(%p)->(%p)\n", This, p);
1042 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1045 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1047 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1048 WCHAR buf[14], *pos_val;
1054 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1056 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1060 val_len = val ? strlenW(val) : 0;
1062 nsAString_Init(&pos_str, NULL);
1063 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1064 if(SUCCEEDED(hres)) {
1065 const PRUnichar *pos, *posy;
1068 nsAString_GetData(&pos_str, &pos);
1069 posy = strchrW(pos, ' ');
1071 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1073 TRACE("no space in %s\n", debugstr_w(pos));
1077 posy_len = strlenW(posy);
1078 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1081 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1083 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1084 pos_val[val_len+posy_len] = 0;
1086 hres = E_OUTOFMEMORY;
1089 nsAString_Finish(&pos_str);
1093 TRACE("setting position to %s\n", debugstr_w(pos_val));
1094 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1099 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1101 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1106 TRACE("(%p)->(%p)\n", This, p);
1108 nsAString_Init(&pos_str, NULL);
1109 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1110 if(SUCCEEDED(hres)) {
1111 const PRUnichar *pos, *space;
1113 nsAString_GetData(&pos_str, &pos);
1114 space = strchrW(pos, ' ');
1116 WARN("no space in %s\n", debugstr_w(pos));
1117 space = pos + strlenW(pos);
1121 ret = SysAllocStringLen(pos, space-pos);
1123 hres = E_OUTOFMEMORY;
1128 nsAString_Finish(&pos_str);
1132 TRACE("returning %s\n", debugstr_w(ret));
1138 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1140 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1141 WCHAR buf[14], *pos_val;
1147 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1149 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1153 val_len = val ? strlenW(val) : 0;
1155 nsAString_Init(&pos_str, NULL);
1156 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1157 if(SUCCEEDED(hres)) {
1158 const PRUnichar *pos, *space;
1161 nsAString_GetData(&pos_str, &pos);
1162 space = strchrW(pos, ' ');
1166 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1168 TRACE("no space in %s\n", debugstr_w(pos));
1170 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1173 posx_len = space-pos;
1175 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1177 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1179 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1180 pos_val[posx_len+val_len] = 0;
1182 hres = E_OUTOFMEMORY;
1185 nsAString_Finish(&pos_str);
1189 TRACE("setting position to %s\n", debugstr_w(pos_val));
1190 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1195 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1197 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1202 TRACE("(%p)->(%p)\n", This, p);
1204 nsAString_Init(&pos_str, NULL);
1205 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1206 if(SUCCEEDED(hres)) {
1207 const PRUnichar *pos, *posy;
1209 nsAString_GetData(&pos_str, &pos);
1210 posy = strchrW(pos, ' ');
1212 ret = SysAllocString(posy+1);
1214 hres = E_OUTOFMEMORY;
1219 nsAString_Finish(&pos_str);
1223 TRACE("returning %s\n", debugstr_w(ret));
1229 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1231 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1233 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1235 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1238 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1240 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1241 TRACE("(%p)->(%p)\n", This, p);
1242 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1245 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1247 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1249 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1251 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1254 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1256 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1257 TRACE("(%p)->(%p)\n", This, p);
1258 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1261 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1263 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1265 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1267 /* textDecoration can only be one of the following */
1268 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1269 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1270 strcmpiW(valBlink, v) == 0)
1272 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1275 return E_INVALIDARG;
1278 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1280 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1282 TRACE("(%p)->(%p)\n", This, p);
1284 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1287 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1289 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1291 TRACE("(%p)->(%x)\n", This, v);
1293 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1296 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1298 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1300 TRACE("(%p)->(%p)\n", This, p);
1302 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1305 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1307 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1309 TRACE("(%p)->(%x)\n", This, v);
1311 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1314 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1316 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1318 TRACE("(%p)->(%p)\n", This, p);
1320 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1323 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1325 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1327 TRACE("(%p)->(%x)\n", This, v);
1329 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1332 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1334 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1336 TRACE("(%p)->(%p)\n", This, p);
1338 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1341 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1343 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1345 TRACE("(%p)->(%x)\n", This, v);
1347 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1350 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1352 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1354 TRACE("(%p)->(%p)\n", This, p);
1356 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1359 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1361 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1363 TRACE("(%p)->(%x)\n", This, v);
1365 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1368 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1370 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1372 TRACE("(%p)->(%p)\n", This, p);
1374 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1377 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1379 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1381 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1383 return set_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, &v, ATTR_FIX_PX);
1386 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1388 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1390 TRACE("(%p)->(%p)\n", This, p);
1392 return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
1395 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1397 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1398 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1402 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1404 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1405 FIXME("(%p)->(%p)\n", This, p);
1409 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1411 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1413 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1415 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1418 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1420 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1422 TRACE("(%p)->(%p)\n", This, p);
1424 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1427 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1429 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1430 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1434 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1437 FIXME("(%p)->(%p)\n", This, p);
1441 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1443 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1444 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1448 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1450 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1451 FIXME("(%p)->(%p)\n", This, p);
1455 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1457 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1459 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1461 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, ATTR_FIX_PX);
1464 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1466 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1468 TRACE("(%p)->(%p)\n", This, p);
1470 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1473 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1475 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1477 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1479 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, &v, ATTR_FIX_PX);
1482 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1484 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1485 TRACE("(%p)->(%p)\n", This, p);
1486 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1489 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1491 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1493 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1495 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, &v, ATTR_FIX_PX);
1498 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1500 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1502 TRACE("(%p)->(%p)\n", This, p);
1504 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
1507 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1509 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1511 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1513 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, &v, ATTR_FIX_PX);
1516 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1518 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1520 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1522 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1525 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1527 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1529 TRACE("(%p)->(%p)\n", This, p);
1531 return get_style_attr(This, STYLEID_MARGIN, p);
1534 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1536 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1537 TRACE("(%p)->(%p)\n", This, p);
1538 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1541 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1543 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1545 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1547 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, &v, ATTR_FIX_PX);
1550 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1552 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1554 TRACE("(%p)->(%p)\n", This, p);
1556 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
1559 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1561 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1563 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1565 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, &v, ATTR_FIX_PX);
1568 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1570 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1572 TRACE("(%p)->(%p)\n", This, p);
1574 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
1577 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1579 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1581 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1583 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, &v, ATTR_FIX_PX);
1586 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1588 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1590 TRACE("(%p)->(%p)\n", This, p);
1592 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
1595 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1597 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1599 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1601 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, &v, ATTR_FIX_PX);
1604 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1606 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1608 TRACE("(%p)->(%p)\n", This, p);
1610 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
1613 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1615 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1617 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1619 return set_style_attr(This, STYLEID_PADDING, v, 0);
1622 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1624 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1626 TRACE("(%p)->(%p)\n", This, p);
1628 return get_style_attr(This, STYLEID_PADDING, p);
1631 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1633 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1635 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1637 return set_style_attr(This, STYLEID_BORDER, v, 0);
1640 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1642 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1644 TRACE("(%p)->(%p)\n", This, p);
1646 return get_style_attr(This, STYLEID_BORDER, p);
1649 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1651 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1652 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1653 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1656 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1658 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1659 TRACE("(%p)->(%p)\n", This, p);
1660 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1663 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1665 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1666 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1667 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1670 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1672 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1673 TRACE("(%p)->(%p)\n", This, p);
1674 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1677 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1679 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1680 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1681 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1684 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1686 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1687 TRACE("(%p)->(%p)\n", This, p);
1688 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1691 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1693 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1695 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1697 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1700 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1702 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1704 TRACE("(%p)->(%p)\n", This, p);
1706 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1709 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1711 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1713 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1715 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1718 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1720 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1722 TRACE("(%p)->(%p)\n", This, p);
1724 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1727 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1729 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1731 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1733 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1736 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1738 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1740 TRACE("(%p)->(%p)\n", This, p);
1742 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1745 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1747 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1749 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1751 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1754 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1756 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1758 TRACE("(%p)->(%p)\n", This, p);
1760 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1763 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1765 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1767 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1769 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1772 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1774 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1776 TRACE("(%p)->(%p)\n", This, p);
1778 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1781 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1783 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1785 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1787 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1790 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1792 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1794 TRACE("(%p)->(%p)\n", This, p);
1796 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1799 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1801 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1802 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1803 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1806 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1808 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1809 TRACE("(%p)->(%p)\n", This, p);
1810 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1813 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1815 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1817 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1819 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1822 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1824 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1826 TRACE("(%p)->(%p)\n", This, p);
1828 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1831 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1833 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1835 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1837 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1840 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1842 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1844 TRACE("(%p)->(%p)\n", This, p);
1846 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1849 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1851 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1853 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1855 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1858 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1860 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1861 TRACE("(%p)->(%p)\n", This, p);
1862 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1865 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1867 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1869 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1871 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1874 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(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_LEFT_WIDTH, p, 0);
1881 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1883 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1884 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1885 HRESULT hres = S_OK;
1890 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1892 while(v[i] && hres == S_OK)
1894 if(v[i] == (WCHAR)' ')
1896 pstyle = SysAllocStringLen(&v[last], (i-last));
1897 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1899 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1900 hres = E_INVALIDARG;
1902 SysFreeString(pstyle);
1910 pstyle = SysAllocStringLen(&v[last], i-last);
1911 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1913 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1914 hres = E_INVALIDARG;
1916 SysFreeString(pstyle);
1920 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1925 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1927 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1928 TRACE("(%p)->(%p)\n", This, p);
1929 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1932 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1934 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1935 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1937 if(!is_valid_border_style(v))
1938 return E_INVALIDARG;
1940 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1943 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1945 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1946 TRACE("(%p)->(%p)\n", This, p);
1947 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1950 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1952 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1953 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1955 if(!is_valid_border_style(v))
1956 return E_INVALIDARG;
1958 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1961 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1963 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1964 TRACE("(%p)->(%p)\n", This, p);
1965 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1968 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1970 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1971 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1973 if(!is_valid_border_style(v))
1974 return E_INVALIDARG;
1976 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1979 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1981 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1982 TRACE("(%p)->(%p)\n", This, p);
1983 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1986 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1988 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1989 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1991 if(!is_valid_border_style(v))
1992 return E_INVALIDARG;
1994 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1997 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1999 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2000 TRACE("(%p)->(%p)\n", This, p);
2001 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2004 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2006 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2008 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2010 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2013 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2015 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2017 TRACE("(%p)->(%p)\n", This, p);
2019 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
2022 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2026 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2028 return set_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, &v, ATTR_FIX_PX);
2031 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2033 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2035 TRACE("(%p)->(%p)\n", This, p);
2037 return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
2040 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2042 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2043 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2047 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2049 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2050 FIXME("(%p)->(%p)\n", This, p);
2054 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2056 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2057 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2061 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2063 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2064 FIXME("(%p)->(%p)\n", This, p);
2068 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2070 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2072 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2074 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2077 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2079 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2081 TRACE("(%p)->(%p)\n", This, p);
2083 return get_style_attr(This, STYLEID_DISPLAY, p);
2086 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2088 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2090 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2092 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2095 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2097 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2099 TRACE("(%p)->(%p)\n", This, p);
2101 return get_style_attr(This, STYLEID_VISIBILITY, p);
2104 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2106 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2107 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2111 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2113 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2114 FIXME("(%p)->(%p)\n", This, p);
2118 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2120 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2121 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2125 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2127 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2128 FIXME("(%p)->(%p)\n", This, p);
2132 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2134 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2135 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2139 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2141 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2142 FIXME("(%p)->(%p)\n", This, p);
2146 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2148 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2149 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2153 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2155 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2156 FIXME("(%p)->(%p)\n", This, p);
2160 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2162 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2163 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2167 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2169 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2170 FIXME("(%p)->(%p)\n", This, p);
2174 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2176 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2178 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2180 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2183 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2185 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2187 TRACE("(%p)->(%p)\n", This, p);
2189 return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
2192 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2194 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2196 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2198 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2201 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2203 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2205 TRACE("(%p)->(%p)\n", This, p);
2207 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
2210 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2212 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2213 TRACE("(%p)->(%p)\n", This, p);
2214 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2217 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2219 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2221 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2223 return set_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, &v, 0);
2226 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2228 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2230 TRACE("(%p)->(%p)\n", This, p);
2232 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2235 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2237 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2238 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2239 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2240 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2241 static const WCHAR szAuto[] = {'a','u','t','o',0};
2243 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2245 /* overflow can only be one of the follow values. */
2246 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2247 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2249 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2252 return E_INVALIDARG;
2256 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2258 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2260 TRACE("(%p)->(%p)\n", This, p);
2263 return E_INVALIDARG;
2265 return get_style_attr(This, STYLEID_OVERFLOW, p);
2268 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2270 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2272 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2274 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, v, 0);
2277 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2279 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2281 TRACE("(%p)->(%p)\n", This, p);
2283 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, p, 0);
2286 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2288 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2290 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2292 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, v, 0);
2295 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2297 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2299 TRACE("(%p)->(%p)\n", This, p);
2301 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, p, 0);
2304 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2306 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2310 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2312 nsAString_InitDepend(&text_str, v);
2313 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2314 nsAString_Finish(&text_str);
2315 if(NS_FAILED(nsres)) {
2316 FIXME("SetCssStyle failed: %08x\n", nsres);
2323 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2325 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2329 TRACE("(%p)->(%p)\n", This, p);
2331 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2332 nsAString_Init(&text_str, NULL);
2333 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2334 if(NS_SUCCEEDED(nsres)) {
2335 const PRUnichar *text;
2337 nsAString_GetData(&text_str, &text);
2338 *p = *text ? SysAllocString(text) : NULL;
2340 FIXME("GetCssStyle failed: %08x\n", nsres);
2344 nsAString_Finish(&text_str);
2348 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2350 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2351 FIXME("(%p)->()\n", This);
2355 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2357 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2358 FIXME("(%p)->()\n", This);
2362 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2364 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2365 FIXME("(%p)->()\n", This);
2369 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2371 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2372 FIXME("(%p)->()\n", This);
2376 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2378 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2379 FIXME("(%p)->()\n", This);
2383 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2385 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2386 FIXME("(%p)->()\n", This);
2390 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2392 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2393 FIXME("(%p)->()\n", This);
2397 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2399 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2400 FIXME("(%p)->()\n", This);
2404 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2406 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2408 TRACE("(%p)->(%f)\n", This, v);
2410 return set_style_pos(This, STYLEID_TOP, v);
2413 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2415 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2417 TRACE("(%p)->(%p)\n", This, p);
2422 return get_nsstyle_pos(This, STYLEID_TOP, p);
2425 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2427 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2429 TRACE("(%p)->(%f)\n", This, v);
2431 return set_style_pos(This, STYLEID_LEFT, v);
2434 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2438 TRACE("(%p)->(%p)\n", This, p);
2443 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2446 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2448 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2450 TRACE("(%p)->(%f)\n", This, v);
2452 return set_style_pos(This, STYLEID_WIDTH, v);
2455 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2457 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2459 TRACE("(%p)->(%p)\n", This, p);
2464 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2470 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2472 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2474 TRACE("(%p)->(%f)\n", This, v);
2476 return set_style_pos(This, STYLEID_HEIGHT, v);
2479 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2481 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2483 TRACE("(%p)->(%p)\n", This, p);
2488 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2494 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2496 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2498 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2500 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2503 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2505 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2507 TRACE("(%p)->(%p)\n", This, p);
2509 return get_style_attr(This, STYLEID_CURSOR, p);
2512 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2514 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2516 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2518 return set_style_attr(This, STYLEID_CLIP, v, 0);
2521 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2523 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2525 TRACE("(%p)->(%p)\n", This, p);
2527 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2530 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2532 nsAString name_str, val_str, empty_str;
2535 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2537 TRACE("%s\n", debugstr_w(val));
2539 nsAString_InitDepend(&name_str, opacityW);
2540 nsAString_InitDepend(&val_str, val);
2541 nsAString_InitDepend(&empty_str, emptyW);
2543 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2544 if(NS_FAILED(nsres))
2545 ERR("SetProperty failed: %08x\n", nsres);
2547 nsAString_Finish(&name_str);
2548 nsAString_Finish(&val_str);
2549 nsAString_Finish(&empty_str);
2552 static void update_filter(HTMLStyle *This)
2554 const WCHAR *ptr = This->elem->filter, *ptr2;
2556 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2559 set_opacity(This, emptyW);
2564 while(isspaceW(*ptr))
2570 while(isalnumW(*ptr))
2573 WARN("unexpected char '%c'\n", *ptr);
2577 WARN("expected '('\n");
2581 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2582 static const WCHAR formatW[] = {'%','f',0};
2583 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2587 while(isspaceW(*ptr))
2591 while(*ptr && *ptr != ',' && *ptr != ')')
2594 WARN("unexpected end of string\n");
2598 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2599 float fval = 0.0f, e = 0.1f;
2602 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2604 while(isdigitW(*ptr2))
2605 fval = fval*10.0f + (float)(*ptr2++ - '0');
2608 while(isdigitW(*++ptr2)) {
2609 fval += e * (float)(*ptr2++ - '0');
2614 sprintfW(buf, formatW, fval * 0.01f);
2615 set_opacity(This, buf);
2617 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2622 }while(*ptr != ')');
2624 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2625 ptr = strchrW(ptr, ')');
2633 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2635 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2636 WCHAR *new_filter = NULL;
2638 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2641 FIXME("Element already destroyed\n");
2642 return E_UNEXPECTED;
2646 new_filter = heap_strdupW(v);
2648 return E_OUTOFMEMORY;
2651 heap_free(This->elem->filter);
2652 This->elem->filter = new_filter;
2654 update_filter(This);
2658 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2660 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2662 TRACE("(%p)->(%p)\n", This, p);
2665 FIXME("Element already destroyed\n");
2666 return E_UNEXPECTED;
2669 if(This->elem->filter) {
2670 *p = SysAllocString(This->elem->filter);
2672 return E_OUTOFMEMORY;
2680 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2681 VARIANT AttributeValue, LONG lFlags)
2683 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2687 TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName),
2688 debugstr_variant(&AttributeValue), lFlags);
2690 if(!strAttributeName)
2691 return E_INVALIDARG;
2694 FIXME("Parameter lFlags ignored\n");
2696 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2697 LOCALE_USER_DEFAULT, &dispid);
2701 DISPID dispidNamed = DISPID_PROPERTYPUT;
2705 params.rgvarg = &AttributeValue;
2706 params.cNamedArgs = 1;
2707 params.rgdispidNamedArgs = &dispidNamed;
2709 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2710 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2714 FIXME("Custom attributes not supported.\n");
2717 TRACE("ret: %08x\n", hres);
2722 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2723 LONG lFlags, VARIANT *AttributeValue)
2725 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2729 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2730 AttributeValue, lFlags);
2732 if(!AttributeValue || !strAttributeName)
2733 return E_INVALIDARG;
2736 FIXME("Parameter lFlags ignored\n");
2738 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2739 LOCALE_USER_DEFAULT, &dispid);
2742 DISPPARAMS params = {NULL, NULL, 0, 0 };
2744 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2745 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2749 FIXME("Custom attributes not supported.\n");
2755 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2756 LONG lFlags, VARIANT_BOOL *pfSuccess)
2758 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2759 const style_tbl_entry_t *style_entry;
2760 nsAString name_str, ret_str;
2764 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
2766 style_entry = lookup_style_tbl(strAttributeName);
2771 hres = IDispatchEx_GetDispID(&This->dispex.IDispatchEx_iface, strAttributeName,
2772 (lFlags&1) ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
2774 *pfSuccess = VARIANT_FALSE;
2778 for(i=0; i < sizeof(style_tbl)/sizeof(*style_tbl); i++) {
2779 if(dispid == style_tbl[i].dispid)
2783 if(i == sizeof(style_tbl)/sizeof(*style_tbl))
2784 return remove_prop(&This->dispex, strAttributeName, pfSuccess);
2785 style_entry = style_tbl+i;
2788 /* filter property is a special case */
2789 if(style_entry->dispid == DISPID_IHTMLSTYLE_FILTER) {
2790 *pfSuccess = This->elem->filter && *This->elem->filter ? VARIANT_TRUE : VARIANT_FALSE;
2791 heap_free(This->elem->filter);
2792 This->elem->filter = NULL;
2793 update_filter(This);
2797 nsAString_InitDepend(&name_str, style_entry->name);
2798 nsAString_Init(&ret_str, NULL);
2799 nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->nsstyle, &name_str, &ret_str);
2800 if(NS_SUCCEEDED(nsres)) {
2801 const PRUnichar *ret;
2802 nsAString_GetData(&ret_str, &ret);
2803 *pfSuccess = *ret ? VARIANT_TRUE : VARIANT_FALSE;
2805 ERR("RemoveProperty failed: %08x\n", nsres);
2807 nsAString_Finish(&name_str);
2808 nsAString_Finish(&ret_str);
2809 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
2812 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2814 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2815 FIXME("(%p)->(%p)\n", This, String);
2819 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2820 HTMLStyle_QueryInterface,
2823 HTMLStyle_GetTypeInfoCount,
2824 HTMLStyle_GetTypeInfo,
2825 HTMLStyle_GetIDsOfNames,
2827 HTMLStyle_put_fontFamily,
2828 HTMLStyle_get_fontFamily,
2829 HTMLStyle_put_fontStyle,
2830 HTMLStyle_get_fontStyle,
2831 HTMLStyle_put_fontVariant,
2832 HTMLStyle_get_fontVariant,
2833 HTMLStyle_put_fontWeight,
2834 HTMLStyle_get_fontWeight,
2835 HTMLStyle_put_fontSize,
2836 HTMLStyle_get_fontSize,
2839 HTMLStyle_put_color,
2840 HTMLStyle_get_color,
2841 HTMLStyle_put_background,
2842 HTMLStyle_get_background,
2843 HTMLStyle_put_backgroundColor,
2844 HTMLStyle_get_backgroundColor,
2845 HTMLStyle_put_backgroundImage,
2846 HTMLStyle_get_backgroundImage,
2847 HTMLStyle_put_backgroundRepeat,
2848 HTMLStyle_get_backgroundRepeat,
2849 HTMLStyle_put_backgroundAttachment,
2850 HTMLStyle_get_backgroundAttachment,
2851 HTMLStyle_put_backgroundPosition,
2852 HTMLStyle_get_backgroundPosition,
2853 HTMLStyle_put_backgroundPositionX,
2854 HTMLStyle_get_backgroundPositionX,
2855 HTMLStyle_put_backgroundPositionY,
2856 HTMLStyle_get_backgroundPositionY,
2857 HTMLStyle_put_wordSpacing,
2858 HTMLStyle_get_wordSpacing,
2859 HTMLStyle_put_letterSpacing,
2860 HTMLStyle_get_letterSpacing,
2861 HTMLStyle_put_textDecoration,
2862 HTMLStyle_get_textDecoration,
2863 HTMLStyle_put_textDecorationNone,
2864 HTMLStyle_get_textDecorationNone,
2865 HTMLStyle_put_textDecorationUnderline,
2866 HTMLStyle_get_textDecorationUnderline,
2867 HTMLStyle_put_textDecorationOverline,
2868 HTMLStyle_get_textDecorationOverline,
2869 HTMLStyle_put_textDecorationLineThrough,
2870 HTMLStyle_get_textDecorationLineThrough,
2871 HTMLStyle_put_textDecorationBlink,
2872 HTMLStyle_get_textDecorationBlink,
2873 HTMLStyle_put_verticalAlign,
2874 HTMLStyle_get_verticalAlign,
2875 HTMLStyle_put_textTransform,
2876 HTMLStyle_get_textTransform,
2877 HTMLStyle_put_textAlign,
2878 HTMLStyle_get_textAlign,
2879 HTMLStyle_put_textIndent,
2880 HTMLStyle_get_textIndent,
2881 HTMLStyle_put_lineHeight,
2882 HTMLStyle_get_lineHeight,
2883 HTMLStyle_put_marginTop,
2884 HTMLStyle_get_marginTop,
2885 HTMLStyle_put_marginRight,
2886 HTMLStyle_get_marginRight,
2887 HTMLStyle_put_marginBottom,
2888 HTMLStyle_get_marginBottom,
2889 HTMLStyle_put_marginLeft,
2890 HTMLStyle_get_marginLeft,
2891 HTMLStyle_put_margin,
2892 HTMLStyle_get_margin,
2893 HTMLStyle_put_paddingTop,
2894 HTMLStyle_get_paddingTop,
2895 HTMLStyle_put_paddingRight,
2896 HTMLStyle_get_paddingRight,
2897 HTMLStyle_put_paddingBottom,
2898 HTMLStyle_get_paddingBottom,
2899 HTMLStyle_put_paddingLeft,
2900 HTMLStyle_get_paddingLeft,
2901 HTMLStyle_put_padding,
2902 HTMLStyle_get_padding,
2903 HTMLStyle_put_border,
2904 HTMLStyle_get_border,
2905 HTMLStyle_put_borderTop,
2906 HTMLStyle_get_borderTop,
2907 HTMLStyle_put_borderRight,
2908 HTMLStyle_get_borderRight,
2909 HTMLStyle_put_borderBottom,
2910 HTMLStyle_get_borderBottom,
2911 HTMLStyle_put_borderLeft,
2912 HTMLStyle_get_borderLeft,
2913 HTMLStyle_put_borderColor,
2914 HTMLStyle_get_borderColor,
2915 HTMLStyle_put_borderTopColor,
2916 HTMLStyle_get_borderTopColor,
2917 HTMLStyle_put_borderRightColor,
2918 HTMLStyle_get_borderRightColor,
2919 HTMLStyle_put_borderBottomColor,
2920 HTMLStyle_get_borderBottomColor,
2921 HTMLStyle_put_borderLeftColor,
2922 HTMLStyle_get_borderLeftColor,
2923 HTMLStyle_put_borderWidth,
2924 HTMLStyle_get_borderWidth,
2925 HTMLStyle_put_borderTopWidth,
2926 HTMLStyle_get_borderTopWidth,
2927 HTMLStyle_put_borderRightWidth,
2928 HTMLStyle_get_borderRightWidth,
2929 HTMLStyle_put_borderBottomWidth,
2930 HTMLStyle_get_borderBottomWidth,
2931 HTMLStyle_put_borderLeftWidth,
2932 HTMLStyle_get_borderLeftWidth,
2933 HTMLStyle_put_borderStyle,
2934 HTMLStyle_get_borderStyle,
2935 HTMLStyle_put_borderTopStyle,
2936 HTMLStyle_get_borderTopStyle,
2937 HTMLStyle_put_borderRightStyle,
2938 HTMLStyle_get_borderRightStyle,
2939 HTMLStyle_put_borderBottomStyle,
2940 HTMLStyle_get_borderBottomStyle,
2941 HTMLStyle_put_borderLeftStyle,
2942 HTMLStyle_get_borderLeftStyle,
2943 HTMLStyle_put_width,
2944 HTMLStyle_get_width,
2945 HTMLStyle_put_height,
2946 HTMLStyle_get_height,
2947 HTMLStyle_put_styleFloat,
2948 HTMLStyle_get_styleFloat,
2949 HTMLStyle_put_clear,
2950 HTMLStyle_get_clear,
2951 HTMLStyle_put_display,
2952 HTMLStyle_get_display,
2953 HTMLStyle_put_visibility,
2954 HTMLStyle_get_visibility,
2955 HTMLStyle_put_listStyleType,
2956 HTMLStyle_get_listStyleType,
2957 HTMLStyle_put_listStylePosition,
2958 HTMLStyle_get_listStylePosition,
2959 HTMLStyle_put_listStyleImage,
2960 HTMLStyle_get_listStyleImage,
2961 HTMLStyle_put_listStyle,
2962 HTMLStyle_get_listStyle,
2963 HTMLStyle_put_whiteSpace,
2964 HTMLStyle_get_whiteSpace,
2969 HTMLStyle_get_position,
2970 HTMLStyle_put_zIndex,
2971 HTMLStyle_get_zIndex,
2972 HTMLStyle_put_overflow,
2973 HTMLStyle_get_overflow,
2974 HTMLStyle_put_pageBreakBefore,
2975 HTMLStyle_get_pageBreakBefore,
2976 HTMLStyle_put_pageBreakAfter,
2977 HTMLStyle_get_pageBreakAfter,
2978 HTMLStyle_put_cssText,
2979 HTMLStyle_get_cssText,
2980 HTMLStyle_put_pixelTop,
2981 HTMLStyle_get_pixelTop,
2982 HTMLStyle_put_pixelLeft,
2983 HTMLStyle_get_pixelLeft,
2984 HTMLStyle_put_pixelWidth,
2985 HTMLStyle_get_pixelWidth,
2986 HTMLStyle_put_pixelHeight,
2987 HTMLStyle_get_pixelHeight,
2988 HTMLStyle_put_posTop,
2989 HTMLStyle_get_posTop,
2990 HTMLStyle_put_posLeft,
2991 HTMLStyle_get_posLeft,
2992 HTMLStyle_put_posWidth,
2993 HTMLStyle_get_posWidth,
2994 HTMLStyle_put_posHeight,
2995 HTMLStyle_get_posHeight,
2996 HTMLStyle_put_cursor,
2997 HTMLStyle_get_cursor,
3000 HTMLStyle_put_filter,
3001 HTMLStyle_get_filter,
3002 HTMLStyle_setAttribute,
3003 HTMLStyle_getAttribute,
3004 HTMLStyle_removeAttribute,
3008 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3010 const style_tbl_entry_t *style_entry;
3012 style_entry = lookup_style_tbl(name);
3014 *dispid = style_entry->dispid;
3018 return DISP_E_UNKNOWNNAME;
3021 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3023 HTMLStyle_get_dispid,
3028 static const tid_t HTMLStyle_iface_tids[] = {
3037 static dispex_static_data_t HTMLStyle_dispex = {
3038 &HTMLStyle_dispex_vtbl,
3041 HTMLStyle_iface_tids
3044 HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret)
3046 nsIDOMElementCSSInlineStyle *nselemstyle;
3047 nsIDOMCSSStyleDeclaration *nsstyle;
3052 FIXME("NULL nselem\n");
3056 nsres = nsIDOMHTMLElement_QueryInterface(elem->nselem, &IID_nsIDOMElementCSSInlineStyle,
3057 (void**)&nselemstyle);
3058 assert(nsres == NS_OK);
3060 nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
3061 nsIDOMElementCSSInlineStyle_Release(nselemstyle);
3062 if(NS_FAILED(nsres)) {
3063 ERR("GetStyle failed: %08x\n", nsres);
3067 style = heap_alloc_zero(sizeof(HTMLStyle));
3069 nsIDOMCSSStyleDeclaration_Release(nsstyle);
3070 return E_OUTOFMEMORY;
3073 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3075 style->nsstyle = nsstyle;
3077 HTMLStyle2_Init(style);
3078 HTMLStyle3_Init(style);
3080 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3082 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);