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 attrBackgroundAttachment
[] =
24 {'b','a','c','k','g','r','o','u','n','d','-','a','t','t','a','c','h','m','e','n','t',0};
25 static const WCHAR attrBackgroundColor
[] =
26 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
27 static const WCHAR attrBackgroundImage
[] =
28 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
29 static const WCHAR attrBackgroundPosition
[] =
30 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
31 static const WCHAR attrBackgroundPositionX
[] =
32 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
33 static const WCHAR attrBackgroundPositionY
[] =
34 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
35 static const WCHAR attrBackgroundRepeat
[] =
36 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
37 static const WCHAR attrBorder
[] =
38 {'b','o','r','d','e','r',0};
39 static const WCHAR attrBorderBottom
[] =
40 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
41 static const WCHAR attrBorderBottomColor
[] =
42 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
43 static const WCHAR attrBorderBottomStyle
[] =
44 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
45 static const WCHAR attrBorderBottomWidth
[] =
46 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
47 static const WCHAR attrBorderColor
[] =
48 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
49 static const WCHAR attrBorderLeft
[] =
50 {'b','o','r','d','e','r','-','l','e','f','t',0};
51 static const WCHAR attrBorderLeftColor
[] =
52 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
53 static const WCHAR attrBorderLeftStyle
[] =
54 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
55 static const WCHAR attrBorderLeftWidth
[] =
56 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
57 static const WCHAR attrBorderRight
[] =
58 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
59 static const WCHAR attrBorderRightColor
[] =
60 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
61 static const WCHAR attrBorderRightStyle
[] =
62 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
63 static const WCHAR attrBorderRightWidth
[] =
64 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
65 static const WCHAR attrBorderTop
[] =
66 {'b','o','r','d','e','r','-','t','o','p',0};
67 static const WCHAR attrBorderTopColor
[] =
68 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
69 static const WCHAR attrBorderStyle
[] =
70 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
71 static const WCHAR attrBorderTopStyle
[] =
72 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
73 static const WCHAR attrBorderTopWidth
[] =
74 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
75 static const WCHAR attrBorderWidth
[] =
76 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
77 static const WCHAR attrBottom
[] =
78 {'b','o','t','t','o','m',0};
79 /* FIXME: Use unprefixed version (requires Gecko changes). */
80 static const WCHAR attrBoxSizing
[] =
81 {'-','m','o','z','-','b','o','x','-','s','i','z','i','n','g',0};
82 static const WCHAR attrClear
[] =
83 {'c','l','e','a','r',0};
84 static const WCHAR attrClip
[] =
86 static const WCHAR attrColor
[] =
87 {'c','o','l','o','r',0};
88 static const WCHAR attrCursor
[] =
89 {'c','u','r','s','o','r',0};
90 static const WCHAR attrDirection
[] =
91 {'d','i','r','e','c','t','i','o','n',0};
92 static const WCHAR attrDisplay
[] =
93 {'d','i','s','p','l','a','y',0};
94 static const WCHAR attrFilter
[] =
95 {'f','i','l','e','t','e','r',0};
96 static const WCHAR attrFloat
[] =
97 {'f','l','o','a','t',0};
98 static const WCHAR attrFontFamily
[] =
99 {'f','o','n','t','-','f','a','m','i','l','y',0};
100 static const WCHAR attrFontSize
[] =
101 {'f','o','n','t','-','s','i','z','e',0};
102 static const WCHAR attrFontStyle
[] =
103 {'f','o','n','t','-','s','t','y','l','e',0};
104 static const WCHAR attrFontVariant
[] =
105 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
106 static const WCHAR attrFontWeight
[] =
107 {'f','o','n','t','-','w','e','i','g','h','t',0};
108 static const WCHAR attrHeight
[] =
109 {'h','e','i','g','h','t',0};
110 static const WCHAR attrLeft
[] =
112 static const WCHAR attrLetterSpacing
[] =
113 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
114 static const WCHAR attrLineHeight
[] =
115 {'l','i','n','e','-','h','e','i','g','h','t',0};
116 static const WCHAR attrListStyle
[] =
117 {'l','i','s','t','-','s','t','y','l','e',0};
118 static const WCHAR attrListStyleType
[] =
119 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
120 static const WCHAR attrListStylePosition
[] =
121 {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0};
122 static const WCHAR attrMargin
[] =
123 {'m','a','r','g','i','n',0};
124 static const WCHAR attrMarginBottom
[] =
125 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
126 static const WCHAR attrMarginLeft
[] =
127 {'m','a','r','g','i','n','-','l','e','f','t',0};
128 static const WCHAR attrMarginRight
[] =
129 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
130 static const WCHAR attrMarginTop
[] =
131 {'m','a','r','g','i','n','-','t','o','p',0};
132 static const WCHAR attrMaxHeight
[] =
133 {'m','a','x','-','h','e','i','g','h','t',0};
134 static const WCHAR attrMaxWidth
[] =
135 {'m','a','x','-','w','i','d','t','h',0};
136 static const WCHAR attrMinHeight
[] =
137 {'m','i','n','-','h','e','i','g','h','t',0};
138 static const WCHAR attrMinWidth
[] =
139 {'m','i','n','-','w','i','d','t','h',0};
140 static const WCHAR attrOutline
[] =
141 {'o','u','t','l','i','n','e',0};
142 static const WCHAR attrOverflow
[] =
143 {'o','v','e','r','f','l','o','w',0};
144 static const WCHAR attrOverflowX
[] =
145 {'o','v','e','r','f','l','o','w','-','x',0};
146 static const WCHAR attrOverflowY
[] =
147 {'o','v','e','r','f','l','o','w','-','y',0};
148 static const WCHAR attrPadding
[] =
149 {'p','a','d','d','i','n','g',0};
150 static const WCHAR attrPaddingBottom
[] =
151 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
152 static const WCHAR attrPaddingLeft
[] =
153 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
154 static const WCHAR attrPaddingRight
[] =
155 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
156 static const WCHAR attrPaddingTop
[] =
157 {'p','a','d','d','i','n','g','-','t','o','p',0};
158 static const WCHAR attrPageBreakAfter
[] =
159 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
160 static const WCHAR attrPageBreakBefore
[] =
161 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
162 static const WCHAR attrPosition
[] =
163 {'p','o','s','i','t','i','o','n',0};
164 static const WCHAR attrRight
[] =
165 {'r','i','g','h','t',0};
166 static const WCHAR attrTableLayout
[] =
167 {'t','a','b','l','e','-','l','a','y','o','u','t',0};
168 static const WCHAR attrTextAlign
[] =
169 {'t','e','x','t','-','a','l','i','g','n',0};
170 static const WCHAR attrTextDecoration
[] =
171 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
172 static const WCHAR attrTextIndent
[] =
173 {'t','e','x','t','-','i','n','d','e','n','t',0};
174 static const WCHAR attrTextTransform
[] =
175 {'t','e','x','t','-','t','r','a','n','s','f','o','r','m',0};
176 static const WCHAR attrTop
[] =
178 static const WCHAR attrVerticalAlign
[] =
179 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
180 static const WCHAR attrVisibility
[] =
181 {'v','i','s','i','b','i','l','i','t','y',0};
182 static const WCHAR attrWhiteSpace
[] =
183 {'w','h','i','t','e','-','s','p','a','c','e',0};
184 static const WCHAR attrWidth
[] =
185 {'w','i','d','t','h',0};
186 static const WCHAR attrWordSpacing
[] =
187 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
188 static const WCHAR attrWordWrap
[] =
189 {'w','o','r','d','-','w','r','a','p',0};
190 static const WCHAR attrZIndex
[] =
191 {'z','-','i','n','d','e','x',0};
194 static const WCHAR pxW
[] = {'p','x',0};
201 static const style_tbl_entry_t style_tbl
[] = {
202 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
203 {attrBackgroundAttachment
, DISPID_IHTMLSTYLE_BACKGROUNDATTACHMENT
},
204 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
205 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
206 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
207 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
208 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
209 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
210 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
211 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
212 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
213 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
214 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
215 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
216 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
217 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
218 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
219 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
220 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
221 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
222 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
223 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
224 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
225 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
226 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
227 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
228 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
229 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
230 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
231 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
232 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
233 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
234 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
235 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
236 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
237 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
238 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
239 {attrFloat
, DISPID_IHTMLSTYLE_STYLEFLOAT
},
240 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
241 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
242 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
243 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
244 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
245 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
246 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
247 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
248 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
249 {attrListStyle
, DISPID_IHTMLSTYLE_LISTSTYLE
},
250 {attrListStylePosition
, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION
},
251 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
252 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
253 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
254 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
255 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
256 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
257 {attrMaxHeight
, DISPID_IHTMLSTYLE5_MAXHEIGHT
},
258 {attrMaxWidth
, DISPID_IHTMLSTYLE5_MAXWIDTH
},
259 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
260 {attrMinWidth
, DISPID_IHTMLSTYLE5_MINWIDTH
},
261 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
262 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
263 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
264 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
265 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
266 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
267 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
268 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
269 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
270 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
271 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
272 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
273 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
274 {attrTableLayout
, DISPID_IHTMLSTYLE2_TABLELAYOUT
},
275 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
276 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
277 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
278 {attrTextTransform
, DISPID_IHTMLSTYLE_TEXTTRANSFORM
},
279 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
280 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
281 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
282 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
283 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
284 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
285 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
286 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
289 C_ASSERT(sizeof(style_tbl
)/sizeof(*style_tbl
) == STYLEID_MAX_VALUE
);
291 static const WCHAR valLineThrough
[] =
292 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
293 static const WCHAR valUnderline
[] =
294 {'u','n','d','e','r','l','i','n','e',0};
295 static const WCHAR szNormal
[] =
296 {'n','o','r','m','a','l',0};
297 static const WCHAR styleNone
[] =
299 static const WCHAR valOverline
[] =
300 {'o','v','e','r','l','i','n','e',0};
301 static const WCHAR valBlink
[] =
302 {'b','l','i','n','k',0};
304 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
305 static const WCHAR emptyW
[] = {0};
307 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
309 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
314 c
= strcmpW(style_tbl
[i
].name
, name
);
327 static LPWSTR
fix_px_value(LPCWSTR val
)
332 while(*ptr
&& isspaceW(*ptr
))
337 while(*ptr
&& isdigitW(*ptr
))
340 if(!*ptr
|| isspaceW(*ptr
)) {
342 int len
= strlenW(val
)+1;
344 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
345 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
351 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
356 while(*ptr
&& !isspaceW(*ptr
))
363 static LPWSTR
fix_url_value(LPCWSTR val
)
367 static const WCHAR urlW
[] = {'u','r','l','('};
369 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
372 ret
= heap_strdupW(val
);
374 for(ptr
= ret
; *ptr
; ptr
++) {
382 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
384 nsAString str_name
, str_value
, str_empty
;
389 if(flags
& ATTR_FIX_PX
)
390 val
= fix_px_value(value
);
391 else if(flags
& ATTR_FIX_URL
)
392 val
= fix_url_value(value
);
395 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
396 nsAString_InitDepend(&str_value
, val
? val
: value
);
397 nsAString_InitDepend(&str_empty
, emptyW
);
399 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
401 ERR("SetProperty failed: %08x\n", nsres
);
403 nsAString_Finish(&str_name
);
404 nsAString_Finish(&str_value
);
405 nsAString_Finish(&str_empty
);
411 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
422 case VT_BSTR
|VT_BYREF
:
423 *ret
= *V_BSTRREF(v
);
427 static const WCHAR formatW
[] = {'%','d',0};
428 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
430 if(flags
& ATTR_HEX_INT
)
431 wsprintfW(buf
, hex_formatW
, V_I4(v
));
432 else if(flags
& ATTR_FIX_PX
)
433 wsprintfW(buf
, px_formatW
, V_I4(v
));
435 wsprintfW(buf
, formatW
, V_I4(v
));
441 FIXME("not implemented for %s\n", debugstr_variant(v
));
447 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
453 hres
= var_to_styleval(value
, buf
, flags
, &val
);
457 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
460 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
462 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
465 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
470 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
472 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
473 if(NS_FAILED(nsres
)) {
474 ERR("SetProperty failed: %08x\n", nsres
);
478 nsAString_Finish(&str_name
);
483 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
489 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
493 ret
= SysAllocString(val
);
495 return E_OUTOFMEMORY
;
497 len
= SysStringLen(ret
);
499 if(flags
& ATTR_REMOVE_COMMA
) {
503 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
509 new_ret
= SysAllocStringLen(NULL
, new_len
);
512 return E_OUTOFMEMORY
;
515 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
529 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
532 const PRUnichar
*value
;
535 nsAString_Init(&str_value
, NULL
);
537 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
539 nsAString_GetData(&str_value
, &value
);
540 hres
= nsstyle_to_bstr(value
, flags
, p
);
541 nsAString_Finish(&str_value
);
543 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
547 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
550 const PRUnichar
*value
;
554 nsAString_Init(&str_value
, NULL
);
556 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
558 nsAString_GetData(&str_value
, &value
);
560 if(flags
& ATTR_STR_TO_INT
) {
561 const PRUnichar
*ptr
= value
;
570 while(isdigitW(*ptr
))
571 i
= i
*10 + (*ptr
++ - '0');
575 V_I4(p
) = neg
? -i
: i
;
583 hres
= nsstyle_to_bstr(value
, flags
, &str
);
584 if(SUCCEEDED(hres
)) {
590 nsAString_Finish(&str_value
);
592 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
596 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
598 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
601 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
604 const PRUnichar
*value
;
606 nsAString_Init(&str_value
, NULL
);
608 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
610 nsAString_GetData(&str_value
, &value
);
611 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
612 nsAString_Finish(&str_value
);
614 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
618 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
621 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
623 value
= floor(value
);
625 sprintfW(szValue
, szFormat
, value
);
627 return set_style_attr(This
, sid
, szValue
, 0);
630 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
634 sprintfW(value_str
, px_formatW
, value
);
636 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
639 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
644 TRACE("%p %d %p\n", This
, sid
, p
);
648 nsAString_Init(&str_value
, NULL
);
650 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
654 const PRUnichar
*value
;
656 nsAString_GetData(&str_value
, &value
);
659 *p
= strtolW(value
, &ptr
, 10);
661 if(*ptr
&& strcmpW(ptr
, pxW
))
663 nsAString_Finish(&str_value
);
664 FIXME("only px values are currently supported\n");
670 TRACE("ret %f\n", *p
);
672 nsAString_Finish(&str_value
);
676 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
684 nsAString_Init(&str_value
, NULL
);
686 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
689 const PRUnichar
*value
;
691 nsAString_GetData(&str_value
, &value
);
693 *p
= strtolW(value
, &ptr
, 10);
696 /* Skip all digits. We have tests showing that we should not round the value. */
697 while(isdigitW(*++ptr
));
700 if(*ptr
&& strcmpW(ptr
, pxW
)) {
701 nsAString_Finish(&str_value
);
702 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
710 nsAString_Finish(&str_value
);
714 static BOOL
is_valid_border_style(BSTR v
)
716 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
717 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
718 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
719 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
720 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
721 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
722 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
723 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
725 TRACE("%s\n", debugstr_w(v
));
727 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
728 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
729 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
730 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
731 strcmpiW(v
, styleOutset
) == 0 )
739 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
741 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
744 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
746 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
748 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
750 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
751 *ppv
= &This
->IHTMLStyle_iface
;
752 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
753 *ppv
= &This
->IHTMLStyle_iface
;
754 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
755 *ppv
= &This
->IHTMLStyle2_iface
;
756 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
757 *ppv
= &This
->IHTMLStyle3_iface
;
758 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
759 *ppv
= &This
->IHTMLStyle4_iface
;
760 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
761 *ppv
= &This
->IHTMLStyle5_iface
;
762 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
763 *ppv
= &This
->IHTMLStyle6_iface
;
764 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
765 return *ppv
? S_OK
: E_NOINTERFACE
;
768 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
769 return E_NOINTERFACE
;
772 IUnknown_AddRef((IUnknown
*)*ppv
);
776 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
778 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
779 LONG ref
= InterlockedIncrement(&This
->ref
);
781 TRACE("(%p) ref=%d\n", This
, ref
);
786 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
788 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
789 LONG ref
= InterlockedDecrement(&This
->ref
);
791 TRACE("(%p) ref=%d\n", This
, ref
);
796 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
797 release_dispex(&This
->dispex
);
804 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
806 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
807 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
810 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
811 LCID lcid
, ITypeInfo
**ppTInfo
)
813 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
814 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
817 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
818 LPOLESTR
*rgszNames
, UINT cNames
,
819 LCID lcid
, DISPID
*rgDispId
)
821 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
822 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
826 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
827 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
828 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
830 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
831 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
832 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
835 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
837 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
839 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
841 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
844 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
846 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
848 TRACE("(%p)->(%p)\n", This
, p
);
850 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
853 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
855 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
856 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
857 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
859 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
861 /* fontStyle can only be one of the follow values. */
862 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
863 strcmpiW(szOblique
, v
) == 0)
865 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
871 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
873 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
875 TRACE("(%p)->(%p)\n", This
, p
);
877 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
880 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
882 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
883 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
885 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
887 /* fontVariant can only be one of the follow values. */
888 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
890 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
896 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
898 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
899 TRACE("(%p)->(%p)\n", This
, p
);
904 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
907 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
909 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
910 static const WCHAR styleBold
[] = {'b','o','l','d',0};
911 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
912 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
913 static const WCHAR style100
[] = {'1','0','0',0};
914 static const WCHAR style200
[] = {'2','0','0',0};
915 static const WCHAR style300
[] = {'3','0','0',0};
916 static const WCHAR style400
[] = {'4','0','0',0};
917 static const WCHAR style500
[] = {'5','0','0',0};
918 static const WCHAR style600
[] = {'6','0','0',0};
919 static const WCHAR style700
[] = {'7','0','0',0};
920 static const WCHAR style800
[] = {'8','0','0',0};
921 static const WCHAR style900
[] = {'9','0','0',0};
923 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
925 /* fontWeight can only be one of the following */
926 if(v
&& *v
&& strcmpiW(szNormal
, v
) && strcmpiW(styleBold
, v
) && strcmpiW(styleBolder
, v
)
927 && strcmpiW(styleLighter
, v
) && strcmpiW(style100
, v
) && strcmpiW(style200
, v
)
928 && strcmpiW(style300
, v
) && strcmpiW(style400
, v
) && strcmpiW(style500
, v
) && strcmpiW(style600
, v
)
929 && strcmpiW(style700
, v
) && strcmpiW(style800
, v
) && strcmpiW(style900
, v
))
932 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
935 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
937 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
939 TRACE("(%p)->(%p)\n", This
, p
);
941 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
944 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
946 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
948 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
950 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
953 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
955 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
957 TRACE("(%p)->(%p)\n", This
, p
);
959 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
962 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
964 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
965 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
969 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
971 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
972 FIXME("(%p)->(%p)\n", This
, p
);
976 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
978 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
980 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
982 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
985 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
987 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
989 TRACE("(%p)->(%p)\n", This
, p
);
991 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
994 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
996 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
998 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1000 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
1003 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
1005 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1007 TRACE("(%p)->(%p)\n", This
, p
);
1009 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
1012 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1014 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1016 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1018 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1021 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1023 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1025 TRACE("(%p)->(%p)\n", This
, p
);
1027 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1030 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1032 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1034 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1036 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1039 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1041 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1043 TRACE("(%p)->(%p)\n", This
, p
);
1045 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1048 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1050 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1051 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1052 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1053 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1054 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1056 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1058 /* fontWeight can only be one of the following */
1059 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1060 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1062 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1065 return E_INVALIDARG
;
1068 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1070 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1072 TRACE("(%p)->(%p)\n", This
, p
);
1074 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1077 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1079 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1081 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1083 return set_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, v
, 0);
1086 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(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_ATTACHMENT
, p
);
1095 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(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_POSITION
, v
, 0);
1104 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(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_POSITION
, p
);
1113 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1115 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1116 WCHAR buf
[14], *pos_val
;
1122 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1124 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1128 val_len
= val
? strlenW(val
) : 0;
1130 nsAString_Init(&pos_str
, NULL
);
1131 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1132 if(SUCCEEDED(hres
)) {
1133 const PRUnichar
*pos
, *posy
;
1136 nsAString_GetData(&pos_str
, &pos
);
1137 posy
= strchrW(pos
, ' ');
1139 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1141 TRACE("no space in %s\n", debugstr_w(pos
));
1145 posy_len
= strlenW(posy
);
1146 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1149 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1151 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1152 pos_val
[val_len
+posy_len
] = 0;
1154 hres
= E_OUTOFMEMORY
;
1157 nsAString_Finish(&pos_str
);
1161 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1162 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1167 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1169 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1174 TRACE("(%p)->(%p)\n", This
, p
);
1176 nsAString_Init(&pos_str
, NULL
);
1177 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1178 if(SUCCEEDED(hres
)) {
1179 const PRUnichar
*pos
, *space
;
1181 nsAString_GetData(&pos_str
, &pos
);
1182 space
= strchrW(pos
, ' ');
1184 WARN("no space in %s\n", debugstr_w(pos
));
1185 space
= pos
+ strlenW(pos
);
1189 ret
= SysAllocStringLen(pos
, space
-pos
);
1191 hres
= E_OUTOFMEMORY
;
1196 nsAString_Finish(&pos_str
);
1200 TRACE("returning %s\n", debugstr_w(ret
));
1206 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1208 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1209 WCHAR buf
[14], *pos_val
;
1215 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1217 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1221 val_len
= val
? strlenW(val
) : 0;
1223 nsAString_Init(&pos_str
, NULL
);
1224 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1225 if(SUCCEEDED(hres
)) {
1226 const PRUnichar
*pos
, *space
;
1229 nsAString_GetData(&pos_str
, &pos
);
1230 space
= strchrW(pos
, ' ');
1234 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1236 TRACE("no space in %s\n", debugstr_w(pos
));
1238 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1241 posx_len
= space
-pos
;
1243 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1245 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1247 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1248 pos_val
[posx_len
+val_len
] = 0;
1250 hres
= E_OUTOFMEMORY
;
1253 nsAString_Finish(&pos_str
);
1257 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1258 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1263 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1265 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1270 TRACE("(%p)->(%p)\n", This
, p
);
1272 nsAString_Init(&pos_str
, NULL
);
1273 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1274 if(SUCCEEDED(hres
)) {
1275 const PRUnichar
*pos
, *posy
;
1277 nsAString_GetData(&pos_str
, &pos
);
1278 posy
= strchrW(pos
, ' ');
1280 ret
= SysAllocString(posy
+1);
1282 hres
= E_OUTOFMEMORY
;
1287 nsAString_Finish(&pos_str
);
1291 TRACE("returning %s\n", debugstr_w(ret
));
1297 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1299 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1301 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1303 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1306 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1308 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1309 TRACE("(%p)->(%p)\n", This
, p
);
1310 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1313 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1315 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1317 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1319 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1322 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1324 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1325 TRACE("(%p)->(%p)\n", This
, p
);
1326 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1329 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1331 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1333 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1335 /* textDecoration can only be one of the following */
1336 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1337 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1338 strcmpiW(valBlink
, v
) == 0)
1340 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1343 return E_INVALIDARG
;
1346 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1348 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1350 TRACE("(%p)->(%p)\n", This
, p
);
1352 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1355 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1357 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1359 TRACE("(%p)->(%x)\n", This
, v
);
1361 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1364 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1366 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1368 TRACE("(%p)->(%p)\n", This
, p
);
1370 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1373 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(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
? valUnderline
: emptyW
, 0);
1382 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(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
, valUnderline
, p
);
1391 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(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
? valOverline
: emptyW
, 0);
1400 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(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
, valOverline
, p
);
1409 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(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
? valLineThrough
: emptyW
, 0);
1418 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(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
, valLineThrough
, p
);
1427 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(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
? valBlink
: emptyW
, 0);
1436 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(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
, valBlink
, p
);
1445 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1447 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1449 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1451 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1454 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1456 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1458 TRACE("(%p)->(%p)\n", This
, p
);
1460 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1463 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1465 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1467 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1469 return set_style_attr(This
, STYLEID_TEXT_TRANSFORM
, v
, 0);
1472 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1474 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1476 TRACE("(%p)->(%p)\n", This
, p
);
1478 return get_style_attr(This
, STYLEID_TEXT_TRANSFORM
, p
);
1481 static HRESULT WINAPI
HTMLStyle_put_textAlign(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_ALIGN
, v
, 0);
1490 static HRESULT WINAPI
HTMLStyle_get_textAlign(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_ALIGN
, p
);
1499 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1501 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1503 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1505 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, &v
, ATTR_FIX_PX
);
1508 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1510 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1512 TRACE("(%p)->(%p)\n", This
, p
);
1514 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, p
, 0);
1517 static HRESULT WINAPI
HTMLStyle_put_lineHeight(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_LINE_HEIGHT
, &v
, 0);
1526 static HRESULT WINAPI
HTMLStyle_get_lineHeight(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_LINE_HEIGHT
, p
, 0);
1535 static HRESULT WINAPI
HTMLStyle_put_marginTop(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_TOP
, &v
, ATTR_FIX_PX
);
1544 static HRESULT WINAPI
HTMLStyle_get_marginTop(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_TOP
, p
, 0);
1553 static HRESULT WINAPI
HTMLStyle_put_marginRight(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_RIGHT
, &v
, ATTR_FIX_PX
);
1562 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1564 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1565 TRACE("(%p)->(%p)\n", This
, p
);
1566 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1569 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1571 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1573 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1575 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1578 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1580 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1582 TRACE("(%p)->(%p)\n", This
, p
);
1584 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1587 static HRESULT WINAPI
HTMLStyle_put_marginLeft(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_LEFT
, &v
, ATTR_FIX_PX
);
1596 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1598 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1600 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1602 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1605 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1607 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1609 TRACE("(%p)->(%p)\n", This
, p
);
1611 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1614 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1617 TRACE("(%p)->(%p)\n", This
, p
);
1618 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1621 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1623 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1625 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1627 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1630 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1632 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1634 TRACE("(%p)->(%p)\n", This
, p
);
1636 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1639 static HRESULT WINAPI
HTMLStyle_put_paddingRight(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_RIGHT
, &v
, ATTR_FIX_PX
);
1648 static HRESULT WINAPI
HTMLStyle_get_paddingRight(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_RIGHT
, p
, 0);
1657 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(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_BOTTOM
, &v
, ATTR_FIX_PX
);
1666 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(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_BOTTOM
, p
, 0);
1675 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(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_LEFT
, &v
, ATTR_FIX_PX
);
1684 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(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_LEFT
, p
, 0);
1693 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1695 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1697 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1699 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1702 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1704 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1706 TRACE("(%p)->(%p)\n", This
, p
);
1708 return get_style_attr(This
, STYLEID_PADDING
, p
);
1711 static HRESULT WINAPI
HTMLStyle_put_border(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_BORDER
, v
, 0);
1720 static HRESULT WINAPI
HTMLStyle_get_border(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_BORDER
, p
);
1729 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1731 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1732 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1733 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1736 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1738 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1739 TRACE("(%p)->(%p)\n", This
, p
);
1740 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1743 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1745 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1746 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1747 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1750 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1752 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1753 TRACE("(%p)->(%p)\n", This
, p
);
1754 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1757 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1759 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1760 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1761 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1764 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1766 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1767 TRACE("(%p)->(%p)\n", This
, p
);
1768 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1771 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1773 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1775 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1777 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1780 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1782 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1784 TRACE("(%p)->(%p)\n", This
, p
);
1786 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1789 static HRESULT WINAPI
HTMLStyle_put_borderColor(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_COLOR
, v
, 0);
1798 static HRESULT WINAPI
HTMLStyle_get_borderColor(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_COLOR
, p
);
1807 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1809 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1811 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1813 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1816 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1818 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1820 TRACE("(%p)->(%p)\n", This
, p
);
1822 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1825 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(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_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1834 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(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_RIGHT_COLOR
, p
, 0);
1843 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(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_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1852 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(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_BOTTOM_COLOR
, p
, 0);
1861 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(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_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1870 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(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_LEFT_COLOR
, p
, 0);
1879 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1881 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1882 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1883 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1886 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1888 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1889 TRACE("(%p)->(%p)\n", This
, p
);
1890 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1893 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1895 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1897 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1899 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1902 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1904 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1906 TRACE("(%p)->(%p)\n", This
, p
);
1908 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1911 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(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_RIGHT_WIDTH
, &v
, 0);
1920 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(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_RIGHT_WIDTH
, p
, 0);
1929 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(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_BOTTOM_WIDTH
, &v
, 0);
1938 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1940 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1941 TRACE("(%p)->(%p)\n", This
, p
);
1942 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1945 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1947 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1949 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1951 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1954 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1956 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1957 TRACE("(%p)->(%p)\n", This
, p
);
1958 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1961 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1963 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1964 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1965 HRESULT hres
= S_OK
;
1970 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1972 while(v
[i
] && hres
== S_OK
)
1974 if(v
[i
] == (WCHAR
)' ')
1976 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1977 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1979 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1980 hres
= E_INVALIDARG
;
1982 SysFreeString(pstyle
);
1990 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1991 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1993 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1994 hres
= E_INVALIDARG
;
1996 SysFreeString(pstyle
);
2000 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
2005 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
2007 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2008 TRACE("(%p)->(%p)\n", This
, p
);
2009 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
2012 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
2014 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2015 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2017 if(!is_valid_border_style(v
))
2018 return E_INVALIDARG
;
2020 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
2023 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(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_TOP_STYLE
, p
);
2030 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(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_RIGHT_STYLE
, v
, 0);
2041 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(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_RIGHT_STYLE
, p
);
2048 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(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_BOTTOM_STYLE
, v
, 0);
2059 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(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_BOTTOM_STYLE
, p
);
2066 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(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_LEFT_STYLE
, v
, 0);
2077 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(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_LEFT_STYLE
, p
);
2084 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2086 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2088 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2090 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2093 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2095 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2097 TRACE("(%p)->(%p)\n", This
, p
);
2099 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2102 static HRESULT WINAPI
HTMLStyle_put_height(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_HEIGHT
, &v
, ATTR_FIX_PX
);
2111 static HRESULT WINAPI
HTMLStyle_get_height(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_HEIGHT
, p
, 0);
2120 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2122 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2124 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2126 return set_style_attr(This
, STYLEID_FLOAT
, v
, 0);
2129 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2131 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2133 TRACE("(%p)->(%p)\n", This
, p
);
2135 return get_style_attr(This
, STYLEID_FLOAT
, p
);
2138 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2140 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2142 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2144 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2147 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2149 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2151 TRACE("(%p)->(%p)\n", This
, p
);
2153 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2156 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2158 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2160 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2162 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2165 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2167 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2169 TRACE("(%p)->(%p)\n", This
, p
);
2171 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2174 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2176 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2178 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2180 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2183 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2185 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2187 TRACE("(%p)->(%p)\n", This
, p
);
2189 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2192 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2194 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2196 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2198 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2201 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2203 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2205 TRACE("(%p)->(%p)\n", This
, p
);
2207 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2210 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2212 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2214 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2216 return set_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, v
, 0);
2219 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2221 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2223 TRACE("(%p)->(%p)\n", This
, p
);
2225 return get_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, p
);
2228 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2230 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2231 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2235 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2237 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2238 FIXME("(%p)->(%p)\n", This
, p
);
2242 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2244 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2246 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2248 return set_style_attr(This
, STYLEID_LIST_STYLE
, v
, 0);
2251 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2253 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2255 TRACE("(%p)->(%p)\n", This
, p
);
2257 return get_style_attr(This
, STYLEID_LIST_STYLE
, p
);
2260 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2262 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2264 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2266 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2269 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2271 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2273 TRACE("(%p)->(%p)\n", This
, p
);
2275 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2278 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2280 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2282 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2284 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2287 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2289 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2291 TRACE("(%p)->(%p)\n", This
, p
);
2293 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2296 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2298 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2300 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2302 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2305 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2307 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2309 TRACE("(%p)->(%p)\n", This
, p
);
2311 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2314 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2316 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2317 TRACE("(%p)->(%p)\n", This
, p
);
2318 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2321 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2323 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2325 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2327 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2330 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2332 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2334 TRACE("(%p)->(%p)\n", This
, p
);
2336 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2339 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2341 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2342 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2343 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2344 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2345 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2347 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2349 /* overflow can only be one of the follow values. */
2350 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2351 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2353 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2356 return E_INVALIDARG
;
2360 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2362 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2364 TRACE("(%p)->(%p)\n", This
, p
);
2367 return E_INVALIDARG
;
2369 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2372 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2374 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2376 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2378 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2381 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2383 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2385 TRACE("(%p)->(%p)\n", This
, p
);
2387 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2390 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2392 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2394 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2396 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2399 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2401 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2403 TRACE("(%p)->(%p)\n", This
, p
);
2405 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2408 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2410 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2414 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2416 nsAString_InitDepend(&text_str
, v
);
2417 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2418 nsAString_Finish(&text_str
);
2419 if(NS_FAILED(nsres
)) {
2420 FIXME("SetCssStyle failed: %08x\n", nsres
);
2427 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2429 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2433 TRACE("(%p)->(%p)\n", This
, p
);
2435 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2436 nsAString_Init(&text_str
, NULL
);
2437 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2438 if(NS_SUCCEEDED(nsres
)) {
2439 const PRUnichar
*text
;
2441 nsAString_GetData(&text_str
, &text
);
2442 *p
= *text
? SysAllocString(text
) : NULL
;
2444 FIXME("GetCssStyle failed: %08x\n", nsres
);
2448 nsAString_Finish(&text_str
);
2452 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2454 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2456 TRACE("(%p)->(%d)\n", This
, v
);
2458 return set_style_pxattr(This
->nsstyle
, STYLEID_TOP
, v
);
2461 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2463 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2465 TRACE("(%p)->(%p)\n", This
, p
);
2467 return get_nsstyle_pixel_val(This
, STYLEID_TOP
, p
);
2470 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2472 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2474 TRACE("(%p)->(%d)\n", This
, v
);
2476 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2479 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2481 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2483 TRACE("(%p)->(%p)\n", This
, p
);
2485 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2488 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2490 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2492 TRACE("(%p)->()\n", This
);
2494 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2497 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2499 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2501 TRACE("(%p)->(%p)\n", This
, p
);
2503 return get_nsstyle_pixel_val(This
, STYLEID_WIDTH
, p
);
2506 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2508 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2510 TRACE("(%p)->(%d)\n", This
, v
);
2512 return set_style_pxattr(This
->nsstyle
, STYLEID_HEIGHT
, v
);
2515 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2517 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2519 TRACE("(%p)->(%p)\n", This
, p
);
2521 return get_nsstyle_pixel_val(This
, STYLEID_HEIGHT
, p
);
2524 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2526 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2528 TRACE("(%p)->(%f)\n", This
, v
);
2530 return set_style_pos(This
, STYLEID_TOP
, v
);
2533 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2535 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2537 TRACE("(%p)->(%p)\n", This
, p
);
2542 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2545 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2547 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2549 TRACE("(%p)->(%f)\n", This
, v
);
2551 return set_style_pos(This
, STYLEID_LEFT
, v
);
2554 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2556 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2558 TRACE("(%p)->(%p)\n", This
, p
);
2563 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2566 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2568 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2570 TRACE("(%p)->(%f)\n", This
, v
);
2572 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2575 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2577 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2579 TRACE("(%p)->(%p)\n", This
, p
);
2584 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2590 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2592 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2594 TRACE("(%p)->(%f)\n", This
, v
);
2596 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2599 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2601 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2603 TRACE("(%p)->(%p)\n", This
, p
);
2608 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2614 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2618 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2620 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2623 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2625 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2627 TRACE("(%p)->(%p)\n", This
, p
);
2629 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2632 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2634 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2636 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2638 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2641 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2643 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2645 TRACE("(%p)->(%p)\n", This
, p
);
2647 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2650 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2652 nsAString name_str
, val_str
, empty_str
;
2655 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2657 TRACE("%s\n", debugstr_w(val
));
2659 nsAString_InitDepend(&name_str
, opacityW
);
2660 nsAString_InitDepend(&val_str
, val
);
2661 nsAString_InitDepend(&empty_str
, emptyW
);
2663 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2664 if(NS_FAILED(nsres
))
2665 ERR("SetProperty failed: %08x\n", nsres
);
2667 nsAString_Finish(&name_str
);
2668 nsAString_Finish(&val_str
);
2669 nsAString_Finish(&empty_str
);
2672 static void update_filter(HTMLStyle
*This
)
2674 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2676 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2679 set_opacity(This
, emptyW
);
2684 while(isspaceW(*ptr
))
2690 while(isalnumW(*ptr
))
2693 WARN("unexpected char '%c'\n", *ptr
);
2697 WARN("expected '('\n");
2701 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2702 static const WCHAR formatW
[] = {'%','f',0};
2703 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2707 while(isspaceW(*ptr
))
2711 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2714 WARN("unexpected end of string\n");
2718 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2719 float fval
= 0.0f
, e
= 0.1f
;
2722 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2724 while(isdigitW(*ptr2
))
2725 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2728 while(isdigitW(*++ptr2
)) {
2729 fval
+= e
* (float)(*ptr2
++ - '0');
2734 sprintfW(buf
, formatW
, fval
* 0.01f
);
2735 set_opacity(This
, buf
);
2737 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2742 }while(*ptr
!= ')');
2744 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2745 ptr
= strchrW(ptr
, ')');
2753 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2755 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2756 WCHAR
*new_filter
= NULL
;
2758 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2761 FIXME("Element already destroyed\n");
2762 return E_UNEXPECTED
;
2766 new_filter
= heap_strdupW(v
);
2768 return E_OUTOFMEMORY
;
2771 heap_free(This
->elem
->filter
);
2772 This
->elem
->filter
= new_filter
;
2774 update_filter(This
);
2778 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2780 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2782 TRACE("(%p)->(%p)\n", This
, p
);
2785 FIXME("Element already destroyed\n");
2786 return E_UNEXPECTED
;
2789 if(This
->elem
->filter
) {
2790 *p
= SysAllocString(This
->elem
->filter
);
2792 return E_OUTOFMEMORY
;
2800 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2801 VARIANT AttributeValue
, LONG lFlags
)
2803 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2807 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2808 debugstr_variant(&AttributeValue
), lFlags
);
2810 if(!strAttributeName
)
2811 return E_INVALIDARG
;
2814 FIXME("Parameter lFlags ignored\n");
2816 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2817 LOCALE_USER_DEFAULT
, &dispid
);
2821 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2825 params
.rgvarg
= &AttributeValue
;
2826 params
.cNamedArgs
= 1;
2827 params
.rgdispidNamedArgs
= &dispidNamed
;
2829 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2830 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2834 FIXME("Custom attributes not supported.\n");
2837 TRACE("ret: %08x\n", hres
);
2842 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2843 LONG lFlags
, VARIANT
*AttributeValue
)
2845 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2849 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2850 AttributeValue
, lFlags
);
2852 if(!AttributeValue
|| !strAttributeName
)
2853 return E_INVALIDARG
;
2856 FIXME("Parameter lFlags ignored\n");
2858 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2859 LOCALE_USER_DEFAULT
, &dispid
);
2862 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2864 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2865 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2869 FIXME("Custom attributes not supported.\n");
2875 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2876 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2878 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2879 const style_tbl_entry_t
*style_entry
;
2880 nsAString name_str
, ret_str
;
2884 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2886 style_entry
= lookup_style_tbl(strAttributeName
);
2891 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2892 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2894 *pfSuccess
= VARIANT_FALSE
;
2898 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2899 if(dispid
== style_tbl
[i
].dispid
)
2903 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2904 return remove_attribute(&This
->dispex
, dispid
, pfSuccess
);
2905 style_entry
= style_tbl
+i
;
2908 /* filter property is a special case */
2909 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2910 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2911 heap_free(This
->elem
->filter
);
2912 This
->elem
->filter
= NULL
;
2913 update_filter(This
);
2917 nsAString_InitDepend(&name_str
, style_entry
->name
);
2918 nsAString_Init(&ret_str
, NULL
);
2919 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2920 if(NS_SUCCEEDED(nsres
)) {
2921 const PRUnichar
*ret
;
2922 nsAString_GetData(&ret_str
, &ret
);
2923 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2925 ERR("RemoveProperty failed: %08x\n", nsres
);
2927 nsAString_Finish(&name_str
);
2928 nsAString_Finish(&ret_str
);
2929 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2932 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2934 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2935 FIXME("(%p)->(%p)\n", This
, String
);
2939 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2940 HTMLStyle_QueryInterface
,
2943 HTMLStyle_GetTypeInfoCount
,
2944 HTMLStyle_GetTypeInfo
,
2945 HTMLStyle_GetIDsOfNames
,
2947 HTMLStyle_put_fontFamily
,
2948 HTMLStyle_get_fontFamily
,
2949 HTMLStyle_put_fontStyle
,
2950 HTMLStyle_get_fontStyle
,
2951 HTMLStyle_put_fontVariant
,
2952 HTMLStyle_get_fontVariant
,
2953 HTMLStyle_put_fontWeight
,
2954 HTMLStyle_get_fontWeight
,
2955 HTMLStyle_put_fontSize
,
2956 HTMLStyle_get_fontSize
,
2959 HTMLStyle_put_color
,
2960 HTMLStyle_get_color
,
2961 HTMLStyle_put_background
,
2962 HTMLStyle_get_background
,
2963 HTMLStyle_put_backgroundColor
,
2964 HTMLStyle_get_backgroundColor
,
2965 HTMLStyle_put_backgroundImage
,
2966 HTMLStyle_get_backgroundImage
,
2967 HTMLStyle_put_backgroundRepeat
,
2968 HTMLStyle_get_backgroundRepeat
,
2969 HTMLStyle_put_backgroundAttachment
,
2970 HTMLStyle_get_backgroundAttachment
,
2971 HTMLStyle_put_backgroundPosition
,
2972 HTMLStyle_get_backgroundPosition
,
2973 HTMLStyle_put_backgroundPositionX
,
2974 HTMLStyle_get_backgroundPositionX
,
2975 HTMLStyle_put_backgroundPositionY
,
2976 HTMLStyle_get_backgroundPositionY
,
2977 HTMLStyle_put_wordSpacing
,
2978 HTMLStyle_get_wordSpacing
,
2979 HTMLStyle_put_letterSpacing
,
2980 HTMLStyle_get_letterSpacing
,
2981 HTMLStyle_put_textDecoration
,
2982 HTMLStyle_get_textDecoration
,
2983 HTMLStyle_put_textDecorationNone
,
2984 HTMLStyle_get_textDecorationNone
,
2985 HTMLStyle_put_textDecorationUnderline
,
2986 HTMLStyle_get_textDecorationUnderline
,
2987 HTMLStyle_put_textDecorationOverline
,
2988 HTMLStyle_get_textDecorationOverline
,
2989 HTMLStyle_put_textDecorationLineThrough
,
2990 HTMLStyle_get_textDecorationLineThrough
,
2991 HTMLStyle_put_textDecorationBlink
,
2992 HTMLStyle_get_textDecorationBlink
,
2993 HTMLStyle_put_verticalAlign
,
2994 HTMLStyle_get_verticalAlign
,
2995 HTMLStyle_put_textTransform
,
2996 HTMLStyle_get_textTransform
,
2997 HTMLStyle_put_textAlign
,
2998 HTMLStyle_get_textAlign
,
2999 HTMLStyle_put_textIndent
,
3000 HTMLStyle_get_textIndent
,
3001 HTMLStyle_put_lineHeight
,
3002 HTMLStyle_get_lineHeight
,
3003 HTMLStyle_put_marginTop
,
3004 HTMLStyle_get_marginTop
,
3005 HTMLStyle_put_marginRight
,
3006 HTMLStyle_get_marginRight
,
3007 HTMLStyle_put_marginBottom
,
3008 HTMLStyle_get_marginBottom
,
3009 HTMLStyle_put_marginLeft
,
3010 HTMLStyle_get_marginLeft
,
3011 HTMLStyle_put_margin
,
3012 HTMLStyle_get_margin
,
3013 HTMLStyle_put_paddingTop
,
3014 HTMLStyle_get_paddingTop
,
3015 HTMLStyle_put_paddingRight
,
3016 HTMLStyle_get_paddingRight
,
3017 HTMLStyle_put_paddingBottom
,
3018 HTMLStyle_get_paddingBottom
,
3019 HTMLStyle_put_paddingLeft
,
3020 HTMLStyle_get_paddingLeft
,
3021 HTMLStyle_put_padding
,
3022 HTMLStyle_get_padding
,
3023 HTMLStyle_put_border
,
3024 HTMLStyle_get_border
,
3025 HTMLStyle_put_borderTop
,
3026 HTMLStyle_get_borderTop
,
3027 HTMLStyle_put_borderRight
,
3028 HTMLStyle_get_borderRight
,
3029 HTMLStyle_put_borderBottom
,
3030 HTMLStyle_get_borderBottom
,
3031 HTMLStyle_put_borderLeft
,
3032 HTMLStyle_get_borderLeft
,
3033 HTMLStyle_put_borderColor
,
3034 HTMLStyle_get_borderColor
,
3035 HTMLStyle_put_borderTopColor
,
3036 HTMLStyle_get_borderTopColor
,
3037 HTMLStyle_put_borderRightColor
,
3038 HTMLStyle_get_borderRightColor
,
3039 HTMLStyle_put_borderBottomColor
,
3040 HTMLStyle_get_borderBottomColor
,
3041 HTMLStyle_put_borderLeftColor
,
3042 HTMLStyle_get_borderLeftColor
,
3043 HTMLStyle_put_borderWidth
,
3044 HTMLStyle_get_borderWidth
,
3045 HTMLStyle_put_borderTopWidth
,
3046 HTMLStyle_get_borderTopWidth
,
3047 HTMLStyle_put_borderRightWidth
,
3048 HTMLStyle_get_borderRightWidth
,
3049 HTMLStyle_put_borderBottomWidth
,
3050 HTMLStyle_get_borderBottomWidth
,
3051 HTMLStyle_put_borderLeftWidth
,
3052 HTMLStyle_get_borderLeftWidth
,
3053 HTMLStyle_put_borderStyle
,
3054 HTMLStyle_get_borderStyle
,
3055 HTMLStyle_put_borderTopStyle
,
3056 HTMLStyle_get_borderTopStyle
,
3057 HTMLStyle_put_borderRightStyle
,
3058 HTMLStyle_get_borderRightStyle
,
3059 HTMLStyle_put_borderBottomStyle
,
3060 HTMLStyle_get_borderBottomStyle
,
3061 HTMLStyle_put_borderLeftStyle
,
3062 HTMLStyle_get_borderLeftStyle
,
3063 HTMLStyle_put_width
,
3064 HTMLStyle_get_width
,
3065 HTMLStyle_put_height
,
3066 HTMLStyle_get_height
,
3067 HTMLStyle_put_styleFloat
,
3068 HTMLStyle_get_styleFloat
,
3069 HTMLStyle_put_clear
,
3070 HTMLStyle_get_clear
,
3071 HTMLStyle_put_display
,
3072 HTMLStyle_get_display
,
3073 HTMLStyle_put_visibility
,
3074 HTMLStyle_get_visibility
,
3075 HTMLStyle_put_listStyleType
,
3076 HTMLStyle_get_listStyleType
,
3077 HTMLStyle_put_listStylePosition
,
3078 HTMLStyle_get_listStylePosition
,
3079 HTMLStyle_put_listStyleImage
,
3080 HTMLStyle_get_listStyleImage
,
3081 HTMLStyle_put_listStyle
,
3082 HTMLStyle_get_listStyle
,
3083 HTMLStyle_put_whiteSpace
,
3084 HTMLStyle_get_whiteSpace
,
3089 HTMLStyle_get_position
,
3090 HTMLStyle_put_zIndex
,
3091 HTMLStyle_get_zIndex
,
3092 HTMLStyle_put_overflow
,
3093 HTMLStyle_get_overflow
,
3094 HTMLStyle_put_pageBreakBefore
,
3095 HTMLStyle_get_pageBreakBefore
,
3096 HTMLStyle_put_pageBreakAfter
,
3097 HTMLStyle_get_pageBreakAfter
,
3098 HTMLStyle_put_cssText
,
3099 HTMLStyle_get_cssText
,
3100 HTMLStyle_put_pixelTop
,
3101 HTMLStyle_get_pixelTop
,
3102 HTMLStyle_put_pixelLeft
,
3103 HTMLStyle_get_pixelLeft
,
3104 HTMLStyle_put_pixelWidth
,
3105 HTMLStyle_get_pixelWidth
,
3106 HTMLStyle_put_pixelHeight
,
3107 HTMLStyle_get_pixelHeight
,
3108 HTMLStyle_put_posTop
,
3109 HTMLStyle_get_posTop
,
3110 HTMLStyle_put_posLeft
,
3111 HTMLStyle_get_posLeft
,
3112 HTMLStyle_put_posWidth
,
3113 HTMLStyle_get_posWidth
,
3114 HTMLStyle_put_posHeight
,
3115 HTMLStyle_get_posHeight
,
3116 HTMLStyle_put_cursor
,
3117 HTMLStyle_get_cursor
,
3120 HTMLStyle_put_filter
,
3121 HTMLStyle_get_filter
,
3122 HTMLStyle_setAttribute
,
3123 HTMLStyle_getAttribute
,
3124 HTMLStyle_removeAttribute
,
3128 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3130 const style_tbl_entry_t
*style_entry
;
3132 style_entry
= lookup_style_tbl(name
);
3134 *dispid
= style_entry
->dispid
;
3138 return DISP_E_UNKNOWNNAME
;
3141 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3143 HTMLStyle_get_dispid
,
3148 static const tid_t HTMLStyle_iface_tids
[] = {
3157 static dispex_static_data_t HTMLStyle_dispex
= {
3158 &HTMLStyle_dispex_vtbl
,
3161 HTMLStyle_iface_tids
3164 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3166 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3170 FIXME("NULL nselem\n");
3174 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3175 (void**)&nselemstyle
);
3176 assert(nsres
== NS_OK
);
3178 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3179 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3180 if(NS_FAILED(nsres
)) {
3181 ERR("GetStyle failed: %08x\n", nsres
);
3188 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3190 nsIDOMCSSStyleDeclaration
*nsstyle
;
3194 hres
= get_style_from_elem(elem
, &nsstyle
);
3198 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3200 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3201 return E_OUTOFMEMORY
;
3204 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3206 style
->nsstyle
= nsstyle
;
3208 HTMLStyle2_Init(style
);
3209 HTMLStyle3_Init(style
);
3211 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3213 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3219 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3221 nsIDOMCSSStyleDeclaration
*style
;
3224 hres
= get_style_from_elem(elem
, &style
);
3228 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3229 nsIDOMCSSStyleDeclaration_Release(style
);
3233 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3235 nsIDOMCSSStyleDeclaration
*style
;
3238 hres
= get_style_from_elem(elem
, &style
);
3242 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3243 nsIDOMCSSStyleDeclaration_Release(style
);