2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "mshtml_private.h"
31 #include "htmlstyle.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 static const WCHAR attrBackground[] =
39 {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPosition[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
46 static const WCHAR attrBackgroundPositionX[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
48 static const WCHAR attrBackgroundPositionY[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
50 static const WCHAR attrBackgroundRepeat[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
52 static const WCHAR attrBorder[] =
53 {'b','o','r','d','e','r',0};
54 static const WCHAR attrBorderBottom[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
56 static const WCHAR attrBorderBottomColor[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
58 static const WCHAR attrBorderBottomStyle[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
60 static const WCHAR attrBorderBottomWidth[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
62 static const WCHAR attrBorderColor[] =
63 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
64 static const WCHAR attrBorderLeft[] =
65 {'b','o','r','d','e','r','-','l','e','f','t',0};
66 static const WCHAR attrBorderLeftColor[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
68 static const WCHAR attrBorderLeftStyle[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
70 static const WCHAR attrBorderLeftWidth[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
72 static const WCHAR attrBorderRight[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
74 static const WCHAR attrBorderRightColor[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
76 static const WCHAR attrBorderRightStyle[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
78 static const WCHAR attrBorderRightWidth[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
80 static const WCHAR attrBorderTop[] =
81 {'b','o','r','d','e','r','-','t','o','p',0};
82 static const WCHAR attrBorderTopColor[] =
83 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
84 static const WCHAR attrBorderStyle[] =
85 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopStyle[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopWidth[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
90 static const WCHAR attrBorderWidth[] =
91 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
92 static const WCHAR attrBottom[] =
93 {'b','o','t','t','o','m',0};
94 static const WCHAR attrClip[] =
96 static const WCHAR attrColor[] =
97 {'c','o','l','o','r',0};
98 static const WCHAR attrCursor[] =
99 {'c','u','r','s','o','r',0};
100 static const WCHAR attrDisplay[] =
101 {'d','i','s','p','l','a','y',0};
102 static const WCHAR attrFilter[] =
103 {'f','i','l','e','t','e','r',0};
104 static const WCHAR attrFontFamily[] =
105 {'f','o','n','t','-','f','a','m','i','l','y',0};
106 static const WCHAR attrFontSize[] =
107 {'f','o','n','t','-','s','i','z','e',0};
108 static const WCHAR attrFontStyle[] =
109 {'f','o','n','t','-','s','t','y','l','e',0};
110 static const WCHAR attrFontVariant[] =
111 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
112 static const WCHAR attrFontWeight[] =
113 {'f','o','n','t','-','w','e','i','g','h','t',0};
114 static const WCHAR attrHeight[] =
115 {'h','e','i','g','h','t',0};
116 static const WCHAR attrLeft[] =
118 static const WCHAR attrLetterSpacing[] =
119 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
120 static const WCHAR attrLineHeight[] =
121 {'l','i','n','e','-','h','e','i','g','h','t',0};
122 static const WCHAR attrMargin[] =
123 {'m','a','r','g','i','n',0};
124 static const WCHAR attrMarginBottom[] =
125 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
126 static const WCHAR attrMarginLeft[] =
127 {'m','a','r','g','i','n','-','l','e','f','t',0};
128 static const WCHAR attrMarginRight[] =
129 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
130 static const WCHAR attrMarginTop[] =
131 {'m','a','r','g','i','n','-','t','o','p',0};
132 static const WCHAR attrMinHeight[] =
133 {'m','i','n','-','h','e','i','g','h','t',0};
134 static const WCHAR attrOverflow[] =
135 {'o','v','e','r','f','l','o','w',0};
136 static const WCHAR attrPadding[] =
137 {'p','a','d','d','i','n','g',0};
138 static const WCHAR attrPaddingBottom[] =
139 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
140 static const WCHAR attrPaddingLeft[] =
141 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
142 static const WCHAR attrPaddingRight[] =
143 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
144 static const WCHAR attrPaddingTop[] =
145 {'p','a','d','d','i','n','g','-','t','o','p',0};
146 static const WCHAR attrPageBreakAfter[] =
147 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
148 static const WCHAR attrPageBreakBefore[] =
149 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
150 static const WCHAR attrPosition[] =
151 {'p','o','s','i','t','i','o','n',0};
152 static const WCHAR attrRight[] =
153 {'r','i','g','h','t',0};
154 static const WCHAR attrTextAlign[] =
155 {'t','e','x','t','-','a','l','i','g','n',0};
156 static const WCHAR attrTextDecoration[] =
157 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
158 static const WCHAR attrTextIndent[] =
159 {'t','e','x','t','-','i','n','d','e','n','t',0};
160 static const WCHAR attrTop[] =
162 static const WCHAR attrVerticalAlign[] =
163 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
164 static const WCHAR attrVisibility[] =
165 {'v','i','s','i','b','i','l','i','t','y',0};
166 static const WCHAR attrWidth[] =
167 {'w','i','d','t','h',0};
168 static const WCHAR attrWordSpacing[] =
169 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
170 static const WCHAR attrWordWrap[] =
171 {'w','o','r','d','-','w','r','a','p',0};
172 static const WCHAR attrZIndex[] =
173 {'z','-','i','n','d','e','x',0};
179 {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
180 {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
181 {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
182 {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION},
183 {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX},
184 {attrBackgroundPositionY, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY},
185 {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
186 {attrBorder, DISPID_IHTMLSTYLE_BORDER},
187 {attrBorderBottom, DISPID_IHTMLSTYLE_BORDERBOTTOM},
188 {attrBorderBottomColor, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR},
189 {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
190 {attrBorderBottomWidth, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH},
191 {attrBorderColor, DISPID_IHTMLSTYLE_BORDERCOLOR},
192 {attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
193 {attrBorderLeftColor, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR},
194 {attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
195 {attrBorderLeftWidth, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH},
196 {attrBorderRight, DISPID_IHTMLSTYLE_BORDERRIGHT},
197 {attrBorderRightColor, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR},
198 {attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
199 {attrBorderRightWidth, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH},
200 {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
201 {attrBorderTop, DISPID_IHTMLSTYLE_BORDERTOP},
202 {attrBorderTopColor, DISPID_IHTMLSTYLE_BORDERTOPCOLOR},
203 {attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
204 {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
205 {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
206 {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
207 {attrClip, DISPID_IHTMLSTYLE_CLIP},
208 {attrColor, DISPID_IHTMLSTYLE_COLOR},
209 {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
210 {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
211 {attrFilter, DISPID_IHTMLSTYLE_FILTER},
212 {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY},
213 {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE},
214 {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE},
215 {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT},
216 {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT},
217 {attrHeight, DISPID_IHTMLSTYLE_HEIGHT},
218 {attrLeft, DISPID_IHTMLSTYLE_LEFT},
219 {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING},
220 {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT},
221 {attrMargin, DISPID_IHTMLSTYLE_MARGIN},
222 {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM},
223 {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
224 {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
225 {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP},
226 {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
227 {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
228 {attrPadding, DISPID_IHTMLSTYLE_PADDING},
229 {attrPaddingBottom, DISPID_IHTMLSTYLE_PADDINGBOTTOM},
230 {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
231 {attrPaddingRight, DISPID_IHTMLSTYLE_PADDINGRIGHT},
232 {attrPaddingTop, DISPID_IHTMLSTYLE_PADDINGTOP},
233 {attrPageBreakAfter, DISPID_IHTMLSTYLE_PAGEBREAKAFTER},
234 {attrPageBreakBefore, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE},
235 {attrPosition, DISPID_IHTMLSTYLE2_POSITION},
236 {attrRight, DISPID_IHTMLSTYLE2_RIGHT},
237 {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
238 {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION},
239 {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT},
240 {attrTop, DISPID_IHTMLSTYLE_TOP},
241 {attrVerticalAlign, DISPID_IHTMLSTYLE_VERTICALALIGN},
242 {attrVisibility, DISPID_IHTMLSTYLE_VISIBILITY},
243 {attrWidth, DISPID_IHTMLSTYLE_WIDTH},
244 {attrWordSpacing, DISPID_IHTMLSTYLE_WORDSPACING},
245 {attrWordWrap, DISPID_IHTMLSTYLE3_WORDWRAP},
246 {attrZIndex, DISPID_IHTMLSTYLE_ZINDEX}
249 static const WCHAR valLineThrough[] =
250 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
251 static const WCHAR valUnderline[] =
252 {'u','n','d','e','r','l','i','n','e',0};
253 static const WCHAR szNormal[] =
254 {'n','o','r','m','a','l',0};
255 static const WCHAR styleNone[] =
257 static const WCHAR valOverline[] =
258 {'o','v','e','r','l','i','n','e',0};
259 static const WCHAR valBlink[] =
260 {'b','l','i','n','k',0};
262 static const WCHAR px_formatW[] = {'%','d','p','x',0};
263 static const WCHAR emptyW[] = {0};
265 static LPWSTR fix_px_value(LPCWSTR val)
270 while(*ptr && isspaceW(*ptr))
275 while(*ptr && isdigitW(*ptr))
278 if(!*ptr || isspaceW(*ptr)) {
280 int len = strlenW(val)+1;
282 ret = heap_alloc((len+2)*sizeof(WCHAR));
283 memcpy(ret, val, (ptr-val)*sizeof(WCHAR));
289 TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
294 while(*ptr && !isspaceW(*ptr))
301 static LPWSTR fix_url_value(LPCWSTR val)
305 static const WCHAR urlW[] = {'u','r','l','('};
307 if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
310 ret = heap_strdupW(val);
312 for(ptr = ret; *ptr; ptr++) {
320 HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
322 nsAString str_name, str_value, str_empty;
326 if(flags & ATTR_FIX_PX)
327 val = fix_px_value(value);
328 if(flags & ATTR_FIX_URL)
329 val = fix_url_value(value);
331 nsAString_InitDepend(&str_name, style_tbl[sid].name);
332 nsAString_InitDepend(&str_value, val ? val : value);
333 nsAString_InitDepend(&str_empty, emptyW);
335 nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
337 ERR("SetProperty failed: %08x\n", nsres);
339 nsAString_Finish(&str_name);
340 nsAString_Finish(&str_value);
341 nsAString_Finish(&str_empty);
347 static HRESULT var_to_styleval(const VARIANT *v, WCHAR *buf, DWORD flags, const WCHAR **ret)
358 case VT_BSTR|VT_BYREF:
359 *ret = *V_BSTRREF(v);
363 static const WCHAR formatW[] = {'%','d',0};
364 static const WCHAR hex_formatW[] = {'#','%','0','6','x',0};
366 if(flags & ATTR_HEX_INT)
367 wsprintfW(buf, hex_formatW, V_I4(v));
368 else if(flags & ATTR_FIX_PX)
369 wsprintfW(buf, px_formatW, V_I4(v));
371 wsprintfW(buf, formatW, V_I4(v));
377 FIXME("not implemented vt %d\n", V_VT(v));
383 HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
389 hres = var_to_styleval(value, buf, flags, &val);
393 return set_nsstyle_attr(nsstyle, sid, val, flags);
396 static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
398 return set_nsstyle_attr(This->nsstyle, sid, value, flags);
401 static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
406 nsAString_InitDepend(&str_name, style_tbl[sid].name);
408 nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
409 if(NS_FAILED(nsres)) {
410 ERR("SetProperty failed: %08x\n", nsres);
414 nsAString_Finish(&str_name);
419 static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
429 ret = SysAllocString(val);
431 return E_OUTOFMEMORY;
433 len = SysStringLen(ret);
435 if(flags & ATTR_REMOVE_COMMA) {
439 for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
445 new_ret = SysAllocStringLen(NULL, new_len);
448 return E_OUTOFMEMORY;
451 for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
465 HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p, DWORD flags)
468 const PRUnichar *value;
471 nsAString_Init(&str_value, NULL);
473 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
475 nsAString_GetData(&str_value, &value);
476 hres = nsstyle_to_bstr(value, flags, p);
477 nsAString_Finish(&str_value);
479 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_w(*p));
483 HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
486 const PRUnichar *value;
490 nsAString_Init(&str_value, NULL);
492 get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
494 nsAString_GetData(&str_value, &value);
496 if(flags & ATTR_STR_TO_INT) {
497 const PRUnichar *ptr = value;
506 while(isdigitW(*ptr))
507 i = i*10 + (*ptr++ - '0');
511 V_I4(p) = neg ? -i : i;
519 hres = nsstyle_to_bstr(value, flags, &str);
520 if(SUCCEEDED(hres)) {
526 nsAString_Finish(&str_value);
528 TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
532 static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
534 return get_nsstyle_attr(This->nsstyle, sid, p, 0);
537 static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
540 const PRUnichar *value;
542 nsAString_Init(&str_value, NULL);
544 get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
546 nsAString_GetData(&str_value, &value);
547 *p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
548 nsAString_Finish(&str_value);
550 TRACE("%s -> %x\n", debugstr_w(style_tbl[sid].name), *p);
554 static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
557 WCHAR szFormat[] = {'%','.','0','f','p','x',0};
559 value = floor(value);
561 sprintfW(szValue, szFormat, value);
563 return set_style_attr(This, sid, szValue, 0);
566 static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
570 WCHAR pxW[] = {'p','x',0};
572 TRACE("%p %d %p\n", This, sid, p);
576 nsAString_Init(&str_value, NULL);
578 hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
582 const PRUnichar *value;
584 nsAString_GetData(&str_value, &value);
587 *p = strtolW(value, &ptr, 10);
589 if(*ptr && strcmpW(ptr, pxW))
591 nsAString_Finish(&str_value);
592 FIXME("only px values are currently supported\n");
598 TRACE("ret %f\n", *p);
600 nsAString_Finish(&str_value);
605 static BOOL is_valid_border_style(BSTR v)
607 static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
608 static const WCHAR styleDashed[] = {'d','a','s','h','e','d',0};
609 static const WCHAR styleSolid[] = {'s','o','l','i','d',0};
610 static const WCHAR styleDouble[] = {'d','o','u','b','l','e',0};
611 static const WCHAR styleGroove[] = {'g','r','o','o','v','e',0};
612 static const WCHAR styleRidge[] = {'r','i','d','g','e',0};
613 static const WCHAR styleInset[] = {'i','n','s','e','t',0};
614 static const WCHAR styleOutset[] = {'o','u','t','s','e','t',0};
616 TRACE("%s\n", debugstr_w(v));
618 if(!v || strcmpiW(v, styleNone) == 0 || strcmpiW(v, styleDotted) == 0 ||
619 strcmpiW(v, styleDashed) == 0 || strcmpiW(v, styleSolid) == 0 ||
620 strcmpiW(v, styleDouble) == 0 || strcmpiW(v, styleGroove) == 0 ||
621 strcmpiW(v, styleRidge) == 0 || strcmpiW(v, styleInset) == 0 ||
622 strcmpiW(v, styleOutset) == 0 )
630 static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
632 return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
635 static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv)
637 HTMLStyle *This = impl_from_IHTMLStyle(iface);
641 if(IsEqualGUID(&IID_IUnknown, riid)) {
642 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
643 *ppv = &This->IHTMLStyle_iface;
644 }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
645 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
646 *ppv = &This->IHTMLStyle_iface;
647 }else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
648 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
649 *ppv = &This->IHTMLStyle2_iface;
650 }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
651 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
652 *ppv = &This->IHTMLStyle3_iface;
653 }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
654 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
655 *ppv = &This->IHTMLStyle4_iface;
656 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
657 return *ppv ? S_OK : E_NOINTERFACE;
661 IUnknown_AddRef((IUnknown*)*ppv);
665 WARN("unsupported %s\n", debugstr_guid(riid));
666 return E_NOINTERFACE;
669 static ULONG WINAPI HTMLStyle_AddRef(IHTMLStyle *iface)
671 HTMLStyle *This = impl_from_IHTMLStyle(iface);
672 LONG ref = InterlockedIncrement(&This->ref);
674 TRACE("(%p) ref=%d\n", This, ref);
679 static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
681 HTMLStyle *This = impl_from_IHTMLStyle(iface);
682 LONG ref = InterlockedDecrement(&This->ref);
684 TRACE("(%p) ref=%d\n", This, ref);
688 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
689 heap_free(This->filter);
690 release_dispex(&This->dispex);
697 static HRESULT WINAPI HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo)
699 HTMLStyle *This = impl_from_IHTMLStyle(iface);
700 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
703 static HRESULT WINAPI HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo,
704 LCID lcid, ITypeInfo **ppTInfo)
706 HTMLStyle *This = impl_from_IHTMLStyle(iface);
707 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
710 static HRESULT WINAPI HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid,
711 LPOLESTR *rgszNames, UINT cNames,
712 LCID lcid, DISPID *rgDispId)
714 HTMLStyle *This = impl_from_IHTMLStyle(iface);
715 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
719 static HRESULT WINAPI HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember,
720 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
721 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
723 HTMLStyle *This = impl_from_IHTMLStyle(iface);
724 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
725 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
728 static HRESULT WINAPI HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v)
730 HTMLStyle *This = impl_from_IHTMLStyle(iface);
732 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
734 return set_style_attr(This, STYLEID_FONT_FAMILY, v, 0);
737 static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
739 HTMLStyle *This = impl_from_IHTMLStyle(iface);
741 TRACE("(%p)->(%p)\n", This, p);
743 return get_style_attr(This, STYLEID_FONT_FAMILY, p);
746 static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
748 HTMLStyle *This = impl_from_IHTMLStyle(iface);
749 static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
750 static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
752 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
754 /* fontStyle can only be one of the follow values. */
755 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
756 strcmpiW(szOblique, v) == 0)
758 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
764 static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
766 HTMLStyle *This = impl_from_IHTMLStyle(iface);
768 TRACE("(%p)->(%p)\n", This, p);
770 return get_style_attr(This, STYLEID_FONT_STYLE, p);
773 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
775 HTMLStyle *This = impl_from_IHTMLStyle(iface);
776 static const WCHAR szCaps[] = {'s','m','a','l','l','-','c','a','p','s',0};
778 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
780 /* fontVariant can only be one of the follow values. */
781 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0)
783 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0);
789 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
791 HTMLStyle *This = impl_from_IHTMLStyle(iface);
792 TRACE("(%p)->(%p)\n", This, p);
797 return get_style_attr(This, STYLEID_FONT_VARIANT, p);
800 static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
802 HTMLStyle *This = impl_from_IHTMLStyle(iface);
803 static const WCHAR styleBold[] = {'b','o','l','d',0};
804 static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
805 static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
806 static const WCHAR style100[] = {'1','0','0',0};
807 static const WCHAR style200[] = {'2','0','0',0};
808 static const WCHAR style300[] = {'3','0','0',0};
809 static const WCHAR style400[] = {'4','0','0',0};
810 static const WCHAR style500[] = {'5','0','0',0};
811 static const WCHAR style600[] = {'6','0','0',0};
812 static const WCHAR style700[] = {'7','0','0',0};
813 static const WCHAR style800[] = {'8','0','0',0};
814 static const WCHAR style900[] = {'9','0','0',0};
816 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
818 /* fontWeight can only be one of the following */
819 if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
820 strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
821 strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
822 strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
823 strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
824 strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
825 strcmpiW(style900, v) == 0
828 return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
834 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
836 HTMLStyle *This = impl_from_IHTMLStyle(iface);
838 TRACE("(%p)->(%p)\n", This, p);
840 return get_style_attr(This, STYLEID_FONT_WEIGHT, p);
843 static HRESULT WINAPI HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v)
845 HTMLStyle *This = impl_from_IHTMLStyle(iface);
847 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
851 return set_style_attr(This, STYLEID_FONT_SIZE, V_BSTR(&v), 0);
853 FIXME("not supported vt %d\n", V_VT(&v));
859 static HRESULT WINAPI HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p)
861 HTMLStyle *This = impl_from_IHTMLStyle(iface);
863 TRACE("(%p)->(%p)\n", This, p);
866 return get_style_attr(This, STYLEID_FONT_SIZE, &V_BSTR(p));
869 static HRESULT WINAPI HTMLStyle_put_font(IHTMLStyle *iface, BSTR v)
871 HTMLStyle *This = impl_from_IHTMLStyle(iface);
872 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
876 static HRESULT WINAPI HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p)
878 HTMLStyle *This = impl_from_IHTMLStyle(iface);
879 FIXME("(%p)->(%p)\n", This, p);
883 static HRESULT WINAPI HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v)
885 HTMLStyle *This = impl_from_IHTMLStyle(iface);
887 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
891 TRACE("%s\n", debugstr_w(V_BSTR(&v)));
892 return set_style_attr(This, STYLEID_COLOR, V_BSTR(&v), 0);
895 FIXME("unsupported vt=%d\n", V_VT(&v));
901 static HRESULT WINAPI HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p)
903 HTMLStyle *This = impl_from_IHTMLStyle(iface);
905 TRACE("(%p)->(%p)\n", This, p);
908 return get_style_attr(This, STYLEID_COLOR, &V_BSTR(p));
911 static HRESULT WINAPI HTMLStyle_put_background(IHTMLStyle *iface, BSTR v)
913 HTMLStyle *This = impl_from_IHTMLStyle(iface);
915 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
917 return set_style_attr(This, STYLEID_BACKGROUND, v, 0);
920 static HRESULT WINAPI HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p)
922 HTMLStyle *This = impl_from_IHTMLStyle(iface);
924 TRACE("(%p)->(%p)\n", This, p);
926 return get_style_attr(This, STYLEID_BACKGROUND, p);
929 static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v)
931 HTMLStyle *This = impl_from_IHTMLStyle(iface);
933 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
937 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
940 static const WCHAR format[] = {'#','%','0','6','x',0};
942 wsprintfW(value, format, V_I4(&v));
943 return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
946 FIXME("unsupported vt %d\n", V_VT(&v));
952 static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
954 HTMLStyle *This = impl_from_IHTMLStyle(iface);
955 TRACE("(%p)->(%p)\n", This, p);
958 return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
961 static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
963 HTMLStyle *This = impl_from_IHTMLStyle(iface);
965 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
967 return set_style_attr(This, STYLEID_BACKGROUND_IMAGE, v, ATTR_FIX_URL);
970 static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
972 HTMLStyle *This = impl_from_IHTMLStyle(iface);
974 TRACE("(%p)->(%p)\n", This, p);
976 return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p);
979 static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
981 HTMLStyle *This = impl_from_IHTMLStyle(iface);
982 static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
983 static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
984 static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
985 static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
987 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
989 /* fontWeight can only be one of the following */
990 if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
991 strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
993 return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
999 static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
1001 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1003 TRACE("(%p)->(%p)\n", This, p);
1005 return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
1008 static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
1010 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1011 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1015 static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p)
1017 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1018 FIXME("(%p)->(%p)\n", This, p);
1022 static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v)
1024 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1026 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1028 return set_style_attr(This, STYLEID_BACKGROUND_POSITION, v, 0);
1031 static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p)
1033 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1035 TRACE("(%p)->(%p)\n", This, p);
1037 return get_style_attr(This, STYLEID_BACKGROUND_POSITION, p);
1040 static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
1042 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1043 WCHAR buf[14], *pos_val;
1049 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1051 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1055 val_len = val ? strlenW(val) : 0;
1057 nsAString_Init(&pos_str, NULL);
1058 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1059 if(SUCCEEDED(hres)) {
1060 const PRUnichar *pos, *posy;
1063 nsAString_GetData(&pos_str, &pos);
1064 posy = strchrW(pos, ' ');
1066 static const WCHAR zero_pxW[] = {' ','0','p','x',0};
1068 TRACE("no space in %s\n", debugstr_w(pos));
1072 posy_len = strlenW(posy);
1073 pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
1076 memcpy(pos_val, val, val_len*sizeof(WCHAR));
1078 memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
1079 pos_val[val_len+posy_len] = 0;
1081 hres = E_OUTOFMEMORY;
1084 nsAString_Finish(&pos_str);
1088 TRACE("setting position to %s\n", debugstr_w(pos_val));
1089 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1094 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
1096 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1101 TRACE("(%p)->(%p)\n", This, p);
1103 nsAString_Init(&pos_str, NULL);
1104 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1105 if(SUCCEEDED(hres)) {
1106 const PRUnichar *pos, *space;
1108 nsAString_GetData(&pos_str, &pos);
1109 space = strchrW(pos, ' ');
1111 WARN("no space in %s\n", debugstr_w(pos));
1112 space = pos + strlenW(pos);
1116 ret = SysAllocStringLen(pos, space-pos);
1118 hres = E_OUTOFMEMORY;
1123 nsAString_Finish(&pos_str);
1127 TRACE("returning %s\n", debugstr_w(ret));
1133 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)
1135 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1136 WCHAR buf[14], *pos_val;
1142 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1144 hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
1148 val_len = val ? strlenW(val) : 0;
1150 nsAString_Init(&pos_str, NULL);
1151 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1152 if(SUCCEEDED(hres)) {
1153 const PRUnichar *pos, *space;
1156 nsAString_GetData(&pos_str, &pos);
1157 space = strchrW(pos, ' ');
1161 static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
1163 TRACE("no space in %s\n", debugstr_w(pos));
1165 space = pos + sizeof(zero_pxW)/sizeof(WCHAR)-1;
1168 posx_len = space-pos;
1170 pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR));
1172 memcpy(pos_val, pos, posx_len*sizeof(WCHAR));
1174 memcpy(pos_val+posx_len, val, val_len*sizeof(WCHAR));
1175 pos_val[posx_len+val_len] = 0;
1177 hres = E_OUTOFMEMORY;
1180 nsAString_Finish(&pos_str);
1184 TRACE("setting position to %s\n", debugstr_w(pos_val));
1185 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
1190 static HRESULT WINAPI HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p)
1192 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1197 TRACE("(%p)->(%p)\n", This, p);
1199 nsAString_Init(&pos_str, NULL);
1200 hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
1201 if(SUCCEEDED(hres)) {
1202 const PRUnichar *pos, *posy;
1204 nsAString_GetData(&pos_str, &pos);
1205 posy = strchrW(pos, ' ');
1207 ret = SysAllocString(posy+1);
1209 hres = E_OUTOFMEMORY;
1214 nsAString_Finish(&pos_str);
1218 TRACE("returning %s\n", debugstr_w(ret));
1224 static HRESULT WINAPI HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v)
1226 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1227 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1228 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, &v, 0);
1231 static HRESULT WINAPI HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p)
1233 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1234 TRACE("(%p)->(%p)\n", This, p);
1235 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WORD_SPACING, p, 0);
1238 static HRESULT WINAPI HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v)
1240 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1241 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1242 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, &v, 0);
1245 static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p)
1247 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1248 TRACE("(%p)->(%p)\n", This, p);
1249 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
1252 static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
1254 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1256 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1258 /* textDecoration can only be one of the following */
1259 if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 ||
1260 strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 ||
1261 strcmpiW(valBlink, v) == 0)
1263 return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0);
1266 return E_INVALIDARG;
1269 static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
1271 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1273 TRACE("(%p)->(%p)\n", This, p);
1275 return get_style_attr(This, STYLEID_TEXT_DECORATION, p);
1278 static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
1280 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1282 TRACE("(%p)->(%x)\n", This, v);
1284 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? styleNone : emptyW, 0);
1287 static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
1289 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1291 TRACE("(%p)->(%p)\n", This, p);
1293 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, styleNone, p);
1296 static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
1298 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1300 TRACE("(%p)->(%x)\n", This, v);
1302 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
1305 static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
1307 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1309 TRACE("(%p)->(%p)\n", This, p);
1311 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valUnderline, p);
1314 static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
1316 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1318 TRACE("(%p)->(%x)\n", This, v);
1320 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valOverline : emptyW, 0);
1323 static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
1325 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1327 TRACE("(%p)->(%p)\n", This, p);
1329 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valOverline, p);
1332 static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
1334 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1336 TRACE("(%p)->(%x)\n", This, v);
1338 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
1341 static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
1343 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1345 TRACE("(%p)->(%p)\n", This, p);
1347 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valLineThrough, p);
1350 static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
1352 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1354 TRACE("(%p)->(%x)\n", This, v);
1356 return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valBlink : emptyW, 0);
1359 static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
1361 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1363 TRACE("(%p)->(%p)\n", This, p);
1365 return check_style_attr_value(This, STYLEID_TEXT_DECORATION, valBlink, p);
1368 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
1370 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1372 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1376 return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
1378 FIXME("not implemented vt %d\n", V_VT(&v));
1385 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
1387 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1391 TRACE("(%p)->(%p)\n", This, p);
1393 hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
1402 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
1404 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1405 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1409 static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
1411 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1412 FIXME("(%p)->(%p)\n", This, p);
1416 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
1418 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1420 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1422 return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
1425 static HRESULT WINAPI HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p)
1427 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1429 TRACE("(%p)->(%p)\n", This, p);
1431 return get_style_attr(This, STYLEID_TEXT_ALIGN, p);
1434 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
1436 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1437 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1441 static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p)
1443 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1444 FIXME("(%p)->(%p)\n", This, p);
1448 static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v)
1450 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1451 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1455 static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p)
1457 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1458 FIXME("(%p)->(%p)\n", This, p);
1462 static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v)
1464 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1466 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1468 return set_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, &v, 0);
1471 static HRESULT WINAPI HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p)
1473 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1475 TRACE("(%p)->(%p)\n", This, p);
1477 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
1480 static HRESULT WINAPI HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v)
1482 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1484 TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
1488 return set_style_attr(This, STYLEID_MARGIN_RIGHT, emptyW, 0);
1492 wsprintfW(buf, px_formatW, V_I4(&v));
1493 return set_style_attr(This, STYLEID_MARGIN_RIGHT, buf, 0);
1496 return set_style_attr(This, STYLEID_MARGIN_RIGHT, V_BSTR(&v), 0);
1498 FIXME("Unsupported vt=%d\n", V_VT(&v));
1504 static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p)
1506 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1507 TRACE("(%p)->(%p)\n", This, p);
1508 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
1511 static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v)
1513 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1514 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1518 static HRESULT WINAPI HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p)
1520 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1521 FIXME("(%p)->(%p)\n", This, p);
1525 static HRESULT WINAPI HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v)
1527 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1531 TRACE("(%p)->(NULL)\n", This);
1532 return set_style_attr(This, STYLEID_MARGIN_LEFT, emptyW, 0);
1536 TRACE("(%p)->(%d)\n", This, V_I4(&v));
1538 wsprintfW(buf, px_formatW, V_I4(&v));
1539 return set_style_attr(This, STYLEID_MARGIN_LEFT, buf, 0);
1542 TRACE("(%p)->(%s)\n", This, debugstr_w(V_BSTR(&v)));
1543 return set_style_attr(This, STYLEID_MARGIN_LEFT, V_BSTR(&v), 0);
1545 FIXME("Unsupported vt=%d\n", V_VT(&v));
1551 static HRESULT WINAPI HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v)
1553 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1555 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1557 return set_style_attr(This, STYLEID_MARGIN, v, 0);
1560 static HRESULT WINAPI HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p)
1562 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1564 TRACE("(%p)->(%p)\n", This, p);
1566 return get_style_attr(This, STYLEID_MARGIN, p);
1569 static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p)
1571 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1572 TRACE("(%p)->(%p)\n", This, p);
1573 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
1576 static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v)
1578 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1579 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1583 static HRESULT WINAPI HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p)
1585 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1586 FIXME("(%p)->(%p)\n", This, p);
1590 static HRESULT WINAPI HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v)
1592 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1593 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1597 static HRESULT WINAPI HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p)
1599 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1600 FIXME("(%p)->(%p)\n", This, p);
1604 static HRESULT WINAPI HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v)
1606 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1607 FIXME("(%p)->(v%d)\n", This, V_VT(&v));
1611 static HRESULT WINAPI HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p)
1613 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1614 FIXME("(%p)->(%p)\n", This, p);
1618 static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
1620 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1622 TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
1628 wsprintfW(buf, px_formatW, V_I4(&v));
1629 return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
1632 return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
1634 FIXME("unsupported vt=%d\n", V_VT(&v));
1640 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
1642 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1646 TRACE("(%p)->(%p)\n", This, p);
1648 hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
1657 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
1659 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1661 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1663 return set_style_attr(This, STYLEID_PADDING, v, 0);
1666 static HRESULT WINAPI HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p)
1668 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1670 TRACE("(%p)->(%p)\n", This, p);
1672 return get_style_attr(This, STYLEID_PADDING, p);
1675 static HRESULT WINAPI HTMLStyle_put_border(IHTMLStyle *iface, BSTR v)
1677 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1679 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1681 return set_style_attr(This, STYLEID_BORDER, v, 0);
1684 static HRESULT WINAPI HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p)
1686 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1688 TRACE("(%p)->(%p)\n", This, p);
1690 return get_style_attr(This, STYLEID_BORDER, p);
1693 static HRESULT WINAPI HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v)
1695 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1696 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1697 return set_style_attr(This, STYLEID_BORDER_TOP, v, ATTR_FIX_PX);
1700 static HRESULT WINAPI HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p)
1702 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1703 TRACE("(%p)->(%p)\n", This, p);
1704 return get_style_attr(This, STYLEID_BORDER_TOP, p);
1707 static HRESULT WINAPI HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v)
1709 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1710 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1711 return set_style_attr(This, STYLEID_BORDER_RIGHT, v, ATTR_FIX_PX);
1714 static HRESULT WINAPI HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p)
1716 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1717 TRACE("(%p)->(%p)\n", This, p);
1718 return get_style_attr(This, STYLEID_BORDER_RIGHT, p);
1721 static HRESULT WINAPI HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v)
1723 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1724 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1725 return set_style_attr(This, STYLEID_BORDER_BOTTOM, v, ATTR_FIX_PX);
1728 static HRESULT WINAPI HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p)
1730 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1731 TRACE("(%p)->(%p)\n", This, p);
1732 return get_style_attr(This, STYLEID_BORDER_BOTTOM, p);
1735 static HRESULT WINAPI HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v)
1737 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1739 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1741 return set_style_attr(This, STYLEID_BORDER_LEFT, v, ATTR_FIX_PX);
1744 static HRESULT WINAPI HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p)
1746 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1748 TRACE("(%p)->(%p)\n", This, p);
1750 return get_style_attr(This, STYLEID_BORDER_LEFT, p);
1753 static HRESULT WINAPI HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v)
1755 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1757 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1759 return set_style_attr(This, STYLEID_BORDER_COLOR, v, 0);
1762 static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
1764 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1766 TRACE("(%p)->(%p)\n", This, p);
1768 return get_style_attr(This, STYLEID_BORDER_COLOR, p);
1771 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
1773 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1775 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1777 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
1780 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
1782 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1784 TRACE("(%p)->(%p)\n", This, p);
1786 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
1789 static HRESULT WINAPI HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v)
1791 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1793 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1795 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, &v, ATTR_HEX_INT);
1798 static HRESULT WINAPI HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p)
1800 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1802 TRACE("(%p)->(%p)\n", This, p);
1804 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
1807 static HRESULT WINAPI HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v)
1809 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1811 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1813 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, &v, ATTR_HEX_INT);
1816 static HRESULT WINAPI HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p)
1818 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1820 TRACE("(%p)->(%p)\n", This, p);
1822 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
1825 static HRESULT WINAPI HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v)
1827 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1829 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1831 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, &v, ATTR_HEX_INT);
1834 static HRESULT WINAPI HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p)
1836 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1838 TRACE("(%p)->(%p)\n", This, p);
1840 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
1843 static HRESULT WINAPI HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v)
1845 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1846 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1847 return set_style_attr(This, STYLEID_BORDER_WIDTH, v, ATTR_FIX_PX);
1850 static HRESULT WINAPI HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p)
1852 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1853 TRACE("(%p)->(%p)\n", This, p);
1854 return get_style_attr(This, STYLEID_BORDER_WIDTH, p);
1857 static HRESULT WINAPI HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v)
1859 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1860 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1861 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, &v, 0);
1864 static HRESULT WINAPI HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p)
1866 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1868 TRACE("(%p)->(%p)\n", This, p);
1870 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
1873 static HRESULT WINAPI HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v)
1875 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1876 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1877 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, &v, 0);
1880 static HRESULT WINAPI HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p)
1882 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1883 TRACE("(%p)->(%p)\n", This, p);
1884 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
1887 static HRESULT WINAPI HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v)
1889 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1891 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1892 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, &v, 0);
1895 static HRESULT WINAPI HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p)
1897 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1898 TRACE("(%p)->(%p)\n", This, p);
1899 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
1902 static HRESULT WINAPI HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v)
1904 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1905 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
1906 return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, &v, 0);
1909 static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p)
1911 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1912 TRACE("(%p)->(%p)\n", This, p);
1913 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
1916 static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
1918 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1919 static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1920 HRESULT hres = S_OK;
1925 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1927 while(v[i] && hres == S_OK)
1929 if(v[i] == (WCHAR)' ')
1931 pstyle = SysAllocStringLen(&v[last], (i-last));
1932 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1934 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
1935 hres = E_INVALIDARG;
1937 SysFreeString(pstyle);
1945 pstyle = SysAllocStringLen(&v[last], i-last);
1946 if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
1948 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
1949 hres = E_INVALIDARG;
1951 SysFreeString(pstyle);
1955 hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
1960 static HRESULT WINAPI HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p)
1962 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1963 TRACE("(%p)->(%p)\n", This, p);
1964 return get_style_attr(This, STYLEID_BORDER_STYLE, p);
1967 static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
1969 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1970 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1972 if(!is_valid_border_style(v))
1973 return E_INVALIDARG;
1975 return set_style_attr(This, STYLEID_BORDER_TOP_STYLE, v, 0);
1978 static HRESULT WINAPI HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p)
1980 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1981 TRACE("(%p)->(%p)\n", This, p);
1982 return get_style_attr(This, STYLEID_BORDER_TOP_STYLE, p);
1985 static HRESULT WINAPI HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v)
1987 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1988 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1990 if(!is_valid_border_style(v))
1991 return E_INVALIDARG;
1993 return set_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, v, 0);
1996 static HRESULT WINAPI HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p)
1998 HTMLStyle *This = impl_from_IHTMLStyle(iface);
1999 TRACE("(%p)->(%p)\n", This, p);
2000 return get_style_attr(This, STYLEID_BORDER_RIGHT_STYLE, p);
2003 static HRESULT WINAPI HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v)
2005 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2006 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2008 if(!is_valid_border_style(v))
2009 return E_INVALIDARG;
2011 return set_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, v, 0);
2014 static HRESULT WINAPI HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p)
2016 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2017 TRACE("(%p)->(%p)\n", This, p);
2018 return get_style_attr(This, STYLEID_BORDER_BOTTOM_STYLE, p);
2021 static HRESULT WINAPI HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v)
2023 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2024 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2026 if(!is_valid_border_style(v))
2027 return E_INVALIDARG;
2029 return set_style_attr(This, STYLEID_BORDER_LEFT_STYLE, v, 0);
2032 static HRESULT WINAPI HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p)
2034 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2035 TRACE("(%p)->(%p)\n", This, p);
2036 return get_style_attr(This, STYLEID_BORDER_LEFT_STYLE, p);
2039 static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
2041 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2043 TRACE("(%p)->(v%d)\n", This, V_VT(&v));
2045 return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
2048 static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)
2050 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2052 TRACE("(%p)->(%p)\n", This, p);
2055 return get_style_attr(This, STYLEID_WIDTH, &V_BSTR(p));
2058 static HRESULT WINAPI HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v)
2060 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2062 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2066 return set_style_attr(This, STYLEID_HEIGHT, V_BSTR(&v), 0);
2068 FIXME("unimplemented vt %d\n", V_VT(&v));
2075 static HRESULT WINAPI HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p)
2077 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2081 TRACE("(%p)->(%p)\n", This, p);
2083 hres = get_style_attr(This, STYLEID_HEIGHT, &ret);
2092 static HRESULT WINAPI HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v)
2094 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2095 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2099 static HRESULT WINAPI HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p)
2101 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2102 FIXME("(%p)->(%p)\n", This, p);
2106 static HRESULT WINAPI HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v)
2108 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2109 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2113 static HRESULT WINAPI HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p)
2115 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2116 FIXME("(%p)->(%p)\n", This, p);
2120 static HRESULT WINAPI HTMLStyle_put_display(IHTMLStyle *iface, BSTR v)
2122 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2124 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2126 return set_style_attr(This, STYLEID_DISPLAY, v, 0);
2129 static HRESULT WINAPI HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p)
2131 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2133 TRACE("(%p)->(%p)\n", This, p);
2135 return get_style_attr(This, STYLEID_DISPLAY, p);
2138 static HRESULT WINAPI HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v)
2140 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2142 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2144 return set_style_attr(This, STYLEID_VISIBILITY, v, 0);
2147 static HRESULT WINAPI HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p)
2149 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2151 TRACE("(%p)->(%p)\n", This, p);
2153 return get_style_attr(This, STYLEID_VISIBILITY, p);
2156 static HRESULT WINAPI HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v)
2158 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2159 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2163 static HRESULT WINAPI HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p)
2165 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2166 FIXME("(%p)->(%p)\n", This, p);
2170 static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v)
2172 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2173 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2177 static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p)
2179 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2180 FIXME("(%p)->(%p)\n", This, p);
2184 static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v)
2186 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2187 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2191 static HRESULT WINAPI HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p)
2193 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2194 FIXME("(%p)->(%p)\n", This, p);
2198 static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v)
2200 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2201 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2205 static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p)
2207 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2208 FIXME("(%p)->(%p)\n", This, p);
2212 static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v)
2214 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2215 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2219 static HRESULT WINAPI HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p)
2221 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2222 FIXME("(%p)->(%p)\n", This, p);
2226 static HRESULT WINAPI HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v)
2228 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2230 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2232 return set_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, &v, 0);
2235 static HRESULT WINAPI HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p)
2237 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2241 TRACE("(%p)->(%p)\n", This, p);
2243 hres = get_style_attr(This, STYLEID_TOP, &ret);
2252 static HRESULT WINAPI HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v)
2254 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2256 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2258 return set_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, &v, 0);
2261 static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p)
2263 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2267 TRACE("(%p)->(%p)\n", This, p);
2269 hres = get_style_attr(This, STYLEID_LEFT, &ret);
2278 static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
2280 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2281 TRACE("(%p)->(%p)\n", This, p);
2282 return IHTMLStyle2_get_position(&This->IHTMLStyle2_iface, p);
2285 static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
2287 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2289 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2293 return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
2296 static const WCHAR format[] = {'%','d',0};
2298 wsprintfW(value, format, V_I4(&v));
2299 return set_style_attr(This, STYLEID_Z_INDEX, value, 0);
2302 FIXME("unimplemented vt %d\n", V_VT(&v));
2309 static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
2311 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2313 TRACE("(%p)->(%p)\n", This, p);
2315 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
2318 static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
2320 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2321 static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
2322 static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
2323 static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
2324 static const WCHAR szAuto[] = {'a','u','t','o',0};
2326 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2328 /* overflow can only be one of the follow values. */
2329 if(!v || !*v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
2330 strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
2332 return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
2335 return E_INVALIDARG;
2339 static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
2341 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2343 TRACE("(%p)->(%p)\n", This, p);
2346 return E_INVALIDARG;
2348 return get_style_attr(This, STYLEID_OVERFLOW, p);
2351 static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
2353 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2355 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2357 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, v, 0);
2360 static HRESULT WINAPI HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p)
2362 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2364 TRACE("(%p)->(%p)\n", This, p);
2366 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_BEFORE, p, 0);
2369 static HRESULT WINAPI HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v)
2371 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2373 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2375 return set_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, v, 0);
2378 static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
2380 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2382 TRACE("(%p)->(%p)\n", This, p);
2384 return get_nsstyle_attr(This->nsstyle, STYLEID_PAGE_BREAK_AFTER, p, 0);
2387 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
2389 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2393 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2395 nsAString_InitDepend(&text_str, v);
2396 nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
2397 nsAString_Finish(&text_str);
2398 if(NS_FAILED(nsres)) {
2399 FIXME("SetCssStyle failed: %08x\n", nsres);
2406 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
2408 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2412 TRACE("(%p)->(%p)\n", This, p);
2414 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2415 nsAString_Init(&text_str, NULL);
2416 nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
2417 if(NS_SUCCEEDED(nsres)) {
2418 const PRUnichar *text;
2420 nsAString_GetData(&text_str, &text);
2421 *p = *text ? SysAllocString(text) : NULL;
2423 FIXME("GetCssStyle failed: %08x\n", nsres);
2427 nsAString_Finish(&text_str);
2431 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
2433 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2434 FIXME("(%p)->()\n", This);
2438 static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p)
2440 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2441 FIXME("(%p)->()\n", This);
2445 static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
2447 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2448 FIXME("(%p)->()\n", This);
2452 static HRESULT WINAPI HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p)
2454 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2455 FIXME("(%p)->()\n", This);
2459 static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
2461 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2462 FIXME("(%p)->()\n", This);
2466 static HRESULT WINAPI HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p)
2468 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2469 FIXME("(%p)->()\n", This);
2473 static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
2475 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2476 FIXME("(%p)->()\n", This);
2480 static HRESULT WINAPI HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p)
2482 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2483 FIXME("(%p)->()\n", This);
2487 static HRESULT WINAPI HTMLStyle_put_posTop(IHTMLStyle *iface, float v)
2489 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2491 TRACE("(%p)->(%f)\n", This, v);
2493 return set_style_pos(This, STYLEID_TOP, v);
2496 static HRESULT WINAPI HTMLStyle_get_posTop(IHTMLStyle *iface, float *p)
2498 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2500 TRACE("(%p)->(%p)\n", This, p);
2505 return get_nsstyle_pos(This, STYLEID_TOP, p);
2508 static HRESULT WINAPI HTMLStyle_put_posLeft(IHTMLStyle *iface, float v)
2510 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2512 TRACE("(%p)->(%f)\n", This, v);
2514 return set_style_pos(This, STYLEID_LEFT, v);
2517 static HRESULT WINAPI HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p)
2519 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2521 TRACE("(%p)->(%p)\n", This, p);
2526 return get_nsstyle_pos(This, STYLEID_LEFT, p);
2529 static HRESULT WINAPI HTMLStyle_put_posWidth(IHTMLStyle *iface, float v)
2531 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2533 TRACE("(%p)->(%f)\n", This, v);
2535 return set_style_pos(This, STYLEID_WIDTH, v);
2538 static HRESULT WINAPI HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p)
2540 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2542 TRACE("(%p)->(%p)\n", This, p);
2547 if(get_nsstyle_pos(This, STYLEID_WIDTH, p) != S_OK)
2553 static HRESULT WINAPI HTMLStyle_put_posHeight(IHTMLStyle *iface, float v)
2555 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2557 TRACE("(%p)->(%f)\n", This, v);
2559 return set_style_pos(This, STYLEID_HEIGHT, v);
2562 static HRESULT WINAPI HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p)
2564 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2566 TRACE("(%p)->(%p)\n", This, p);
2571 if(get_nsstyle_pos(This, STYLEID_HEIGHT, p) != S_OK)
2577 static HRESULT WINAPI HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v)
2579 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2581 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2583 return set_style_attr(This, STYLEID_CURSOR, v, 0);
2586 static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
2588 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2590 TRACE("(%p)->(%p)\n", This, p);
2592 return get_style_attr(This, STYLEID_CURSOR, p);
2595 static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
2597 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2599 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2601 return set_style_attr(This, STYLEID_CLIP, v, 0);
2604 static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
2606 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2608 TRACE("(%p)->(%p)\n", This, p);
2610 return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
2613 static void set_opacity(HTMLStyle *This, const WCHAR *val)
2615 nsAString name_str, val_str, empty_str;
2618 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
2620 TRACE("%s\n", debugstr_w(val));
2622 nsAString_InitDepend(&name_str, opacityW);
2623 nsAString_InitDepend(&val_str, val);
2624 nsAString_InitDepend(&empty_str, emptyW);
2626 nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &val_str, &empty_str);
2627 if(NS_FAILED(nsres))
2628 ERR("SetProperty failed: %08x\n", nsres);
2630 nsAString_Finish(&name_str);
2631 nsAString_Finish(&val_str);
2632 nsAString_Finish(&empty_str);
2635 static void update_filter(HTMLStyle *This)
2637 const WCHAR *ptr = This->filter, *ptr2;
2639 static const WCHAR alphaW[] = {'a','l','p','h','a'};
2642 set_opacity(This, emptyW);
2647 while(isspaceW(*ptr))
2653 while(isalnumW(*ptr))
2656 WARN("unexpected char '%c'\n", *ptr);
2660 WARN("expected '('\n");
2664 if(ptr2 + sizeof(alphaW)/sizeof(WCHAR) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
2665 static const WCHAR formatW[] = {'%','f',0};
2666 static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
2670 while(isspaceW(*ptr))
2674 while(*ptr && *ptr != ',' && *ptr != ')')
2677 WARN("unexpected end of string\n");
2681 if(ptr-ptr2 > sizeof(opacityW)/sizeof(WCHAR) && !memcmp(ptr2, opacityW, sizeof(opacityW))) {
2682 float fval = 0.0f, e = 0.1f;
2685 ptr2 += sizeof(opacityW)/sizeof(WCHAR);
2687 while(isdigitW(*ptr2))
2688 fval = fval*10.0f + (float)(*ptr2++ - '0');
2691 while(isdigitW(*++ptr2)) {
2692 fval += e * (float)(*ptr2++ - '0');
2697 sprintfW(buf, formatW, fval * 0.01f);
2698 set_opacity(This, buf);
2700 FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
2705 }while(*ptr != ')');
2707 FIXME("unknown filter %s\n", debugstr_wn(ptr2, ptr-ptr2));
2708 ptr = strchrW(ptr, ')');
2716 static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
2718 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2719 WCHAR *new_filter = NULL;
2721 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2724 new_filter = heap_strdupW(v);
2726 return E_OUTOFMEMORY;
2729 heap_free(This->filter);
2730 This->filter = new_filter;
2732 update_filter(This);
2736 static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
2738 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2740 TRACE("(%p)->(%p)\n", This, p);
2743 *p = SysAllocString(This->filter);
2745 return E_OUTOFMEMORY;
2753 static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2754 VARIANT AttributeValue, LONG lFlags)
2756 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2760 TRACE("(%p)->(%s v%d %08x)\n", This, debugstr_w(strAttributeName),
2761 V_VT(&AttributeValue), lFlags);
2763 if(!strAttributeName)
2764 return E_INVALIDARG;
2767 FIXME("Parameter lFlags ignored\n");
2769 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2770 LOCALE_USER_DEFAULT, &dispid);
2774 DISPID dispidNamed = DISPID_PROPERTYPUT;
2778 params.rgvarg = &AttributeValue;
2779 params.cNamedArgs = 1;
2780 params.rgdispidNamedArgs = &dispidNamed;
2782 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2783 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
2787 FIXME("Custom attributes not supported.\n");
2790 TRACE("ret: %08x\n", hres);
2795 static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2796 LONG lFlags, VARIANT *AttributeValue)
2798 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2802 TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
2803 AttributeValue, lFlags);
2805 if(!AttributeValue || !strAttributeName)
2806 return E_INVALIDARG;
2809 FIXME("Parameter lFlags ignored\n");
2811 hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1,
2812 LOCALE_USER_DEFAULT, &dispid);
2815 DISPPARAMS params = {NULL, NULL, 0, 0 };
2817 hres = HTMLStyle_Invoke(iface, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
2818 DISPATCH_PROPERTYGET, ¶ms, AttributeValue, NULL, NULL);
2822 FIXME("Custom attributes not supported.\n");
2828 static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName,
2829 LONG lFlags, VARIANT_BOOL *pfSuccess)
2831 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2832 FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName),
2837 static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
2839 HTMLStyle *This = impl_from_IHTMLStyle(iface);
2840 FIXME("(%p)->(%p)\n", This, String);
2844 static const IHTMLStyleVtbl HTMLStyleVtbl = {
2845 HTMLStyle_QueryInterface,
2848 HTMLStyle_GetTypeInfoCount,
2849 HTMLStyle_GetTypeInfo,
2850 HTMLStyle_GetIDsOfNames,
2852 HTMLStyle_put_fontFamily,
2853 HTMLStyle_get_fontFamily,
2854 HTMLStyle_put_fontStyle,
2855 HTMLStyle_get_fontStyle,
2856 HTMLStyle_put_fontVariant,
2857 HTMLStyle_get_fontVariant,
2858 HTMLStyle_put_fontWeight,
2859 HTMLStyle_get_fontWeight,
2860 HTMLStyle_put_fontSize,
2861 HTMLStyle_get_fontSize,
2864 HTMLStyle_put_color,
2865 HTMLStyle_get_color,
2866 HTMLStyle_put_background,
2867 HTMLStyle_get_background,
2868 HTMLStyle_put_backgroundColor,
2869 HTMLStyle_get_backgroundColor,
2870 HTMLStyle_put_backgroundImage,
2871 HTMLStyle_get_backgroundImage,
2872 HTMLStyle_put_backgroundRepeat,
2873 HTMLStyle_get_backgroundRepeat,
2874 HTMLStyle_put_backgroundAttachment,
2875 HTMLStyle_get_backgroundAttachment,
2876 HTMLStyle_put_backgroundPosition,
2877 HTMLStyle_get_backgroundPosition,
2878 HTMLStyle_put_backgroundPositionX,
2879 HTMLStyle_get_backgroundPositionX,
2880 HTMLStyle_put_backgroundPositionY,
2881 HTMLStyle_get_backgroundPositionY,
2882 HTMLStyle_put_wordSpacing,
2883 HTMLStyle_get_wordSpacing,
2884 HTMLStyle_put_letterSpacing,
2885 HTMLStyle_get_letterSpacing,
2886 HTMLStyle_put_textDecoration,
2887 HTMLStyle_get_textDecoration,
2888 HTMLStyle_put_textDecorationNone,
2889 HTMLStyle_get_textDecorationNone,
2890 HTMLStyle_put_textDecorationUnderline,
2891 HTMLStyle_get_textDecorationUnderline,
2892 HTMLStyle_put_textDecorationOverline,
2893 HTMLStyle_get_textDecorationOverline,
2894 HTMLStyle_put_textDecorationLineThrough,
2895 HTMLStyle_get_textDecorationLineThrough,
2896 HTMLStyle_put_textDecorationBlink,
2897 HTMLStyle_get_textDecorationBlink,
2898 HTMLStyle_put_verticalAlign,
2899 HTMLStyle_get_verticalAlign,
2900 HTMLStyle_put_textTransform,
2901 HTMLStyle_get_textTransform,
2902 HTMLStyle_put_textAlign,
2903 HTMLStyle_get_textAlign,
2904 HTMLStyle_put_textIndent,
2905 HTMLStyle_get_textIndent,
2906 HTMLStyle_put_lineHeight,
2907 HTMLStyle_get_lineHeight,
2908 HTMLStyle_put_marginTop,
2909 HTMLStyle_get_marginTop,
2910 HTMLStyle_put_marginRight,
2911 HTMLStyle_get_marginRight,
2912 HTMLStyle_put_marginBottom,
2913 HTMLStyle_get_marginBottom,
2914 HTMLStyle_put_marginLeft,
2915 HTMLStyle_get_marginLeft,
2916 HTMLStyle_put_margin,
2917 HTMLStyle_get_margin,
2918 HTMLStyle_put_paddingTop,
2919 HTMLStyle_get_paddingTop,
2920 HTMLStyle_put_paddingRight,
2921 HTMLStyle_get_paddingRight,
2922 HTMLStyle_put_paddingBottom,
2923 HTMLStyle_get_paddingBottom,
2924 HTMLStyle_put_paddingLeft,
2925 HTMLStyle_get_paddingLeft,
2926 HTMLStyle_put_padding,
2927 HTMLStyle_get_padding,
2928 HTMLStyle_put_border,
2929 HTMLStyle_get_border,
2930 HTMLStyle_put_borderTop,
2931 HTMLStyle_get_borderTop,
2932 HTMLStyle_put_borderRight,
2933 HTMLStyle_get_borderRight,
2934 HTMLStyle_put_borderBottom,
2935 HTMLStyle_get_borderBottom,
2936 HTMLStyle_put_borderLeft,
2937 HTMLStyle_get_borderLeft,
2938 HTMLStyle_put_borderColor,
2939 HTMLStyle_get_borderColor,
2940 HTMLStyle_put_borderTopColor,
2941 HTMLStyle_get_borderTopColor,
2942 HTMLStyle_put_borderRightColor,
2943 HTMLStyle_get_borderRightColor,
2944 HTMLStyle_put_borderBottomColor,
2945 HTMLStyle_get_borderBottomColor,
2946 HTMLStyle_put_borderLeftColor,
2947 HTMLStyle_get_borderLeftColor,
2948 HTMLStyle_put_borderWidth,
2949 HTMLStyle_get_borderWidth,
2950 HTMLStyle_put_borderTopWidth,
2951 HTMLStyle_get_borderTopWidth,
2952 HTMLStyle_put_borderRightWidth,
2953 HTMLStyle_get_borderRightWidth,
2954 HTMLStyle_put_borderBottomWidth,
2955 HTMLStyle_get_borderBottomWidth,
2956 HTMLStyle_put_borderLeftWidth,
2957 HTMLStyle_get_borderLeftWidth,
2958 HTMLStyle_put_borderStyle,
2959 HTMLStyle_get_borderStyle,
2960 HTMLStyle_put_borderTopStyle,
2961 HTMLStyle_get_borderTopStyle,
2962 HTMLStyle_put_borderRightStyle,
2963 HTMLStyle_get_borderRightStyle,
2964 HTMLStyle_put_borderBottomStyle,
2965 HTMLStyle_get_borderBottomStyle,
2966 HTMLStyle_put_borderLeftStyle,
2967 HTMLStyle_get_borderLeftStyle,
2968 HTMLStyle_put_width,
2969 HTMLStyle_get_width,
2970 HTMLStyle_put_height,
2971 HTMLStyle_get_height,
2972 HTMLStyle_put_styleFloat,
2973 HTMLStyle_get_styleFloat,
2974 HTMLStyle_put_clear,
2975 HTMLStyle_get_clear,
2976 HTMLStyle_put_display,
2977 HTMLStyle_get_display,
2978 HTMLStyle_put_visibility,
2979 HTMLStyle_get_visibility,
2980 HTMLStyle_put_listStyleType,
2981 HTMLStyle_get_listStyleType,
2982 HTMLStyle_put_listStylePosition,
2983 HTMLStyle_get_listStylePosition,
2984 HTMLStyle_put_listStyleImage,
2985 HTMLStyle_get_listStyleImage,
2986 HTMLStyle_put_listStyle,
2987 HTMLStyle_get_listStyle,
2988 HTMLStyle_put_whiteSpace,
2989 HTMLStyle_get_whiteSpace,
2994 HTMLStyle_get_position,
2995 HTMLStyle_put_zIndex,
2996 HTMLStyle_get_zIndex,
2997 HTMLStyle_put_overflow,
2998 HTMLStyle_get_overflow,
2999 HTMLStyle_put_pageBreakBefore,
3000 HTMLStyle_get_pageBreakBefore,
3001 HTMLStyle_put_pageBreakAfter,
3002 HTMLStyle_get_pageBreakAfter,
3003 HTMLStyle_put_cssText,
3004 HTMLStyle_get_cssText,
3005 HTMLStyle_put_pixelTop,
3006 HTMLStyle_get_pixelTop,
3007 HTMLStyle_put_pixelLeft,
3008 HTMLStyle_get_pixelLeft,
3009 HTMLStyle_put_pixelWidth,
3010 HTMLStyle_get_pixelWidth,
3011 HTMLStyle_put_pixelHeight,
3012 HTMLStyle_get_pixelHeight,
3013 HTMLStyle_put_posTop,
3014 HTMLStyle_get_posTop,
3015 HTMLStyle_put_posLeft,
3016 HTMLStyle_get_posLeft,
3017 HTMLStyle_put_posWidth,
3018 HTMLStyle_get_posWidth,
3019 HTMLStyle_put_posHeight,
3020 HTMLStyle_get_posHeight,
3021 HTMLStyle_put_cursor,
3022 HTMLStyle_get_cursor,
3025 HTMLStyle_put_filter,
3026 HTMLStyle_get_filter,
3027 HTMLStyle_setAttribute,
3028 HTMLStyle_getAttribute,
3029 HTMLStyle_removeAttribute,
3033 static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
3035 int c, i, min=0, max = sizeof(style_tbl)/sizeof(*style_tbl)-1;
3040 c = strcmpW(style_tbl[i].name, name);
3042 *dispid = style_tbl[i].dispid;
3052 return DISP_E_UNKNOWNNAME;
3055 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
3057 HTMLStyle_get_dispid,
3061 static const tid_t HTMLStyle_iface_tids[] = {
3068 static dispex_static_data_t HTMLStyle_dispex = {
3069 &HTMLStyle_dispex_vtbl,
3072 HTMLStyle_iface_tids
3075 HRESULT HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret)
3079 style = heap_alloc_zero(sizeof(HTMLStyle));
3081 return E_OUTOFMEMORY;
3083 style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl;
3085 style->nsstyle = nsstyle;
3086 HTMLStyle2_Init(style);
3087 HTMLStyle3_Init(style);
3089 nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
3091 init_dispex(&style->dispex, (IUnknown*)&style->IHTMLStyle_iface, &HTMLStyle_dispex);