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
30 #include "mshtml_private.h"
31 #include "htmlstyle.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 static const WCHAR attrBackground[] =
39 {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPosition[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
46 static const WCHAR attrBackgroundPositionX[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
48 static const WCHAR attrBackgroundPositionY[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
50 static const WCHAR attrBackgroundRepeat[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
52 static const WCHAR attrBorder[] =
53 {'b','o','r','d','e','r',0};
54 static const WCHAR attrBorderBottom[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
56 static const WCHAR attrBorderBottomColor[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
58 static const WCHAR attrBorderBottomStyle[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
60 static const WCHAR attrBorderBottomWidth[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
62 static const WCHAR attrBorderColor[] =
63 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
64 static const WCHAR attrBorderLeft[] =
65 {'b','o','r','d','e','r','-','l','e','f','t',0};
66 static const WCHAR attrBorderLeftColor[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
68 static const WCHAR attrBorderLeftStyle[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
70 static const WCHAR attrBorderLeftWidth[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
72 static const WCHAR attrBorderRight[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
74 static const WCHAR attrBorderRightColor[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
76 static const WCHAR attrBorderRightStyle[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
78 static const WCHAR attrBorderRightWidth[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
80 static const WCHAR attrBorderTop[] =
81 {'b','o','r','d','e','r','-','t','o','p',0};
82 static const WCHAR attrBorderTopColor[] =
83 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
84 static const WCHAR attrBorderStyle[] =
85 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopStyle[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopWidth[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
90 static const WCHAR attrBorderWidth[] =
91 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
92 static const WCHAR attrBottom[] =
93 {'b','o','t','t','o','m',0};
94 static const WCHAR attrClip[] =
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 attrPadding[] =
139 {'p','a','d','d','i','n','g',0};
140 static const WCHAR attrPaddingBottom[] =
141 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
142 static const WCHAR attrPaddingLeft[] =
143 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
144 static const WCHAR attrPaddingRight[] =
145 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
146 static const WCHAR attrPaddingTop[] =
147 {'p','a','d','d','i','n','g','-','t','o','p',0};
148 static const WCHAR attrPageBreakAfter[] =
149 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
150 static const WCHAR attrPageBreakBefore[] =
151 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
152 static const WCHAR attrPosition[] =
153 {'p','o','s','i','t','i','o','n',0};
154 static const WCHAR attrRight[] =
155 {'r','i','g','h','t',0};
156 static const WCHAR attrTextAlign[] =
157 {'t','e','x','t','-','a','l','i','g','n',0};
158 static const WCHAR attrTextDecoration[] =
159 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
160 static const WCHAR attrTextIndent[] =
161 {'t','e','x','t','-','i','n','d','e','n','t',0};
162 static const WCHAR attrTop[] =
164 static const WCHAR attrVerticalAlign[] =
165 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
166 static const WCHAR attrVisibility[] =
167 {'v','i','s','i','b','i','l','i','t','y',0};
168 static const WCHAR attrWidth[] =
169 {'w','i','d','t','h',0};
170 static const WCHAR attrWordSpacing[] =
171 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
172 static const WCHAR attrWordWrap[] =
173 {'w','o','r','d','-','w','r','a','p',0};
174 static const WCHAR attrZIndex[] =
175 {'z','-','i','n','d','e','x',0};
181 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
182 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
183 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
184 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
185 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
186 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
187 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
188 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
189 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
190 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
191 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
192 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
193 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
194 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
195 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
196 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
197 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
198 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
199 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
200 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
201 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
202 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
203 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
204 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
205 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
206 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
207 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
208 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
209 {attrClip, DISPID_IHTMLSTYLE_CLIP},
210 {attrColor, DISPID_IHTMLSTYLE_COLOR},
211 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
212 {attrDirection, DISPID_IHTMLSTYLE2_DIRECTION},
213 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
214 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
215 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
216 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
217 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
218 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
219 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
220 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
221 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
222 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
223 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
224 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
225 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
226 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
227 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
228 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
229 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
230 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
231 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
232 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
233 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
234 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
235 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
236 {attrPageBreakAfter, DISPID_IHTMLSTYLE_PAGEBREAKAFTER},
237 {attrPageBreakBefore, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE},
238 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
239 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
240 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
241 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
242 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
243 {attrTop, DISPID_IHTMLSTYLE_TOP},
244 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
245 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
246 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
247 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
248 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
249 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
252 static const WCHAR valLineThrough[] =
253 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
254 static const WCHAR valUnderline[] =
255 {'u','n','d','e','r','l','i','n','e',0};
256 static const WCHAR szNormal[] =
257 {'n','o','r','m','a','l',0};
258 static const WCHAR styleNone[] =
260 static const WCHAR valOverline[] =
261 {'o','v','e','r','l','i','n','e',0};
262 static const WCHAR valBlink[] =
263 {'b','l','i','n','k',0};
265 static const WCHAR px_formatW[] = {'%','d','p','x',0};
266 static const WCHAR emptyW[] = {0};
268 static LPWSTR fix_px_value(LPCWSTR val)
273 while(*ptr && isspaceW(*ptr))
278 while(*ptr && isdigitW(*ptr))
281 if(!*ptr || isspaceW(*ptr)) {
283 int len = strlenW(val)+1;
285 ret = heap_alloc((len+2)*sizeof(WCHAR));
286 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
292 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
297 while(*ptr && !isspaceW(*ptr))
304 static LPWSTR fix_url_value(LPCWSTR val)
308 static const WCHAR urlW[] = {'u','r','l','('};
310 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
313 ret = heap_strdupW(val);
315 for(ptr = ret; *ptr; ptr++) {
323 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
325 nsAString str_name, str_value, str_empty;
329 if(flags & ATTR_FIX_PX)
330 val = fix_px_value(value);
331 if(flags & ATTR_FIX_URL)
332 val = fix_url_value(value);
334 nsAString_InitDepend(&str_name, style_tbl[sid].name);
335 nsAString_InitDepend(&str_value, val ? val : value);
336 nsAString_InitDepend(&str_empty, emptyW);
338 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
340 ERR("SetProperty failed: %08x\n", nsres);
342 nsAString_Finish(&str_name);
343 nsAString_Finish(&str_value);
344 nsAString_Finish(&str_empty);
350 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
361 case VT_BSTR|VT_BYREF:
362 *ret = *V_BSTRREF(v);
366 static const WCHAR formatW[] = {'%','d',0};
367 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
369 if(flags & ATTR_HEX_INT)
370 wsprintfW(buf, hex_formatW, V_I4(v));
371 else if(flags & ATTR_FIX_PX)
372 wsprintfW(buf, px_formatW, V_I4(v));
374 wsprintfW(buf, formatW, V_I4(v));
380 FIXME("not implemented vt %d\n", V_VT(v));
386 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
392 hres = var_to_styleval(value, buf, flags, &val);
396 return set_nsstyle_attr(nsstyle, sid, val, flags);
399 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
401 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
404 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
409 nsAString_InitDepend(&str_name, style_tbl[sid].name);
411 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
412 if(NS_FAILED(nsres)) {
413 ERR("SetProperty failed: %08x\n", nsres);
417 nsAString_Finish(&str_name);
422 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
432 ret = SysAllocString(val);
434 return E_OUTOFMEMORY;
436 len = SysStringLen(ret);
438 if(flags & ATTR_REMOVE_COMMA) {
442 for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
448 new_ret = SysAllocStringLen(NULL, new_len);
451 return E_OUTOFMEMORY;
454 for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
468 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p, DWORD flags)
471 const PRUnichar *value;
474 nsAString_Init(&str_value, NULL);
476 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
478 nsAString_GetData(&str_value, &value);
479 hres = nsstyle_to_bstr(value, flags, p);
480 nsAString_Finish(&str_value);
482 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
486 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
489 const PRUnichar *value;
493 nsAString_Init(&str_value, NULL);
495 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
497 nsAString_GetData(&str_value, &value);
499 if(flags & ATTR_STR_TO_INT) {
500 const PRUnichar *ptr = value;
509 while(isdigitW(*ptr))
510 i = i*10 + (*ptr++ - '0');
514 V_I4(p) = neg ? -i : i;
522 hres = nsstyle_to_bstr(value, flags, &str);
523 if(SUCCEEDED(hres)) {
529 nsAString_Finish(&str_value);
531 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
535 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
537 return get_nsstyle_attr(This->nsstyle, sid, p, 0);
540 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
543 const PRUnichar *value;
545 nsAString_Init(&str_value, NULL);
547 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
549 nsAString_GetData(&str_value, &value);
550 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
551 nsAString_Finish(&str_value);
553 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
557 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
560 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
562 value = floor(value);
564 sprintfW(szValue, szFormat, value);
566 return set_style_attr(This, sid, szValue, 0);
569 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
573 WCHAR pxW[] = {'p','x',0};
575 TRACE("%p %d %p\n", This, sid, p);
579 nsAString_Init(&str_value, NULL);
581 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
585 const PRUnichar *value;
587 nsAString_GetData(&str_value, &value);
590 *p = strtolW(value, &ptr, 10);
592 if(*ptr && strcmpW(ptr, pxW))
594 nsAString_Finish(&str_value);
595 FIXME("only px values are currently supported\n");
601 TRACE("ret %f\n", *p);
603 nsAString_Finish(&str_value);
608 static BOOL is_valid_border_style(BSTR v)
610 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
611 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
612 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
613 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
614 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
615 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
616 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
617 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
619 TRACE("%s\n", debugstr_w(v));
621 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
622 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
623 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
624 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
625 strcmpiW(v, styleOutset) == 0 )
633 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
635 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
638 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
640 HTMLStyle *This = impl_from_IHTMLStyle(iface);
644 if(IsEqualGUID(&IID_IUnknown, riid)) {
645 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
646 *ppv = &This->IHTMLStyle_iface;
647 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
648 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
649 *ppv = &This->IHTMLStyle_iface;
650 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
651 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
652 *ppv = &This->IHTMLStyle2_iface;
653 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
654 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
655 *ppv = &This->IHTMLStyle3_iface;
656 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
657 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
658 *ppv = &This->IHTMLStyle4_iface;
659 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
660 return *ppv ? S_OK : E_NOINTERFACE;
664 IUnknown_AddRef((IUnknown*)*ppv);
668 WARN("unsupported %s\n", debugstr_guid(riid));
669 return E_NOINTERFACE;
672 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
674 HTMLStyle *This = impl_from_IHTMLStyle(iface);
675 LONG ref = InterlockedIncrement(&This->ref);
677 TRACE("(%p) ref=%d\n", This, ref);
682 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
684 HTMLStyle *This = impl_from_IHTMLStyle(iface);
685 LONG ref = InterlockedDecrement(&This->ref);
687 TRACE("(%p) ref=%d\n", This, ref);
691 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
692 heap_free(This->filter);
693 release_dispex(&This->dispex);
700 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
702 HTMLStyle *This = impl_from_IHTMLStyle(iface);
703 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
706 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
707 LCID lcid, ITypeInfo **ppTInfo)
709 HTMLStyle *This = impl_from_IHTMLStyle(iface);
710 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
713 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
714 LPOLESTR *rgszNames, UINT cNames,
715 LCID lcid, DISPID *rgDispId)
717 HTMLStyle *This = impl_from_IHTMLStyle(iface);
718 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
722 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
723 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
724 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
726 HTMLStyle *This = impl_from_IHTMLStyle(iface);
727 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
728 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
731 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
733 HTMLStyle *This = impl_from_IHTMLStyle(iface);
735 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
737 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
740 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
742 HTMLStyle *This = impl_from_IHTMLStyle(iface);
744 TRACE("(%p)->(%p)\n", This, p);
746 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
749 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
751 HTMLStyle *This = impl_from_IHTMLStyle(iface);
752 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
753 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
755 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
757 /* fontStyle can only be one of the follow values. */
758 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
759 strcmpiW(szOblique, v) == 0)
761 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
767 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
769 HTMLStyle *This = impl_from_IHTMLStyle(iface);
771 TRACE("(%p)->(%p)\n", This, p);
773 return get_style_attr(This, STYLEID_FONT_STYLE, p);
776 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
778 HTMLStyle *This = impl_from_IHTMLStyle(iface);
779 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
781 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
783 /* fontVariant can only be one of the follow values. */
784 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
786 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
792 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
794 HTMLStyle *This = impl_from_IHTMLStyle(iface);
795 TRACE("(%p)->(%p)\n", This, p);
800 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
803 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
805 HTMLStyle *This = impl_from_IHTMLStyle(iface);
806 static const WCHAR styleBold[] = {'b','o','l','d',0};
807 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
808 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
809 static const WCHAR style100[] = {'1','0','0',0};
810 static const WCHAR style200[] = {'2','0','0',0};
811 static const WCHAR style300[] = {'3','0','0',0};
812 static const WCHAR style400[] = {'4','0','0',0};
813 static const WCHAR style500[] = {'5','0','0',0};
814 static const WCHAR style600[] = {'6','0','0',0};
815 static const WCHAR style700[] = {'7','0','0',0};
816 static const WCHAR style800[] = {'8','0','0',0};
817 static const WCHAR style900[] = {'9','0','0',0};
819 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
821 /* fontWeight can only be one of the following */
822 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
823 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
824 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
825 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
826 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
827 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
828 strcmpiW(style900, v) == 0
831 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
837 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
841 TRACE("(%p)->(%p)\n", This, p);
843 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
846 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
848 HTMLStyle *This = impl_from_IHTMLStyle(iface);
850 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
854 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
856 FIXME("not supported vt %d\n", V_VT(&v));
862 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
864 HTMLStyle *This = impl_from_IHTMLStyle(iface);
866 TRACE("(%p)->(%p)\n", This, p);
869 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
872 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
874 HTMLStyle *This = impl_from_IHTMLStyle(iface);
875 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
879 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
881 HTMLStyle *This = impl_from_IHTMLStyle(iface);
882 FIXME("(%p)->(%p)\n", This, p);
886 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
888 HTMLStyle *This = impl_from_IHTMLStyle(iface);
890 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
894 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
895 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
898 FIXME("unsupported vt=%d\n", V_VT(&v));
904 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
906 HTMLStyle *This = impl_from_IHTMLStyle(iface);
908 TRACE("(%p)->(%p)\n", This, p);
911 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
914 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
916 HTMLStyle *This = impl_from_IHTMLStyle(iface);
918 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
920 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
923 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
925 HTMLStyle *This = impl_from_IHTMLStyle(iface);
927 TRACE("(%p)->(%p)\n", This, p);
929 return get_style_attr(This, STYLEID_BACKGROUND, p);
932 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
934 HTMLStyle *This = impl_from_IHTMLStyle(iface);
936 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
940 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
943 static const WCHAR format[] = {'#','%','0','6','x',0};
945 wsprintfW(value, format, V_I4(&v));
946 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
949 FIXME("unsupported vt %d\n", V_VT(&v));
955 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
957 HTMLStyle *This = impl_from_IHTMLStyle(iface);
958 TRACE("(%p)->(%p)\n", This, p);
961 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
964 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
966 HTMLStyle *This = impl_from_IHTMLStyle(iface);
968 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
970 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
973 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
975 HTMLStyle *This = impl_from_IHTMLStyle(iface);
977 TRACE("(%p)->(%p)\n", This, p);
979 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
982 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
984 HTMLStyle *This = impl_from_IHTMLStyle(iface);
985 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
986 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
987 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
988 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
990 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
992 /* fontWeight can only be one of the following */
993 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
994 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
996 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
1002 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
1004 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1006 TRACE("(%p)->(%p)\n", This, p);
1008 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1011 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1013 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1014 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1018 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1020 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1021 FIXME("(%p)->(%p)\n", This, p);
1025 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1027 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1029 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1031 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1034 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1036 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1038 TRACE("(%p)->(%p)\n", This, p);
1040 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1043 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1045 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1046 WCHAR buf[14], *pos_val;
1052 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1054 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1058 val_len = val ? strlenW(val) : 0;
1060 nsAString_Init(&pos_str, NULL);
1061 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1062 if(SUCCEEDED(hres)) {
1063 const PRUnichar *pos, *posy;
1066 nsAString_GetData(&pos_str, &pos);
1067 posy = strchrW(pos, ' ');
1069 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1071 TRACE("no space in %s\n", debugstr_w(pos));
1075 posy_len = strlenW(posy);
1076 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1079 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1081 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1082 pos_val[val_len+posy_len] = 0;
1084 hres = E_OUTOFMEMORY;
1087 nsAString_Finish(&pos_str);
1091 TRACE("setting position to %s\n", debugstr_w(pos_val));
1092 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1097 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1099 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1104 TRACE("(%p)->(%p)\n", This, p);
1106 nsAString_Init(&pos_str, NULL);
1107 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1108 if(SUCCEEDED(hres)) {
1109 const PRUnichar *pos, *space;
1111 nsAString_GetData(&pos_str, &pos);
1112 space = strchrW(pos, ' ');
1114 WARN("no space in %s\n", debugstr_w(pos));
1115 space = pos + strlenW(pos);
1119 ret = SysAllocStringLen(pos, space-pos);
1121 hres = E_OUTOFMEMORY;
1126 nsAString_Finish(&pos_str);
1130 TRACE("returning %s\n", debugstr_w(ret));
1136 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1138 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1139 WCHAR buf[14], *pos_val;
1145 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1147 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1151 val_len = val ? strlenW(val) : 0;
1153 nsAString_Init(&pos_str, NULL);
1154 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1155 if(SUCCEEDED(hres)) {
1156 const PRUnichar *pos, *space;
1159 nsAString_GetData(&pos_str, &pos);
1160 space = strchrW(pos, ' ');
1164 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1166 TRACE("no space in %s\n", debugstr_w(pos));
1168 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1171 posx_len = space-pos;
1173 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1175 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1177 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1178 pos_val[posx_len+val_len] = 0;
1180 hres = E_OUTOFMEMORY;
1183 nsAString_Finish(&pos_str);
1187 TRACE("setting position to %s\n", debugstr_w(pos_val));
1188 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1193 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1195 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1200 TRACE("(%p)->(%p)\n", This, p);
1202 nsAString_Init(&pos_str, NULL);
1203 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1204 if(SUCCEEDED(hres)) {
1205 const PRUnichar *pos, *posy;
1207 nsAString_GetData(&pos_str, &pos);
1208 posy = strchrW(pos, ' ');
1210 ret = SysAllocString(posy+1);
1212 hres = E_OUTOFMEMORY;
1217 nsAString_Finish(&pos_str);
1221 TRACE("returning %s\n", debugstr_w(ret));
1227 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1229 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1230 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1231 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1234 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1236 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1237 TRACE("(%p)->(%p)\n", This, p);
1238 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1241 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1243 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1244 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1245 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1248 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1250 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1251 TRACE("(%p)->(%p)\n", This, p);
1252 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1255 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1257 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1259 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1261 /* textDecoration can only be one of the following */
1262 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1263 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1264 strcmpiW(valBlink, v) == 0)
1266 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1269 return E_INVALIDARG;
1272 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1274 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1276 TRACE("(%p)->(%p)\n", This, p);
1278 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1281 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1283 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1285 TRACE("(%p)->(%x)\n", This, v);
1287 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1290 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1292 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1294 TRACE("(%p)->(%p)\n", This, p);
1296 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1299 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1301 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1303 TRACE("(%p)->(%x)\n", This, v);
1305 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1308 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1310 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1312 TRACE("(%p)->(%p)\n", This, p);
1314 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1317 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1319 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1321 TRACE("(%p)->(%x)\n", This, v);
1323 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1326 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1328 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1330 TRACE("(%p)->(%p)\n", This, p);
1332 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1335 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1337 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1339 TRACE("(%p)->(%x)\n", This, v);
1341 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1344 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1346 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1348 TRACE("(%p)->(%p)\n", This, p);
1350 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1353 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1355 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1357 TRACE("(%p)->(%x)\n", This, v);
1359 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1362 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1364 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1366 TRACE("(%p)->(%p)\n", This, p);
1368 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1371 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1373 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1375 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1379 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1381 FIXME("not implemented vt %d\n", V_VT(&v));
1388 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1390 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1394 TRACE("(%p)->(%p)\n", This, p);
1396 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1405 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1407 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1408 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1412 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1414 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1415 FIXME("(%p)->(%p)\n", This, p);
1419 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1421 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1423 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1425 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1428 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1430 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1432 TRACE("(%p)->(%p)\n", This, p);
1434 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1437 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1439 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1440 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1444 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1446 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1447 FIXME("(%p)->(%p)\n", This, p);
1451 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1453 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1454 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1458 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1460 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1461 FIXME("(%p)->(%p)\n", This, p);
1465 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1467 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1469 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1471 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1474 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1476 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1478 TRACE("(%p)->(%p)\n", This, p);
1480 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1483 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1485 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1487 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1491 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1495 wsprintfW(buf, px_formatW, V_I4(&v));
1496 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1499 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1501 FIXME("Unsupported vt=%d\n", V_VT(&v));
1507 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1509 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1510 TRACE("(%p)->(%p)\n", This, p);
1511 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1514 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1516 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1517 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1521 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1523 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1524 FIXME("(%p)->(%p)\n", This, p);
1528 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1530 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1534 TRACE("(%p)->(NULL)\n", This);
1535 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1539 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1541 wsprintfW(buf, px_formatW, V_I4(&v));
1542 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1545 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1546 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1548 FIXME("Unsupported vt=%d\n", V_VT(&v));
1554 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1556 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1558 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1560 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1563 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1565 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1567 TRACE("(%p)->(%p)\n", This, p);
1569 return get_style_attr(This, STYLEID_MARGIN, p);
1572 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1574 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1575 TRACE("(%p)->(%p)\n", This, p);
1576 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1579 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1581 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1582 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1586 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1588 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1589 FIXME("(%p)->(%p)\n", This, p);
1593 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1595 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1596 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1600 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1602 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1603 FIXME("(%p)->(%p)\n", This, p);
1607 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1609 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1610 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1614 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1616 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1617 FIXME("(%p)->(%p)\n", This, p);
1621 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1623 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1625 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1631 wsprintfW(buf, px_formatW, V_I4(&v));
1632 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1635 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1637 FIXME("unsupported vt=%d\n", V_VT(&v));
1643 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1645 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1649 TRACE("(%p)->(%p)\n", This, p);
1651 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1660 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1662 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1664 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1666 return set_style_attr(This, STYLEID_PADDING, v, 0);
1669 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1671 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1673 TRACE("(%p)->(%p)\n", This, p);
1675 return get_style_attr(This, STYLEID_PADDING, p);
1678 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1680 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1682 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1684 return set_style_attr(This, STYLEID_BORDER, v, 0);
1687 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1689 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1691 TRACE("(%p)->(%p)\n", This, p);
1693 return get_style_attr(This, STYLEID_BORDER, p);
1696 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1698 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1699 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1700 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1703 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1705 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1706 TRACE("(%p)->(%p)\n", This, p);
1707 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1710 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1712 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1713 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1714 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1717 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1719 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1720 TRACE("(%p)->(%p)\n", This, p);
1721 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1724 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1726 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1727 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1728 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1731 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1733 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1734 TRACE("(%p)->(%p)\n", This, p);
1735 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1738 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1740 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1742 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1744 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1747 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1749 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1751 TRACE("(%p)->(%p)\n", This, p);
1753 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1756 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1758 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1760 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1762 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1765 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1767 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1769 TRACE("(%p)->(%p)\n", This, p);
1771 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1774 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1776 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1778 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1780 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1783 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1785 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1787 TRACE("(%p)->(%p)\n", This, p);
1789 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1792 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1794 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1796 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1798 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1801 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1803 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1805 TRACE("(%p)->(%p)\n", This, p);
1807 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1810 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1812 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1814 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1816 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1819 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1821 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1823 TRACE("(%p)->(%p)\n", This, p);
1825 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1828 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1830 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1832 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1834 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1837 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1841 TRACE("(%p)->(%p)\n", This, p);
1843 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1846 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1848 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1849 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1850 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1853 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1855 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1856 TRACE("(%p)->(%p)\n", This, p);
1857 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1860 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1862 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1863 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1864 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1867 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1869 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1871 TRACE("(%p)->(%p)\n", This, p);
1873 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1876 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1878 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1879 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1880 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1883 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(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_RIGHT_WIDTH, p, 0);
1890 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1892 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1894 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1895 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1898 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1900 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1901 TRACE("(%p)->(%p)\n", This, p);
1902 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1905 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1907 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1908 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1909 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1912 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1914 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1915 TRACE("(%p)->(%p)\n", This, p);
1916 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1919 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1921 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1922 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1923 HRESULT hres = S_OK;
1928 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1930 while(v[i] && hres == S_OK)
1932 if(v[i] == (WCHAR)' ')
1934 pstyle = SysAllocStringLen(&v[last], (i-last));
1935 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1937 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1938 hres = E_INVALIDARG;
1940 SysFreeString(pstyle);
1948 pstyle = SysAllocStringLen(&v[last], i-last);
1949 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1951 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1952 hres = E_INVALIDARG;
1954 SysFreeString(pstyle);
1958 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1963 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1965 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1966 TRACE("(%p)->(%p)\n", This, p);
1967 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1970 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1972 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1973 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1975 if(!is_valid_border_style(v))
1976 return E_INVALIDARG;
1978 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1981 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1983 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1984 TRACE("(%p)->(%p)\n", This, p);
1985 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1988 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1990 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1991 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1993 if(!is_valid_border_style(v))
1994 return E_INVALIDARG;
1996 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1999 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
2001 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2002 TRACE("(%p)->(%p)\n", This, p);
2003 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
2006 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
2008 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2009 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2011 if(!is_valid_border_style(v))
2012 return E_INVALIDARG;
2014 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
2017 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
2019 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2020 TRACE("(%p)->(%p)\n", This, p);
2021 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
2024 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
2026 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2027 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2029 if(!is_valid_border_style(v))
2030 return E_INVALIDARG;
2032 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
2035 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
2037 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2038 TRACE("(%p)->(%p)\n", This, p);
2039 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2042 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2044 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2046 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
2048 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2051 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2053 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2055 TRACE("(%p)->(%p)\n", This, p);
2058 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
2061 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2063 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2065 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2069 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
2071 FIXME("unimplemented vt %d\n", V_VT(&v));
2078 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2080 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2084 TRACE("(%p)->(%p)\n", This, p);
2086 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
2095 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2097 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2098 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2102 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2104 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2105 FIXME("(%p)->(%p)\n", This, p);
2109 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2111 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2112 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2116 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2118 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2119 FIXME("(%p)->(%p)\n", This, p);
2123 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2125 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2127 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2129 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2132 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2134 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2136 TRACE("(%p)->(%p)\n", This, p);
2138 return get_style_attr(This, STYLEID_DISPLAY, p);
2141 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2143 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2145 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2147 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2150 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2152 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2154 TRACE("(%p)->(%p)\n", This, p);
2156 return get_style_attr(This, STYLEID_VISIBILITY, p);
2159 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2161 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2162 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2166 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2168 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2169 FIXME("(%p)->(%p)\n", This, p);
2173 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2175 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2176 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2180 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2182 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2183 FIXME("(%p)->(%p)\n", This, p);
2187 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2189 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2190 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2194 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2196 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2197 FIXME("(%p)->(%p)\n", This, p);
2201 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2203 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2204 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2208 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2210 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2211 FIXME("(%p)->(%p)\n", This, p);
2215 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2217 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2218 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2222 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2224 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2225 FIXME("(%p)->(%p)\n", This, p);
2229 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2231 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2233 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2235 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2238 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2240 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2244 TRACE("(%p)->(%p)\n", This, p);
2246 hres = get_style_attr(This, STYLEID_TOP, &ret);
2255 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2257 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2259 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2261 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2264 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2266 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2270 TRACE("(%p)->(%p)\n", This, p);
2272 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2281 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2283 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2284 TRACE("(%p)->(%p)\n", This, p);
2285 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2288 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2290 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2292 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2296 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2299 static const WCHAR format[] = {'%','d',0};
2301 wsprintfW(value, format, V_I4(&v));
2302 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2305 FIXME("unimplemented vt %d\n", V_VT(&v));
2312 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2314 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2316 TRACE("(%p)->(%p)\n", This, p);
2318 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2321 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2323 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2324 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2325 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2326 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2327 static const WCHAR szAuto[] = {'a','u','t','o',0};
2329 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2331 /* overflow can only be one of the follow values. */
2332 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2333 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2335 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2338 return E_INVALIDARG;
2342 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2344 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2346 TRACE("(%p)->(%p)\n", This, p);
2349 return E_INVALIDARG;
2351 return get_style_attr(This, STYLEID_OVERFLOW, p);
2354 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2356 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2358 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2360 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, v, 0);
2363 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2365 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2367 TRACE("(%p)->(%p)\n", This, p);
2369 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, p, 0);
2372 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2374 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2376 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2378 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, v, 0);
2381 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2383 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2385 TRACE("(%p)->(%p)\n", This, p);
2387 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, p, 0);
2390 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2392 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2396 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2398 nsAString_InitDepend(&text_str, v);
2399 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2400 nsAString_Finish(&text_str);
2401 if(NS_FAILED(nsres)) {
2402 FIXME("SetCssStyle failed: %08x\n", nsres);
2409 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2411 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2415 TRACE("(%p)->(%p)\n", This, p);
2417 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2418 nsAString_Init(&text_str, NULL);
2419 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2420 if(NS_SUCCEEDED(nsres)) {
2421 const PRUnichar *text;
2423 nsAString_GetData(&text_str, &text);
2424 *p = *text ? SysAllocString(text) : NULL;
2426 FIXME("GetCssStyle failed: %08x\n", nsres);
2430 nsAString_Finish(&text_str);
2434 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2437 FIXME("(%p)->()\n", This);
2441 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2443 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2444 FIXME("(%p)->()\n", This);
2448 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2450 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2451 FIXME("(%p)->()\n", This);
2455 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2457 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2458 FIXME("(%p)->()\n", This);
2462 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2464 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2465 FIXME("(%p)->()\n", This);
2469 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2471 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2472 FIXME("(%p)->()\n", This);
2476 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2478 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2479 FIXME("(%p)->()\n", This);
2483 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2485 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2486 FIXME("(%p)->()\n", This);
2490 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2492 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2494 TRACE("(%p)->(%f)\n", This, v);
2496 return set_style_pos(This, STYLEID_TOP, v);
2499 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2501 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2503 TRACE("(%p)->(%p)\n", This, p);
2508 return get_nsstyle_pos(This, STYLEID_TOP, p);
2511 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2513 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2515 TRACE("(%p)->(%f)\n", This, v);
2517 return set_style_pos(This, STYLEID_LEFT, v);
2520 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2522 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2524 TRACE("(%p)->(%p)\n", This, p);
2529 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2532 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2534 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2536 TRACE("(%p)->(%f)\n", This, v);
2538 return set_style_pos(This, STYLEID_WIDTH, v);
2541 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2543 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2545 TRACE("(%p)->(%p)\n", This, p);
2550 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2556 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2558 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2560 TRACE("(%p)->(%f)\n", This, v);
2562 return set_style_pos(This, STYLEID_HEIGHT, v);
2565 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2567 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2569 TRACE("(%p)->(%p)\n", This, p);
2574 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2580 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2582 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2584 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2586 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2589 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2591 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2593 TRACE("(%p)->(%p)\n", This, p);
2595 return get_style_attr(This, STYLEID_CURSOR, p);
2598 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2600 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2602 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2604 return set_style_attr(This, STYLEID_CLIP, v, 0);
2607 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2609 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2611 TRACE("(%p)->(%p)\n", This, p);
2613 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2616 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2618 nsAString name_str, val_str, empty_str;
2621 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2623 TRACE("%s\n", debugstr_w(val));
2625 nsAString_InitDepend(&name_str, opacityW);
2626 nsAString_InitDepend(&val_str, val);
2627 nsAString_InitDepend(&empty_str, emptyW);
2629 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2630 if(NS_FAILED(nsres))
2631 ERR("SetProperty failed: %08x\n", nsres);
2633 nsAString_Finish(&name_str);
2634 nsAString_Finish(&val_str);
2635 nsAString_Finish(&empty_str);
2638 static void update_filter(HTMLStyle *This)
2640 const WCHAR *ptr = This->filter, *ptr2;
2642 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2645 set_opacity(This, emptyW);
2650 while(isspaceW(*ptr))
2656 while(isalnumW(*ptr))
2659 WARN("unexpected char '%c'\n", *ptr);
2663 WARN("expected '('\n");
2667 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2668 static const WCHAR formatW[] = {'%','f',0};
2669 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2673 while(isspaceW(*ptr))
2677 while(*ptr && *ptr != ',' && *ptr != ')')
2680 WARN("unexpected end of string\n");
2684 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2685 float fval = 0.0f, e = 0.1f;
2688 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2690 while(isdigitW(*ptr2))
2691 fval = fval*10.0f + (float)(*ptr2++ - '0');
2694 while(isdigitW(*++ptr2)) {
2695 fval += e * (float)(*ptr2++ - '0');
2700 sprintfW(buf, formatW, fval * 0.01f);
2701 set_opacity(This, buf);
2703 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2708 }while(*ptr != ')');
2710 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2711 ptr = strchrW(ptr, ')');
2719 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2721 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2722 WCHAR *new_filter = NULL;
2724 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2727 new_filter = heap_strdupW(v);
2729 return E_OUTOFMEMORY;
2732 heap_free(This->filter);
2733 This->filter = new_filter;
2735 update_filter(This);
2739 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2741 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2743 TRACE("(%p)->(%p)\n", This, p);
2746 *p = SysAllocString(This->filter);
2748 return E_OUTOFMEMORY;
2756 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2757 VARIANT AttributeValue, LONG lFlags)
2759 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2763 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2764 V_VT(&AttributeValue), lFlags);
2766 if(!strAttributeName)
2767 return E_INVALIDARG;
2770 FIXME("Parameter lFlags ignored\n");
2772 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2773 LOCALE_USER_DEFAULT, &dispid);
2777 DISPID dispidNamed = DISPID_PROPERTYPUT;
2781 params.rgvarg = &AttributeValue;
2782 params.cNamedArgs = 1;
2783 params.rgdispidNamedArgs = &dispidNamed;
2785 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2786 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2790 FIXME("Custom attributes not supported.\n");
2793 TRACE("ret: %08x\n", hres);
2798 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2799 LONG lFlags, VARIANT *AttributeValue)
2801 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2805 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2806 AttributeValue, lFlags);
2808 if(!AttributeValue || !strAttributeName)
2809 return E_INVALIDARG;
2812 FIXME("Parameter lFlags ignored\n");
2814 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2815 LOCALE_USER_DEFAULT, &dispid);
2818 DISPPARAMS params = {NULL, NULL, 0, 0 };
2820 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2821 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2825 FIXME("Custom attributes not supported.\n");
2831 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2832 LONG lFlags, VARIANT_BOOL *pfSuccess)
2834 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2835 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2840 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2842 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2843 FIXME("(%p)->(%p)\n", This, String);
2847 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2848 HTMLStyle_QueryInterface,
2851 HTMLStyle_GetTypeInfoCount,
2852 HTMLStyle_GetTypeInfo,
2853 HTMLStyle_GetIDsOfNames,
2855 HTMLStyle_put_fontFamily,
2856 HTMLStyle_get_fontFamily,
2857 HTMLStyle_put_fontStyle,
2858 HTMLStyle_get_fontStyle,
2859 HTMLStyle_put_fontVariant,
2860 HTMLStyle_get_fontVariant,
2861 HTMLStyle_put_fontWeight,
2862 HTMLStyle_get_fontWeight,
2863 HTMLStyle_put_fontSize,
2864 HTMLStyle_get_fontSize,
2867 HTMLStyle_put_color,
2868 HTMLStyle_get_color,
2869 HTMLStyle_put_background,
2870 HTMLStyle_get_background,
2871 HTMLStyle_put_backgroundColor,
2872 HTMLStyle_get_backgroundColor,
2873 HTMLStyle_put_backgroundImage,
2874 HTMLStyle_get_backgroundImage,
2875 HTMLStyle_put_backgroundRepeat,
2876 HTMLStyle_get_backgroundRepeat,
2877 HTMLStyle_put_backgroundAttachment,
2878 HTMLStyle_get_backgroundAttachment,
2879 HTMLStyle_put_backgroundPosition,
2880 HTMLStyle_get_backgroundPosition,
2881 HTMLStyle_put_backgroundPositionX,
2882 HTMLStyle_get_backgroundPositionX,
2883 HTMLStyle_put_backgroundPositionY,
2884 HTMLStyle_get_backgroundPositionY,
2885 HTMLStyle_put_wordSpacing,
2886 HTMLStyle_get_wordSpacing,
2887 HTMLStyle_put_letterSpacing,
2888 HTMLStyle_get_letterSpacing,
2889 HTMLStyle_put_textDecoration,
2890 HTMLStyle_get_textDecoration,
2891 HTMLStyle_put_textDecorationNone,
2892 HTMLStyle_get_textDecorationNone,
2893 HTMLStyle_put_textDecorationUnderline,
2894 HTMLStyle_get_textDecorationUnderline,
2895 HTMLStyle_put_textDecorationOverline,
2896 HTMLStyle_get_textDecorationOverline,
2897 HTMLStyle_put_textDecorationLineThrough,
2898 HTMLStyle_get_textDecorationLineThrough,
2899 HTMLStyle_put_textDecorationBlink,
2900 HTMLStyle_get_textDecorationBlink,
2901 HTMLStyle_put_verticalAlign,
2902 HTMLStyle_get_verticalAlign,
2903 HTMLStyle_put_textTransform,
2904 HTMLStyle_get_textTransform,
2905 HTMLStyle_put_textAlign,
2906 HTMLStyle_get_textAlign,
2907 HTMLStyle_put_textIndent,
2908 HTMLStyle_get_textIndent,
2909 HTMLStyle_put_lineHeight,
2910 HTMLStyle_get_lineHeight,
2911 HTMLStyle_put_marginTop,
2912 HTMLStyle_get_marginTop,
2913 HTMLStyle_put_marginRight,
2914 HTMLStyle_get_marginRight,
2915 HTMLStyle_put_marginBottom,
2916 HTMLStyle_get_marginBottom,
2917 HTMLStyle_put_marginLeft,
2918 HTMLStyle_get_marginLeft,
2919 HTMLStyle_put_margin,
2920 HTMLStyle_get_margin,
2921 HTMLStyle_put_paddingTop,
2922 HTMLStyle_get_paddingTop,
2923 HTMLStyle_put_paddingRight,
2924 HTMLStyle_get_paddingRight,
2925 HTMLStyle_put_paddingBottom,
2926 HTMLStyle_get_paddingBottom,
2927 HTMLStyle_put_paddingLeft,
2928 HTMLStyle_get_paddingLeft,
2929 HTMLStyle_put_padding,
2930 HTMLStyle_get_padding,
2931 HTMLStyle_put_border,
2932 HTMLStyle_get_border,
2933 HTMLStyle_put_borderTop,
2934 HTMLStyle_get_borderTop,
2935 HTMLStyle_put_borderRight,
2936 HTMLStyle_get_borderRight,
2937 HTMLStyle_put_borderBottom,
2938 HTMLStyle_get_borderBottom,
2939 HTMLStyle_put_borderLeft,
2940 HTMLStyle_get_borderLeft,
2941 HTMLStyle_put_borderColor,
2942 HTMLStyle_get_borderColor,
2943 HTMLStyle_put_borderTopColor,
2944 HTMLStyle_get_borderTopColor,
2945 HTMLStyle_put_borderRightColor,
2946 HTMLStyle_get_borderRightColor,
2947 HTMLStyle_put_borderBottomColor,
2948 HTMLStyle_get_borderBottomColor,
2949 HTMLStyle_put_borderLeftColor,
2950 HTMLStyle_get_borderLeftColor,
2951 HTMLStyle_put_borderWidth,
2952 HTMLStyle_get_borderWidth,
2953 HTMLStyle_put_borderTopWidth,
2954 HTMLStyle_get_borderTopWidth,
2955 HTMLStyle_put_borderRightWidth,
2956 HTMLStyle_get_borderRightWidth,
2957 HTMLStyle_put_borderBottomWidth,
2958 HTMLStyle_get_borderBottomWidth,
2959 HTMLStyle_put_borderLeftWidth,
2960 HTMLStyle_get_borderLeftWidth,
2961 HTMLStyle_put_borderStyle,
2962 HTMLStyle_get_borderStyle,
2963 HTMLStyle_put_borderTopStyle,
2964 HTMLStyle_get_borderTopStyle,
2965 HTMLStyle_put_borderRightStyle,
2966 HTMLStyle_get_borderRightStyle,
2967 HTMLStyle_put_borderBottomStyle,
2968 HTMLStyle_get_borderBottomStyle,
2969 HTMLStyle_put_borderLeftStyle,
2970 HTMLStyle_get_borderLeftStyle,
2971 HTMLStyle_put_width,
2972 HTMLStyle_get_width,
2973 HTMLStyle_put_height,
2974 HTMLStyle_get_height,
2975 HTMLStyle_put_styleFloat,
2976 HTMLStyle_get_styleFloat,
2977 HTMLStyle_put_clear,
2978 HTMLStyle_get_clear,
2979 HTMLStyle_put_display,
2980 HTMLStyle_get_display,
2981 HTMLStyle_put_visibility,
2982 HTMLStyle_get_visibility,
2983 HTMLStyle_put_listStyleType,
2984 HTMLStyle_get_listStyleType,
2985 HTMLStyle_put_listStylePosition,
2986 HTMLStyle_get_listStylePosition,
2987 HTMLStyle_put_listStyleImage,
2988 HTMLStyle_get_listStyleImage,
2989 HTMLStyle_put_listStyle,
2990 HTMLStyle_get_listStyle,
2991 HTMLStyle_put_whiteSpace,
2992 HTMLStyle_get_whiteSpace,
2997 HTMLStyle_get_position,
2998 HTMLStyle_put_zIndex,
2999 HTMLStyle_get_zIndex,
3000 HTMLStyle_put_overflow,
3001 HTMLStyle_get_overflow,
3002 HTMLStyle_put_pageBreakBefore,
3003 HTMLStyle_get_pageBreakBefore,
3004 HTMLStyle_put_pageBreakAfter,
3005 HTMLStyle_get_pageBreakAfter,
3006 HTMLStyle_put_cssText,
3007 HTMLStyle_get_cssText,
3008 HTMLStyle_put_pixelTop,
3009 HTMLStyle_get_pixelTop,
3010 HTMLStyle_put_pixelLeft,
3011 HTMLStyle_get_pixelLeft,
3012 HTMLStyle_put_pixelWidth,
3013 HTMLStyle_get_pixelWidth,
3014 HTMLStyle_put_pixelHeight,
3015 HTMLStyle_get_pixelHeight,
3016 HTMLStyle_put_posTop,
3017 HTMLStyle_get_posTop,
3018 HTMLStyle_put_posLeft,
3019 HTMLStyle_get_posLeft,
3020 HTMLStyle_put_posWidth,
3021 HTMLStyle_get_posWidth,
3022 HTMLStyle_put_posHeight,
3023 HTMLStyle_get_posHeight,
3024 HTMLStyle_put_cursor,
3025 HTMLStyle_get_cursor,
3028 HTMLStyle_put_filter,
3029 HTMLStyle_get_filter,
3030 HTMLStyle_setAttribute,
3031 HTMLStyle_getAttribute,
3032 HTMLStyle_removeAttribute,
3036 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3038 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
3043 c = strcmpW(style_tbl[i].name, name);
3045 *dispid = style_tbl[i].dispid;
3055 return DISP_E_UNKNOWNNAME;
3058 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3060 HTMLStyle_get_dispid,
3064 static const tid_t HTMLStyle_iface_tids[] = {
3071 static dispex_static_data_t HTMLStyle_dispex = {
3072 &HTMLStyle_dispex_vtbl,
3075 HTMLStyle_iface_tids
3078 HRESULT HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret)
3082 style = heap_alloc_zero(sizeof(HTMLStyle));
3084 return E_OUTOFMEMORY;
3086 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3088 style->nsstyle = nsstyle;
3089 HTMLStyle2_Init(style);
3090 HTMLStyle3_Init(style);
3092 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3094 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);