2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "mshtml_private.h"
32 #include "htmlstyle.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 static const WCHAR attrBackground
[] =
39 {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor
[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage
[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPosition
[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
46 static const WCHAR attrBackgroundPositionX
[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
48 static const WCHAR attrBackgroundPositionY
[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
50 static const WCHAR attrBackgroundRepeat
[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
52 static const WCHAR attrBorder
[] =
53 {'b','o','r','d','e','r',0};
54 static const WCHAR attrBorderBottom
[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
56 static const WCHAR attrBorderBottomColor
[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
58 static const WCHAR attrBorderBottomStyle
[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
60 static const WCHAR attrBorderBottomWidth
[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
62 static const WCHAR attrBorderColor
[] =
63 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
64 static const WCHAR attrBorderLeft
[] =
65 {'b','o','r','d','e','r','-','l','e','f','t',0};
66 static const WCHAR attrBorderLeftColor
[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
68 static const WCHAR attrBorderLeftStyle
[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
70 static const WCHAR attrBorderLeftWidth
[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
72 static const WCHAR attrBorderRight
[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
74 static const WCHAR attrBorderRightColor
[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
76 static const WCHAR attrBorderRightStyle
[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
78 static const WCHAR attrBorderRightWidth
[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
80 static const WCHAR attrBorderTop
[] =
81 {'b','o','r','d','e','r','-','t','o','p',0};
82 static const WCHAR attrBorderTopColor
[] =
83 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
84 static const WCHAR attrBorderStyle
[] =
85 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopStyle
[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopWidth
[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
90 static const WCHAR attrBorderWidth
[] =
91 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
92 static const WCHAR attrBottom
[] =
93 {'b','o','t','t','o','m',0};
94 /* FIXME: Use unprefixed version (requires Gecko changes). */
95 static const WCHAR attrBoxSizing
[] =
96 {'-','m','o','z','-','b','o','x','-','s','i','z','i','n','g',0};
97 static const WCHAR attrClear
[] =
98 {'c','l','e','a','r',0};
99 static const WCHAR attrClip
[] =
101 static const WCHAR attrColor
[] =
102 {'c','o','l','o','r',0};
103 static const WCHAR attrCursor
[] =
104 {'c','u','r','s','o','r',0};
105 static const WCHAR attrDirection
[] =
106 {'d','i','r','e','c','t','i','o','n',0};
107 static const WCHAR attrDisplay
[] =
108 {'d','i','s','p','l','a','y',0};
109 static const WCHAR attrFilter
[] =
110 {'f','i','l','e','t','e','r',0};
111 static const WCHAR attrFontFamily
[] =
112 {'f','o','n','t','-','f','a','m','i','l','y',0};
113 static const WCHAR attrFontSize
[] =
114 {'f','o','n','t','-','s','i','z','e',0};
115 static const WCHAR attrFontStyle
[] =
116 {'f','o','n','t','-','s','t','y','l','e',0};
117 static const WCHAR attrFontVariant
[] =
118 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
119 static const WCHAR attrFontWeight
[] =
120 {'f','o','n','t','-','w','e','i','g','h','t',0};
121 static const WCHAR attrHeight
[] =
122 {'h','e','i','g','h','t',0};
123 static const WCHAR attrLeft
[] =
125 static const WCHAR attrLetterSpacing
[] =
126 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
127 static const WCHAR attrLineHeight
[] =
128 {'l','i','n','e','-','h','e','i','g','h','t',0};
129 static const WCHAR attrListStyleType
[] =
130 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
131 static const WCHAR attrMargin
[] =
132 {'m','a','r','g','i','n',0};
133 static const WCHAR attrMarginBottom
[] =
134 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
135 static const WCHAR attrMarginLeft
[] =
136 {'m','a','r','g','i','n','-','l','e','f','t',0};
137 static const WCHAR attrMarginRight
[] =
138 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
139 static const WCHAR attrMarginTop
[] =
140 {'m','a','r','g','i','n','-','t','o','p',0};
141 static const WCHAR attrMinHeight
[] =
142 {'m','i','n','-','h','e','i','g','h','t',0};
143 static const WCHAR attrOutline
[] =
144 {'o','u','t','l','i','n','e',0};
145 static const WCHAR attrOverflow
[] =
146 {'o','v','e','r','f','l','o','w',0};
147 static const WCHAR attrOverflowX
[] =
148 {'o','v','e','r','f','l','o','w','-','x',0};
149 static const WCHAR attrOverflowY
[] =
150 {'o','v','e','r','f','l','o','w','-','y',0};
151 static const WCHAR attrPadding
[] =
152 {'p','a','d','d','i','n','g',0};
153 static const WCHAR attrPaddingBottom
[] =
154 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
155 static const WCHAR attrPaddingLeft
[] =
156 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
157 static const WCHAR attrPaddingRight
[] =
158 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
159 static const WCHAR attrPaddingTop
[] =
160 {'p','a','d','d','i','n','g','-','t','o','p',0};
161 static const WCHAR attrPageBreakAfter
[] =
162 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
163 static const WCHAR attrPageBreakBefore
[] =
164 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
165 static const WCHAR attrPosition
[] =
166 {'p','o','s','i','t','i','o','n',0};
167 static const WCHAR attrRight
[] =
168 {'r','i','g','h','t',0};
169 static const WCHAR attrTextAlign
[] =
170 {'t','e','x','t','-','a','l','i','g','n',0};
171 static const WCHAR attrTextDecoration
[] =
172 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
173 static const WCHAR attrTextIndent
[] =
174 {'t','e','x','t','-','i','n','d','e','n','t',0};
175 static const WCHAR attrTop
[] =
177 static const WCHAR attrVerticalAlign
[] =
178 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
179 static const WCHAR attrVisibility
[] =
180 {'v','i','s','i','b','i','l','i','t','y',0};
181 static const WCHAR attrWhiteSpace
[] =
182 {'w','h','i','t','e','-','s','p','a','c','e',0};
183 static const WCHAR attrWidth
[] =
184 {'w','i','d','t','h',0};
185 static const WCHAR attrWordSpacing
[] =
186 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
187 static const WCHAR attrWordWrap
[] =
188 {'w','o','r','d','-','w','r','a','p',0};
189 static const WCHAR attrZIndex
[] =
190 {'z','-','i','n','d','e','x',0};
193 static const WCHAR pxW
[] = {'p','x',0};
200 static const style_tbl_entry_t style_tbl
[] = {
201 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
202 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
203 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
204 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
205 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
206 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
207 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
208 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
209 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
210 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
211 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
212 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
213 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
214 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
215 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
216 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
217 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
218 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
219 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
220 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
221 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
222 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
223 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
224 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
225 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
226 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
227 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
228 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
229 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
230 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
231 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
232 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
233 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
234 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
235 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
236 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
237 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
238 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
239 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
240 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
241 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
242 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
243 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
244 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
245 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
246 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
247 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
248 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
249 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
250 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
251 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
252 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
253 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
254 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
255 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
256 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
257 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
258 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
259 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
260 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
261 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
262 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
263 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
264 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
265 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
266 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
267 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
268 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
269 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
270 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
271 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
272 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
273 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
274 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
275 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
276 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
279 static const WCHAR valLineThrough
[] =
280 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
281 static const WCHAR valUnderline
[] =
282 {'u','n','d','e','r','l','i','n','e',0};
283 static const WCHAR szNormal
[] =
284 {'n','o','r','m','a','l',0};
285 static const WCHAR styleNone
[] =
287 static const WCHAR valOverline
[] =
288 {'o','v','e','r','l','i','n','e',0};
289 static const WCHAR valBlink
[] =
290 {'b','l','i','n','k',0};
292 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
293 static const WCHAR emptyW
[] = {0};
295 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
297 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
302 c
= strcmpW(style_tbl
[i
].name
, name
);
315 static LPWSTR
fix_px_value(LPCWSTR val
)
320 while(*ptr
&& isspaceW(*ptr
))
325 while(*ptr
&& isdigitW(*ptr
))
328 if(!*ptr
|| isspaceW(*ptr
)) {
330 int len
= strlenW(val
)+1;
332 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
333 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
339 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
344 while(*ptr
&& !isspaceW(*ptr
))
351 static LPWSTR
fix_url_value(LPCWSTR val
)
355 static const WCHAR urlW
[] = {'u','r','l','('};
357 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
360 ret
= heap_strdupW(val
);
362 for(ptr
= ret
; *ptr
; ptr
++) {
370 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
372 nsAString str_name
, str_value
, str_empty
;
377 if(flags
& ATTR_FIX_PX
)
378 val
= fix_px_value(value
);
379 if(flags
& ATTR_FIX_URL
)
380 val
= fix_url_value(value
);
383 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
384 nsAString_InitDepend(&str_value
, val
? val
: value
);
385 nsAString_InitDepend(&str_empty
, emptyW
);
387 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
389 ERR("SetProperty failed: %08x\n", nsres
);
391 nsAString_Finish(&str_name
);
392 nsAString_Finish(&str_value
);
393 nsAString_Finish(&str_empty
);
399 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
410 case VT_BSTR
|VT_BYREF
:
411 *ret
= *V_BSTRREF(v
);
415 static const WCHAR formatW
[] = {'%','d',0};
416 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
418 if(flags
& ATTR_HEX_INT
)
419 wsprintfW(buf
, hex_formatW
, V_I4(v
));
420 else if(flags
& ATTR_FIX_PX
)
421 wsprintfW(buf
, px_formatW
, V_I4(v
));
423 wsprintfW(buf
, formatW
, V_I4(v
));
429 FIXME("not implemented for %s\n", debugstr_variant(v
));
435 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
441 hres
= var_to_styleval(value
, buf
, flags
, &val
);
445 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
448 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
450 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
453 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
458 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
460 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
461 if(NS_FAILED(nsres
)) {
462 ERR("SetProperty failed: %08x\n", nsres
);
466 nsAString_Finish(&str_name
);
471 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
477 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
481 ret
= SysAllocString(val
);
483 return E_OUTOFMEMORY
;
485 len
= SysStringLen(ret
);
487 if(flags
& ATTR_REMOVE_COMMA
) {
491 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
497 new_ret
= SysAllocStringLen(NULL
, new_len
);
500 return E_OUTOFMEMORY
;
503 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
517 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
520 const PRUnichar
*value
;
523 nsAString_Init(&str_value
, NULL
);
525 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
527 nsAString_GetData(&str_value
, &value
);
528 hres
= nsstyle_to_bstr(value
, flags
, p
);
529 nsAString_Finish(&str_value
);
531 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
535 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
538 const PRUnichar
*value
;
542 nsAString_Init(&str_value
, NULL
);
544 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
546 nsAString_GetData(&str_value
, &value
);
548 if(flags
& ATTR_STR_TO_INT
) {
549 const PRUnichar
*ptr
= value
;
558 while(isdigitW(*ptr
))
559 i
= i
*10 + (*ptr
++ - '0');
563 V_I4(p
) = neg
? -i
: i
;
571 hres
= nsstyle_to_bstr(value
, flags
, &str
);
572 if(SUCCEEDED(hres
)) {
578 nsAString_Finish(&str_value
);
580 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
584 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
586 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
589 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
592 const PRUnichar
*value
;
594 nsAString_Init(&str_value
, NULL
);
596 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
598 nsAString_GetData(&str_value
, &value
);
599 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
600 nsAString_Finish(&str_value
);
602 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
606 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
609 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
611 value
= floor(value
);
613 sprintfW(szValue
, szFormat
, value
);
615 return set_style_attr(This
, sid
, szValue
, 0);
618 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
622 sprintfW(value_str
, px_formatW
, value
);
624 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
627 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
632 TRACE("%p %d %p\n", This
, sid
, p
);
636 nsAString_Init(&str_value
, NULL
);
638 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
642 const PRUnichar
*value
;
644 nsAString_GetData(&str_value
, &value
);
647 *p
= strtolW(value
, &ptr
, 10);
649 if(*ptr
&& strcmpW(ptr
, pxW
))
651 nsAString_Finish(&str_value
);
652 FIXME("only px values are currently supported\n");
658 TRACE("ret %f\n", *p
);
660 nsAString_Finish(&str_value
);
664 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
669 nsAString_Init(&str_value
, NULL
);
671 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
674 const PRUnichar
*value
;
676 nsAString_GetData(&str_value
, &value
);
678 *p
= strtolW(value
, &ptr
, 10);
681 /* Skip all digits. We have tests showing that we should not round the value. */
682 while(isdigitW(*++ptr
));
685 if(*ptr
&& strcmpW(ptr
, pxW
)) {
686 nsAString_Finish(&str_value
);
687 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
695 nsAString_Finish(&str_value
);
699 static BOOL
is_valid_border_style(BSTR v
)
701 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
702 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
703 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
704 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
705 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
706 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
707 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
708 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
710 TRACE("%s\n", debugstr_w(v
));
712 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
713 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
714 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
715 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
716 strcmpiW(v
, styleOutset
) == 0 )
724 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
726 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
729 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
731 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
733 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
735 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
736 *ppv
= &This
->IHTMLStyle_iface
;
737 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
738 *ppv
= &This
->IHTMLStyle_iface
;
739 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
740 *ppv
= &This
->IHTMLStyle2_iface
;
741 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
742 *ppv
= &This
->IHTMLStyle3_iface
;
743 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
744 *ppv
= &This
->IHTMLStyle4_iface
;
745 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
746 *ppv
= &This
->IHTMLStyle5_iface
;
747 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
748 *ppv
= &This
->IHTMLStyle6_iface
;
749 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
750 return *ppv
? S_OK
: E_NOINTERFACE
;
753 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
754 return E_NOINTERFACE
;
757 IUnknown_AddRef((IUnknown
*)*ppv
);
761 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
763 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
764 LONG ref
= InterlockedIncrement(&This
->ref
);
766 TRACE("(%p) ref=%d\n", This
, ref
);
771 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
773 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
774 LONG ref
= InterlockedDecrement(&This
->ref
);
776 TRACE("(%p) ref=%d\n", This
, ref
);
781 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
782 release_dispex(&This
->dispex
);
789 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
791 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
792 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
795 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
796 LCID lcid
, ITypeInfo
**ppTInfo
)
798 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
799 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
802 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
803 LPOLESTR
*rgszNames
, UINT cNames
,
804 LCID lcid
, DISPID
*rgDispId
)
806 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
807 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
811 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
812 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
813 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
815 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
816 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
817 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
820 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
822 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
824 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
826 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
829 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
831 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
833 TRACE("(%p)->(%p)\n", This
, p
);
835 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
838 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
840 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
841 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
842 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
844 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
846 /* fontStyle can only be one of the follow values. */
847 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
848 strcmpiW(szOblique
, v
) == 0)
850 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
856 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
860 TRACE("(%p)->(%p)\n", This
, p
);
862 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
865 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
867 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
868 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
870 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
872 /* fontVariant can only be one of the follow values. */
873 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
875 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
881 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
883 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
884 TRACE("(%p)->(%p)\n", This
, p
);
889 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
892 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
894 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
895 static const WCHAR styleBold
[] = {'b','o','l','d',0};
896 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
897 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
898 static const WCHAR style100
[] = {'1','0','0',0};
899 static const WCHAR style200
[] = {'2','0','0',0};
900 static const WCHAR style300
[] = {'3','0','0',0};
901 static const WCHAR style400
[] = {'4','0','0',0};
902 static const WCHAR style500
[] = {'5','0','0',0};
903 static const WCHAR style600
[] = {'6','0','0',0};
904 static const WCHAR style700
[] = {'7','0','0',0};
905 static const WCHAR style800
[] = {'8','0','0',0};
906 static const WCHAR style900
[] = {'9','0','0',0};
908 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
910 /* fontWeight can only be one of the following */
911 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
912 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
913 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
914 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
915 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
916 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
917 strcmpiW(style900
, v
) == 0
920 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
926 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
928 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
930 TRACE("(%p)->(%p)\n", This
, p
);
932 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
935 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
937 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
939 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
941 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
944 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
946 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
948 TRACE("(%p)->(%p)\n", This
, p
);
950 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
953 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
955 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
956 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
960 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
962 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
963 FIXME("(%p)->(%p)\n", This
, p
);
967 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
969 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
971 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
973 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
976 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
978 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
980 TRACE("(%p)->(%p)\n", This
, p
);
982 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
985 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
987 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
989 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
991 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
994 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
996 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
998 TRACE("(%p)->(%p)\n", This
, p
);
1000 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
1003 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1005 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1007 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1009 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1012 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1014 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1016 TRACE("(%p)->(%p)\n", This
, p
);
1018 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1021 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1023 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1025 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1027 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1030 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1032 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1034 TRACE("(%p)->(%p)\n", This
, p
);
1036 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1039 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1041 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1042 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1043 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1044 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1045 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1047 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1049 /* fontWeight can only be one of the following */
1050 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1051 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1053 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1056 return E_INVALIDARG
;
1059 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1063 TRACE("(%p)->(%p)\n", This
, p
);
1065 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1068 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1070 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1071 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1075 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1077 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1078 FIXME("(%p)->(%p)\n", This
, p
);
1082 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1084 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1086 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1088 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1091 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1093 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1095 TRACE("(%p)->(%p)\n", This
, p
);
1097 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1100 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1102 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1103 WCHAR buf
[14], *pos_val
;
1109 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1111 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1115 val_len
= val
? strlenW(val
) : 0;
1117 nsAString_Init(&pos_str
, NULL
);
1118 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1119 if(SUCCEEDED(hres
)) {
1120 const PRUnichar
*pos
, *posy
;
1123 nsAString_GetData(&pos_str
, &pos
);
1124 posy
= strchrW(pos
, ' ');
1126 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1128 TRACE("no space in %s\n", debugstr_w(pos
));
1132 posy_len
= strlenW(posy
);
1133 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1136 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1138 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1139 pos_val
[val_len
+posy_len
] = 0;
1141 hres
= E_OUTOFMEMORY
;
1144 nsAString_Finish(&pos_str
);
1148 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1149 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1154 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1156 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1161 TRACE("(%p)->(%p)\n", This
, p
);
1163 nsAString_Init(&pos_str
, NULL
);
1164 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1165 if(SUCCEEDED(hres
)) {
1166 const PRUnichar
*pos
, *space
;
1168 nsAString_GetData(&pos_str
, &pos
);
1169 space
= strchrW(pos
, ' ');
1171 WARN("no space in %s\n", debugstr_w(pos
));
1172 space
= pos
+ strlenW(pos
);
1176 ret
= SysAllocStringLen(pos
, space
-pos
);
1178 hres
= E_OUTOFMEMORY
;
1183 nsAString_Finish(&pos_str
);
1187 TRACE("returning %s\n", debugstr_w(ret
));
1193 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1195 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1196 WCHAR buf
[14], *pos_val
;
1202 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1204 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1208 val_len
= val
? strlenW(val
) : 0;
1210 nsAString_Init(&pos_str
, NULL
);
1211 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1212 if(SUCCEEDED(hres
)) {
1213 const PRUnichar
*pos
, *space
;
1216 nsAString_GetData(&pos_str
, &pos
);
1217 space
= strchrW(pos
, ' ');
1221 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1223 TRACE("no space in %s\n", debugstr_w(pos
));
1225 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1228 posx_len
= space
-pos
;
1230 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1232 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1234 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1235 pos_val
[posx_len
+val_len
] = 0;
1237 hres
= E_OUTOFMEMORY
;
1240 nsAString_Finish(&pos_str
);
1244 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1245 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1250 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1252 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1257 TRACE("(%p)->(%p)\n", This
, p
);
1259 nsAString_Init(&pos_str
, NULL
);
1260 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1261 if(SUCCEEDED(hres
)) {
1262 const PRUnichar
*pos
, *posy
;
1264 nsAString_GetData(&pos_str
, &pos
);
1265 posy
= strchrW(pos
, ' ');
1267 ret
= SysAllocString(posy
+1);
1269 hres
= E_OUTOFMEMORY
;
1274 nsAString_Finish(&pos_str
);
1278 TRACE("returning %s\n", debugstr_w(ret
));
1284 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1286 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1288 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1290 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1293 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1295 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1296 TRACE("(%p)->(%p)\n", This
, p
);
1297 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1300 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1302 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1304 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1306 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1309 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1311 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1312 TRACE("(%p)->(%p)\n", This
, p
);
1313 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1316 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1318 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1320 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1322 /* textDecoration can only be one of the following */
1323 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1324 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1325 strcmpiW(valBlink
, v
) == 0)
1327 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1330 return E_INVALIDARG
;
1333 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1335 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1337 TRACE("(%p)->(%p)\n", This
, p
);
1339 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1342 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1344 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1346 TRACE("(%p)->(%x)\n", This
, v
);
1348 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1351 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1353 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1355 TRACE("(%p)->(%p)\n", This
, p
);
1357 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1360 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1362 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1364 TRACE("(%p)->(%x)\n", This
, v
);
1366 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1369 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1371 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1373 TRACE("(%p)->(%p)\n", This
, p
);
1375 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1378 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1380 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1382 TRACE("(%p)->(%x)\n", This
, v
);
1384 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1387 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1389 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1391 TRACE("(%p)->(%p)\n", This
, p
);
1393 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1396 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1398 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1400 TRACE("(%p)->(%x)\n", This
, v
);
1402 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1405 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1407 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1409 TRACE("(%p)->(%p)\n", This
, p
);
1411 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1414 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1416 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1418 TRACE("(%p)->(%x)\n", This
, v
);
1420 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1423 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1425 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1427 TRACE("(%p)->(%p)\n", This
, p
);
1429 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1432 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1434 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1436 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1438 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1441 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1443 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1445 TRACE("(%p)->(%p)\n", This
, p
);
1447 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1450 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1452 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1453 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1457 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1459 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1460 FIXME("(%p)->(%p)\n", This
, p
);
1464 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1466 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1468 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1470 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1473 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1475 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1477 TRACE("(%p)->(%p)\n", This
, p
);
1479 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1482 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1484 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1485 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1489 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1491 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1492 FIXME("(%p)->(%p)\n", This
, p
);
1496 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1498 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1499 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1503 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1505 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1506 FIXME("(%p)->(%p)\n", This
, p
);
1510 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1512 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1514 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1516 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, ATTR_FIX_PX
);
1519 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1521 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1523 TRACE("(%p)->(%p)\n", This
, p
);
1525 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1528 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1530 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1532 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1534 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1537 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1539 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1540 TRACE("(%p)->(%p)\n", This
, p
);
1541 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1544 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1546 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1548 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1550 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1553 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1555 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1557 TRACE("(%p)->(%p)\n", This
, p
);
1559 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1562 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1564 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1566 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1568 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1571 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1573 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1575 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1577 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1580 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1582 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1584 TRACE("(%p)->(%p)\n", This
, p
);
1586 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1589 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1591 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1592 TRACE("(%p)->(%p)\n", This
, p
);
1593 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1596 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1598 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1600 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1602 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1605 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1607 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1609 TRACE("(%p)->(%p)\n", This
, p
);
1611 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1614 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1616 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1618 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1620 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1623 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1625 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1627 TRACE("(%p)->(%p)\n", This
, p
);
1629 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1632 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1634 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1636 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1638 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1641 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1643 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1645 TRACE("(%p)->(%p)\n", This
, p
);
1647 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1650 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1652 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1654 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1656 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1659 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1661 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1663 TRACE("(%p)->(%p)\n", This
, p
);
1665 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1668 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1670 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1672 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1674 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1677 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1679 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1681 TRACE("(%p)->(%p)\n", This
, p
);
1683 return get_style_attr(This
, STYLEID_PADDING
, p
);
1686 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1688 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1690 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1692 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1695 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1697 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1699 TRACE("(%p)->(%p)\n", This
, p
);
1701 return get_style_attr(This
, STYLEID_BORDER
, p
);
1704 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1706 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1707 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1708 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1711 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1713 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1714 TRACE("(%p)->(%p)\n", This
, p
);
1715 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1718 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1720 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1721 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1722 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1725 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1727 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1728 TRACE("(%p)->(%p)\n", This
, p
);
1729 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1732 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1734 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1735 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1736 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1739 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1741 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1742 TRACE("(%p)->(%p)\n", This
, p
);
1743 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1746 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1748 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1750 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1752 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1755 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1757 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1759 TRACE("(%p)->(%p)\n", This
, p
);
1761 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1764 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1766 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1768 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1770 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1773 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1775 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1777 TRACE("(%p)->(%p)\n", This
, p
);
1779 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1782 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1786 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1788 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1791 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1793 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1795 TRACE("(%p)->(%p)\n", This
, p
);
1797 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1800 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1802 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1804 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1806 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1809 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1811 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1813 TRACE("(%p)->(%p)\n", This
, p
);
1815 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1818 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1820 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1822 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1824 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1827 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1829 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1831 TRACE("(%p)->(%p)\n", This
, p
);
1833 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1836 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1838 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1840 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1842 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1845 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1847 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1849 TRACE("(%p)->(%p)\n", This
, p
);
1851 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1854 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1856 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1857 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1858 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1861 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1863 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1864 TRACE("(%p)->(%p)\n", This
, p
);
1865 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1868 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1870 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1872 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1874 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1877 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1879 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1881 TRACE("(%p)->(%p)\n", This
, p
);
1883 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1886 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1888 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1890 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1892 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1895 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1897 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1899 TRACE("(%p)->(%p)\n", This
, p
);
1901 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1904 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1906 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1908 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1910 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1913 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1915 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1916 TRACE("(%p)->(%p)\n", This
, p
);
1917 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1920 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1922 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1924 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1926 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1929 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1931 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1932 TRACE("(%p)->(%p)\n", This
, p
);
1933 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1936 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1938 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1939 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1940 HRESULT hres
= S_OK
;
1945 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1947 while(v
[i
] && hres
== S_OK
)
1949 if(v
[i
] == (WCHAR
)' ')
1951 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1952 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1954 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1955 hres
= E_INVALIDARG
;
1957 SysFreeString(pstyle
);
1965 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1966 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1968 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1969 hres
= E_INVALIDARG
;
1971 SysFreeString(pstyle
);
1975 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1980 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
1982 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1983 TRACE("(%p)->(%p)\n", This
, p
);
1984 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
1987 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
1989 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1990 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1992 if(!is_valid_border_style(v
))
1993 return E_INVALIDARG
;
1995 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
1998 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
2000 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2001 TRACE("(%p)->(%p)\n", This
, p
);
2002 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
2005 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
2007 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2008 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2010 if(!is_valid_border_style(v
))
2011 return E_INVALIDARG
;
2013 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2016 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2018 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2019 TRACE("(%p)->(%p)\n", This
, p
);
2020 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2023 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2025 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2026 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2028 if(!is_valid_border_style(v
))
2029 return E_INVALIDARG
;
2031 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2034 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2036 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2037 TRACE("(%p)->(%p)\n", This
, p
);
2038 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2041 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2043 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2044 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2046 if(!is_valid_border_style(v
))
2047 return E_INVALIDARG
;
2049 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2052 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2054 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2055 TRACE("(%p)->(%p)\n", This
, p
);
2056 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2059 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2063 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2065 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2068 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2070 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2072 TRACE("(%p)->(%p)\n", This
, p
);
2074 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2077 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2079 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2081 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2083 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2086 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2088 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2090 TRACE("(%p)->(%p)\n", This
, p
);
2092 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2095 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2097 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2098 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2102 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2104 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2105 FIXME("(%p)->(%p)\n", This
, p
);
2109 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2111 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2113 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2115 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2118 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2120 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2122 TRACE("(%p)->(%p)\n", This
, p
);
2124 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2127 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2129 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2131 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2133 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2136 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2138 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2140 TRACE("(%p)->(%p)\n", This
, p
);
2142 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2145 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2147 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2149 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2151 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2154 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2156 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2158 TRACE("(%p)->(%p)\n", This
, p
);
2160 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2163 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2165 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2167 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2169 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2172 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2174 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2176 TRACE("(%p)->(%p)\n", This
, p
);
2178 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2181 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2183 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2184 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2188 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2190 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2191 FIXME("(%p)->(%p)\n", This
, p
);
2195 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2197 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2198 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2202 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2204 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2205 FIXME("(%p)->(%p)\n", This
, p
);
2209 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2211 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2212 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2216 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2218 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2219 FIXME("(%p)->(%p)\n", This
, p
);
2223 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2225 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2227 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2229 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2232 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2234 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2236 TRACE("(%p)->(%p)\n", This
, p
);
2238 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2241 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2243 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2245 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2247 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2250 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2252 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2254 TRACE("(%p)->(%p)\n", This
, p
);
2256 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2259 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2261 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2263 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2265 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2268 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2270 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2272 TRACE("(%p)->(%p)\n", This
, p
);
2274 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2277 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2279 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2280 TRACE("(%p)->(%p)\n", This
, p
);
2281 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2284 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2286 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2288 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2290 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2293 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2295 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2297 TRACE("(%p)->(%p)\n", This
, p
);
2299 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2302 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2304 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2305 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2306 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2307 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2308 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2310 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2312 /* overflow can only be one of the follow values. */
2313 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2314 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2316 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2319 return E_INVALIDARG
;
2323 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2325 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2327 TRACE("(%p)->(%p)\n", This
, p
);
2330 return E_INVALIDARG
;
2332 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2335 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2337 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2339 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2341 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2344 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2346 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2348 TRACE("(%p)->(%p)\n", This
, p
);
2350 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2353 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2355 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2357 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2359 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2362 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2364 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2366 TRACE("(%p)->(%p)\n", This
, p
);
2368 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2371 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2373 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2377 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2379 nsAString_InitDepend(&text_str
, v
);
2380 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2381 nsAString_Finish(&text_str
);
2382 if(NS_FAILED(nsres
)) {
2383 FIXME("SetCssStyle failed: %08x\n", nsres
);
2390 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2392 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2396 TRACE("(%p)->(%p)\n", This
, p
);
2398 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2399 nsAString_Init(&text_str
, NULL
);
2400 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2401 if(NS_SUCCEEDED(nsres
)) {
2402 const PRUnichar
*text
;
2404 nsAString_GetData(&text_str
, &text
);
2405 *p
= *text
? SysAllocString(text
) : NULL
;
2407 FIXME("GetCssStyle failed: %08x\n", nsres
);
2411 nsAString_Finish(&text_str
);
2415 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2417 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2418 FIXME("(%p)->()\n", This
);
2422 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2424 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2425 FIXME("(%p)->()\n", This
);
2429 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2431 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2433 TRACE("(%p)->(%d)\n", This
, v
);
2435 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2438 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2440 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2442 TRACE("(%p)->(%p)\n", This
, p
);
2444 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2447 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2449 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2451 TRACE("(%p)->()\n", This
);
2453 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2456 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2458 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2459 FIXME("(%p)->()\n", This
);
2463 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2465 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2466 FIXME("(%p)->()\n", This
);
2470 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2472 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2473 FIXME("(%p)->()\n", This
);
2477 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2479 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2481 TRACE("(%p)->(%f)\n", This
, v
);
2483 return set_style_pos(This
, STYLEID_TOP
, v
);
2486 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2488 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2490 TRACE("(%p)->(%p)\n", This
, p
);
2495 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2498 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2500 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2502 TRACE("(%p)->(%f)\n", This
, v
);
2504 return set_style_pos(This
, STYLEID_LEFT
, v
);
2507 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2509 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2511 TRACE("(%p)->(%p)\n", This
, p
);
2516 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2519 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2521 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2523 TRACE("(%p)->(%f)\n", This
, v
);
2525 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2528 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2530 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2532 TRACE("(%p)->(%p)\n", This
, p
);
2537 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2543 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2545 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2547 TRACE("(%p)->(%f)\n", This
, v
);
2549 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2552 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2554 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2556 TRACE("(%p)->(%p)\n", This
, p
);
2561 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2567 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2569 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2571 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2573 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2576 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2578 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2580 TRACE("(%p)->(%p)\n", This
, p
);
2582 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2585 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2587 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2589 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2591 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2594 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2596 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2598 TRACE("(%p)->(%p)\n", This
, p
);
2600 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2603 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2605 nsAString name_str
, val_str
, empty_str
;
2608 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2610 TRACE("%s\n", debugstr_w(val
));
2612 nsAString_InitDepend(&name_str
, opacityW
);
2613 nsAString_InitDepend(&val_str
, val
);
2614 nsAString_InitDepend(&empty_str
, emptyW
);
2616 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2617 if(NS_FAILED(nsres
))
2618 ERR("SetProperty failed: %08x\n", nsres
);
2620 nsAString_Finish(&name_str
);
2621 nsAString_Finish(&val_str
);
2622 nsAString_Finish(&empty_str
);
2625 static void update_filter(HTMLStyle
*This
)
2627 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2629 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2632 set_opacity(This
, emptyW
);
2637 while(isspaceW(*ptr
))
2643 while(isalnumW(*ptr
))
2646 WARN("unexpected char '%c'\n", *ptr
);
2650 WARN("expected '('\n");
2654 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2655 static const WCHAR formatW
[] = {'%','f',0};
2656 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2660 while(isspaceW(*ptr
))
2664 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2667 WARN("unexpected end of string\n");
2671 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2672 float fval
= 0.0f
, e
= 0.1f
;
2675 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2677 while(isdigitW(*ptr2
))
2678 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2681 while(isdigitW(*++ptr2
)) {
2682 fval
+= e
* (float)(*ptr2
++ - '0');
2687 sprintfW(buf
, formatW
, fval
* 0.01f
);
2688 set_opacity(This
, buf
);
2690 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2695 }while(*ptr
!= ')');
2697 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2698 ptr
= strchrW(ptr
, ')');
2706 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2708 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2709 WCHAR
*new_filter
= NULL
;
2711 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2714 FIXME("Element already destroyed\n");
2715 return E_UNEXPECTED
;
2719 new_filter
= heap_strdupW(v
);
2721 return E_OUTOFMEMORY
;
2724 heap_free(This
->elem
->filter
);
2725 This
->elem
->filter
= new_filter
;
2727 update_filter(This
);
2731 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2733 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2735 TRACE("(%p)->(%p)\n", This
, p
);
2738 FIXME("Element already destroyed\n");
2739 return E_UNEXPECTED
;
2742 if(This
->elem
->filter
) {
2743 *p
= SysAllocString(This
->elem
->filter
);
2745 return E_OUTOFMEMORY
;
2753 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2754 VARIANT AttributeValue
, LONG lFlags
)
2756 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2760 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2761 debugstr_variant(&AttributeValue
), lFlags
);
2763 if(!strAttributeName
)
2764 return E_INVALIDARG
;
2767 FIXME("Parameter lFlags ignored\n");
2769 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2770 LOCALE_USER_DEFAULT
, &dispid
);
2774 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2778 params
.rgvarg
= &AttributeValue
;
2779 params
.cNamedArgs
= 1;
2780 params
.rgdispidNamedArgs
= &dispidNamed
;
2782 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2783 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2787 FIXME("Custom attributes not supported.\n");
2790 TRACE("ret: %08x\n", hres
);
2795 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2796 LONG lFlags
, VARIANT
*AttributeValue
)
2798 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2802 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2803 AttributeValue
, lFlags
);
2805 if(!AttributeValue
|| !strAttributeName
)
2806 return E_INVALIDARG
;
2809 FIXME("Parameter lFlags ignored\n");
2811 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2812 LOCALE_USER_DEFAULT
, &dispid
);
2815 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2817 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2818 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2822 FIXME("Custom attributes not supported.\n");
2828 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2829 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2831 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2832 const style_tbl_entry_t
*style_entry
;
2833 nsAString name_str
, ret_str
;
2837 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2839 style_entry
= lookup_style_tbl(strAttributeName
);
2844 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2845 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2847 *pfSuccess
= VARIANT_FALSE
;
2851 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2852 if(dispid
== style_tbl
[i
].dispid
)
2856 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2857 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2858 style_entry
= style_tbl
+i
;
2861 /* filter property is a special case */
2862 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2863 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2864 heap_free(This
->elem
->filter
);
2865 This
->elem
->filter
= NULL
;
2866 update_filter(This
);
2870 nsAString_InitDepend(&name_str
, style_entry
->name
);
2871 nsAString_Init(&ret_str
, NULL
);
2872 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2873 if(NS_SUCCEEDED(nsres
)) {
2874 const PRUnichar
*ret
;
2875 nsAString_GetData(&ret_str
, &ret
);
2876 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2878 ERR("RemoveProperty failed: %08x\n", nsres
);
2880 nsAString_Finish(&name_str
);
2881 nsAString_Finish(&ret_str
);
2882 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2885 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2887 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2888 FIXME("(%p)->(%p)\n", This
, String
);
2892 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2893 HTMLStyle_QueryInterface
,
2896 HTMLStyle_GetTypeInfoCount
,
2897 HTMLStyle_GetTypeInfo
,
2898 HTMLStyle_GetIDsOfNames
,
2900 HTMLStyle_put_fontFamily
,
2901 HTMLStyle_get_fontFamily
,
2902 HTMLStyle_put_fontStyle
,
2903 HTMLStyle_get_fontStyle
,
2904 HTMLStyle_put_fontVariant
,
2905 HTMLStyle_get_fontVariant
,
2906 HTMLStyle_put_fontWeight
,
2907 HTMLStyle_get_fontWeight
,
2908 HTMLStyle_put_fontSize
,
2909 HTMLStyle_get_fontSize
,
2912 HTMLStyle_put_color
,
2913 HTMLStyle_get_color
,
2914 HTMLStyle_put_background
,
2915 HTMLStyle_get_background
,
2916 HTMLStyle_put_backgroundColor
,
2917 HTMLStyle_get_backgroundColor
,
2918 HTMLStyle_put_backgroundImage
,
2919 HTMLStyle_get_backgroundImage
,
2920 HTMLStyle_put_backgroundRepeat
,
2921 HTMLStyle_get_backgroundRepeat
,
2922 HTMLStyle_put_backgroundAttachment
,
2923 HTMLStyle_get_backgroundAttachment
,
2924 HTMLStyle_put_backgroundPosition
,
2925 HTMLStyle_get_backgroundPosition
,
2926 HTMLStyle_put_backgroundPositionX
,
2927 HTMLStyle_get_backgroundPositionX
,
2928 HTMLStyle_put_backgroundPositionY
,
2929 HTMLStyle_get_backgroundPositionY
,
2930 HTMLStyle_put_wordSpacing
,
2931 HTMLStyle_get_wordSpacing
,
2932 HTMLStyle_put_letterSpacing
,
2933 HTMLStyle_get_letterSpacing
,
2934 HTMLStyle_put_textDecoration
,
2935 HTMLStyle_get_textDecoration
,
2936 HTMLStyle_put_textDecorationNone
,
2937 HTMLStyle_get_textDecorationNone
,
2938 HTMLStyle_put_textDecorationUnderline
,
2939 HTMLStyle_get_textDecorationUnderline
,
2940 HTMLStyle_put_textDecorationOverline
,
2941 HTMLStyle_get_textDecorationOverline
,
2942 HTMLStyle_put_textDecorationLineThrough
,
2943 HTMLStyle_get_textDecorationLineThrough
,
2944 HTMLStyle_put_textDecorationBlink
,
2945 HTMLStyle_get_textDecorationBlink
,
2946 HTMLStyle_put_verticalAlign
,
2947 HTMLStyle_get_verticalAlign
,
2948 HTMLStyle_put_textTransform
,
2949 HTMLStyle_get_textTransform
,
2950 HTMLStyle_put_textAlign
,
2951 HTMLStyle_get_textAlign
,
2952 HTMLStyle_put_textIndent
,
2953 HTMLStyle_get_textIndent
,
2954 HTMLStyle_put_lineHeight
,
2955 HTMLStyle_get_lineHeight
,
2956 HTMLStyle_put_marginTop
,
2957 HTMLStyle_get_marginTop
,
2958 HTMLStyle_put_marginRight
,
2959 HTMLStyle_get_marginRight
,
2960 HTMLStyle_put_marginBottom
,
2961 HTMLStyle_get_marginBottom
,
2962 HTMLStyle_put_marginLeft
,
2963 HTMLStyle_get_marginLeft
,
2964 HTMLStyle_put_margin
,
2965 HTMLStyle_get_margin
,
2966 HTMLStyle_put_paddingTop
,
2967 HTMLStyle_get_paddingTop
,
2968 HTMLStyle_put_paddingRight
,
2969 HTMLStyle_get_paddingRight
,
2970 HTMLStyle_put_paddingBottom
,
2971 HTMLStyle_get_paddingBottom
,
2972 HTMLStyle_put_paddingLeft
,
2973 HTMLStyle_get_paddingLeft
,
2974 HTMLStyle_put_padding
,
2975 HTMLStyle_get_padding
,
2976 HTMLStyle_put_border
,
2977 HTMLStyle_get_border
,
2978 HTMLStyle_put_borderTop
,
2979 HTMLStyle_get_borderTop
,
2980 HTMLStyle_put_borderRight
,
2981 HTMLStyle_get_borderRight
,
2982 HTMLStyle_put_borderBottom
,
2983 HTMLStyle_get_borderBottom
,
2984 HTMLStyle_put_borderLeft
,
2985 HTMLStyle_get_borderLeft
,
2986 HTMLStyle_put_borderColor
,
2987 HTMLStyle_get_borderColor
,
2988 HTMLStyle_put_borderTopColor
,
2989 HTMLStyle_get_borderTopColor
,
2990 HTMLStyle_put_borderRightColor
,
2991 HTMLStyle_get_borderRightColor
,
2992 HTMLStyle_put_borderBottomColor
,
2993 HTMLStyle_get_borderBottomColor
,
2994 HTMLStyle_put_borderLeftColor
,
2995 HTMLStyle_get_borderLeftColor
,
2996 HTMLStyle_put_borderWidth
,
2997 HTMLStyle_get_borderWidth
,
2998 HTMLStyle_put_borderTopWidth
,
2999 HTMLStyle_get_borderTopWidth
,
3000 HTMLStyle_put_borderRightWidth
,
3001 HTMLStyle_get_borderRightWidth
,
3002 HTMLStyle_put_borderBottomWidth
,
3003 HTMLStyle_get_borderBottomWidth
,
3004 HTMLStyle_put_borderLeftWidth
,
3005 HTMLStyle_get_borderLeftWidth
,
3006 HTMLStyle_put_borderStyle
,
3007 HTMLStyle_get_borderStyle
,
3008 HTMLStyle_put_borderTopStyle
,
3009 HTMLStyle_get_borderTopStyle
,
3010 HTMLStyle_put_borderRightStyle
,
3011 HTMLStyle_get_borderRightStyle
,
3012 HTMLStyle_put_borderBottomStyle
,
3013 HTMLStyle_get_borderBottomStyle
,
3014 HTMLStyle_put_borderLeftStyle
,
3015 HTMLStyle_get_borderLeftStyle
,
3016 HTMLStyle_put_width
,
3017 HTMLStyle_get_width
,
3018 HTMLStyle_put_height
,
3019 HTMLStyle_get_height
,
3020 HTMLStyle_put_styleFloat
,
3021 HTMLStyle_get_styleFloat
,
3022 HTMLStyle_put_clear
,
3023 HTMLStyle_get_clear
,
3024 HTMLStyle_put_display
,
3025 HTMLStyle_get_display
,
3026 HTMLStyle_put_visibility
,
3027 HTMLStyle_get_visibility
,
3028 HTMLStyle_put_listStyleType
,
3029 HTMLStyle_get_listStyleType
,
3030 HTMLStyle_put_listStylePosition
,
3031 HTMLStyle_get_listStylePosition
,
3032 HTMLStyle_put_listStyleImage
,
3033 HTMLStyle_get_listStyleImage
,
3034 HTMLStyle_put_listStyle
,
3035 HTMLStyle_get_listStyle
,
3036 HTMLStyle_put_whiteSpace
,
3037 HTMLStyle_get_whiteSpace
,
3042 HTMLStyle_get_position
,
3043 HTMLStyle_put_zIndex
,
3044 HTMLStyle_get_zIndex
,
3045 HTMLStyle_put_overflow
,
3046 HTMLStyle_get_overflow
,
3047 HTMLStyle_put_pageBreakBefore
,
3048 HTMLStyle_get_pageBreakBefore
,
3049 HTMLStyle_put_pageBreakAfter
,
3050 HTMLStyle_get_pageBreakAfter
,
3051 HTMLStyle_put_cssText
,
3052 HTMLStyle_get_cssText
,
3053 HTMLStyle_put_pixelTop
,
3054 HTMLStyle_get_pixelTop
,
3055 HTMLStyle_put_pixelLeft
,
3056 HTMLStyle_get_pixelLeft
,
3057 HTMLStyle_put_pixelWidth
,
3058 HTMLStyle_get_pixelWidth
,
3059 HTMLStyle_put_pixelHeight
,
3060 HTMLStyle_get_pixelHeight
,
3061 HTMLStyle_put_posTop
,
3062 HTMLStyle_get_posTop
,
3063 HTMLStyle_put_posLeft
,
3064 HTMLStyle_get_posLeft
,
3065 HTMLStyle_put_posWidth
,
3066 HTMLStyle_get_posWidth
,
3067 HTMLStyle_put_posHeight
,
3068 HTMLStyle_get_posHeight
,
3069 HTMLStyle_put_cursor
,
3070 HTMLStyle_get_cursor
,
3073 HTMLStyle_put_filter
,
3074 HTMLStyle_get_filter
,
3075 HTMLStyle_setAttribute
,
3076 HTMLStyle_getAttribute
,
3077 HTMLStyle_removeAttribute
,
3081 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3083 const style_tbl_entry_t
*style_entry
;
3085 style_entry
= lookup_style_tbl(name
);
3087 *dispid
= style_entry
->dispid
;
3091 return DISP_E_UNKNOWNNAME
;
3094 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3096 HTMLStyle_get_dispid
,
3101 static const tid_t HTMLStyle_iface_tids
[] = {
3110 static dispex_static_data_t HTMLStyle_dispex
= {
3111 &HTMLStyle_dispex_vtbl
,
3114 HTMLStyle_iface_tids
3117 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3119 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3123 FIXME("NULL nselem\n");
3127 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3128 (void**)&nselemstyle
);
3129 assert(nsres
== NS_OK
);
3131 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3132 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3133 if(NS_FAILED(nsres
)) {
3134 ERR("GetStyle failed: %08x\n", nsres
);
3141 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3143 nsIDOMCSSStyleDeclaration
*nsstyle
;
3147 hres
= get_style_from_elem(elem
, &nsstyle
);
3151 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3153 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3154 return E_OUTOFMEMORY
;
3157 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3159 style
->nsstyle
= nsstyle
;
3161 HTMLStyle2_Init(style
);
3162 HTMLStyle3_Init(style
);
3164 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3166 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3172 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3174 nsIDOMCSSStyleDeclaration
*style
;
3177 hres
= get_style_from_elem(elem
, &style
);
3181 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3182 nsIDOMCSSStyleDeclaration_Release(style
);
3186 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3188 nsIDOMCSSStyleDeclaration
*style
;
3191 hres
= get_style_from_elem(elem
, &style
);
3195 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3196 nsIDOMCSSStyleDeclaration_Release(style
);