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 attrBackgroundAttachment
[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','a','t','t','a','c','h','m','e','n','t',0};
42 static const WCHAR attrBackgroundColor
[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
44 static const WCHAR attrBackgroundImage
[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
46 static const WCHAR attrBackgroundPosition
[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
48 static const WCHAR attrBackgroundPositionX
[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
50 static const WCHAR attrBackgroundPositionY
[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
52 static const WCHAR attrBackgroundRepeat
[] =
53 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
54 static const WCHAR attrBorder
[] =
55 {'b','o','r','d','e','r',0};
56 static const WCHAR attrBorderBottom
[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
58 static const WCHAR attrBorderBottomColor
[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
60 static const WCHAR attrBorderBottomStyle
[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
62 static const WCHAR attrBorderBottomWidth
[] =
63 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
64 static const WCHAR attrBorderColor
[] =
65 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
66 static const WCHAR attrBorderLeft
[] =
67 {'b','o','r','d','e','r','-','l','e','f','t',0};
68 static const WCHAR attrBorderLeftColor
[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
70 static const WCHAR attrBorderLeftStyle
[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
72 static const WCHAR attrBorderLeftWidth
[] =
73 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
74 static const WCHAR attrBorderRight
[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
76 static const WCHAR attrBorderRightColor
[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
78 static const WCHAR attrBorderRightStyle
[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
80 static const WCHAR attrBorderRightWidth
[] =
81 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
82 static const WCHAR attrBorderTop
[] =
83 {'b','o','r','d','e','r','-','t','o','p',0};
84 static const WCHAR attrBorderTopColor
[] =
85 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
86 static const WCHAR attrBorderStyle
[] =
87 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopStyle
[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
90 static const WCHAR attrBorderTopWidth
[] =
91 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
92 static const WCHAR attrBorderWidth
[] =
93 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
94 static const WCHAR attrBottom
[] =
95 {'b','o','t','t','o','m',0};
96 /* FIXME: Use unprefixed version (requires Gecko changes). */
97 static const WCHAR attrBoxSizing
[] =
98 {'-','m','o','z','-','b','o','x','-','s','i','z','i','n','g',0};
99 static const WCHAR attrClear
[] =
100 {'c','l','e','a','r',0};
101 static const WCHAR attrClip
[] =
103 static const WCHAR attrColor
[] =
104 {'c','o','l','o','r',0};
105 static const WCHAR attrCursor
[] =
106 {'c','u','r','s','o','r',0};
107 static const WCHAR attrDirection
[] =
108 {'d','i','r','e','c','t','i','o','n',0};
109 static const WCHAR attrDisplay
[] =
110 {'d','i','s','p','l','a','y',0};
111 static const WCHAR attrFilter
[] =
112 {'f','i','l','e','t','e','r',0};
113 static const WCHAR attrFontFamily
[] =
114 {'f','o','n','t','-','f','a','m','i','l','y',0};
115 static const WCHAR attrFontSize
[] =
116 {'f','o','n','t','-','s','i','z','e',0};
117 static const WCHAR attrFontStyle
[] =
118 {'f','o','n','t','-','s','t','y','l','e',0};
119 static const WCHAR attrFontVariant
[] =
120 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
121 static const WCHAR attrFontWeight
[] =
122 {'f','o','n','t','-','w','e','i','g','h','t',0};
123 static const WCHAR attrHeight
[] =
124 {'h','e','i','g','h','t',0};
125 static const WCHAR attrLeft
[] =
127 static const WCHAR attrLetterSpacing
[] =
128 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
129 static const WCHAR attrLineHeight
[] =
130 {'l','i','n','e','-','h','e','i','g','h','t',0};
131 static const WCHAR attrListStyle
[] =
132 {'l','i','s','t','-','s','t','y','l','e',0};
133 static const WCHAR attrListStyleType
[] =
134 {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0};
135 static const WCHAR attrListStylePosition
[] =
136 {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0};
137 static const WCHAR attrMargin
[] =
138 {'m','a','r','g','i','n',0};
139 static const WCHAR attrMarginBottom
[] =
140 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
141 static const WCHAR attrMarginLeft
[] =
142 {'m','a','r','g','i','n','-','l','e','f','t',0};
143 static const WCHAR attrMarginRight
[] =
144 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
145 static const WCHAR attrMarginTop
[] =
146 {'m','a','r','g','i','n','-','t','o','p',0};
147 static const WCHAR attrMinHeight
[] =
148 {'m','i','n','-','h','e','i','g','h','t',0};
149 static const WCHAR attrMinWidth
[] =
150 {'m','i','n','-','w','i','d','t','h',0};
151 static const WCHAR attrOutline
[] =
152 {'o','u','t','l','i','n','e',0};
153 static const WCHAR attrOverflow
[] =
154 {'o','v','e','r','f','l','o','w',0};
155 static const WCHAR attrOverflowX
[] =
156 {'o','v','e','r','f','l','o','w','-','x',0};
157 static const WCHAR attrOverflowY
[] =
158 {'o','v','e','r','f','l','o','w','-','y',0};
159 static const WCHAR attrPadding
[] =
160 {'p','a','d','d','i','n','g',0};
161 static const WCHAR attrPaddingBottom
[] =
162 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
163 static const WCHAR attrPaddingLeft
[] =
164 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
165 static const WCHAR attrPaddingRight
[] =
166 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
167 static const WCHAR attrPaddingTop
[] =
168 {'p','a','d','d','i','n','g','-','t','o','p',0};
169 static const WCHAR attrPageBreakAfter
[] =
170 {'p','a','g','e','-','b','r','e','a','k','-','a','f','t','e','r',0};
171 static const WCHAR attrPageBreakBefore
[] =
172 {'p','a','g','e','-','b','r','e','a','k','-','b','e','f','o','r','e',0};
173 static const WCHAR attrPosition
[] =
174 {'p','o','s','i','t','i','o','n',0};
175 static const WCHAR attrRight
[] =
176 {'r','i','g','h','t',0};
177 static const WCHAR attrTableLayout
[] =
178 {'t','a','b','l','e','-','l','a','y','o','u','t',0};
179 static const WCHAR attrTextAlign
[] =
180 {'t','e','x','t','-','a','l','i','g','n',0};
181 static const WCHAR attrTextDecoration
[] =
182 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
183 static const WCHAR attrTextIndent
[] =
184 {'t','e','x','t','-','i','n','d','e','n','t',0};
185 static const WCHAR attrTextTransform
[] =
186 {'t','e','x','t','-','t','r','a','n','s','f','o','r','m',0};
187 static const WCHAR attrTop
[] =
189 static const WCHAR attrVerticalAlign
[] =
190 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
191 static const WCHAR attrVisibility
[] =
192 {'v','i','s','i','b','i','l','i','t','y',0};
193 static const WCHAR attrWhiteSpace
[] =
194 {'w','h','i','t','e','-','s','p','a','c','e',0};
195 static const WCHAR attrWidth
[] =
196 {'w','i','d','t','h',0};
197 static const WCHAR attrWordSpacing
[] =
198 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
199 static const WCHAR attrWordWrap
[] =
200 {'w','o','r','d','-','w','r','a','p',0};
201 static const WCHAR attrZIndex
[] =
202 {'z','-','i','n','d','e','x',0};
205 static const WCHAR pxW
[] = {'p','x',0};
212 static const style_tbl_entry_t style_tbl
[] = {
213 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
214 {attrBackgroundAttachment
, DISPID_IHTMLSTYLE_BACKGROUNDATTACHMENT
},
215 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
216 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
217 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
218 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
219 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
220 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
221 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
222 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
223 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
224 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
225 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
226 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
227 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
228 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
229 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
230 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
231 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
232 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
233 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
234 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
235 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
236 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
237 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
238 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
239 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
240 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
241 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
242 {attrBoxSizing
, DISPID_IHTMLSTYLE6_BOXSIZING
},
243 {attrClear
, DISPID_IHTMLSTYLE_CLEAR
},
244 {attrClip
, DISPID_IHTMLSTYLE_CLIP
},
245 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
246 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
247 {attrDirection
, DISPID_IHTMLSTYLE2_DIRECTION
},
248 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
249 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
250 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
251 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
252 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
253 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
254 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
255 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
256 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
257 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
258 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
259 {attrListStyle
, DISPID_IHTMLSTYLE_LISTSTYLE
},
260 {attrListStylePosition
, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION
},
261 {attrListStyleType
, DISPID_IHTMLSTYLE_LISTSTYLETYPE
},
262 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
263 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
264 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
265 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
266 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
267 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
268 {attrMinWidth
, DISPID_IHTMLSTYLE5_MINWIDTH
},
269 {attrOutline
, DISPID_IHTMLSTYLE6_OUTLINE
},
270 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
271 {attrOverflowX
, DISPID_IHTMLSTYLE2_OVERFLOWX
},
272 {attrOverflowY
, DISPID_IHTMLSTYLE2_OVERFLOWY
},
273 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
274 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
275 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
276 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
277 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
278 {attrPageBreakAfter
, DISPID_IHTMLSTYLE_PAGEBREAKAFTER
},
279 {attrPageBreakBefore
, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE
},
280 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
281 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
282 {attrTableLayout
, DISPID_IHTMLSTYLE2_TABLELAYOUT
},
283 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
284 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
285 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
286 {attrTextTransform
, DISPID_IHTMLSTYLE_TEXTTRANSFORM
},
287 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
288 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
289 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
290 {attrWhiteSpace
, DISPID_IHTMLSTYLE_WHITESPACE
},
291 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
292 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
293 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
294 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
297 static const WCHAR valLineThrough
[] =
298 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
299 static const WCHAR valUnderline
[] =
300 {'u','n','d','e','r','l','i','n','e',0};
301 static const WCHAR szNormal
[] =
302 {'n','o','r','m','a','l',0};
303 static const WCHAR styleNone
[] =
305 static const WCHAR valOverline
[] =
306 {'o','v','e','r','l','i','n','e',0};
307 static const WCHAR valBlink
[] =
308 {'b','l','i','n','k',0};
310 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
311 static const WCHAR emptyW
[] = {0};
313 static const style_tbl_entry_t
*lookup_style_tbl(const WCHAR
*name
)
315 int c
, i
, min
= 0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
320 c
= strcmpW(style_tbl
[i
].name
, name
);
333 static LPWSTR
fix_px_value(LPCWSTR val
)
338 while(*ptr
&& isspaceW(*ptr
))
343 while(*ptr
&& isdigitW(*ptr
))
346 if(!*ptr
|| isspaceW(*ptr
)) {
348 int len
= strlenW(val
)+1;
350 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
351 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
357 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
362 while(*ptr
&& !isspaceW(*ptr
))
369 static LPWSTR
fix_url_value(LPCWSTR val
)
373 static const WCHAR urlW
[] = {'u','r','l','('};
375 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
378 ret
= heap_strdupW(val
);
380 for(ptr
= ret
; *ptr
; ptr
++) {
388 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, const WCHAR
*value
, DWORD flags
)
390 nsAString str_name
, str_value
, str_empty
;
395 if(flags
& ATTR_FIX_PX
)
396 val
= fix_px_value(value
);
397 if(flags
& ATTR_FIX_URL
)
398 val
= fix_url_value(value
);
401 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
402 nsAString_InitDepend(&str_value
, val
? val
: value
);
403 nsAString_InitDepend(&str_empty
, emptyW
);
405 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
407 ERR("SetProperty failed: %08x\n", nsres
);
409 nsAString_Finish(&str_name
);
410 nsAString_Finish(&str_value
);
411 nsAString_Finish(&str_empty
);
417 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
428 case VT_BSTR
|VT_BYREF
:
429 *ret
= *V_BSTRREF(v
);
433 static const WCHAR formatW
[] = {'%','d',0};
434 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
436 if(flags
& ATTR_HEX_INT
)
437 wsprintfW(buf
, hex_formatW
, V_I4(v
));
438 else if(flags
& ATTR_FIX_PX
)
439 wsprintfW(buf
, px_formatW
, V_I4(v
));
441 wsprintfW(buf
, formatW
, V_I4(v
));
447 FIXME("not implemented for %s\n", debugstr_variant(v
));
453 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
459 hres
= var_to_styleval(value
, buf
, flags
, &val
);
463 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
466 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
468 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
471 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
476 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
478 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
479 if(NS_FAILED(nsres
)) {
480 ERR("SetProperty failed: %08x\n", nsres
);
484 nsAString_Finish(&str_name
);
489 static HRESULT
nsstyle_to_bstr(const WCHAR
*val
, DWORD flags
, BSTR
*p
)
495 *p
= (flags
& ATTR_NO_NULL
) ? SysAllocStringLen(NULL
, 0) : NULL
;
499 ret
= SysAllocString(val
);
501 return E_OUTOFMEMORY
;
503 len
= SysStringLen(ret
);
505 if(flags
& ATTR_REMOVE_COMMA
) {
509 for(ptr
= ret
; (ptr
= strchrW(ptr
, ',')); ptr
++)
515 new_ret
= SysAllocStringLen(NULL
, new_len
);
518 return E_OUTOFMEMORY
;
521 for(ptr2
= new_ret
, ptr
= ret
; *ptr
; ptr
++) {
535 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
, DWORD flags
)
538 const PRUnichar
*value
;
541 nsAString_Init(&str_value
, NULL
);
543 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
545 nsAString_GetData(&str_value
, &value
);
546 hres
= nsstyle_to_bstr(value
, flags
, p
);
547 nsAString_Finish(&str_value
);
549 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
553 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
556 const PRUnichar
*value
;
560 nsAString_Init(&str_value
, NULL
);
562 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
564 nsAString_GetData(&str_value
, &value
);
566 if(flags
& ATTR_STR_TO_INT
) {
567 const PRUnichar
*ptr
= value
;
576 while(isdigitW(*ptr
))
577 i
= i
*10 + (*ptr
++ - '0');
581 V_I4(p
) = neg
? -i
: i
;
589 hres
= nsstyle_to_bstr(value
, flags
, &str
);
590 if(SUCCEEDED(hres
)) {
596 nsAString_Finish(&str_value
);
598 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
602 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
604 return get_nsstyle_attr(This
->nsstyle
, sid
, p
, 0);
607 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
610 const PRUnichar
*value
;
612 nsAString_Init(&str_value
, NULL
);
614 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
616 nsAString_GetData(&str_value
, &value
);
617 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
618 nsAString_Finish(&str_value
);
620 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
624 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
627 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
629 value
= floor(value
);
631 sprintfW(szValue
, szFormat
, value
);
633 return set_style_attr(This
, sid
, szValue
, 0);
636 static HRESULT
set_style_pxattr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LONG value
)
640 sprintfW(value_str
, px_formatW
, value
);
642 return set_nsstyle_attr(nsstyle
, sid
, value_str
, 0);
645 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
650 TRACE("%p %d %p\n", This
, sid
, p
);
654 nsAString_Init(&str_value
, NULL
);
656 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
660 const PRUnichar
*value
;
662 nsAString_GetData(&str_value
, &value
);
665 *p
= strtolW(value
, &ptr
, 10);
667 if(*ptr
&& strcmpW(ptr
, pxW
))
669 nsAString_Finish(&str_value
);
670 FIXME("only px values are currently supported\n");
676 TRACE("ret %f\n", *p
);
678 nsAString_Finish(&str_value
);
682 static HRESULT
get_nsstyle_pixel_val(HTMLStyle
*This
, styleid_t sid
, LONG
*p
)
690 nsAString_Init(&str_value
, NULL
);
692 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
695 const PRUnichar
*value
;
697 nsAString_GetData(&str_value
, &value
);
699 *p
= strtolW(value
, &ptr
, 10);
702 /* Skip all digits. We have tests showing that we should not round the value. */
703 while(isdigitW(*++ptr
));
706 if(*ptr
&& strcmpW(ptr
, pxW
)) {
707 nsAString_Finish(&str_value
);
708 FIXME("%s: only px values are currently supported\n", debugstr_w(value
));
716 nsAString_Finish(&str_value
);
720 static BOOL
is_valid_border_style(BSTR v
)
722 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
723 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
724 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
725 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
726 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
727 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
728 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
729 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
731 TRACE("%s\n", debugstr_w(v
));
733 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
734 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
735 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
736 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
737 strcmpiW(v
, styleOutset
) == 0 )
745 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
747 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
750 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
752 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
754 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
756 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
757 *ppv
= &This
->IHTMLStyle_iface
;
758 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
759 *ppv
= &This
->IHTMLStyle_iface
;
760 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
761 *ppv
= &This
->IHTMLStyle2_iface
;
762 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
763 *ppv
= &This
->IHTMLStyle3_iface
;
764 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
765 *ppv
= &This
->IHTMLStyle4_iface
;
766 }else if(IsEqualGUID(&IID_IHTMLStyle5
, riid
)) {
767 *ppv
= &This
->IHTMLStyle5_iface
;
768 }else if(IsEqualGUID(&IID_IHTMLStyle6
, riid
)) {
769 *ppv
= &This
->IHTMLStyle6_iface
;
770 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
771 return *ppv
? S_OK
: E_NOINTERFACE
;
774 WARN("unsupported iface %s\n", debugstr_mshtml_guid(riid
));
775 return E_NOINTERFACE
;
778 IUnknown_AddRef((IUnknown
*)*ppv
);
782 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
784 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
785 LONG ref
= InterlockedIncrement(&This
->ref
);
787 TRACE("(%p) ref=%d\n", This
, ref
);
792 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
794 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
795 LONG ref
= InterlockedDecrement(&This
->ref
);
797 TRACE("(%p) ref=%d\n", This
, ref
);
802 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
803 release_dispex(&This
->dispex
);
810 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
812 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
813 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
816 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
817 LCID lcid
, ITypeInfo
**ppTInfo
)
819 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
820 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
823 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
824 LPOLESTR
*rgszNames
, UINT cNames
,
825 LCID lcid
, DISPID
*rgDispId
)
827 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
828 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
832 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
833 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
834 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
836 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
837 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
838 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
841 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
843 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
845 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
847 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
850 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
852 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
854 TRACE("(%p)->(%p)\n", This
, p
);
856 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
859 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
861 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
862 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
863 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
865 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
867 /* fontStyle can only be one of the follow values. */
868 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
869 strcmpiW(szOblique
, v
) == 0)
871 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
877 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
879 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
881 TRACE("(%p)->(%p)\n", This
, p
);
883 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
886 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
888 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
889 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
891 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
893 /* fontVariant can only be one of the follow values. */
894 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
896 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
902 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
904 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
905 TRACE("(%p)->(%p)\n", This
, p
);
910 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
913 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
915 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
916 static const WCHAR styleBold
[] = {'b','o','l','d',0};
917 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
918 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
919 static const WCHAR style100
[] = {'1','0','0',0};
920 static const WCHAR style200
[] = {'2','0','0',0};
921 static const WCHAR style300
[] = {'3','0','0',0};
922 static const WCHAR style400
[] = {'4','0','0',0};
923 static const WCHAR style500
[] = {'5','0','0',0};
924 static const WCHAR style600
[] = {'6','0','0',0};
925 static const WCHAR style700
[] = {'7','0','0',0};
926 static const WCHAR style800
[] = {'8','0','0',0};
927 static const WCHAR style900
[] = {'9','0','0',0};
929 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
931 /* fontWeight can only be one of the following */
932 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
933 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
934 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
935 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
936 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
937 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
938 strcmpiW(style900
, v
) == 0
941 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
947 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
949 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
951 TRACE("(%p)->(%p)\n", This
, p
);
953 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
956 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
958 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
960 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
962 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, &v
, ATTR_FIX_PX
);
965 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
967 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
969 TRACE("(%p)->(%p)\n", This
, p
);
971 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_FONT_SIZE
, p
, 0);
974 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
976 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
977 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
981 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
983 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
984 FIXME("(%p)->(%p)\n", This
, p
);
988 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
990 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
992 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
994 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, &v
, ATTR_HEX_INT
);
997 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
999 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1001 TRACE("(%p)->(%p)\n", This
, p
);
1003 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_COLOR
, p
, 0);
1006 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
1008 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1010 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1012 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
1015 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
1017 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1019 TRACE("(%p)->(%p)\n", This
, p
);
1021 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
1024 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
1026 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1028 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1030 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, &v
, ATTR_HEX_INT
);
1033 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
1035 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1037 TRACE("(%p)->(%p)\n", This
, p
);
1039 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BACKGROUND_COLOR
, p
, 0);
1042 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
1044 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1046 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1048 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
1051 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
1053 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1055 TRACE("(%p)->(%p)\n", This
, p
);
1057 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
1060 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
1062 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1063 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
1064 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
1065 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
1066 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
1068 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1070 /* fontWeight can only be one of the following */
1071 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
1072 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
1074 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
1077 return E_INVALIDARG
;
1080 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
1082 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1084 TRACE("(%p)->(%p)\n", This
, p
);
1086 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
1089 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
1091 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1093 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1095 return set_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, v
, 0);
1098 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
1100 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1102 TRACE("(%p)->(%p)\n", This
, p
);
1104 return get_style_attr(This
, STYLEID_BACKGROUND_ATTACHMENT
, p
);
1107 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
1109 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1111 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1113 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
1116 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
1118 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1120 TRACE("(%p)->(%p)\n", This
, p
);
1122 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
1125 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
1127 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1128 WCHAR buf
[14], *pos_val
;
1134 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1136 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1140 val_len
= val
? strlenW(val
) : 0;
1142 nsAString_Init(&pos_str
, NULL
);
1143 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1144 if(SUCCEEDED(hres
)) {
1145 const PRUnichar
*pos
, *posy
;
1148 nsAString_GetData(&pos_str
, &pos
);
1149 posy
= strchrW(pos
, ' ');
1151 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1153 TRACE("no space in %s\n", debugstr_w(pos
));
1157 posy_len
= strlenW(posy
);
1158 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1161 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1163 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1164 pos_val
[val_len
+posy_len
] = 0;
1166 hres
= E_OUTOFMEMORY
;
1169 nsAString_Finish(&pos_str
);
1173 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1174 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1179 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1181 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1186 TRACE("(%p)->(%p)\n", This
, p
);
1188 nsAString_Init(&pos_str
, NULL
);
1189 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1190 if(SUCCEEDED(hres
)) {
1191 const PRUnichar
*pos
, *space
;
1193 nsAString_GetData(&pos_str
, &pos
);
1194 space
= strchrW(pos
, ' ');
1196 WARN("no space in %s\n", debugstr_w(pos
));
1197 space
= pos
+ strlenW(pos
);
1201 ret
= SysAllocStringLen(pos
, space
-pos
);
1203 hres
= E_OUTOFMEMORY
;
1208 nsAString_Finish(&pos_str
);
1212 TRACE("returning %s\n", debugstr_w(ret
));
1218 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1220 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1221 WCHAR buf
[14], *pos_val
;
1227 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1229 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1233 val_len
= val
? strlenW(val
) : 0;
1235 nsAString_Init(&pos_str
, NULL
);
1236 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1237 if(SUCCEEDED(hres
)) {
1238 const PRUnichar
*pos
, *space
;
1241 nsAString_GetData(&pos_str
, &pos
);
1242 space
= strchrW(pos
, ' ');
1246 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1248 TRACE("no space in %s\n", debugstr_w(pos
));
1250 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1253 posx_len
= space
-pos
;
1255 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1257 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1259 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1260 pos_val
[posx_len
+val_len
] = 0;
1262 hres
= E_OUTOFMEMORY
;
1265 nsAString_Finish(&pos_str
);
1269 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1270 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1275 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1277 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1282 TRACE("(%p)->(%p)\n", This
, p
);
1284 nsAString_Init(&pos_str
, NULL
);
1285 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1286 if(SUCCEEDED(hres
)) {
1287 const PRUnichar
*pos
, *posy
;
1289 nsAString_GetData(&pos_str
, &pos
);
1290 posy
= strchrW(pos
, ' ');
1292 ret
= SysAllocString(posy
+1);
1294 hres
= E_OUTOFMEMORY
;
1299 nsAString_Finish(&pos_str
);
1303 TRACE("returning %s\n", debugstr_w(ret
));
1309 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1311 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1313 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1315 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1318 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1320 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1321 TRACE("(%p)->(%p)\n", This
, p
);
1322 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1325 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1327 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1329 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1331 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1334 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1336 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1337 TRACE("(%p)->(%p)\n", This
, p
);
1338 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1341 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1343 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1345 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1347 /* textDecoration can only be one of the following */
1348 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1349 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1350 strcmpiW(valBlink
, v
) == 0)
1352 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1355 return E_INVALIDARG
;
1358 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1360 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1362 TRACE("(%p)->(%p)\n", This
, p
);
1364 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1367 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1369 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1371 TRACE("(%p)->(%x)\n", This
, v
);
1373 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1376 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1378 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1380 TRACE("(%p)->(%p)\n", This
, p
);
1382 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1385 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1387 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1389 TRACE("(%p)->(%x)\n", This
, v
);
1391 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1394 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1396 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1398 TRACE("(%p)->(%p)\n", This
, p
);
1400 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1403 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1405 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1407 TRACE("(%p)->(%x)\n", This
, v
);
1409 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1412 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1414 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1416 TRACE("(%p)->(%p)\n", This
, p
);
1418 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1421 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1423 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1425 TRACE("(%p)->(%x)\n", This
, v
);
1427 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1430 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1432 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1434 TRACE("(%p)->(%p)\n", This
, p
);
1436 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1439 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1441 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1443 TRACE("(%p)->(%x)\n", This
, v
);
1445 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1448 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1450 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1452 TRACE("(%p)->(%p)\n", This
, p
);
1454 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1457 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1459 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1461 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1463 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, &v
, ATTR_FIX_PX
);
1466 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1468 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1470 TRACE("(%p)->(%p)\n", This
, p
);
1472 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_VERTICAL_ALIGN
, p
, 0);
1475 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1477 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1479 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1481 return set_style_attr(This
, STYLEID_TEXT_TRANSFORM
, v
, 0);
1484 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1486 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1488 TRACE("(%p)->(%p)\n", This
, p
);
1490 return get_style_attr(This
, STYLEID_TEXT_TRANSFORM
, p
);
1493 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1495 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1497 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1499 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1502 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1504 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1506 TRACE("(%p)->(%p)\n", This
, p
);
1508 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1511 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1513 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1515 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1517 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, &v
, ATTR_FIX_PX
);
1520 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1522 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1524 TRACE("(%p)->(%p)\n", This
, p
);
1526 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TEXT_INDENT
, p
, 0);
1529 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1531 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1533 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1535 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LINE_HEIGHT
, &v
, 0);
1538 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1540 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1542 TRACE("(%p)->(%p)\n", This
, p
);
1544 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LINE_HEIGHT
, p
, 0);
1547 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1549 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1551 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1553 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, ATTR_FIX_PX
);
1556 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1558 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1560 TRACE("(%p)->(%p)\n", This
, p
);
1562 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1565 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1567 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1569 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1571 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, &v
, ATTR_FIX_PX
);
1574 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1576 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1577 TRACE("(%p)->(%p)\n", This
, p
);
1578 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1581 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1583 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1585 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1587 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, &v
, ATTR_FIX_PX
);
1590 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1592 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1594 TRACE("(%p)->(%p)\n", This
, p
);
1596 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_BOTTOM
, p
, 0);
1599 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1601 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1603 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1605 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, &v
, ATTR_FIX_PX
);
1608 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1610 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1612 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1614 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1617 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1619 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1621 TRACE("(%p)->(%p)\n", This
, p
);
1623 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1626 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1628 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1629 TRACE("(%p)->(%p)\n", This
, p
);
1630 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1633 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1635 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1637 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1639 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, &v
, ATTR_FIX_PX
);
1642 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1644 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1646 TRACE("(%p)->(%p)\n", This
, p
);
1648 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_TOP
, p
, 0);
1651 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1653 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1655 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1657 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, &v
, ATTR_FIX_PX
);
1660 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1662 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1664 TRACE("(%p)->(%p)\n", This
, p
);
1666 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_RIGHT
, p
, 0);
1669 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1671 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1673 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1675 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, &v
, ATTR_FIX_PX
);
1678 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1680 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1682 TRACE("(%p)->(%p)\n", This
, p
);
1684 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_BOTTOM
, p
, 0);
1687 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1689 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1691 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1693 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, &v
, ATTR_FIX_PX
);
1696 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1698 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1700 TRACE("(%p)->(%p)\n", This
, p
);
1702 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_PADDING_LEFT
, p
, 0);
1705 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1707 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1709 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1711 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1714 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1716 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1718 TRACE("(%p)->(%p)\n", This
, p
);
1720 return get_style_attr(This
, STYLEID_PADDING
, p
);
1723 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1725 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1727 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1729 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1732 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1734 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1736 TRACE("(%p)->(%p)\n", This
, p
);
1738 return get_style_attr(This
, STYLEID_BORDER
, p
);
1741 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1743 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1744 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1745 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1748 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1750 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1751 TRACE("(%p)->(%p)\n", This
, p
);
1752 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1755 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1757 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1758 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1759 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1762 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1764 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1765 TRACE("(%p)->(%p)\n", This
, p
);
1766 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1769 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1771 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1772 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1773 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1776 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1778 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1779 TRACE("(%p)->(%p)\n", This
, p
);
1780 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1783 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1785 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1787 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1789 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1792 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1794 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1796 TRACE("(%p)->(%p)\n", This
, p
);
1798 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1801 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1803 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1805 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1807 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1810 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1812 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1814 TRACE("(%p)->(%p)\n", This
, p
);
1816 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1819 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1821 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1823 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1825 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1828 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1830 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1832 TRACE("(%p)->(%p)\n", This
, p
);
1834 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1837 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1839 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1841 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1843 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1846 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1848 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1850 TRACE("(%p)->(%p)\n", This
, p
);
1852 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1855 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1857 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1859 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1861 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1864 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1866 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1868 TRACE("(%p)->(%p)\n", This
, p
);
1870 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1873 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1875 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1877 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1879 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1882 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1884 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1886 TRACE("(%p)->(%p)\n", This
, p
);
1888 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1891 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1893 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1894 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1895 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1898 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1900 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1901 TRACE("(%p)->(%p)\n", This
, p
);
1902 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1905 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1907 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1909 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1911 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1914 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1916 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1918 TRACE("(%p)->(%p)\n", This
, p
);
1920 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1923 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1925 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1927 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1929 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1932 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1934 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1936 TRACE("(%p)->(%p)\n", This
, p
);
1938 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1941 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1943 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1945 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1947 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1950 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1952 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1953 TRACE("(%p)->(%p)\n", This
, p
);
1954 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1957 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1959 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1961 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1963 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1966 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1968 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1969 TRACE("(%p)->(%p)\n", This
, p
);
1970 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1973 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1975 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1976 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1977 HRESULT hres
= S_OK
;
1982 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1984 while(v
[i
] && hres
== S_OK
)
1986 if(v
[i
] == (WCHAR
)' ')
1988 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1989 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1991 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1992 hres
= E_INVALIDARG
;
1994 SysFreeString(pstyle
);
2002 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
2003 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
2005 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
2006 hres
= E_INVALIDARG
;
2008 SysFreeString(pstyle
);
2012 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
2017 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
2019 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2020 TRACE("(%p)->(%p)\n", This
, p
);
2021 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
2024 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
2026 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2027 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2029 if(!is_valid_border_style(v
))
2030 return E_INVALIDARG
;
2032 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
2035 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
2037 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2038 TRACE("(%p)->(%p)\n", This
, p
);
2039 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
2042 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
2044 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2045 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2047 if(!is_valid_border_style(v
))
2048 return E_INVALIDARG
;
2050 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
2053 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
2055 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2056 TRACE("(%p)->(%p)\n", This
, p
);
2057 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
2060 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
2062 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2063 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2065 if(!is_valid_border_style(v
))
2066 return E_INVALIDARG
;
2068 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
2071 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
2073 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2074 TRACE("(%p)->(%p)\n", This
, p
);
2075 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
2078 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
2080 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2081 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2083 if(!is_valid_border_style(v
))
2084 return E_INVALIDARG
;
2086 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
2089 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
2091 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2092 TRACE("(%p)->(%p)\n", This
, p
);
2093 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
2096 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
2098 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2100 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2102 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
2105 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
2107 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2109 TRACE("(%p)->(%p)\n", This
, p
);
2111 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, p
, 0);
2114 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2116 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2118 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2120 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, &v
, ATTR_FIX_PX
);
2123 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2125 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2127 TRACE("(%p)->(%p)\n", This
, p
);
2129 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_HEIGHT
, p
, 0);
2132 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2134 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2135 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2139 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2141 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2142 FIXME("(%p)->(%p)\n", This
, p
);
2146 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2148 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2150 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2152 return set_style_attr(This
, STYLEID_CLEAR
, v
, 0);
2155 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2157 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2159 TRACE("(%p)->(%p)\n", This
, p
);
2161 return get_style_attr(This
, STYLEID_CLEAR
, p
);
2164 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2166 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2168 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2170 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2173 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2175 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2177 TRACE("(%p)->(%p)\n", This
, p
);
2179 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2182 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2184 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2186 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2188 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2191 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2193 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2195 TRACE("(%p)->(%p)\n", This
, p
);
2197 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2200 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2202 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2204 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2206 return set_style_attr(This
, STYLEID_LISTSTYLETYPE
, v
, 0);
2209 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2211 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2213 TRACE("(%p)->(%p)\n", This
, p
);
2215 return get_style_attr(This
, STYLEID_LISTSTYLETYPE
, p
);
2218 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2220 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2222 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2224 return set_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, v
, 0);
2227 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2229 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2231 TRACE("(%p)->(%p)\n", This
, p
);
2233 return get_style_attr(This
, STYLEID_LISTSTYLEPOSITION
, p
);
2236 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2238 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2239 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2243 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2245 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2246 FIXME("(%p)->(%p)\n", This
, p
);
2250 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2252 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2254 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2256 return set_style_attr(This
, STYLEID_LIST_STYLE
, v
, 0);
2259 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2261 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2263 TRACE("(%p)->(%p)\n", This
, p
);
2265 return get_style_attr(This
, STYLEID_LIST_STYLE
, p
);
2268 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2270 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2272 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2274 return set_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, v
, 0);
2277 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2279 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2281 TRACE("(%p)->(%p)\n", This
, p
);
2283 return get_nsstyle_attr(This
->nsstyle
, STYLEID_WHITE_SPACE
, p
, 0);
2286 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2288 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2290 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2292 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2295 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2297 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2299 TRACE("(%p)->(%p)\n", This
, p
);
2301 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, p
, 0);
2304 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2306 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2308 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2310 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2313 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2315 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2317 TRACE("(%p)->(%p)\n", This
, p
);
2319 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, p
, 0);
2322 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2324 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2325 TRACE("(%p)->(%p)\n", This
, p
);
2326 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2329 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2331 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2333 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2335 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, &v
, 0);
2338 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2340 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2342 TRACE("(%p)->(%p)\n", This
, p
);
2344 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2347 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2349 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2350 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2351 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2352 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2353 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2355 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2357 /* overflow can only be one of the follow values. */
2358 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2359 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2361 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2364 return E_INVALIDARG
;
2368 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2370 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2372 TRACE("(%p)->(%p)\n", This
, p
);
2375 return E_INVALIDARG
;
2377 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2380 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2382 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2384 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2386 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, v
, 0);
2389 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2391 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2393 TRACE("(%p)->(%p)\n", This
, p
);
2395 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_BEFORE
, p
, 0);
2398 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2400 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2402 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2404 return set_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, v
, 0);
2407 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2409 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2411 TRACE("(%p)->(%p)\n", This
, p
);
2413 return get_nsstyle_attr(This
->nsstyle
, STYLEID_PAGE_BREAK_AFTER
, p
, 0);
2416 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2418 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2422 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2424 nsAString_InitDepend(&text_str
, v
);
2425 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2426 nsAString_Finish(&text_str
);
2427 if(NS_FAILED(nsres
)) {
2428 FIXME("SetCssStyle failed: %08x\n", nsres
);
2435 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2437 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2441 TRACE("(%p)->(%p)\n", This
, p
);
2443 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2444 nsAString_Init(&text_str
, NULL
);
2445 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2446 if(NS_SUCCEEDED(nsres
)) {
2447 const PRUnichar
*text
;
2449 nsAString_GetData(&text_str
, &text
);
2450 *p
= *text
? SysAllocString(text
) : NULL
;
2452 FIXME("GetCssStyle failed: %08x\n", nsres
);
2456 nsAString_Finish(&text_str
);
2460 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2462 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2464 TRACE("(%p)->(%d)\n", This
, v
);
2466 return set_style_pxattr(This
->nsstyle
, STYLEID_TOP
, v
);
2469 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2471 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2473 TRACE("(%p)->(%p)\n", This
, p
);
2475 return get_nsstyle_pixel_val(This
, STYLEID_TOP
, p
);
2478 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2480 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2482 TRACE("(%p)->(%d)\n", This
, v
);
2484 return set_style_pxattr(This
->nsstyle
, STYLEID_LEFT
, v
);
2487 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2489 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2491 TRACE("(%p)->(%p)\n", This
, p
);
2493 return get_nsstyle_pixel_val(This
, STYLEID_LEFT
, p
);
2496 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2498 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2500 TRACE("(%p)->()\n", This
);
2502 return set_style_pxattr(This
->nsstyle
, STYLEID_WIDTH
, v
);
2505 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2507 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2509 TRACE("(%p)->(%p)\n", This
, p
);
2511 return get_nsstyle_pixel_val(This
, STYLEID_WIDTH
, p
);
2514 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2516 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2518 TRACE("(%p)->(%d)\n", This
, v
);
2520 return set_style_pxattr(This
->nsstyle
, STYLEID_HEIGHT
, v
);
2523 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2525 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2527 TRACE("(%p)->(%p)\n", This
, p
);
2529 return get_nsstyle_pixel_val(This
, STYLEID_HEIGHT
, p
);
2532 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2534 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2536 TRACE("(%p)->(%f)\n", This
, v
);
2538 return set_style_pos(This
, STYLEID_TOP
, v
);
2541 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2543 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2545 TRACE("(%p)->(%p)\n", This
, p
);
2550 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2553 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2555 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2557 TRACE("(%p)->(%f)\n", This
, v
);
2559 return set_style_pos(This
, STYLEID_LEFT
, v
);
2562 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2564 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2566 TRACE("(%p)->(%p)\n", This
, p
);
2571 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2574 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2576 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2578 TRACE("(%p)->(%f)\n", This
, v
);
2580 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2583 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2585 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2587 TRACE("(%p)->(%p)\n", This
, p
);
2592 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2598 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2600 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2602 TRACE("(%p)->(%f)\n", This
, v
);
2604 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2607 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2609 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2611 TRACE("(%p)->(%p)\n", This
, p
);
2616 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2622 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2624 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2626 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2628 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2631 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2633 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2635 TRACE("(%p)->(%p)\n", This
, p
);
2637 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2640 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2642 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2644 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2646 return set_style_attr(This
, STYLEID_CLIP
, v
, 0);
2649 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2651 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2653 TRACE("(%p)->(%p)\n", This
, p
);
2655 return get_nsstyle_attr(This
->nsstyle
, STYLEID_CLIP
, p
, ATTR_REMOVE_COMMA
);
2658 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2660 nsAString name_str
, val_str
, empty_str
;
2663 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2665 TRACE("%s\n", debugstr_w(val
));
2667 nsAString_InitDepend(&name_str
, opacityW
);
2668 nsAString_InitDepend(&val_str
, val
);
2669 nsAString_InitDepend(&empty_str
, emptyW
);
2671 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2672 if(NS_FAILED(nsres
))
2673 ERR("SetProperty failed: %08x\n", nsres
);
2675 nsAString_Finish(&name_str
);
2676 nsAString_Finish(&val_str
);
2677 nsAString_Finish(&empty_str
);
2680 static void update_filter(HTMLStyle
*This
)
2682 const WCHAR
*ptr
= This
->elem
->filter
, *ptr2
;
2684 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2687 set_opacity(This
, emptyW
);
2692 while(isspaceW(*ptr
))
2698 while(isalnumW(*ptr
))
2701 WARN("unexpected char '%c'\n", *ptr
);
2705 WARN("expected '('\n");
2709 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2710 static const WCHAR formatW
[] = {'%','f',0};
2711 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2715 while(isspaceW(*ptr
))
2719 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2722 WARN("unexpected end of string\n");
2726 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2727 float fval
= 0.0f
, e
= 0.1f
;
2730 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2732 while(isdigitW(*ptr2
))
2733 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2736 while(isdigitW(*++ptr2
)) {
2737 fval
+= e
* (float)(*ptr2
++ - '0');
2742 sprintfW(buf
, formatW
, fval
* 0.01f
);
2743 set_opacity(This
, buf
);
2745 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2750 }while(*ptr
!= ')');
2752 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2753 ptr
= strchrW(ptr
, ')');
2761 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2763 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2764 WCHAR
*new_filter
= NULL
;
2766 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2769 FIXME("Element already destroyed\n");
2770 return E_UNEXPECTED
;
2774 new_filter
= heap_strdupW(v
);
2776 return E_OUTOFMEMORY
;
2779 heap_free(This
->elem
->filter
);
2780 This
->elem
->filter
= new_filter
;
2782 update_filter(This
);
2786 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2788 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2790 TRACE("(%p)->(%p)\n", This
, p
);
2793 FIXME("Element already destroyed\n");
2794 return E_UNEXPECTED
;
2797 if(This
->elem
->filter
) {
2798 *p
= SysAllocString(This
->elem
->filter
);
2800 return E_OUTOFMEMORY
;
2808 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2809 VARIANT AttributeValue
, LONG lFlags
)
2811 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2815 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
),
2816 debugstr_variant(&AttributeValue
), lFlags
);
2818 if(!strAttributeName
)
2819 return E_INVALIDARG
;
2822 FIXME("Parameter lFlags ignored\n");
2824 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2825 LOCALE_USER_DEFAULT
, &dispid
);
2829 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2833 params
.rgvarg
= &AttributeValue
;
2834 params
.cNamedArgs
= 1;
2835 params
.rgdispidNamedArgs
= &dispidNamed
;
2837 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2838 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2842 FIXME("Custom attributes not supported.\n");
2845 TRACE("ret: %08x\n", hres
);
2850 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2851 LONG lFlags
, VARIANT
*AttributeValue
)
2853 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2857 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2858 AttributeValue
, lFlags
);
2860 if(!AttributeValue
|| !strAttributeName
)
2861 return E_INVALIDARG
;
2864 FIXME("Parameter lFlags ignored\n");
2866 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2867 LOCALE_USER_DEFAULT
, &dispid
);
2870 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2872 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2873 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2877 FIXME("Custom attributes not supported.\n");
2883 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2884 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2886 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2887 const style_tbl_entry_t
*style_entry
;
2888 nsAString name_str
, ret_str
;
2892 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
2894 style_entry
= lookup_style_tbl(strAttributeName
);
2899 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, strAttributeName
,
2900 (lFlags
&1) ? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
2902 *pfSuccess
= VARIANT_FALSE
;
2906 for(i
=0; i
< sizeof(style_tbl
)/sizeof(*style_tbl
); i
++) {
2907 if(dispid
== style_tbl
[i
].dispid
)
2911 if(i
== sizeof(style_tbl
)/sizeof(*style_tbl
))
2912 return remove_prop(&This
->dispex
, strAttributeName
, pfSuccess
);
2913 style_entry
= style_tbl
+i
;
2916 /* filter property is a special case */
2917 if(style_entry
->dispid
== DISPID_IHTMLSTYLE_FILTER
) {
2918 *pfSuccess
= This
->elem
->filter
&& *This
->elem
->filter
? VARIANT_TRUE
: VARIANT_FALSE
;
2919 heap_free(This
->elem
->filter
);
2920 This
->elem
->filter
= NULL
;
2921 update_filter(This
);
2925 nsAString_InitDepend(&name_str
, style_entry
->name
);
2926 nsAString_Init(&ret_str
, NULL
);
2927 nsres
= nsIDOMCSSStyleDeclaration_RemoveProperty(This
->nsstyle
, &name_str
, &ret_str
);
2928 if(NS_SUCCEEDED(nsres
)) {
2929 const PRUnichar
*ret
;
2930 nsAString_GetData(&ret_str
, &ret
);
2931 *pfSuccess
= *ret
? VARIANT_TRUE
: VARIANT_FALSE
;
2933 ERR("RemoveProperty failed: %08x\n", nsres
);
2935 nsAString_Finish(&name_str
);
2936 nsAString_Finish(&ret_str
);
2937 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
2940 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2942 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2943 FIXME("(%p)->(%p)\n", This
, String
);
2947 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2948 HTMLStyle_QueryInterface
,
2951 HTMLStyle_GetTypeInfoCount
,
2952 HTMLStyle_GetTypeInfo
,
2953 HTMLStyle_GetIDsOfNames
,
2955 HTMLStyle_put_fontFamily
,
2956 HTMLStyle_get_fontFamily
,
2957 HTMLStyle_put_fontStyle
,
2958 HTMLStyle_get_fontStyle
,
2959 HTMLStyle_put_fontVariant
,
2960 HTMLStyle_get_fontVariant
,
2961 HTMLStyle_put_fontWeight
,
2962 HTMLStyle_get_fontWeight
,
2963 HTMLStyle_put_fontSize
,
2964 HTMLStyle_get_fontSize
,
2967 HTMLStyle_put_color
,
2968 HTMLStyle_get_color
,
2969 HTMLStyle_put_background
,
2970 HTMLStyle_get_background
,
2971 HTMLStyle_put_backgroundColor
,
2972 HTMLStyle_get_backgroundColor
,
2973 HTMLStyle_put_backgroundImage
,
2974 HTMLStyle_get_backgroundImage
,
2975 HTMLStyle_put_backgroundRepeat
,
2976 HTMLStyle_get_backgroundRepeat
,
2977 HTMLStyle_put_backgroundAttachment
,
2978 HTMLStyle_get_backgroundAttachment
,
2979 HTMLStyle_put_backgroundPosition
,
2980 HTMLStyle_get_backgroundPosition
,
2981 HTMLStyle_put_backgroundPositionX
,
2982 HTMLStyle_get_backgroundPositionX
,
2983 HTMLStyle_put_backgroundPositionY
,
2984 HTMLStyle_get_backgroundPositionY
,
2985 HTMLStyle_put_wordSpacing
,
2986 HTMLStyle_get_wordSpacing
,
2987 HTMLStyle_put_letterSpacing
,
2988 HTMLStyle_get_letterSpacing
,
2989 HTMLStyle_put_textDecoration
,
2990 HTMLStyle_get_textDecoration
,
2991 HTMLStyle_put_textDecorationNone
,
2992 HTMLStyle_get_textDecorationNone
,
2993 HTMLStyle_put_textDecorationUnderline
,
2994 HTMLStyle_get_textDecorationUnderline
,
2995 HTMLStyle_put_textDecorationOverline
,
2996 HTMLStyle_get_textDecorationOverline
,
2997 HTMLStyle_put_textDecorationLineThrough
,
2998 HTMLStyle_get_textDecorationLineThrough
,
2999 HTMLStyle_put_textDecorationBlink
,
3000 HTMLStyle_get_textDecorationBlink
,
3001 HTMLStyle_put_verticalAlign
,
3002 HTMLStyle_get_verticalAlign
,
3003 HTMLStyle_put_textTransform
,
3004 HTMLStyle_get_textTransform
,
3005 HTMLStyle_put_textAlign
,
3006 HTMLStyle_get_textAlign
,
3007 HTMLStyle_put_textIndent
,
3008 HTMLStyle_get_textIndent
,
3009 HTMLStyle_put_lineHeight
,
3010 HTMLStyle_get_lineHeight
,
3011 HTMLStyle_put_marginTop
,
3012 HTMLStyle_get_marginTop
,
3013 HTMLStyle_put_marginRight
,
3014 HTMLStyle_get_marginRight
,
3015 HTMLStyle_put_marginBottom
,
3016 HTMLStyle_get_marginBottom
,
3017 HTMLStyle_put_marginLeft
,
3018 HTMLStyle_get_marginLeft
,
3019 HTMLStyle_put_margin
,
3020 HTMLStyle_get_margin
,
3021 HTMLStyle_put_paddingTop
,
3022 HTMLStyle_get_paddingTop
,
3023 HTMLStyle_put_paddingRight
,
3024 HTMLStyle_get_paddingRight
,
3025 HTMLStyle_put_paddingBottom
,
3026 HTMLStyle_get_paddingBottom
,
3027 HTMLStyle_put_paddingLeft
,
3028 HTMLStyle_get_paddingLeft
,
3029 HTMLStyle_put_padding
,
3030 HTMLStyle_get_padding
,
3031 HTMLStyle_put_border
,
3032 HTMLStyle_get_border
,
3033 HTMLStyle_put_borderTop
,
3034 HTMLStyle_get_borderTop
,
3035 HTMLStyle_put_borderRight
,
3036 HTMLStyle_get_borderRight
,
3037 HTMLStyle_put_borderBottom
,
3038 HTMLStyle_get_borderBottom
,
3039 HTMLStyle_put_borderLeft
,
3040 HTMLStyle_get_borderLeft
,
3041 HTMLStyle_put_borderColor
,
3042 HTMLStyle_get_borderColor
,
3043 HTMLStyle_put_borderTopColor
,
3044 HTMLStyle_get_borderTopColor
,
3045 HTMLStyle_put_borderRightColor
,
3046 HTMLStyle_get_borderRightColor
,
3047 HTMLStyle_put_borderBottomColor
,
3048 HTMLStyle_get_borderBottomColor
,
3049 HTMLStyle_put_borderLeftColor
,
3050 HTMLStyle_get_borderLeftColor
,
3051 HTMLStyle_put_borderWidth
,
3052 HTMLStyle_get_borderWidth
,
3053 HTMLStyle_put_borderTopWidth
,
3054 HTMLStyle_get_borderTopWidth
,
3055 HTMLStyle_put_borderRightWidth
,
3056 HTMLStyle_get_borderRightWidth
,
3057 HTMLStyle_put_borderBottomWidth
,
3058 HTMLStyle_get_borderBottomWidth
,
3059 HTMLStyle_put_borderLeftWidth
,
3060 HTMLStyle_get_borderLeftWidth
,
3061 HTMLStyle_put_borderStyle
,
3062 HTMLStyle_get_borderStyle
,
3063 HTMLStyle_put_borderTopStyle
,
3064 HTMLStyle_get_borderTopStyle
,
3065 HTMLStyle_put_borderRightStyle
,
3066 HTMLStyle_get_borderRightStyle
,
3067 HTMLStyle_put_borderBottomStyle
,
3068 HTMLStyle_get_borderBottomStyle
,
3069 HTMLStyle_put_borderLeftStyle
,
3070 HTMLStyle_get_borderLeftStyle
,
3071 HTMLStyle_put_width
,
3072 HTMLStyle_get_width
,
3073 HTMLStyle_put_height
,
3074 HTMLStyle_get_height
,
3075 HTMLStyle_put_styleFloat
,
3076 HTMLStyle_get_styleFloat
,
3077 HTMLStyle_put_clear
,
3078 HTMLStyle_get_clear
,
3079 HTMLStyle_put_display
,
3080 HTMLStyle_get_display
,
3081 HTMLStyle_put_visibility
,
3082 HTMLStyle_get_visibility
,
3083 HTMLStyle_put_listStyleType
,
3084 HTMLStyle_get_listStyleType
,
3085 HTMLStyle_put_listStylePosition
,
3086 HTMLStyle_get_listStylePosition
,
3087 HTMLStyle_put_listStyleImage
,
3088 HTMLStyle_get_listStyleImage
,
3089 HTMLStyle_put_listStyle
,
3090 HTMLStyle_get_listStyle
,
3091 HTMLStyle_put_whiteSpace
,
3092 HTMLStyle_get_whiteSpace
,
3097 HTMLStyle_get_position
,
3098 HTMLStyle_put_zIndex
,
3099 HTMLStyle_get_zIndex
,
3100 HTMLStyle_put_overflow
,
3101 HTMLStyle_get_overflow
,
3102 HTMLStyle_put_pageBreakBefore
,
3103 HTMLStyle_get_pageBreakBefore
,
3104 HTMLStyle_put_pageBreakAfter
,
3105 HTMLStyle_get_pageBreakAfter
,
3106 HTMLStyle_put_cssText
,
3107 HTMLStyle_get_cssText
,
3108 HTMLStyle_put_pixelTop
,
3109 HTMLStyle_get_pixelTop
,
3110 HTMLStyle_put_pixelLeft
,
3111 HTMLStyle_get_pixelLeft
,
3112 HTMLStyle_put_pixelWidth
,
3113 HTMLStyle_get_pixelWidth
,
3114 HTMLStyle_put_pixelHeight
,
3115 HTMLStyle_get_pixelHeight
,
3116 HTMLStyle_put_posTop
,
3117 HTMLStyle_get_posTop
,
3118 HTMLStyle_put_posLeft
,
3119 HTMLStyle_get_posLeft
,
3120 HTMLStyle_put_posWidth
,
3121 HTMLStyle_get_posWidth
,
3122 HTMLStyle_put_posHeight
,
3123 HTMLStyle_get_posHeight
,
3124 HTMLStyle_put_cursor
,
3125 HTMLStyle_get_cursor
,
3128 HTMLStyle_put_filter
,
3129 HTMLStyle_get_filter
,
3130 HTMLStyle_setAttribute
,
3131 HTMLStyle_getAttribute
,
3132 HTMLStyle_removeAttribute
,
3136 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
3138 const style_tbl_entry_t
*style_entry
;
3140 style_entry
= lookup_style_tbl(name
);
3142 *dispid
= style_entry
->dispid
;
3146 return DISP_E_UNKNOWNNAME
;
3149 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
3151 HTMLStyle_get_dispid
,
3156 static const tid_t HTMLStyle_iface_tids
[] = {
3165 static dispex_static_data_t HTMLStyle_dispex
= {
3166 &HTMLStyle_dispex_vtbl
,
3169 HTMLStyle_iface_tids
3172 static HRESULT
get_style_from_elem(HTMLElement
*elem
, nsIDOMCSSStyleDeclaration
**ret
)
3174 nsIDOMElementCSSInlineStyle
*nselemstyle
;
3178 FIXME("NULL nselem\n");
3182 nsres
= nsIDOMHTMLElement_QueryInterface(elem
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
3183 (void**)&nselemstyle
);
3184 assert(nsres
== NS_OK
);
3186 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, ret
);
3187 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
3188 if(NS_FAILED(nsres
)) {
3189 ERR("GetStyle failed: %08x\n", nsres
);
3196 HRESULT
HTMLStyle_Create(HTMLElement
*elem
, HTMLStyle
**ret
)
3198 nsIDOMCSSStyleDeclaration
*nsstyle
;
3202 hres
= get_style_from_elem(elem
, &nsstyle
);
3206 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3208 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
3209 return E_OUTOFMEMORY
;
3212 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3214 style
->nsstyle
= nsstyle
;
3216 HTMLStyle2_Init(style
);
3217 HTMLStyle3_Init(style
);
3219 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3221 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);
3227 HRESULT
get_elem_style(HTMLElement
*elem
, styleid_t styleid
, BSTR
*ret
)
3229 nsIDOMCSSStyleDeclaration
*style
;
3232 hres
= get_style_from_elem(elem
, &style
);
3236 hres
= get_nsstyle_attr(style
, styleid
, ret
, 0);
3237 nsIDOMCSSStyleDeclaration_Release(style
);
3241 HRESULT
set_elem_style(HTMLElement
*elem
, styleid_t styleid
, const WCHAR
*val
)
3243 nsIDOMCSSStyleDeclaration
*style
;
3246 hres
= get_style_from_elem(elem
, &style
);
3250 hres
= set_nsstyle_attr(style
, styleid
, val
, 0);
3251 nsIDOMCSSStyleDeclaration_Release(style
);