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 attrListStylePosition
[] =
132 {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0};
133 static const WCHAR attrMargin
[] =
134 {'m','a','r','g','i','n',0};
135 static const WCHAR attrMarginBottom
[] =
136 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
137 static const WCHAR attrMarginLeft
[] =
138 {'m','a','r','g','i','n','-','l','e','f','t',0};
139 static const WCHAR attrMarginRight
[] =
140 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
141 static const WCHAR attrMarginTop
[] =
142 {'m','a','r','g','i','n','-','t','o','p',0};
143 static const WCHAR attrMinHeight
[] =
144 {'m','i','n','-','h','e','i','g','h','t',0};
145 static const WCHAR attrOutline
[] =
146 {'o','u','t','l','i','n','e',0};
147 static const WCHAR attrOverflow
[] =
148 {'o','v','e','r','f','l','o','w',0};
149 static const WCHAR attrOverflowX
[] =
150 {'o','v','e','r','f','l','o','w','-','x',0};
151 static const WCHAR attrOverflowY
[] =
152 {'o','v','e','r','f','l','o','w','-','y',0};
153 static const WCHAR attrPadding
[] =
154 {'p','a','d','d','i','n','g',0};
155 static const WCHAR attrPaddingBottom
[] =
156 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
157 static const WCHAR attrPaddingLeft
[] =
158 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
159 static const WCHAR attrPaddingRight
[] =
160 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
161 static const WCHAR attrPaddingTop
[] =
162 {'p','a','d','d','i','n','g','-','t','o','p',0};
163 static const WCHAR attrPageBreakAfter
[] =
164 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
165 static const WCHAR attrPageBreakBefore
[] =
166 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
167 static const WCHAR attrPosition
[] =
168 {'p','o','s','i','t','i','o','n',0};
169 static const WCHAR attrRight
[] =
170 {'r','i','g','h','t',0};
171 static const WCHAR attrTextAlign
[] =
172 {'t','e','x','t','-','a','l','i','g','n',0};
173 static const WCHAR attrTextDecoration
[] =
174 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
175 static const WCHAR attrTextIndent
[] =
176 {'t','e','x','t','-','i','n','d','e','n','t',0};
177 static const WCHAR attrTextTransform
[] =
178 {'t','e','x','t','-','t','r','a','n','s','f','o','r','m',0};
179 static const WCHAR attrTop
[] =
181 static const WCHAR attrVerticalAlign
[] =
182 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
183 static const WCHAR attrVisibility
[] =
184 {'v','i','s','i','b','i','l','i','t','y',0};
185 static const WCHAR attrWhiteSpace
[] =
186 {'w','h','i','t','e','-','s','p','a','c','e',0};
187 static const WCHAR attrWidth
[] =
188 {'w','i','d','t','h',0};
189 static const WCHAR attrWordSpacing
[] =
190 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
191 static const WCHAR attrWordWrap
[] =
192 {'w','o','r','d','-','w','r','a','p',0};
193 static const WCHAR attrZIndex
[] =
194 {'z','-','i','n','d','e','x',0};
197 static const WCHAR pxW
[] = {'p','x',0};
204 static const style_tbl_entry_t style_tbl
[] = {
205 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
206 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
207 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
208 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
209 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
210 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
211 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
212 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
213 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
214 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
215 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
216 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
217 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
218 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
219 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
220 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
221 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
222 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
223 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
224 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
225 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
226 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
227 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
228 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
229 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
230 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
231 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
232 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
233 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
234 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
235 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
236 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
237 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
238 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
239 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
240 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
241 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
242 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
243 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
244 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
245 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
246 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
247 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
248 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
249 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
250 {attrListStylePosition
, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION
},
251 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
252 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
253 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
254 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
255 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
256 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
257 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
258 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
259 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
260 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
261 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
262 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
263 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
264 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
265 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
266 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
267 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
268 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
269 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
270 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
271 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
272 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
273 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
274 {attrTextTransform
, DISPID_IHTMLSTYLE_TEXTTRANSFORM
},
275 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
276 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
277 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
278 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
279 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
280 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
281 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
282 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
285 static const WCHAR valLineThrough
[] =
286 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
287 static const WCHAR valUnderline
[] =
288 {'u','n','d','e','r','l','i','n','e',0};
289 static const WCHAR szNormal
[] =
290 {'n','o','r','m','a','l',0};
291 static const WCHAR styleNone
[] =
293 static const WCHAR valOverline
[] =
294 {'o','v','e','r','l','i','n','e',0};
295 static const WCHAR valBlink
[] =
296 {'b','l','i','n','k',0};
298 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
299 static const WCHAR emptyW
[] = {0};
301 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
303 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
308 c
= strcmpW(style_tbl
[i
].name
, name
);
321 static LPWSTR
fix_px_value(LPCWSTR val
)
326 while(*ptr
&& isspaceW(*ptr
))
331 while(*ptr
&& isdigitW(*ptr
))
334 if(!*ptr
|| isspaceW(*ptr
)) {
336 int len
= strlenW(val
)+1;
338 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
339 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
345 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
350 while(*ptr
&& !isspaceW(*ptr
))
357 static LPWSTR
fix_url_value(LPCWSTR val
)
361 static const WCHAR urlW
[] = {'u','r','l','('};
363 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
366 ret
= heap_strdupW(val
);
368 for(ptr
= ret
; *ptr
; ptr
++) {
376 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
378 nsAString str_name
, str_value
, str_empty
;
383 if(flags
& ATTR_FIX_PX
)
384 val
= fix_px_value(value
);
385 if(flags
& ATTR_FIX_URL
)
386 val
= fix_url_value(value
);
389 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
390 nsAString_InitDepend(&str_value
, val
? val
: value
);
391 nsAString_InitDepend(&str_empty
, emptyW
);
393 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
395 ERR("SetProperty failed: %08x\n", nsres
);
397 nsAString_Finish(&str_name
);
398 nsAString_Finish(&str_value
);
399 nsAString_Finish(&str_empty
);
405 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
416 case VT_BSTR
|VT_BYREF
:
417 *ret
= *V_BSTRREF(v
);
421 static const WCHAR formatW
[] = {'%','d',0};
422 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
424 if(flags
& ATTR_HEX_INT
)
425 wsprintfW(buf
, hex_formatW
, V_I4(v
));
426 else if(flags
& ATTR_FIX_PX
)
427 wsprintfW(buf
, px_formatW
, V_I4(v
));
429 wsprintfW(buf
, formatW
, V_I4(v
));
435 FIXME("not implemented for %s\n", debugstr_variant(v
));
441 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
447 hres
= var_to_styleval(value
, buf
, flags
, &val
);
451 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
454 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
456 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
459 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
464 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
466 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
467 if(NS_FAILED(nsres
)) {
468 ERR("SetProperty failed: %08x\n", nsres
);
472 nsAString_Finish(&str_name
);
477 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
483 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
487 ret
= SysAllocString(val
);
489 return E_OUTOFMEMORY
;
491 len
= SysStringLen(ret
);
493 if(flags
& ATTR_REMOVE_COMMA
) {
497 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
503 new_ret
= SysAllocStringLen(NULL
, new_len
);
506 return E_OUTOFMEMORY
;
509 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
523 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
526 const PRUnichar
*value
;
529 nsAString_Init(&str_value
, NULL
);
531 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
533 nsAString_GetData(&str_value
, &value
);
534 hres
= nsstyle_to_bstr(value
, flags
, p
);
535 nsAString_Finish(&str_value
);
537 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
541 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
544 const PRUnichar
*value
;
548 nsAString_Init(&str_value
, NULL
);
550 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
552 nsAString_GetData(&str_value
, &value
);
554 if(flags
& ATTR_STR_TO_INT
) {
555 const PRUnichar
*ptr
= value
;
564 while(isdigitW(*ptr
))
565 i
= i
*10 + (*ptr
++ - '0');
569 V_I4(p
) = neg
? -i
: i
;
577 hres
= nsstyle_to_bstr(value
, flags
, &str
);
578 if(SUCCEEDED(hres
)) {
584 nsAString_Finish(&str_value
);
586 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
590 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
592 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
595 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
598 const PRUnichar
*value
;
600 nsAString_Init(&str_value
, NULL
);
602 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
604 nsAString_GetData(&str_value
, &value
);
605 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
606 nsAString_Finish(&str_value
);
608 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
612 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
615 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
617 value
= floor(value
);
619 sprintfW(szValue
, szFormat
, value
);
621 return set_style_attr(This
, sid
, szValue
, 0);
624 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
628 sprintfW(value_str
, px_formatW
, value
);
630 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
633 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
638 TRACE("%p %d %p\n", This
, sid
, p
);
642 nsAString_Init(&str_value
, NULL
);
644 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
648 const PRUnichar
*value
;
650 nsAString_GetData(&str_value
, &value
);
653 *p
= strtolW(value
, &ptr
, 10);
655 if(*ptr
&& strcmpW(ptr
, pxW
))
657 nsAString_Finish(&str_value
);
658 FIXME("only px values are currently supported\n");
664 TRACE("ret %f\n", *p
);
666 nsAString_Finish(&str_value
);
670 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
675 nsAString_Init(&str_value
, NULL
);
677 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
680 const PRUnichar
*value
;
682 nsAString_GetData(&str_value
, &value
);
684 *p
= strtolW(value
, &ptr
, 10);
687 /* Skip all digits. We have tests showing that we should not round the value. */
688 while(isdigitW(*++ptr
));
691 if(*ptr
&& strcmpW(ptr
, pxW
)) {
692 nsAString_Finish(&str_value
);
693 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
701 nsAString_Finish(&str_value
);
705 static BOOL
is_valid_border_style(BSTR v
)
707 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
708 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
709 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
710 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
711 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
712 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
713 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
714 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
716 TRACE("%s\n", debugstr_w(v
));
718 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
719 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
720 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
721 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
722 strcmpiW(v
, styleOutset
) == 0 )
730 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
732 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
735 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
737 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
739 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
741 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
742 *ppv
= &This
->IHTMLStyle_iface
;
743 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
744 *ppv
= &This
->IHTMLStyle_iface
;
745 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
746 *ppv
= &This
->IHTMLStyle2_iface
;
747 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
748 *ppv
= &This
->IHTMLStyle3_iface
;
749 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
750 *ppv
= &This
->IHTMLStyle4_iface
;
751 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
752 *ppv
= &This
->IHTMLStyle5_iface
;
753 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
754 *ppv
= &This
->IHTMLStyle6_iface
;
755 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
756 return *ppv
? S_OK
: E_NOINTERFACE
;
759 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
760 return E_NOINTERFACE
;
763 IUnknown_AddRef((IUnknown
*)*ppv
);
767 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
769 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
770 LONG ref
= InterlockedIncrement(&This
->ref
);
772 TRACE("(%p) ref=%d\n", This
, ref
);
777 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
779 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
780 LONG ref
= InterlockedDecrement(&This
->ref
);
782 TRACE("(%p) ref=%d\n", This
, ref
);
787 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
788 release_dispex(&This
->dispex
);
795 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
797 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
798 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
801 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
802 LCID lcid
, ITypeInfo
**ppTInfo
)
804 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
805 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
808 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
809 LPOLESTR
*rgszNames
, UINT cNames
,
810 LCID lcid
, DISPID
*rgDispId
)
812 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
813 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
817 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
818 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
819 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
821 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
822 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
823 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
826 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
828 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
830 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
832 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
835 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
837 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
839 TRACE("(%p)->(%p)\n", This
, p
);
841 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
844 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
846 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
847 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
848 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
850 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
852 /* fontStyle can only be one of the follow values. */
853 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
854 strcmpiW(szOblique
, v
) == 0)
856 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
862 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
864 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
866 TRACE("(%p)->(%p)\n", This
, p
);
868 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
871 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
873 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
874 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
876 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
878 /* fontVariant can only be one of the follow values. */
879 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
881 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
887 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
889 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
890 TRACE("(%p)->(%p)\n", This
, p
);
895 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
898 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
900 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
901 static const WCHAR styleBold
[] = {'b','o','l','d',0};
902 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
903 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
904 static const WCHAR style100
[] = {'1','0','0',0};
905 static const WCHAR style200
[] = {'2','0','0',0};
906 static const WCHAR style300
[] = {'3','0','0',0};
907 static const WCHAR style400
[] = {'4','0','0',0};
908 static const WCHAR style500
[] = {'5','0','0',0};
909 static const WCHAR style600
[] = {'6','0','0',0};
910 static const WCHAR style700
[] = {'7','0','0',0};
911 static const WCHAR style800
[] = {'8','0','0',0};
912 static const WCHAR style900
[] = {'9','0','0',0};
914 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
916 /* fontWeight can only be one of the following */
917 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
918 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
919 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
920 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
921 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
922 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
923 strcmpiW(style900
, v
) == 0
926 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
932 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
934 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
936 TRACE("(%p)->(%p)\n", This
, p
);
938 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
941 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
943 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
945 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
947 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
950 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
952 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
954 TRACE("(%p)->(%p)\n", This
, p
);
956 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
959 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
961 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
962 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
966 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
968 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
969 FIXME("(%p)->(%p)\n", This
, p
);
973 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
975 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
977 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
979 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
982 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
984 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
986 TRACE("(%p)->(%p)\n", This
, p
);
988 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
991 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
993 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
995 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
997 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
1000 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
1002 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1004 TRACE("(%p)->(%p)\n", This
, p
);
1006 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
1009 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1011 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1013 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1015 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1018 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1020 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1022 TRACE("(%p)->(%p)\n", This
, p
);
1024 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1027 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1029 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1031 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1033 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1036 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1038 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1040 TRACE("(%p)->(%p)\n", This
, p
);
1042 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1045 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1047 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1048 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1049 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1050 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1051 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1053 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1055 /* fontWeight can only be one of the following */
1056 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1057 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1059 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1062 return E_INVALIDARG
;
1065 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1067 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1069 TRACE("(%p)->(%p)\n", This
, p
);
1071 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1074 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1076 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1077 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1081 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1083 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1084 FIXME("(%p)->(%p)\n", This
, p
);
1088 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1090 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1092 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1094 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1097 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1099 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1101 TRACE("(%p)->(%p)\n", This
, p
);
1103 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1106 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1108 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1109 WCHAR buf
[14], *pos_val
;
1115 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1117 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1121 val_len
= val
? strlenW(val
) : 0;
1123 nsAString_Init(&pos_str
, NULL
);
1124 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1125 if(SUCCEEDED(hres
)) {
1126 const PRUnichar
*pos
, *posy
;
1129 nsAString_GetData(&pos_str
, &pos
);
1130 posy
= strchrW(pos
, ' ');
1132 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1134 TRACE("no space in %s\n", debugstr_w(pos
));
1138 posy_len
= strlenW(posy
);
1139 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1142 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1144 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1145 pos_val
[val_len
+posy_len
] = 0;
1147 hres
= E_OUTOFMEMORY
;
1150 nsAString_Finish(&pos_str
);
1154 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1155 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1160 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1162 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1167 TRACE("(%p)->(%p)\n", This
, p
);
1169 nsAString_Init(&pos_str
, NULL
);
1170 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1171 if(SUCCEEDED(hres
)) {
1172 const PRUnichar
*pos
, *space
;
1174 nsAString_GetData(&pos_str
, &pos
);
1175 space
= strchrW(pos
, ' ');
1177 WARN("no space in %s\n", debugstr_w(pos
));
1178 space
= pos
+ strlenW(pos
);
1182 ret
= SysAllocStringLen(pos
, space
-pos
);
1184 hres
= E_OUTOFMEMORY
;
1189 nsAString_Finish(&pos_str
);
1193 TRACE("returning %s\n", debugstr_w(ret
));
1199 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1201 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1202 WCHAR buf
[14], *pos_val
;
1208 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1210 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1214 val_len
= val
? strlenW(val
) : 0;
1216 nsAString_Init(&pos_str
, NULL
);
1217 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1218 if(SUCCEEDED(hres
)) {
1219 const PRUnichar
*pos
, *space
;
1222 nsAString_GetData(&pos_str
, &pos
);
1223 space
= strchrW(pos
, ' ');
1227 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1229 TRACE("no space in %s\n", debugstr_w(pos
));
1231 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1234 posx_len
= space
-pos
;
1236 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1238 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1240 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1241 pos_val
[posx_len
+val_len
] = 0;
1243 hres
= E_OUTOFMEMORY
;
1246 nsAString_Finish(&pos_str
);
1250 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1251 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1256 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1258 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1263 TRACE("(%p)->(%p)\n", This
, p
);
1265 nsAString_Init(&pos_str
, NULL
);
1266 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1267 if(SUCCEEDED(hres
)) {
1268 const PRUnichar
*pos
, *posy
;
1270 nsAString_GetData(&pos_str
, &pos
);
1271 posy
= strchrW(pos
, ' ');
1273 ret
= SysAllocString(posy
+1);
1275 hres
= E_OUTOFMEMORY
;
1280 nsAString_Finish(&pos_str
);
1284 TRACE("returning %s\n", debugstr_w(ret
));
1290 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1292 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1294 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1296 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1299 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1301 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1302 TRACE("(%p)->(%p)\n", This
, p
);
1303 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1306 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1308 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1310 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1312 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1315 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1317 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1318 TRACE("(%p)->(%p)\n", This
, p
);
1319 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1322 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1324 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1326 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1328 /* textDecoration can only be one of the following */
1329 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1330 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1331 strcmpiW(valBlink
, v
) == 0)
1333 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1336 return E_INVALIDARG
;
1339 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1341 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1343 TRACE("(%p)->(%p)\n", This
, p
);
1345 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1348 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1350 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1352 TRACE("(%p)->(%x)\n", This
, v
);
1354 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1357 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1359 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1361 TRACE("(%p)->(%p)\n", This
, p
);
1363 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1366 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1368 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1370 TRACE("(%p)->(%x)\n", This
, v
);
1372 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1375 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1377 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1379 TRACE("(%p)->(%p)\n", This
, p
);
1381 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1384 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1386 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1388 TRACE("(%p)->(%x)\n", This
, v
);
1390 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1393 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1395 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1397 TRACE("(%p)->(%p)\n", This
, p
);
1399 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1402 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1404 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1406 TRACE("(%p)->(%x)\n", This
, v
);
1408 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1411 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1413 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1415 TRACE("(%p)->(%p)\n", This
, p
);
1417 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1420 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1422 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1424 TRACE("(%p)->(%x)\n", This
, v
);
1426 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1429 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1431 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1433 TRACE("(%p)->(%p)\n", This
, p
);
1435 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1438 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1440 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1442 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1444 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1447 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1449 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1451 TRACE("(%p)->(%p)\n", This
, p
);
1453 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1456 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1458 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1460 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1462 return set_style_attr(This
, STYLEID_TEXT_TRANSFORM
, v
, 0);
1465 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1467 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1469 TRACE("(%p)->(%p)\n", This
, p
);
1471 return get_style_attr(This
, STYLEID_TEXT_TRANSFORM
, p
);
1474 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1476 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1478 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1480 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1483 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1485 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1487 TRACE("(%p)->(%p)\n", This
, p
);
1489 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1492 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1494 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1496 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1498 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, &v
, ATTR_FIX_PX
);
1501 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1503 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1505 TRACE("(%p)->(%p)\n", This
, p
);
1507 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, p
, 0);
1510 static HRESULT WINAPI
HTMLStyle_put_lineHeight(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_LINE_HEIGHT
, &v
, 0);
1519 static HRESULT WINAPI
HTMLStyle_get_lineHeight(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_LINE_HEIGHT
, p
, 0);
1528 static HRESULT WINAPI
HTMLStyle_put_marginTop(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_TOP
, &v
, ATTR_FIX_PX
);
1537 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1539 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1541 TRACE("(%p)->(%p)\n", This
, p
);
1543 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1546 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1548 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1550 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1552 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1555 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1557 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1558 TRACE("(%p)->(%p)\n", This
, p
);
1559 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1562 static HRESULT WINAPI
HTMLStyle_put_marginBottom(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_BOTTOM
, &v
, ATTR_FIX_PX
);
1571 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1573 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1575 TRACE("(%p)->(%p)\n", This
, p
);
1577 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1580 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1582 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1584 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1586 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1589 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1591 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1593 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1595 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1598 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1600 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1602 TRACE("(%p)->(%p)\n", This
, p
);
1604 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1607 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1609 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1610 TRACE("(%p)->(%p)\n", This
, p
);
1611 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1614 static HRESULT WINAPI
HTMLStyle_put_paddingTop(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_TOP
, &v
, ATTR_FIX_PX
);
1623 static HRESULT WINAPI
HTMLStyle_get_paddingTop(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_TOP
, p
, 0);
1632 static HRESULT WINAPI
HTMLStyle_put_paddingRight(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_RIGHT
, &v
, ATTR_FIX_PX
);
1641 static HRESULT WINAPI
HTMLStyle_get_paddingRight(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_RIGHT
, p
, 0);
1650 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(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_BOTTOM
, &v
, ATTR_FIX_PX
);
1659 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(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_BOTTOM
, p
, 0);
1668 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1670 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1672 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1674 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1677 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1679 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1681 TRACE("(%p)->(%p)\n", This
, p
);
1683 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1686 static HRESULT WINAPI
HTMLStyle_put_padding(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_PADDING
, v
, 0);
1695 static HRESULT WINAPI
HTMLStyle_get_padding(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_PADDING
, p
);
1704 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1706 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1708 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1710 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1713 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1715 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1717 TRACE("(%p)->(%p)\n", This
, p
);
1719 return get_style_attr(This
, STYLEID_BORDER
, p
);
1722 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1724 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1725 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1726 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1729 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1731 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1732 TRACE("(%p)->(%p)\n", This
, p
);
1733 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1736 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1738 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1739 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1740 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1743 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1745 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1746 TRACE("(%p)->(%p)\n", This
, p
);
1747 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1750 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1752 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1753 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1754 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1757 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1759 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1760 TRACE("(%p)->(%p)\n", This
, p
);
1761 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1764 static HRESULT WINAPI
HTMLStyle_put_borderLeft(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_LEFT
, v
, ATTR_FIX_PX
);
1773 static HRESULT WINAPI
HTMLStyle_get_borderLeft(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_LEFT
, p
);
1782 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1786 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1788 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1791 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1793 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1795 TRACE("(%p)->(%p)\n", This
, p
);
1797 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1800 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(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_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1809 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(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_TOP_COLOR
, p
, 0);
1818 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(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_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1827 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(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_RIGHT_COLOR
, p
, 0);
1836 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(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_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1845 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(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_BOTTOM_COLOR
, p
, 0);
1854 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1856 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1858 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1860 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1863 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1865 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1867 TRACE("(%p)->(%p)\n", This
, p
);
1869 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1872 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1874 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1875 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1876 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1879 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1881 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1882 TRACE("(%p)->(%p)\n", This
, p
);
1883 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1886 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(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_TOP_WIDTH
, &v
, 0);
1895 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(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_TOP_WIDTH
, p
, 0);
1904 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(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_RIGHT_WIDTH
, &v
, 0);
1913 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1915 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1917 TRACE("(%p)->(%p)\n", This
, p
);
1919 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1922 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1924 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1926 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1928 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1931 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1933 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1934 TRACE("(%p)->(%p)\n", This
, p
);
1935 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1938 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1940 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1942 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1944 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1947 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1949 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1950 TRACE("(%p)->(%p)\n", This
, p
);
1951 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1954 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1956 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1957 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1958 HRESULT hres
= S_OK
;
1963 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1965 while(v
[i
] && hres
== S_OK
)
1967 if(v
[i
] == (WCHAR
)' ')
1969 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1970 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1972 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1973 hres
= E_INVALIDARG
;
1975 SysFreeString(pstyle
);
1983 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1984 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1986 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1987 hres
= E_INVALIDARG
;
1989 SysFreeString(pstyle
);
1993 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1998 static HRESULT WINAPI
HTMLStyle_get_borderStyle(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_STYLE
, p
);
2005 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(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_TOP_STYLE
, v
, 0);
2016 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(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_TOP_STYLE
, p
);
2023 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(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_RIGHT_STYLE
, v
, 0);
2034 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(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_RIGHT_STYLE
, p
);
2041 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(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_BOTTOM_STYLE
, v
, 0);
2052 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(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_BOTTOM_STYLE
, p
);
2059 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2061 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2062 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2064 if(!is_valid_border_style(v
))
2065 return E_INVALIDARG
;
2067 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2070 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2072 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2073 TRACE("(%p)->(%p)\n", This
, p
);
2074 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2077 static HRESULT WINAPI
HTMLStyle_put_width(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_WIDTH
, &v
, ATTR_FIX_PX
);
2086 static HRESULT WINAPI
HTMLStyle_get_width(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_WIDTH
, p
, 0);
2095 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2097 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2099 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2101 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2104 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2106 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2108 TRACE("(%p)->(%p)\n", This
, p
);
2110 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2113 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2115 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2116 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2120 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2122 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2123 FIXME("(%p)->(%p)\n", This
, p
);
2127 static HRESULT WINAPI
HTMLStyle_put_clear(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_CLEAR
, v
, 0);
2136 static HRESULT WINAPI
HTMLStyle_get_clear(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_CLEAR
, p
);
2145 static HRESULT WINAPI
HTMLStyle_put_display(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_DISPLAY
, v
, 0);
2154 static HRESULT WINAPI
HTMLStyle_get_display(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_DISPLAY
, p
);
2163 static HRESULT WINAPI
HTMLStyle_put_visibility(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_VISIBILITY
, v
, 0);
2172 static HRESULT WINAPI
HTMLStyle_get_visibility(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_VISIBILITY
, p
);
2181 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2183 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2185 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2187 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2190 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2192 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2194 TRACE("(%p)->(%p)\n", This
, p
);
2196 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2199 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2201 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2203 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2205 return set_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, v
, 0);
2208 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2210 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2212 TRACE("(%p)->(%p)\n", This
, p
);
2214 return get_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, p
);
2217 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2219 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2220 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2224 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2226 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2227 FIXME("(%p)->(%p)\n", This
, p
);
2231 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2233 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2234 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2238 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2240 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2241 FIXME("(%p)->(%p)\n", This
, p
);
2245 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2247 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2249 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2251 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2254 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2256 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2258 TRACE("(%p)->(%p)\n", This
, p
);
2260 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2263 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2265 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2267 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2269 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2272 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2274 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2276 TRACE("(%p)->(%p)\n", This
, p
);
2278 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2281 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2283 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2285 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2287 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2290 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2292 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2294 TRACE("(%p)->(%p)\n", This
, p
);
2296 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2299 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2301 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2302 TRACE("(%p)->(%p)\n", This
, p
);
2303 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2306 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2308 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2310 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2312 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2315 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2317 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2319 TRACE("(%p)->(%p)\n", This
, p
);
2321 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2324 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2326 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2327 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2328 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2329 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2330 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2332 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2334 /* overflow can only be one of the follow values. */
2335 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2336 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2338 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2341 return E_INVALIDARG
;
2345 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2347 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2349 TRACE("(%p)->(%p)\n", This
, p
);
2352 return E_INVALIDARG
;
2354 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2357 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2359 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2361 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2363 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2366 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2368 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2370 TRACE("(%p)->(%p)\n", This
, p
);
2372 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2375 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2377 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2379 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2381 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2384 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2386 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2388 TRACE("(%p)->(%p)\n", This
, p
);
2390 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2393 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2395 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2399 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2401 nsAString_InitDepend(&text_str
, v
);
2402 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2403 nsAString_Finish(&text_str
);
2404 if(NS_FAILED(nsres
)) {
2405 FIXME("SetCssStyle failed: %08x\n", nsres
);
2412 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2414 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2418 TRACE("(%p)->(%p)\n", This
, p
);
2420 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2421 nsAString_Init(&text_str
, NULL
);
2422 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2423 if(NS_SUCCEEDED(nsres
)) {
2424 const PRUnichar
*text
;
2426 nsAString_GetData(&text_str
, &text
);
2427 *p
= *text
? SysAllocString(text
) : NULL
;
2429 FIXME("GetCssStyle failed: %08x\n", nsres
);
2433 nsAString_Finish(&text_str
);
2437 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2439 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2440 FIXME("(%p)->()\n", This
);
2444 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2446 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2447 FIXME("(%p)->()\n", This
);
2451 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2453 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2455 TRACE("(%p)->(%d)\n", This
, v
);
2457 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2460 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2462 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2464 TRACE("(%p)->(%p)\n", This
, p
);
2466 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2469 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2471 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2473 TRACE("(%p)->()\n", This
);
2475 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2478 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2480 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2481 FIXME("(%p)->()\n", This
);
2485 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2487 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2488 FIXME("(%p)->()\n", This
);
2492 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2494 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2495 FIXME("(%p)->()\n", This
);
2499 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2501 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2503 TRACE("(%p)->(%f)\n", This
, v
);
2505 return set_style_pos(This
, STYLEID_TOP
, v
);
2508 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2510 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2512 TRACE("(%p)->(%p)\n", This
, p
);
2517 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2520 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2522 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2524 TRACE("(%p)->(%f)\n", This
, v
);
2526 return set_style_pos(This
, STYLEID_LEFT
, v
);
2529 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2531 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2533 TRACE("(%p)->(%p)\n", This
, p
);
2538 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2541 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2543 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2545 TRACE("(%p)->(%f)\n", This
, v
);
2547 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2550 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2552 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2554 TRACE("(%p)->(%p)\n", This
, p
);
2559 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2565 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2567 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2569 TRACE("(%p)->(%f)\n", This
, v
);
2571 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2574 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2576 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2578 TRACE("(%p)->(%p)\n", This
, p
);
2583 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2589 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2591 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2593 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2595 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2598 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2600 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2602 TRACE("(%p)->(%p)\n", This
, p
);
2604 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2607 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2609 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2611 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2613 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2616 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2618 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2620 TRACE("(%p)->(%p)\n", This
, p
);
2622 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2625 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2627 nsAString name_str
, val_str
, empty_str
;
2630 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2632 TRACE("%s\n", debugstr_w(val
));
2634 nsAString_InitDepend(&name_str
, opacityW
);
2635 nsAString_InitDepend(&val_str
, val
);
2636 nsAString_InitDepend(&empty_str
, emptyW
);
2638 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2639 if(NS_FAILED(nsres
))
2640 ERR("SetProperty failed: %08x\n", nsres
);
2642 nsAString_Finish(&name_str
);
2643 nsAString_Finish(&val_str
);
2644 nsAString_Finish(&empty_str
);
2647 static void update_filter(HTMLStyle
*This
)
2649 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2651 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2654 set_opacity(This
, emptyW
);
2659 while(isspaceW(*ptr
))
2665 while(isalnumW(*ptr
))
2668 WARN("unexpected char '%c'\n", *ptr
);
2672 WARN("expected '('\n");
2676 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2677 static const WCHAR formatW
[] = {'%','f',0};
2678 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2682 while(isspaceW(*ptr
))
2686 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2689 WARN("unexpected end of string\n");
2693 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2694 float fval
= 0.0f
, e
= 0.1f
;
2697 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2699 while(isdigitW(*ptr2
))
2700 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2703 while(isdigitW(*++ptr2
)) {
2704 fval
+= e
* (float)(*ptr2
++ - '0');
2709 sprintfW(buf
, formatW
, fval
* 0.01f
);
2710 set_opacity(This
, buf
);
2712 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2717 }while(*ptr
!= ')');
2719 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2720 ptr
= strchrW(ptr
, ')');
2728 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2730 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2731 WCHAR
*new_filter
= NULL
;
2733 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2736 FIXME("Element already destroyed\n");
2737 return E_UNEXPECTED
;
2741 new_filter
= heap_strdupW(v
);
2743 return E_OUTOFMEMORY
;
2746 heap_free(This
->elem
->filter
);
2747 This
->elem
->filter
= new_filter
;
2749 update_filter(This
);
2753 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2755 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2757 TRACE("(%p)->(%p)\n", This
, p
);
2760 FIXME("Element already destroyed\n");
2761 return E_UNEXPECTED
;
2764 if(This
->elem
->filter
) {
2765 *p
= SysAllocString(This
->elem
->filter
);
2767 return E_OUTOFMEMORY
;
2775 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2776 VARIANT AttributeValue
, LONG lFlags
)
2778 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2782 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2783 debugstr_variant(&AttributeValue
), lFlags
);
2785 if(!strAttributeName
)
2786 return E_INVALIDARG
;
2789 FIXME("Parameter lFlags ignored\n");
2791 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2792 LOCALE_USER_DEFAULT
, &dispid
);
2796 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2800 params
.rgvarg
= &AttributeValue
;
2801 params
.cNamedArgs
= 1;
2802 params
.rgdispidNamedArgs
= &dispidNamed
;
2804 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2805 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2809 FIXME("Custom attributes not supported.\n");
2812 TRACE("ret: %08x\n", hres
);
2817 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2818 LONG lFlags
, VARIANT
*AttributeValue
)
2820 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2824 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2825 AttributeValue
, lFlags
);
2827 if(!AttributeValue
|| !strAttributeName
)
2828 return E_INVALIDARG
;
2831 FIXME("Parameter lFlags ignored\n");
2833 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2834 LOCALE_USER_DEFAULT
, &dispid
);
2837 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2839 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2840 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2844 FIXME("Custom attributes not supported.\n");
2850 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2851 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2853 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2854 const style_tbl_entry_t
*style_entry
;
2855 nsAString name_str
, ret_str
;
2859 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2861 style_entry
= lookup_style_tbl(strAttributeName
);
2866 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2867 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2869 *pfSuccess
= VARIANT_FALSE
;
2873 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2874 if(dispid
== style_tbl
[i
].dispid
)
2878 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2879 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2880 style_entry
= style_tbl
+i
;
2883 /* filter property is a special case */
2884 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2885 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2886 heap_free(This
->elem
->filter
);
2887 This
->elem
->filter
= NULL
;
2888 update_filter(This
);
2892 nsAString_InitDepend(&name_str
, style_entry
->name
);
2893 nsAString_Init(&ret_str
, NULL
);
2894 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2895 if(NS_SUCCEEDED(nsres
)) {
2896 const PRUnichar
*ret
;
2897 nsAString_GetData(&ret_str
, &ret
);
2898 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2900 ERR("RemoveProperty failed: %08x\n", nsres
);
2902 nsAString_Finish(&name_str
);
2903 nsAString_Finish(&ret_str
);
2904 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2907 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2909 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2910 FIXME("(%p)->(%p)\n", This
, String
);
2914 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2915 HTMLStyle_QueryInterface
,
2918 HTMLStyle_GetTypeInfoCount
,
2919 HTMLStyle_GetTypeInfo
,
2920 HTMLStyle_GetIDsOfNames
,
2922 HTMLStyle_put_fontFamily
,
2923 HTMLStyle_get_fontFamily
,
2924 HTMLStyle_put_fontStyle
,
2925 HTMLStyle_get_fontStyle
,
2926 HTMLStyle_put_fontVariant
,
2927 HTMLStyle_get_fontVariant
,
2928 HTMLStyle_put_fontWeight
,
2929 HTMLStyle_get_fontWeight
,
2930 HTMLStyle_put_fontSize
,
2931 HTMLStyle_get_fontSize
,
2934 HTMLStyle_put_color
,
2935 HTMLStyle_get_color
,
2936 HTMLStyle_put_background
,
2937 HTMLStyle_get_background
,
2938 HTMLStyle_put_backgroundColor
,
2939 HTMLStyle_get_backgroundColor
,
2940 HTMLStyle_put_backgroundImage
,
2941 HTMLStyle_get_backgroundImage
,
2942 HTMLStyle_put_backgroundRepeat
,
2943 HTMLStyle_get_backgroundRepeat
,
2944 HTMLStyle_put_backgroundAttachment
,
2945 HTMLStyle_get_backgroundAttachment
,
2946 HTMLStyle_put_backgroundPosition
,
2947 HTMLStyle_get_backgroundPosition
,
2948 HTMLStyle_put_backgroundPositionX
,
2949 HTMLStyle_get_backgroundPositionX
,
2950 HTMLStyle_put_backgroundPositionY
,
2951 HTMLStyle_get_backgroundPositionY
,
2952 HTMLStyle_put_wordSpacing
,
2953 HTMLStyle_get_wordSpacing
,
2954 HTMLStyle_put_letterSpacing
,
2955 HTMLStyle_get_letterSpacing
,
2956 HTMLStyle_put_textDecoration
,
2957 HTMLStyle_get_textDecoration
,
2958 HTMLStyle_put_textDecorationNone
,
2959 HTMLStyle_get_textDecorationNone
,
2960 HTMLStyle_put_textDecorationUnderline
,
2961 HTMLStyle_get_textDecorationUnderline
,
2962 HTMLStyle_put_textDecorationOverline
,
2963 HTMLStyle_get_textDecorationOverline
,
2964 HTMLStyle_put_textDecorationLineThrough
,
2965 HTMLStyle_get_textDecorationLineThrough
,
2966 HTMLStyle_put_textDecorationBlink
,
2967 HTMLStyle_get_textDecorationBlink
,
2968 HTMLStyle_put_verticalAlign
,
2969 HTMLStyle_get_verticalAlign
,
2970 HTMLStyle_put_textTransform
,
2971 HTMLStyle_get_textTransform
,
2972 HTMLStyle_put_textAlign
,
2973 HTMLStyle_get_textAlign
,
2974 HTMLStyle_put_textIndent
,
2975 HTMLStyle_get_textIndent
,
2976 HTMLStyle_put_lineHeight
,
2977 HTMLStyle_get_lineHeight
,
2978 HTMLStyle_put_marginTop
,
2979 HTMLStyle_get_marginTop
,
2980 HTMLStyle_put_marginRight
,
2981 HTMLStyle_get_marginRight
,
2982 HTMLStyle_put_marginBottom
,
2983 HTMLStyle_get_marginBottom
,
2984 HTMLStyle_put_marginLeft
,
2985 HTMLStyle_get_marginLeft
,
2986 HTMLStyle_put_margin
,
2987 HTMLStyle_get_margin
,
2988 HTMLStyle_put_paddingTop
,
2989 HTMLStyle_get_paddingTop
,
2990 HTMLStyle_put_paddingRight
,
2991 HTMLStyle_get_paddingRight
,
2992 HTMLStyle_put_paddingBottom
,
2993 HTMLStyle_get_paddingBottom
,
2994 HTMLStyle_put_paddingLeft
,
2995 HTMLStyle_get_paddingLeft
,
2996 HTMLStyle_put_padding
,
2997 HTMLStyle_get_padding
,
2998 HTMLStyle_put_border
,
2999 HTMLStyle_get_border
,
3000 HTMLStyle_put_borderTop
,
3001 HTMLStyle_get_borderTop
,
3002 HTMLStyle_put_borderRight
,
3003 HTMLStyle_get_borderRight
,
3004 HTMLStyle_put_borderBottom
,
3005 HTMLStyle_get_borderBottom
,
3006 HTMLStyle_put_borderLeft
,
3007 HTMLStyle_get_borderLeft
,
3008 HTMLStyle_put_borderColor
,
3009 HTMLStyle_get_borderColor
,
3010 HTMLStyle_put_borderTopColor
,
3011 HTMLStyle_get_borderTopColor
,
3012 HTMLStyle_put_borderRightColor
,
3013 HTMLStyle_get_borderRightColor
,
3014 HTMLStyle_put_borderBottomColor
,
3015 HTMLStyle_get_borderBottomColor
,
3016 HTMLStyle_put_borderLeftColor
,
3017 HTMLStyle_get_borderLeftColor
,
3018 HTMLStyle_put_borderWidth
,
3019 HTMLStyle_get_borderWidth
,
3020 HTMLStyle_put_borderTopWidth
,
3021 HTMLStyle_get_borderTopWidth
,
3022 HTMLStyle_put_borderRightWidth
,
3023 HTMLStyle_get_borderRightWidth
,
3024 HTMLStyle_put_borderBottomWidth
,
3025 HTMLStyle_get_borderBottomWidth
,
3026 HTMLStyle_put_borderLeftWidth
,
3027 HTMLStyle_get_borderLeftWidth
,
3028 HTMLStyle_put_borderStyle
,
3029 HTMLStyle_get_borderStyle
,
3030 HTMLStyle_put_borderTopStyle
,
3031 HTMLStyle_get_borderTopStyle
,
3032 HTMLStyle_put_borderRightStyle
,
3033 HTMLStyle_get_borderRightStyle
,
3034 HTMLStyle_put_borderBottomStyle
,
3035 HTMLStyle_get_borderBottomStyle
,
3036 HTMLStyle_put_borderLeftStyle
,
3037 HTMLStyle_get_borderLeftStyle
,
3038 HTMLStyle_put_width
,
3039 HTMLStyle_get_width
,
3040 HTMLStyle_put_height
,
3041 HTMLStyle_get_height
,
3042 HTMLStyle_put_styleFloat
,
3043 HTMLStyle_get_styleFloat
,
3044 HTMLStyle_put_clear
,
3045 HTMLStyle_get_clear
,
3046 HTMLStyle_put_display
,
3047 HTMLStyle_get_display
,
3048 HTMLStyle_put_visibility
,
3049 HTMLStyle_get_visibility
,
3050 HTMLStyle_put_listStyleType
,
3051 HTMLStyle_get_listStyleType
,
3052 HTMLStyle_put_listStylePosition
,
3053 HTMLStyle_get_listStylePosition
,
3054 HTMLStyle_put_listStyleImage
,
3055 HTMLStyle_get_listStyleImage
,
3056 HTMLStyle_put_listStyle
,
3057 HTMLStyle_get_listStyle
,
3058 HTMLStyle_put_whiteSpace
,
3059 HTMLStyle_get_whiteSpace
,
3064 HTMLStyle_get_position
,
3065 HTMLStyle_put_zIndex
,
3066 HTMLStyle_get_zIndex
,
3067 HTMLStyle_put_overflow
,
3068 HTMLStyle_get_overflow
,
3069 HTMLStyle_put_pageBreakBefore
,
3070 HTMLStyle_get_pageBreakBefore
,
3071 HTMLStyle_put_pageBreakAfter
,
3072 HTMLStyle_get_pageBreakAfter
,
3073 HTMLStyle_put_cssText
,
3074 HTMLStyle_get_cssText
,
3075 HTMLStyle_put_pixelTop
,
3076 HTMLStyle_get_pixelTop
,
3077 HTMLStyle_put_pixelLeft
,
3078 HTMLStyle_get_pixelLeft
,
3079 HTMLStyle_put_pixelWidth
,
3080 HTMLStyle_get_pixelWidth
,
3081 HTMLStyle_put_pixelHeight
,
3082 HTMLStyle_get_pixelHeight
,
3083 HTMLStyle_put_posTop
,
3084 HTMLStyle_get_posTop
,
3085 HTMLStyle_put_posLeft
,
3086 HTMLStyle_get_posLeft
,
3087 HTMLStyle_put_posWidth
,
3088 HTMLStyle_get_posWidth
,
3089 HTMLStyle_put_posHeight
,
3090 HTMLStyle_get_posHeight
,
3091 HTMLStyle_put_cursor
,
3092 HTMLStyle_get_cursor
,
3095 HTMLStyle_put_filter
,
3096 HTMLStyle_get_filter
,
3097 HTMLStyle_setAttribute
,
3098 HTMLStyle_getAttribute
,
3099 HTMLStyle_removeAttribute
,
3103 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3105 const style_tbl_entry_t
*style_entry
;
3107 style_entry
= lookup_style_tbl(name
);
3109 *dispid
= style_entry
->dispid
;
3113 return DISP_E_UNKNOWNNAME
;
3116 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3118 HTMLStyle_get_dispid
,
3123 static const tid_t HTMLStyle_iface_tids
[] = {
3132 static dispex_static_data_t HTMLStyle_dispex
= {
3133 &HTMLStyle_dispex_vtbl
,
3136 HTMLStyle_iface_tids
3139 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3141 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3145 FIXME("NULL nselem\n");
3149 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3150 (void**)&nselemstyle
);
3151 assert(nsres
== NS_OK
);
3153 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3154 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3155 if(NS_FAILED(nsres
)) {
3156 ERR("GetStyle failed: %08x\n", nsres
);
3163 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3165 nsIDOMCSSStyleDeclaration
*nsstyle
;
3169 hres
= get_style_from_elem(elem
, &nsstyle
);
3173 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3175 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3176 return E_OUTOFMEMORY
;
3179 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3181 style
->nsstyle
= nsstyle
;
3183 HTMLStyle2_Init(style
);
3184 HTMLStyle3_Init(style
);
3186 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3188 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3194 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3196 nsIDOMCSSStyleDeclaration
*style
;
3199 hres
= get_style_from_elem(elem
, &style
);
3203 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3204 nsIDOMCSSStyleDeclaration_Release(style
);
3208 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3210 nsIDOMCSSStyleDeclaration
*style
;
3213 hres
= get_style_from_elem(elem
, &style
);
3217 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3218 nsIDOMCSSStyleDeclaration_Release(style
);