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 attrFontFamily
[] =
97 {'f','o','n','t','-','f','a','m','i','l','y',0};
98 static const WCHAR attrFontSize
[] =
99 {'f','o','n','t','-','s','i','z','e',0};
100 static const WCHAR attrFontStyle
[] =
101 {'f','o','n','t','-','s','t','y','l','e',0};
102 static const WCHAR attrFontVariant
[] =
103 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
104 static const WCHAR attrFontWeight
[] =
105 {'f','o','n','t','-','w','e','i','g','h','t',0};
106 static const WCHAR attrHeight
[] =
107 {'h','e','i','g','h','t',0};
108 static const WCHAR attrLeft
[] =
110 static const WCHAR attrLetterSpacing
[] =
111 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
112 static const WCHAR attrLineHeight
[] =
113 {'l','i','n','e','-','h','e','i','g','h','t',0};
114 static const WCHAR attrListStyle
[] =
115 {'l','i','s','t','-','s','t','y','l','e',0};
116 static const WCHAR attrListStyleType
[] =
117 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
118 static const WCHAR attrListStylePosition
[] =
119 {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0};
120 static const WCHAR attrMargin
[] =
121 {'m','a','r','g','i','n',0};
122 static const WCHAR attrMarginBottom
[] =
123 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
124 static const WCHAR attrMarginLeft
[] =
125 {'m','a','r','g','i','n','-','l','e','f','t',0};
126 static const WCHAR attrMarginRight
[] =
127 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
128 static const WCHAR attrMarginTop
[] =
129 {'m','a','r','g','i','n','-','t','o','p',0};
130 static const WCHAR attrMinHeight
[] =
131 {'m','i','n','-','h','e','i','g','h','t',0};
132 static const WCHAR attrMinWidth
[] =
133 {'m','i','n','-','w','i','d','t','h',0};
134 static const WCHAR attrOutline
[] =
135 {'o','u','t','l','i','n','e',0};
136 static const WCHAR attrOverflow
[] =
137 {'o','v','e','r','f','l','o','w',0};
138 static const WCHAR attrOverflowX
[] =
139 {'o','v','e','r','f','l','o','w','-','x',0};
140 static const WCHAR attrOverflowY
[] =
141 {'o','v','e','r','f','l','o','w','-','y',0};
142 static const WCHAR attrPadding
[] =
143 {'p','a','d','d','i','n','g',0};
144 static const WCHAR attrPaddingBottom
[] =
145 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
146 static const WCHAR attrPaddingLeft
[] =
147 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
148 static const WCHAR attrPaddingRight
[] =
149 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
150 static const WCHAR attrPaddingTop
[] =
151 {'p','a','d','d','i','n','g','-','t','o','p',0};
152 static const WCHAR attrPageBreakAfter
[] =
153 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
154 static const WCHAR attrPageBreakBefore
[] =
155 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
156 static const WCHAR attrPosition
[] =
157 {'p','o','s','i','t','i','o','n',0};
158 static const WCHAR attrRight
[] =
159 {'r','i','g','h','t',0};
160 static const WCHAR attrTableLayout
[] =
161 {'t','a','b','l','e','-','l','a','y','o','u','t',0};
162 static const WCHAR attrTextAlign
[] =
163 {'t','e','x','t','-','a','l','i','g','n',0};
164 static const WCHAR attrTextDecoration
[] =
165 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
166 static const WCHAR attrTextIndent
[] =
167 {'t','e','x','t','-','i','n','d','e','n','t',0};
168 static const WCHAR attrTextTransform
[] =
169 {'t','e','x','t','-','t','r','a','n','s','f','o','r','m',0};
170 static const WCHAR attrTop
[] =
172 static const WCHAR attrVerticalAlign
[] =
173 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
174 static const WCHAR attrVisibility
[] =
175 {'v','i','s','i','b','i','l','i','t','y',0};
176 static const WCHAR attrWhiteSpace
[] =
177 {'w','h','i','t','e','-','s','p','a','c','e',0};
178 static const WCHAR attrWidth
[] =
179 {'w','i','d','t','h',0};
180 static const WCHAR attrWordSpacing
[] =
181 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
182 static const WCHAR attrWordWrap
[] =
183 {'w','o','r','d','-','w','r','a','p',0};
184 static const WCHAR attrZIndex
[] =
185 {'z','-','i','n','d','e','x',0};
188 static const WCHAR pxW
[] = {'p','x',0};
195 static const style_tbl_entry_t style_tbl
[] = {
196 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
197 {attrBackgroundAttachment
, DISPID_IHTMLSTYLE_BACKGROUNDATTACHMENT
},
198 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
199 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
200 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
201 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
202 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
203 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
204 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
205 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
206 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
207 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
208 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
209 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
210 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
211 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
212 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
213 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
214 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
215 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
216 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
217 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
218 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
219 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
220 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
221 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
222 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
223 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
224 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
225 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
226 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
227 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
228 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
229 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
230 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
231 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
232 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
233 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
234 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
235 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
236 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
237 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
238 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
239 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
240 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
241 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
242 {attrListStyle
, DISPID_IHTMLSTYLE_LISTSTYLE
},
243 {attrListStylePosition
, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION
},
244 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
245 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
246 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
247 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
248 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
249 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
250 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
251 {attrMinWidth
, DISPID_IHTMLSTYLE5_MINWIDTH
},
252 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
253 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
254 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
255 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
256 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
257 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
258 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
259 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
260 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
261 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
262 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
263 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
264 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
265 {attrTableLayout
, DISPID_IHTMLSTYLE2_TABLELAYOUT
},
266 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
267 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
268 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
269 {attrTextTransform
, DISPID_IHTMLSTYLE_TEXTTRANSFORM
},
270 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
271 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
272 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
273 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
274 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
275 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
276 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
277 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
280 static const WCHAR valLineThrough
[] =
281 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
282 static const WCHAR valUnderline
[] =
283 {'u','n','d','e','r','l','i','n','e',0};
284 static const WCHAR szNormal
[] =
285 {'n','o','r','m','a','l',0};
286 static const WCHAR styleNone
[] =
288 static const WCHAR valOverline
[] =
289 {'o','v','e','r','l','i','n','e',0};
290 static const WCHAR valBlink
[] =
291 {'b','l','i','n','k',0};
293 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
294 static const WCHAR emptyW
[] = {0};
296 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
298 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
303 c
= strcmpW(style_tbl
[i
].name
, name
);
316 static LPWSTR
fix_px_value(LPCWSTR val
)
321 while(*ptr
&& isspaceW(*ptr
))
326 while(*ptr
&& isdigitW(*ptr
))
329 if(!*ptr
|| isspaceW(*ptr
)) {
331 int len
= strlenW(val
)+1;
333 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
334 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
340 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
345 while(*ptr
&& !isspaceW(*ptr
))
352 static LPWSTR
fix_url_value(LPCWSTR val
)
356 static const WCHAR urlW
[] = {'u','r','l','('};
358 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
361 ret
= heap_strdupW(val
);
363 for(ptr
= ret
; *ptr
; ptr
++) {
371 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
373 nsAString str_name
, str_value
, str_empty
;
378 if(flags
& ATTR_FIX_PX
)
379 val
= fix_px_value(value
);
380 if(flags
& ATTR_FIX_URL
)
381 val
= fix_url_value(value
);
384 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
385 nsAString_InitDepend(&str_value
, val
? val
: value
);
386 nsAString_InitDepend(&str_empty
, emptyW
);
388 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
390 ERR("SetProperty failed: %08x\n", nsres
);
392 nsAString_Finish(&str_name
);
393 nsAString_Finish(&str_value
);
394 nsAString_Finish(&str_empty
);
400 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
411 case VT_BSTR
|VT_BYREF
:
412 *ret
= *V_BSTRREF(v
);
416 static const WCHAR formatW
[] = {'%','d',0};
417 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
419 if(flags
& ATTR_HEX_INT
)
420 wsprintfW(buf
, hex_formatW
, V_I4(v
));
421 else if(flags
& ATTR_FIX_PX
)
422 wsprintfW(buf
, px_formatW
, V_I4(v
));
424 wsprintfW(buf
, formatW
, V_I4(v
));
430 FIXME("not implemented for %s\n", debugstr_variant(v
));
436 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
442 hres
= var_to_styleval(value
, buf
, flags
, &val
);
446 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
449 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
451 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
454 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
459 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
461 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
462 if(NS_FAILED(nsres
)) {
463 ERR("SetProperty failed: %08x\n", nsres
);
467 nsAString_Finish(&str_name
);
472 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
478 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
482 ret
= SysAllocString(val
);
484 return E_OUTOFMEMORY
;
486 len
= SysStringLen(ret
);
488 if(flags
& ATTR_REMOVE_COMMA
) {
492 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
498 new_ret
= SysAllocStringLen(NULL
, new_len
);
501 return E_OUTOFMEMORY
;
504 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
518 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
521 const PRUnichar
*value
;
524 nsAString_Init(&str_value
, NULL
);
526 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
528 nsAString_GetData(&str_value
, &value
);
529 hres
= nsstyle_to_bstr(value
, flags
, p
);
530 nsAString_Finish(&str_value
);
532 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
536 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
539 const PRUnichar
*value
;
543 nsAString_Init(&str_value
, NULL
);
545 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
547 nsAString_GetData(&str_value
, &value
);
549 if(flags
& ATTR_STR_TO_INT
) {
550 const PRUnichar
*ptr
= value
;
559 while(isdigitW(*ptr
))
560 i
= i
*10 + (*ptr
++ - '0');
564 V_I4(p
) = neg
? -i
: i
;
572 hres
= nsstyle_to_bstr(value
, flags
, &str
);
573 if(SUCCEEDED(hres
)) {
579 nsAString_Finish(&str_value
);
581 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
585 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
587 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
590 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
593 const PRUnichar
*value
;
595 nsAString_Init(&str_value
, NULL
);
597 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
599 nsAString_GetData(&str_value
, &value
);
600 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
601 nsAString_Finish(&str_value
);
603 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
607 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
610 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
612 value
= floor(value
);
614 sprintfW(szValue
, szFormat
, value
);
616 return set_style_attr(This
, sid
, szValue
, 0);
619 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
623 sprintfW(value_str
, px_formatW
, value
);
625 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
628 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
633 TRACE("%p %d %p\n", This
, sid
, p
);
637 nsAString_Init(&str_value
, NULL
);
639 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
643 const PRUnichar
*value
;
645 nsAString_GetData(&str_value
, &value
);
648 *p
= strtolW(value
, &ptr
, 10);
650 if(*ptr
&& strcmpW(ptr
, pxW
))
652 nsAString_Finish(&str_value
);
653 FIXME("only px values are currently supported\n");
659 TRACE("ret %f\n", *p
);
661 nsAString_Finish(&str_value
);
665 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
673 nsAString_Init(&str_value
, NULL
);
675 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
678 const PRUnichar
*value
;
680 nsAString_GetData(&str_value
, &value
);
682 *p
= strtolW(value
, &ptr
, 10);
685 /* Skip all digits. We have tests showing that we should not round the value. */
686 while(isdigitW(*++ptr
));
689 if(*ptr
&& strcmpW(ptr
, pxW
)) {
690 nsAString_Finish(&str_value
);
691 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
699 nsAString_Finish(&str_value
);
703 static BOOL
is_valid_border_style(BSTR v
)
705 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
706 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
707 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
708 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
709 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
710 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
711 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
712 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
714 TRACE("%s\n", debugstr_w(v
));
716 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
717 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
718 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
719 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
720 strcmpiW(v
, styleOutset
) == 0 )
728 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
730 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
733 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
735 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
737 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
739 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
740 *ppv
= &This
->IHTMLStyle_iface
;
741 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
742 *ppv
= &This
->IHTMLStyle_iface
;
743 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
744 *ppv
= &This
->IHTMLStyle2_iface
;
745 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
746 *ppv
= &This
->IHTMLStyle3_iface
;
747 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
748 *ppv
= &This
->IHTMLStyle4_iface
;
749 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
750 *ppv
= &This
->IHTMLStyle5_iface
;
751 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
752 *ppv
= &This
->IHTMLStyle6_iface
;
753 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
754 return *ppv
? S_OK
: E_NOINTERFACE
;
757 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
758 return E_NOINTERFACE
;
761 IUnknown_AddRef((IUnknown
*)*ppv
);
765 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
767 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
768 LONG ref
= InterlockedIncrement(&This
->ref
);
770 TRACE("(%p) ref=%d\n", This
, ref
);
775 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
777 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
778 LONG ref
= InterlockedDecrement(&This
->ref
);
780 TRACE("(%p) ref=%d\n", This
, ref
);
785 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
786 release_dispex(&This
->dispex
);
793 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
795 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
796 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
799 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
800 LCID lcid
, ITypeInfo
**ppTInfo
)
802 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
803 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
806 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
807 LPOLESTR
*rgszNames
, UINT cNames
,
808 LCID lcid
, DISPID
*rgDispId
)
810 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
811 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
815 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
816 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
817 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
819 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
820 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
821 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
824 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
826 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
828 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
830 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
833 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
835 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
837 TRACE("(%p)->(%p)\n", This
, p
);
839 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
842 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
844 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
845 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
846 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
848 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
850 /* fontStyle can only be one of the follow values. */
851 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
852 strcmpiW(szOblique
, v
) == 0)
854 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
860 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
862 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
864 TRACE("(%p)->(%p)\n", This
, p
);
866 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
869 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
871 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
872 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
874 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
876 /* fontVariant can only be one of the follow values. */
877 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
879 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
885 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
887 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
888 TRACE("(%p)->(%p)\n", This
, p
);
893 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
896 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
898 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
899 static const WCHAR styleBold
[] = {'b','o','l','d',0};
900 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
901 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
902 static const WCHAR style100
[] = {'1','0','0',0};
903 static const WCHAR style200
[] = {'2','0','0',0};
904 static const WCHAR style300
[] = {'3','0','0',0};
905 static const WCHAR style400
[] = {'4','0','0',0};
906 static const WCHAR style500
[] = {'5','0','0',0};
907 static const WCHAR style600
[] = {'6','0','0',0};
908 static const WCHAR style700
[] = {'7','0','0',0};
909 static const WCHAR style800
[] = {'8','0','0',0};
910 static const WCHAR style900
[] = {'9','0','0',0};
912 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
914 /* fontWeight can only be one of the following */
915 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
916 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
917 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
918 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
919 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
920 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
921 strcmpiW(style900
, v
) == 0
924 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
930 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
932 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
934 TRACE("(%p)->(%p)\n", This
, p
);
936 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
939 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
941 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
943 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
945 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
948 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
950 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
952 TRACE("(%p)->(%p)\n", This
, p
);
954 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
957 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
959 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
960 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
964 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
966 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
967 FIXME("(%p)->(%p)\n", This
, p
);
971 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
973 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
975 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
977 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
980 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
982 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
984 TRACE("(%p)->(%p)\n", This
, p
);
986 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
989 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
991 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
993 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
995 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
998 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
1000 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1002 TRACE("(%p)->(%p)\n", This
, p
);
1004 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
1007 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1009 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1011 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1013 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1016 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1018 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1020 TRACE("(%p)->(%p)\n", This
, p
);
1022 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1025 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1027 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1029 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1031 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1034 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1036 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1038 TRACE("(%p)->(%p)\n", This
, p
);
1040 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1043 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1045 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1046 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1047 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1048 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1049 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1051 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1053 /* fontWeight can only be one of the following */
1054 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1055 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1057 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1060 return E_INVALIDARG
;
1063 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1065 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1067 TRACE("(%p)->(%p)\n", This
, p
);
1069 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1072 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1074 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1076 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1078 return set_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, v
, 0);
1081 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1083 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1085 TRACE("(%p)->(%p)\n", This
, p
);
1087 return get_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, p
);
1090 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1092 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1094 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1096 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1099 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1101 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1103 TRACE("(%p)->(%p)\n", This
, p
);
1105 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1108 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1110 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1111 WCHAR buf
[14], *pos_val
;
1117 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1119 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1123 val_len
= val
? strlenW(val
) : 0;
1125 nsAString_Init(&pos_str
, NULL
);
1126 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1127 if(SUCCEEDED(hres
)) {
1128 const PRUnichar
*pos
, *posy
;
1131 nsAString_GetData(&pos_str
, &pos
);
1132 posy
= strchrW(pos
, ' ');
1134 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1136 TRACE("no space in %s\n", debugstr_w(pos
));
1140 posy_len
= strlenW(posy
);
1141 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1144 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1146 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1147 pos_val
[val_len
+posy_len
] = 0;
1149 hres
= E_OUTOFMEMORY
;
1152 nsAString_Finish(&pos_str
);
1156 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1157 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1162 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1164 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1169 TRACE("(%p)->(%p)\n", This
, p
);
1171 nsAString_Init(&pos_str
, NULL
);
1172 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1173 if(SUCCEEDED(hres
)) {
1174 const PRUnichar
*pos
, *space
;
1176 nsAString_GetData(&pos_str
, &pos
);
1177 space
= strchrW(pos
, ' ');
1179 WARN("no space in %s\n", debugstr_w(pos
));
1180 space
= pos
+ strlenW(pos
);
1184 ret
= SysAllocStringLen(pos
, space
-pos
);
1186 hres
= E_OUTOFMEMORY
;
1191 nsAString_Finish(&pos_str
);
1195 TRACE("returning %s\n", debugstr_w(ret
));
1201 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1203 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1204 WCHAR buf
[14], *pos_val
;
1210 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1212 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1216 val_len
= val
? strlenW(val
) : 0;
1218 nsAString_Init(&pos_str
, NULL
);
1219 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1220 if(SUCCEEDED(hres
)) {
1221 const PRUnichar
*pos
, *space
;
1224 nsAString_GetData(&pos_str
, &pos
);
1225 space
= strchrW(pos
, ' ');
1229 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1231 TRACE("no space in %s\n", debugstr_w(pos
));
1233 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1236 posx_len
= space
-pos
;
1238 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1240 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1242 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1243 pos_val
[posx_len
+val_len
] = 0;
1245 hres
= E_OUTOFMEMORY
;
1248 nsAString_Finish(&pos_str
);
1252 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1253 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1258 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1260 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1265 TRACE("(%p)->(%p)\n", This
, p
);
1267 nsAString_Init(&pos_str
, NULL
);
1268 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1269 if(SUCCEEDED(hres
)) {
1270 const PRUnichar
*pos
, *posy
;
1272 nsAString_GetData(&pos_str
, &pos
);
1273 posy
= strchrW(pos
, ' ');
1275 ret
= SysAllocString(posy
+1);
1277 hres
= E_OUTOFMEMORY
;
1282 nsAString_Finish(&pos_str
);
1286 TRACE("returning %s\n", debugstr_w(ret
));
1292 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1294 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1296 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1298 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1301 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1303 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1304 TRACE("(%p)->(%p)\n", This
, p
);
1305 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1308 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1310 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1312 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1314 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1317 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1319 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1320 TRACE("(%p)->(%p)\n", This
, p
);
1321 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1324 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1326 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1328 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1330 /* textDecoration can only be one of the following */
1331 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1332 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1333 strcmpiW(valBlink
, v
) == 0)
1335 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1338 return E_INVALIDARG
;
1341 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1343 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1345 TRACE("(%p)->(%p)\n", This
, p
);
1347 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1350 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1352 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1354 TRACE("(%p)->(%x)\n", This
, v
);
1356 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1359 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1361 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1363 TRACE("(%p)->(%p)\n", This
, p
);
1365 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1368 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1370 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1372 TRACE("(%p)->(%x)\n", This
, v
);
1374 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1377 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1379 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1381 TRACE("(%p)->(%p)\n", This
, p
);
1383 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1386 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1388 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1390 TRACE("(%p)->(%x)\n", This
, v
);
1392 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1395 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1397 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1399 TRACE("(%p)->(%p)\n", This
, p
);
1401 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1404 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1406 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1408 TRACE("(%p)->(%x)\n", This
, v
);
1410 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1413 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1415 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1417 TRACE("(%p)->(%p)\n", This
, p
);
1419 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1422 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1424 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1426 TRACE("(%p)->(%x)\n", This
, v
);
1428 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1431 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1433 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1435 TRACE("(%p)->(%p)\n", This
, p
);
1437 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1440 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1442 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1444 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1446 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1449 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1451 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1453 TRACE("(%p)->(%p)\n", This
, p
);
1455 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1458 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1460 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1462 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1464 return set_style_attr(This
, STYLEID_TEXT_TRANSFORM
, v
, 0);
1467 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1469 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1471 TRACE("(%p)->(%p)\n", This
, p
);
1473 return get_style_attr(This
, STYLEID_TEXT_TRANSFORM
, p
);
1476 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1478 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1480 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1482 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1485 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1487 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1489 TRACE("(%p)->(%p)\n", This
, p
);
1491 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1494 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1496 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1498 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1500 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, &v
, ATTR_FIX_PX
);
1503 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1505 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1507 TRACE("(%p)->(%p)\n", This
, p
);
1509 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, p
, 0);
1512 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1514 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1516 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1518 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LINE_HEIGHT
, &v
, 0);
1521 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1523 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1525 TRACE("(%p)->(%p)\n", This
, p
);
1527 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LINE_HEIGHT
, p
, 0);
1530 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1532 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1534 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1536 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, ATTR_FIX_PX
);
1539 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1541 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1543 TRACE("(%p)->(%p)\n", This
, p
);
1545 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1548 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1550 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1552 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1554 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1557 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1559 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1560 TRACE("(%p)->(%p)\n", This
, p
);
1561 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1564 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1566 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1568 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1570 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1573 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1575 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1577 TRACE("(%p)->(%p)\n", This
, p
);
1579 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1582 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1584 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1586 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1588 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1591 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1593 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1595 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1597 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1600 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1602 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1604 TRACE("(%p)->(%p)\n", This
, p
);
1606 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1609 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1611 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1612 TRACE("(%p)->(%p)\n", This
, p
);
1613 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1616 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1618 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1620 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1622 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1625 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1627 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1629 TRACE("(%p)->(%p)\n", This
, p
);
1631 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1634 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1636 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1638 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1640 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1643 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1645 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1647 TRACE("(%p)->(%p)\n", This
, p
);
1649 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1652 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1654 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1656 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1658 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1661 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1663 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1665 TRACE("(%p)->(%p)\n", This
, p
);
1667 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1670 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1672 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1674 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1676 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1679 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1681 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1683 TRACE("(%p)->(%p)\n", This
, p
);
1685 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1688 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1690 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1692 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1694 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1697 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1699 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1701 TRACE("(%p)->(%p)\n", This
, p
);
1703 return get_style_attr(This
, STYLEID_PADDING
, p
);
1706 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1708 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1710 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1712 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1715 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1717 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1719 TRACE("(%p)->(%p)\n", This
, p
);
1721 return get_style_attr(This
, STYLEID_BORDER
, p
);
1724 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1726 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1727 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1728 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1731 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1733 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1734 TRACE("(%p)->(%p)\n", This
, p
);
1735 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1738 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1740 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1741 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1742 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1745 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1747 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1748 TRACE("(%p)->(%p)\n", This
, p
);
1749 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1752 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1754 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1755 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1756 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1759 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1761 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1762 TRACE("(%p)->(%p)\n", This
, p
);
1763 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1766 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1768 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1770 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1772 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1775 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1777 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1779 TRACE("(%p)->(%p)\n", This
, p
);
1781 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1784 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1786 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1788 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1790 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1793 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1795 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1797 TRACE("(%p)->(%p)\n", This
, p
);
1799 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1802 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1804 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1806 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1808 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1811 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1813 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1815 TRACE("(%p)->(%p)\n", This
, p
);
1817 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1820 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1822 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1824 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1826 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1829 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1831 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1833 TRACE("(%p)->(%p)\n", This
, p
);
1835 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1838 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1840 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1842 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1844 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1847 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1849 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1851 TRACE("(%p)->(%p)\n", This
, p
);
1853 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1856 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1860 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1862 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1865 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1867 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1869 TRACE("(%p)->(%p)\n", This
, p
);
1871 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1874 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1876 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1877 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1878 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1881 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1883 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1884 TRACE("(%p)->(%p)\n", This
, p
);
1885 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1888 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1890 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1892 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1894 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1897 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1899 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1901 TRACE("(%p)->(%p)\n", This
, p
);
1903 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1906 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1908 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1910 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1912 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1915 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1917 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1919 TRACE("(%p)->(%p)\n", This
, p
);
1921 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1924 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1926 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1928 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1930 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1933 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1935 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1936 TRACE("(%p)->(%p)\n", This
, p
);
1937 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1940 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1942 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1944 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1946 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1949 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1951 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1952 TRACE("(%p)->(%p)\n", This
, p
);
1953 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1956 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1958 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1959 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1960 HRESULT hres
= S_OK
;
1965 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1967 while(v
[i
] && hres
== S_OK
)
1969 if(v
[i
] == (WCHAR
)' ')
1971 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1972 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1974 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1975 hres
= E_INVALIDARG
;
1977 SysFreeString(pstyle
);
1985 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1986 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1988 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1989 hres
= E_INVALIDARG
;
1991 SysFreeString(pstyle
);
1995 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
2000 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
2002 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2003 TRACE("(%p)->(%p)\n", This
, p
);
2004 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
2007 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
2009 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2010 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2012 if(!is_valid_border_style(v
))
2013 return E_INVALIDARG
;
2015 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
2018 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
2020 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2021 TRACE("(%p)->(%p)\n", This
, p
);
2022 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
2025 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
2027 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2028 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2030 if(!is_valid_border_style(v
))
2031 return E_INVALIDARG
;
2033 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2036 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2038 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2039 TRACE("(%p)->(%p)\n", This
, p
);
2040 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2043 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2045 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2046 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2048 if(!is_valid_border_style(v
))
2049 return E_INVALIDARG
;
2051 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2054 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2056 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2057 TRACE("(%p)->(%p)\n", This
, p
);
2058 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2061 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2063 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2064 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2066 if(!is_valid_border_style(v
))
2067 return E_INVALIDARG
;
2069 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2072 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2074 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2075 TRACE("(%p)->(%p)\n", This
, p
);
2076 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2079 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2081 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2083 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2085 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2088 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2090 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2092 TRACE("(%p)->(%p)\n", This
, p
);
2094 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2097 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2099 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2101 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2103 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2106 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2108 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2110 TRACE("(%p)->(%p)\n", This
, p
);
2112 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2115 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2117 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2118 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2122 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2124 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2125 FIXME("(%p)->(%p)\n", This
, p
);
2129 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2131 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2133 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2135 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2138 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2140 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2142 TRACE("(%p)->(%p)\n", This
, p
);
2144 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2147 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2149 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2151 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2153 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2156 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2158 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2160 TRACE("(%p)->(%p)\n", This
, p
);
2162 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2165 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2167 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2169 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2171 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2174 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2176 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2178 TRACE("(%p)->(%p)\n", This
, p
);
2180 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2183 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2185 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2187 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2189 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2192 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2194 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2196 TRACE("(%p)->(%p)\n", This
, p
);
2198 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2201 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2203 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2205 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2207 return set_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, v
, 0);
2210 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2212 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2214 TRACE("(%p)->(%p)\n", This
, p
);
2216 return get_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, p
);
2219 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2221 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2222 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2226 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2228 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2229 FIXME("(%p)->(%p)\n", This
, p
);
2233 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2235 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2237 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2239 return set_style_attr(This
, STYLEID_LIST_STYLE
, v
, 0);
2242 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2244 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2246 TRACE("(%p)->(%p)\n", This
, p
);
2248 return get_style_attr(This
, STYLEID_LIST_STYLE
, p
);
2251 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2253 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2255 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2257 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2260 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2262 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2264 TRACE("(%p)->(%p)\n", This
, p
);
2266 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2269 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2271 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2273 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2275 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2278 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2280 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2282 TRACE("(%p)->(%p)\n", This
, p
);
2284 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2287 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2289 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2291 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2293 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2296 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2298 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2300 TRACE("(%p)->(%p)\n", This
, p
);
2302 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2305 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2307 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2308 TRACE("(%p)->(%p)\n", This
, p
);
2309 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2312 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2314 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2316 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2318 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2321 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2323 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2325 TRACE("(%p)->(%p)\n", This
, p
);
2327 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2330 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2332 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2333 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2334 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2335 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2336 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2338 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2340 /* overflow can only be one of the follow values. */
2341 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2342 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2344 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2347 return E_INVALIDARG
;
2351 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2353 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2355 TRACE("(%p)->(%p)\n", This
, p
);
2358 return E_INVALIDARG
;
2360 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2363 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2365 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2367 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2369 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2372 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2374 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2376 TRACE("(%p)->(%p)\n", This
, p
);
2378 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2381 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2383 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2385 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2387 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2390 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2392 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2394 TRACE("(%p)->(%p)\n", This
, p
);
2396 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2399 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2401 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2405 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2407 nsAString_InitDepend(&text_str
, v
);
2408 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2409 nsAString_Finish(&text_str
);
2410 if(NS_FAILED(nsres
)) {
2411 FIXME("SetCssStyle failed: %08x\n", nsres
);
2418 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2420 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2424 TRACE("(%p)->(%p)\n", This
, p
);
2426 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2427 nsAString_Init(&text_str
, NULL
);
2428 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2429 if(NS_SUCCEEDED(nsres
)) {
2430 const PRUnichar
*text
;
2432 nsAString_GetData(&text_str
, &text
);
2433 *p
= *text
? SysAllocString(text
) : NULL
;
2435 FIXME("GetCssStyle failed: %08x\n", nsres
);
2439 nsAString_Finish(&text_str
);
2443 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2445 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2447 TRACE("(%p)->(%d)\n", This
, v
);
2449 return set_style_pxattr(This
->nsstyle
, STYLEID_TOP
, v
);
2452 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2454 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2456 TRACE("(%p)->(%p)\n", This
, p
);
2458 return get_nsstyle_pixel_val(This
, STYLEID_TOP
, p
);
2461 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2463 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2465 TRACE("(%p)->(%d)\n", This
, v
);
2467 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2470 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2472 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2474 TRACE("(%p)->(%p)\n", This
, p
);
2476 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2479 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2481 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2483 TRACE("(%p)->()\n", This
);
2485 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2488 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2490 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2492 TRACE("(%p)->(%p)\n", This
, p
);
2494 return get_nsstyle_pixel_val(This
, STYLEID_WIDTH
, p
);
2497 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2499 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2501 TRACE("(%p)->(%d)\n", This
, v
);
2503 return set_style_pxattr(This
->nsstyle
, STYLEID_HEIGHT
, v
);
2506 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2508 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2510 TRACE("(%p)->(%p)\n", This
, p
);
2512 return get_nsstyle_pixel_val(This
, STYLEID_HEIGHT
, p
);
2515 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2517 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2519 TRACE("(%p)->(%f)\n", This
, v
);
2521 return set_style_pos(This
, STYLEID_TOP
, v
);
2524 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2526 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2528 TRACE("(%p)->(%p)\n", This
, p
);
2533 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2536 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2538 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2540 TRACE("(%p)->(%f)\n", This
, v
);
2542 return set_style_pos(This
, STYLEID_LEFT
, v
);
2545 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2547 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2549 TRACE("(%p)->(%p)\n", This
, p
);
2554 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2557 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2559 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2561 TRACE("(%p)->(%f)\n", This
, v
);
2563 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2566 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2568 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2570 TRACE("(%p)->(%p)\n", This
, p
);
2575 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2581 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2583 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2585 TRACE("(%p)->(%f)\n", This
, v
);
2587 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2590 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2592 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2594 TRACE("(%p)->(%p)\n", This
, p
);
2599 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2605 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2607 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2609 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2611 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2614 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2618 TRACE("(%p)->(%p)\n", This
, p
);
2620 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2623 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2625 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2627 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2629 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2632 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2634 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2636 TRACE("(%p)->(%p)\n", This
, p
);
2638 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2641 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2643 nsAString name_str
, val_str
, empty_str
;
2646 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2648 TRACE("%s\n", debugstr_w(val
));
2650 nsAString_InitDepend(&name_str
, opacityW
);
2651 nsAString_InitDepend(&val_str
, val
);
2652 nsAString_InitDepend(&empty_str
, emptyW
);
2654 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2655 if(NS_FAILED(nsres
))
2656 ERR("SetProperty failed: %08x\n", nsres
);
2658 nsAString_Finish(&name_str
);
2659 nsAString_Finish(&val_str
);
2660 nsAString_Finish(&empty_str
);
2663 static void update_filter(HTMLStyle
*This
)
2665 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2667 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2670 set_opacity(This
, emptyW
);
2675 while(isspaceW(*ptr
))
2681 while(isalnumW(*ptr
))
2684 WARN("unexpected char '%c'\n", *ptr
);
2688 WARN("expected '('\n");
2692 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2693 static const WCHAR formatW
[] = {'%','f',0};
2694 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2698 while(isspaceW(*ptr
))
2702 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2705 WARN("unexpected end of string\n");
2709 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2710 float fval
= 0.0f
, e
= 0.1f
;
2713 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2715 while(isdigitW(*ptr2
))
2716 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2719 while(isdigitW(*++ptr2
)) {
2720 fval
+= e
* (float)(*ptr2
++ - '0');
2725 sprintfW(buf
, formatW
, fval
* 0.01f
);
2726 set_opacity(This
, buf
);
2728 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2733 }while(*ptr
!= ')');
2735 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2736 ptr
= strchrW(ptr
, ')');
2744 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2746 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2747 WCHAR
*new_filter
= NULL
;
2749 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2752 FIXME("Element already destroyed\n");
2753 return E_UNEXPECTED
;
2757 new_filter
= heap_strdupW(v
);
2759 return E_OUTOFMEMORY
;
2762 heap_free(This
->elem
->filter
);
2763 This
->elem
->filter
= new_filter
;
2765 update_filter(This
);
2769 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2771 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2773 TRACE("(%p)->(%p)\n", This
, p
);
2776 FIXME("Element already destroyed\n");
2777 return E_UNEXPECTED
;
2780 if(This
->elem
->filter
) {
2781 *p
= SysAllocString(This
->elem
->filter
);
2783 return E_OUTOFMEMORY
;
2791 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2792 VARIANT AttributeValue
, LONG lFlags
)
2794 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2798 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2799 debugstr_variant(&AttributeValue
), lFlags
);
2801 if(!strAttributeName
)
2802 return E_INVALIDARG
;
2805 FIXME("Parameter lFlags ignored\n");
2807 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2808 LOCALE_USER_DEFAULT
, &dispid
);
2812 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2816 params
.rgvarg
= &AttributeValue
;
2817 params
.cNamedArgs
= 1;
2818 params
.rgdispidNamedArgs
= &dispidNamed
;
2820 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2821 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2825 FIXME("Custom attributes not supported.\n");
2828 TRACE("ret: %08x\n", hres
);
2833 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2834 LONG lFlags
, VARIANT
*AttributeValue
)
2836 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2840 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2841 AttributeValue
, lFlags
);
2843 if(!AttributeValue
|| !strAttributeName
)
2844 return E_INVALIDARG
;
2847 FIXME("Parameter lFlags ignored\n");
2849 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2850 LOCALE_USER_DEFAULT
, &dispid
);
2853 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2855 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2856 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2860 FIXME("Custom attributes not supported.\n");
2866 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2867 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2869 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2870 const style_tbl_entry_t
*style_entry
;
2871 nsAString name_str
, ret_str
;
2875 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2877 style_entry
= lookup_style_tbl(strAttributeName
);
2882 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2883 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2885 *pfSuccess
= VARIANT_FALSE
;
2889 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2890 if(dispid
== style_tbl
[i
].dispid
)
2894 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2895 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2896 style_entry
= style_tbl
+i
;
2899 /* filter property is a special case */
2900 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2901 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2902 heap_free(This
->elem
->filter
);
2903 This
->elem
->filter
= NULL
;
2904 update_filter(This
);
2908 nsAString_InitDepend(&name_str
, style_entry
->name
);
2909 nsAString_Init(&ret_str
, NULL
);
2910 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2911 if(NS_SUCCEEDED(nsres
)) {
2912 const PRUnichar
*ret
;
2913 nsAString_GetData(&ret_str
, &ret
);
2914 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2916 ERR("RemoveProperty failed: %08x\n", nsres
);
2918 nsAString_Finish(&name_str
);
2919 nsAString_Finish(&ret_str
);
2920 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2923 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2925 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2926 FIXME("(%p)->(%p)\n", This
, String
);
2930 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2931 HTMLStyle_QueryInterface
,
2934 HTMLStyle_GetTypeInfoCount
,
2935 HTMLStyle_GetTypeInfo
,
2936 HTMLStyle_GetIDsOfNames
,
2938 HTMLStyle_put_fontFamily
,
2939 HTMLStyle_get_fontFamily
,
2940 HTMLStyle_put_fontStyle
,
2941 HTMLStyle_get_fontStyle
,
2942 HTMLStyle_put_fontVariant
,
2943 HTMLStyle_get_fontVariant
,
2944 HTMLStyle_put_fontWeight
,
2945 HTMLStyle_get_fontWeight
,
2946 HTMLStyle_put_fontSize
,
2947 HTMLStyle_get_fontSize
,
2950 HTMLStyle_put_color
,
2951 HTMLStyle_get_color
,
2952 HTMLStyle_put_background
,
2953 HTMLStyle_get_background
,
2954 HTMLStyle_put_backgroundColor
,
2955 HTMLStyle_get_backgroundColor
,
2956 HTMLStyle_put_backgroundImage
,
2957 HTMLStyle_get_backgroundImage
,
2958 HTMLStyle_put_backgroundRepeat
,
2959 HTMLStyle_get_backgroundRepeat
,
2960 HTMLStyle_put_backgroundAttachment
,
2961 HTMLStyle_get_backgroundAttachment
,
2962 HTMLStyle_put_backgroundPosition
,
2963 HTMLStyle_get_backgroundPosition
,
2964 HTMLStyle_put_backgroundPositionX
,
2965 HTMLStyle_get_backgroundPositionX
,
2966 HTMLStyle_put_backgroundPositionY
,
2967 HTMLStyle_get_backgroundPositionY
,
2968 HTMLStyle_put_wordSpacing
,
2969 HTMLStyle_get_wordSpacing
,
2970 HTMLStyle_put_letterSpacing
,
2971 HTMLStyle_get_letterSpacing
,
2972 HTMLStyle_put_textDecoration
,
2973 HTMLStyle_get_textDecoration
,
2974 HTMLStyle_put_textDecorationNone
,
2975 HTMLStyle_get_textDecorationNone
,
2976 HTMLStyle_put_textDecorationUnderline
,
2977 HTMLStyle_get_textDecorationUnderline
,
2978 HTMLStyle_put_textDecorationOverline
,
2979 HTMLStyle_get_textDecorationOverline
,
2980 HTMLStyle_put_textDecorationLineThrough
,
2981 HTMLStyle_get_textDecorationLineThrough
,
2982 HTMLStyle_put_textDecorationBlink
,
2983 HTMLStyle_get_textDecorationBlink
,
2984 HTMLStyle_put_verticalAlign
,
2985 HTMLStyle_get_verticalAlign
,
2986 HTMLStyle_put_textTransform
,
2987 HTMLStyle_get_textTransform
,
2988 HTMLStyle_put_textAlign
,
2989 HTMLStyle_get_textAlign
,
2990 HTMLStyle_put_textIndent
,
2991 HTMLStyle_get_textIndent
,
2992 HTMLStyle_put_lineHeight
,
2993 HTMLStyle_get_lineHeight
,
2994 HTMLStyle_put_marginTop
,
2995 HTMLStyle_get_marginTop
,
2996 HTMLStyle_put_marginRight
,
2997 HTMLStyle_get_marginRight
,
2998 HTMLStyle_put_marginBottom
,
2999 HTMLStyle_get_marginBottom
,
3000 HTMLStyle_put_marginLeft
,
3001 HTMLStyle_get_marginLeft
,
3002 HTMLStyle_put_margin
,
3003 HTMLStyle_get_margin
,
3004 HTMLStyle_put_paddingTop
,
3005 HTMLStyle_get_paddingTop
,
3006 HTMLStyle_put_paddingRight
,
3007 HTMLStyle_get_paddingRight
,
3008 HTMLStyle_put_paddingBottom
,
3009 HTMLStyle_get_paddingBottom
,
3010 HTMLStyle_put_paddingLeft
,
3011 HTMLStyle_get_paddingLeft
,
3012 HTMLStyle_put_padding
,
3013 HTMLStyle_get_padding
,
3014 HTMLStyle_put_border
,
3015 HTMLStyle_get_border
,
3016 HTMLStyle_put_borderTop
,
3017 HTMLStyle_get_borderTop
,
3018 HTMLStyle_put_borderRight
,
3019 HTMLStyle_get_borderRight
,
3020 HTMLStyle_put_borderBottom
,
3021 HTMLStyle_get_borderBottom
,
3022 HTMLStyle_put_borderLeft
,
3023 HTMLStyle_get_borderLeft
,
3024 HTMLStyle_put_borderColor
,
3025 HTMLStyle_get_borderColor
,
3026 HTMLStyle_put_borderTopColor
,
3027 HTMLStyle_get_borderTopColor
,
3028 HTMLStyle_put_borderRightColor
,
3029 HTMLStyle_get_borderRightColor
,
3030 HTMLStyle_put_borderBottomColor
,
3031 HTMLStyle_get_borderBottomColor
,
3032 HTMLStyle_put_borderLeftColor
,
3033 HTMLStyle_get_borderLeftColor
,
3034 HTMLStyle_put_borderWidth
,
3035 HTMLStyle_get_borderWidth
,
3036 HTMLStyle_put_borderTopWidth
,
3037 HTMLStyle_get_borderTopWidth
,
3038 HTMLStyle_put_borderRightWidth
,
3039 HTMLStyle_get_borderRightWidth
,
3040 HTMLStyle_put_borderBottomWidth
,
3041 HTMLStyle_get_borderBottomWidth
,
3042 HTMLStyle_put_borderLeftWidth
,
3043 HTMLStyle_get_borderLeftWidth
,
3044 HTMLStyle_put_borderStyle
,
3045 HTMLStyle_get_borderStyle
,
3046 HTMLStyle_put_borderTopStyle
,
3047 HTMLStyle_get_borderTopStyle
,
3048 HTMLStyle_put_borderRightStyle
,
3049 HTMLStyle_get_borderRightStyle
,
3050 HTMLStyle_put_borderBottomStyle
,
3051 HTMLStyle_get_borderBottomStyle
,
3052 HTMLStyle_put_borderLeftStyle
,
3053 HTMLStyle_get_borderLeftStyle
,
3054 HTMLStyle_put_width
,
3055 HTMLStyle_get_width
,
3056 HTMLStyle_put_height
,
3057 HTMLStyle_get_height
,
3058 HTMLStyle_put_styleFloat
,
3059 HTMLStyle_get_styleFloat
,
3060 HTMLStyle_put_clear
,
3061 HTMLStyle_get_clear
,
3062 HTMLStyle_put_display
,
3063 HTMLStyle_get_display
,
3064 HTMLStyle_put_visibility
,
3065 HTMLStyle_get_visibility
,
3066 HTMLStyle_put_listStyleType
,
3067 HTMLStyle_get_listStyleType
,
3068 HTMLStyle_put_listStylePosition
,
3069 HTMLStyle_get_listStylePosition
,
3070 HTMLStyle_put_listStyleImage
,
3071 HTMLStyle_get_listStyleImage
,
3072 HTMLStyle_put_listStyle
,
3073 HTMLStyle_get_listStyle
,
3074 HTMLStyle_put_whiteSpace
,
3075 HTMLStyle_get_whiteSpace
,
3080 HTMLStyle_get_position
,
3081 HTMLStyle_put_zIndex
,
3082 HTMLStyle_get_zIndex
,
3083 HTMLStyle_put_overflow
,
3084 HTMLStyle_get_overflow
,
3085 HTMLStyle_put_pageBreakBefore
,
3086 HTMLStyle_get_pageBreakBefore
,
3087 HTMLStyle_put_pageBreakAfter
,
3088 HTMLStyle_get_pageBreakAfter
,
3089 HTMLStyle_put_cssText
,
3090 HTMLStyle_get_cssText
,
3091 HTMLStyle_put_pixelTop
,
3092 HTMLStyle_get_pixelTop
,
3093 HTMLStyle_put_pixelLeft
,
3094 HTMLStyle_get_pixelLeft
,
3095 HTMLStyle_put_pixelWidth
,
3096 HTMLStyle_get_pixelWidth
,
3097 HTMLStyle_put_pixelHeight
,
3098 HTMLStyle_get_pixelHeight
,
3099 HTMLStyle_put_posTop
,
3100 HTMLStyle_get_posTop
,
3101 HTMLStyle_put_posLeft
,
3102 HTMLStyle_get_posLeft
,
3103 HTMLStyle_put_posWidth
,
3104 HTMLStyle_get_posWidth
,
3105 HTMLStyle_put_posHeight
,
3106 HTMLStyle_get_posHeight
,
3107 HTMLStyle_put_cursor
,
3108 HTMLStyle_get_cursor
,
3111 HTMLStyle_put_filter
,
3112 HTMLStyle_get_filter
,
3113 HTMLStyle_setAttribute
,
3114 HTMLStyle_getAttribute
,
3115 HTMLStyle_removeAttribute
,
3119 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3121 const style_tbl_entry_t
*style_entry
;
3123 style_entry
= lookup_style_tbl(name
);
3125 *dispid
= style_entry
->dispid
;
3129 return DISP_E_UNKNOWNNAME
;
3132 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3134 HTMLStyle_get_dispid
,
3139 static const tid_t HTMLStyle_iface_tids
[] = {
3148 static dispex_static_data_t HTMLStyle_dispex
= {
3149 &HTMLStyle_dispex_vtbl
,
3152 HTMLStyle_iface_tids
3155 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3157 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3161 FIXME("NULL nselem\n");
3165 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3166 (void**)&nselemstyle
);
3167 assert(nsres
== NS_OK
);
3169 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3170 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3171 if(NS_FAILED(nsres
)) {
3172 ERR("GetStyle failed: %08x\n", nsres
);
3179 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3181 nsIDOMCSSStyleDeclaration
*nsstyle
;
3185 hres
= get_style_from_elem(elem
, &nsstyle
);
3189 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3191 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3192 return E_OUTOFMEMORY
;
3195 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3197 style
->nsstyle
= nsstyle
;
3199 HTMLStyle2_Init(style
);
3200 HTMLStyle3_Init(style
);
3202 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3204 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3210 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3212 nsIDOMCSSStyleDeclaration
*style
;
3215 hres
= get_style_from_elem(elem
, &style
);
3219 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3220 nsIDOMCSSStyleDeclaration_Release(style
);
3224 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3226 nsIDOMCSSStyleDeclaration
*style
;
3229 hres
= get_style_from_elem(elem
, &style
);
3233 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3234 nsIDOMCSSStyleDeclaration_Release(style
);