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 attrPosition
[] =
147 {'p','o','s','i','t','i','o','n',0};
148 static const WCHAR attrRight
[] =
149 {'r','i','g','h','t',0};
150 static const WCHAR attrTextAlign
[] =
151 {'t','e','x','t','-','a','l','i','g','n',0};
152 static const WCHAR attrTextDecoration
[] =
153 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
154 static const WCHAR attrTextIndent
[] =
155 {'t','e','x','t','-','i','n','d','e','n','t',0};
156 static const WCHAR attrTop
[] =
158 static const WCHAR attrVerticalAlign
[] =
159 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
160 static const WCHAR attrVisibility
[] =
161 {'v','i','s','i','b','i','l','i','t','y',0};
162 static const WCHAR attrWidth
[] =
163 {'w','i','d','t','h',0};
164 static const WCHAR attrWordSpacing
[] =
165 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
166 static const WCHAR attrWordWrap
[] =
167 {'w','o','r','d','-','w','r','a','p',0};
168 static const WCHAR attrZIndex
[] =
169 {'z','-','i','n','d','e','x',0};
175 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
176 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
177 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
178 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
179 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
180 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
181 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
182 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
183 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
184 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
185 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
186 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
187 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
188 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
189 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
190 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
191 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
192 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
193 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
194 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
195 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
196 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
197 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
198 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
199 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
200 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
201 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
202 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
203 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
204 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
205 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
206 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
207 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
208 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
209 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
210 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
211 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
212 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
213 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
214 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
215 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
216 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
217 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
218 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
219 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
220 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
221 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
222 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
223 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
224 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
225 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
226 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
227 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
228 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
229 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
230 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
231 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
232 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
233 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
234 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
235 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
236 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
237 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
238 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
239 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
240 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
243 static const WCHAR valLineThrough
[] =
244 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
245 static const WCHAR valUnderline
[] =
246 {'u','n','d','e','r','l','i','n','e',0};
247 static const WCHAR szNormal
[] =
248 {'n','o','r','m','a','l',0};
249 static const WCHAR styleNone
[] =
251 static const WCHAR valOverline
[] =
252 {'o','v','e','r','l','i','n','e',0};
253 static const WCHAR valBlink
[] =
254 {'b','l','i','n','k',0};
256 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
257 static const WCHAR emptyW
[] = {0};
259 static LPWSTR
fix_px_value(LPCWSTR val
)
264 while(*ptr
&& isspaceW(*ptr
))
269 while(*ptr
&& isdigitW(*ptr
))
272 if(!*ptr
|| isspaceW(*ptr
)) {
274 int len
= strlenW(val
)+1;
276 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
277 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
283 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
288 while(*ptr
&& !isspaceW(*ptr
))
295 static LPWSTR
fix_url_value(LPCWSTR val
)
299 static const WCHAR urlW
[] = {'u','r','l','('};
301 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
304 ret
= heap_strdupW(val
);
306 for(ptr
= ret
; *ptr
; ptr
++) {
314 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
316 nsAString str_name
, str_value
, str_empty
;
320 if(flags
& ATTR_FIX_PX
)
321 val
= fix_px_value(value
);
322 if(flags
& ATTR_FIX_URL
)
323 val
= fix_url_value(value
);
325 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
326 nsAString_InitDepend(&str_value
, val
? val
: value
);
327 nsAString_InitDepend(&str_empty
, emptyW
);
329 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
331 ERR("SetProperty failed: %08x\n", nsres
);
333 nsAString_Finish(&str_name
);
334 nsAString_Finish(&str_value
);
335 nsAString_Finish(&str_empty
);
341 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
352 case VT_BSTR
|VT_BYREF
:
353 *ret
= *V_BSTRREF(v
);
357 static const WCHAR formatW
[] = {'%','d',0};
358 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
360 if(flags
& ATTR_HEX_INT
)
361 wsprintfW(buf
, hex_formatW
, V_I4(v
));
362 else if(flags
& ATTR_FIX_PX
)
363 wsprintfW(buf
, px_formatW
, V_I4(v
));
365 wsprintfW(buf
, formatW
, V_I4(v
));
371 FIXME("not implemented vt %d\n", V_VT(v
));
377 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
383 hres
= var_to_styleval(value
, buf
, flags
, &val
);
387 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
390 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
392 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
395 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
400 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
402 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
403 if(NS_FAILED(nsres
)) {
404 ERR("SetProperty failed: %08x\n", nsres
);
408 nsAString_Finish(&str_name
);
413 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
423 ret
= SysAllocString(val
);
425 return E_OUTOFMEMORY
;
427 len
= SysStringLen(ret
);
429 if(flags
& ATTR_REMOVE_COMMA
) {
433 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
439 new_ret
= SysAllocStringLen(NULL
, new_len
);
442 return E_OUTOFMEMORY
;
445 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
459 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
462 const PRUnichar
*value
;
465 nsAString_Init(&str_value
, NULL
);
467 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
469 nsAString_GetData(&str_value
, &value
);
470 hres
= nsstyle_to_bstr(value
, flags
, p
);
471 nsAString_Finish(&str_value
);
473 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
477 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
480 const PRUnichar
*value
;
484 nsAString_Init(&str_value
, NULL
);
486 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
488 nsAString_GetData(&str_value
, &value
);
490 if(flags
& ATTR_STR_TO_INT
) {
491 const PRUnichar
*ptr
= value
;
500 while(isdigitW(*ptr
))
501 i
= i
*10 + (*ptr
++ - '0');
505 V_I4(p
) = neg
? -i
: i
;
513 hres
= nsstyle_to_bstr(value
, flags
, &str
);
514 if(SUCCEEDED(hres
)) {
520 nsAString_Finish(&str_value
);
522 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
526 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
528 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
531 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
534 const PRUnichar
*value
;
536 nsAString_Init(&str_value
, NULL
);
538 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
540 nsAString_GetData(&str_value
, &value
);
541 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
542 nsAString_Finish(&str_value
);
544 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
548 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
551 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
553 value
= floor(value
);
555 sprintfW(szValue
, szFormat
, value
);
557 return set_style_attr(This
, sid
, szValue
, 0);
560 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
564 WCHAR pxW
[] = {'p','x',0};
566 TRACE("%p %d %p\n", This
, sid
, p
);
570 nsAString_Init(&str_value
, NULL
);
572 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
576 const PRUnichar
*value
;
578 nsAString_GetData(&str_value
, &value
);
581 *p
= strtolW(value
, &ptr
, 10);
583 if(*ptr
&& strcmpW(ptr
, pxW
))
585 nsAString_Finish(&str_value
);
586 FIXME("only px values are currently supported\n");
592 TRACE("ret %f\n", *p
);
594 nsAString_Finish(&str_value
);
599 static BOOL
is_valid_border_style(BSTR v
)
601 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
602 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
603 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
604 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
605 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
606 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
607 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
608 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
610 TRACE("%s\n", debugstr_w(v
));
612 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
613 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
614 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
615 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
616 strcmpiW(v
, styleOutset
) == 0 )
624 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
626 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
629 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
631 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
635 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
636 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
637 *ppv
= &This
->IHTMLStyle_iface
;
638 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
639 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This
, ppv
);
640 *ppv
= &This
->IHTMLStyle_iface
;
641 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
642 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This
, ppv
);
643 *ppv
= &This
->IHTMLStyle2_iface
;
644 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
645 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This
, ppv
);
646 *ppv
= &This
->IHTMLStyle3_iface
;
647 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
648 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This
, ppv
);
649 *ppv
= &This
->IHTMLStyle4_iface
;
650 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
651 return *ppv
? S_OK
: E_NOINTERFACE
;
655 IUnknown_AddRef((IUnknown
*)*ppv
);
659 WARN("unsupported %s\n", debugstr_guid(riid
));
660 return E_NOINTERFACE
;
663 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
665 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
666 LONG ref
= InterlockedIncrement(&This
->ref
);
668 TRACE("(%p) ref=%d\n", This
, ref
);
673 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
675 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
676 LONG ref
= InterlockedDecrement(&This
->ref
);
678 TRACE("(%p) ref=%d\n", This
, ref
);
682 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
683 heap_free(This
->filter
);
684 release_dispex(&This
->dispex
);
691 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
693 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
694 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
697 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
698 LCID lcid
, ITypeInfo
**ppTInfo
)
700 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
701 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
704 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
705 LPOLESTR
*rgszNames
, UINT cNames
,
706 LCID lcid
, DISPID
*rgDispId
)
708 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
709 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
713 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
714 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
715 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
717 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
718 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
719 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
722 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
724 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
726 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
728 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
731 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
733 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
735 TRACE("(%p)->(%p)\n", This
, p
);
737 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
740 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
742 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
743 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
744 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
746 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
748 /* fontStyle can only be one of the follow values. */
749 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
750 strcmpiW(szOblique
, v
) == 0)
752 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
758 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
760 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
762 TRACE("(%p)->(%p)\n", This
, p
);
764 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
767 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
769 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
770 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
772 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
774 /* fontVariant can only be one of the follow values. */
775 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
777 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
783 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
785 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
786 TRACE("(%p)->(%p)\n", This
, p
);
791 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
794 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
796 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
797 static const WCHAR styleBold
[] = {'b','o','l','d',0};
798 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
799 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
800 static const WCHAR style100
[] = {'1','0','0',0};
801 static const WCHAR style200
[] = {'2','0','0',0};
802 static const WCHAR style300
[] = {'3','0','0',0};
803 static const WCHAR style400
[] = {'4','0','0',0};
804 static const WCHAR style500
[] = {'5','0','0',0};
805 static const WCHAR style600
[] = {'6','0','0',0};
806 static const WCHAR style700
[] = {'7','0','0',0};
807 static const WCHAR style800
[] = {'8','0','0',0};
808 static const WCHAR style900
[] = {'9','0','0',0};
810 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
812 /* fontWeight can only be one of the following */
813 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
814 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
815 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
816 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
817 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
818 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
819 strcmpiW(style900
, v
) == 0
822 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
828 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
830 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
832 TRACE("(%p)->(%p)\n", This
, p
);
834 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
837 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
839 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
841 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
845 return set_style_attr(This
, STYLEID_FONT_SIZE
, V_BSTR(&v
), 0);
847 FIXME("not supported vt %d\n", V_VT(&v
));
853 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
855 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
857 TRACE("(%p)->(%p)\n", This
, p
);
860 return get_style_attr(This
, STYLEID_FONT_SIZE
, &V_BSTR(p
));
863 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
865 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
866 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
870 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
872 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
873 FIXME("(%p)->(%p)\n", This
, p
);
877 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
879 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
881 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
885 TRACE("%s\n", debugstr_w(V_BSTR(&v
)));
886 return set_style_attr(This
, STYLEID_COLOR
, V_BSTR(&v
), 0);
889 FIXME("unsupported vt=%d\n", V_VT(&v
));
895 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
897 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
899 TRACE("(%p)->(%p)\n", This
, p
);
902 return get_style_attr(This
, STYLEID_COLOR
, &V_BSTR(p
));
905 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
907 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
909 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
911 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
914 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
916 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
918 TRACE("(%p)->(%p)\n", This
, p
);
920 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
923 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
925 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
927 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
931 return set_style_attr(This
, STYLEID_BACKGROUND_COLOR
, V_BSTR(&v
), 0);
934 static const WCHAR format
[] = {'#','%','0','6','x',0};
936 wsprintfW(value
, format
, V_I4(&v
));
937 return set_style_attr(This
, STYLEID_BACKGROUND_COLOR
, value
, 0);
940 FIXME("unsupported vt %d\n", V_VT(&v
));
946 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
948 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
949 TRACE("(%p)->(%p)\n", This
, p
);
952 return get_style_attr(This
, STYLEID_BACKGROUND_COLOR
, &V_BSTR(p
));
955 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
957 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
959 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
961 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
964 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
966 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
968 TRACE("(%p)->(%p)\n", This
, p
);
970 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
973 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
975 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
976 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
977 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
978 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
979 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
981 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
983 /* fontWeight can only be one of the following */
984 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
985 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
987 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
993 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
995 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
997 TRACE("(%p)->(%p)\n", This
, p
);
999 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1002 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1004 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1005 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1009 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1011 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1012 FIXME("(%p)->(%p)\n", This
, p
);
1016 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1018 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1020 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1022 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1025 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1027 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1029 TRACE("(%p)->(%p)\n", This
, p
);
1031 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1034 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1036 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1037 WCHAR buf
[14], *pos_val
;
1043 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1045 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1049 val_len
= val
? strlenW(val
) : 0;
1051 nsAString_Init(&pos_str
, NULL
);
1052 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1053 if(SUCCEEDED(hres
)) {
1054 const PRUnichar
*pos
, *posy
;
1057 nsAString_GetData(&pos_str
, &pos
);
1058 posy
= strchrW(pos
, ' ');
1060 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1062 TRACE("no space in %s\n", debugstr_w(pos
));
1066 posy_len
= strlenW(posy
);
1067 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1070 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1072 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1073 pos_val
[val_len
+posy_len
] = 0;
1075 hres
= E_OUTOFMEMORY
;
1078 nsAString_Finish(&pos_str
);
1082 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1083 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1088 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1090 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1095 TRACE("(%p)->(%p)\n", This
, p
);
1097 nsAString_Init(&pos_str
, NULL
);
1098 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1099 if(SUCCEEDED(hres
)) {
1100 const PRUnichar
*pos
, *space
;
1102 nsAString_GetData(&pos_str
, &pos
);
1103 space
= strchrW(pos
, ' ');
1105 WARN("no space in %s\n", debugstr_w(pos
));
1106 space
= pos
+ strlenW(pos
);
1110 ret
= SysAllocStringLen(pos
, space
-pos
);
1112 hres
= E_OUTOFMEMORY
;
1117 nsAString_Finish(&pos_str
);
1121 TRACE("returning %s\n", debugstr_w(ret
));
1127 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1129 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1130 WCHAR buf
[14], *pos_val
;
1136 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1138 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1142 val_len
= val
? strlenW(val
) : 0;
1144 nsAString_Init(&pos_str
, NULL
);
1145 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1146 if(SUCCEEDED(hres
)) {
1147 const PRUnichar
*pos
, *space
;
1150 nsAString_GetData(&pos_str
, &pos
);
1151 space
= strchrW(pos
, ' ');
1155 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1157 TRACE("no space in %s\n", debugstr_w(pos
));
1159 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1162 posx_len
= space
-pos
;
1164 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1166 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1168 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1169 pos_val
[posx_len
+val_len
] = 0;
1171 hres
= E_OUTOFMEMORY
;
1174 nsAString_Finish(&pos_str
);
1178 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1179 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1184 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1186 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1191 TRACE("(%p)->(%p)\n", This
, p
);
1193 nsAString_Init(&pos_str
, NULL
);
1194 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1195 if(SUCCEEDED(hres
)) {
1196 const PRUnichar
*pos
, *posy
;
1198 nsAString_GetData(&pos_str
, &pos
);
1199 posy
= strchrW(pos
, ' ');
1201 ret
= SysAllocString(posy
+1);
1203 hres
= E_OUTOFMEMORY
;
1208 nsAString_Finish(&pos_str
);
1212 TRACE("returning %s\n", debugstr_w(ret
));
1218 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1220 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1221 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1222 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1225 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1227 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1228 TRACE("(%p)->(%p)\n", This
, p
);
1229 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1232 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(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_LETTER_SPACING
, &v
, 0);
1239 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(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_LETTER_SPACING
, p
, 0);
1246 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1248 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1250 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1252 /* textDecoration can only be one of the following */
1253 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1254 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1255 strcmpiW(valBlink
, v
) == 0)
1257 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1260 return E_INVALIDARG
;
1263 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1265 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1267 TRACE("(%p)->(%p)\n", This
, p
);
1269 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1272 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1274 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1276 TRACE("(%p)->(%x)\n", This
, v
);
1278 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1281 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1283 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1285 TRACE("(%p)->(%p)\n", This
, p
);
1287 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1290 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1292 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1294 TRACE("(%p)->(%x)\n", This
, v
);
1296 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1299 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1301 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1303 TRACE("(%p)->(%p)\n", This
, p
);
1305 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1308 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1310 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1312 TRACE("(%p)->(%x)\n", This
, v
);
1314 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1317 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1319 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1321 TRACE("(%p)->(%p)\n", This
, p
);
1323 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1326 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1328 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1330 TRACE("(%p)->(%x)\n", This
, v
);
1332 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1335 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1337 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1339 TRACE("(%p)->(%p)\n", This
, p
);
1341 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1344 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1346 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1348 TRACE("(%p)->(%x)\n", This
, v
);
1350 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1353 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1355 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1357 TRACE("(%p)->(%p)\n", This
, p
);
1359 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1362 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1364 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1366 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1370 return set_style_attr(This
, STYLEID_VERTICAL_ALIGN
, V_BSTR(&v
), 0);
1372 FIXME("not implemented vt %d\n", V_VT(&v
));
1379 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1381 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1385 TRACE("(%p)->(%p)\n", This
, p
);
1387 hres
= get_style_attr(This
, STYLEID_VERTICAL_ALIGN
, &ret
);
1396 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1398 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1399 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1403 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1405 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1406 FIXME("(%p)->(%p)\n", This
, p
);
1410 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1412 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1414 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1416 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1419 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1421 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1423 TRACE("(%p)->(%p)\n", This
, p
);
1425 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1428 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1430 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1431 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1435 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1437 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1438 FIXME("(%p)->(%p)\n", This
, p
);
1442 static HRESULT WINAPI
HTMLStyle_put_lineHeight(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_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1451 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1452 FIXME("(%p)->(%p)\n", This
, p
);
1456 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1458 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1460 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1462 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, 0);
1465 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1467 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1469 TRACE("(%p)->(%p)\n", This
, p
);
1471 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1474 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1476 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1478 TRACE("(%p)->(v(%d))\n", This
, V_VT(&v
));
1482 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, emptyW
, 0);
1486 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1487 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, buf
, 0);
1490 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, V_BSTR(&v
), 0);
1492 FIXME("Unsupported vt=%d\n", V_VT(&v
));
1498 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1500 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1501 TRACE("(%p)->(%p)\n", This
, p
);
1502 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1505 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1507 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1508 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1512 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1514 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1515 FIXME("(%p)->(%p)\n", This
, p
);
1519 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1521 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1525 TRACE("(%p)->(NULL)\n", This
);
1526 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, emptyW
, 0);
1530 TRACE("(%p)->(%d)\n", This
, V_I4(&v
));
1532 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1533 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, buf
, 0);
1536 TRACE("(%p)->(%s)\n", This
, debugstr_w(V_BSTR(&v
)));
1537 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, V_BSTR(&v
), 0);
1539 FIXME("Unsupported vt=%d\n", V_VT(&v
));
1545 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1547 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1549 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1551 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1554 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1556 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1558 TRACE("(%p)->(%p)\n", This
, p
);
1560 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1563 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1565 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1566 TRACE("(%p)->(%p)\n", This
, p
);
1567 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1570 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1572 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1573 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1577 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1579 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1580 FIXME("(%p)->(%p)\n", This
, p
);
1584 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1586 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1587 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1591 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1593 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1594 FIXME("(%p)->(%p)\n", This
, p
);
1598 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1600 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1601 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1605 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1607 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1608 FIXME("(%p)->(%p)\n", This
, p
);
1612 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1614 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1616 TRACE("(%p)->(vt=%d)\n", This
, V_VT(&v
));
1622 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1623 return set_style_attr(This
, STYLEID_PADDING_LEFT
, buf
, 0);
1626 return set_style_attr(This
, STYLEID_PADDING_LEFT
, V_BSTR(&v
), 0);
1628 FIXME("unsupported vt=%d\n", V_VT(&v
));
1634 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1636 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1640 TRACE("(%p)->(%p)\n", This
, p
);
1642 hres
= get_style_attr(This
, STYLEID_PADDING_LEFT
, &ret
);
1651 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1653 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1655 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1657 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1660 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1662 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1664 TRACE("(%p)->(%p)\n", This
, p
);
1666 return get_style_attr(This
, STYLEID_PADDING
, p
);
1669 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1671 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1673 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1675 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1678 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1680 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1682 TRACE("(%p)->(%p)\n", This
, p
);
1684 return get_style_attr(This
, STYLEID_BORDER
, p
);
1687 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1689 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1690 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1691 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1694 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1696 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1697 TRACE("(%p)->(%p)\n", This
, p
);
1698 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1701 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1703 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1704 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1705 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1708 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1710 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1711 TRACE("(%p)->(%p)\n", This
, p
);
1712 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1715 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1717 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1718 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1719 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1722 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1724 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1725 TRACE("(%p)->(%p)\n", This
, p
);
1726 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1729 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1731 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1733 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1735 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1738 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1740 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1742 TRACE("(%p)->(%p)\n", This
, p
);
1744 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1747 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1749 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1751 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1753 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1756 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1758 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1760 TRACE("(%p)->(%p)\n", This
, p
);
1762 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1765 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1767 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1769 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1771 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1774 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1776 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1778 TRACE("(%p)->(%p)\n", This
, p
);
1780 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1783 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1785 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1787 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1789 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1792 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1794 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1796 TRACE("(%p)->(%p)\n", This
, p
);
1798 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1801 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1803 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1805 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1807 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1810 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1812 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1814 TRACE("(%p)->(%p)\n", This
, p
);
1816 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1819 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1821 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1823 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1825 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1828 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1830 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1832 TRACE("(%p)->(%p)\n", This
, p
);
1834 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1837 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1839 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1840 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1841 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1844 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1846 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1847 TRACE("(%p)->(%p)\n", This
, p
);
1848 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1851 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1853 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1854 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1855 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1858 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1860 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1862 TRACE("(%p)->(%p)\n", This
, p
);
1864 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1867 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1869 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1870 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1871 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1874 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1876 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1877 TRACE("(%p)->(%p)\n", This
, p
);
1878 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1881 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1883 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1885 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1886 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1889 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1891 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1892 TRACE("(%p)->(%p)\n", This
, p
);
1893 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1896 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1898 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1899 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1900 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1903 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1905 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1906 TRACE("(%p)->(%p)\n", This
, p
);
1907 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1910 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1912 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1913 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1914 HRESULT hres
= S_OK
;
1919 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1921 while(v
[i
] && hres
== S_OK
)
1923 if(v
[i
] == (WCHAR
)' ')
1925 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1926 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1928 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1929 hres
= E_INVALIDARG
;
1931 SysFreeString(pstyle
);
1939 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1940 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1942 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1943 hres
= E_INVALIDARG
;
1945 SysFreeString(pstyle
);
1949 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1954 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
1956 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1957 TRACE("(%p)->(%p)\n", This
, p
);
1958 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
1961 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
1963 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1964 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1966 if(!is_valid_border_style(v
))
1967 return E_INVALIDARG
;
1969 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
1972 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
1974 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1975 TRACE("(%p)->(%p)\n", This
, p
);
1976 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
1979 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
1981 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1982 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1984 if(!is_valid_border_style(v
))
1985 return E_INVALIDARG
;
1987 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
1990 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
1992 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1993 TRACE("(%p)->(%p)\n", This
, p
);
1994 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
1997 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
1999 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2000 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2002 if(!is_valid_border_style(v
))
2003 return E_INVALIDARG
;
2005 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2008 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2010 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2011 TRACE("(%p)->(%p)\n", This
, p
);
2012 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2015 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2017 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2018 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2020 if(!is_valid_border_style(v
))
2021 return E_INVALIDARG
;
2023 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2026 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2028 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2029 TRACE("(%p)->(%p)\n", This
, p
);
2030 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2033 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2035 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2037 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
2039 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2042 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2044 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2046 TRACE("(%p)->(%p)\n", This
, p
);
2049 return get_style_attr(This
, STYLEID_WIDTH
, &V_BSTR(p
));
2052 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2054 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2056 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2060 return set_style_attr(This
, STYLEID_HEIGHT
, V_BSTR(&v
), 0);
2062 FIXME("unimplemented vt %d\n", V_VT(&v
));
2069 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2071 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2075 TRACE("(%p)->(%p)\n", This
, p
);
2077 hres
= get_style_attr(This
, STYLEID_HEIGHT
, &ret
);
2086 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2088 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2089 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2093 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2095 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2096 FIXME("(%p)->(%p)\n", This
, p
);
2100 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2102 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2103 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2107 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2109 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2110 FIXME("(%p)->(%p)\n", This
, p
);
2114 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2116 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2118 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2120 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2123 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2125 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2127 TRACE("(%p)->(%p)\n", This
, p
);
2129 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2132 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2134 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2136 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2138 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2141 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2143 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2145 TRACE("(%p)->(%p)\n", This
, p
);
2147 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2150 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2152 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2153 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2157 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2159 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2160 FIXME("(%p)->(%p)\n", This
, p
);
2164 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2166 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2167 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2171 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2173 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2174 FIXME("(%p)->(%p)\n", This
, p
);
2178 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2180 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2181 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2185 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2187 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2188 FIXME("(%p)->(%p)\n", This
, p
);
2192 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2194 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2195 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2199 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2201 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2202 FIXME("(%p)->(%p)\n", This
, p
);
2206 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2208 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2209 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2213 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2215 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2216 FIXME("(%p)->(%p)\n", This
, p
);
2220 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2222 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2224 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2226 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2229 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2231 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2235 TRACE("(%p)->(%p)\n", This
, p
);
2237 hres
= get_style_attr(This
, STYLEID_TOP
, &ret
);
2246 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2248 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2250 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2252 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2255 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2257 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2261 TRACE("(%p)->(%p)\n", This
, p
);
2263 hres
= get_style_attr(This
, STYLEID_LEFT
, &ret
);
2272 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2274 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2275 TRACE("(%p)->(%p)\n", This
, p
);
2276 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2279 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2281 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2283 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2287 return set_style_attr(This
, STYLEID_Z_INDEX
, V_BSTR(&v
), 0);
2290 static const WCHAR format
[] = {'%','d',0};
2292 wsprintfW(value
, format
, V_I4(&v
));
2293 return set_style_attr(This
, STYLEID_Z_INDEX
, value
, 0);
2296 FIXME("unimplemented vt %d\n", V_VT(&v
));
2303 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2305 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2307 TRACE("(%p)->(%p)\n", This
, p
);
2309 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2312 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2314 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2315 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2316 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2317 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2318 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2320 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2322 /* overflow can only be one of the follow values. */
2323 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2324 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2326 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2329 return E_INVALIDARG
;
2333 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2335 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2337 TRACE("(%p)->(%p)\n", This
, p
);
2340 return E_INVALIDARG
;
2342 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2345 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2347 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2348 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2352 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2354 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2355 FIXME("(%p)->(%p)\n", This
, p
);
2359 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2361 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2362 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2366 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2368 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2369 FIXME("(%p)->(%p)\n", This
, p
);
2373 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2375 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2379 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2381 nsAString_InitDepend(&text_str
, v
);
2382 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2383 nsAString_Finish(&text_str
);
2384 if(NS_FAILED(nsres
)) {
2385 FIXME("SetCssStyle failed: %08x\n", nsres
);
2392 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2394 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2398 TRACE("(%p)->(%p)\n", This
, p
);
2400 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2401 nsAString_Init(&text_str
, NULL
);
2402 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2403 if(NS_SUCCEEDED(nsres
)) {
2404 const PRUnichar
*text
;
2406 nsAString_GetData(&text_str
, &text
);
2407 *p
= *text
? SysAllocString(text
) : NULL
;
2409 FIXME("GetCssStyle failed: %08x\n", nsres
);
2413 nsAString_Finish(&text_str
);
2417 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2419 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2420 FIXME("(%p)->()\n", This
);
2424 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2426 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2427 FIXME("(%p)->()\n", This
);
2431 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2433 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2434 FIXME("(%p)->()\n", This
);
2438 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2440 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2441 FIXME("(%p)->()\n", This
);
2445 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2447 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2448 FIXME("(%p)->()\n", This
);
2452 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2454 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2455 FIXME("(%p)->()\n", This
);
2459 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2461 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2462 FIXME("(%p)->()\n", This
);
2466 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2468 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2469 FIXME("(%p)->()\n", This
);
2473 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2475 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2477 TRACE("(%p)->(%f)\n", This
, v
);
2479 return set_style_pos(This
, STYLEID_TOP
, v
);
2482 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2484 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2486 TRACE("(%p)->(%p)\n", This
, p
);
2491 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2494 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2496 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2498 TRACE("(%p)->(%f)\n", This
, v
);
2500 return set_style_pos(This
, STYLEID_LEFT
, v
);
2503 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2505 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2507 TRACE("(%p)->(%p)\n", This
, p
);
2512 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2515 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2517 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2519 TRACE("(%p)->(%f)\n", This
, v
);
2521 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2524 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2526 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2528 TRACE("(%p)->(%p)\n", This
, p
);
2533 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2539 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2541 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2543 TRACE("(%p)->(%f)\n", This
, v
);
2545 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2548 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2550 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2552 TRACE("(%p)->(%p)\n", This
, p
);
2557 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2563 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2565 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2567 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2569 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2572 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2574 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2576 TRACE("(%p)->(%p)\n", This
, p
);
2578 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2581 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2583 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2585 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2587 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2590 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2592 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2594 TRACE("(%p)->(%p)\n", This
, p
);
2596 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2599 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2601 nsAString name_str
, val_str
, empty_str
;
2604 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2606 TRACE("%s\n", debugstr_w(val
));
2608 nsAString_InitDepend(&name_str
, opacityW
);
2609 nsAString_InitDepend(&val_str
, val
);
2610 nsAString_InitDepend(&empty_str
, emptyW
);
2612 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2613 if(NS_FAILED(nsres
))
2614 ERR("SetProperty failed: %08x\n", nsres
);
2616 nsAString_Finish(&name_str
);
2617 nsAString_Finish(&val_str
);
2618 nsAString_Finish(&empty_str
);
2621 static void update_filter(HTMLStyle
*This
)
2623 const WCHAR
*ptr
= This
->filter
, *ptr2
;
2625 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2628 set_opacity(This
, emptyW
);
2633 while(isspaceW(*ptr
))
2639 while(isalnumW(*ptr
))
2642 WARN("unexpected char '%c'\n", *ptr
);
2646 WARN("expected '('\n");
2650 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2651 static const WCHAR formatW
[] = {'%','f',0};
2652 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2656 while(isspaceW(*ptr
))
2660 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2663 WARN("unexpected end of string\n");
2667 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2668 float fval
= 0.0f
, e
= 0.1f
;
2671 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2673 while(isdigitW(*ptr2
))
2674 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2677 while(isdigitW(*++ptr2
)) {
2678 fval
+= e
* (float)(*ptr2
++ - '0');
2683 sprintfW(buf
, formatW
, fval
* 0.01f
);
2684 set_opacity(This
, buf
);
2686 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2691 }while(*ptr
!= ')');
2693 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2694 ptr
= strchrW(ptr
, ')');
2702 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2704 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2705 WCHAR
*new_filter
= NULL
;
2707 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2710 new_filter
= heap_strdupW(v
);
2712 return E_OUTOFMEMORY
;
2715 heap_free(This
->filter
);
2716 This
->filter
= new_filter
;
2718 update_filter(This
);
2722 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2724 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2726 TRACE("(%p)->(%p)\n", This
, p
);
2729 *p
= SysAllocString(This
->filter
);
2731 return E_OUTOFMEMORY
;
2739 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2740 VARIANT AttributeValue
, LONG lFlags
)
2742 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2746 TRACE("(%p)->(%s v%d %08x)\n", This
, debugstr_w(strAttributeName
),
2747 V_VT(&AttributeValue
), lFlags
);
2749 if(!strAttributeName
)
2750 return E_INVALIDARG
;
2753 FIXME("Parameter lFlags ignored\n");
2755 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2756 LOCALE_USER_DEFAULT
, &dispid
);
2760 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2764 params
.rgvarg
= &AttributeValue
;
2765 params
.cNamedArgs
= 1;
2766 params
.rgdispidNamedArgs
= &dispidNamed
;
2768 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2769 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2773 FIXME("Custom attributes not supported.\n");
2776 TRACE("ret: %08x\n", hres
);
2781 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2782 LONG lFlags
, VARIANT
*AttributeValue
)
2784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2788 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2789 AttributeValue
, lFlags
);
2791 if(!AttributeValue
|| !strAttributeName
)
2792 return E_INVALIDARG
;
2795 FIXME("Parameter lFlags ignored\n");
2797 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2798 LOCALE_USER_DEFAULT
, &dispid
);
2801 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2803 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2804 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2808 FIXME("Custom attributes not supported.\n");
2814 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2815 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2817 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2818 FIXME("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
),
2823 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2825 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2826 FIXME("(%p)->(%p)\n", This
, String
);
2830 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2831 HTMLStyle_QueryInterface
,
2834 HTMLStyle_GetTypeInfoCount
,
2835 HTMLStyle_GetTypeInfo
,
2836 HTMLStyle_GetIDsOfNames
,
2838 HTMLStyle_put_fontFamily
,
2839 HTMLStyle_get_fontFamily
,
2840 HTMLStyle_put_fontStyle
,
2841 HTMLStyle_get_fontStyle
,
2842 HTMLStyle_put_fontVariant
,
2843 HTMLStyle_get_fontVariant
,
2844 HTMLStyle_put_fontWeight
,
2845 HTMLStyle_get_fontWeight
,
2846 HTMLStyle_put_fontSize
,
2847 HTMLStyle_get_fontSize
,
2850 HTMLStyle_put_color
,
2851 HTMLStyle_get_color
,
2852 HTMLStyle_put_background
,
2853 HTMLStyle_get_background
,
2854 HTMLStyle_put_backgroundColor
,
2855 HTMLStyle_get_backgroundColor
,
2856 HTMLStyle_put_backgroundImage
,
2857 HTMLStyle_get_backgroundImage
,
2858 HTMLStyle_put_backgroundRepeat
,
2859 HTMLStyle_get_backgroundRepeat
,
2860 HTMLStyle_put_backgroundAttachment
,
2861 HTMLStyle_get_backgroundAttachment
,
2862 HTMLStyle_put_backgroundPosition
,
2863 HTMLStyle_get_backgroundPosition
,
2864 HTMLStyle_put_backgroundPositionX
,
2865 HTMLStyle_get_backgroundPositionX
,
2866 HTMLStyle_put_backgroundPositionY
,
2867 HTMLStyle_get_backgroundPositionY
,
2868 HTMLStyle_put_wordSpacing
,
2869 HTMLStyle_get_wordSpacing
,
2870 HTMLStyle_put_letterSpacing
,
2871 HTMLStyle_get_letterSpacing
,
2872 HTMLStyle_put_textDecoration
,
2873 HTMLStyle_get_textDecoration
,
2874 HTMLStyle_put_textDecorationNone
,
2875 HTMLStyle_get_textDecorationNone
,
2876 HTMLStyle_put_textDecorationUnderline
,
2877 HTMLStyle_get_textDecorationUnderline
,
2878 HTMLStyle_put_textDecorationOverline
,
2879 HTMLStyle_get_textDecorationOverline
,
2880 HTMLStyle_put_textDecorationLineThrough
,
2881 HTMLStyle_get_textDecorationLineThrough
,
2882 HTMLStyle_put_textDecorationBlink
,
2883 HTMLStyle_get_textDecorationBlink
,
2884 HTMLStyle_put_verticalAlign
,
2885 HTMLStyle_get_verticalAlign
,
2886 HTMLStyle_put_textTransform
,
2887 HTMLStyle_get_textTransform
,
2888 HTMLStyle_put_textAlign
,
2889 HTMLStyle_get_textAlign
,
2890 HTMLStyle_put_textIndent
,
2891 HTMLStyle_get_textIndent
,
2892 HTMLStyle_put_lineHeight
,
2893 HTMLStyle_get_lineHeight
,
2894 HTMLStyle_put_marginTop
,
2895 HTMLStyle_get_marginTop
,
2896 HTMLStyle_put_marginRight
,
2897 HTMLStyle_get_marginRight
,
2898 HTMLStyle_put_marginBottom
,
2899 HTMLStyle_get_marginBottom
,
2900 HTMLStyle_put_marginLeft
,
2901 HTMLStyle_get_marginLeft
,
2902 HTMLStyle_put_margin
,
2903 HTMLStyle_get_margin
,
2904 HTMLStyle_put_paddingTop
,
2905 HTMLStyle_get_paddingTop
,
2906 HTMLStyle_put_paddingRight
,
2907 HTMLStyle_get_paddingRight
,
2908 HTMLStyle_put_paddingBottom
,
2909 HTMLStyle_get_paddingBottom
,
2910 HTMLStyle_put_paddingLeft
,
2911 HTMLStyle_get_paddingLeft
,
2912 HTMLStyle_put_padding
,
2913 HTMLStyle_get_padding
,
2914 HTMLStyle_put_border
,
2915 HTMLStyle_get_border
,
2916 HTMLStyle_put_borderTop
,
2917 HTMLStyle_get_borderTop
,
2918 HTMLStyle_put_borderRight
,
2919 HTMLStyle_get_borderRight
,
2920 HTMLStyle_put_borderBottom
,
2921 HTMLStyle_get_borderBottom
,
2922 HTMLStyle_put_borderLeft
,
2923 HTMLStyle_get_borderLeft
,
2924 HTMLStyle_put_borderColor
,
2925 HTMLStyle_get_borderColor
,
2926 HTMLStyle_put_borderTopColor
,
2927 HTMLStyle_get_borderTopColor
,
2928 HTMLStyle_put_borderRightColor
,
2929 HTMLStyle_get_borderRightColor
,
2930 HTMLStyle_put_borderBottomColor
,
2931 HTMLStyle_get_borderBottomColor
,
2932 HTMLStyle_put_borderLeftColor
,
2933 HTMLStyle_get_borderLeftColor
,
2934 HTMLStyle_put_borderWidth
,
2935 HTMLStyle_get_borderWidth
,
2936 HTMLStyle_put_borderTopWidth
,
2937 HTMLStyle_get_borderTopWidth
,
2938 HTMLStyle_put_borderRightWidth
,
2939 HTMLStyle_get_borderRightWidth
,
2940 HTMLStyle_put_borderBottomWidth
,
2941 HTMLStyle_get_borderBottomWidth
,
2942 HTMLStyle_put_borderLeftWidth
,
2943 HTMLStyle_get_borderLeftWidth
,
2944 HTMLStyle_put_borderStyle
,
2945 HTMLStyle_get_borderStyle
,
2946 HTMLStyle_put_borderTopStyle
,
2947 HTMLStyle_get_borderTopStyle
,
2948 HTMLStyle_put_borderRightStyle
,
2949 HTMLStyle_get_borderRightStyle
,
2950 HTMLStyle_put_borderBottomStyle
,
2951 HTMLStyle_get_borderBottomStyle
,
2952 HTMLStyle_put_borderLeftStyle
,
2953 HTMLStyle_get_borderLeftStyle
,
2954 HTMLStyle_put_width
,
2955 HTMLStyle_get_width
,
2956 HTMLStyle_put_height
,
2957 HTMLStyle_get_height
,
2958 HTMLStyle_put_styleFloat
,
2959 HTMLStyle_get_styleFloat
,
2960 HTMLStyle_put_clear
,
2961 HTMLStyle_get_clear
,
2962 HTMLStyle_put_display
,
2963 HTMLStyle_get_display
,
2964 HTMLStyle_put_visibility
,
2965 HTMLStyle_get_visibility
,
2966 HTMLStyle_put_listStyleType
,
2967 HTMLStyle_get_listStyleType
,
2968 HTMLStyle_put_listStylePosition
,
2969 HTMLStyle_get_listStylePosition
,
2970 HTMLStyle_put_listStyleImage
,
2971 HTMLStyle_get_listStyleImage
,
2972 HTMLStyle_put_listStyle
,
2973 HTMLStyle_get_listStyle
,
2974 HTMLStyle_put_whiteSpace
,
2975 HTMLStyle_get_whiteSpace
,
2980 HTMLStyle_get_position
,
2981 HTMLStyle_put_zIndex
,
2982 HTMLStyle_get_zIndex
,
2983 HTMLStyle_put_overflow
,
2984 HTMLStyle_get_overflow
,
2985 HTMLStyle_put_pageBreakBefore
,
2986 HTMLStyle_get_pageBreakBefore
,
2987 HTMLStyle_put_pageBreakAfter
,
2988 HTMLStyle_get_pageBreakAfter
,
2989 HTMLStyle_put_cssText
,
2990 HTMLStyle_get_cssText
,
2991 HTMLStyle_put_pixelTop
,
2992 HTMLStyle_get_pixelTop
,
2993 HTMLStyle_put_pixelLeft
,
2994 HTMLStyle_get_pixelLeft
,
2995 HTMLStyle_put_pixelWidth
,
2996 HTMLStyle_get_pixelWidth
,
2997 HTMLStyle_put_pixelHeight
,
2998 HTMLStyle_get_pixelHeight
,
2999 HTMLStyle_put_posTop
,
3000 HTMLStyle_get_posTop
,
3001 HTMLStyle_put_posLeft
,
3002 HTMLStyle_get_posLeft
,
3003 HTMLStyle_put_posWidth
,
3004 HTMLStyle_get_posWidth
,
3005 HTMLStyle_put_posHeight
,
3006 HTMLStyle_get_posHeight
,
3007 HTMLStyle_put_cursor
,
3008 HTMLStyle_get_cursor
,
3011 HTMLStyle_put_filter
,
3012 HTMLStyle_get_filter
,
3013 HTMLStyle_setAttribute
,
3014 HTMLStyle_getAttribute
,
3015 HTMLStyle_removeAttribute
,
3019 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3021 int c
, i
, min
=0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
3026 c
= strcmpW(style_tbl
[i
].name
, name
);
3028 *dispid
= style_tbl
[i
].dispid
;
3038 return DISP_E_UNKNOWNNAME
;
3041 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3043 HTMLStyle_get_dispid
,
3047 static const tid_t HTMLStyle_iface_tids
[] = {
3054 static dispex_static_data_t HTMLStyle_dispex
= {
3055 &HTMLStyle_dispex_vtbl
,
3058 HTMLStyle_iface_tids
3061 HRESULT
HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*nsstyle
, HTMLStyle
**ret
)
3065 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3067 return E_OUTOFMEMORY
;
3069 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3071 style
->nsstyle
= nsstyle
;
3072 HTMLStyle2_Init(style
);
3073 HTMLStyle3_Init(style
);
3075 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3077 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);