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 static const WCHAR attrClear
[] =
95 {'c','l','e','a','r',0};
96 static const WCHAR attrClip
[] =
98 static const WCHAR attrColor
[] =
99 {'c','o','l','o','r',0};
100 static const WCHAR attrCursor
[] =
101 {'c','u','r','s','o','r',0};
102 static const WCHAR attrDirection
[] =
103 {'d','i','r','e','c','t','i','o','n',0};
104 static const WCHAR attrDisplay
[] =
105 {'d','i','s','p','l','a','y',0};
106 static const WCHAR attrFilter
[] =
107 {'f','i','l','e','t','e','r',0};
108 static const WCHAR attrFontFamily
[] =
109 {'f','o','n','t','-','f','a','m','i','l','y',0};
110 static const WCHAR attrFontSize
[] =
111 {'f','o','n','t','-','s','i','z','e',0};
112 static const WCHAR attrFontStyle
[] =
113 {'f','o','n','t','-','s','t','y','l','e',0};
114 static const WCHAR attrFontVariant
[] =
115 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
116 static const WCHAR attrFontWeight
[] =
117 {'f','o','n','t','-','w','e','i','g','h','t',0};
118 static const WCHAR attrHeight
[] =
119 {'h','e','i','g','h','t',0};
120 static const WCHAR attrLeft
[] =
122 static const WCHAR attrLetterSpacing
[] =
123 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
124 static const WCHAR attrLineHeight
[] =
125 {'l','i','n','e','-','h','e','i','g','h','t',0};
126 static const WCHAR attrMargin
[] =
127 {'m','a','r','g','i','n',0};
128 static const WCHAR attrMarginBottom
[] =
129 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
130 static const WCHAR attrMarginLeft
[] =
131 {'m','a','r','g','i','n','-','l','e','f','t',0};
132 static const WCHAR attrMarginRight
[] =
133 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
134 static const WCHAR attrMarginTop
[] =
135 {'m','a','r','g','i','n','-','t','o','p',0};
136 static const WCHAR attrMinHeight
[] =
137 {'m','i','n','-','h','e','i','g','h','t',0};
138 static const WCHAR attrOverflow
[] =
139 {'o','v','e','r','f','l','o','w',0};
140 static const WCHAR attrOverflowX
[] =
141 {'o','v','e','r','f','l','o','w','-','x',0};
142 static const WCHAR attrOverflowY
[] =
143 {'o','v','e','r','f','l','o','w','-','y',0};
144 static const WCHAR attrPadding
[] =
145 {'p','a','d','d','i','n','g',0};
146 static const WCHAR attrPaddingBottom
[] =
147 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
148 static const WCHAR attrPaddingLeft
[] =
149 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
150 static const WCHAR attrPaddingRight
[] =
151 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
152 static const WCHAR attrPaddingTop
[] =
153 {'p','a','d','d','i','n','g','-','t','o','p',0};
154 static const WCHAR attrPageBreakAfter
[] =
155 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
156 static const WCHAR attrPageBreakBefore
[] =
157 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
158 static const WCHAR attrPosition
[] =
159 {'p','o','s','i','t','i','o','n',0};
160 static const WCHAR attrRight
[] =
161 {'r','i','g','h','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 attrTop
[] =
170 static const WCHAR attrVerticalAlign
[] =
171 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
172 static const WCHAR attrVisibility
[] =
173 {'v','i','s','i','b','i','l','i','t','y',0};
174 static const WCHAR attrWidth
[] =
175 {'w','i','d','t','h',0};
176 static const WCHAR attrWordSpacing
[] =
177 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
178 static const WCHAR attrWordWrap
[] =
179 {'w','o','r','d','-','w','r','a','p',0};
180 static const WCHAR attrZIndex
[] =
181 {'z','-','i','n','d','e','x',0};
184 static const WCHAR pxW
[] = {'p','x',0};
191 static const style_tbl_entry_t style_tbl
[] = {
192 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
193 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
194 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
195 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
196 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
197 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
198 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
199 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
200 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
201 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
202 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
203 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
204 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
205 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
206 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
207 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
208 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
209 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
210 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
211 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
212 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
213 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
214 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
215 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
216 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
217 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
218 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
219 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
220 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
221 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
222 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
223 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
224 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
225 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
226 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
227 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
228 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
229 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
230 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
231 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
232 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
233 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
234 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
235 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
236 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
237 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
238 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
239 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
240 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
241 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
242 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
243 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
244 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
245 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
246 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
247 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
248 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
249 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
250 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
251 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
252 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
253 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
254 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
255 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
256 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
257 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
258 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
259 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
260 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
261 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
262 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
263 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
266 static const WCHAR valLineThrough
[] =
267 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
268 static const WCHAR valUnderline
[] =
269 {'u','n','d','e','r','l','i','n','e',0};
270 static const WCHAR szNormal
[] =
271 {'n','o','r','m','a','l',0};
272 static const WCHAR styleNone
[] =
274 static const WCHAR valOverline
[] =
275 {'o','v','e','r','l','i','n','e',0};
276 static const WCHAR valBlink
[] =
277 {'b','l','i','n','k',0};
279 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
280 static const WCHAR emptyW
[] = {0};
282 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
284 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
289 c
= strcmpW(style_tbl
[i
].name
, name
);
302 static LPWSTR
fix_px_value(LPCWSTR val
)
307 while(*ptr
&& isspaceW(*ptr
))
312 while(*ptr
&& isdigitW(*ptr
))
315 if(!*ptr
|| isspaceW(*ptr
)) {
317 int len
= strlenW(val
)+1;
319 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
320 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
326 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
331 while(*ptr
&& !isspaceW(*ptr
))
338 static LPWSTR
fix_url_value(LPCWSTR val
)
342 static const WCHAR urlW
[] = {'u','r','l','('};
344 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
347 ret
= heap_strdupW(val
);
349 for(ptr
= ret
; *ptr
; ptr
++) {
357 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
359 nsAString str_name
, str_value
, str_empty
;
364 if(flags
& ATTR_FIX_PX
)
365 val
= fix_px_value(value
);
366 if(flags
& ATTR_FIX_URL
)
367 val
= fix_url_value(value
);
370 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
371 nsAString_InitDepend(&str_value
, val
? val
: value
);
372 nsAString_InitDepend(&str_empty
, emptyW
);
374 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
376 ERR("SetProperty failed: %08x\n", nsres
);
378 nsAString_Finish(&str_name
);
379 nsAString_Finish(&str_value
);
380 nsAString_Finish(&str_empty
);
386 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
397 case VT_BSTR
|VT_BYREF
:
398 *ret
= *V_BSTRREF(v
);
402 static const WCHAR formatW
[] = {'%','d',0};
403 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
405 if(flags
& ATTR_HEX_INT
)
406 wsprintfW(buf
, hex_formatW
, V_I4(v
));
407 else if(flags
& ATTR_FIX_PX
)
408 wsprintfW(buf
, px_formatW
, V_I4(v
));
410 wsprintfW(buf
, formatW
, V_I4(v
));
416 FIXME("not implemented for %s\n", debugstr_variant(v
));
422 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
428 hres
= var_to_styleval(value
, buf
, flags
, &val
);
432 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
435 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
437 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
440 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
445 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
447 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
448 if(NS_FAILED(nsres
)) {
449 ERR("SetProperty failed: %08x\n", nsres
);
453 nsAString_Finish(&str_name
);
458 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
468 ret
= SysAllocString(val
);
470 return E_OUTOFMEMORY
;
472 len
= SysStringLen(ret
);
474 if(flags
& ATTR_REMOVE_COMMA
) {
478 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
484 new_ret
= SysAllocStringLen(NULL
, new_len
);
487 return E_OUTOFMEMORY
;
490 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
504 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
507 const PRUnichar
*value
;
510 nsAString_Init(&str_value
, NULL
);
512 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
514 nsAString_GetData(&str_value
, &value
);
515 hres
= nsstyle_to_bstr(value
, flags
, p
);
516 nsAString_Finish(&str_value
);
518 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
522 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
525 const PRUnichar
*value
;
529 nsAString_Init(&str_value
, NULL
);
531 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
533 nsAString_GetData(&str_value
, &value
);
535 if(flags
& ATTR_STR_TO_INT
) {
536 const PRUnichar
*ptr
= value
;
545 while(isdigitW(*ptr
))
546 i
= i
*10 + (*ptr
++ - '0');
550 V_I4(p
) = neg
? -i
: i
;
558 hres
= nsstyle_to_bstr(value
, flags
, &str
);
559 if(SUCCEEDED(hres
)) {
565 nsAString_Finish(&str_value
);
567 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
571 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
573 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
576 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
579 const PRUnichar
*value
;
581 nsAString_Init(&str_value
, NULL
);
583 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
585 nsAString_GetData(&str_value
, &value
);
586 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
587 nsAString_Finish(&str_value
);
589 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
593 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
596 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
598 value
= floor(value
);
600 sprintfW(szValue
, szFormat
, value
);
602 return set_style_attr(This
, sid
, szValue
, 0);
605 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
609 sprintfW(value_str
, px_formatW
, value
);
611 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
614 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
619 TRACE("%p %d %p\n", This
, sid
, p
);
623 nsAString_Init(&str_value
, NULL
);
625 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
629 const PRUnichar
*value
;
631 nsAString_GetData(&str_value
, &value
);
634 *p
= strtolW(value
, &ptr
, 10);
636 if(*ptr
&& strcmpW(ptr
, pxW
))
638 nsAString_Finish(&str_value
);
639 FIXME("only px values are currently supported\n");
645 TRACE("ret %f\n", *p
);
647 nsAString_Finish(&str_value
);
651 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
656 nsAString_Init(&str_value
, NULL
);
658 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
661 const PRUnichar
*value
;
663 nsAString_GetData(&str_value
, &value
);
665 *p
= strtolW(value
, &ptr
, 10);
668 /* Skip all digits. We have tests showing that we should not round the value. */
669 while(isdigitW(*++ptr
));
672 if(*ptr
&& strcmpW(ptr
, pxW
)) {
673 nsAString_Finish(&str_value
);
674 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
682 nsAString_Finish(&str_value
);
686 static BOOL
is_valid_border_style(BSTR v
)
688 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
689 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
690 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
691 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
692 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
693 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
694 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
695 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
697 TRACE("%s\n", debugstr_w(v
));
699 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
700 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
701 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
702 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
703 strcmpiW(v
, styleOutset
) == 0 )
711 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
713 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
716 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
718 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
722 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
723 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
724 *ppv
= &This
->IHTMLStyle_iface
;
725 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
726 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This
, ppv
);
727 *ppv
= &This
->IHTMLStyle_iface
;
728 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
729 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This
, ppv
);
730 *ppv
= &This
->IHTMLStyle2_iface
;
731 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
732 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This
, ppv
);
733 *ppv
= &This
->IHTMLStyle3_iface
;
734 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
735 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This
, ppv
);
736 *ppv
= &This
->IHTMLStyle4_iface
;
737 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
738 TRACE("(%p)->(IID_IHTMLStyle5 %p)\n", This
, ppv
);
739 *ppv
= &This
->IHTMLStyle5_iface
;
740 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
741 TRACE("(%p)->(IID_IHTMLStyle6 %p)\n", This
, ppv
);
742 *ppv
= &This
->IHTMLStyle6_iface
;
743 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
744 return *ppv
? S_OK
: E_NOINTERFACE
;
748 IUnknown_AddRef((IUnknown
*)*ppv
);
752 WARN("unsupported %s\n", debugstr_guid(riid
));
753 return E_NOINTERFACE
;
756 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
758 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
759 LONG ref
= InterlockedIncrement(&This
->ref
);
761 TRACE("(%p) ref=%d\n", This
, ref
);
766 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
768 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
769 LONG ref
= InterlockedDecrement(&This
->ref
);
771 TRACE("(%p) ref=%d\n", This
, ref
);
776 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
777 release_dispex(&This
->dispex
);
784 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
786 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
787 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
790 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
791 LCID lcid
, ITypeInfo
**ppTInfo
)
793 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
794 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
797 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
798 LPOLESTR
*rgszNames
, UINT cNames
,
799 LCID lcid
, DISPID
*rgDispId
)
801 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
802 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
806 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
807 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
808 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
810 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
811 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
812 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
815 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
817 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
819 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
821 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
824 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
826 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
828 TRACE("(%p)->(%p)\n", This
, p
);
830 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
833 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
835 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
836 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
837 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
839 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
841 /* fontStyle can only be one of the follow values. */
842 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
843 strcmpiW(szOblique
, v
) == 0)
845 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
851 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
853 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
855 TRACE("(%p)->(%p)\n", This
, p
);
857 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
860 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
862 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
863 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
865 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
867 /* fontVariant can only be one of the follow values. */
868 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
870 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
876 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
878 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
879 TRACE("(%p)->(%p)\n", This
, p
);
884 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
887 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
889 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
890 static const WCHAR styleBold
[] = {'b','o','l','d',0};
891 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
892 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
893 static const WCHAR style100
[] = {'1','0','0',0};
894 static const WCHAR style200
[] = {'2','0','0',0};
895 static const WCHAR style300
[] = {'3','0','0',0};
896 static const WCHAR style400
[] = {'4','0','0',0};
897 static const WCHAR style500
[] = {'5','0','0',0};
898 static const WCHAR style600
[] = {'6','0','0',0};
899 static const WCHAR style700
[] = {'7','0','0',0};
900 static const WCHAR style800
[] = {'8','0','0',0};
901 static const WCHAR style900
[] = {'9','0','0',0};
903 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
905 /* fontWeight can only be one of the following */
906 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
907 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
908 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
909 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
910 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
911 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
912 strcmpiW(style900
, v
) == 0
915 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
921 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
923 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
925 TRACE("(%p)->(%p)\n", This
, p
);
927 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
930 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
932 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
934 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
936 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
939 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
941 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
943 TRACE("(%p)->(%p)\n", This
, p
);
945 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
948 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
950 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
951 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
955 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
957 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
958 FIXME("(%p)->(%p)\n", This
, p
);
962 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
964 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
966 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
968 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
971 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
973 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
975 TRACE("(%p)->(%p)\n", This
, p
);
977 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
980 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
982 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
984 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
986 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
989 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
991 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
993 TRACE("(%p)->(%p)\n", This
, p
);
995 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
998 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1000 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1002 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1004 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1007 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1009 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1011 TRACE("(%p)->(%p)\n", This
, p
);
1013 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1016 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1018 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1020 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1022 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1025 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1027 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1029 TRACE("(%p)->(%p)\n", This
, p
);
1031 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1034 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1036 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1037 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1038 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1039 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1040 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1042 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1044 /* fontWeight can only be one of the following */
1045 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1046 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1048 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1051 return E_INVALIDARG
;
1054 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1056 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1058 TRACE("(%p)->(%p)\n", This
, p
);
1060 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1063 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1065 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1066 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1070 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1072 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1073 FIXME("(%p)->(%p)\n", This
, p
);
1077 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1079 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1081 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1083 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1086 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1088 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1090 TRACE("(%p)->(%p)\n", This
, p
);
1092 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1095 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1097 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1098 WCHAR buf
[14], *pos_val
;
1104 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1106 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1110 val_len
= val
? strlenW(val
) : 0;
1112 nsAString_Init(&pos_str
, NULL
);
1113 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1114 if(SUCCEEDED(hres
)) {
1115 const PRUnichar
*pos
, *posy
;
1118 nsAString_GetData(&pos_str
, &pos
);
1119 posy
= strchrW(pos
, ' ');
1121 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1123 TRACE("no space in %s\n", debugstr_w(pos
));
1127 posy_len
= strlenW(posy
);
1128 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1131 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1133 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1134 pos_val
[val_len
+posy_len
] = 0;
1136 hres
= E_OUTOFMEMORY
;
1139 nsAString_Finish(&pos_str
);
1143 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1144 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1149 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1151 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1156 TRACE("(%p)->(%p)\n", This
, p
);
1158 nsAString_Init(&pos_str
, NULL
);
1159 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1160 if(SUCCEEDED(hres
)) {
1161 const PRUnichar
*pos
, *space
;
1163 nsAString_GetData(&pos_str
, &pos
);
1164 space
= strchrW(pos
, ' ');
1166 WARN("no space in %s\n", debugstr_w(pos
));
1167 space
= pos
+ strlenW(pos
);
1171 ret
= SysAllocStringLen(pos
, space
-pos
);
1173 hres
= E_OUTOFMEMORY
;
1178 nsAString_Finish(&pos_str
);
1182 TRACE("returning %s\n", debugstr_w(ret
));
1188 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1190 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1191 WCHAR buf
[14], *pos_val
;
1197 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1199 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1203 val_len
= val
? strlenW(val
) : 0;
1205 nsAString_Init(&pos_str
, NULL
);
1206 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1207 if(SUCCEEDED(hres
)) {
1208 const PRUnichar
*pos
, *space
;
1211 nsAString_GetData(&pos_str
, &pos
);
1212 space
= strchrW(pos
, ' ');
1216 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1218 TRACE("no space in %s\n", debugstr_w(pos
));
1220 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1223 posx_len
= space
-pos
;
1225 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1227 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1229 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1230 pos_val
[posx_len
+val_len
] = 0;
1232 hres
= E_OUTOFMEMORY
;
1235 nsAString_Finish(&pos_str
);
1239 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1240 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1245 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1247 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1252 TRACE("(%p)->(%p)\n", This
, p
);
1254 nsAString_Init(&pos_str
, NULL
);
1255 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1256 if(SUCCEEDED(hres
)) {
1257 const PRUnichar
*pos
, *posy
;
1259 nsAString_GetData(&pos_str
, &pos
);
1260 posy
= strchrW(pos
, ' ');
1262 ret
= SysAllocString(posy
+1);
1264 hres
= E_OUTOFMEMORY
;
1269 nsAString_Finish(&pos_str
);
1273 TRACE("returning %s\n", debugstr_w(ret
));
1279 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1281 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1283 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1285 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1288 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1290 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1291 TRACE("(%p)->(%p)\n", This
, p
);
1292 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1295 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1297 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1299 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1301 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1304 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1306 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1307 TRACE("(%p)->(%p)\n", This
, p
);
1308 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1311 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1313 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1315 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1317 /* textDecoration can only be one of the following */
1318 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1319 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1320 strcmpiW(valBlink
, v
) == 0)
1322 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1325 return E_INVALIDARG
;
1328 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1330 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1332 TRACE("(%p)->(%p)\n", This
, p
);
1334 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1337 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1339 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1341 TRACE("(%p)->(%x)\n", This
, v
);
1343 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1346 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1348 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1350 TRACE("(%p)->(%p)\n", This
, p
);
1352 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1355 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1357 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1359 TRACE("(%p)->(%x)\n", This
, v
);
1361 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1364 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1366 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1368 TRACE("(%p)->(%p)\n", This
, p
);
1370 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1373 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1375 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1377 TRACE("(%p)->(%x)\n", This
, v
);
1379 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1382 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1384 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1386 TRACE("(%p)->(%p)\n", This
, p
);
1388 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1391 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1393 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1395 TRACE("(%p)->(%x)\n", This
, v
);
1397 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1400 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1402 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1404 TRACE("(%p)->(%p)\n", This
, p
);
1406 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1409 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1411 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1413 TRACE("(%p)->(%x)\n", This
, v
);
1415 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1418 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1420 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1422 TRACE("(%p)->(%p)\n", This
, p
);
1424 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1427 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1429 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1431 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1433 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1436 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1438 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1440 TRACE("(%p)->(%p)\n", This
, p
);
1442 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1445 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1447 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1448 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1452 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1454 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1455 FIXME("(%p)->(%p)\n", This
, p
);
1459 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1461 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1463 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1465 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1468 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1470 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1472 TRACE("(%p)->(%p)\n", This
, p
);
1474 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1477 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1479 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1480 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1484 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1486 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1487 FIXME("(%p)->(%p)\n", This
, p
);
1491 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1493 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1494 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1498 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1500 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1501 FIXME("(%p)->(%p)\n", This
, p
);
1505 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1507 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1509 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1511 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, ATTR_FIX_PX
);
1514 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1516 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1518 TRACE("(%p)->(%p)\n", This
, p
);
1520 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1523 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1525 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1527 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1529 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1532 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1534 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1535 TRACE("(%p)->(%p)\n", This
, p
);
1536 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1539 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1541 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1543 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1545 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1548 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1550 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1552 TRACE("(%p)->(%p)\n", This
, p
);
1554 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1557 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1559 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1561 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1563 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1566 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1568 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1570 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1572 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1575 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1577 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1579 TRACE("(%p)->(%p)\n", This
, p
);
1581 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1584 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1586 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1587 TRACE("(%p)->(%p)\n", This
, p
);
1588 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1591 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1593 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1595 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1597 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1600 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1602 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1604 TRACE("(%p)->(%p)\n", This
, p
);
1606 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1609 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1611 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1613 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1615 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1618 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1620 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1622 TRACE("(%p)->(%p)\n", This
, p
);
1624 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1627 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1629 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1631 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1633 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1636 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1638 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1640 TRACE("(%p)->(%p)\n", This
, p
);
1642 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1645 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1647 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1649 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1651 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1654 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1656 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1658 TRACE("(%p)->(%p)\n", This
, p
);
1660 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1663 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1665 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1667 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1669 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1672 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1674 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1676 TRACE("(%p)->(%p)\n", This
, p
);
1678 return get_style_attr(This
, STYLEID_PADDING
, p
);
1681 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1683 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1685 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1687 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1690 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1692 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1694 TRACE("(%p)->(%p)\n", This
, p
);
1696 return get_style_attr(This
, STYLEID_BORDER
, p
);
1699 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1701 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1702 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1703 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1706 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1708 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1709 TRACE("(%p)->(%p)\n", This
, p
);
1710 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1713 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1715 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1716 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1717 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1720 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1722 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1723 TRACE("(%p)->(%p)\n", This
, p
);
1724 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1727 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1729 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1730 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1731 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1734 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1736 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1737 TRACE("(%p)->(%p)\n", This
, p
);
1738 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1741 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1743 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1745 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1747 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1750 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1752 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1754 TRACE("(%p)->(%p)\n", This
, p
);
1756 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1759 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1761 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1763 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1765 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1768 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1770 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1772 TRACE("(%p)->(%p)\n", This
, p
);
1774 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1777 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1779 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1781 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1783 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1786 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1788 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1790 TRACE("(%p)->(%p)\n", This
, p
);
1792 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1795 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1797 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1799 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1801 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1804 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1806 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1808 TRACE("(%p)->(%p)\n", This
, p
);
1810 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1813 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1815 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1817 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1819 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1822 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1824 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1826 TRACE("(%p)->(%p)\n", This
, p
);
1828 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1831 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1833 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1835 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1837 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1840 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1842 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1844 TRACE("(%p)->(%p)\n", This
, p
);
1846 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1849 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1851 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1852 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1853 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1856 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1859 TRACE("(%p)->(%p)\n", This
, p
);
1860 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1863 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1865 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1867 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1869 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1872 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1874 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1876 TRACE("(%p)->(%p)\n", This
, p
);
1878 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1881 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1883 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1885 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1887 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1890 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1892 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1894 TRACE("(%p)->(%p)\n", This
, p
);
1896 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1899 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1901 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1903 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1905 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1908 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1910 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1911 TRACE("(%p)->(%p)\n", This
, p
);
1912 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1915 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1917 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1919 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1921 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1924 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1926 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1927 TRACE("(%p)->(%p)\n", This
, p
);
1928 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1931 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1933 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1934 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1935 HRESULT hres
= S_OK
;
1940 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1942 while(v
[i
] && hres
== S_OK
)
1944 if(v
[i
] == (WCHAR
)' ')
1946 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1947 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1949 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1950 hres
= E_INVALIDARG
;
1952 SysFreeString(pstyle
);
1960 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1961 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1963 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1964 hres
= E_INVALIDARG
;
1966 SysFreeString(pstyle
);
1970 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1975 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
1977 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1978 TRACE("(%p)->(%p)\n", This
, p
);
1979 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
1982 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
1984 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1985 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1987 if(!is_valid_border_style(v
))
1988 return E_INVALIDARG
;
1990 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
1993 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
1995 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1996 TRACE("(%p)->(%p)\n", This
, p
);
1997 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
2000 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
2002 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2003 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2005 if(!is_valid_border_style(v
))
2006 return E_INVALIDARG
;
2008 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2011 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2013 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2014 TRACE("(%p)->(%p)\n", This
, p
);
2015 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2018 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2020 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2021 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2023 if(!is_valid_border_style(v
))
2024 return E_INVALIDARG
;
2026 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2029 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2031 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2032 TRACE("(%p)->(%p)\n", This
, p
);
2033 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2036 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2038 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2039 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2041 if(!is_valid_border_style(v
))
2042 return E_INVALIDARG
;
2044 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2047 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2049 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2050 TRACE("(%p)->(%p)\n", This
, p
);
2051 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2054 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2056 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2058 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2060 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2063 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2065 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2067 TRACE("(%p)->(%p)\n", This
, p
);
2069 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2072 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2074 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2076 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2078 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2081 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2083 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2085 TRACE("(%p)->(%p)\n", This
, p
);
2087 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2090 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2092 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2093 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2097 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2099 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2100 FIXME("(%p)->(%p)\n", This
, p
);
2104 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2106 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2108 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2110 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2113 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2115 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2117 TRACE("(%p)->(%p)\n", This
, p
);
2119 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2122 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2124 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2126 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2128 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2131 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2133 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2135 TRACE("(%p)->(%p)\n", This
, p
);
2137 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2140 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2142 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2144 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2146 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2149 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2151 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2153 TRACE("(%p)->(%p)\n", This
, p
);
2155 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2158 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2160 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2161 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2165 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2167 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2168 FIXME("(%p)->(%p)\n", This
, p
);
2172 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2174 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2175 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2179 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2181 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2182 FIXME("(%p)->(%p)\n", This
, p
);
2186 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2188 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2189 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2193 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2195 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2196 FIXME("(%p)->(%p)\n", This
, p
);
2200 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2202 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2203 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2207 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2209 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2210 FIXME("(%p)->(%p)\n", This
, p
);
2214 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2216 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2217 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2221 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2223 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2224 FIXME("(%p)->(%p)\n", This
, p
);
2228 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2230 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2232 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2234 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2237 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2239 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2241 TRACE("(%p)->(%p)\n", This
, p
);
2243 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2246 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2248 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2250 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2252 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2255 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2257 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2259 TRACE("(%p)->(%p)\n", This
, p
);
2261 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2264 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2266 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2267 TRACE("(%p)->(%p)\n", This
, p
);
2268 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2271 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2273 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2275 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2277 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2280 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2282 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2284 TRACE("(%p)->(%p)\n", This
, p
);
2286 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2289 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2291 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2292 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2293 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2294 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2295 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2297 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2299 /* overflow can only be one of the follow values. */
2300 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2301 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2303 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2306 return E_INVALIDARG
;
2310 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2312 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2314 TRACE("(%p)->(%p)\n", This
, p
);
2317 return E_INVALIDARG
;
2319 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2322 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2324 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2326 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2328 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2331 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2333 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2335 TRACE("(%p)->(%p)\n", This
, p
);
2337 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2340 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2342 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2344 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2346 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2349 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2351 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2353 TRACE("(%p)->(%p)\n", This
, p
);
2355 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2358 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2360 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2364 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2366 nsAString_InitDepend(&text_str
, v
);
2367 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2368 nsAString_Finish(&text_str
);
2369 if(NS_FAILED(nsres
)) {
2370 FIXME("SetCssStyle failed: %08x\n", nsres
);
2377 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2379 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2383 TRACE("(%p)->(%p)\n", This
, p
);
2385 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2386 nsAString_Init(&text_str
, NULL
);
2387 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2388 if(NS_SUCCEEDED(nsres
)) {
2389 const PRUnichar
*text
;
2391 nsAString_GetData(&text_str
, &text
);
2392 *p
= *text
? SysAllocString(text
) : NULL
;
2394 FIXME("GetCssStyle failed: %08x\n", nsres
);
2398 nsAString_Finish(&text_str
);
2402 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2404 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2405 FIXME("(%p)->()\n", This
);
2409 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2411 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2412 FIXME("(%p)->()\n", This
);
2416 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2418 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2420 TRACE("(%p)->(%d)\n", This
, v
);
2422 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2425 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2427 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2429 TRACE("(%p)->(%p)\n", This
, p
);
2431 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2434 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2436 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2438 TRACE("(%p)->()\n", This
);
2440 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2443 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2445 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2446 FIXME("(%p)->()\n", This
);
2450 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2452 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2453 FIXME("(%p)->()\n", This
);
2457 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2459 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2460 FIXME("(%p)->()\n", This
);
2464 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2466 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2468 TRACE("(%p)->(%f)\n", This
, v
);
2470 return set_style_pos(This
, STYLEID_TOP
, v
);
2473 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2475 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2477 TRACE("(%p)->(%p)\n", This
, p
);
2482 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2485 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2487 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2489 TRACE("(%p)->(%f)\n", This
, v
);
2491 return set_style_pos(This
, STYLEID_LEFT
, v
);
2494 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2496 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2498 TRACE("(%p)->(%p)\n", This
, p
);
2503 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2506 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2508 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2510 TRACE("(%p)->(%f)\n", This
, v
);
2512 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2515 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2517 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2519 TRACE("(%p)->(%p)\n", This
, p
);
2524 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2530 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2532 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2534 TRACE("(%p)->(%f)\n", This
, v
);
2536 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2539 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2541 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2543 TRACE("(%p)->(%p)\n", This
, p
);
2548 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2554 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2556 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2558 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2560 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2563 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2565 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2567 TRACE("(%p)->(%p)\n", This
, p
);
2569 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2572 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2574 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2576 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2578 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2581 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2583 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2585 TRACE("(%p)->(%p)\n", This
, p
);
2587 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2590 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2592 nsAString name_str
, val_str
, empty_str
;
2595 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2597 TRACE("%s\n", debugstr_w(val
));
2599 nsAString_InitDepend(&name_str
, opacityW
);
2600 nsAString_InitDepend(&val_str
, val
);
2601 nsAString_InitDepend(&empty_str
, emptyW
);
2603 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2604 if(NS_FAILED(nsres
))
2605 ERR("SetProperty failed: %08x\n", nsres
);
2607 nsAString_Finish(&name_str
);
2608 nsAString_Finish(&val_str
);
2609 nsAString_Finish(&empty_str
);
2612 static void update_filter(HTMLStyle
*This
)
2614 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2616 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2619 set_opacity(This
, emptyW
);
2624 while(isspaceW(*ptr
))
2630 while(isalnumW(*ptr
))
2633 WARN("unexpected char '%c'\n", *ptr
);
2637 WARN("expected '('\n");
2641 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2642 static const WCHAR formatW
[] = {'%','f',0};
2643 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2647 while(isspaceW(*ptr
))
2651 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2654 WARN("unexpected end of string\n");
2658 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2659 float fval
= 0.0f
, e
= 0.1f
;
2662 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2664 while(isdigitW(*ptr2
))
2665 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2668 while(isdigitW(*++ptr2
)) {
2669 fval
+= e
* (float)(*ptr2
++ - '0');
2674 sprintfW(buf
, formatW
, fval
* 0.01f
);
2675 set_opacity(This
, buf
);
2677 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2682 }while(*ptr
!= ')');
2684 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2685 ptr
= strchrW(ptr
, ')');
2693 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2695 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2696 WCHAR
*new_filter
= NULL
;
2698 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2701 FIXME("Element already destroyed\n");
2702 return E_UNEXPECTED
;
2706 new_filter
= heap_strdupW(v
);
2708 return E_OUTOFMEMORY
;
2711 heap_free(This
->elem
->filter
);
2712 This
->elem
->filter
= new_filter
;
2714 update_filter(This
);
2718 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2720 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2722 TRACE("(%p)->(%p)\n", This
, p
);
2725 FIXME("Element already destroyed\n");
2726 return E_UNEXPECTED
;
2729 if(This
->elem
->filter
) {
2730 *p
= SysAllocString(This
->elem
->filter
);
2732 return E_OUTOFMEMORY
;
2740 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2741 VARIANT AttributeValue
, LONG lFlags
)
2743 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2747 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2748 debugstr_variant(&AttributeValue
), lFlags
);
2750 if(!strAttributeName
)
2751 return E_INVALIDARG
;
2754 FIXME("Parameter lFlags ignored\n");
2756 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2757 LOCALE_USER_DEFAULT
, &dispid
);
2761 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2765 params
.rgvarg
= &AttributeValue
;
2766 params
.cNamedArgs
= 1;
2767 params
.rgdispidNamedArgs
= &dispidNamed
;
2769 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2770 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2774 FIXME("Custom attributes not supported.\n");
2777 TRACE("ret: %08x\n", hres
);
2782 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2783 LONG lFlags
, VARIANT
*AttributeValue
)
2785 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2789 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2790 AttributeValue
, lFlags
);
2792 if(!AttributeValue
|| !strAttributeName
)
2793 return E_INVALIDARG
;
2796 FIXME("Parameter lFlags ignored\n");
2798 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2799 LOCALE_USER_DEFAULT
, &dispid
);
2802 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2804 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2805 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2809 FIXME("Custom attributes not supported.\n");
2815 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2816 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2818 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2819 const style_tbl_entry_t
*style_entry
;
2820 nsAString name_str
, ret_str
;
2824 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2826 style_entry
= lookup_style_tbl(strAttributeName
);
2831 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2832 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2834 *pfSuccess
= VARIANT_FALSE
;
2838 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2839 if(dispid
== style_tbl
[i
].dispid
)
2843 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2844 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2845 style_entry
= style_tbl
+i
;
2848 /* filter property is a special case */
2849 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2850 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2851 heap_free(This
->elem
->filter
);
2852 This
->elem
->filter
= NULL
;
2853 update_filter(This
);
2857 nsAString_InitDepend(&name_str
, style_entry
->name
);
2858 nsAString_Init(&ret_str
, NULL
);
2859 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2860 if(NS_SUCCEEDED(nsres
)) {
2861 const PRUnichar
*ret
;
2862 nsAString_GetData(&ret_str
, &ret
);
2863 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2865 ERR("RemoveProperty failed: %08x\n", nsres
);
2867 nsAString_Finish(&name_str
);
2868 nsAString_Finish(&ret_str
);
2869 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2872 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2874 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2875 FIXME("(%p)->(%p)\n", This
, String
);
2879 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2880 HTMLStyle_QueryInterface
,
2883 HTMLStyle_GetTypeInfoCount
,
2884 HTMLStyle_GetTypeInfo
,
2885 HTMLStyle_GetIDsOfNames
,
2887 HTMLStyle_put_fontFamily
,
2888 HTMLStyle_get_fontFamily
,
2889 HTMLStyle_put_fontStyle
,
2890 HTMLStyle_get_fontStyle
,
2891 HTMLStyle_put_fontVariant
,
2892 HTMLStyle_get_fontVariant
,
2893 HTMLStyle_put_fontWeight
,
2894 HTMLStyle_get_fontWeight
,
2895 HTMLStyle_put_fontSize
,
2896 HTMLStyle_get_fontSize
,
2899 HTMLStyle_put_color
,
2900 HTMLStyle_get_color
,
2901 HTMLStyle_put_background
,
2902 HTMLStyle_get_background
,
2903 HTMLStyle_put_backgroundColor
,
2904 HTMLStyle_get_backgroundColor
,
2905 HTMLStyle_put_backgroundImage
,
2906 HTMLStyle_get_backgroundImage
,
2907 HTMLStyle_put_backgroundRepeat
,
2908 HTMLStyle_get_backgroundRepeat
,
2909 HTMLStyle_put_backgroundAttachment
,
2910 HTMLStyle_get_backgroundAttachment
,
2911 HTMLStyle_put_backgroundPosition
,
2912 HTMLStyle_get_backgroundPosition
,
2913 HTMLStyle_put_backgroundPositionX
,
2914 HTMLStyle_get_backgroundPositionX
,
2915 HTMLStyle_put_backgroundPositionY
,
2916 HTMLStyle_get_backgroundPositionY
,
2917 HTMLStyle_put_wordSpacing
,
2918 HTMLStyle_get_wordSpacing
,
2919 HTMLStyle_put_letterSpacing
,
2920 HTMLStyle_get_letterSpacing
,
2921 HTMLStyle_put_textDecoration
,
2922 HTMLStyle_get_textDecoration
,
2923 HTMLStyle_put_textDecorationNone
,
2924 HTMLStyle_get_textDecorationNone
,
2925 HTMLStyle_put_textDecorationUnderline
,
2926 HTMLStyle_get_textDecorationUnderline
,
2927 HTMLStyle_put_textDecorationOverline
,
2928 HTMLStyle_get_textDecorationOverline
,
2929 HTMLStyle_put_textDecorationLineThrough
,
2930 HTMLStyle_get_textDecorationLineThrough
,
2931 HTMLStyle_put_textDecorationBlink
,
2932 HTMLStyle_get_textDecorationBlink
,
2933 HTMLStyle_put_verticalAlign
,
2934 HTMLStyle_get_verticalAlign
,
2935 HTMLStyle_put_textTransform
,
2936 HTMLStyle_get_textTransform
,
2937 HTMLStyle_put_textAlign
,
2938 HTMLStyle_get_textAlign
,
2939 HTMLStyle_put_textIndent
,
2940 HTMLStyle_get_textIndent
,
2941 HTMLStyle_put_lineHeight
,
2942 HTMLStyle_get_lineHeight
,
2943 HTMLStyle_put_marginTop
,
2944 HTMLStyle_get_marginTop
,
2945 HTMLStyle_put_marginRight
,
2946 HTMLStyle_get_marginRight
,
2947 HTMLStyle_put_marginBottom
,
2948 HTMLStyle_get_marginBottom
,
2949 HTMLStyle_put_marginLeft
,
2950 HTMLStyle_get_marginLeft
,
2951 HTMLStyle_put_margin
,
2952 HTMLStyle_get_margin
,
2953 HTMLStyle_put_paddingTop
,
2954 HTMLStyle_get_paddingTop
,
2955 HTMLStyle_put_paddingRight
,
2956 HTMLStyle_get_paddingRight
,
2957 HTMLStyle_put_paddingBottom
,
2958 HTMLStyle_get_paddingBottom
,
2959 HTMLStyle_put_paddingLeft
,
2960 HTMLStyle_get_paddingLeft
,
2961 HTMLStyle_put_padding
,
2962 HTMLStyle_get_padding
,
2963 HTMLStyle_put_border
,
2964 HTMLStyle_get_border
,
2965 HTMLStyle_put_borderTop
,
2966 HTMLStyle_get_borderTop
,
2967 HTMLStyle_put_borderRight
,
2968 HTMLStyle_get_borderRight
,
2969 HTMLStyle_put_borderBottom
,
2970 HTMLStyle_get_borderBottom
,
2971 HTMLStyle_put_borderLeft
,
2972 HTMLStyle_get_borderLeft
,
2973 HTMLStyle_put_borderColor
,
2974 HTMLStyle_get_borderColor
,
2975 HTMLStyle_put_borderTopColor
,
2976 HTMLStyle_get_borderTopColor
,
2977 HTMLStyle_put_borderRightColor
,
2978 HTMLStyle_get_borderRightColor
,
2979 HTMLStyle_put_borderBottomColor
,
2980 HTMLStyle_get_borderBottomColor
,
2981 HTMLStyle_put_borderLeftColor
,
2982 HTMLStyle_get_borderLeftColor
,
2983 HTMLStyle_put_borderWidth
,
2984 HTMLStyle_get_borderWidth
,
2985 HTMLStyle_put_borderTopWidth
,
2986 HTMLStyle_get_borderTopWidth
,
2987 HTMLStyle_put_borderRightWidth
,
2988 HTMLStyle_get_borderRightWidth
,
2989 HTMLStyle_put_borderBottomWidth
,
2990 HTMLStyle_get_borderBottomWidth
,
2991 HTMLStyle_put_borderLeftWidth
,
2992 HTMLStyle_get_borderLeftWidth
,
2993 HTMLStyle_put_borderStyle
,
2994 HTMLStyle_get_borderStyle
,
2995 HTMLStyle_put_borderTopStyle
,
2996 HTMLStyle_get_borderTopStyle
,
2997 HTMLStyle_put_borderRightStyle
,
2998 HTMLStyle_get_borderRightStyle
,
2999 HTMLStyle_put_borderBottomStyle
,
3000 HTMLStyle_get_borderBottomStyle
,
3001 HTMLStyle_put_borderLeftStyle
,
3002 HTMLStyle_get_borderLeftStyle
,
3003 HTMLStyle_put_width
,
3004 HTMLStyle_get_width
,
3005 HTMLStyle_put_height
,
3006 HTMLStyle_get_height
,
3007 HTMLStyle_put_styleFloat
,
3008 HTMLStyle_get_styleFloat
,
3009 HTMLStyle_put_clear
,
3010 HTMLStyle_get_clear
,
3011 HTMLStyle_put_display
,
3012 HTMLStyle_get_display
,
3013 HTMLStyle_put_visibility
,
3014 HTMLStyle_get_visibility
,
3015 HTMLStyle_put_listStyleType
,
3016 HTMLStyle_get_listStyleType
,
3017 HTMLStyle_put_listStylePosition
,
3018 HTMLStyle_get_listStylePosition
,
3019 HTMLStyle_put_listStyleImage
,
3020 HTMLStyle_get_listStyleImage
,
3021 HTMLStyle_put_listStyle
,
3022 HTMLStyle_get_listStyle
,
3023 HTMLStyle_put_whiteSpace
,
3024 HTMLStyle_get_whiteSpace
,
3029 HTMLStyle_get_position
,
3030 HTMLStyle_put_zIndex
,
3031 HTMLStyle_get_zIndex
,
3032 HTMLStyle_put_overflow
,
3033 HTMLStyle_get_overflow
,
3034 HTMLStyle_put_pageBreakBefore
,
3035 HTMLStyle_get_pageBreakBefore
,
3036 HTMLStyle_put_pageBreakAfter
,
3037 HTMLStyle_get_pageBreakAfter
,
3038 HTMLStyle_put_cssText
,
3039 HTMLStyle_get_cssText
,
3040 HTMLStyle_put_pixelTop
,
3041 HTMLStyle_get_pixelTop
,
3042 HTMLStyle_put_pixelLeft
,
3043 HTMLStyle_get_pixelLeft
,
3044 HTMLStyle_put_pixelWidth
,
3045 HTMLStyle_get_pixelWidth
,
3046 HTMLStyle_put_pixelHeight
,
3047 HTMLStyle_get_pixelHeight
,
3048 HTMLStyle_put_posTop
,
3049 HTMLStyle_get_posTop
,
3050 HTMLStyle_put_posLeft
,
3051 HTMLStyle_get_posLeft
,
3052 HTMLStyle_put_posWidth
,
3053 HTMLStyle_get_posWidth
,
3054 HTMLStyle_put_posHeight
,
3055 HTMLStyle_get_posHeight
,
3056 HTMLStyle_put_cursor
,
3057 HTMLStyle_get_cursor
,
3060 HTMLStyle_put_filter
,
3061 HTMLStyle_get_filter
,
3062 HTMLStyle_setAttribute
,
3063 HTMLStyle_getAttribute
,
3064 HTMLStyle_removeAttribute
,
3068 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3070 const style_tbl_entry_t
*style_entry
;
3072 style_entry
= lookup_style_tbl(name
);
3074 *dispid
= style_entry
->dispid
;
3078 return DISP_E_UNKNOWNNAME
;
3081 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3083 HTMLStyle_get_dispid
,
3088 static const tid_t HTMLStyle_iface_tids
[] = {
3097 static dispex_static_data_t HTMLStyle_dispex
= {
3098 &HTMLStyle_dispex_vtbl
,
3101 HTMLStyle_iface_tids
3104 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3106 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3107 nsIDOMCSSStyleDeclaration
*nsstyle
;
3112 FIXME("NULL nselem\n");
3116 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3117 (void**)&nselemstyle
);
3118 assert(nsres
== NS_OK
);
3120 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, &nsstyle
);
3121 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3122 if(NS_FAILED(nsres
)) {
3123 ERR("GetStyle failed: %08x\n", nsres
);
3127 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3129 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3130 return E_OUTOFMEMORY
;
3133 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3135 style
->nsstyle
= nsstyle
;
3137 HTMLStyle2_Init(style
);
3138 HTMLStyle3_Init(style
);
3140 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3142 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);