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"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 static const WCHAR attrBackground[] =
38 {'b','a','c','k','g','r','o','u','n','d',0};
39 static const WCHAR attrBackgroundColor[] =
40 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
41 static const WCHAR attrBackgroundImage[] =
42 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
43 static const WCHAR attrBackgroundPosition[] =
44 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
45 static const WCHAR attrBackgroundPositionX[] =
46 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
47 static const WCHAR attrBackgroundPositionY[] =
48 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
49 static const WCHAR attrBackgroundRepeat[] =
50 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
51 static const WCHAR attrBorder[] =
52 {'b','o','r','d','e','r',0};
53 static const WCHAR attrBorderBottom[] =
54 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
55 static const WCHAR attrBorderBottomColor[] =
56 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
57 static const WCHAR attrBorderBottomStyle[] =
58 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
59 static const WCHAR attrBorderBottomWidth[] =
60 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
61 static const WCHAR attrBorderColor[] =
62 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
63 static const WCHAR attrBorderLeft[] =
64 {'b','o','r','d','e','r','-','l','e','f','t',0};
65 static const WCHAR attrBorderLeftColor[] =
66 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
67 static const WCHAR attrBorderLeftStyle[] =
68 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
69 static const WCHAR attrBorderLeftWidth[] =
70 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
71 static const WCHAR attrBorderRight[] =
72 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
73 static const WCHAR attrBorderRightColor[] =
74 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
75 static const WCHAR attrBorderRightStyle[] =
76 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
77 static const WCHAR attrBorderRightWidth[] =
78 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
79 static const WCHAR attrBorderTop[] =
80 {'b','o','r','d','e','r','-','t','o','p',0};
81 static const WCHAR attrBorderTopColor[] =
82 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
83 static const WCHAR attrBorderStyle[] =
84 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
85 static const WCHAR attrBorderTopStyle[] =
86 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
87 static const WCHAR attrBorderTopWidth[] =
88 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
89 static const WCHAR attrBorderWidth[] =
90 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
91 static const WCHAR attrBottom[] =
92 {'b','o','t','t','o','m',0};
93 static const WCHAR attrClip[] =
95 static const WCHAR attrColor[] =
96 {'c','o','l','o','r',0};
97 static const WCHAR attrCursor[] =
98 {'c','u','r','s','o','r',0};
99 static const WCHAR attrDirection[] =
100 {'d','i','r','e','c','t','i','o','n',0};
101 static const WCHAR attrDisplay[] =
102 {'d','i','s','p','l','a','y',0};
103 static const WCHAR attrFilter[] =
104 {'f','i','l','e','t','e','r',0};
105 static const WCHAR attrFontFamily[] =
106 {'f','o','n','t','-','f','a','m','i','l','y',0};
107 static const WCHAR attrFontSize[] =
108 {'f','o','n','t','-','s','i','z','e',0};
109 static const WCHAR attrFontStyle[] =
110 {'f','o','n','t','-','s','t','y','l','e',0};
111 static const WCHAR attrFontVariant[] =
112 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
113 static const WCHAR attrFontWeight[] =
114 {'f','o','n','t','-','w','e','i','g','h','t',0};
115 static const WCHAR attrHeight[] =
116 {'h','e','i','g','h','t',0};
117 static const WCHAR attrLeft[] =
119 static const WCHAR attrLetterSpacing[] =
120 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
121 static const WCHAR attrLineHeight[] =
122 {'l','i','n','e','-','h','e','i','g','h','t',0};
123 static const WCHAR attrMargin[] =
124 {'m','a','r','g','i','n',0};
125 static const WCHAR attrMarginBottom[] =
126 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
127 static const WCHAR attrMarginLeft[] =
128 {'m','a','r','g','i','n','-','l','e','f','t',0};
129 static const WCHAR attrMarginRight[] =
130 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
131 static const WCHAR attrMarginTop[] =
132 {'m','a','r','g','i','n','-','t','o','p',0};
133 static const WCHAR attrMinHeight[] =
134 {'m','i','n','-','h','e','i','g','h','t',0};
135 static const WCHAR attrOverflow[] =
136 {'o','v','e','r','f','l','o','w',0};
137 static const WCHAR attrPadding[] =
138 {'p','a','d','d','i','n','g',0};
139 static const WCHAR attrPaddingBottom[] =
140 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
141 static const WCHAR attrPaddingLeft[] =
142 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
143 static const WCHAR attrPaddingRight[] =
144 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
145 static const WCHAR attrPaddingTop[] =
146 {'p','a','d','d','i','n','g','-','t','o','p',0};
147 static const WCHAR attrPageBreakAfter[] =
148 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
149 static const WCHAR attrPageBreakBefore[] =
150 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
151 static const WCHAR attrPosition[] =
152 {'p','o','s','i','t','i','o','n',0};
153 static const WCHAR attrRight[] =
154 {'r','i','g','h','t',0};
155 static const WCHAR attrTextAlign[] =
156 {'t','e','x','t','-','a','l','i','g','n',0};
157 static const WCHAR attrTextDecoration[] =
158 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
159 static const WCHAR attrTextIndent[] =
160 {'t','e','x','t','-','i','n','d','e','n','t',0};
161 static const WCHAR attrTop[] =
163 static const WCHAR attrVerticalAlign[] =
164 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
165 static const WCHAR attrVisibility[] =
166 {'v','i','s','i','b','i','l','i','t','y',0};
167 static const WCHAR attrWidth[] =
168 {'w','i','d','t','h',0};
169 static const WCHAR attrWordSpacing[] =
170 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
171 static const WCHAR attrWordWrap[] =
172 {'w','o','r','d','-','w','r','a','p',0};
173 static const WCHAR attrZIndex[] =
174 {'z','-','i','n','d','e','x',0};
180 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
181 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
182 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
183 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
184 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
185 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
186 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
187 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
188 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
189 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
190 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
191 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
192 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
193 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
194 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
195 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
196 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
197 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
198 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
199 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
200 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
201 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
202 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
203 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
204 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
205 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
206 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
207 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
208 {attrClip, DISPID_IHTMLSTYLE_CLIP},
209 {attrColor, DISPID_IHTMLSTYLE_COLOR},
210 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
211 {attrDirection, DISPID_IHTMLSTYLE2_DIRECTION},
212 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
213 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
214 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
215 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
216 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
217 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
218 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
219 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
220 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
221 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
222 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
223 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
224 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
225 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
226 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
227 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
228 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
229 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
230 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
231 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
232 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
233 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
234 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
235 {attrPageBreakAfter, DISPID_IHTMLSTYLE_PAGEBREAKAFTER},
236 {attrPageBreakBefore, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE},
237 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
238 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
239 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
240 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
241 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
242 {attrTop, DISPID_IHTMLSTYLE_TOP},
243 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
244 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
245 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
246 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
247 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
248 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
251 static const WCHAR valLineThrough[] =
252 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
253 static const WCHAR valUnderline[] =
254 {'u','n','d','e','r','l','i','n','e',0};
255 static const WCHAR szNormal[] =
256 {'n','o','r','m','a','l',0};
257 static const WCHAR styleNone[] =
259 static const WCHAR valOverline[] =
260 {'o','v','e','r','l','i','n','e',0};
261 static const WCHAR valBlink[] =
262 {'b','l','i','n','k',0};
264 static const WCHAR px_formatW[] = {'%','d','p','x',0};
265 static const WCHAR emptyW[] = {0};
267 static LPWSTR fix_px_value(LPCWSTR val)
272 while(*ptr && isspaceW(*ptr))
277 while(*ptr && isdigitW(*ptr))
280 if(!*ptr || isspaceW(*ptr)) {
282 int len = strlenW(val)+1;
284 ret = heap_alloc((len+2)*sizeof(WCHAR));
285 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
291 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
296 while(*ptr && !isspaceW(*ptr))
303 static LPWSTR fix_url_value(LPCWSTR val)
307 static const WCHAR urlW[] = {'u','r','l','('};
309 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
312 ret = heap_strdupW(val);
314 for(ptr = ret; *ptr; ptr++) {
322 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
324 nsAString str_name, str_value, str_empty;
328 if(flags & ATTR_FIX_PX)
329 val = fix_px_value(value);
330 if(flags & ATTR_FIX_URL)
331 val = fix_url_value(value);
333 nsAString_InitDepend(&str_name, style_tbl[sid].name);
334 nsAString_InitDepend(&str_value, val ? val : value);
335 nsAString_InitDepend(&str_empty, emptyW);
337 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
339 ERR("SetProperty failed: %08x\n", nsres);
341 nsAString_Finish(&str_name);
342 nsAString_Finish(&str_value);
343 nsAString_Finish(&str_empty);
349 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
360 case VT_BSTR|VT_BYREF:
361 *ret = *V_BSTRREF(v);
365 static const WCHAR formatW[] = {'%','d',0};
366 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
368 if(flags & ATTR_HEX_INT)
369 wsprintfW(buf, hex_formatW, V_I4(v));
370 else if(flags & ATTR_FIX_PX)
371 wsprintfW(buf, px_formatW, V_I4(v));
373 wsprintfW(buf, formatW, V_I4(v));
379 FIXME("not implemented vt %d\n", V_VT(v));
385 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
391 hres = var_to_styleval(value, buf, flags, &val);
395 return set_nsstyle_attr(nsstyle, sid, val, flags);
398 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
400 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
403 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
408 nsAString_InitDepend(&str_name, style_tbl[sid].name);
410 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
411 if(NS_FAILED(nsres)) {
412 ERR("SetProperty failed: %08x\n", nsres);
416 nsAString_Finish(&str_name);
421 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
431 ret = SysAllocString(val);
433 return E_OUTOFMEMORY;
435 len = SysStringLen(ret);
437 if(flags & ATTR_REMOVE_COMMA) {
441 for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
447 new_ret = SysAllocStringLen(NULL, new_len);
450 return E_OUTOFMEMORY;
453 for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
467 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p, DWORD flags)
470 const PRUnichar *value;
473 nsAString_Init(&str_value, NULL);
475 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
477 nsAString_GetData(&str_value, &value);
478 hres = nsstyle_to_bstr(value, flags, p);
479 nsAString_Finish(&str_value);
481 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
485 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
488 const PRUnichar *value;
492 nsAString_Init(&str_value, NULL);
494 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
496 nsAString_GetData(&str_value, &value);
498 if(flags & ATTR_STR_TO_INT) {
499 const PRUnichar *ptr = value;
508 while(isdigitW(*ptr))
509 i = i*10 + (*ptr++ - '0');
513 V_I4(p) = neg ? -i : i;
521 hres = nsstyle_to_bstr(value, flags, &str);
522 if(SUCCEEDED(hres)) {
528 nsAString_Finish(&str_value);
530 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
534 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
536 return get_nsstyle_attr(This->nsstyle, sid, p, 0);
539 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
542 const PRUnichar *value;
544 nsAString_Init(&str_value, NULL);
546 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
548 nsAString_GetData(&str_value, &value);
549 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
550 nsAString_Finish(&str_value);
552 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
556 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
559 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
561 value = floor(value);
563 sprintfW(szValue, szFormat, value);
565 return set_style_attr(This, sid, szValue, 0);
568 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
572 WCHAR pxW[] = {'p','x',0};
574 TRACE("%p %d %p\n", This, sid, p);
578 nsAString_Init(&str_value, NULL);
580 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
584 const PRUnichar *value;
586 nsAString_GetData(&str_value, &value);
589 *p = strtolW(value, &ptr, 10);
591 if(*ptr && strcmpW(ptr, pxW))
593 nsAString_Finish(&str_value);
594 FIXME("only px values are currently supported\n");
600 TRACE("ret %f\n", *p);
602 nsAString_Finish(&str_value);
607 static BOOL is_valid_border_style(BSTR v)
609 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
610 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
611 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
612 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
613 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
614 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
615 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
616 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
618 TRACE("%s\n", debugstr_w(v));
620 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
621 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
622 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
623 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
624 strcmpiW(v, styleOutset) == 0 )
632 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
634 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
637 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
639 HTMLStyle *This = impl_from_IHTMLStyle(iface);
643 if(IsEqualGUID(&IID_IUnknown, riid)) {
644 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
645 *ppv = &This->IHTMLStyle_iface;
646 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
647 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
648 *ppv = &This->IHTMLStyle_iface;
649 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
650 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
651 *ppv = &This->IHTMLStyle2_iface;
652 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
653 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
654 *ppv = &This->IHTMLStyle3_iface;
655 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
656 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
657 *ppv = &This->IHTMLStyle4_iface;
658 }else if(IsEqualGUID(&IID_IHTMLStyle5, riid)) {
659 TRACE("(%p)->(IID_IHTMLStyle5 %p)\n", This, ppv);
660 *ppv = &This->IHTMLStyle5_iface;
661 }else if(IsEqualGUID(&IID_IHTMLStyle6, riid)) {
662 TRACE("(%p)->(IID_IHTMLStyle6 %p)\n", This, ppv);
663 *ppv = &This->IHTMLStyle6_iface;
664 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
665 return *ppv ? S_OK : E_NOINTERFACE;
669 IUnknown_AddRef((IUnknown*)*ppv);
673 WARN("unsupported %s\n", debugstr_guid(riid));
674 return E_NOINTERFACE;
677 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
679 HTMLStyle *This = impl_from_IHTMLStyle(iface);
680 LONG ref = InterlockedIncrement(&This->ref);
682 TRACE("(%p) ref=%d\n", This, ref);
687 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
689 HTMLStyle *This = impl_from_IHTMLStyle(iface);
690 LONG ref = InterlockedDecrement(&This->ref);
692 TRACE("(%p) ref=%d\n", This, ref);
696 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
697 heap_free(This->filter);
698 release_dispex(&This->dispex);
705 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
707 HTMLStyle *This = impl_from_IHTMLStyle(iface);
708 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
711 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
712 LCID lcid, ITypeInfo **ppTInfo)
714 HTMLStyle *This = impl_from_IHTMLStyle(iface);
715 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
718 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
719 LPOLESTR *rgszNames, UINT cNames,
720 LCID lcid, DISPID *rgDispId)
722 HTMLStyle *This = impl_from_IHTMLStyle(iface);
723 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
727 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
728 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
729 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
731 HTMLStyle *This = impl_from_IHTMLStyle(iface);
732 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
733 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
736 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
738 HTMLStyle *This = impl_from_IHTMLStyle(iface);
740 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
742 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
745 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
747 HTMLStyle *This = impl_from_IHTMLStyle(iface);
749 TRACE("(%p)->(%p)\n", This, p);
751 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
754 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
756 HTMLStyle *This = impl_from_IHTMLStyle(iface);
757 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
758 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
760 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
762 /* fontStyle can only be one of the follow values. */
763 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
764 strcmpiW(szOblique, v) == 0)
766 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
772 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
774 HTMLStyle *This = impl_from_IHTMLStyle(iface);
776 TRACE("(%p)->(%p)\n", This, p);
778 return get_style_attr(This, STYLEID_FONT_STYLE, p);
781 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
783 HTMLStyle *This = impl_from_IHTMLStyle(iface);
784 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
786 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
788 /* fontVariant can only be one of the follow values. */
789 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
791 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
797 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
799 HTMLStyle *This = impl_from_IHTMLStyle(iface);
800 TRACE("(%p)->(%p)\n", This, p);
805 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
808 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
810 HTMLStyle *This = impl_from_IHTMLStyle(iface);
811 static const WCHAR styleBold[] = {'b','o','l','d',0};
812 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
813 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
814 static const WCHAR style100[] = {'1','0','0',0};
815 static const WCHAR style200[] = {'2','0','0',0};
816 static const WCHAR style300[] = {'3','0','0',0};
817 static const WCHAR style400[] = {'4','0','0',0};
818 static const WCHAR style500[] = {'5','0','0',0};
819 static const WCHAR style600[] = {'6','0','0',0};
820 static const WCHAR style700[] = {'7','0','0',0};
821 static const WCHAR style800[] = {'8','0','0',0};
822 static const WCHAR style900[] = {'9','0','0',0};
824 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
826 /* fontWeight can only be one of the following */
827 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
828 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
829 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
830 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
831 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
832 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
833 strcmpiW(style900, v) == 0
836 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
842 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
844 HTMLStyle *This = impl_from_IHTMLStyle(iface);
846 TRACE("(%p)->(%p)\n", This, p);
848 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
851 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
853 HTMLStyle *This = impl_from_IHTMLStyle(iface);
855 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
859 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
861 FIXME("not supported vt %d\n", V_VT(&v));
867 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
869 HTMLStyle *This = impl_from_IHTMLStyle(iface);
871 TRACE("(%p)->(%p)\n", This, p);
874 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
877 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
879 HTMLStyle *This = impl_from_IHTMLStyle(iface);
880 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
884 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
886 HTMLStyle *This = impl_from_IHTMLStyle(iface);
887 FIXME("(%p)->(%p)\n", This, p);
891 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
893 HTMLStyle *This = impl_from_IHTMLStyle(iface);
895 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
899 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
900 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
903 FIXME("unsupported vt=%d\n", V_VT(&v));
909 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
911 HTMLStyle *This = impl_from_IHTMLStyle(iface);
913 TRACE("(%p)->(%p)\n", This, p);
916 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
919 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
921 HTMLStyle *This = impl_from_IHTMLStyle(iface);
923 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
925 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
928 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
930 HTMLStyle *This = impl_from_IHTMLStyle(iface);
932 TRACE("(%p)->(%p)\n", This, p);
934 return get_style_attr(This, STYLEID_BACKGROUND, p);
937 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
939 HTMLStyle *This = impl_from_IHTMLStyle(iface);
941 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
945 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
948 static const WCHAR format[] = {'#','%','0','6','x',0};
950 wsprintfW(value, format, V_I4(&v));
951 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
954 FIXME("unsupported vt %d\n", V_VT(&v));
960 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
962 HTMLStyle *This = impl_from_IHTMLStyle(iface);
963 TRACE("(%p)->(%p)\n", This, p);
966 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
969 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
971 HTMLStyle *This = impl_from_IHTMLStyle(iface);
973 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
975 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
978 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
980 HTMLStyle *This = impl_from_IHTMLStyle(iface);
982 TRACE("(%p)->(%p)\n", This, p);
984 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
987 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
989 HTMLStyle *This = impl_from_IHTMLStyle(iface);
990 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
991 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
992 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
993 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
995 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
997 /* fontWeight can only be one of the following */
998 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
999 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
1001 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
1004 return E_INVALIDARG;
1007 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
1009 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1011 TRACE("(%p)->(%p)\n", This, p);
1013 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1016 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1018 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1019 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1023 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1025 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1026 FIXME("(%p)->(%p)\n", This, p);
1030 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1032 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1034 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1036 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1039 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1041 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1043 TRACE("(%p)->(%p)\n", This, p);
1045 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1048 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1050 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1051 WCHAR buf[14], *pos_val;
1057 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1059 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1063 val_len = val ? strlenW(val) : 0;
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, *posy;
1071 nsAString_GetData(&pos_str, &pos);
1072 posy = strchrW(pos, ' ');
1074 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1076 TRACE("no space in %s\n", debugstr_w(pos));
1080 posy_len = strlenW(posy);
1081 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1084 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1086 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1087 pos_val[val_len+posy_len] = 0;
1089 hres = E_OUTOFMEMORY;
1092 nsAString_Finish(&pos_str);
1096 TRACE("setting position to %s\n", debugstr_w(pos_val));
1097 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1102 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1104 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1109 TRACE("(%p)->(%p)\n", This, p);
1111 nsAString_Init(&pos_str, NULL);
1112 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1113 if(SUCCEEDED(hres)) {
1114 const PRUnichar *pos, *space;
1116 nsAString_GetData(&pos_str, &pos);
1117 space = strchrW(pos, ' ');
1119 WARN("no space in %s\n", debugstr_w(pos));
1120 space = pos + strlenW(pos);
1124 ret = SysAllocStringLen(pos, space-pos);
1126 hres = E_OUTOFMEMORY;
1131 nsAString_Finish(&pos_str);
1135 TRACE("returning %s\n", debugstr_w(ret));
1141 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1143 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1144 WCHAR buf[14], *pos_val;
1150 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1152 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1156 val_len = val ? strlenW(val) : 0;
1158 nsAString_Init(&pos_str, NULL);
1159 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1160 if(SUCCEEDED(hres)) {
1161 const PRUnichar *pos, *space;
1164 nsAString_GetData(&pos_str, &pos);
1165 space = strchrW(pos, ' ');
1169 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1171 TRACE("no space in %s\n", debugstr_w(pos));
1173 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1176 posx_len = space-pos;
1178 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1180 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1182 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1183 pos_val[posx_len+val_len] = 0;
1185 hres = E_OUTOFMEMORY;
1188 nsAString_Finish(&pos_str);
1192 TRACE("setting position to %s\n", debugstr_w(pos_val));
1193 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1198 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1200 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1205 TRACE("(%p)->(%p)\n", This, p);
1207 nsAString_Init(&pos_str, NULL);
1208 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1209 if(SUCCEEDED(hres)) {
1210 const PRUnichar *pos, *posy;
1212 nsAString_GetData(&pos_str, &pos);
1213 posy = strchrW(pos, ' ');
1215 ret = SysAllocString(posy+1);
1217 hres = E_OUTOFMEMORY;
1222 nsAString_Finish(&pos_str);
1226 TRACE("returning %s\n", debugstr_w(ret));
1232 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1234 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1235 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1236 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1239 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1241 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1242 TRACE("(%p)->(%p)\n", This, p);
1243 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1246 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1248 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1249 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1250 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1253 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1255 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1256 TRACE("(%p)->(%p)\n", This, p);
1257 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1260 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1262 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1264 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1266 /* textDecoration can only be one of the following */
1267 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1268 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1269 strcmpiW(valBlink, v) == 0)
1271 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1274 return E_INVALIDARG;
1277 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1279 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1281 TRACE("(%p)->(%p)\n", This, p);
1283 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1286 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1288 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1290 TRACE("(%p)->(%x)\n", This, v);
1292 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1295 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1297 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1299 TRACE("(%p)->(%p)\n", This, p);
1301 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1304 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1306 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1308 TRACE("(%p)->(%x)\n", This, v);
1310 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1313 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1315 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1317 TRACE("(%p)->(%p)\n", This, p);
1319 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1322 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1324 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1326 TRACE("(%p)->(%x)\n", This, v);
1328 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1331 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1333 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1335 TRACE("(%p)->(%p)\n", This, p);
1337 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1340 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1342 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1344 TRACE("(%p)->(%x)\n", This, v);
1346 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1349 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1351 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1353 TRACE("(%p)->(%p)\n", This, p);
1355 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1358 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1360 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1362 TRACE("(%p)->(%x)\n", This, v);
1364 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1367 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1369 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1371 TRACE("(%p)->(%p)\n", This, p);
1373 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1376 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1378 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1380 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1384 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1386 FIXME("not implemented vt %d\n", V_VT(&v));
1393 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1395 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1399 TRACE("(%p)->(%p)\n", This, p);
1401 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1410 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1412 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1413 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1417 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1419 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1420 FIXME("(%p)->(%p)\n", This, p);
1424 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1426 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1428 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1430 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1433 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1435 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1437 TRACE("(%p)->(%p)\n", This, p);
1439 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1442 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1444 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1445 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1449 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1451 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1452 FIXME("(%p)->(%p)\n", This, p);
1456 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1458 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1459 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1463 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1465 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1466 FIXME("(%p)->(%p)\n", This, p);
1470 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1472 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1474 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1476 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, ATTR_FIX_PX);
1479 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1481 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1483 TRACE("(%p)->(%p)\n", This, p);
1485 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1488 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1490 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1492 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1494 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, &v, ATTR_FIX_PX);
1497 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1499 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1500 TRACE("(%p)->(%p)\n", This, p);
1501 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1504 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1506 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1508 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1510 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, &v, ATTR_FIX_PX);
1513 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1515 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1517 TRACE("(%p)->(%p)\n", This, p);
1519 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
1522 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1524 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1526 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1528 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, &v, ATTR_FIX_PX);
1531 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1533 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1535 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1537 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1540 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1542 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1544 TRACE("(%p)->(%p)\n", This, p);
1546 return get_style_attr(This, STYLEID_MARGIN, p);
1549 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1551 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1552 TRACE("(%p)->(%p)\n", This, p);
1553 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1556 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1558 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1560 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1562 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, &v, ATTR_FIX_PX);
1565 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1567 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1569 TRACE("(%p)->(%p)\n", This, p);
1571 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
1574 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1576 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1578 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1580 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, &v, ATTR_FIX_PX);
1583 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1585 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1587 TRACE("(%p)->(%p)\n", This, p);
1589 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
1592 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1594 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1596 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1598 return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, &v, ATTR_FIX_PX);
1601 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1603 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1605 TRACE("(%p)->(%p)\n", This, p);
1607 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
1610 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1612 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1614 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1620 wsprintfW(buf, px_formatW, V_I4(&v));
1621 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1624 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1626 FIXME("unsupported vt=%d\n", V_VT(&v));
1632 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1634 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1638 TRACE("(%p)->(%p)\n", This, p);
1640 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1649 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1651 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1653 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1655 return set_style_attr(This, STYLEID_PADDING, v, 0);
1658 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1660 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1662 TRACE("(%p)->(%p)\n", This, p);
1664 return get_style_attr(This, STYLEID_PADDING, p);
1667 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1669 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1671 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1673 return set_style_attr(This, STYLEID_BORDER, v, 0);
1676 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1678 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1680 TRACE("(%p)->(%p)\n", This, p);
1682 return get_style_attr(This, STYLEID_BORDER, p);
1685 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1687 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1688 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1689 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1692 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1694 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1695 TRACE("(%p)->(%p)\n", This, p);
1696 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1699 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1701 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1702 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1703 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1706 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1708 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1709 TRACE("(%p)->(%p)\n", This, p);
1710 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1713 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1715 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1716 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1717 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1720 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1722 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1723 TRACE("(%p)->(%p)\n", This, p);
1724 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1727 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1729 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1731 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1733 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1736 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1738 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1740 TRACE("(%p)->(%p)\n", This, p);
1742 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1745 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1747 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1749 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1751 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1754 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1756 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1758 TRACE("(%p)->(%p)\n", This, p);
1760 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1763 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1765 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1767 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1769 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1772 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1774 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1776 TRACE("(%p)->(%p)\n", This, p);
1778 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1781 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1783 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1785 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1787 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1790 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1792 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1794 TRACE("(%p)->(%p)\n", This, p);
1796 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1799 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1801 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1803 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1805 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1808 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1810 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1812 TRACE("(%p)->(%p)\n", This, p);
1814 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1817 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1819 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1821 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1823 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1826 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(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_LEFT_COLOR, p, 0);
1835 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1837 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1838 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1839 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1842 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1844 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1845 TRACE("(%p)->(%p)\n", This, p);
1846 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1849 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1851 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1852 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1853 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1856 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1858 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1860 TRACE("(%p)->(%p)\n", This, p);
1862 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1865 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1867 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1868 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1869 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1872 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1874 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1875 TRACE("(%p)->(%p)\n", This, p);
1876 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1879 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1881 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1883 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1884 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1887 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1889 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1890 TRACE("(%p)->(%p)\n", This, p);
1891 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1894 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1896 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1897 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1898 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1901 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1903 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1904 TRACE("(%p)->(%p)\n", This, p);
1905 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1908 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1910 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1911 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1912 HRESULT hres = S_OK;
1917 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1919 while(v[i] && hres == S_OK)
1921 if(v[i] == (WCHAR)' ')
1923 pstyle = SysAllocStringLen(&v[last], (i-last));
1924 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1926 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1927 hres = E_INVALIDARG;
1929 SysFreeString(pstyle);
1937 pstyle = SysAllocStringLen(&v[last], i-last);
1938 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1940 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1941 hres = E_INVALIDARG;
1943 SysFreeString(pstyle);
1947 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1952 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1954 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1955 TRACE("(%p)->(%p)\n", This, p);
1956 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1959 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1961 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1962 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1964 if(!is_valid_border_style(v))
1965 return E_INVALIDARG;
1967 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1970 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1972 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1973 TRACE("(%p)->(%p)\n", This, p);
1974 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1977 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1979 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1980 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1982 if(!is_valid_border_style(v))
1983 return E_INVALIDARG;
1985 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1988 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1990 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1991 TRACE("(%p)->(%p)\n", This, p);
1992 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
1995 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
1997 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1998 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2000 if(!is_valid_border_style(v))
2001 return E_INVALIDARG;
2003 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
2006 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
2008 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2009 TRACE("(%p)->(%p)\n", This, p);
2010 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
2013 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
2015 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2016 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2018 if(!is_valid_border_style(v))
2019 return E_INVALIDARG;
2021 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
2024 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
2026 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2027 TRACE("(%p)->(%p)\n", This, p);
2028 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2031 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2033 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2035 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
2037 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2040 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2042 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2044 TRACE("(%p)->(%p)\n", This, p);
2047 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
2050 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2052 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2054 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2056 return set_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, &v, ATTR_FIX_PX);
2059 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2061 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2065 TRACE("(%p)->(%p)\n", This, p);
2067 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
2076 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2078 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2079 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2083 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2085 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2086 FIXME("(%p)->(%p)\n", This, p);
2090 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2092 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2093 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2097 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2099 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2100 FIXME("(%p)->(%p)\n", This, p);
2104 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2106 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2108 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2110 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2113 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2115 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2117 TRACE("(%p)->(%p)\n", This, p);
2119 return get_style_attr(This, STYLEID_DISPLAY, p);
2122 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2124 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2126 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2128 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2131 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2133 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2135 TRACE("(%p)->(%p)\n", This, p);
2137 return get_style_attr(This, STYLEID_VISIBILITY, p);
2140 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2142 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2143 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2147 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2149 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2150 FIXME("(%p)->(%p)\n", This, p);
2154 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2156 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2157 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2161 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2163 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2164 FIXME("(%p)->(%p)\n", This, p);
2168 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2170 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2171 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2175 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2177 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2178 FIXME("(%p)->(%p)\n", This, p);
2182 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2184 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2185 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2189 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2191 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2192 FIXME("(%p)->(%p)\n", This, p);
2196 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2198 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2199 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2203 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2205 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2206 FIXME("(%p)->(%p)\n", This, p);
2210 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2212 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2214 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2216 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2219 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2221 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2225 TRACE("(%p)->(%p)\n", This, p);
2227 hres = get_style_attr(This, STYLEID_TOP, &ret);
2236 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2238 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2240 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2242 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2245 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2247 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2251 TRACE("(%p)->(%p)\n", This, p);
2253 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2262 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2264 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2265 TRACE("(%p)->(%p)\n", This, p);
2266 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2269 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2271 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2273 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2277 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2280 static const WCHAR format[] = {'%','d',0};
2282 wsprintfW(value, format, V_I4(&v));
2283 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2286 FIXME("unimplemented vt %d\n", V_VT(&v));
2293 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2295 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2297 TRACE("(%p)->(%p)\n", This, p);
2299 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2302 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2304 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2305 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2306 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2307 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2308 static const WCHAR szAuto[] = {'a','u','t','o',0};
2310 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2312 /* overflow can only be one of the follow values. */
2313 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2314 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2316 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2319 return E_INVALIDARG;
2323 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2325 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2327 TRACE("(%p)->(%p)\n", This, p);
2330 return E_INVALIDARG;
2332 return get_style_attr(This, STYLEID_OVERFLOW, p);
2335 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2337 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2339 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2341 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, v, 0);
2344 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2346 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2348 TRACE("(%p)->(%p)\n", This, p);
2350 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, p, 0);
2353 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2355 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2357 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2359 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, v, 0);
2362 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2364 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2366 TRACE("(%p)->(%p)\n", This, p);
2368 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, p, 0);
2371 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2373 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2377 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2379 nsAString_InitDepend(&text_str, v);
2380 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2381 nsAString_Finish(&text_str);
2382 if(NS_FAILED(nsres)) {
2383 FIXME("SetCssStyle failed: %08x\n", nsres);
2390 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2392 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2396 TRACE("(%p)->(%p)\n", This, p);
2398 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2399 nsAString_Init(&text_str, NULL);
2400 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2401 if(NS_SUCCEEDED(nsres)) {
2402 const PRUnichar *text;
2404 nsAString_GetData(&text_str, &text);
2405 *p = *text ? SysAllocString(text) : NULL;
2407 FIXME("GetCssStyle failed: %08x\n", nsres);
2411 nsAString_Finish(&text_str);
2415 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2417 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2418 FIXME("(%p)->()\n", This);
2422 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2424 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2425 FIXME("(%p)->()\n", This);
2429 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2431 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2432 FIXME("(%p)->()\n", This);
2436 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2438 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2439 FIXME("(%p)->()\n", This);
2443 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2445 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2446 FIXME("(%p)->()\n", This);
2450 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2452 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2453 FIXME("(%p)->()\n", This);
2457 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2459 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2460 FIXME("(%p)->()\n", This);
2464 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2466 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2467 FIXME("(%p)->()\n", This);
2471 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2473 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2475 TRACE("(%p)->(%f)\n", This, v);
2477 return set_style_pos(This, STYLEID_TOP, v);
2480 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2482 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2484 TRACE("(%p)->(%p)\n", This, p);
2489 return get_nsstyle_pos(This, STYLEID_TOP, p);
2492 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2494 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2496 TRACE("(%p)->(%f)\n", This, v);
2498 return set_style_pos(This, STYLEID_LEFT, v);
2501 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2503 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2505 TRACE("(%p)->(%p)\n", This, p);
2510 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2513 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2515 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2517 TRACE("(%p)->(%f)\n", This, v);
2519 return set_style_pos(This, STYLEID_WIDTH, v);
2522 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2524 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2526 TRACE("(%p)->(%p)\n", This, p);
2531 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2537 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2539 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2541 TRACE("(%p)->(%f)\n", This, v);
2543 return set_style_pos(This, STYLEID_HEIGHT, v);
2546 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2548 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2550 TRACE("(%p)->(%p)\n", This, p);
2555 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2561 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2563 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2565 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2567 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2570 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2572 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2574 TRACE("(%p)->(%p)\n", This, p);
2576 return get_style_attr(This, STYLEID_CURSOR, p);
2579 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2581 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2583 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2585 return set_style_attr(This, STYLEID_CLIP, v, 0);
2588 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2590 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2592 TRACE("(%p)->(%p)\n", This, p);
2594 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2597 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2599 nsAString name_str, val_str, empty_str;
2602 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2604 TRACE("%s\n", debugstr_w(val));
2606 nsAString_InitDepend(&name_str, opacityW);
2607 nsAString_InitDepend(&val_str, val);
2608 nsAString_InitDepend(&empty_str, emptyW);
2610 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2611 if(NS_FAILED(nsres))
2612 ERR("SetProperty failed: %08x\n", nsres);
2614 nsAString_Finish(&name_str);
2615 nsAString_Finish(&val_str);
2616 nsAString_Finish(&empty_str);
2619 static void update_filter(HTMLStyle *This)
2621 const WCHAR *ptr = This->filter, *ptr2;
2623 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2626 set_opacity(This, emptyW);
2631 while(isspaceW(*ptr))
2637 while(isalnumW(*ptr))
2640 WARN("unexpected char '%c'\n", *ptr);
2644 WARN("expected '('\n");
2648 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2649 static const WCHAR formatW[] = {'%','f',0};
2650 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2654 while(isspaceW(*ptr))
2658 while(*ptr && *ptr != ',' && *ptr != ')')
2661 WARN("unexpected end of string\n");
2665 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2666 float fval = 0.0f, e = 0.1f;
2669 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2671 while(isdigitW(*ptr2))
2672 fval = fval*10.0f + (float)(*ptr2++ - '0');
2675 while(isdigitW(*++ptr2)) {
2676 fval += e * (float)(*ptr2++ - '0');
2681 sprintfW(buf, formatW, fval * 0.01f);
2682 set_opacity(This, buf);
2684 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2689 }while(*ptr != ')');
2691 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2692 ptr = strchrW(ptr, ')');
2700 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2702 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2703 WCHAR *new_filter = NULL;
2705 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2708 new_filter = heap_strdupW(v);
2710 return E_OUTOFMEMORY;
2713 heap_free(This->filter);
2714 This->filter = new_filter;
2716 update_filter(This);
2720 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2722 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2724 TRACE("(%p)->(%p)\n", This, p);
2727 *p = SysAllocString(This->filter);
2729 return E_OUTOFMEMORY;
2737 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2738 VARIANT AttributeValue, LONG lFlags)
2740 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2744 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2745 V_VT(&AttributeValue), lFlags);
2747 if(!strAttributeName)
2748 return E_INVALIDARG;
2751 FIXME("Parameter lFlags ignored\n");
2753 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2754 LOCALE_USER_DEFAULT, &dispid);
2758 DISPID dispidNamed = DISPID_PROPERTYPUT;
2762 params.rgvarg = &AttributeValue;
2763 params.cNamedArgs = 1;
2764 params.rgdispidNamedArgs = &dispidNamed;
2766 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2767 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2771 FIXME("Custom attributes not supported.\n");
2774 TRACE("ret: %08x\n", hres);
2779 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2780 LONG lFlags, VARIANT *AttributeValue)
2782 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2786 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2787 AttributeValue, lFlags);
2789 if(!AttributeValue || !strAttributeName)
2790 return E_INVALIDARG;
2793 FIXME("Parameter lFlags ignored\n");
2795 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2796 LOCALE_USER_DEFAULT, &dispid);
2799 DISPPARAMS params = {NULL, NULL, 0, 0 };
2801 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2802 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2806 FIXME("Custom attributes not supported.\n");
2812 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2813 LONG lFlags, VARIANT_BOOL *pfSuccess)
2815 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2816 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2821 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2823 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2824 FIXME("(%p)->(%p)\n", This, String);
2828 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2829 HTMLStyle_QueryInterface,
2832 HTMLStyle_GetTypeInfoCount,
2833 HTMLStyle_GetTypeInfo,
2834 HTMLStyle_GetIDsOfNames,
2836 HTMLStyle_put_fontFamily,
2837 HTMLStyle_get_fontFamily,
2838 HTMLStyle_put_fontStyle,
2839 HTMLStyle_get_fontStyle,
2840 HTMLStyle_put_fontVariant,
2841 HTMLStyle_get_fontVariant,
2842 HTMLStyle_put_fontWeight,
2843 HTMLStyle_get_fontWeight,
2844 HTMLStyle_put_fontSize,
2845 HTMLStyle_get_fontSize,
2848 HTMLStyle_put_color,
2849 HTMLStyle_get_color,
2850 HTMLStyle_put_background,
2851 HTMLStyle_get_background,
2852 HTMLStyle_put_backgroundColor,
2853 HTMLStyle_get_backgroundColor,
2854 HTMLStyle_put_backgroundImage,
2855 HTMLStyle_get_backgroundImage,
2856 HTMLStyle_put_backgroundRepeat,
2857 HTMLStyle_get_backgroundRepeat,
2858 HTMLStyle_put_backgroundAttachment,
2859 HTMLStyle_get_backgroundAttachment,
2860 HTMLStyle_put_backgroundPosition,
2861 HTMLStyle_get_backgroundPosition,
2862 HTMLStyle_put_backgroundPositionX,
2863 HTMLStyle_get_backgroundPositionX,
2864 HTMLStyle_put_backgroundPositionY,
2865 HTMLStyle_get_backgroundPositionY,
2866 HTMLStyle_put_wordSpacing,
2867 HTMLStyle_get_wordSpacing,
2868 HTMLStyle_put_letterSpacing,
2869 HTMLStyle_get_letterSpacing,
2870 HTMLStyle_put_textDecoration,
2871 HTMLStyle_get_textDecoration,
2872 HTMLStyle_put_textDecorationNone,
2873 HTMLStyle_get_textDecorationNone,
2874 HTMLStyle_put_textDecorationUnderline,
2875 HTMLStyle_get_textDecorationUnderline,
2876 HTMLStyle_put_textDecorationOverline,
2877 HTMLStyle_get_textDecorationOverline,
2878 HTMLStyle_put_textDecorationLineThrough,
2879 HTMLStyle_get_textDecorationLineThrough,
2880 HTMLStyle_put_textDecorationBlink,
2881 HTMLStyle_get_textDecorationBlink,
2882 HTMLStyle_put_verticalAlign,
2883 HTMLStyle_get_verticalAlign,
2884 HTMLStyle_put_textTransform,
2885 HTMLStyle_get_textTransform,
2886 HTMLStyle_put_textAlign,
2887 HTMLStyle_get_textAlign,
2888 HTMLStyle_put_textIndent,
2889 HTMLStyle_get_textIndent,
2890 HTMLStyle_put_lineHeight,
2891 HTMLStyle_get_lineHeight,
2892 HTMLStyle_put_marginTop,
2893 HTMLStyle_get_marginTop,
2894 HTMLStyle_put_marginRight,
2895 HTMLStyle_get_marginRight,
2896 HTMLStyle_put_marginBottom,
2897 HTMLStyle_get_marginBottom,
2898 HTMLStyle_put_marginLeft,
2899 HTMLStyle_get_marginLeft,
2900 HTMLStyle_put_margin,
2901 HTMLStyle_get_margin,
2902 HTMLStyle_put_paddingTop,
2903 HTMLStyle_get_paddingTop,
2904 HTMLStyle_put_paddingRight,
2905 HTMLStyle_get_paddingRight,
2906 HTMLStyle_put_paddingBottom,
2907 HTMLStyle_get_paddingBottom,
2908 HTMLStyle_put_paddingLeft,
2909 HTMLStyle_get_paddingLeft,
2910 HTMLStyle_put_padding,
2911 HTMLStyle_get_padding,
2912 HTMLStyle_put_border,
2913 HTMLStyle_get_border,
2914 HTMLStyle_put_borderTop,
2915 HTMLStyle_get_borderTop,
2916 HTMLStyle_put_borderRight,
2917 HTMLStyle_get_borderRight,
2918 HTMLStyle_put_borderBottom,
2919 HTMLStyle_get_borderBottom,
2920 HTMLStyle_put_borderLeft,
2921 HTMLStyle_get_borderLeft,
2922 HTMLStyle_put_borderColor,
2923 HTMLStyle_get_borderColor,
2924 HTMLStyle_put_borderTopColor,
2925 HTMLStyle_get_borderTopColor,
2926 HTMLStyle_put_borderRightColor,
2927 HTMLStyle_get_borderRightColor,
2928 HTMLStyle_put_borderBottomColor,
2929 HTMLStyle_get_borderBottomColor,
2930 HTMLStyle_put_borderLeftColor,
2931 HTMLStyle_get_borderLeftColor,
2932 HTMLStyle_put_borderWidth,
2933 HTMLStyle_get_borderWidth,
2934 HTMLStyle_put_borderTopWidth,
2935 HTMLStyle_get_borderTopWidth,
2936 HTMLStyle_put_borderRightWidth,
2937 HTMLStyle_get_borderRightWidth,
2938 HTMLStyle_put_borderBottomWidth,
2939 HTMLStyle_get_borderBottomWidth,
2940 HTMLStyle_put_borderLeftWidth,
2941 HTMLStyle_get_borderLeftWidth,
2942 HTMLStyle_put_borderStyle,
2943 HTMLStyle_get_borderStyle,
2944 HTMLStyle_put_borderTopStyle,
2945 HTMLStyle_get_borderTopStyle,
2946 HTMLStyle_put_borderRightStyle,
2947 HTMLStyle_get_borderRightStyle,
2948 HTMLStyle_put_borderBottomStyle,
2949 HTMLStyle_get_borderBottomStyle,
2950 HTMLStyle_put_borderLeftStyle,
2951 HTMLStyle_get_borderLeftStyle,
2952 HTMLStyle_put_width,
2953 HTMLStyle_get_width,
2954 HTMLStyle_put_height,
2955 HTMLStyle_get_height,
2956 HTMLStyle_put_styleFloat,
2957 HTMLStyle_get_styleFloat,
2958 HTMLStyle_put_clear,
2959 HTMLStyle_get_clear,
2960 HTMLStyle_put_display,
2961 HTMLStyle_get_display,
2962 HTMLStyle_put_visibility,
2963 HTMLStyle_get_visibility,
2964 HTMLStyle_put_listStyleType,
2965 HTMLStyle_get_listStyleType,
2966 HTMLStyle_put_listStylePosition,
2967 HTMLStyle_get_listStylePosition,
2968 HTMLStyle_put_listStyleImage,
2969 HTMLStyle_get_listStyleImage,
2970 HTMLStyle_put_listStyle,
2971 HTMLStyle_get_listStyle,
2972 HTMLStyle_put_whiteSpace,
2973 HTMLStyle_get_whiteSpace,
2978 HTMLStyle_get_position,
2979 HTMLStyle_put_zIndex,
2980 HTMLStyle_get_zIndex,
2981 HTMLStyle_put_overflow,
2982 HTMLStyle_get_overflow,
2983 HTMLStyle_put_pageBreakBefore,
2984 HTMLStyle_get_pageBreakBefore,
2985 HTMLStyle_put_pageBreakAfter,
2986 HTMLStyle_get_pageBreakAfter,
2987 HTMLStyle_put_cssText,
2988 HTMLStyle_get_cssText,
2989 HTMLStyle_put_pixelTop,
2990 HTMLStyle_get_pixelTop,
2991 HTMLStyle_put_pixelLeft,
2992 HTMLStyle_get_pixelLeft,
2993 HTMLStyle_put_pixelWidth,
2994 HTMLStyle_get_pixelWidth,
2995 HTMLStyle_put_pixelHeight,
2996 HTMLStyle_get_pixelHeight,
2997 HTMLStyle_put_posTop,
2998 HTMLStyle_get_posTop,
2999 HTMLStyle_put_posLeft,
3000 HTMLStyle_get_posLeft,
3001 HTMLStyle_put_posWidth,
3002 HTMLStyle_get_posWidth,
3003 HTMLStyle_put_posHeight,
3004 HTMLStyle_get_posHeight,
3005 HTMLStyle_put_cursor,
3006 HTMLStyle_get_cursor,
3009 HTMLStyle_put_filter,
3010 HTMLStyle_get_filter,
3011 HTMLStyle_setAttribute,
3012 HTMLStyle_getAttribute,
3013 HTMLStyle_removeAttribute,
3017 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3019 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
3024 c = strcmpW(style_tbl[i].name, name);
3026 *dispid = style_tbl[i].dispid;
3036 return DISP_E_UNKNOWNNAME;
3039 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3041 HTMLStyle_get_dispid,
3046 static const tid_t HTMLStyle_iface_tids[] = {
3055 static dispex_static_data_t HTMLStyle_dispex = {
3056 &HTMLStyle_dispex_vtbl,
3059 HTMLStyle_iface_tids
3062 HRESULT HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret)
3066 style = heap_alloc_zero(sizeof(HTMLStyle));
3068 return E_OUTOFMEMORY;
3070 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3072 style->nsstyle = nsstyle;
3073 HTMLStyle2_Init(style);
3074 HTMLStyle3_Init(style);
3076 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3078 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);