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
31 #include "mshtml_private.h"
32 #include "htmlstyle.h"
34 #include "wine/debug.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 attrBackgroundAttachment
[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','a','t','t','a','c','h','m','e','n','t',0};
42 static const WCHAR attrBackgroundColor
[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
44 static const WCHAR attrBackgroundImage
[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
46 static const WCHAR attrBackgroundPosition
[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
48 static const WCHAR attrBackgroundPositionX
[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
50 static const WCHAR attrBackgroundPositionY
[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
52 static const WCHAR attrBackgroundRepeat
[] =
53 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
54 static const WCHAR attrBorder
[] =
55 {'b','o','r','d','e','r',0};
56 static const WCHAR attrBorderBottom
[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
58 static const WCHAR attrBorderBottomColor
[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
60 static const WCHAR attrBorderBottomStyle
[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
62 static const WCHAR attrBorderBottomWidth
[] =
63 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
64 static const WCHAR attrBorderColor
[] =
65 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
66 static const WCHAR attrBorderLeft
[] =
67 {'b','o','r','d','e','r','-','l','e','f','t',0};
68 static const WCHAR attrBorderLeftColor
[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
70 static const WCHAR attrBorderLeftStyle
[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
72 static const WCHAR attrBorderLeftWidth
[] =
73 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
74 static const WCHAR attrBorderRight
[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
76 static const WCHAR attrBorderRightColor
[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
78 static const WCHAR attrBorderRightStyle
[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
80 static const WCHAR attrBorderRightWidth
[] =
81 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
82 static const WCHAR attrBorderTop
[] =
83 {'b','o','r','d','e','r','-','t','o','p',0};
84 static const WCHAR attrBorderTopColor
[] =
85 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
86 static const WCHAR attrBorderStyle
[] =
87 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopStyle
[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
90 static const WCHAR attrBorderTopWidth
[] =
91 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
92 static const WCHAR attrBorderWidth
[] =
93 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
94 static const WCHAR attrBottom
[] =
95 {'b','o','t','t','o','m',0};
96 /* FIXME: Use unprefixed version (requires Gecko changes). */
97 static const WCHAR attrBoxSizing
[] =
98 {'-','m','o','z','-','b','o','x','-','s','i','z','i','n','g',0};
99 static const WCHAR attrClear
[] =
100 {'c','l','e','a','r',0};
101 static const WCHAR attrClip
[] =
103 static const WCHAR attrColor
[] =
104 {'c','o','l','o','r',0};
105 static const WCHAR attrCursor
[] =
106 {'c','u','r','s','o','r',0};
107 static const WCHAR attrDirection
[] =
108 {'d','i','r','e','c','t','i','o','n',0};
109 static const WCHAR attrDisplay
[] =
110 {'d','i','s','p','l','a','y',0};
111 static const WCHAR attrFilter
[] =
112 {'f','i','l','e','t','e','r',0};
113 static const WCHAR attrFontFamily
[] =
114 {'f','o','n','t','-','f','a','m','i','l','y',0};
115 static const WCHAR attrFontSize
[] =
116 {'f','o','n','t','-','s','i','z','e',0};
117 static const WCHAR attrFontStyle
[] =
118 {'f','o','n','t','-','s','t','y','l','e',0};
119 static const WCHAR attrFontVariant
[] =
120 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
121 static const WCHAR attrFontWeight
[] =
122 {'f','o','n','t','-','w','e','i','g','h','t',0};
123 static const WCHAR attrHeight
[] =
124 {'h','e','i','g','h','t',0};
125 static const WCHAR attrLeft
[] =
127 static const WCHAR attrLetterSpacing
[] =
128 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
129 static const WCHAR attrLineHeight
[] =
130 {'l','i','n','e','-','h','e','i','g','h','t',0};
131 static const WCHAR attrListStyle
[] =
132 {'l','i','s','t','-','s','t','y','l','e',0};
133 static const WCHAR attrListStyleType
[] =
134 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
135 static const WCHAR attrListStylePosition
[] =
136 {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0};
137 static const WCHAR attrMargin
[] =
138 {'m','a','r','g','i','n',0};
139 static const WCHAR attrMarginBottom
[] =
140 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
141 static const WCHAR attrMarginLeft
[] =
142 {'m','a','r','g','i','n','-','l','e','f','t',0};
143 static const WCHAR attrMarginRight
[] =
144 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
145 static const WCHAR attrMarginTop
[] =
146 {'m','a','r','g','i','n','-','t','o','p',0};
147 static const WCHAR attrMaxHeight
[] =
148 {'m','a','x','-','h','e','i','g','h','t',0};
149 static const WCHAR attrMaxWidth
[] =
150 {'m','a','x','-','w','i','d','t','h',0};
151 static const WCHAR attrMinHeight
[] =
152 {'m','i','n','-','h','e','i','g','h','t',0};
153 static const WCHAR attrMinWidth
[] =
154 {'m','i','n','-','w','i','d','t','h',0};
155 static const WCHAR attrOutline
[] =
156 {'o','u','t','l','i','n','e',0};
157 static const WCHAR attrOverflow
[] =
158 {'o','v','e','r','f','l','o','w',0};
159 static const WCHAR attrOverflowX
[] =
160 {'o','v','e','r','f','l','o','w','-','x',0};
161 static const WCHAR attrOverflowY
[] =
162 {'o','v','e','r','f','l','o','w','-','y',0};
163 static const WCHAR attrPadding
[] =
164 {'p','a','d','d','i','n','g',0};
165 static const WCHAR attrPaddingBottom
[] =
166 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
167 static const WCHAR attrPaddingLeft
[] =
168 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
169 static const WCHAR attrPaddingRight
[] =
170 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
171 static const WCHAR attrPaddingTop
[] =
172 {'p','a','d','d','i','n','g','-','t','o','p',0};
173 static const WCHAR attrPageBreakAfter
[] =
174 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
175 static const WCHAR attrPageBreakBefore
[] =
176 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
177 static const WCHAR attrPosition
[] =
178 {'p','o','s','i','t','i','o','n',0};
179 static const WCHAR attrRight
[] =
180 {'r','i','g','h','t',0};
181 static const WCHAR attrTableLayout
[] =
182 {'t','a','b','l','e','-','l','a','y','o','u','t',0};
183 static const WCHAR attrTextAlign
[] =
184 {'t','e','x','t','-','a','l','i','g','n',0};
185 static const WCHAR attrTextDecoration
[] =
186 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
187 static const WCHAR attrTextIndent
[] =
188 {'t','e','x','t','-','i','n','d','e','n','t',0};
189 static const WCHAR attrTextTransform
[] =
190 {'t','e','x','t','-','t','r','a','n','s','f','o','r','m',0};
191 static const WCHAR attrTop
[] =
193 static const WCHAR attrVerticalAlign
[] =
194 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
195 static const WCHAR attrVisibility
[] =
196 {'v','i','s','i','b','i','l','i','t','y',0};
197 static const WCHAR attrWhiteSpace
[] =
198 {'w','h','i','t','e','-','s','p','a','c','e',0};
199 static const WCHAR attrWidth
[] =
200 {'w','i','d','t','h',0};
201 static const WCHAR attrWordSpacing
[] =
202 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
203 static const WCHAR attrWordWrap
[] =
204 {'w','o','r','d','-','w','r','a','p',0};
205 static const WCHAR attrZIndex
[] =
206 {'z','-','i','n','d','e','x',0};
209 static const WCHAR pxW
[] = {'p','x',0};
216 static const style_tbl_entry_t style_tbl
[] = {
217 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
218 {attrBackgroundAttachment
, DISPID_IHTMLSTYLE_BACKGROUNDATTACHMENT
},
219 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
220 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
221 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
222 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
223 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
224 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
225 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
226 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
227 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
228 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
229 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
230 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
231 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
232 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
233 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
234 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
235 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
236 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
237 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
238 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
239 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
240 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
241 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
242 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
243 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
244 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
245 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
246 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
247 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
248 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
249 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
250 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
251 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
252 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
253 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
254 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
255 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
256 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
257 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
258 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
259 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
260 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
261 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
262 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
263 {attrListStyle
, DISPID_IHTMLSTYLE_LISTSTYLE
},
264 {attrListStylePosition
, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION
},
265 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
266 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
267 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
268 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
269 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
270 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
271 {attrMaxHeight
, DISPID_IHTMLSTYLE5_MAXHEIGHT
},
272 {attrMaxWidth
, DISPID_IHTMLSTYLE5_MAXWIDTH
},
273 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
274 {attrMinWidth
, DISPID_IHTMLSTYLE5_MINWIDTH
},
275 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
276 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
277 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
278 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
279 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
280 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
281 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
282 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
283 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
284 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
285 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
286 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
287 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
288 {attrTableLayout
, DISPID_IHTMLSTYLE2_TABLELAYOUT
},
289 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
290 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
291 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
292 {attrTextTransform
, DISPID_IHTMLSTYLE_TEXTTRANSFORM
},
293 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
294 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
295 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
296 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
297 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
298 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
299 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
300 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
303 static const WCHAR valLineThrough
[] =
304 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
305 static const WCHAR valUnderline
[] =
306 {'u','n','d','e','r','l','i','n','e',0};
307 static const WCHAR szNormal
[] =
308 {'n','o','r','m','a','l',0};
309 static const WCHAR styleNone
[] =
311 static const WCHAR valOverline
[] =
312 {'o','v','e','r','l','i','n','e',0};
313 static const WCHAR valBlink
[] =
314 {'b','l','i','n','k',0};
316 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
317 static const WCHAR emptyW
[] = {0};
319 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
321 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
326 c
= strcmpW(style_tbl
[i
].name
, name
);
339 static LPWSTR
fix_px_value(LPCWSTR val
)
344 while(*ptr
&& isspaceW(*ptr
))
349 while(*ptr
&& isdigitW(*ptr
))
352 if(!*ptr
|| isspaceW(*ptr
)) {
354 int len
= strlenW(val
)+1;
356 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
357 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
363 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
368 while(*ptr
&& !isspaceW(*ptr
))
375 static LPWSTR
fix_url_value(LPCWSTR val
)
379 static const WCHAR urlW
[] = {'u','r','l','('};
381 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
384 ret
= heap_strdupW(val
);
386 for(ptr
= ret
; *ptr
; ptr
++) {
394 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
396 nsAString str_name
, str_value
, str_empty
;
401 if(flags
& ATTR_FIX_PX
)
402 val
= fix_px_value(value
);
403 if(flags
& ATTR_FIX_URL
)
404 val
= fix_url_value(value
);
407 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
408 nsAString_InitDepend(&str_value
, val
? val
: value
);
409 nsAString_InitDepend(&str_empty
, emptyW
);
411 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
413 ERR("SetProperty failed: %08x\n", nsres
);
415 nsAString_Finish(&str_name
);
416 nsAString_Finish(&str_value
);
417 nsAString_Finish(&str_empty
);
423 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
434 case VT_BSTR
|VT_BYREF
:
435 *ret
= *V_BSTRREF(v
);
439 static const WCHAR formatW
[] = {'%','d',0};
440 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
442 if(flags
& ATTR_HEX_INT
)
443 wsprintfW(buf
, hex_formatW
, V_I4(v
));
444 else if(flags
& ATTR_FIX_PX
)
445 wsprintfW(buf
, px_formatW
, V_I4(v
));
447 wsprintfW(buf
, formatW
, V_I4(v
));
453 FIXME("not implemented for %s\n", debugstr_variant(v
));
459 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
465 hres
= var_to_styleval(value
, buf
, flags
, &val
);
469 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
472 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
474 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
477 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
482 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
484 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
485 if(NS_FAILED(nsres
)) {
486 ERR("SetProperty failed: %08x\n", nsres
);
490 nsAString_Finish(&str_name
);
495 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
501 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
505 ret
= SysAllocString(val
);
507 return E_OUTOFMEMORY
;
509 len
= SysStringLen(ret
);
511 if(flags
& ATTR_REMOVE_COMMA
) {
515 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
521 new_ret
= SysAllocStringLen(NULL
, new_len
);
524 return E_OUTOFMEMORY
;
527 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
541 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
544 const PRUnichar
*value
;
547 nsAString_Init(&str_value
, NULL
);
549 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
551 nsAString_GetData(&str_value
, &value
);
552 hres
= nsstyle_to_bstr(value
, flags
, p
);
553 nsAString_Finish(&str_value
);
555 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
559 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
562 const PRUnichar
*value
;
566 nsAString_Init(&str_value
, NULL
);
568 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
570 nsAString_GetData(&str_value
, &value
);
572 if(flags
& ATTR_STR_TO_INT
) {
573 const PRUnichar
*ptr
= value
;
582 while(isdigitW(*ptr
))
583 i
= i
*10 + (*ptr
++ - '0');
587 V_I4(p
) = neg
? -i
: i
;
595 hres
= nsstyle_to_bstr(value
, flags
, &str
);
596 if(SUCCEEDED(hres
)) {
602 nsAString_Finish(&str_value
);
604 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
608 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
610 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
613 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
616 const PRUnichar
*value
;
618 nsAString_Init(&str_value
, NULL
);
620 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
622 nsAString_GetData(&str_value
, &value
);
623 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
624 nsAString_Finish(&str_value
);
626 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
630 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
633 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
635 value
= floor(value
);
637 sprintfW(szValue
, szFormat
, value
);
639 return set_style_attr(This
, sid
, szValue
, 0);
642 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
646 sprintfW(value_str
, px_formatW
, value
);
648 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
651 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
656 TRACE("%p %d %p\n", This
, sid
, p
);
660 nsAString_Init(&str_value
, NULL
);
662 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
666 const PRUnichar
*value
;
668 nsAString_GetData(&str_value
, &value
);
671 *p
= strtolW(value
, &ptr
, 10);
673 if(*ptr
&& strcmpW(ptr
, pxW
))
675 nsAString_Finish(&str_value
);
676 FIXME("only px values are currently supported\n");
682 TRACE("ret %f\n", *p
);
684 nsAString_Finish(&str_value
);
688 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
696 nsAString_Init(&str_value
, NULL
);
698 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
701 const PRUnichar
*value
;
703 nsAString_GetData(&str_value
, &value
);
705 *p
= strtolW(value
, &ptr
, 10);
708 /* Skip all digits. We have tests showing that we should not round the value. */
709 while(isdigitW(*++ptr
));
712 if(*ptr
&& strcmpW(ptr
, pxW
)) {
713 nsAString_Finish(&str_value
);
714 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
722 nsAString_Finish(&str_value
);
726 static BOOL
is_valid_border_style(BSTR v
)
728 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
729 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
730 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
731 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
732 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
733 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
734 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
735 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
737 TRACE("%s\n", debugstr_w(v
));
739 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
740 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
741 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
742 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
743 strcmpiW(v
, styleOutset
) == 0 )
751 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
753 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
756 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
758 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
760 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
762 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
763 *ppv
= &This
->IHTMLStyle_iface
;
764 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
765 *ppv
= &This
->IHTMLStyle_iface
;
766 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
767 *ppv
= &This
->IHTMLStyle2_iface
;
768 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
769 *ppv
= &This
->IHTMLStyle3_iface
;
770 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
771 *ppv
= &This
->IHTMLStyle4_iface
;
772 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
773 *ppv
= &This
->IHTMLStyle5_iface
;
774 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
775 *ppv
= &This
->IHTMLStyle6_iface
;
776 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
777 return *ppv
? S_OK
: E_NOINTERFACE
;
780 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
781 return E_NOINTERFACE
;
784 IUnknown_AddRef((IUnknown
*)*ppv
);
788 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
790 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
791 LONG ref
= InterlockedIncrement(&This
->ref
);
793 TRACE("(%p) ref=%d\n", This
, ref
);
798 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
800 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
801 LONG ref
= InterlockedDecrement(&This
->ref
);
803 TRACE("(%p) ref=%d\n", This
, ref
);
808 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
809 release_dispex(&This
->dispex
);
816 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
818 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
819 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
822 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
823 LCID lcid
, ITypeInfo
**ppTInfo
)
825 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
826 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
829 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
830 LPOLESTR
*rgszNames
, UINT cNames
,
831 LCID lcid
, DISPID
*rgDispId
)
833 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
834 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
838 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
839 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
840 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
842 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
843 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
844 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
847 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
849 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
851 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
853 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
856 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
860 TRACE("(%p)->(%p)\n", This
, p
);
862 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
865 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
867 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
868 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
869 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
871 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
873 /* fontStyle can only be one of the follow values. */
874 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
875 strcmpiW(szOblique
, v
) == 0)
877 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
883 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
885 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
887 TRACE("(%p)->(%p)\n", This
, p
);
889 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
892 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
894 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
895 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
897 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
899 /* fontVariant can only be one of the follow values. */
900 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
902 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
908 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
910 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
911 TRACE("(%p)->(%p)\n", This
, p
);
916 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
919 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
921 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
922 static const WCHAR styleBold
[] = {'b','o','l','d',0};
923 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
924 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
925 static const WCHAR style100
[] = {'1','0','0',0};
926 static const WCHAR style200
[] = {'2','0','0',0};
927 static const WCHAR style300
[] = {'3','0','0',0};
928 static const WCHAR style400
[] = {'4','0','0',0};
929 static const WCHAR style500
[] = {'5','0','0',0};
930 static const WCHAR style600
[] = {'6','0','0',0};
931 static const WCHAR style700
[] = {'7','0','0',0};
932 static const WCHAR style800
[] = {'8','0','0',0};
933 static const WCHAR style900
[] = {'9','0','0',0};
935 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
937 /* fontWeight can only be one of the following */
938 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
939 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
940 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
941 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
942 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
943 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
944 strcmpiW(style900
, v
) == 0
947 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
953 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
955 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
957 TRACE("(%p)->(%p)\n", This
, p
);
959 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
962 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
964 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
966 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
968 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
971 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
973 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
975 TRACE("(%p)->(%p)\n", This
, p
);
977 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
980 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
982 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
983 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
987 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
989 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
990 FIXME("(%p)->(%p)\n", This
, p
);
994 static HRESULT WINAPI
HTMLStyle_put_color(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_COLOR
, &v
, ATTR_HEX_INT
);
1003 static HRESULT WINAPI
HTMLStyle_get_color(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_COLOR
, p
, 0);
1012 static HRESULT WINAPI
HTMLStyle_put_background(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
, v
, 0);
1021 static HRESULT WINAPI
HTMLStyle_get_background(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
, p
);
1030 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1032 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1034 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1036 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1039 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1041 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1043 TRACE("(%p)->(%p)\n", This
, p
);
1045 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1048 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1050 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1052 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1054 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1057 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1059 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1061 TRACE("(%p)->(%p)\n", This
, p
);
1063 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1066 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1068 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1069 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1070 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1071 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1072 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1074 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1076 /* fontWeight can only be one of the following */
1077 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1078 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1080 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1083 return E_INVALIDARG
;
1086 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1088 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1090 TRACE("(%p)->(%p)\n", This
, p
);
1092 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1095 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1097 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1099 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1101 return set_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, v
, 0);
1104 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1106 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1108 TRACE("(%p)->(%p)\n", This
, p
);
1110 return get_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, p
);
1113 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1115 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1117 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1119 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1122 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1124 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1126 TRACE("(%p)->(%p)\n", This
, p
);
1128 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1131 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1133 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1134 WCHAR buf
[14], *pos_val
;
1140 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1142 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1146 val_len
= val
? strlenW(val
) : 0;
1148 nsAString_Init(&pos_str
, NULL
);
1149 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1150 if(SUCCEEDED(hres
)) {
1151 const PRUnichar
*pos
, *posy
;
1154 nsAString_GetData(&pos_str
, &pos
);
1155 posy
= strchrW(pos
, ' ');
1157 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1159 TRACE("no space in %s\n", debugstr_w(pos
));
1163 posy_len
= strlenW(posy
);
1164 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1167 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1169 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1170 pos_val
[val_len
+posy_len
] = 0;
1172 hres
= E_OUTOFMEMORY
;
1175 nsAString_Finish(&pos_str
);
1179 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1180 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1185 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1187 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1192 TRACE("(%p)->(%p)\n", This
, p
);
1194 nsAString_Init(&pos_str
, NULL
);
1195 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1196 if(SUCCEEDED(hres
)) {
1197 const PRUnichar
*pos
, *space
;
1199 nsAString_GetData(&pos_str
, &pos
);
1200 space
= strchrW(pos
, ' ');
1202 WARN("no space in %s\n", debugstr_w(pos
));
1203 space
= pos
+ strlenW(pos
);
1207 ret
= SysAllocStringLen(pos
, space
-pos
);
1209 hres
= E_OUTOFMEMORY
;
1214 nsAString_Finish(&pos_str
);
1218 TRACE("returning %s\n", debugstr_w(ret
));
1224 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1226 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1227 WCHAR buf
[14], *pos_val
;
1233 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1235 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1239 val_len
= val
? strlenW(val
) : 0;
1241 nsAString_Init(&pos_str
, NULL
);
1242 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1243 if(SUCCEEDED(hres
)) {
1244 const PRUnichar
*pos
, *space
;
1247 nsAString_GetData(&pos_str
, &pos
);
1248 space
= strchrW(pos
, ' ');
1252 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1254 TRACE("no space in %s\n", debugstr_w(pos
));
1256 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1259 posx_len
= space
-pos
;
1261 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1263 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1265 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1266 pos_val
[posx_len
+val_len
] = 0;
1268 hres
= E_OUTOFMEMORY
;
1271 nsAString_Finish(&pos_str
);
1275 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1276 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1281 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1283 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1288 TRACE("(%p)->(%p)\n", This
, p
);
1290 nsAString_Init(&pos_str
, NULL
);
1291 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1292 if(SUCCEEDED(hres
)) {
1293 const PRUnichar
*pos
, *posy
;
1295 nsAString_GetData(&pos_str
, &pos
);
1296 posy
= strchrW(pos
, ' ');
1298 ret
= SysAllocString(posy
+1);
1300 hres
= E_OUTOFMEMORY
;
1305 nsAString_Finish(&pos_str
);
1309 TRACE("returning %s\n", debugstr_w(ret
));
1315 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1317 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1319 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1321 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1324 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1326 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1327 TRACE("(%p)->(%p)\n", This
, p
);
1328 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1331 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1333 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1335 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1337 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1340 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1342 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1343 TRACE("(%p)->(%p)\n", This
, p
);
1344 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1347 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1349 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1351 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1353 /* textDecoration can only be one of the following */
1354 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1355 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1356 strcmpiW(valBlink
, v
) == 0)
1358 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1361 return E_INVALIDARG
;
1364 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1366 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1368 TRACE("(%p)->(%p)\n", This
, p
);
1370 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1373 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1375 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1377 TRACE("(%p)->(%x)\n", This
, v
);
1379 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1382 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1384 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1386 TRACE("(%p)->(%p)\n", This
, p
);
1388 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1391 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1393 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1395 TRACE("(%p)->(%x)\n", This
, v
);
1397 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1400 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1402 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1404 TRACE("(%p)->(%p)\n", This
, p
);
1406 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1409 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1411 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1413 TRACE("(%p)->(%x)\n", This
, v
);
1415 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1418 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1420 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1422 TRACE("(%p)->(%p)\n", This
, p
);
1424 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1427 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1429 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1431 TRACE("(%p)->(%x)\n", This
, v
);
1433 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1436 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1438 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1440 TRACE("(%p)->(%p)\n", This
, p
);
1442 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1445 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1447 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1449 TRACE("(%p)->(%x)\n", This
, v
);
1451 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1454 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1456 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1458 TRACE("(%p)->(%p)\n", This
, p
);
1460 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1463 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1465 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1467 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1469 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1472 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1474 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1476 TRACE("(%p)->(%p)\n", This
, p
);
1478 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1481 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1483 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1485 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1487 return set_style_attr(This
, STYLEID_TEXT_TRANSFORM
, v
, 0);
1490 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1492 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1494 TRACE("(%p)->(%p)\n", This
, p
);
1496 return get_style_attr(This
, STYLEID_TEXT_TRANSFORM
, p
);
1499 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1501 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1503 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1505 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1508 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1510 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1512 TRACE("(%p)->(%p)\n", This
, p
);
1514 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1517 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1519 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1521 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1523 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, &v
, ATTR_FIX_PX
);
1526 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1528 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1530 TRACE("(%p)->(%p)\n", This
, p
);
1532 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, p
, 0);
1535 static HRESULT WINAPI
HTMLStyle_put_lineHeight(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_LINE_HEIGHT
, &v
, 0);
1544 static HRESULT WINAPI
HTMLStyle_get_lineHeight(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_LINE_HEIGHT
, p
, 0);
1553 static HRESULT WINAPI
HTMLStyle_put_marginTop(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_TOP
, &v
, ATTR_FIX_PX
);
1562 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1564 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1566 TRACE("(%p)->(%p)\n", This
, p
);
1568 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1571 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1573 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1575 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1577 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1580 static HRESULT WINAPI
HTMLStyle_get_marginRight(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_RIGHT
, p
, 0);
1587 static HRESULT WINAPI
HTMLStyle_put_marginBottom(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_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1596 static HRESULT WINAPI
HTMLStyle_get_marginBottom(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_MARGIN_BOTTOM
, p
, 0);
1605 static HRESULT WINAPI
HTMLStyle_put_marginLeft(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_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1614 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1618 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1620 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1623 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1625 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1627 TRACE("(%p)->(%p)\n", This
, p
);
1629 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1632 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1634 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1635 TRACE("(%p)->(%p)\n", This
, p
);
1636 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1639 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1641 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1643 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1645 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1648 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1650 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1652 TRACE("(%p)->(%p)\n", This
, p
);
1654 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1657 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1659 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1661 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1663 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1666 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1668 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1670 TRACE("(%p)->(%p)\n", This
, p
);
1672 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1675 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1677 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1679 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1681 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1684 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1686 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1688 TRACE("(%p)->(%p)\n", This
, p
);
1690 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1693 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1695 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1697 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1699 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1702 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1704 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1706 TRACE("(%p)->(%p)\n", This
, p
);
1708 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1711 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1713 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1715 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1717 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1720 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1722 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1724 TRACE("(%p)->(%p)\n", This
, p
);
1726 return get_style_attr(This
, STYLEID_PADDING
, p
);
1729 static HRESULT WINAPI
HTMLStyle_put_border(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
, v
, 0);
1738 static HRESULT WINAPI
HTMLStyle_get_border(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
, p
);
1747 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1749 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1750 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1751 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1754 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1756 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1757 TRACE("(%p)->(%p)\n", This
, p
);
1758 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1761 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1763 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1764 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1765 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1768 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1770 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1771 TRACE("(%p)->(%p)\n", This
, p
);
1772 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1775 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1777 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1778 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1779 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1782 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1785 TRACE("(%p)->(%p)\n", This
, p
);
1786 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1789 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1791 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1793 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1795 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1798 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1800 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1802 TRACE("(%p)->(%p)\n", This
, p
);
1804 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1807 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1809 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1811 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1813 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1816 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1818 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1820 TRACE("(%p)->(%p)\n", This
, p
);
1822 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1825 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1827 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1829 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1831 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1834 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1836 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1838 TRACE("(%p)->(%p)\n", This
, p
);
1840 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1843 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1845 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1847 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1849 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1852 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1854 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1856 TRACE("(%p)->(%p)\n", This
, p
);
1858 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1861 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1863 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1865 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1867 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1870 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1872 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1874 TRACE("(%p)->(%p)\n", This
, p
);
1876 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1879 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1881 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1883 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1885 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1888 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1890 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1892 TRACE("(%p)->(%p)\n", This
, p
);
1894 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1897 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1899 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1900 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1901 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1904 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1906 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1907 TRACE("(%p)->(%p)\n", This
, p
);
1908 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1911 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(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_TOP_WIDTH
, &v
, 0);
1920 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1922 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1924 TRACE("(%p)->(%p)\n", This
, p
);
1926 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1929 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1931 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1933 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1935 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1938 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1940 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1942 TRACE("(%p)->(%p)\n", This
, p
);
1944 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1947 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1949 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1951 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1953 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1956 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1958 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1959 TRACE("(%p)->(%p)\n", This
, p
);
1960 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1963 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1965 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1967 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1969 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1972 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1974 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1975 TRACE("(%p)->(%p)\n", This
, p
);
1976 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1979 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1981 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1982 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1983 HRESULT hres
= S_OK
;
1988 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1990 while(v
[i
] && hres
== S_OK
)
1992 if(v
[i
] == (WCHAR
)' ')
1994 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1995 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1997 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1998 hres
= E_INVALIDARG
;
2000 SysFreeString(pstyle
);
2008 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
2009 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
2011 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
2012 hres
= E_INVALIDARG
;
2014 SysFreeString(pstyle
);
2018 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
2023 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
2025 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2026 TRACE("(%p)->(%p)\n", This
, p
);
2027 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
2030 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
2032 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2033 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2035 if(!is_valid_border_style(v
))
2036 return E_INVALIDARG
;
2038 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
2041 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
2043 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2044 TRACE("(%p)->(%p)\n", This
, p
);
2045 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
2048 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
2050 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2051 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2053 if(!is_valid_border_style(v
))
2054 return E_INVALIDARG
;
2056 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2059 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2062 TRACE("(%p)->(%p)\n", This
, p
);
2063 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2066 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2068 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2069 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2071 if(!is_valid_border_style(v
))
2072 return E_INVALIDARG
;
2074 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2077 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2079 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2080 TRACE("(%p)->(%p)\n", This
, p
);
2081 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2084 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2086 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2087 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2089 if(!is_valid_border_style(v
))
2090 return E_INVALIDARG
;
2092 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2095 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2097 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2098 TRACE("(%p)->(%p)\n", This
, p
);
2099 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2102 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2104 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2106 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2108 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2111 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2113 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2115 TRACE("(%p)->(%p)\n", This
, p
);
2117 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2120 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2122 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2124 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2126 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2129 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2131 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2133 TRACE("(%p)->(%p)\n", This
, p
);
2135 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2138 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2140 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2141 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2145 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2147 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2148 FIXME("(%p)->(%p)\n", This
, p
);
2152 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2154 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2156 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2158 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2161 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2163 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2165 TRACE("(%p)->(%p)\n", This
, p
);
2167 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2170 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2172 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2174 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2176 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2179 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2181 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2183 TRACE("(%p)->(%p)\n", This
, p
);
2185 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2188 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2190 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2192 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2194 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2197 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2199 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2201 TRACE("(%p)->(%p)\n", This
, p
);
2203 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2206 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2208 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2210 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2212 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2215 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2217 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2219 TRACE("(%p)->(%p)\n", This
, p
);
2221 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2224 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2226 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2228 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2230 return set_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, v
, 0);
2233 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2235 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2237 TRACE("(%p)->(%p)\n", This
, p
);
2239 return get_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, p
);
2242 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2244 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2245 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2249 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2251 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2252 FIXME("(%p)->(%p)\n", This
, p
);
2256 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2258 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2260 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2262 return set_style_attr(This
, STYLEID_LIST_STYLE
, v
, 0);
2265 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2267 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2269 TRACE("(%p)->(%p)\n", This
, p
);
2271 return get_style_attr(This
, STYLEID_LIST_STYLE
, p
);
2274 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2276 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2278 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2280 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2283 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2285 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2287 TRACE("(%p)->(%p)\n", This
, p
);
2289 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2292 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2294 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2296 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2298 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2301 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2303 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2305 TRACE("(%p)->(%p)\n", This
, p
);
2307 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2310 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2312 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2314 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2316 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2319 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2321 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2323 TRACE("(%p)->(%p)\n", This
, p
);
2325 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2328 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2330 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2331 TRACE("(%p)->(%p)\n", This
, p
);
2332 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2335 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2337 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2339 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2341 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2344 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2346 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2348 TRACE("(%p)->(%p)\n", This
, p
);
2350 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2353 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2355 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2356 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2357 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2358 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2359 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2361 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2363 /* overflow can only be one of the follow values. */
2364 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2365 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2367 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2370 return E_INVALIDARG
;
2374 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2376 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2378 TRACE("(%p)->(%p)\n", This
, p
);
2381 return E_INVALIDARG
;
2383 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2386 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2388 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2390 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2392 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2395 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2397 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2399 TRACE("(%p)->(%p)\n", This
, p
);
2401 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2404 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2406 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2408 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2410 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2413 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2415 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2417 TRACE("(%p)->(%p)\n", This
, p
);
2419 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2422 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2424 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2428 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2430 nsAString_InitDepend(&text_str
, v
);
2431 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2432 nsAString_Finish(&text_str
);
2433 if(NS_FAILED(nsres
)) {
2434 FIXME("SetCssStyle failed: %08x\n", nsres
);
2441 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2443 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2447 TRACE("(%p)->(%p)\n", This
, p
);
2449 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2450 nsAString_Init(&text_str
, NULL
);
2451 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2452 if(NS_SUCCEEDED(nsres
)) {
2453 const PRUnichar
*text
;
2455 nsAString_GetData(&text_str
, &text
);
2456 *p
= *text
? SysAllocString(text
) : NULL
;
2458 FIXME("GetCssStyle failed: %08x\n", nsres
);
2462 nsAString_Finish(&text_str
);
2466 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2468 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2470 TRACE("(%p)->(%d)\n", This
, v
);
2472 return set_style_pxattr(This
->nsstyle
, STYLEID_TOP
, v
);
2475 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2477 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2479 TRACE("(%p)->(%p)\n", This
, p
);
2481 return get_nsstyle_pixel_val(This
, STYLEID_TOP
, p
);
2484 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2486 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2488 TRACE("(%p)->(%d)\n", This
, v
);
2490 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2493 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2495 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2497 TRACE("(%p)->(%p)\n", This
, p
);
2499 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2502 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2504 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2506 TRACE("(%p)->()\n", This
);
2508 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2511 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2513 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2515 TRACE("(%p)->(%p)\n", This
, p
);
2517 return get_nsstyle_pixel_val(This
, STYLEID_WIDTH
, p
);
2520 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2522 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2524 TRACE("(%p)->(%d)\n", This
, v
);
2526 return set_style_pxattr(This
->nsstyle
, STYLEID_HEIGHT
, v
);
2529 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2531 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2533 TRACE("(%p)->(%p)\n", This
, p
);
2535 return get_nsstyle_pixel_val(This
, STYLEID_HEIGHT
, p
);
2538 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2540 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2542 TRACE("(%p)->(%f)\n", This
, v
);
2544 return set_style_pos(This
, STYLEID_TOP
, v
);
2547 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2549 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2551 TRACE("(%p)->(%p)\n", This
, p
);
2556 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2559 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2561 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2563 TRACE("(%p)->(%f)\n", This
, v
);
2565 return set_style_pos(This
, STYLEID_LEFT
, v
);
2568 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2570 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2572 TRACE("(%p)->(%p)\n", This
, p
);
2577 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2580 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2582 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2584 TRACE("(%p)->(%f)\n", This
, v
);
2586 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2589 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2591 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2593 TRACE("(%p)->(%p)\n", This
, p
);
2598 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2604 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2606 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2608 TRACE("(%p)->(%f)\n", This
, v
);
2610 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2613 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2615 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2617 TRACE("(%p)->(%p)\n", This
, p
);
2622 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2628 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2630 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2632 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2634 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2637 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2639 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2641 TRACE("(%p)->(%p)\n", This
, p
);
2643 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2646 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2648 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2650 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2652 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2655 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2657 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2659 TRACE("(%p)->(%p)\n", This
, p
);
2661 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2664 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2666 nsAString name_str
, val_str
, empty_str
;
2669 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2671 TRACE("%s\n", debugstr_w(val
));
2673 nsAString_InitDepend(&name_str
, opacityW
);
2674 nsAString_InitDepend(&val_str
, val
);
2675 nsAString_InitDepend(&empty_str
, emptyW
);
2677 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2678 if(NS_FAILED(nsres
))
2679 ERR("SetProperty failed: %08x\n", nsres
);
2681 nsAString_Finish(&name_str
);
2682 nsAString_Finish(&val_str
);
2683 nsAString_Finish(&empty_str
);
2686 static void update_filter(HTMLStyle
*This
)
2688 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2690 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2693 set_opacity(This
, emptyW
);
2698 while(isspaceW(*ptr
))
2704 while(isalnumW(*ptr
))
2707 WARN("unexpected char '%c'\n", *ptr
);
2711 WARN("expected '('\n");
2715 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2716 static const WCHAR formatW
[] = {'%','f',0};
2717 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2721 while(isspaceW(*ptr
))
2725 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2728 WARN("unexpected end of string\n");
2732 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2733 float fval
= 0.0f
, e
= 0.1f
;
2736 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2738 while(isdigitW(*ptr2
))
2739 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2742 while(isdigitW(*++ptr2
)) {
2743 fval
+= e
* (float)(*ptr2
++ - '0');
2748 sprintfW(buf
, formatW
, fval
* 0.01f
);
2749 set_opacity(This
, buf
);
2751 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2756 }while(*ptr
!= ')');
2758 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2759 ptr
= strchrW(ptr
, ')');
2767 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2769 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2770 WCHAR
*new_filter
= NULL
;
2772 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2775 FIXME("Element already destroyed\n");
2776 return E_UNEXPECTED
;
2780 new_filter
= heap_strdupW(v
);
2782 return E_OUTOFMEMORY
;
2785 heap_free(This
->elem
->filter
);
2786 This
->elem
->filter
= new_filter
;
2788 update_filter(This
);
2792 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2794 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2796 TRACE("(%p)->(%p)\n", This
, p
);
2799 FIXME("Element already destroyed\n");
2800 return E_UNEXPECTED
;
2803 if(This
->elem
->filter
) {
2804 *p
= SysAllocString(This
->elem
->filter
);
2806 return E_OUTOFMEMORY
;
2814 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2815 VARIANT AttributeValue
, LONG lFlags
)
2817 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2821 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2822 debugstr_variant(&AttributeValue
), lFlags
);
2824 if(!strAttributeName
)
2825 return E_INVALIDARG
;
2828 FIXME("Parameter lFlags ignored\n");
2830 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2831 LOCALE_USER_DEFAULT
, &dispid
);
2835 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2839 params
.rgvarg
= &AttributeValue
;
2840 params
.cNamedArgs
= 1;
2841 params
.rgdispidNamedArgs
= &dispidNamed
;
2843 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2844 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2848 FIXME("Custom attributes not supported.\n");
2851 TRACE("ret: %08x\n", hres
);
2856 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2857 LONG lFlags
, VARIANT
*AttributeValue
)
2859 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2863 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2864 AttributeValue
, lFlags
);
2866 if(!AttributeValue
|| !strAttributeName
)
2867 return E_INVALIDARG
;
2870 FIXME("Parameter lFlags ignored\n");
2872 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2873 LOCALE_USER_DEFAULT
, &dispid
);
2876 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2878 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2879 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2883 FIXME("Custom attributes not supported.\n");
2889 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2890 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2892 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2893 const style_tbl_entry_t
*style_entry
;
2894 nsAString name_str
, ret_str
;
2898 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2900 style_entry
= lookup_style_tbl(strAttributeName
);
2905 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2906 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2908 *pfSuccess
= VARIANT_FALSE
;
2912 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2913 if(dispid
== style_tbl
[i
].dispid
)
2917 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2918 return remove_attribute(&This
->dispex
, dispid
, pfSuccess
);
2919 style_entry
= style_tbl
+i
;
2922 /* filter property is a special case */
2923 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2924 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2925 heap_free(This
->elem
->filter
);
2926 This
->elem
->filter
= NULL
;
2927 update_filter(This
);
2931 nsAString_InitDepend(&name_str
, style_entry
->name
);
2932 nsAString_Init(&ret_str
, NULL
);
2933 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2934 if(NS_SUCCEEDED(nsres
)) {
2935 const PRUnichar
*ret
;
2936 nsAString_GetData(&ret_str
, &ret
);
2937 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2939 ERR("RemoveProperty failed: %08x\n", nsres
);
2941 nsAString_Finish(&name_str
);
2942 nsAString_Finish(&ret_str
);
2943 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2946 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2948 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2949 FIXME("(%p)->(%p)\n", This
, String
);
2953 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2954 HTMLStyle_QueryInterface
,
2957 HTMLStyle_GetTypeInfoCount
,
2958 HTMLStyle_GetTypeInfo
,
2959 HTMLStyle_GetIDsOfNames
,
2961 HTMLStyle_put_fontFamily
,
2962 HTMLStyle_get_fontFamily
,
2963 HTMLStyle_put_fontStyle
,
2964 HTMLStyle_get_fontStyle
,
2965 HTMLStyle_put_fontVariant
,
2966 HTMLStyle_get_fontVariant
,
2967 HTMLStyle_put_fontWeight
,
2968 HTMLStyle_get_fontWeight
,
2969 HTMLStyle_put_fontSize
,
2970 HTMLStyle_get_fontSize
,
2973 HTMLStyle_put_color
,
2974 HTMLStyle_get_color
,
2975 HTMLStyle_put_background
,
2976 HTMLStyle_get_background
,
2977 HTMLStyle_put_backgroundColor
,
2978 HTMLStyle_get_backgroundColor
,
2979 HTMLStyle_put_backgroundImage
,
2980 HTMLStyle_get_backgroundImage
,
2981 HTMLStyle_put_backgroundRepeat
,
2982 HTMLStyle_get_backgroundRepeat
,
2983 HTMLStyle_put_backgroundAttachment
,
2984 HTMLStyle_get_backgroundAttachment
,
2985 HTMLStyle_put_backgroundPosition
,
2986 HTMLStyle_get_backgroundPosition
,
2987 HTMLStyle_put_backgroundPositionX
,
2988 HTMLStyle_get_backgroundPositionX
,
2989 HTMLStyle_put_backgroundPositionY
,
2990 HTMLStyle_get_backgroundPositionY
,
2991 HTMLStyle_put_wordSpacing
,
2992 HTMLStyle_get_wordSpacing
,
2993 HTMLStyle_put_letterSpacing
,
2994 HTMLStyle_get_letterSpacing
,
2995 HTMLStyle_put_textDecoration
,
2996 HTMLStyle_get_textDecoration
,
2997 HTMLStyle_put_textDecorationNone
,
2998 HTMLStyle_get_textDecorationNone
,
2999 HTMLStyle_put_textDecorationUnderline
,
3000 HTMLStyle_get_textDecorationUnderline
,
3001 HTMLStyle_put_textDecorationOverline
,
3002 HTMLStyle_get_textDecorationOverline
,
3003 HTMLStyle_put_textDecorationLineThrough
,
3004 HTMLStyle_get_textDecorationLineThrough
,
3005 HTMLStyle_put_textDecorationBlink
,
3006 HTMLStyle_get_textDecorationBlink
,
3007 HTMLStyle_put_verticalAlign
,
3008 HTMLStyle_get_verticalAlign
,
3009 HTMLStyle_put_textTransform
,
3010 HTMLStyle_get_textTransform
,
3011 HTMLStyle_put_textAlign
,
3012 HTMLStyle_get_textAlign
,
3013 HTMLStyle_put_textIndent
,
3014 HTMLStyle_get_textIndent
,
3015 HTMLStyle_put_lineHeight
,
3016 HTMLStyle_get_lineHeight
,
3017 HTMLStyle_put_marginTop
,
3018 HTMLStyle_get_marginTop
,
3019 HTMLStyle_put_marginRight
,
3020 HTMLStyle_get_marginRight
,
3021 HTMLStyle_put_marginBottom
,
3022 HTMLStyle_get_marginBottom
,
3023 HTMLStyle_put_marginLeft
,
3024 HTMLStyle_get_marginLeft
,
3025 HTMLStyle_put_margin
,
3026 HTMLStyle_get_margin
,
3027 HTMLStyle_put_paddingTop
,
3028 HTMLStyle_get_paddingTop
,
3029 HTMLStyle_put_paddingRight
,
3030 HTMLStyle_get_paddingRight
,
3031 HTMLStyle_put_paddingBottom
,
3032 HTMLStyle_get_paddingBottom
,
3033 HTMLStyle_put_paddingLeft
,
3034 HTMLStyle_get_paddingLeft
,
3035 HTMLStyle_put_padding
,
3036 HTMLStyle_get_padding
,
3037 HTMLStyle_put_border
,
3038 HTMLStyle_get_border
,
3039 HTMLStyle_put_borderTop
,
3040 HTMLStyle_get_borderTop
,
3041 HTMLStyle_put_borderRight
,
3042 HTMLStyle_get_borderRight
,
3043 HTMLStyle_put_borderBottom
,
3044 HTMLStyle_get_borderBottom
,
3045 HTMLStyle_put_borderLeft
,
3046 HTMLStyle_get_borderLeft
,
3047 HTMLStyle_put_borderColor
,
3048 HTMLStyle_get_borderColor
,
3049 HTMLStyle_put_borderTopColor
,
3050 HTMLStyle_get_borderTopColor
,
3051 HTMLStyle_put_borderRightColor
,
3052 HTMLStyle_get_borderRightColor
,
3053 HTMLStyle_put_borderBottomColor
,
3054 HTMLStyle_get_borderBottomColor
,
3055 HTMLStyle_put_borderLeftColor
,
3056 HTMLStyle_get_borderLeftColor
,
3057 HTMLStyle_put_borderWidth
,
3058 HTMLStyle_get_borderWidth
,
3059 HTMLStyle_put_borderTopWidth
,
3060 HTMLStyle_get_borderTopWidth
,
3061 HTMLStyle_put_borderRightWidth
,
3062 HTMLStyle_get_borderRightWidth
,
3063 HTMLStyle_put_borderBottomWidth
,
3064 HTMLStyle_get_borderBottomWidth
,
3065 HTMLStyle_put_borderLeftWidth
,
3066 HTMLStyle_get_borderLeftWidth
,
3067 HTMLStyle_put_borderStyle
,
3068 HTMLStyle_get_borderStyle
,
3069 HTMLStyle_put_borderTopStyle
,
3070 HTMLStyle_get_borderTopStyle
,
3071 HTMLStyle_put_borderRightStyle
,
3072 HTMLStyle_get_borderRightStyle
,
3073 HTMLStyle_put_borderBottomStyle
,
3074 HTMLStyle_get_borderBottomStyle
,
3075 HTMLStyle_put_borderLeftStyle
,
3076 HTMLStyle_get_borderLeftStyle
,
3077 HTMLStyle_put_width
,
3078 HTMLStyle_get_width
,
3079 HTMLStyle_put_height
,
3080 HTMLStyle_get_height
,
3081 HTMLStyle_put_styleFloat
,
3082 HTMLStyle_get_styleFloat
,
3083 HTMLStyle_put_clear
,
3084 HTMLStyle_get_clear
,
3085 HTMLStyle_put_display
,
3086 HTMLStyle_get_display
,
3087 HTMLStyle_put_visibility
,
3088 HTMLStyle_get_visibility
,
3089 HTMLStyle_put_listStyleType
,
3090 HTMLStyle_get_listStyleType
,
3091 HTMLStyle_put_listStylePosition
,
3092 HTMLStyle_get_listStylePosition
,
3093 HTMLStyle_put_listStyleImage
,
3094 HTMLStyle_get_listStyleImage
,
3095 HTMLStyle_put_listStyle
,
3096 HTMLStyle_get_listStyle
,
3097 HTMLStyle_put_whiteSpace
,
3098 HTMLStyle_get_whiteSpace
,
3103 HTMLStyle_get_position
,
3104 HTMLStyle_put_zIndex
,
3105 HTMLStyle_get_zIndex
,
3106 HTMLStyle_put_overflow
,
3107 HTMLStyle_get_overflow
,
3108 HTMLStyle_put_pageBreakBefore
,
3109 HTMLStyle_get_pageBreakBefore
,
3110 HTMLStyle_put_pageBreakAfter
,
3111 HTMLStyle_get_pageBreakAfter
,
3112 HTMLStyle_put_cssText
,
3113 HTMLStyle_get_cssText
,
3114 HTMLStyle_put_pixelTop
,
3115 HTMLStyle_get_pixelTop
,
3116 HTMLStyle_put_pixelLeft
,
3117 HTMLStyle_get_pixelLeft
,
3118 HTMLStyle_put_pixelWidth
,
3119 HTMLStyle_get_pixelWidth
,
3120 HTMLStyle_put_pixelHeight
,
3121 HTMLStyle_get_pixelHeight
,
3122 HTMLStyle_put_posTop
,
3123 HTMLStyle_get_posTop
,
3124 HTMLStyle_put_posLeft
,
3125 HTMLStyle_get_posLeft
,
3126 HTMLStyle_put_posWidth
,
3127 HTMLStyle_get_posWidth
,
3128 HTMLStyle_put_posHeight
,
3129 HTMLStyle_get_posHeight
,
3130 HTMLStyle_put_cursor
,
3131 HTMLStyle_get_cursor
,
3134 HTMLStyle_put_filter
,
3135 HTMLStyle_get_filter
,
3136 HTMLStyle_setAttribute
,
3137 HTMLStyle_getAttribute
,
3138 HTMLStyle_removeAttribute
,
3142 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3144 const style_tbl_entry_t
*style_entry
;
3146 style_entry
= lookup_style_tbl(name
);
3148 *dispid
= style_entry
->dispid
;
3152 return DISP_E_UNKNOWNNAME
;
3155 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3157 HTMLStyle_get_dispid
,
3162 static const tid_t HTMLStyle_iface_tids
[] = {
3171 static dispex_static_data_t HTMLStyle_dispex
= {
3172 &HTMLStyle_dispex_vtbl
,
3175 HTMLStyle_iface_tids
3178 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3180 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3184 FIXME("NULL nselem\n");
3188 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3189 (void**)&nselemstyle
);
3190 assert(nsres
== NS_OK
);
3192 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3193 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3194 if(NS_FAILED(nsres
)) {
3195 ERR("GetStyle failed: %08x\n", nsres
);
3202 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3204 nsIDOMCSSStyleDeclaration
*nsstyle
;
3208 hres
= get_style_from_elem(elem
, &nsstyle
);
3212 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3214 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3215 return E_OUTOFMEMORY
;
3218 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3220 style
->nsstyle
= nsstyle
;
3222 HTMLStyle2_Init(style
);
3223 HTMLStyle3_Init(style
);
3225 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3227 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3233 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3235 nsIDOMCSSStyleDeclaration
*style
;
3238 hres
= get_style_from_elem(elem
, &style
);
3242 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3243 nsIDOMCSSStyleDeclaration_Release(style
);
3247 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3249 nsIDOMCSSStyleDeclaration
*style
;
3252 hres
= get_style_from_elem(elem
, &style
);
3256 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3257 nsIDOMCSSStyleDeclaration_Release(style
);