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 attrColor[] =
95 {'c','o','l','o','r',0};
96 static const WCHAR attrCursor[] =
97 {'c','u','r','s','o','r',0};
98 static const WCHAR attrDisplay[] =
99 {'d','i','s','p','l','a','y',0};
100 static const WCHAR attrFilter[] =
101 {'f','i','l','e','t','e','r',0};
102 static const WCHAR attrFontFamily[] =
103 {'f','o','n','t','-','f','a','m','i','l','y',0};
104 static const WCHAR attrFontSize[] =
105 {'f','o','n','t','-','s','i','z','e',0};
106 static const WCHAR attrFontStyle[] =
107 {'f','o','n','t','-','s','t','y','l','e',0};
108 static const WCHAR attrFontVariant[] =
109 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
110 static const WCHAR attrFontWeight[] =
111 {'f','o','n','t','-','w','e','i','g','h','t',0};
112 static const WCHAR attrHeight[] =
113 {'h','e','i','g','h','t',0};
114 static const WCHAR attrLeft[] =
116 static const WCHAR attrLetterSpacing[] =
117 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
118 static const WCHAR attrLineHeight[] =
119 {'l','i','n','e','-','h','e','i','g','h','t',0};
120 static const WCHAR attrMargin[] =
121 {'m','a','r','g','i','n',0};
122 static const WCHAR attrMarginBottom[] =
123 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
124 static const WCHAR attrMarginLeft[] =
125 {'m','a','r','g','i','n','-','l','e','f','t',0};
126 static const WCHAR attrMarginRight[] =
127 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
128 static const WCHAR attrMarginTop[] =
129 {'m','a','r','g','i','n','-','t','o','p',0};
130 static const WCHAR attrMinHeight[] =
131 {'m','i','n','-','h','e','i','g','h','t',0};
132 static const WCHAR attrOverflow[] =
133 {'o','v','e','r','f','l','o','w',0};
134 static const WCHAR attrPadding[] =
135 {'p','a','d','d','i','n','g',0};
136 static const WCHAR attrPaddingBottom[] =
137 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
138 static const WCHAR attrPaddingLeft[] =
139 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
140 static const WCHAR attrPaddingRight[] =
141 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
142 static const WCHAR attrPaddingTop[] =
143 {'p','a','d','d','i','n','g','-','t','o','p',0};
144 static const WCHAR attrPosition[] =
145 {'p','o','s','i','t','i','o','n',0};
146 static const WCHAR attrRight[] =
147 {'r','i','g','h','t',0};
148 static const WCHAR attrTextAlign[] =
149 {'t','e','x','t','-','a','l','i','g','n',0};
150 static const WCHAR attrTextDecoration[] =
151 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
152 static const WCHAR attrTextIndent[] =
153 {'t','e','x','t','-','i','n','d','e','n','t',0};
154 static const WCHAR attrTop[] =
156 static const WCHAR attrVerticalAlign[] =
157 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
158 static const WCHAR attrVisibility[] =
159 {'v','i','s','i','b','i','l','i','t','y',0};
160 static const WCHAR attrWidth[] =
161 {'w','i','d','t','h',0};
162 static const WCHAR attrWordSpacing[] =
163 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
164 static const WCHAR attrWordWrap[] =
165 {'w','o','r','d','-','w','r','a','p',0};
166 static const WCHAR attrZIndex[] =
167 {'z','-','i','n','d','e','x',0};
173 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
174 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
175 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
176 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
177 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
178 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
179 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
180 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
181 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
182 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
183 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
184 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
185 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
186 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
187 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
188 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
189 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
190 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
191 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
192 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
193 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
194 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
195 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
196 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
197 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
198 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
199 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
200 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
201 {attrColor, DISPID_IHTMLSTYLE_COLOR},
202 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
203 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
204 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
205 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
206 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
207 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
208 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
209 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
210 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
211 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
212 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
213 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
214 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
215 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
216 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
217 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
218 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
219 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
220 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
221 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
222 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
223 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
224 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
225 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
226 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
227 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
228 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
229 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
230 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
231 {attrTop, DISPID_IHTMLSTYLE_TOP},
232 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
233 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
234 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
235 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
236 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
237 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
240 static const WCHAR valLineThrough[] =
241 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
242 static const WCHAR valUnderline[] =
243 {'u','n','d','e','r','l','i','n','e',0};
244 static const WCHAR szNormal[] =
245 {'n','o','r','m','a','l',0};
246 static const WCHAR styleNone[] =
248 static const WCHAR valOverline[] =
249 {'o','v','e','r','l','i','n','e',0};
250 static const WCHAR valBlink[] =
251 {'b','l','i','n','k',0};
253 static const WCHAR px_formatW[] = {'%','d','p','x',0};
254 static const WCHAR emptyW[] = {0};
256 static LPWSTR fix_px_value(LPCWSTR val)
261 while(*ptr && isspaceW(*ptr))
266 while(*ptr && isdigitW(*ptr))
269 if(!*ptr || isspaceW(*ptr)) {
271 int len = strlenW(val)+1;
273 ret = heap_alloc((len+2)*sizeof(WCHAR));
274 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
280 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
285 while(*ptr && !isspaceW(*ptr))
292 static LPWSTR fix_url_value(LPCWSTR val)
296 static const WCHAR urlW[] = {'u','r','l','('};
298 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
301 ret = heap_strdupW(val);
303 for(ptr = ret; *ptr; ptr++) {
311 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
313 nsAString str_name, str_value, str_empty;
317 if(flags & ATTR_FIX_PX)
318 val = fix_px_value(value);
319 if(flags & ATTR_FIX_URL)
320 val = fix_url_value(value);
322 nsAString_InitDepend(&str_name, style_tbl[sid].name);
323 nsAString_InitDepend(&str_value, val ? val : value);
324 nsAString_InitDepend(&str_empty, emptyW);
326 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
328 ERR("SetProperty failed: %08x\n", nsres);
330 nsAString_Finish(&str_name);
331 nsAString_Finish(&str_value);
332 nsAString_Finish(&str_empty);
338 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
349 case VT_BSTR|VT_BYREF:
350 *ret = *V_BSTRREF(v);
354 static const WCHAR formatW[] = {'%','d',0};
355 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
357 if(flags & ATTR_HEX_INT)
358 wsprintfW(buf, hex_formatW, V_I4(v));
359 else if(flags & ATTR_FIX_PX)
360 wsprintfW(buf, px_formatW, V_I4(v));
362 wsprintfW(buf, formatW, V_I4(v));
368 FIXME("not implemented vt %d\n", V_VT(v));
374 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
380 hres = var_to_styleval(value, buf, flags, &val);
384 return set_nsstyle_attr(nsstyle, sid, val, flags);
387 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
389 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
392 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
397 nsAString_InitDepend(&str_name, style_tbl[sid].name);
399 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
400 if(NS_FAILED(nsres)) {
401 ERR("SetProperty failed: %08x\n", nsres);
405 nsAString_Finish(&str_name);
410 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
419 ret = SysAllocString(val);
421 return E_OUTOFMEMORY;
427 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
430 const PRUnichar *value;
433 nsAString_Init(&str_value, NULL);
435 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
437 nsAString_GetData(&str_value, &value);
438 hres = nsstyle_to_bstr(value, 0, p);
439 nsAString_Finish(&str_value);
441 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
445 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
448 const PRUnichar *value;
452 nsAString_Init(&str_value, NULL);
454 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
456 nsAString_GetData(&str_value, &value);
458 if(flags & ATTR_STR_TO_INT) {
459 const PRUnichar *ptr = value;
468 while(isdigitW(*ptr))
469 i = i*10 + (*ptr++ - '0');
473 V_I4(p) = neg ? -i : i;
481 hres = nsstyle_to_bstr(value, flags, &str);
482 if(SUCCEEDED(hres)) {
488 nsAString_Finish(&str_value);
490 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
494 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
496 return get_nsstyle_attr(This->nsstyle, sid, p);
499 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
502 const PRUnichar *value;
504 nsAString_Init(&str_value, NULL);
506 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
508 nsAString_GetData(&str_value, &value);
509 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
510 nsAString_Finish(&str_value);
512 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
516 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
519 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
521 value = floor(value);
523 sprintfW(szValue, szFormat, value);
525 return set_style_attr(This, sid, szValue, 0);
528 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
532 WCHAR pxW[] = {'p','x',0};
534 TRACE("%p %d %p\n", This, sid, p);
538 nsAString_Init(&str_value, NULL);
540 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
544 const PRUnichar *value;
546 nsAString_GetData(&str_value, &value);
549 *p = strtolW(value, &ptr, 10);
551 if(*ptr && strcmpW(ptr, pxW))
553 nsAString_Finish(&str_value);
554 FIXME("only px values are currently supported\n");
560 TRACE("ret %f\n", *p);
562 nsAString_Finish(&str_value);
567 static BOOL is_valid_border_style(BSTR v)
569 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
570 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
571 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
572 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
573 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
574 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
575 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
576 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
578 TRACE("%s\n", debugstr_w(v));
580 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
581 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
582 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
583 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
584 strcmpiW(v, styleOutset) == 0 )
592 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
594 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
597 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
599 HTMLStyle *This = impl_from_IHTMLStyle(iface);
603 if(IsEqualGUID(&IID_IUnknown, riid)) {
604 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
605 *ppv = &This->IHTMLStyle_iface;
606 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
607 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
608 *ppv = &This->IHTMLStyle_iface;
609 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
610 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
611 *ppv = &This->IHTMLStyle2_iface;
612 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
613 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
614 *ppv = &This->IHTMLStyle3_iface;
615 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
616 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
617 *ppv = &This->IHTMLStyle4_iface;
618 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
619 return *ppv ? S_OK : E_NOINTERFACE;
623 IUnknown_AddRef((IUnknown*)*ppv);
627 WARN("unsupported %s\n", debugstr_guid(riid));
628 return E_NOINTERFACE;
631 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
633 HTMLStyle *This = impl_from_IHTMLStyle(iface);
634 LONG ref = InterlockedIncrement(&This->ref);
636 TRACE("(%p) ref=%d\n", This, ref);
641 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
643 HTMLStyle *This = impl_from_IHTMLStyle(iface);
644 LONG ref = InterlockedDecrement(&This->ref);
646 TRACE("(%p) ref=%d\n", This, ref);
650 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
651 heap_free(This->filter);
652 release_dispex(&This->dispex);
659 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
661 HTMLStyle *This = impl_from_IHTMLStyle(iface);
662 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
665 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
666 LCID lcid, ITypeInfo **ppTInfo)
668 HTMLStyle *This = impl_from_IHTMLStyle(iface);
669 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
672 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
673 LPOLESTR *rgszNames, UINT cNames,
674 LCID lcid, DISPID *rgDispId)
676 HTMLStyle *This = impl_from_IHTMLStyle(iface);
677 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
681 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
682 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
683 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
685 HTMLStyle *This = impl_from_IHTMLStyle(iface);
686 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
687 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
690 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
692 HTMLStyle *This = impl_from_IHTMLStyle(iface);
694 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
696 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
699 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
701 HTMLStyle *This = impl_from_IHTMLStyle(iface);
703 TRACE("(%p)->(%p)\n", This, p);
705 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
708 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
710 HTMLStyle *This = impl_from_IHTMLStyle(iface);
711 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
712 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
714 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
716 /* fontStyle can only be one of the follow values. */
717 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
718 strcmpiW(szOblique, v) == 0)
720 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
726 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
728 HTMLStyle *This = impl_from_IHTMLStyle(iface);
730 TRACE("(%p)->(%p)\n", This, p);
732 return get_style_attr(This, STYLEID_FONT_STYLE, p);
735 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
737 HTMLStyle *This = impl_from_IHTMLStyle(iface);
738 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
740 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
742 /* fontVariant can only be one of the follow values. */
743 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
745 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
751 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
753 HTMLStyle *This = impl_from_IHTMLStyle(iface);
754 TRACE("(%p)->(%p)\n", This, p);
759 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
762 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
764 HTMLStyle *This = impl_from_IHTMLStyle(iface);
765 static const WCHAR styleBold[] = {'b','o','l','d',0};
766 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
767 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
768 static const WCHAR style100[] = {'1','0','0',0};
769 static const WCHAR style200[] = {'2','0','0',0};
770 static const WCHAR style300[] = {'3','0','0',0};
771 static const WCHAR style400[] = {'4','0','0',0};
772 static const WCHAR style500[] = {'5','0','0',0};
773 static const WCHAR style600[] = {'6','0','0',0};
774 static const WCHAR style700[] = {'7','0','0',0};
775 static const WCHAR style800[] = {'8','0','0',0};
776 static const WCHAR style900[] = {'9','0','0',0};
778 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
780 /* fontWeight can only be one of the following */
781 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
782 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
783 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
784 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
785 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
786 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
787 strcmpiW(style900, v) == 0
790 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
796 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
798 HTMLStyle *This = impl_from_IHTMLStyle(iface);
800 TRACE("(%p)->(%p)\n", This, p);
802 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
805 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
807 HTMLStyle *This = impl_from_IHTMLStyle(iface);
809 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
813 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
815 FIXME("not supported vt %d\n", V_VT(&v));
821 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
823 HTMLStyle *This = impl_from_IHTMLStyle(iface);
825 TRACE("(%p)->(%p)\n", This, p);
828 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
831 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
833 HTMLStyle *This = impl_from_IHTMLStyle(iface);
834 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
838 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
840 HTMLStyle *This = impl_from_IHTMLStyle(iface);
841 FIXME("(%p)->(%p)\n", This, p);
845 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
847 HTMLStyle *This = impl_from_IHTMLStyle(iface);
849 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
853 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
854 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
857 FIXME("unsupported vt=%d\n", V_VT(&v));
863 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
865 HTMLStyle *This = impl_from_IHTMLStyle(iface);
867 TRACE("(%p)->(%p)\n", This, p);
870 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
873 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
875 HTMLStyle *This = impl_from_IHTMLStyle(iface);
877 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
879 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
882 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
884 HTMLStyle *This = impl_from_IHTMLStyle(iface);
886 TRACE("(%p)->(%p)\n", This, p);
888 return get_style_attr(This, STYLEID_BACKGROUND, p);
891 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
893 HTMLStyle *This = impl_from_IHTMLStyle(iface);
895 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
899 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
902 static const WCHAR format[] = {'#','%','0','6','x',0};
904 wsprintfW(value, format, V_I4(&v));
905 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
908 FIXME("unsupported vt %d\n", V_VT(&v));
914 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
916 HTMLStyle *This = impl_from_IHTMLStyle(iface);
917 TRACE("(%p)->(%p)\n", This, p);
920 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
923 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
925 HTMLStyle *This = impl_from_IHTMLStyle(iface);
927 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
929 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
932 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
934 HTMLStyle *This = impl_from_IHTMLStyle(iface);
936 TRACE("(%p)->(%p)\n", This, p);
938 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
941 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
943 HTMLStyle *This = impl_from_IHTMLStyle(iface);
944 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
945 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
946 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
947 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
949 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
951 /* fontWeight can only be one of the following */
952 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
953 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
955 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
961 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
963 HTMLStyle *This = impl_from_IHTMLStyle(iface);
965 TRACE("(%p)->(%p)\n", This, p);
967 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
970 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
972 HTMLStyle *This = impl_from_IHTMLStyle(iface);
973 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
977 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
979 HTMLStyle *This = impl_from_IHTMLStyle(iface);
980 FIXME("(%p)->(%p)\n", This, p);
984 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
986 HTMLStyle *This = impl_from_IHTMLStyle(iface);
988 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
990 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
993 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
995 HTMLStyle *This = impl_from_IHTMLStyle(iface);
997 TRACE("(%p)->(%p)\n", This, p);
999 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1002 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1004 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1005 WCHAR buf[14], *pos_val;
1011 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1013 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1017 val_len = val ? strlenW(val) : 0;
1019 nsAString_Init(&pos_str, NULL);
1020 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1021 if(SUCCEEDED(hres)) {
1022 const PRUnichar *pos, *posy;
1025 nsAString_GetData(&pos_str, &pos);
1026 posy = strchrW(pos, ' ');
1028 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1030 TRACE("no space in %s\n", debugstr_w(pos));
1034 posy_len = strlenW(posy);
1035 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1038 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1040 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1041 pos_val[val_len+posy_len] = 0;
1043 hres = E_OUTOFMEMORY;
1046 nsAString_Finish(&pos_str);
1050 TRACE("setting position to %s\n", debugstr_w(pos_val));
1051 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1056 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1058 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1063 TRACE("(%p)->(%p)\n", This, p);
1065 nsAString_Init(&pos_str, NULL);
1066 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1067 if(SUCCEEDED(hres)) {
1068 const PRUnichar *pos, *space;
1070 nsAString_GetData(&pos_str, &pos);
1071 space = strchrW(pos, ' ');
1073 WARN("no space in %s\n", debugstr_w(pos));
1074 space = pos + strlenW(pos);
1078 ret = SysAllocStringLen(pos, space-pos);
1080 hres = E_OUTOFMEMORY;
1085 nsAString_Finish(&pos_str);
1089 TRACE("returning %s\n", debugstr_w(ret));
1095 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1097 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1098 WCHAR buf[14], *pos_val;
1104 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1106 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1110 val_len = val ? strlenW(val) : 0;
1112 nsAString_Init(&pos_str, NULL);
1113 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1114 if(SUCCEEDED(hres)) {
1115 const PRUnichar *pos, *space;
1118 nsAString_GetData(&pos_str, &pos);
1119 space = strchrW(pos, ' ');
1123 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1125 TRACE("no space in %s\n", debugstr_w(pos));
1127 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1130 posx_len = space-pos;
1132 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1134 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1136 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1137 pos_val[posx_len+val_len] = 0;
1139 hres = E_OUTOFMEMORY;
1142 nsAString_Finish(&pos_str);
1146 TRACE("setting position to %s\n", debugstr_w(pos_val));
1147 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1152 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1154 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1159 TRACE("(%p)->(%p)\n", This, p);
1161 nsAString_Init(&pos_str, NULL);
1162 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1163 if(SUCCEEDED(hres)) {
1164 const PRUnichar *pos, *posy;
1166 nsAString_GetData(&pos_str, &pos);
1167 posy = strchrW(pos, ' ');
1169 ret = SysAllocString(posy+1);
1171 hres = E_OUTOFMEMORY;
1176 nsAString_Finish(&pos_str);
1180 TRACE("returning %s\n", debugstr_w(ret));
1186 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1188 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1189 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1190 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1193 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1195 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1196 TRACE("(%p)->(%p)\n", This, p);
1197 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1200 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1202 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1203 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1204 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1207 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1209 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1210 TRACE("(%p)->(%p)\n", This, p);
1211 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1214 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1216 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1218 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1220 /* textDecoration can only be one of the following */
1221 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1222 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1223 strcmpiW(valBlink, v) == 0)
1225 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1228 return E_INVALIDARG;
1231 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1233 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1235 TRACE("(%p)->(%p)\n", This, p);
1237 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1240 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1242 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1244 TRACE("(%p)->(%x)\n", This, v);
1246 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1249 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1251 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1253 TRACE("(%p)->(%p)\n", This, p);
1255 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1258 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1260 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1262 TRACE("(%p)->(%x)\n", This, v);
1264 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1267 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1269 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1271 TRACE("(%p)->(%p)\n", This, p);
1273 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1276 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1278 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1280 TRACE("(%p)->(%x)\n", This, v);
1282 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1285 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1287 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1289 TRACE("(%p)->(%p)\n", This, p);
1291 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1294 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1296 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1298 TRACE("(%p)->(%x)\n", This, v);
1300 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1303 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1305 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1307 TRACE("(%p)->(%p)\n", This, p);
1309 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1312 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1314 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1316 TRACE("(%p)->(%x)\n", This, v);
1318 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1321 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1323 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1325 TRACE("(%p)->(%p)\n", This, p);
1327 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1330 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1332 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1334 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1338 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1340 FIXME("not implemented vt %d\n", V_VT(&v));
1347 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1349 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1353 TRACE("(%p)->(%p)\n", This, p);
1355 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1364 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1366 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1367 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1371 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1373 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1374 FIXME("(%p)->(%p)\n", This, p);
1378 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1380 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1382 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1384 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1387 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1389 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1391 TRACE("(%p)->(%p)\n", This, p);
1393 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1396 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1398 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1399 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1403 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1405 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1406 FIXME("(%p)->(%p)\n", This, p);
1410 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1412 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1413 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1417 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1419 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1420 FIXME("(%p)->(%p)\n", This, p);
1424 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1426 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1428 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1430 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1433 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1435 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1437 TRACE("(%p)->(%p)\n", This, p);
1439 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1442 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1444 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1446 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1450 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1454 wsprintfW(buf, px_formatW, V_I4(&v));
1455 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1458 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1460 FIXME("Unsupported vt=%d\n", V_VT(&v));
1466 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1468 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1469 TRACE("(%p)->(%p)\n", This, p);
1470 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1473 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1475 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1476 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1480 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1482 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1483 FIXME("(%p)->(%p)\n", This, p);
1487 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1489 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1493 TRACE("(%p)->(NULL)\n", This);
1494 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1498 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1500 wsprintfW(buf, px_formatW, V_I4(&v));
1501 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1504 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1505 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1507 FIXME("Unsupported vt=%d\n", V_VT(&v));
1513 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1515 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1517 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1519 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1522 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1524 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1526 TRACE("(%p)->(%p)\n", This, p);
1528 return get_style_attr(This, STYLEID_MARGIN, p);
1531 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1533 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1534 TRACE("(%p)->(%p)\n", This, p);
1535 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1538 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1540 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1541 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1545 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1547 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1548 FIXME("(%p)->(%p)\n", This, p);
1552 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1554 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1555 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1559 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1561 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1562 FIXME("(%p)->(%p)\n", This, p);
1566 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1568 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1569 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1573 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1575 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1576 FIXME("(%p)->(%p)\n", This, p);
1580 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1582 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1584 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1590 wsprintfW(buf, px_formatW, V_I4(&v));
1591 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1594 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1596 FIXME("unsupported vt=%d\n", V_VT(&v));
1602 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1604 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1608 TRACE("(%p)->(%p)\n", This, p);
1610 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1619 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1621 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1623 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1625 return set_style_attr(This, STYLEID_PADDING, v, 0);
1628 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1630 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1632 TRACE("(%p)->(%p)\n", This, p);
1634 return get_style_attr(This, STYLEID_PADDING, p);
1637 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1639 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1641 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1643 return set_style_attr(This, STYLEID_BORDER, v, 0);
1646 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1648 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1650 TRACE("(%p)->(%p)\n", This, p);
1652 return get_style_attr(This, STYLEID_BORDER, p);
1655 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1657 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1658 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1659 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1662 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1664 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1665 TRACE("(%p)->(%p)\n", This, p);
1666 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1669 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1671 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1672 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1673 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1676 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1678 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1679 TRACE("(%p)->(%p)\n", This, p);
1680 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1683 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1685 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1686 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1687 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1690 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1692 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1693 TRACE("(%p)->(%p)\n", This, p);
1694 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1697 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1699 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1701 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1703 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1706 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1708 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1710 TRACE("(%p)->(%p)\n", This, p);
1712 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1715 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1717 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1719 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1721 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1724 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1726 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1728 TRACE("(%p)->(%p)\n", This, p);
1730 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1733 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1735 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1737 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1739 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1742 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1744 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1746 TRACE("(%p)->(%p)\n", This, p);
1748 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1751 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1753 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1755 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1757 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1760 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1762 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1764 TRACE("(%p)->(%p)\n", This, p);
1766 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1769 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1771 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1773 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1775 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1778 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1780 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1782 TRACE("(%p)->(%p)\n", This, p);
1784 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1787 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1789 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1791 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1793 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1796 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1798 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1800 TRACE("(%p)->(%p)\n", This, p);
1802 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1805 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1807 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1808 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1809 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1812 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1814 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1815 TRACE("(%p)->(%p)\n", This, p);
1816 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1819 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1821 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1822 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1823 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1826 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1828 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1830 TRACE("(%p)->(%p)\n", This, p);
1832 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1835 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1837 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1838 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1839 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1842 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1844 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1845 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)->(v%d)\n", This, V_VT(&v));
1854 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1857 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1859 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1860 TRACE("(%p)->(%p)\n", This, p);
1861 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1864 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1866 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1867 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1868 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1871 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1873 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1874 TRACE("(%p)->(%p)\n", This, p);
1875 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1878 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1880 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1881 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1882 HRESULT hres = S_OK;
1887 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1889 while(v[i] && hres == S_OK)
1891 if(v[i] == (WCHAR)' ')
1893 pstyle = SysAllocStringLen(&v[last], (i-last));
1894 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1896 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1897 hres = E_INVALIDARG;
1899 SysFreeString(pstyle);
1907 pstyle = SysAllocStringLen(&v[last], i-last);
1908 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1910 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1911 hres = E_INVALIDARG;
1913 SysFreeString(pstyle);
1917 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1922 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1924 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1925 TRACE("(%p)->(%p)\n", This, p);
1926 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1929 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1931 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1932 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1934 if(!is_valid_border_style(v))
1935 return E_INVALIDARG;
1937 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1940 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1942 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1943 TRACE("(%p)->(%p)\n", This, p);
1944 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1947 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1949 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1950 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1952 if(!is_valid_border_style(v))
1953 return E_INVALIDARG;
1955 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1958 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1960 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1961 TRACE("(%p)->(%p)\n", This, p);
1962 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1965 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1967 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1968 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1970 if(!is_valid_border_style(v))
1971 return E_INVALIDARG;
1973 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
1976 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
1978 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1979 TRACE("(%p)->(%p)\n", This, p);
1980 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
1983 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
1985 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1986 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1988 if(!is_valid_border_style(v))
1989 return E_INVALIDARG;
1991 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
1994 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
1996 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1997 TRACE("(%p)->(%p)\n", This, p);
1998 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2001 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2003 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2005 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
2007 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2010 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2012 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2014 TRACE("(%p)->(%p)\n", This, p);
2017 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
2020 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2022 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2024 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2028 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
2030 FIXME("unimplemented vt %d\n", V_VT(&v));
2037 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2039 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2043 TRACE("(%p)->(%p)\n", This, p);
2045 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
2054 static HRESULT WINAPI HTMLStyle_put_styleFloat(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_styleFloat(IHTMLStyle *iface, BSTR *p)
2063 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2064 FIXME("(%p)->(%p)\n", This, p);
2068 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2070 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2071 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2075 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2077 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2078 FIXME("(%p)->(%p)\n", This, p);
2082 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2084 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2086 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2088 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2091 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2093 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2095 TRACE("(%p)->(%p)\n", This, p);
2097 return get_style_attr(This, STYLEID_DISPLAY, p);
2100 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2102 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2104 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2106 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2109 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2111 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2113 TRACE("(%p)->(%p)\n", This, p);
2115 return get_style_attr(This, STYLEID_VISIBILITY, p);
2118 static HRESULT WINAPI HTMLStyle_put_listStyleType(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_listStyleType(IHTMLStyle *iface, BSTR *p)
2127 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2128 FIXME("(%p)->(%p)\n", This, p);
2132 static HRESULT WINAPI HTMLStyle_put_listStylePosition(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_listStylePosition(IHTMLStyle *iface, BSTR *p)
2141 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2142 FIXME("(%p)->(%p)\n", This, p);
2146 static HRESULT WINAPI HTMLStyle_put_listStyleImage(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_listStyleImage(IHTMLStyle *iface, BSTR *p)
2155 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2156 FIXME("(%p)->(%p)\n", This, p);
2160 static HRESULT WINAPI HTMLStyle_put_listStyle(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_listStyle(IHTMLStyle *iface, BSTR *p)
2169 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2170 FIXME("(%p)->(%p)\n", This, p);
2174 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2176 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2177 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2181 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2183 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2184 FIXME("(%p)->(%p)\n", This, p);
2188 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2190 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2192 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2194 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2197 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2199 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2203 TRACE("(%p)->(%p)\n", This, p);
2205 hres = get_style_attr(This, STYLEID_TOP, &ret);
2214 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2216 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2218 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2220 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2223 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2225 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2229 TRACE("(%p)->(%p)\n", This, p);
2231 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2240 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2242 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2243 TRACE("(%p)->(%p)\n", This, p);
2244 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2247 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2249 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2251 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2255 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2258 static const WCHAR format[] = {'%','d',0};
2260 wsprintfW(value, format, V_I4(&v));
2261 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2264 FIXME("unimplemented vt %d\n", V_VT(&v));
2271 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2273 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2275 TRACE("(%p)->(%p)\n", This, p);
2277 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2280 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2282 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2283 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2284 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2285 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2286 static const WCHAR szAuto[] = {'a','u','t','o',0};
2288 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2290 /* overflow can only be one of the follow values. */
2291 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2292 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2294 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2297 return E_INVALIDARG;
2301 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2303 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2305 TRACE("(%p)->(%p)\n", This, p);
2308 return E_INVALIDARG;
2310 return get_style_attr(This, STYLEID_OVERFLOW, p);
2313 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2315 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2316 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2320 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2322 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2323 FIXME("(%p)->(%p)\n", This, p);
2327 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2329 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2330 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2334 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2336 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2337 FIXME("(%p)->(%p)\n", This, p);
2341 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2343 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2347 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2349 nsAString_InitDepend(&text_str, v);
2350 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2351 nsAString_Finish(&text_str);
2352 if(NS_FAILED(nsres)) {
2353 FIXME("SetCssStyle failed: %08x\n", nsres);
2360 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2362 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2366 TRACE("(%p)->(%p)\n", This, p);
2368 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2369 nsAString_Init(&text_str, NULL);
2370 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2371 if(NS_SUCCEEDED(nsres)) {
2372 const PRUnichar *text;
2374 nsAString_GetData(&text_str, &text);
2375 *p = *text ? SysAllocString(text) : NULL;
2377 FIXME("GetCssStyle failed: %08x\n", nsres);
2381 nsAString_Finish(&text_str);
2385 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2387 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2388 FIXME("(%p)->()\n", This);
2392 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2394 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2395 FIXME("(%p)->()\n", This);
2399 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2401 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2402 FIXME("(%p)->()\n", This);
2406 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2408 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2409 FIXME("(%p)->()\n", This);
2413 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2415 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2416 FIXME("(%p)->()\n", This);
2420 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2422 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2423 FIXME("(%p)->()\n", This);
2427 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2429 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2430 FIXME("(%p)->()\n", This);
2434 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2437 FIXME("(%p)->()\n", This);
2441 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2443 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2445 TRACE("(%p)->(%f)\n", This, v);
2447 return set_style_pos(This, STYLEID_TOP, v);
2450 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2452 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2454 TRACE("(%p)->(%p)\n", This, p);
2459 return get_nsstyle_pos(This, STYLEID_TOP, p);
2462 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2464 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2466 TRACE("(%p)->(%f)\n", This, v);
2468 return set_style_pos(This, STYLEID_LEFT, v);
2471 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2473 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2475 TRACE("(%p)->(%p)\n", This, p);
2480 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2483 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2485 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2487 TRACE("(%p)->(%f)\n", This, v);
2489 return set_style_pos(This, STYLEID_WIDTH, v);
2492 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2494 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2496 TRACE("(%p)->(%p)\n", This, p);
2501 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2507 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2509 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2511 TRACE("(%p)->(%f)\n", This, v);
2513 return set_style_pos(This, STYLEID_HEIGHT, v);
2516 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2518 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2520 TRACE("(%p)->(%p)\n", This, p);
2525 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2531 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2533 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2535 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2537 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2540 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2542 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2544 TRACE("(%p)->(%p)\n", This, p);
2546 return get_style_attr(This, STYLEID_CURSOR, p);
2549 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2551 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2552 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2556 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2558 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2559 FIXME("(%p)->(%p)\n", This, p);
2563 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2565 nsAString name_str, val_str, empty_str;
2568 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2570 TRACE("%s\n", debugstr_w(val));
2572 nsAString_InitDepend(&name_str, opacityW);
2573 nsAString_InitDepend(&val_str, val);
2574 nsAString_InitDepend(&empty_str, emptyW);
2576 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2577 if(NS_FAILED(nsres))
2578 ERR("SetProperty failed: %08x\n", nsres);
2580 nsAString_Finish(&name_str);
2581 nsAString_Finish(&val_str);
2582 nsAString_Finish(&empty_str);
2585 static void update_filter(HTMLStyle *This)
2587 const WCHAR *ptr = This->filter, *ptr2;
2589 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2592 set_opacity(This, emptyW);
2597 while(isspaceW(*ptr))
2603 while(isalnumW(*ptr))
2606 WARN("unexpected char '%c'\n", *ptr);
2610 WARN("expected '('\n");
2614 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2615 static const WCHAR formatW[] = {'%','f',0};
2616 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2620 while(isspaceW(*ptr))
2624 while(*ptr && *ptr != ',' && *ptr != ')')
2627 WARN("unexpected end of string\n");
2631 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2632 float fval = 0.0f, e = 0.1f;
2635 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2637 while(isdigitW(*ptr2))
2638 fval = fval*10.0f + (float)(*ptr2++ - '0');
2641 while(isdigitW(*++ptr2)) {
2642 fval += e * (float)(*ptr2++ - '0');
2647 sprintfW(buf, formatW, fval * 0.01f);
2648 set_opacity(This, buf);
2650 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2655 }while(*ptr != ')');
2657 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2658 ptr = strchrW(ptr, ')');
2666 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2668 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2669 WCHAR *new_filter = NULL;
2671 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2674 new_filter = heap_strdupW(v);
2676 return E_OUTOFMEMORY;
2679 heap_free(This->filter);
2680 This->filter = new_filter;
2682 update_filter(This);
2686 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2688 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2690 TRACE("(%p)->(%p)\n", This, p);
2693 *p = SysAllocString(This->filter);
2695 return E_OUTOFMEMORY;
2703 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2704 VARIANT AttributeValue, LONG lFlags)
2706 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2710 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2711 V_VT(&AttributeValue), lFlags);
2713 if(!strAttributeName)
2714 return E_INVALIDARG;
2717 FIXME("Parameter lFlags ignored\n");
2719 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2720 LOCALE_USER_DEFAULT, &dispid);
2724 DISPID dispidNamed = DISPID_PROPERTYPUT;
2728 params.rgvarg = &AttributeValue;
2729 params.cNamedArgs = 1;
2730 params.rgdispidNamedArgs = &dispidNamed;
2732 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2733 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2737 FIXME("Custom attributes not supported.\n");
2740 TRACE("ret: %08x\n", hres);
2745 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2746 LONG lFlags, VARIANT *AttributeValue)
2748 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2752 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2753 AttributeValue, lFlags);
2755 if(!AttributeValue || !strAttributeName)
2756 return E_INVALIDARG;
2759 FIXME("Parameter lFlags ignored\n");
2761 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2762 LOCALE_USER_DEFAULT, &dispid);
2765 DISPPARAMS params = {NULL, NULL, 0, 0 };
2767 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2768 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2772 FIXME("Custom attributes not supported.\n");
2778 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2779 LONG lFlags, VARIANT_BOOL *pfSuccess)
2781 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2782 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2787 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2789 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2790 FIXME("(%p)->(%p)\n", This, String);
2794 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2795 HTMLStyle_QueryInterface,
2798 HTMLStyle_GetTypeInfoCount,
2799 HTMLStyle_GetTypeInfo,
2800 HTMLStyle_GetIDsOfNames,
2802 HTMLStyle_put_fontFamily,
2803 HTMLStyle_get_fontFamily,
2804 HTMLStyle_put_fontStyle,
2805 HTMLStyle_get_fontStyle,
2806 HTMLStyle_put_fontVariant,
2807 HTMLStyle_get_fontVariant,
2808 HTMLStyle_put_fontWeight,
2809 HTMLStyle_get_fontWeight,
2810 HTMLStyle_put_fontSize,
2811 HTMLStyle_get_fontSize,
2814 HTMLStyle_put_color,
2815 HTMLStyle_get_color,
2816 HTMLStyle_put_background,
2817 HTMLStyle_get_background,
2818 HTMLStyle_put_backgroundColor,
2819 HTMLStyle_get_backgroundColor,
2820 HTMLStyle_put_backgroundImage,
2821 HTMLStyle_get_backgroundImage,
2822 HTMLStyle_put_backgroundRepeat,
2823 HTMLStyle_get_backgroundRepeat,
2824 HTMLStyle_put_backgroundAttachment,
2825 HTMLStyle_get_backgroundAttachment,
2826 HTMLStyle_put_backgroundPosition,
2827 HTMLStyle_get_backgroundPosition,
2828 HTMLStyle_put_backgroundPositionX,
2829 HTMLStyle_get_backgroundPositionX,
2830 HTMLStyle_put_backgroundPositionY,
2831 HTMLStyle_get_backgroundPositionY,
2832 HTMLStyle_put_wordSpacing,
2833 HTMLStyle_get_wordSpacing,
2834 HTMLStyle_put_letterSpacing,
2835 HTMLStyle_get_letterSpacing,
2836 HTMLStyle_put_textDecoration,
2837 HTMLStyle_get_textDecoration,
2838 HTMLStyle_put_textDecorationNone,
2839 HTMLStyle_get_textDecorationNone,
2840 HTMLStyle_put_textDecorationUnderline,
2841 HTMLStyle_get_textDecorationUnderline,
2842 HTMLStyle_put_textDecorationOverline,
2843 HTMLStyle_get_textDecorationOverline,
2844 HTMLStyle_put_textDecorationLineThrough,
2845 HTMLStyle_get_textDecorationLineThrough,
2846 HTMLStyle_put_textDecorationBlink,
2847 HTMLStyle_get_textDecorationBlink,
2848 HTMLStyle_put_verticalAlign,
2849 HTMLStyle_get_verticalAlign,
2850 HTMLStyle_put_textTransform,
2851 HTMLStyle_get_textTransform,
2852 HTMLStyle_put_textAlign,
2853 HTMLStyle_get_textAlign,
2854 HTMLStyle_put_textIndent,
2855 HTMLStyle_get_textIndent,
2856 HTMLStyle_put_lineHeight,
2857 HTMLStyle_get_lineHeight,
2858 HTMLStyle_put_marginTop,
2859 HTMLStyle_get_marginTop,
2860 HTMLStyle_put_marginRight,
2861 HTMLStyle_get_marginRight,
2862 HTMLStyle_put_marginBottom,
2863 HTMLStyle_get_marginBottom,
2864 HTMLStyle_put_marginLeft,
2865 HTMLStyle_get_marginLeft,
2866 HTMLStyle_put_margin,
2867 HTMLStyle_get_margin,
2868 HTMLStyle_put_paddingTop,
2869 HTMLStyle_get_paddingTop,
2870 HTMLStyle_put_paddingRight,
2871 HTMLStyle_get_paddingRight,
2872 HTMLStyle_put_paddingBottom,
2873 HTMLStyle_get_paddingBottom,
2874 HTMLStyle_put_paddingLeft,
2875 HTMLStyle_get_paddingLeft,
2876 HTMLStyle_put_padding,
2877 HTMLStyle_get_padding,
2878 HTMLStyle_put_border,
2879 HTMLStyle_get_border,
2880 HTMLStyle_put_borderTop,
2881 HTMLStyle_get_borderTop,
2882 HTMLStyle_put_borderRight,
2883 HTMLStyle_get_borderRight,
2884 HTMLStyle_put_borderBottom,
2885 HTMLStyle_get_borderBottom,
2886 HTMLStyle_put_borderLeft,
2887 HTMLStyle_get_borderLeft,
2888 HTMLStyle_put_borderColor,
2889 HTMLStyle_get_borderColor,
2890 HTMLStyle_put_borderTopColor,
2891 HTMLStyle_get_borderTopColor,
2892 HTMLStyle_put_borderRightColor,
2893 HTMLStyle_get_borderRightColor,
2894 HTMLStyle_put_borderBottomColor,
2895 HTMLStyle_get_borderBottomColor,
2896 HTMLStyle_put_borderLeftColor,
2897 HTMLStyle_get_borderLeftColor,
2898 HTMLStyle_put_borderWidth,
2899 HTMLStyle_get_borderWidth,
2900 HTMLStyle_put_borderTopWidth,
2901 HTMLStyle_get_borderTopWidth,
2902 HTMLStyle_put_borderRightWidth,
2903 HTMLStyle_get_borderRightWidth,
2904 HTMLStyle_put_borderBottomWidth,
2905 HTMLStyle_get_borderBottomWidth,
2906 HTMLStyle_put_borderLeftWidth,
2907 HTMLStyle_get_borderLeftWidth,
2908 HTMLStyle_put_borderStyle,
2909 HTMLStyle_get_borderStyle,
2910 HTMLStyle_put_borderTopStyle,
2911 HTMLStyle_get_borderTopStyle,
2912 HTMLStyle_put_borderRightStyle,
2913 HTMLStyle_get_borderRightStyle,
2914 HTMLStyle_put_borderBottomStyle,
2915 HTMLStyle_get_borderBottomStyle,
2916 HTMLStyle_put_borderLeftStyle,
2917 HTMLStyle_get_borderLeftStyle,
2918 HTMLStyle_put_width,
2919 HTMLStyle_get_width,
2920 HTMLStyle_put_height,
2921 HTMLStyle_get_height,
2922 HTMLStyle_put_styleFloat,
2923 HTMLStyle_get_styleFloat,
2924 HTMLStyle_put_clear,
2925 HTMLStyle_get_clear,
2926 HTMLStyle_put_display,
2927 HTMLStyle_get_display,
2928 HTMLStyle_put_visibility,
2929 HTMLStyle_get_visibility,
2930 HTMLStyle_put_listStyleType,
2931 HTMLStyle_get_listStyleType,
2932 HTMLStyle_put_listStylePosition,
2933 HTMLStyle_get_listStylePosition,
2934 HTMLStyle_put_listStyleImage,
2935 HTMLStyle_get_listStyleImage,
2936 HTMLStyle_put_listStyle,
2937 HTMLStyle_get_listStyle,
2938 HTMLStyle_put_whiteSpace,
2939 HTMLStyle_get_whiteSpace,
2944 HTMLStyle_get_position,
2945 HTMLStyle_put_zIndex,
2946 HTMLStyle_get_zIndex,
2947 HTMLStyle_put_overflow,
2948 HTMLStyle_get_overflow,
2949 HTMLStyle_put_pageBreakBefore,
2950 HTMLStyle_get_pageBreakBefore,
2951 HTMLStyle_put_pageBreakAfter,
2952 HTMLStyle_get_pageBreakAfter,
2953 HTMLStyle_put_cssText,
2954 HTMLStyle_get_cssText,
2955 HTMLStyle_put_pixelTop,
2956 HTMLStyle_get_pixelTop,
2957 HTMLStyle_put_pixelLeft,
2958 HTMLStyle_get_pixelLeft,
2959 HTMLStyle_put_pixelWidth,
2960 HTMLStyle_get_pixelWidth,
2961 HTMLStyle_put_pixelHeight,
2962 HTMLStyle_get_pixelHeight,
2963 HTMLStyle_put_posTop,
2964 HTMLStyle_get_posTop,
2965 HTMLStyle_put_posLeft,
2966 HTMLStyle_get_posLeft,
2967 HTMLStyle_put_posWidth,
2968 HTMLStyle_get_posWidth,
2969 HTMLStyle_put_posHeight,
2970 HTMLStyle_get_posHeight,
2971 HTMLStyle_put_cursor,
2972 HTMLStyle_get_cursor,
2975 HTMLStyle_put_filter,
2976 HTMLStyle_get_filter,
2977 HTMLStyle_setAttribute,
2978 HTMLStyle_getAttribute,
2979 HTMLStyle_removeAttribute,
2983 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
2985 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
2990 c = strcmpW(style_tbl[i].name, name);
2992 *dispid = style_tbl[i].dispid;
3002 return DISP_E_UNKNOWNNAME;
3005 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3007 HTMLStyle_get_dispid,
3011 static const tid_t HTMLStyle_iface_tids[] = {
3018 static dispex_static_data_t HTMLStyle_dispex = {
3019 &HTMLStyle_dispex_vtbl,
3022 HTMLStyle_iface_tids
3025 HRESULT HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret)
3029 style = heap_alloc_zero(sizeof(HTMLStyle));
3031 return E_OUTOFMEMORY;
3033 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3035 style->nsstyle = nsstyle;
3036 HTMLStyle2_Init(style);
3037 HTMLStyle3_Init(style);
3039 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3041 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);