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
19 #include "mshtml_private.h"
21 static const WCHAR attrBackground
[] =
22 {'b','a','c','k','g','r','o','u','n','d',0};
23 static const WCHAR attrBackgroundColor
[] =
24 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
25 static const WCHAR attrBackgroundImage
[] =
26 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
27 static const WCHAR attrBackgroundPosition
[] =
28 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
29 static const WCHAR attrBackgroundPositionX
[] =
30 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
31 static const WCHAR attrBackgroundPositionY
[] =
32 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
33 static const WCHAR attrBackgroundRepeat
[] =
34 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
35 static const WCHAR attrBorder
[] =
36 {'b','o','r','d','e','r',0};
37 static const WCHAR attrBorderBottom
[] =
38 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
39 static const WCHAR attrBorderBottomColor
[] =
40 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
41 static const WCHAR attrBorderBottomStyle
[] =
42 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
43 static const WCHAR attrBorderBottomWidth
[] =
44 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
45 static const WCHAR attrBorderColor
[] =
46 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
47 static const WCHAR attrBorderLeft
[] =
48 {'b','o','r','d','e','r','-','l','e','f','t',0};
49 static const WCHAR attrBorderLeftColor
[] =
50 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
51 static const WCHAR attrBorderLeftStyle
[] =
52 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
53 static const WCHAR attrBorderLeftWidth
[] =
54 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
55 static const WCHAR attrBorderRight
[] =
56 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
57 static const WCHAR attrBorderRightColor
[] =
58 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
59 static const WCHAR attrBorderRightStyle
[] =
60 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
61 static const WCHAR attrBorderRightWidth
[] =
62 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
63 static const WCHAR attrBorderTop
[] =
64 {'b','o','r','d','e','r','-','t','o','p',0};
65 static const WCHAR attrBorderTopColor
[] =
66 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
67 static const WCHAR attrBorderStyle
[] =
68 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
69 static const WCHAR attrBorderTopStyle
[] =
70 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
71 static const WCHAR attrBorderTopWidth
[] =
72 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
73 static const WCHAR attrBorderWidth
[] =
74 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
75 static const WCHAR attrBottom
[] =
76 {'b','o','t','t','o','m',0};
77 /* FIXME: Use unprefixed version (requires Gecko changes). */
78 static const WCHAR attrBoxSizing
[] =
79 {'-','m','o','z','-','b','o','x','-','s','i','z','i','n','g',0};
80 static const WCHAR attrClear
[] =
81 {'c','l','e','a','r',0};
82 static const WCHAR attrClip
[] =
84 static const WCHAR attrColor
[] =
85 {'c','o','l','o','r',0};
86 static const WCHAR attrCursor
[] =
87 {'c','u','r','s','o','r',0};
88 static const WCHAR attrDirection
[] =
89 {'d','i','r','e','c','t','i','o','n',0};
90 static const WCHAR attrDisplay
[] =
91 {'d','i','s','p','l','a','y',0};
92 static const WCHAR attrFilter
[] =
93 {'f','i','l','e','t','e','r',0};
94 static const WCHAR attrFontFamily
[] =
95 {'f','o','n','t','-','f','a','m','i','l','y',0};
96 static const WCHAR attrFontSize
[] =
97 {'f','o','n','t','-','s','i','z','e',0};
98 static const WCHAR attrFontStyle
[] =
99 {'f','o','n','t','-','s','t','y','l','e',0};
100 static const WCHAR attrFontVariant
[] =
101 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
102 static const WCHAR attrFontWeight
[] =
103 {'f','o','n','t','-','w','e','i','g','h','t',0};
104 static const WCHAR attrHeight
[] =
105 {'h','e','i','g','h','t',0};
106 static const WCHAR attrLeft
[] =
108 static const WCHAR attrLetterSpacing
[] =
109 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
110 static const WCHAR attrLineHeight
[] =
111 {'l','i','n','e','-','h','e','i','g','h','t',0};
112 static const WCHAR attrListStyleType
[] =
113 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
114 static const WCHAR attrMargin
[] =
115 {'m','a','r','g','i','n',0};
116 static const WCHAR attrMarginBottom
[] =
117 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
118 static const WCHAR attrMarginLeft
[] =
119 {'m','a','r','g','i','n','-','l','e','f','t',0};
120 static const WCHAR attrMarginRight
[] =
121 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
122 static const WCHAR attrMarginTop
[] =
123 {'m','a','r','g','i','n','-','t','o','p',0};
124 static const WCHAR attrMinHeight
[] =
125 {'m','i','n','-','h','e','i','g','h','t',0};
126 static const WCHAR attrOutline
[] =
127 {'o','u','t','l','i','n','e',0};
128 static const WCHAR attrOverflow
[] =
129 {'o','v','e','r','f','l','o','w',0};
130 static const WCHAR attrOverflowX
[] =
131 {'o','v','e','r','f','l','o','w','-','x',0};
132 static const WCHAR attrOverflowY
[] =
133 {'o','v','e','r','f','l','o','w','-','y',0};
134 static const WCHAR attrPadding
[] =
135 {'p','a','d','d','i','n','g',0};
136 static const WCHAR attrPaddingBottom
[] =
137 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
138 static const WCHAR attrPaddingLeft
[] =
139 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
140 static const WCHAR attrPaddingRight
[] =
141 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
142 static const WCHAR attrPaddingTop
[] =
143 {'p','a','d','d','i','n','g','-','t','o','p',0};
144 static const WCHAR attrPageBreakAfter
[] =
145 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
146 static const WCHAR attrPageBreakBefore
[] =
147 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
148 static const WCHAR attrPosition
[] =
149 {'p','o','s','i','t','i','o','n',0};
150 static const WCHAR attrRight
[] =
151 {'r','i','g','h','t',0};
152 static const WCHAR attrTextAlign
[] =
153 {'t','e','x','t','-','a','l','i','g','n',0};
154 static const WCHAR attrTextDecoration
[] =
155 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
156 static const WCHAR attrTextIndent
[] =
157 {'t','e','x','t','-','i','n','d','e','n','t',0};
158 static const WCHAR attrTop
[] =
160 static const WCHAR attrVerticalAlign
[] =
161 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
162 static const WCHAR attrVisibility
[] =
163 {'v','i','s','i','b','i','l','i','t','y',0};
164 static const WCHAR attrWhiteSpace
[] =
165 {'w','h','i','t','e','-','s','p','a','c','e',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};
176 static const WCHAR pxW
[] = {'p','x',0};
183 static const style_tbl_entry_t style_tbl
[] = {
184 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
185 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
186 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
187 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
188 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
189 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
190 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
191 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
192 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
193 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
194 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
195 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
196 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
197 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
198 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
199 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
200 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
201 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
202 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
203 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
204 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
205 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
206 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
207 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
208 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
209 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
210 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
211 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
212 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
213 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
214 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
215 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
216 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
217 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
218 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
219 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
220 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
221 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
222 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
223 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
224 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
225 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
226 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
227 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
228 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
229 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
230 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
231 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
232 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
233 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
234 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
235 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
236 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
237 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
238 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
239 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
240 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
241 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
242 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
243 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
244 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
245 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
246 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
247 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
248 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
249 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
250 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
251 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
252 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
253 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
254 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
255 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
256 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
257 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
258 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
259 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
262 static const WCHAR valLineThrough
[] =
263 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
264 static const WCHAR valUnderline
[] =
265 {'u','n','d','e','r','l','i','n','e',0};
266 static const WCHAR szNormal
[] =
267 {'n','o','r','m','a','l',0};
268 static const WCHAR styleNone
[] =
270 static const WCHAR valOverline
[] =
271 {'o','v','e','r','l','i','n','e',0};
272 static const WCHAR valBlink
[] =
273 {'b','l','i','n','k',0};
275 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
276 static const WCHAR emptyW
[] = {0};
278 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
280 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
285 c
= strcmpW(style_tbl
[i
].name
, name
);
298 static LPWSTR
fix_px_value(LPCWSTR val
)
303 while(*ptr
&& isspaceW(*ptr
))
308 while(*ptr
&& isdigitW(*ptr
))
311 if(!*ptr
|| isspaceW(*ptr
)) {
313 int len
= strlenW(val
)+1;
315 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
316 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
322 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
327 while(*ptr
&& !isspaceW(*ptr
))
334 static LPWSTR
fix_url_value(LPCWSTR val
)
338 static const WCHAR urlW
[] = {'u','r','l','('};
340 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
343 ret
= heap_strdupW(val
);
345 for(ptr
= ret
; *ptr
; ptr
++) {
353 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
355 nsAString str_name
, str_value
, str_empty
;
360 if(flags
& ATTR_FIX_PX
)
361 val
= fix_px_value(value
);
362 if(flags
& ATTR_FIX_URL
)
363 val
= fix_url_value(value
);
366 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
367 nsAString_InitDepend(&str_value
, val
? val
: value
);
368 nsAString_InitDepend(&str_empty
, emptyW
);
370 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
372 ERR("SetProperty failed: %08x\n", nsres
);
374 nsAString_Finish(&str_name
);
375 nsAString_Finish(&str_value
);
376 nsAString_Finish(&str_empty
);
382 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
393 case VT_BSTR
|VT_BYREF
:
394 *ret
= *V_BSTRREF(v
);
398 static const WCHAR formatW
[] = {'%','d',0};
399 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
401 if(flags
& ATTR_HEX_INT
)
402 wsprintfW(buf
, hex_formatW
, V_I4(v
));
403 else if(flags
& ATTR_FIX_PX
)
404 wsprintfW(buf
, px_formatW
, V_I4(v
));
406 wsprintfW(buf
, formatW
, V_I4(v
));
412 FIXME("not implemented for %s\n", debugstr_variant(v
));
418 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
424 hres
= var_to_styleval(value
, buf
, flags
, &val
);
428 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
431 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
433 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
436 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
441 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
443 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
444 if(NS_FAILED(nsres
)) {
445 ERR("SetProperty failed: %08x\n", nsres
);
449 nsAString_Finish(&str_name
);
454 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
460 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
464 ret
= SysAllocString(val
);
466 return E_OUTOFMEMORY
;
468 len
= SysStringLen(ret
);
470 if(flags
& ATTR_REMOVE_COMMA
) {
474 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
480 new_ret
= SysAllocStringLen(NULL
, new_len
);
483 return E_OUTOFMEMORY
;
486 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
500 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
503 const PRUnichar
*value
;
506 nsAString_Init(&str_value
, NULL
);
508 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
510 nsAString_GetData(&str_value
, &value
);
511 hres
= nsstyle_to_bstr(value
, flags
, p
);
512 nsAString_Finish(&str_value
);
514 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
518 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
521 const PRUnichar
*value
;
525 nsAString_Init(&str_value
, NULL
);
527 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
529 nsAString_GetData(&str_value
, &value
);
531 if(flags
& ATTR_STR_TO_INT
) {
532 const PRUnichar
*ptr
= value
;
541 while(isdigitW(*ptr
))
542 i
= i
*10 + (*ptr
++ - '0');
546 V_I4(p
) = neg
? -i
: i
;
554 hres
= nsstyle_to_bstr(value
, flags
, &str
);
555 if(SUCCEEDED(hres
)) {
561 nsAString_Finish(&str_value
);
563 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
567 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
569 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
572 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
575 const PRUnichar
*value
;
577 nsAString_Init(&str_value
, NULL
);
579 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
581 nsAString_GetData(&str_value
, &value
);
582 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
583 nsAString_Finish(&str_value
);
585 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
589 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
592 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
594 value
= floor(value
);
596 sprintfW(szValue
, szFormat
, value
);
598 return set_style_attr(This
, sid
, szValue
, 0);
601 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
605 sprintfW(value_str
, px_formatW
, value
);
607 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
610 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
615 TRACE("%p %d %p\n", This
, sid
, p
);
619 nsAString_Init(&str_value
, NULL
);
621 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
625 const PRUnichar
*value
;
627 nsAString_GetData(&str_value
, &value
);
630 *p
= strtolW(value
, &ptr
, 10);
632 if(*ptr
&& strcmpW(ptr
, pxW
))
634 nsAString_Finish(&str_value
);
635 FIXME("only px values are currently supported\n");
641 TRACE("ret %f\n", *p
);
643 nsAString_Finish(&str_value
);
647 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
652 nsAString_Init(&str_value
, NULL
);
654 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
657 const PRUnichar
*value
;
659 nsAString_GetData(&str_value
, &value
);
661 *p
= strtolW(value
, &ptr
, 10);
664 /* Skip all digits. We have tests showing that we should not round the value. */
665 while(isdigitW(*++ptr
));
668 if(*ptr
&& strcmpW(ptr
, pxW
)) {
669 nsAString_Finish(&str_value
);
670 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
678 nsAString_Finish(&str_value
);
682 static BOOL
is_valid_border_style(BSTR v
)
684 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
685 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
686 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
687 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
688 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
689 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
690 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
691 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
693 TRACE("%s\n", debugstr_w(v
));
695 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
696 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
697 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
698 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
699 strcmpiW(v
, styleOutset
) == 0 )
707 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
709 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
712 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
714 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
718 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
719 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
720 *ppv
= &This
->IHTMLStyle_iface
;
721 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
722 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This
, ppv
);
723 *ppv
= &This
->IHTMLStyle_iface
;
724 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
725 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This
, ppv
);
726 *ppv
= &This
->IHTMLStyle2_iface
;
727 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
728 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This
, ppv
);
729 *ppv
= &This
->IHTMLStyle3_iface
;
730 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
731 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This
, ppv
);
732 *ppv
= &This
->IHTMLStyle4_iface
;
733 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
734 TRACE("(%p)->(IID_IHTMLStyle5 %p)\n", This
, ppv
);
735 *ppv
= &This
->IHTMLStyle5_iface
;
736 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
737 TRACE("(%p)->(IID_IHTMLStyle6 %p)\n", This
, ppv
);
738 *ppv
= &This
->IHTMLStyle6_iface
;
739 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
740 return *ppv
? S_OK
: E_NOINTERFACE
;
744 IUnknown_AddRef((IUnknown
*)*ppv
);
748 WARN("unsupported %s\n", debugstr_guid(riid
));
749 return E_NOINTERFACE
;
752 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
754 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
755 LONG ref
= InterlockedIncrement(&This
->ref
);
757 TRACE("(%p) ref=%d\n", This
, ref
);
762 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
764 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
765 LONG ref
= InterlockedDecrement(&This
->ref
);
767 TRACE("(%p) ref=%d\n", This
, ref
);
772 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
773 release_dispex(&This
->dispex
);
780 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
782 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
783 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
786 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
787 LCID lcid
, ITypeInfo
**ppTInfo
)
789 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
790 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
793 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
794 LPOLESTR
*rgszNames
, UINT cNames
,
795 LCID lcid
, DISPID
*rgDispId
)
797 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
798 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
802 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
803 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
804 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
806 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
807 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
808 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
811 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
813 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
815 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
817 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
820 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
822 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
824 TRACE("(%p)->(%p)\n", This
, p
);
826 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
829 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
831 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
832 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
833 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
835 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
837 /* fontStyle can only be one of the follow values. */
838 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
839 strcmpiW(szOblique
, v
) == 0)
841 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
847 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
849 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
851 TRACE("(%p)->(%p)\n", This
, p
);
853 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
856 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
859 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
861 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
863 /* fontVariant can only be one of the follow values. */
864 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
866 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
872 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
874 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
875 TRACE("(%p)->(%p)\n", This
, p
);
880 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
883 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
885 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
886 static const WCHAR styleBold
[] = {'b','o','l','d',0};
887 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
888 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
889 static const WCHAR style100
[] = {'1','0','0',0};
890 static const WCHAR style200
[] = {'2','0','0',0};
891 static const WCHAR style300
[] = {'3','0','0',0};
892 static const WCHAR style400
[] = {'4','0','0',0};
893 static const WCHAR style500
[] = {'5','0','0',0};
894 static const WCHAR style600
[] = {'6','0','0',0};
895 static const WCHAR style700
[] = {'7','0','0',0};
896 static const WCHAR style800
[] = {'8','0','0',0};
897 static const WCHAR style900
[] = {'9','0','0',0};
899 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
901 /* fontWeight can only be one of the following */
902 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
903 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
904 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
905 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
906 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
907 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
908 strcmpiW(style900
, v
) == 0
911 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
917 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
919 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
921 TRACE("(%p)->(%p)\n", This
, p
);
923 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
926 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
928 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
930 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
932 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
935 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
937 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
939 TRACE("(%p)->(%p)\n", This
, p
);
941 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
944 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
946 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
947 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
951 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
953 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
954 FIXME("(%p)->(%p)\n", This
, p
);
958 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
960 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
962 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
964 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
967 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
969 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
971 TRACE("(%p)->(%p)\n", This
, p
);
973 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
976 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
978 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
980 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
982 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
985 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
987 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
989 TRACE("(%p)->(%p)\n", This
, p
);
991 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
994 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
996 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
998 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1000 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1003 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1005 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1007 TRACE("(%p)->(%p)\n", This
, p
);
1009 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1012 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1014 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1016 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1018 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1021 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1023 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1025 TRACE("(%p)->(%p)\n", This
, p
);
1027 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1030 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1032 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1033 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1034 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1035 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1036 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1038 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1040 /* fontWeight can only be one of the following */
1041 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1042 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1044 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1047 return E_INVALIDARG
;
1050 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1052 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1054 TRACE("(%p)->(%p)\n", This
, p
);
1056 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1059 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1062 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1066 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1068 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1069 FIXME("(%p)->(%p)\n", This
, p
);
1073 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1075 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1077 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1079 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1082 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1084 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1086 TRACE("(%p)->(%p)\n", This
, p
);
1088 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1091 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1093 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1094 WCHAR buf
[14], *pos_val
;
1100 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1102 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1106 val_len
= val
? strlenW(val
) : 0;
1108 nsAString_Init(&pos_str
, NULL
);
1109 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1110 if(SUCCEEDED(hres
)) {
1111 const PRUnichar
*pos
, *posy
;
1114 nsAString_GetData(&pos_str
, &pos
);
1115 posy
= strchrW(pos
, ' ');
1117 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1119 TRACE("no space in %s\n", debugstr_w(pos
));
1123 posy_len
= strlenW(posy
);
1124 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1127 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1129 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1130 pos_val
[val_len
+posy_len
] = 0;
1132 hres
= E_OUTOFMEMORY
;
1135 nsAString_Finish(&pos_str
);
1139 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1140 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1145 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1147 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1152 TRACE("(%p)->(%p)\n", This
, p
);
1154 nsAString_Init(&pos_str
, NULL
);
1155 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1156 if(SUCCEEDED(hres
)) {
1157 const PRUnichar
*pos
, *space
;
1159 nsAString_GetData(&pos_str
, &pos
);
1160 space
= strchrW(pos
, ' ');
1162 WARN("no space in %s\n", debugstr_w(pos
));
1163 space
= pos
+ strlenW(pos
);
1167 ret
= SysAllocStringLen(pos
, space
-pos
);
1169 hres
= E_OUTOFMEMORY
;
1174 nsAString_Finish(&pos_str
);
1178 TRACE("returning %s\n", debugstr_w(ret
));
1184 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1186 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1187 WCHAR buf
[14], *pos_val
;
1193 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1195 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1199 val_len
= val
? strlenW(val
) : 0;
1201 nsAString_Init(&pos_str
, NULL
);
1202 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1203 if(SUCCEEDED(hres
)) {
1204 const PRUnichar
*pos
, *space
;
1207 nsAString_GetData(&pos_str
, &pos
);
1208 space
= strchrW(pos
, ' ');
1212 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1214 TRACE("no space in %s\n", debugstr_w(pos
));
1216 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1219 posx_len
= space
-pos
;
1221 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1223 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1225 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1226 pos_val
[posx_len
+val_len
] = 0;
1228 hres
= E_OUTOFMEMORY
;
1231 nsAString_Finish(&pos_str
);
1235 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1236 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1241 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1243 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1248 TRACE("(%p)->(%p)\n", This
, p
);
1250 nsAString_Init(&pos_str
, NULL
);
1251 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1252 if(SUCCEEDED(hres
)) {
1253 const PRUnichar
*pos
, *posy
;
1255 nsAString_GetData(&pos_str
, &pos
);
1256 posy
= strchrW(pos
, ' ');
1258 ret
= SysAllocString(posy
+1);
1260 hres
= E_OUTOFMEMORY
;
1265 nsAString_Finish(&pos_str
);
1269 TRACE("returning %s\n", debugstr_w(ret
));
1275 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1277 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1279 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1281 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1284 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1286 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1287 TRACE("(%p)->(%p)\n", This
, p
);
1288 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1291 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1293 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1295 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1297 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1300 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1302 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1303 TRACE("(%p)->(%p)\n", This
, p
);
1304 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1307 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1309 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1311 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1313 /* textDecoration can only be one of the following */
1314 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1315 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1316 strcmpiW(valBlink
, v
) == 0)
1318 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1321 return E_INVALIDARG
;
1324 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1326 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1328 TRACE("(%p)->(%p)\n", This
, p
);
1330 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1333 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1335 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1337 TRACE("(%p)->(%x)\n", This
, v
);
1339 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1342 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1344 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1346 TRACE("(%p)->(%p)\n", This
, p
);
1348 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1351 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1353 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1355 TRACE("(%p)->(%x)\n", This
, v
);
1357 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1360 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1362 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1364 TRACE("(%p)->(%p)\n", This
, p
);
1366 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1369 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1371 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1373 TRACE("(%p)->(%x)\n", This
, v
);
1375 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1378 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1380 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1382 TRACE("(%p)->(%p)\n", This
, p
);
1384 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1387 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1389 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1391 TRACE("(%p)->(%x)\n", This
, v
);
1393 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1396 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1398 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1400 TRACE("(%p)->(%p)\n", This
, p
);
1402 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1405 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1407 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1409 TRACE("(%p)->(%x)\n", This
, v
);
1411 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1414 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1416 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1418 TRACE("(%p)->(%p)\n", This
, p
);
1420 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1423 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1425 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1427 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1429 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1432 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1434 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1436 TRACE("(%p)->(%p)\n", This
, p
);
1438 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1441 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1443 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1444 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1448 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1450 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1451 FIXME("(%p)->(%p)\n", This
, p
);
1455 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1457 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1459 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1461 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1464 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1466 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1468 TRACE("(%p)->(%p)\n", This
, p
);
1470 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1473 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1475 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1476 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1480 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1482 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1483 FIXME("(%p)->(%p)\n", This
, p
);
1487 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1489 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1490 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1494 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1496 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1497 FIXME("(%p)->(%p)\n", This
, p
);
1501 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1503 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1505 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1507 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, ATTR_FIX_PX
);
1510 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1512 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1514 TRACE("(%p)->(%p)\n", This
, p
);
1516 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1519 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1521 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1523 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1525 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1528 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1530 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1531 TRACE("(%p)->(%p)\n", This
, p
);
1532 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1535 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1537 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1539 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1541 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1544 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1546 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1548 TRACE("(%p)->(%p)\n", This
, p
);
1550 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1553 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1555 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1557 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1559 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1562 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1564 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1566 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1568 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1571 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1573 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1575 TRACE("(%p)->(%p)\n", This
, p
);
1577 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1580 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1582 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1583 TRACE("(%p)->(%p)\n", This
, p
);
1584 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1587 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1589 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1591 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1593 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1596 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1598 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1600 TRACE("(%p)->(%p)\n", This
, p
);
1602 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1605 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1607 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1609 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1611 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1614 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1618 TRACE("(%p)->(%p)\n", This
, p
);
1620 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1623 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1625 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1627 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1629 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1632 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1634 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1636 TRACE("(%p)->(%p)\n", This
, p
);
1638 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1641 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1643 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1645 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1647 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1650 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1652 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1654 TRACE("(%p)->(%p)\n", This
, p
);
1656 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1659 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1661 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1663 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1665 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1668 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1670 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1672 TRACE("(%p)->(%p)\n", This
, p
);
1674 return get_style_attr(This
, STYLEID_PADDING
, p
);
1677 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1679 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1681 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1683 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1686 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1688 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1690 TRACE("(%p)->(%p)\n", This
, p
);
1692 return get_style_attr(This
, STYLEID_BORDER
, p
);
1695 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1697 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1698 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1699 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1702 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1704 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1705 TRACE("(%p)->(%p)\n", This
, p
);
1706 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1709 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1711 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1712 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1713 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1716 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1718 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1719 TRACE("(%p)->(%p)\n", This
, p
);
1720 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1723 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1725 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1726 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1727 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1730 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1732 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1733 TRACE("(%p)->(%p)\n", This
, p
);
1734 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1737 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1739 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1741 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1743 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1746 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1748 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1750 TRACE("(%p)->(%p)\n", This
, p
);
1752 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1755 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1757 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1759 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1761 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1764 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1766 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1768 TRACE("(%p)->(%p)\n", This
, p
);
1770 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1773 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1775 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1777 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1779 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1782 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1786 TRACE("(%p)->(%p)\n", This
, p
);
1788 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1791 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1793 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1795 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1797 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1800 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1802 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1804 TRACE("(%p)->(%p)\n", This
, p
);
1806 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1809 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1811 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1813 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1815 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1818 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1820 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1822 TRACE("(%p)->(%p)\n", This
, p
);
1824 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1827 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1829 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1831 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1833 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1836 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1838 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1840 TRACE("(%p)->(%p)\n", This
, p
);
1842 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1845 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1847 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1848 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1849 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1852 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1854 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1855 TRACE("(%p)->(%p)\n", This
, p
);
1856 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1859 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1861 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1863 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1865 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1868 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1870 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1872 TRACE("(%p)->(%p)\n", This
, p
);
1874 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1877 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1879 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1881 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1883 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1886 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1888 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1890 TRACE("(%p)->(%p)\n", This
, p
);
1892 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1895 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1897 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1899 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1901 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1904 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1906 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1907 TRACE("(%p)->(%p)\n", This
, p
);
1908 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1911 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1913 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1915 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1917 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1920 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1922 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1923 TRACE("(%p)->(%p)\n", This
, p
);
1924 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1927 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1929 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1930 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1931 HRESULT hres
= S_OK
;
1936 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1938 while(v
[i
] && hres
== S_OK
)
1940 if(v
[i
] == (WCHAR
)' ')
1942 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1943 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1945 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1946 hres
= E_INVALIDARG
;
1948 SysFreeString(pstyle
);
1956 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1957 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1959 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1960 hres
= E_INVALIDARG
;
1962 SysFreeString(pstyle
);
1966 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1971 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
1973 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1974 TRACE("(%p)->(%p)\n", This
, p
);
1975 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
1978 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
1980 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1981 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1983 if(!is_valid_border_style(v
))
1984 return E_INVALIDARG
;
1986 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
1989 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
1991 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1992 TRACE("(%p)->(%p)\n", This
, p
);
1993 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
1996 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
1998 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1999 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2001 if(!is_valid_border_style(v
))
2002 return E_INVALIDARG
;
2004 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2007 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2009 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2010 TRACE("(%p)->(%p)\n", This
, p
);
2011 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2014 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2016 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2017 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2019 if(!is_valid_border_style(v
))
2020 return E_INVALIDARG
;
2022 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2025 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2027 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2028 TRACE("(%p)->(%p)\n", This
, p
);
2029 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2032 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2034 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2035 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2037 if(!is_valid_border_style(v
))
2038 return E_INVALIDARG
;
2040 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2043 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2045 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2046 TRACE("(%p)->(%p)\n", This
, p
);
2047 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2050 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2052 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2054 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2056 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2059 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2063 TRACE("(%p)->(%p)\n", This
, p
);
2065 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2068 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2070 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2072 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2074 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2077 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2079 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2081 TRACE("(%p)->(%p)\n", This
, p
);
2083 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
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
);
2104 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2106 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2109 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2111 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2113 TRACE("(%p)->(%p)\n", This
, p
);
2115 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2118 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2120 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2122 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2124 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2127 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2129 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2131 TRACE("(%p)->(%p)\n", This
, p
);
2133 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2136 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2138 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2140 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2142 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2145 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2147 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2149 TRACE("(%p)->(%p)\n", This
, p
);
2151 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2154 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2156 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2158 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2160 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2163 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2165 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2167 TRACE("(%p)->(%p)\n", This
, p
);
2169 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2172 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2174 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2175 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2179 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2181 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2182 FIXME("(%p)->(%p)\n", This
, p
);
2186 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2188 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2189 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2193 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2195 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2196 FIXME("(%p)->(%p)\n", This
, p
);
2200 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2202 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2203 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2207 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2209 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2210 FIXME("(%p)->(%p)\n", This
, p
);
2214 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2216 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2218 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2220 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2223 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2225 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2227 TRACE("(%p)->(%p)\n", This
, p
);
2229 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2232 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2234 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2236 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2238 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2241 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2243 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2245 TRACE("(%p)->(%p)\n", This
, p
);
2247 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2250 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2252 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2254 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2256 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2259 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2261 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2263 TRACE("(%p)->(%p)\n", This
, p
);
2265 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2268 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2270 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2271 TRACE("(%p)->(%p)\n", This
, p
);
2272 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2275 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2277 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2279 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2281 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2284 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2286 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2288 TRACE("(%p)->(%p)\n", This
, p
);
2290 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2293 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2295 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2296 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2297 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2298 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2299 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2301 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2303 /* overflow can only be one of the follow values. */
2304 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2305 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2307 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2310 return E_INVALIDARG
;
2314 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2316 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2318 TRACE("(%p)->(%p)\n", This
, p
);
2321 return E_INVALIDARG
;
2323 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2326 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2328 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2330 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2332 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2335 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2337 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2339 TRACE("(%p)->(%p)\n", This
, p
);
2341 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2344 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2346 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2348 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2350 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2353 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2355 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2357 TRACE("(%p)->(%p)\n", This
, p
);
2359 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2362 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2364 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2368 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2370 nsAString_InitDepend(&text_str
, v
);
2371 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2372 nsAString_Finish(&text_str
);
2373 if(NS_FAILED(nsres
)) {
2374 FIXME("SetCssStyle failed: %08x\n", nsres
);
2381 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2383 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2387 TRACE("(%p)->(%p)\n", This
, p
);
2389 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2390 nsAString_Init(&text_str
, NULL
);
2391 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2392 if(NS_SUCCEEDED(nsres
)) {
2393 const PRUnichar
*text
;
2395 nsAString_GetData(&text_str
, &text
);
2396 *p
= *text
? SysAllocString(text
) : NULL
;
2398 FIXME("GetCssStyle failed: %08x\n", nsres
);
2402 nsAString_Finish(&text_str
);
2406 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2408 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2409 FIXME("(%p)->()\n", This
);
2413 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2415 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2416 FIXME("(%p)->()\n", This
);
2420 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2422 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2424 TRACE("(%p)->(%d)\n", This
, v
);
2426 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2429 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2431 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2433 TRACE("(%p)->(%p)\n", This
, p
);
2435 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2438 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2440 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2442 TRACE("(%p)->()\n", This
);
2444 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2447 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2449 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2450 FIXME("(%p)->()\n", This
);
2454 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2456 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2457 FIXME("(%p)->()\n", This
);
2461 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2463 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2464 FIXME("(%p)->()\n", This
);
2468 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2470 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2472 TRACE("(%p)->(%f)\n", This
, v
);
2474 return set_style_pos(This
, STYLEID_TOP
, v
);
2477 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2479 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2481 TRACE("(%p)->(%p)\n", This
, p
);
2486 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2489 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2491 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2493 TRACE("(%p)->(%f)\n", This
, v
);
2495 return set_style_pos(This
, STYLEID_LEFT
, v
);
2498 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2500 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2502 TRACE("(%p)->(%p)\n", This
, p
);
2507 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2510 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2512 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2514 TRACE("(%p)->(%f)\n", This
, v
);
2516 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2519 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2521 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2523 TRACE("(%p)->(%p)\n", This
, p
);
2528 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2534 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2536 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2538 TRACE("(%p)->(%f)\n", This
, v
);
2540 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2543 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2545 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2547 TRACE("(%p)->(%p)\n", This
, p
);
2552 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2558 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2560 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2562 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2564 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2567 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2569 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2571 TRACE("(%p)->(%p)\n", This
, p
);
2573 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2576 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2578 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2580 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2582 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2585 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2587 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2589 TRACE("(%p)->(%p)\n", This
, p
);
2591 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2594 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2596 nsAString name_str
, val_str
, empty_str
;
2599 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2601 TRACE("%s\n", debugstr_w(val
));
2603 nsAString_InitDepend(&name_str
, opacityW
);
2604 nsAString_InitDepend(&val_str
, val
);
2605 nsAString_InitDepend(&empty_str
, emptyW
);
2607 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2608 if(NS_FAILED(nsres
))
2609 ERR("SetProperty failed: %08x\n", nsres
);
2611 nsAString_Finish(&name_str
);
2612 nsAString_Finish(&val_str
);
2613 nsAString_Finish(&empty_str
);
2616 static void update_filter(HTMLStyle
*This
)
2618 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2620 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2623 set_opacity(This
, emptyW
);
2628 while(isspaceW(*ptr
))
2634 while(isalnumW(*ptr
))
2637 WARN("unexpected char '%c'\n", *ptr
);
2641 WARN("expected '('\n");
2645 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2646 static const WCHAR formatW
[] = {'%','f',0};
2647 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2651 while(isspaceW(*ptr
))
2655 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2658 WARN("unexpected end of string\n");
2662 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2663 float fval
= 0.0f
, e
= 0.1f
;
2666 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2668 while(isdigitW(*ptr2
))
2669 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2672 while(isdigitW(*++ptr2
)) {
2673 fval
+= e
* (float)(*ptr2
++ - '0');
2678 sprintfW(buf
, formatW
, fval
* 0.01f
);
2679 set_opacity(This
, buf
);
2681 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2686 }while(*ptr
!= ')');
2688 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2689 ptr
= strchrW(ptr
, ')');
2697 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2699 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2700 WCHAR
*new_filter
= NULL
;
2702 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2705 FIXME("Element already destroyed\n");
2706 return E_UNEXPECTED
;
2710 new_filter
= heap_strdupW(v
);
2712 return E_OUTOFMEMORY
;
2715 heap_free(This
->elem
->filter
);
2716 This
->elem
->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 FIXME("Element already destroyed\n");
2730 return E_UNEXPECTED
;
2733 if(This
->elem
->filter
) {
2734 *p
= SysAllocString(This
->elem
->filter
);
2736 return E_OUTOFMEMORY
;
2744 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2745 VARIANT AttributeValue
, LONG lFlags
)
2747 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2751 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2752 debugstr_variant(&AttributeValue
), lFlags
);
2754 if(!strAttributeName
)
2755 return E_INVALIDARG
;
2758 FIXME("Parameter lFlags ignored\n");
2760 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2761 LOCALE_USER_DEFAULT
, &dispid
);
2765 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2769 params
.rgvarg
= &AttributeValue
;
2770 params
.cNamedArgs
= 1;
2771 params
.rgdispidNamedArgs
= &dispidNamed
;
2773 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2774 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2778 FIXME("Custom attributes not supported.\n");
2781 TRACE("ret: %08x\n", hres
);
2786 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2787 LONG lFlags
, VARIANT
*AttributeValue
)
2789 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2793 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2794 AttributeValue
, lFlags
);
2796 if(!AttributeValue
|| !strAttributeName
)
2797 return E_INVALIDARG
;
2800 FIXME("Parameter lFlags ignored\n");
2802 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2803 LOCALE_USER_DEFAULT
, &dispid
);
2806 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2808 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2809 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2813 FIXME("Custom attributes not supported.\n");
2819 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2820 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2822 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2823 const style_tbl_entry_t
*style_entry
;
2824 nsAString name_str
, ret_str
;
2828 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2830 style_entry
= lookup_style_tbl(strAttributeName
);
2835 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2836 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2838 *pfSuccess
= VARIANT_FALSE
;
2842 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2843 if(dispid
== style_tbl
[i
].dispid
)
2847 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2848 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2849 style_entry
= style_tbl
+i
;
2852 /* filter property is a special case */
2853 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2854 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2855 heap_free(This
->elem
->filter
);
2856 This
->elem
->filter
= NULL
;
2857 update_filter(This
);
2861 nsAString_InitDepend(&name_str
, style_entry
->name
);
2862 nsAString_Init(&ret_str
, NULL
);
2863 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2864 if(NS_SUCCEEDED(nsres
)) {
2865 const PRUnichar
*ret
;
2866 nsAString_GetData(&ret_str
, &ret
);
2867 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2869 ERR("RemoveProperty failed: %08x\n", nsres
);
2871 nsAString_Finish(&name_str
);
2872 nsAString_Finish(&ret_str
);
2873 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2876 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2878 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2879 FIXME("(%p)->(%p)\n", This
, String
);
2883 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2884 HTMLStyle_QueryInterface
,
2887 HTMLStyle_GetTypeInfoCount
,
2888 HTMLStyle_GetTypeInfo
,
2889 HTMLStyle_GetIDsOfNames
,
2891 HTMLStyle_put_fontFamily
,
2892 HTMLStyle_get_fontFamily
,
2893 HTMLStyle_put_fontStyle
,
2894 HTMLStyle_get_fontStyle
,
2895 HTMLStyle_put_fontVariant
,
2896 HTMLStyle_get_fontVariant
,
2897 HTMLStyle_put_fontWeight
,
2898 HTMLStyle_get_fontWeight
,
2899 HTMLStyle_put_fontSize
,
2900 HTMLStyle_get_fontSize
,
2903 HTMLStyle_put_color
,
2904 HTMLStyle_get_color
,
2905 HTMLStyle_put_background
,
2906 HTMLStyle_get_background
,
2907 HTMLStyle_put_backgroundColor
,
2908 HTMLStyle_get_backgroundColor
,
2909 HTMLStyle_put_backgroundImage
,
2910 HTMLStyle_get_backgroundImage
,
2911 HTMLStyle_put_backgroundRepeat
,
2912 HTMLStyle_get_backgroundRepeat
,
2913 HTMLStyle_put_backgroundAttachment
,
2914 HTMLStyle_get_backgroundAttachment
,
2915 HTMLStyle_put_backgroundPosition
,
2916 HTMLStyle_get_backgroundPosition
,
2917 HTMLStyle_put_backgroundPositionX
,
2918 HTMLStyle_get_backgroundPositionX
,
2919 HTMLStyle_put_backgroundPositionY
,
2920 HTMLStyle_get_backgroundPositionY
,
2921 HTMLStyle_put_wordSpacing
,
2922 HTMLStyle_get_wordSpacing
,
2923 HTMLStyle_put_letterSpacing
,
2924 HTMLStyle_get_letterSpacing
,
2925 HTMLStyle_put_textDecoration
,
2926 HTMLStyle_get_textDecoration
,
2927 HTMLStyle_put_textDecorationNone
,
2928 HTMLStyle_get_textDecorationNone
,
2929 HTMLStyle_put_textDecorationUnderline
,
2930 HTMLStyle_get_textDecorationUnderline
,
2931 HTMLStyle_put_textDecorationOverline
,
2932 HTMLStyle_get_textDecorationOverline
,
2933 HTMLStyle_put_textDecorationLineThrough
,
2934 HTMLStyle_get_textDecorationLineThrough
,
2935 HTMLStyle_put_textDecorationBlink
,
2936 HTMLStyle_get_textDecorationBlink
,
2937 HTMLStyle_put_verticalAlign
,
2938 HTMLStyle_get_verticalAlign
,
2939 HTMLStyle_put_textTransform
,
2940 HTMLStyle_get_textTransform
,
2941 HTMLStyle_put_textAlign
,
2942 HTMLStyle_get_textAlign
,
2943 HTMLStyle_put_textIndent
,
2944 HTMLStyle_get_textIndent
,
2945 HTMLStyle_put_lineHeight
,
2946 HTMLStyle_get_lineHeight
,
2947 HTMLStyle_put_marginTop
,
2948 HTMLStyle_get_marginTop
,
2949 HTMLStyle_put_marginRight
,
2950 HTMLStyle_get_marginRight
,
2951 HTMLStyle_put_marginBottom
,
2952 HTMLStyle_get_marginBottom
,
2953 HTMLStyle_put_marginLeft
,
2954 HTMLStyle_get_marginLeft
,
2955 HTMLStyle_put_margin
,
2956 HTMLStyle_get_margin
,
2957 HTMLStyle_put_paddingTop
,
2958 HTMLStyle_get_paddingTop
,
2959 HTMLStyle_put_paddingRight
,
2960 HTMLStyle_get_paddingRight
,
2961 HTMLStyle_put_paddingBottom
,
2962 HTMLStyle_get_paddingBottom
,
2963 HTMLStyle_put_paddingLeft
,
2964 HTMLStyle_get_paddingLeft
,
2965 HTMLStyle_put_padding
,
2966 HTMLStyle_get_padding
,
2967 HTMLStyle_put_border
,
2968 HTMLStyle_get_border
,
2969 HTMLStyle_put_borderTop
,
2970 HTMLStyle_get_borderTop
,
2971 HTMLStyle_put_borderRight
,
2972 HTMLStyle_get_borderRight
,
2973 HTMLStyle_put_borderBottom
,
2974 HTMLStyle_get_borderBottom
,
2975 HTMLStyle_put_borderLeft
,
2976 HTMLStyle_get_borderLeft
,
2977 HTMLStyle_put_borderColor
,
2978 HTMLStyle_get_borderColor
,
2979 HTMLStyle_put_borderTopColor
,
2980 HTMLStyle_get_borderTopColor
,
2981 HTMLStyle_put_borderRightColor
,
2982 HTMLStyle_get_borderRightColor
,
2983 HTMLStyle_put_borderBottomColor
,
2984 HTMLStyle_get_borderBottomColor
,
2985 HTMLStyle_put_borderLeftColor
,
2986 HTMLStyle_get_borderLeftColor
,
2987 HTMLStyle_put_borderWidth
,
2988 HTMLStyle_get_borderWidth
,
2989 HTMLStyle_put_borderTopWidth
,
2990 HTMLStyle_get_borderTopWidth
,
2991 HTMLStyle_put_borderRightWidth
,
2992 HTMLStyle_get_borderRightWidth
,
2993 HTMLStyle_put_borderBottomWidth
,
2994 HTMLStyle_get_borderBottomWidth
,
2995 HTMLStyle_put_borderLeftWidth
,
2996 HTMLStyle_get_borderLeftWidth
,
2997 HTMLStyle_put_borderStyle
,
2998 HTMLStyle_get_borderStyle
,
2999 HTMLStyle_put_borderTopStyle
,
3000 HTMLStyle_get_borderTopStyle
,
3001 HTMLStyle_put_borderRightStyle
,
3002 HTMLStyle_get_borderRightStyle
,
3003 HTMLStyle_put_borderBottomStyle
,
3004 HTMLStyle_get_borderBottomStyle
,
3005 HTMLStyle_put_borderLeftStyle
,
3006 HTMLStyle_get_borderLeftStyle
,
3007 HTMLStyle_put_width
,
3008 HTMLStyle_get_width
,
3009 HTMLStyle_put_height
,
3010 HTMLStyle_get_height
,
3011 HTMLStyle_put_styleFloat
,
3012 HTMLStyle_get_styleFloat
,
3013 HTMLStyle_put_clear
,
3014 HTMLStyle_get_clear
,
3015 HTMLStyle_put_display
,
3016 HTMLStyle_get_display
,
3017 HTMLStyle_put_visibility
,
3018 HTMLStyle_get_visibility
,
3019 HTMLStyle_put_listStyleType
,
3020 HTMLStyle_get_listStyleType
,
3021 HTMLStyle_put_listStylePosition
,
3022 HTMLStyle_get_listStylePosition
,
3023 HTMLStyle_put_listStyleImage
,
3024 HTMLStyle_get_listStyleImage
,
3025 HTMLStyle_put_listStyle
,
3026 HTMLStyle_get_listStyle
,
3027 HTMLStyle_put_whiteSpace
,
3028 HTMLStyle_get_whiteSpace
,
3033 HTMLStyle_get_position
,
3034 HTMLStyle_put_zIndex
,
3035 HTMLStyle_get_zIndex
,
3036 HTMLStyle_put_overflow
,
3037 HTMLStyle_get_overflow
,
3038 HTMLStyle_put_pageBreakBefore
,
3039 HTMLStyle_get_pageBreakBefore
,
3040 HTMLStyle_put_pageBreakAfter
,
3041 HTMLStyle_get_pageBreakAfter
,
3042 HTMLStyle_put_cssText
,
3043 HTMLStyle_get_cssText
,
3044 HTMLStyle_put_pixelTop
,
3045 HTMLStyle_get_pixelTop
,
3046 HTMLStyle_put_pixelLeft
,
3047 HTMLStyle_get_pixelLeft
,
3048 HTMLStyle_put_pixelWidth
,
3049 HTMLStyle_get_pixelWidth
,
3050 HTMLStyle_put_pixelHeight
,
3051 HTMLStyle_get_pixelHeight
,
3052 HTMLStyle_put_posTop
,
3053 HTMLStyle_get_posTop
,
3054 HTMLStyle_put_posLeft
,
3055 HTMLStyle_get_posLeft
,
3056 HTMLStyle_put_posWidth
,
3057 HTMLStyle_get_posWidth
,
3058 HTMLStyle_put_posHeight
,
3059 HTMLStyle_get_posHeight
,
3060 HTMLStyle_put_cursor
,
3061 HTMLStyle_get_cursor
,
3064 HTMLStyle_put_filter
,
3065 HTMLStyle_get_filter
,
3066 HTMLStyle_setAttribute
,
3067 HTMLStyle_getAttribute
,
3068 HTMLStyle_removeAttribute
,
3072 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3074 const style_tbl_entry_t
*style_entry
;
3076 style_entry
= lookup_style_tbl(name
);
3078 *dispid
= style_entry
->dispid
;
3082 return DISP_E_UNKNOWNNAME
;
3085 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3087 HTMLStyle_get_dispid
,
3092 static const tid_t HTMLStyle_iface_tids
[] = {
3101 static dispex_static_data_t HTMLStyle_dispex
= {
3102 &HTMLStyle_dispex_vtbl
,
3105 HTMLStyle_iface_tids
3108 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3110 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3114 FIXME("NULL nselem\n");
3118 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3119 (void**)&nselemstyle
);
3120 assert(nsres
== NS_OK
);
3122 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3123 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3124 if(NS_FAILED(nsres
)) {
3125 ERR("GetStyle failed: %08x\n", nsres
);
3132 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3134 nsIDOMCSSStyleDeclaration
*nsstyle
;
3138 hres
= get_style_from_elem(elem
, &nsstyle
);
3142 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3144 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3145 return E_OUTOFMEMORY
;
3148 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3150 style
->nsstyle
= nsstyle
;
3152 HTMLStyle2_Init(style
);
3153 HTMLStyle3_Init(style
);
3155 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3157 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3163 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3165 nsIDOMCSSStyleDeclaration
*style
;
3168 hres
= get_style_from_elem(elem
, &style
);
3172 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3173 nsIDOMCSSStyleDeclaration_Release(style
);
3177 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3179 nsIDOMCSSStyleDeclaration
*style
;
3182 hres
= get_style_from_elem(elem
, &style
);
3186 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3187 nsIDOMCSSStyleDeclaration_Release(style
);