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
30 #include "mshtml_private.h"
31 #include "htmlstyle.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 static const WCHAR attrBackground
[] =
39 {'b','a','c','k','g','r','o','u','n','d',0};
40 static const WCHAR attrBackgroundColor
[] =
41 {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
42 static const WCHAR attrBackgroundImage
[] =
43 {'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
44 static const WCHAR attrBackgroundPosition
[] =
45 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n',0};
46 static const WCHAR attrBackgroundPositionX
[] =
47 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',0};
48 static const WCHAR attrBackgroundPositionY
[] =
49 {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','y',0};
50 static const WCHAR attrBackgroundRepeat
[] =
51 {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
52 static const WCHAR attrBorder
[] =
53 {'b','o','r','d','e','r',0};
54 static const WCHAR attrBorderBottom
[] =
55 {'b','o','r','d','e','r','-','b','o','t','t','o','m',0};
56 static const WCHAR attrBorderBottomColor
[] =
57 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','c','o','l','o','r',0};
58 static const WCHAR attrBorderBottomStyle
[] =
59 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','s','t','y','l','e',0};
60 static const WCHAR attrBorderBottomWidth
[] =
61 {'b','o','r','d','e','r','-','b','o','t','t','o','m','-','w','i','d','t','h',0};
62 static const WCHAR attrBorderColor
[] =
63 {'b','o','r','d','e','r','-','c','o','l','o','r',0};
64 static const WCHAR attrBorderLeft
[] =
65 {'b','o','r','d','e','r','-','l','e','f','t',0};
66 static const WCHAR attrBorderLeftColor
[] =
67 {'b','o','r','d','e','r','-','l','e','f','t','-','c','o','l','o','r',0};
68 static const WCHAR attrBorderLeftStyle
[] =
69 {'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
70 static const WCHAR attrBorderLeftWidth
[] =
71 {'b','o','r','d','e','r','-','l','e','f','t','-','w','i','d','t','h',0};
72 static const WCHAR attrBorderRight
[] =
73 {'b','o','r','d','e','r','-','r','i','g','h','t',0};
74 static const WCHAR attrBorderRightColor
[] =
75 {'b','o','r','d','e','r','-','r','i','g','h','t','-','c','o','l','o','r',0};
76 static const WCHAR attrBorderRightStyle
[] =
77 {'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
78 static const WCHAR attrBorderRightWidth
[] =
79 {'b','o','r','d','e','r','-','r','i','g','h','t','-','w','i','d','t','h',0};
80 static const WCHAR attrBorderTop
[] =
81 {'b','o','r','d','e','r','-','t','o','p',0};
82 static const WCHAR attrBorderTopColor
[] =
83 {'b','o','r','d','e','r','-','t','o','p','-','c','o','l','o','r',0};
84 static const WCHAR attrBorderStyle
[] =
85 {'b','o','r','d','e','r','-','s','t','y','l','e',0};
86 static const WCHAR attrBorderTopStyle
[] =
87 {'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
88 static const WCHAR attrBorderTopWidth
[] =
89 {'b','o','r','d','e','r','-','t','o','p','-','w','i','d','t','h',0};
90 static const WCHAR attrBorderWidth
[] =
91 {'b','o','r','d','e','r','-','w','i','d','t','h',0};
92 static const WCHAR attrBottom
[] =
93 {'b','o','t','t','o','m',0};
94 static const WCHAR attrColor
[] =
95 {'c','o','l','o','r',0};
96 static const WCHAR attrCursor
[] =
97 {'c','u','r','s','o','r',0};
98 static const WCHAR attrDisplay
[] =
99 {'d','i','s','p','l','a','y',0};
100 static const WCHAR attrFilter
[] =
101 {'f','i','l','e','t','e','r',0};
102 static const WCHAR attrFontFamily
[] =
103 {'f','o','n','t','-','f','a','m','i','l','y',0};
104 static const WCHAR attrFontSize
[] =
105 {'f','o','n','t','-','s','i','z','e',0};
106 static const WCHAR attrFontStyle
[] =
107 {'f','o','n','t','-','s','t','y','l','e',0};
108 static const WCHAR attrFontVariant
[] =
109 {'f','o','n','t','-','v','a','r','i','a','n','t',0};
110 static const WCHAR attrFontWeight
[] =
111 {'f','o','n','t','-','w','e','i','g','h','t',0};
112 static const WCHAR attrHeight
[] =
113 {'h','e','i','g','h','t',0};
114 static const WCHAR attrLeft
[] =
116 static const WCHAR attrLetterSpacing
[] =
117 {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0};
118 static const WCHAR attrLineHeight
[] =
119 {'l','i','n','e','-','h','e','i','g','h','t',0};
120 static const WCHAR attrMargin
[] =
121 {'m','a','r','g','i','n',0};
122 static const WCHAR attrMarginBottom
[] =
123 {'m','a','r','g','i','n','-','b','o','t','t','o','m',0};
124 static const WCHAR attrMarginLeft
[] =
125 {'m','a','r','g','i','n','-','l','e','f','t',0};
126 static const WCHAR attrMarginRight
[] =
127 {'m','a','r','g','i','n','-','r','i','g','h','t',0};
128 static const WCHAR attrMarginTop
[] =
129 {'m','a','r','g','i','n','-','t','o','p',0};
130 static const WCHAR attrMinHeight
[] =
131 {'m','i','n','-','h','e','i','g','h','t',0};
132 static const WCHAR attrOverflow
[] =
133 {'o','v','e','r','f','l','o','w',0};
134 static const WCHAR attrPadding
[] =
135 {'p','a','d','d','i','n','g',0};
136 static const WCHAR attrPaddingBottom
[] =
137 {'p','a','d','d','i','n','g','-','b','o','t','t','o','m',0};
138 static const WCHAR attrPaddingLeft
[] =
139 {'p','a','d','d','i','n','g','-','l','e','f','t',0};
140 static const WCHAR attrPaddingRight
[] =
141 {'p','a','d','d','i','n','g','-','r','i','g','h','t',0};
142 static const WCHAR attrPaddingTop
[] =
143 {'p','a','d','d','i','n','g','-','t','o','p',0};
144 static const WCHAR attrPosition
[] =
145 {'p','o','s','i','t','i','o','n',0};
146 static const WCHAR attrRight
[] =
147 {'r','i','g','h','t',0};
148 static const WCHAR attrTextAlign
[] =
149 {'t','e','x','t','-','a','l','i','g','n',0};
150 static const WCHAR attrTextDecoration
[] =
151 {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
152 static const WCHAR attrTextIndent
[] =
153 {'t','e','x','t','-','i','n','d','e','n','t',0};
154 static const WCHAR attrTop
[] =
156 static const WCHAR attrVerticalAlign
[] =
157 {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
158 static const WCHAR attrVisibility
[] =
159 {'v','i','s','i','b','i','l','i','t','y',0};
160 static const WCHAR attrWidth
[] =
161 {'w','i','d','t','h',0};
162 static const WCHAR attrWordSpacing
[] =
163 {'w','o','r','d','-','s','p','a','c','i','n','g',0};
164 static const WCHAR attrWordWrap
[] =
165 {'w','o','r','d','-','w','r','a','p',0};
166 static const WCHAR attrZIndex
[] =
167 {'z','-','i','n','d','e','x',0};
173 {attrBackground
, DISPID_IHTMLSTYLE_BACKGROUND
},
174 {attrBackgroundColor
, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
175 {attrBackgroundImage
, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
176 {attrBackgroundPosition
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION
},
177 {attrBackgroundPositionX
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX
},
178 {attrBackgroundPositionY
, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONY
},
179 {attrBackgroundRepeat
, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT
},
180 {attrBorder
, DISPID_IHTMLSTYLE_BORDER
},
181 {attrBorderBottom
, DISPID_IHTMLSTYLE_BORDERBOTTOM
},
182 {attrBorderBottomColor
, DISPID_IHTMLSTYLE_BORDERBOTTOMCOLOR
},
183 {attrBorderBottomStyle
, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE
},
184 {attrBorderBottomWidth
, DISPID_IHTMLSTYLE_BORDERBOTTOMWIDTH
},
185 {attrBorderColor
, DISPID_IHTMLSTYLE_BORDERCOLOR
},
186 {attrBorderLeft
, DISPID_IHTMLSTYLE_BORDERLEFT
},
187 {attrBorderLeftColor
, DISPID_IHTMLSTYLE_BORDERLEFTCOLOR
},
188 {attrBorderLeftStyle
, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE
},
189 {attrBorderLeftWidth
, DISPID_IHTMLSTYLE_BORDERLEFTWIDTH
},
190 {attrBorderRight
, DISPID_IHTMLSTYLE_BORDERRIGHT
},
191 {attrBorderRightColor
, DISPID_IHTMLSTYLE_BORDERRIGHTCOLOR
},
192 {attrBorderRightStyle
, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE
},
193 {attrBorderRightWidth
, DISPID_IHTMLSTYLE_BORDERRIGHTWIDTH
},
194 {attrBorderStyle
, DISPID_IHTMLSTYLE_BORDERSTYLE
},
195 {attrBorderTop
, DISPID_IHTMLSTYLE_BORDERTOP
},
196 {attrBorderTopColor
, DISPID_IHTMLSTYLE_BORDERTOPCOLOR
},
197 {attrBorderTopStyle
, DISPID_IHTMLSTYLE_BORDERTOPSTYLE
},
198 {attrBorderTopWidth
, DISPID_IHTMLSTYLE_BORDERTOPWIDTH
},
199 {attrBorderWidth
, DISPID_IHTMLSTYLE_BORDERWIDTH
},
200 {attrBottom
, DISPID_IHTMLSTYLE2_BOTTOM
},
201 {attrColor
, DISPID_IHTMLSTYLE_COLOR
},
202 {attrCursor
, DISPID_IHTMLSTYLE_CURSOR
},
203 {attrDisplay
, DISPID_IHTMLSTYLE_DISPLAY
},
204 {attrFilter
, DISPID_IHTMLSTYLE_FILTER
},
205 {attrFontFamily
, DISPID_IHTMLSTYLE_FONTFAMILY
},
206 {attrFontSize
, DISPID_IHTMLSTYLE_FONTSIZE
},
207 {attrFontStyle
, DISPID_IHTMLSTYLE_FONTSTYLE
},
208 {attrFontVariant
, DISPID_IHTMLSTYLE_FONTVARIANT
},
209 {attrFontWeight
, DISPID_IHTMLSTYLE_FONTWEIGHT
},
210 {attrHeight
, DISPID_IHTMLSTYLE_HEIGHT
},
211 {attrLeft
, DISPID_IHTMLSTYLE_LEFT
},
212 {attrLetterSpacing
, DISPID_IHTMLSTYLE_LETTERSPACING
},
213 {attrLineHeight
, DISPID_IHTMLSTYLE_LINEHEIGHT
},
214 {attrMargin
, DISPID_IHTMLSTYLE_MARGIN
},
215 {attrMarginBottom
, DISPID_IHTMLSTYLE_MARGINBOTTOM
},
216 {attrMarginLeft
, DISPID_IHTMLSTYLE_MARGINLEFT
},
217 {attrMarginRight
, DISPID_IHTMLSTYLE_MARGINRIGHT
},
218 {attrMarginTop
, DISPID_IHTMLSTYLE_MARGINTOP
},
219 {attrMinHeight
, DISPID_IHTMLSTYLE4_MINHEIGHT
},
220 {attrOverflow
, DISPID_IHTMLSTYLE_OVERFLOW
},
221 {attrPadding
, DISPID_IHTMLSTYLE_PADDING
},
222 {attrPaddingBottom
, DISPID_IHTMLSTYLE_PADDINGBOTTOM
},
223 {attrPaddingLeft
, DISPID_IHTMLSTYLE_PADDINGLEFT
},
224 {attrPaddingRight
, DISPID_IHTMLSTYLE_PADDINGRIGHT
},
225 {attrPaddingTop
, DISPID_IHTMLSTYLE_PADDINGTOP
},
226 {attrPosition
, DISPID_IHTMLSTYLE2_POSITION
},
227 {attrRight
, DISPID_IHTMLSTYLE2_RIGHT
},
228 {attrTextAlign
, DISPID_IHTMLSTYLE_TEXTALIGN
},
229 {attrTextDecoration
, DISPID_IHTMLSTYLE_TEXTDECORATION
},
230 {attrTextIndent
, DISPID_IHTMLSTYLE_TEXTINDENT
},
231 {attrTop
, DISPID_IHTMLSTYLE_TOP
},
232 {attrVerticalAlign
, DISPID_IHTMLSTYLE_VERTICALALIGN
},
233 {attrVisibility
, DISPID_IHTMLSTYLE_VISIBILITY
},
234 {attrWidth
, DISPID_IHTMLSTYLE_WIDTH
},
235 {attrWordSpacing
, DISPID_IHTMLSTYLE_WORDSPACING
},
236 {attrWordWrap
, DISPID_IHTMLSTYLE3_WORDWRAP
},
237 {attrZIndex
, DISPID_IHTMLSTYLE_ZINDEX
}
240 static const WCHAR valLineThrough
[] =
241 {'l','i','n','e','-','t','h','r','o','u','g','h',0};
242 static const WCHAR valUnderline
[] =
243 {'u','n','d','e','r','l','i','n','e',0};
244 static const WCHAR szNormal
[] =
245 {'n','o','r','m','a','l',0};
246 static const WCHAR styleNone
[] =
248 static const WCHAR valOverline
[] =
249 {'o','v','e','r','l','i','n','e',0};
250 static const WCHAR valBlink
[] =
251 {'b','l','i','n','k',0};
253 static const WCHAR px_formatW
[] = {'%','d','p','x',0};
254 static const WCHAR emptyW
[] = {0};
256 static LPWSTR
fix_px_value(LPCWSTR val
)
261 while(*ptr
&& isspaceW(*ptr
))
266 while(*ptr
&& isdigitW(*ptr
))
269 if(!*ptr
|| isspaceW(*ptr
)) {
271 int len
= strlenW(val
)+1;
273 ret
= heap_alloc((len
+2)*sizeof(WCHAR
));
274 memcpy(ret
, val
, (ptr
-val
)*sizeof(WCHAR
));
280 TRACE("fixed %s -> %s\n", debugstr_w(val
), debugstr_w(ret
));
285 while(*ptr
&& !isspaceW(*ptr
))
292 static LPWSTR
fix_url_value(LPCWSTR val
)
296 static const WCHAR urlW
[] = {'u','r','l','('};
298 if(strncmpW(val
, urlW
, sizeof(urlW
)/sizeof(WCHAR
)) || !strchrW(val
, '\\'))
301 ret
= heap_strdupW(val
);
303 for(ptr
= ret
; *ptr
; ptr
++) {
311 HRESULT
set_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
313 nsAString str_name
, str_value
, str_empty
;
317 if(flags
& ATTR_FIX_PX
)
318 val
= fix_px_value(value
);
319 if(flags
& ATTR_FIX_URL
)
320 val
= fix_url_value(value
);
322 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
323 nsAString_InitDepend(&str_value
, val
? val
: value
);
324 nsAString_InitDepend(&str_empty
, emptyW
);
326 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(nsstyle
, &str_name
, &str_value
, &str_empty
);
328 ERR("SetProperty failed: %08x\n", nsres
);
330 nsAString_Finish(&str_name
);
331 nsAString_Finish(&str_value
);
332 nsAString_Finish(&str_empty
);
338 static HRESULT
var_to_styleval(const VARIANT
*v
, WCHAR
*buf
, DWORD flags
, const WCHAR
**ret
)
349 case VT_BSTR
|VT_BYREF
:
350 *ret
= *V_BSTRREF(v
);
354 static const WCHAR formatW
[] = {'%','d',0};
355 static const WCHAR hex_formatW
[] = {'#','%','0','6','x',0};
357 if(flags
& ATTR_HEX_INT
)
358 wsprintfW(buf
, hex_formatW
, V_I4(v
));
359 else if(flags
& ATTR_FIX_PX
)
360 wsprintfW(buf
, px_formatW
, V_I4(v
));
362 wsprintfW(buf
, formatW
, V_I4(v
));
368 FIXME("not implemented vt %d\n", V_VT(v
));
374 HRESULT
set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*value
, DWORD flags
)
380 hres
= var_to_styleval(value
, buf
, flags
, &val
);
384 return set_nsstyle_attr(nsstyle
, sid
, val
, flags
);
387 static inline HRESULT
set_style_attr(HTMLStyle
*This
, styleid_t sid
, LPCWSTR value
, DWORD flags
)
389 return set_nsstyle_attr(This
->nsstyle
, sid
, value
, flags
);
392 static HRESULT
get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, nsAString
*value
)
397 nsAString_InitDepend(&str_name
, style_tbl
[sid
].name
);
399 nsres
= nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle
, &str_name
, value
);
400 if(NS_FAILED(nsres
)) {
401 ERR("SetProperty failed: %08x\n", nsres
);
405 nsAString_Finish(&str_name
);
410 HRESULT
get_nsstyle_attr(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, BSTR
*p
)
413 const PRUnichar
*value
;
415 nsAString_Init(&str_value
, NULL
);
417 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
419 nsAString_GetData(&str_value
, &value
);
420 *p
= *value
? SysAllocString(value
) : NULL
;
422 nsAString_Finish(&str_value
);
424 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_w(*p
));
428 HRESULT
get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration
*nsstyle
, styleid_t sid
, VARIANT
*p
, DWORD flags
)
431 const PRUnichar
*value
;
434 nsAString_Init(&str_value
, NULL
);
436 get_nsstyle_attr_nsval(nsstyle
, sid
, &str_value
);
438 nsAString_GetData(&str_value
, &value
);
440 if(flags
& ATTR_STR_TO_INT
) {
441 const PRUnichar
*ptr
= value
;
450 while(isdigitW(*ptr
))
451 i
= i
*10 + (*ptr
++ - '0');
455 V_I4(p
) = neg
? -i
: i
;
464 str
= SysAllocString(value
);
466 return E_OUTOFMEMORY
;
473 nsAString_Finish(&str_value
);
475 TRACE("%s -> %s\n", debugstr_w(style_tbl
[sid
].name
), debugstr_variant(p
));
479 static inline HRESULT
get_style_attr(HTMLStyle
*This
, styleid_t sid
, BSTR
*p
)
481 return get_nsstyle_attr(This
->nsstyle
, sid
, p
);
484 static HRESULT
check_style_attr_value(HTMLStyle
*This
, styleid_t sid
, LPCWSTR exval
, VARIANT_BOOL
*p
)
487 const PRUnichar
*value
;
489 nsAString_Init(&str_value
, NULL
);
491 get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
493 nsAString_GetData(&str_value
, &value
);
494 *p
= strcmpW(value
, exval
) ? VARIANT_FALSE
: VARIANT_TRUE
;
495 nsAString_Finish(&str_value
);
497 TRACE("%s -> %x\n", debugstr_w(style_tbl
[sid
].name
), *p
);
501 static inline HRESULT
set_style_pos(HTMLStyle
*This
, styleid_t sid
, float value
)
504 WCHAR szFormat
[] = {'%','.','0','f','p','x',0};
506 value
= floor(value
);
508 sprintfW(szValue
, szFormat
, value
);
510 return set_style_attr(This
, sid
, szValue
, 0);
513 static HRESULT
get_nsstyle_pos(HTMLStyle
*This
, styleid_t sid
, float *p
)
517 WCHAR pxW
[] = {'p','x',0};
519 TRACE("%p %d %p\n", This
, sid
, p
);
523 nsAString_Init(&str_value
, NULL
);
525 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, sid
, &str_value
);
529 const PRUnichar
*value
;
531 nsAString_GetData(&str_value
, &value
);
534 *p
= strtolW(value
, &ptr
, 10);
536 if(*ptr
&& strcmpW(ptr
, pxW
))
538 nsAString_Finish(&str_value
);
539 FIXME("only px values are currently supported\n");
545 TRACE("ret %f\n", *p
);
547 nsAString_Finish(&str_value
);
552 static BOOL
is_valid_border_style(BSTR v
)
554 static const WCHAR styleDotted
[] = {'d','o','t','t','e','d',0};
555 static const WCHAR styleDashed
[] = {'d','a','s','h','e','d',0};
556 static const WCHAR styleSolid
[] = {'s','o','l','i','d',0};
557 static const WCHAR styleDouble
[] = {'d','o','u','b','l','e',0};
558 static const WCHAR styleGroove
[] = {'g','r','o','o','v','e',0};
559 static const WCHAR styleRidge
[] = {'r','i','d','g','e',0};
560 static const WCHAR styleInset
[] = {'i','n','s','e','t',0};
561 static const WCHAR styleOutset
[] = {'o','u','t','s','e','t',0};
563 TRACE("%s\n", debugstr_w(v
));
565 if(!v
|| strcmpiW(v
, styleNone
) == 0 || strcmpiW(v
, styleDotted
) == 0 ||
566 strcmpiW(v
, styleDashed
) == 0 || strcmpiW(v
, styleSolid
) == 0 ||
567 strcmpiW(v
, styleDouble
) == 0 || strcmpiW(v
, styleGroove
) == 0 ||
568 strcmpiW(v
, styleRidge
) == 0 || strcmpiW(v
, styleInset
) == 0 ||
569 strcmpiW(v
, styleOutset
) == 0 )
577 static inline HTMLStyle
*impl_from_IHTMLStyle(IHTMLStyle
*iface
)
579 return CONTAINING_RECORD(iface
, HTMLStyle
, IHTMLStyle_iface
);
582 static HRESULT WINAPI
HTMLStyle_QueryInterface(IHTMLStyle
*iface
, REFIID riid
, void **ppv
)
584 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
588 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
589 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
590 *ppv
= &This
->IHTMLStyle_iface
;
591 }else if(IsEqualGUID(&IID_IHTMLStyle
, riid
)) {
592 TRACE("(%p)->(IID_IHTMLStyle %p)\n", This
, ppv
);
593 *ppv
= &This
->IHTMLStyle_iface
;
594 }else if(IsEqualGUID(&IID_IHTMLStyle2
, riid
)) {
595 TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This
, ppv
);
596 *ppv
= &This
->IHTMLStyle2_iface
;
597 }else if(IsEqualGUID(&IID_IHTMLStyle3
, riid
)) {
598 TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This
, ppv
);
599 *ppv
= &This
->IHTMLStyle3_iface
;
600 }else if(IsEqualGUID(&IID_IHTMLStyle4
, riid
)) {
601 TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This
, ppv
);
602 *ppv
= &This
->IHTMLStyle4_iface
;
603 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
604 return *ppv
? S_OK
: E_NOINTERFACE
;
608 IUnknown_AddRef((IUnknown
*)*ppv
);
612 WARN("unsupported %s\n", debugstr_guid(riid
));
613 return E_NOINTERFACE
;
616 static ULONG WINAPI
HTMLStyle_AddRef(IHTMLStyle
*iface
)
618 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
619 LONG ref
= InterlockedIncrement(&This
->ref
);
621 TRACE("(%p) ref=%d\n", This
, ref
);
626 static ULONG WINAPI
HTMLStyle_Release(IHTMLStyle
*iface
)
628 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
629 LONG ref
= InterlockedDecrement(&This
->ref
);
631 TRACE("(%p) ref=%d\n", This
, ref
);
635 nsIDOMCSSStyleDeclaration_Release(This
->nsstyle
);
636 heap_free(This
->filter
);
637 release_dispex(&This
->dispex
);
644 static HRESULT WINAPI
HTMLStyle_GetTypeInfoCount(IHTMLStyle
*iface
, UINT
*pctinfo
)
646 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
647 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
650 static HRESULT WINAPI
HTMLStyle_GetTypeInfo(IHTMLStyle
*iface
, UINT iTInfo
,
651 LCID lcid
, ITypeInfo
**ppTInfo
)
653 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
654 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
657 static HRESULT WINAPI
HTMLStyle_GetIDsOfNames(IHTMLStyle
*iface
, REFIID riid
,
658 LPOLESTR
*rgszNames
, UINT cNames
,
659 LCID lcid
, DISPID
*rgDispId
)
661 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
662 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
666 static HRESULT WINAPI
HTMLStyle_Invoke(IHTMLStyle
*iface
, DISPID dispIdMember
,
667 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
668 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
670 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
671 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
672 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
675 static HRESULT WINAPI
HTMLStyle_put_fontFamily(IHTMLStyle
*iface
, BSTR v
)
677 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
679 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
681 return set_style_attr(This
, STYLEID_FONT_FAMILY
, v
, 0);
684 static HRESULT WINAPI
HTMLStyle_get_fontFamily(IHTMLStyle
*iface
, BSTR
*p
)
686 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
688 TRACE("(%p)->(%p)\n", This
, p
);
690 return get_style_attr(This
, STYLEID_FONT_FAMILY
, p
);
693 static HRESULT WINAPI
HTMLStyle_put_fontStyle(IHTMLStyle
*iface
, BSTR v
)
695 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
696 static const WCHAR szItalic
[] = {'i','t','a','l','i','c',0};
697 static const WCHAR szOblique
[] = {'o','b','l','i','q','u','e',0};
699 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
701 /* fontStyle can only be one of the follow values. */
702 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szItalic
, v
) == 0 ||
703 strcmpiW(szOblique
, v
) == 0)
705 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_STYLE
, v
, 0);
711 static HRESULT WINAPI
HTMLStyle_get_fontStyle(IHTMLStyle
*iface
, BSTR
*p
)
713 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
715 TRACE("(%p)->(%p)\n", This
, p
);
717 return get_style_attr(This
, STYLEID_FONT_STYLE
, p
);
720 static HRESULT WINAPI
HTMLStyle_put_fontVariant(IHTMLStyle
*iface
, BSTR v
)
722 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
723 static const WCHAR szCaps
[] = {'s','m','a','l','l','-','c','a','p','s',0};
725 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
727 /* fontVariant can only be one of the follow values. */
728 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(szCaps
, v
) == 0)
730 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_VARIANT
, v
, 0);
736 static HRESULT WINAPI
HTMLStyle_get_fontVariant(IHTMLStyle
*iface
, BSTR
*p
)
738 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
739 TRACE("(%p)->(%p)\n", This
, p
);
744 return get_style_attr(This
, STYLEID_FONT_VARIANT
, p
);
747 static HRESULT WINAPI
HTMLStyle_put_fontWeight(IHTMLStyle
*iface
, BSTR v
)
749 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
750 static const WCHAR styleBold
[] = {'b','o','l','d',0};
751 static const WCHAR styleBolder
[] = {'b','o','l','d','e','r',0};
752 static const WCHAR styleLighter
[] = {'l','i','g','h','t','e','r',0};
753 static const WCHAR style100
[] = {'1','0','0',0};
754 static const WCHAR style200
[] = {'2','0','0',0};
755 static const WCHAR style300
[] = {'3','0','0',0};
756 static const WCHAR style400
[] = {'4','0','0',0};
757 static const WCHAR style500
[] = {'5','0','0',0};
758 static const WCHAR style600
[] = {'6','0','0',0};
759 static const WCHAR style700
[] = {'7','0','0',0};
760 static const WCHAR style800
[] = {'8','0','0',0};
761 static const WCHAR style900
[] = {'9','0','0',0};
763 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
765 /* fontWeight can only be one of the following */
766 if(!v
|| strcmpiW(szNormal
, v
) == 0 || strcmpiW(styleBold
, v
) == 0 ||
767 strcmpiW(styleBolder
, v
) == 0 || strcmpiW(styleLighter
, v
) == 0 ||
768 strcmpiW(style100
, v
) == 0 || strcmpiW(style200
, v
) == 0 ||
769 strcmpiW(style300
, v
) == 0 || strcmpiW(style400
, v
) == 0 ||
770 strcmpiW(style500
, v
) == 0 || strcmpiW(style600
, v
) == 0 ||
771 strcmpiW(style700
, v
) == 0 || strcmpiW(style800
, v
) == 0 ||
772 strcmpiW(style900
, v
) == 0
775 return set_nsstyle_attr(This
->nsstyle
, STYLEID_FONT_WEIGHT
, v
, 0);
781 static HRESULT WINAPI
HTMLStyle_get_fontWeight(IHTMLStyle
*iface
, BSTR
*p
)
783 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
785 TRACE("(%p)->(%p)\n", This
, p
);
787 return get_style_attr(This
, STYLEID_FONT_WEIGHT
, p
);
790 static HRESULT WINAPI
HTMLStyle_put_fontSize(IHTMLStyle
*iface
, VARIANT v
)
792 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
794 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
798 return set_style_attr(This
, STYLEID_FONT_SIZE
, V_BSTR(&v
), 0);
800 FIXME("not supported vt %d\n", V_VT(&v
));
806 static HRESULT WINAPI
HTMLStyle_get_fontSize(IHTMLStyle
*iface
, VARIANT
*p
)
808 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
810 TRACE("(%p)->(%p)\n", This
, p
);
813 return get_style_attr(This
, STYLEID_FONT_SIZE
, &V_BSTR(p
));
816 static HRESULT WINAPI
HTMLStyle_put_font(IHTMLStyle
*iface
, BSTR v
)
818 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
819 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
823 static HRESULT WINAPI
HTMLStyle_get_font(IHTMLStyle
*iface
, BSTR
*p
)
825 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
826 FIXME("(%p)->(%p)\n", This
, p
);
830 static HRESULT WINAPI
HTMLStyle_put_color(IHTMLStyle
*iface
, VARIANT v
)
832 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
834 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
838 TRACE("%s\n", debugstr_w(V_BSTR(&v
)));
839 return set_style_attr(This
, STYLEID_COLOR
, V_BSTR(&v
), 0);
842 FIXME("unsupported vt=%d\n", V_VT(&v
));
848 static HRESULT WINAPI
HTMLStyle_get_color(IHTMLStyle
*iface
, VARIANT
*p
)
850 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
852 TRACE("(%p)->(%p)\n", This
, p
);
855 return get_style_attr(This
, STYLEID_COLOR
, &V_BSTR(p
));
858 static HRESULT WINAPI
HTMLStyle_put_background(IHTMLStyle
*iface
, BSTR v
)
860 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
862 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
864 return set_style_attr(This
, STYLEID_BACKGROUND
, v
, 0);
867 static HRESULT WINAPI
HTMLStyle_get_background(IHTMLStyle
*iface
, BSTR
*p
)
869 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
871 TRACE("(%p)->(%p)\n", This
, p
);
873 return get_style_attr(This
, STYLEID_BACKGROUND
, p
);
876 static HRESULT WINAPI
HTMLStyle_put_backgroundColor(IHTMLStyle
*iface
, VARIANT v
)
878 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
880 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
884 return set_style_attr(This
, STYLEID_BACKGROUND_COLOR
, V_BSTR(&v
), 0);
887 static const WCHAR format
[] = {'#','%','0','6','x',0};
889 wsprintfW(value
, format
, V_I4(&v
));
890 return set_style_attr(This
, STYLEID_BACKGROUND_COLOR
, value
, 0);
893 FIXME("unsupported vt %d\n", V_VT(&v
));
899 static HRESULT WINAPI
HTMLStyle_get_backgroundColor(IHTMLStyle
*iface
, VARIANT
*p
)
901 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
902 TRACE("(%p)->(%p)\n", This
, p
);
905 return get_style_attr(This
, STYLEID_BACKGROUND_COLOR
, &V_BSTR(p
));
908 static HRESULT WINAPI
HTMLStyle_put_backgroundImage(IHTMLStyle
*iface
, BSTR v
)
910 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
912 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
914 return set_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, v
, ATTR_FIX_URL
);
917 static HRESULT WINAPI
HTMLStyle_get_backgroundImage(IHTMLStyle
*iface
, BSTR
*p
)
919 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
921 TRACE("(%p)->(%p)\n", This
, p
);
923 return get_style_attr(This
, STYLEID_BACKGROUND_IMAGE
, p
);
926 static HRESULT WINAPI
HTMLStyle_put_backgroundRepeat(IHTMLStyle
*iface
, BSTR v
)
928 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
929 static const WCHAR styleRepeat
[] = {'r','e','p','e','a','t',0};
930 static const WCHAR styleNoRepeat
[] = {'n','o','-','r','e','p','e','a','t',0};
931 static const WCHAR styleRepeatX
[] = {'r','e','p','e','a','t','-','x',0};
932 static const WCHAR styleRepeatY
[] = {'r','e','p','e','a','t','-','y',0};
934 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
936 /* fontWeight can only be one of the following */
937 if(!v
|| strcmpiW(styleRepeat
, v
) == 0 || strcmpiW(styleNoRepeat
, v
) == 0 ||
938 strcmpiW(styleRepeatX
, v
) == 0 || strcmpiW(styleRepeatY
, v
) == 0 )
940 return set_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, v
, 0);
946 static HRESULT WINAPI
HTMLStyle_get_backgroundRepeat(IHTMLStyle
*iface
, BSTR
*p
)
948 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
950 TRACE("(%p)->(%p)\n", This
, p
);
952 return get_style_attr(This
, STYLEID_BACKGROUND_REPEAT
, p
);
955 static HRESULT WINAPI
HTMLStyle_put_backgroundAttachment(IHTMLStyle
*iface
, BSTR v
)
957 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
958 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
962 static HRESULT WINAPI
HTMLStyle_get_backgroundAttachment(IHTMLStyle
*iface
, BSTR
*p
)
964 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
965 FIXME("(%p)->(%p)\n", This
, p
);
969 static HRESULT WINAPI
HTMLStyle_put_backgroundPosition(IHTMLStyle
*iface
, BSTR v
)
971 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
973 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
975 return set_style_attr(This
, STYLEID_BACKGROUND_POSITION
, v
, 0);
978 static HRESULT WINAPI
HTMLStyle_get_backgroundPosition(IHTMLStyle
*iface
, BSTR
*p
)
980 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
982 TRACE("(%p)->(%p)\n", This
, p
);
984 return get_style_attr(This
, STYLEID_BACKGROUND_POSITION
, p
);
987 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionX(IHTMLStyle
*iface
, VARIANT v
)
989 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
990 WCHAR buf
[14], *pos_val
;
996 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
998 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1002 val_len
= val
? strlenW(val
) : 0;
1004 nsAString_Init(&pos_str
, NULL
);
1005 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1006 if(SUCCEEDED(hres
)) {
1007 const PRUnichar
*pos
, *posy
;
1010 nsAString_GetData(&pos_str
, &pos
);
1011 posy
= strchrW(pos
, ' ');
1013 static const WCHAR zero_pxW
[] = {' ','0','p','x',0};
1015 TRACE("no space in %s\n", debugstr_w(pos
));
1019 posy_len
= strlenW(posy
);
1020 pos_val
= heap_alloc((val_len
+posy_len
+1)*sizeof(WCHAR
));
1023 memcpy(pos_val
, val
, val_len
*sizeof(WCHAR
));
1025 memcpy(pos_val
+val_len
, posy
, posy_len
*sizeof(WCHAR
));
1026 pos_val
[val_len
+posy_len
] = 0;
1028 hres
= E_OUTOFMEMORY
;
1031 nsAString_Finish(&pos_str
);
1035 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1036 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1041 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionX(IHTMLStyle
*iface
, VARIANT
*p
)
1043 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1048 TRACE("(%p)->(%p)\n", This
, p
);
1050 nsAString_Init(&pos_str
, NULL
);
1051 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1052 if(SUCCEEDED(hres
)) {
1053 const PRUnichar
*pos
, *space
;
1055 nsAString_GetData(&pos_str
, &pos
);
1056 space
= strchrW(pos
, ' ');
1058 WARN("no space in %s\n", debugstr_w(pos
));
1059 space
= pos
+ strlenW(pos
);
1063 ret
= SysAllocStringLen(pos
, space
-pos
);
1065 hres
= E_OUTOFMEMORY
;
1070 nsAString_Finish(&pos_str
);
1074 TRACE("returning %s\n", debugstr_w(ret
));
1080 static HRESULT WINAPI
HTMLStyle_put_backgroundPositionY(IHTMLStyle
*iface
, VARIANT v
)
1082 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1083 WCHAR buf
[14], *pos_val
;
1089 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1091 hres
= var_to_styleval(&v
, buf
, ATTR_FIX_PX
, &val
);
1095 val_len
= val
? strlenW(val
) : 0;
1097 nsAString_Init(&pos_str
, NULL
);
1098 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1099 if(SUCCEEDED(hres
)) {
1100 const PRUnichar
*pos
, *space
;
1103 nsAString_GetData(&pos_str
, &pos
);
1104 space
= strchrW(pos
, ' ');
1108 static const WCHAR zero_pxW
[] = {'0','p','x',' ',0};
1110 TRACE("no space in %s\n", debugstr_w(pos
));
1112 space
= pos
+ sizeof(zero_pxW
)/sizeof(WCHAR
)-1;
1115 posx_len
= space
-pos
;
1117 pos_val
= heap_alloc((posx_len
+val_len
+1)*sizeof(WCHAR
));
1119 memcpy(pos_val
, pos
, posx_len
*sizeof(WCHAR
));
1121 memcpy(pos_val
+posx_len
, val
, val_len
*sizeof(WCHAR
));
1122 pos_val
[posx_len
+val_len
] = 0;
1124 hres
= E_OUTOFMEMORY
;
1127 nsAString_Finish(&pos_str
);
1131 TRACE("setting position to %s\n", debugstr_w(pos_val
));
1132 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, pos_val
, ATTR_FIX_PX
);
1137 static HRESULT WINAPI
HTMLStyle_get_backgroundPositionY(IHTMLStyle
*iface
, VARIANT
*p
)
1139 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1144 TRACE("(%p)->(%p)\n", This
, p
);
1146 nsAString_Init(&pos_str
, NULL
);
1147 hres
= get_nsstyle_attr_nsval(This
->nsstyle
, STYLEID_BACKGROUND_POSITION
, &pos_str
);
1148 if(SUCCEEDED(hres
)) {
1149 const PRUnichar
*pos
, *posy
;
1151 nsAString_GetData(&pos_str
, &pos
);
1152 posy
= strchrW(pos
, ' ');
1154 ret
= SysAllocString(posy
+1);
1156 hres
= E_OUTOFMEMORY
;
1161 nsAString_Finish(&pos_str
);
1165 TRACE("returning %s\n", debugstr_w(ret
));
1171 static HRESULT WINAPI
HTMLStyle_put_wordSpacing(IHTMLStyle
*iface
, VARIANT v
)
1173 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1174 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1175 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, &v
, 0);
1178 static HRESULT WINAPI
HTMLStyle_get_wordSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1180 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1181 TRACE("(%p)->(%p)\n", This
, p
);
1182 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_WORD_SPACING
, p
, 0);
1185 static HRESULT WINAPI
HTMLStyle_put_letterSpacing(IHTMLStyle
*iface
, VARIANT v
)
1187 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1188 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1189 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, &v
, 0);
1192 static HRESULT WINAPI
HTMLStyle_get_letterSpacing(IHTMLStyle
*iface
, VARIANT
*p
)
1194 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1195 TRACE("(%p)->(%p)\n", This
, p
);
1196 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_LETTER_SPACING
, p
, 0);
1199 static HRESULT WINAPI
HTMLStyle_put_textDecoration(IHTMLStyle
*iface
, BSTR v
)
1201 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1203 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1205 /* textDecoration can only be one of the following */
1206 if(!v
|| strcmpiW(styleNone
, v
) == 0 || strcmpiW(valUnderline
, v
) == 0 ||
1207 strcmpiW(valOverline
, v
) == 0 || strcmpiW(valLineThrough
, v
) == 0 ||
1208 strcmpiW(valBlink
, v
) == 0)
1210 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
, 0);
1213 return E_INVALIDARG
;
1216 static HRESULT WINAPI
HTMLStyle_get_textDecoration(IHTMLStyle
*iface
, BSTR
*p
)
1218 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1220 TRACE("(%p)->(%p)\n", This
, p
);
1222 return get_style_attr(This
, STYLEID_TEXT_DECORATION
, p
);
1225 static HRESULT WINAPI
HTMLStyle_put_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1227 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1229 TRACE("(%p)->(%x)\n", This
, v
);
1231 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? styleNone
: emptyW
, 0);
1234 static HRESULT WINAPI
HTMLStyle_get_textDecorationNone(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1236 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1238 TRACE("(%p)->(%p)\n", This
, p
);
1240 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, styleNone
, p
);
1243 static HRESULT WINAPI
HTMLStyle_put_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1245 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1247 TRACE("(%p)->(%x)\n", This
, v
);
1249 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valUnderline
: emptyW
, 0);
1252 static HRESULT WINAPI
HTMLStyle_get_textDecorationUnderline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1254 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1256 TRACE("(%p)->(%p)\n", This
, p
);
1258 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valUnderline
, p
);
1261 static HRESULT WINAPI
HTMLStyle_put_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1263 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1265 TRACE("(%p)->(%x)\n", This
, v
);
1267 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valOverline
: emptyW
, 0);
1270 static HRESULT WINAPI
HTMLStyle_get_textDecorationOverline(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1272 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1274 TRACE("(%p)->(%p)\n", This
, p
);
1276 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valOverline
, p
);
1279 static HRESULT WINAPI
HTMLStyle_put_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1281 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1283 TRACE("(%p)->(%x)\n", This
, v
);
1285 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valLineThrough
: emptyW
, 0);
1288 static HRESULT WINAPI
HTMLStyle_get_textDecorationLineThrough(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1290 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1292 TRACE("(%p)->(%p)\n", This
, p
);
1294 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valLineThrough
, p
);
1297 static HRESULT WINAPI
HTMLStyle_put_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL v
)
1299 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1301 TRACE("(%p)->(%x)\n", This
, v
);
1303 return set_style_attr(This
, STYLEID_TEXT_DECORATION
, v
? valBlink
: emptyW
, 0);
1306 static HRESULT WINAPI
HTMLStyle_get_textDecorationBlink(IHTMLStyle
*iface
, VARIANT_BOOL
*p
)
1308 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1310 TRACE("(%p)->(%p)\n", This
, p
);
1312 return check_style_attr_value(This
, STYLEID_TEXT_DECORATION
, valBlink
, p
);
1315 static HRESULT WINAPI
HTMLStyle_put_verticalAlign(IHTMLStyle
*iface
, VARIANT v
)
1317 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1319 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1323 return set_style_attr(This
, STYLEID_VERTICAL_ALIGN
, V_BSTR(&v
), 0);
1325 FIXME("not implemented vt %d\n", V_VT(&v
));
1332 static HRESULT WINAPI
HTMLStyle_get_verticalAlign(IHTMLStyle
*iface
, VARIANT
*p
)
1334 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1338 TRACE("(%p)->(%p)\n", This
, p
);
1340 hres
= get_style_attr(This
, STYLEID_VERTICAL_ALIGN
, &ret
);
1349 static HRESULT WINAPI
HTMLStyle_put_textTransform(IHTMLStyle
*iface
, BSTR v
)
1351 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1352 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1356 static HRESULT WINAPI
HTMLStyle_get_textTransform(IHTMLStyle
*iface
, BSTR
*p
)
1358 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1359 FIXME("(%p)->(%p)\n", This
, p
);
1363 static HRESULT WINAPI
HTMLStyle_put_textAlign(IHTMLStyle
*iface
, BSTR v
)
1365 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1367 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1369 return set_style_attr(This
, STYLEID_TEXT_ALIGN
, v
, 0);
1372 static HRESULT WINAPI
HTMLStyle_get_textAlign(IHTMLStyle
*iface
, BSTR
*p
)
1374 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1376 TRACE("(%p)->(%p)\n", This
, p
);
1378 return get_style_attr(This
, STYLEID_TEXT_ALIGN
, p
);
1381 static HRESULT WINAPI
HTMLStyle_put_textIndent(IHTMLStyle
*iface
, VARIANT v
)
1383 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1384 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1388 static HRESULT WINAPI
HTMLStyle_get_textIndent(IHTMLStyle
*iface
, VARIANT
*p
)
1390 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1391 FIXME("(%p)->(%p)\n", This
, p
);
1395 static HRESULT WINAPI
HTMLStyle_put_lineHeight(IHTMLStyle
*iface
, VARIANT v
)
1397 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1398 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1402 static HRESULT WINAPI
HTMLStyle_get_lineHeight(IHTMLStyle
*iface
, VARIANT
*p
)
1404 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1405 FIXME("(%p)->(%p)\n", This
, p
);
1409 static HRESULT WINAPI
HTMLStyle_put_marginTop(IHTMLStyle
*iface
, VARIANT v
)
1411 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1413 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1415 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, &v
, 0);
1418 static HRESULT WINAPI
HTMLStyle_get_marginTop(IHTMLStyle
*iface
, VARIANT
*p
)
1420 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1422 TRACE("(%p)->(%p)\n", This
, p
);
1424 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_TOP
, p
, 0);
1427 static HRESULT WINAPI
HTMLStyle_put_marginRight(IHTMLStyle
*iface
, VARIANT v
)
1429 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1431 TRACE("(%p)->(v(%d))\n", This
, V_VT(&v
));
1435 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, emptyW
, 0);
1439 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1440 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, buf
, 0);
1443 return set_style_attr(This
, STYLEID_MARGIN_RIGHT
, V_BSTR(&v
), 0);
1445 FIXME("Unsupported vt=%d\n", V_VT(&v
));
1451 static HRESULT WINAPI
HTMLStyle_get_marginRight(IHTMLStyle
*iface
, VARIANT
*p
)
1453 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1454 TRACE("(%p)->(%p)\n", This
, p
);
1455 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_RIGHT
, p
, 0);
1458 static HRESULT WINAPI
HTMLStyle_put_marginBottom(IHTMLStyle
*iface
, VARIANT v
)
1460 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1461 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1465 static HRESULT WINAPI
HTMLStyle_get_marginBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1467 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1468 FIXME("(%p)->(%p)\n", This
, p
);
1472 static HRESULT WINAPI
HTMLStyle_put_marginLeft(IHTMLStyle
*iface
, VARIANT v
)
1474 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1478 TRACE("(%p)->(NULL)\n", This
);
1479 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, emptyW
, 0);
1483 TRACE("(%p)->(%d)\n", This
, V_I4(&v
));
1485 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1486 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, buf
, 0);
1489 TRACE("(%p)->(%s)\n", This
, debugstr_w(V_BSTR(&v
)));
1490 return set_style_attr(This
, STYLEID_MARGIN_LEFT
, V_BSTR(&v
), 0);
1492 FIXME("Unsupported vt=%d\n", V_VT(&v
));
1498 static HRESULT WINAPI
HTMLStyle_put_margin(IHTMLStyle
*iface
, BSTR v
)
1500 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1502 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1504 return set_style_attr(This
, STYLEID_MARGIN
, v
, 0);
1507 static HRESULT WINAPI
HTMLStyle_get_margin(IHTMLStyle
*iface
, BSTR
*p
)
1509 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1511 TRACE("(%p)->(%p)\n", This
, p
);
1513 return get_style_attr(This
, STYLEID_MARGIN
, p
);
1516 static HRESULT WINAPI
HTMLStyle_get_marginLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1518 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1519 TRACE("(%p)->(%p)\n", This
, p
);
1520 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_MARGIN_LEFT
, p
, 0);
1523 static HRESULT WINAPI
HTMLStyle_put_paddingTop(IHTMLStyle
*iface
, VARIANT v
)
1525 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1526 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1530 static HRESULT WINAPI
HTMLStyle_get_paddingTop(IHTMLStyle
*iface
, VARIANT
*p
)
1532 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1533 FIXME("(%p)->(%p)\n", This
, p
);
1537 static HRESULT WINAPI
HTMLStyle_put_paddingRight(IHTMLStyle
*iface
, VARIANT v
)
1539 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1540 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1544 static HRESULT WINAPI
HTMLStyle_get_paddingRight(IHTMLStyle
*iface
, VARIANT
*p
)
1546 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1547 FIXME("(%p)->(%p)\n", This
, p
);
1551 static HRESULT WINAPI
HTMLStyle_put_paddingBottom(IHTMLStyle
*iface
, VARIANT v
)
1553 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1554 FIXME("(%p)->(v%d)\n", This
, V_VT(&v
));
1558 static HRESULT WINAPI
HTMLStyle_get_paddingBottom(IHTMLStyle
*iface
, VARIANT
*p
)
1560 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1561 FIXME("(%p)->(%p)\n", This
, p
);
1565 static HRESULT WINAPI
HTMLStyle_put_paddingLeft(IHTMLStyle
*iface
, VARIANT v
)
1567 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1569 TRACE("(%p)->(vt=%d)\n", This
, V_VT(&v
));
1575 wsprintfW(buf
, px_formatW
, V_I4(&v
));
1576 return set_style_attr(This
, STYLEID_PADDING_LEFT
, buf
, 0);
1579 return set_style_attr(This
, STYLEID_PADDING_LEFT
, V_BSTR(&v
), 0);
1581 FIXME("unsupported vt=%d\n", V_VT(&v
));
1587 static HRESULT WINAPI
HTMLStyle_get_paddingLeft(IHTMLStyle
*iface
, VARIANT
*p
)
1589 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1593 TRACE("(%p)->(%p)\n", This
, p
);
1595 hres
= get_style_attr(This
, STYLEID_PADDING_LEFT
, &ret
);
1604 static HRESULT WINAPI
HTMLStyle_put_padding(IHTMLStyle
*iface
, BSTR v
)
1606 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1608 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1610 return set_style_attr(This
, STYLEID_PADDING
, v
, 0);
1613 static HRESULT WINAPI
HTMLStyle_get_padding(IHTMLStyle
*iface
, BSTR
*p
)
1615 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1617 TRACE("(%p)->(%p)\n", This
, p
);
1619 return get_style_attr(This
, STYLEID_PADDING
, p
);
1622 static HRESULT WINAPI
HTMLStyle_put_border(IHTMLStyle
*iface
, BSTR v
)
1624 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1626 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1628 return set_style_attr(This
, STYLEID_BORDER
, v
, 0);
1631 static HRESULT WINAPI
HTMLStyle_get_border(IHTMLStyle
*iface
, BSTR
*p
)
1633 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1635 TRACE("(%p)->(%p)\n", This
, p
);
1637 return get_style_attr(This
, STYLEID_BORDER
, p
);
1640 static HRESULT WINAPI
HTMLStyle_put_borderTop(IHTMLStyle
*iface
, BSTR v
)
1642 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1643 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1644 return set_style_attr(This
, STYLEID_BORDER_TOP
, v
, ATTR_FIX_PX
);
1647 static HRESULT WINAPI
HTMLStyle_get_borderTop(IHTMLStyle
*iface
, BSTR
*p
)
1649 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1650 TRACE("(%p)->(%p)\n", This
, p
);
1651 return get_style_attr(This
, STYLEID_BORDER_TOP
, p
);
1654 static HRESULT WINAPI
HTMLStyle_put_borderRight(IHTMLStyle
*iface
, BSTR v
)
1656 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1657 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1658 return set_style_attr(This
, STYLEID_BORDER_RIGHT
, v
, ATTR_FIX_PX
);
1661 static HRESULT WINAPI
HTMLStyle_get_borderRight(IHTMLStyle
*iface
, BSTR
*p
)
1663 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1664 TRACE("(%p)->(%p)\n", This
, p
);
1665 return get_style_attr(This
, STYLEID_BORDER_RIGHT
, p
);
1668 static HRESULT WINAPI
HTMLStyle_put_borderBottom(IHTMLStyle
*iface
, BSTR v
)
1670 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1671 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1672 return set_style_attr(This
, STYLEID_BORDER_BOTTOM
, v
, ATTR_FIX_PX
);
1675 static HRESULT WINAPI
HTMLStyle_get_borderBottom(IHTMLStyle
*iface
, BSTR
*p
)
1677 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1678 TRACE("(%p)->(%p)\n", This
, p
);
1679 return get_style_attr(This
, STYLEID_BORDER_BOTTOM
, p
);
1682 static HRESULT WINAPI
HTMLStyle_put_borderLeft(IHTMLStyle
*iface
, BSTR v
)
1684 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1686 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1688 return set_style_attr(This
, STYLEID_BORDER_LEFT
, v
, ATTR_FIX_PX
);
1691 static HRESULT WINAPI
HTMLStyle_get_borderLeft(IHTMLStyle
*iface
, BSTR
*p
)
1693 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1695 TRACE("(%p)->(%p)\n", This
, p
);
1697 return get_style_attr(This
, STYLEID_BORDER_LEFT
, p
);
1700 static HRESULT WINAPI
HTMLStyle_put_borderColor(IHTMLStyle
*iface
, BSTR v
)
1702 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1704 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1706 return set_style_attr(This
, STYLEID_BORDER_COLOR
, v
, 0);
1709 static HRESULT WINAPI
HTMLStyle_get_borderColor(IHTMLStyle
*iface
, BSTR
*p
)
1711 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1713 TRACE("(%p)->(%p)\n", This
, p
);
1715 return get_style_attr(This
, STYLEID_BORDER_COLOR
, p
);
1718 static HRESULT WINAPI
HTMLStyle_put_borderTopColor(IHTMLStyle
*iface
, VARIANT v
)
1720 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1722 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1724 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, &v
, ATTR_HEX_INT
);
1727 static HRESULT WINAPI
HTMLStyle_get_borderTopColor(IHTMLStyle
*iface
, VARIANT
*p
)
1729 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1731 TRACE("(%p)->(%p)\n", This
, p
);
1733 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_COLOR
, p
, 0);
1736 static HRESULT WINAPI
HTMLStyle_put_borderRightColor(IHTMLStyle
*iface
, VARIANT v
)
1738 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1740 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1742 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, &v
, ATTR_HEX_INT
);
1745 static HRESULT WINAPI
HTMLStyle_get_borderRightColor(IHTMLStyle
*iface
, VARIANT
*p
)
1747 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1749 TRACE("(%p)->(%p)\n", This
, p
);
1751 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_COLOR
, p
, 0);
1754 static HRESULT WINAPI
HTMLStyle_put_borderBottomColor(IHTMLStyle
*iface
, VARIANT v
)
1756 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1758 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1760 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, &v
, ATTR_HEX_INT
);
1763 static HRESULT WINAPI
HTMLStyle_get_borderBottomColor(IHTMLStyle
*iface
, VARIANT
*p
)
1765 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1767 TRACE("(%p)->(%p)\n", This
, p
);
1769 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_COLOR
, p
, 0);
1772 static HRESULT WINAPI
HTMLStyle_put_borderLeftColor(IHTMLStyle
*iface
, VARIANT v
)
1774 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1776 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1778 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, &v
, ATTR_HEX_INT
);
1781 static HRESULT WINAPI
HTMLStyle_get_borderLeftColor(IHTMLStyle
*iface
, VARIANT
*p
)
1783 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1785 TRACE("(%p)->(%p)\n", This
, p
);
1787 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_COLOR
, p
, 0);
1790 static HRESULT WINAPI
HTMLStyle_put_borderWidth(IHTMLStyle
*iface
, BSTR v
)
1792 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1793 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1794 return set_style_attr(This
, STYLEID_BORDER_WIDTH
, v
, ATTR_FIX_PX
);
1797 static HRESULT WINAPI
HTMLStyle_get_borderWidth(IHTMLStyle
*iface
, BSTR
*p
)
1799 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1800 TRACE("(%p)->(%p)\n", This
, p
);
1801 return get_style_attr(This
, STYLEID_BORDER_WIDTH
, p
);
1804 static HRESULT WINAPI
HTMLStyle_put_borderTopWidth(IHTMLStyle
*iface
, VARIANT v
)
1806 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1807 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1808 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, &v
, 0);
1811 static HRESULT WINAPI
HTMLStyle_get_borderTopWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1813 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1815 TRACE("(%p)->(%p)\n", This
, p
);
1817 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_TOP_WIDTH
, p
, 0);
1820 static HRESULT WINAPI
HTMLStyle_put_borderRightWidth(IHTMLStyle
*iface
, VARIANT v
)
1822 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1823 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1824 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, &v
, 0);
1827 static HRESULT WINAPI
HTMLStyle_get_borderRightWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1829 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1830 TRACE("(%p)->(%p)\n", This
, p
);
1831 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_RIGHT_WIDTH
, p
, 0);
1834 static HRESULT WINAPI
HTMLStyle_put_borderBottomWidth(IHTMLStyle
*iface
, VARIANT v
)
1836 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1838 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1839 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, &v
, 0);
1842 static HRESULT WINAPI
HTMLStyle_get_borderBottomWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1844 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1845 TRACE("(%p)->(%p)\n", This
, p
);
1846 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_BOTTOM_WIDTH
, p
, 0);
1849 static HRESULT WINAPI
HTMLStyle_put_borderLeftWidth(IHTMLStyle
*iface
, VARIANT v
)
1851 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1852 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1853 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, &v
, 0);
1856 static HRESULT WINAPI
HTMLStyle_get_borderLeftWidth(IHTMLStyle
*iface
, VARIANT
*p
)
1858 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1859 TRACE("(%p)->(%p)\n", This
, p
);
1860 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_BORDER_LEFT_WIDTH
, p
, 0);
1863 static HRESULT WINAPI
HTMLStyle_put_borderStyle(IHTMLStyle
*iface
, BSTR v
)
1865 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1866 static const WCHAR styleWindowInset
[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
1867 HRESULT hres
= S_OK
;
1872 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1874 while(v
[i
] && hres
== S_OK
)
1876 if(v
[i
] == (WCHAR
)' ')
1878 pstyle
= SysAllocStringLen(&v
[last
], (i
-last
));
1879 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1881 TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle
));
1882 hres
= E_INVALIDARG
;
1884 SysFreeString(pstyle
);
1892 pstyle
= SysAllocStringLen(&v
[last
], i
-last
);
1893 if( !(is_valid_border_style(pstyle
) || strcmpiW(styleWindowInset
, pstyle
) == 0))
1895 TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle
));
1896 hres
= E_INVALIDARG
;
1898 SysFreeString(pstyle
);
1902 hres
= set_nsstyle_attr(This
->nsstyle
, STYLEID_BORDER_STYLE
, v
, 0);
1907 static HRESULT WINAPI
HTMLStyle_get_borderStyle(IHTMLStyle
*iface
, BSTR
*p
)
1909 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1910 TRACE("(%p)->(%p)\n", This
, p
);
1911 return get_style_attr(This
, STYLEID_BORDER_STYLE
, p
);
1914 static HRESULT WINAPI
HTMLStyle_put_borderTopStyle(IHTMLStyle
*iface
, BSTR v
)
1916 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1917 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1919 if(!is_valid_border_style(v
))
1920 return E_INVALIDARG
;
1922 return set_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, v
, 0);
1925 static HRESULT WINAPI
HTMLStyle_get_borderTopStyle(IHTMLStyle
*iface
, BSTR
*p
)
1927 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1928 TRACE("(%p)->(%p)\n", This
, p
);
1929 return get_style_attr(This
, STYLEID_BORDER_TOP_STYLE
, p
);
1932 static HRESULT WINAPI
HTMLStyle_put_borderRightStyle(IHTMLStyle
*iface
, BSTR v
)
1934 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1935 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1937 if(!is_valid_border_style(v
))
1938 return E_INVALIDARG
;
1940 return set_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, v
, 0);
1943 static HRESULT WINAPI
HTMLStyle_get_borderRightStyle(IHTMLStyle
*iface
, BSTR
*p
)
1945 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1946 TRACE("(%p)->(%p)\n", This
, p
);
1947 return get_style_attr(This
, STYLEID_BORDER_RIGHT_STYLE
, p
);
1950 static HRESULT WINAPI
HTMLStyle_put_borderBottomStyle(IHTMLStyle
*iface
, BSTR v
)
1952 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1953 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1955 if(!is_valid_border_style(v
))
1956 return E_INVALIDARG
;
1958 return set_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, v
, 0);
1961 static HRESULT WINAPI
HTMLStyle_get_borderBottomStyle(IHTMLStyle
*iface
, BSTR
*p
)
1963 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1964 TRACE("(%p)->(%p)\n", This
, p
);
1965 return get_style_attr(This
, STYLEID_BORDER_BOTTOM_STYLE
, p
);
1968 static HRESULT WINAPI
HTMLStyle_put_borderLeftStyle(IHTMLStyle
*iface
, BSTR v
)
1970 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1971 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1973 if(!is_valid_border_style(v
))
1974 return E_INVALIDARG
;
1976 return set_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, v
, 0);
1979 static HRESULT WINAPI
HTMLStyle_get_borderLeftStyle(IHTMLStyle
*iface
, BSTR
*p
)
1981 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1982 TRACE("(%p)->(%p)\n", This
, p
);
1983 return get_style_attr(This
, STYLEID_BORDER_LEFT_STYLE
, p
);
1986 static HRESULT WINAPI
HTMLStyle_put_width(IHTMLStyle
*iface
, VARIANT v
)
1988 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1990 TRACE("(%p)->(v%d)\n", This
, V_VT(&v
));
1992 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_WIDTH
, &v
, ATTR_FIX_PX
);
1995 static HRESULT WINAPI
HTMLStyle_get_width(IHTMLStyle
*iface
, VARIANT
*p
)
1997 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
1999 TRACE("(%p)->(%p)\n", This
, p
);
2002 return get_style_attr(This
, STYLEID_WIDTH
, &V_BSTR(p
));
2005 static HRESULT WINAPI
HTMLStyle_put_height(IHTMLStyle
*iface
, VARIANT v
)
2007 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2009 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2013 return set_style_attr(This
, STYLEID_HEIGHT
, V_BSTR(&v
), 0);
2015 FIXME("unimplemented vt %d\n", V_VT(&v
));
2022 static HRESULT WINAPI
HTMLStyle_get_height(IHTMLStyle
*iface
, VARIANT
*p
)
2024 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2028 TRACE("(%p)->(%p)\n", This
, p
);
2030 hres
= get_style_attr(This
, STYLEID_HEIGHT
, &ret
);
2039 static HRESULT WINAPI
HTMLStyle_put_styleFloat(IHTMLStyle
*iface
, BSTR v
)
2041 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2042 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2046 static HRESULT WINAPI
HTMLStyle_get_styleFloat(IHTMLStyle
*iface
, BSTR
*p
)
2048 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2049 FIXME("(%p)->(%p)\n", This
, p
);
2053 static HRESULT WINAPI
HTMLStyle_put_clear(IHTMLStyle
*iface
, BSTR v
)
2055 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2056 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2060 static HRESULT WINAPI
HTMLStyle_get_clear(IHTMLStyle
*iface
, BSTR
*p
)
2062 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2063 FIXME("(%p)->(%p)\n", This
, p
);
2067 static HRESULT WINAPI
HTMLStyle_put_display(IHTMLStyle
*iface
, BSTR v
)
2069 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2071 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2073 return set_style_attr(This
, STYLEID_DISPLAY
, v
, 0);
2076 static HRESULT WINAPI
HTMLStyle_get_display(IHTMLStyle
*iface
, BSTR
*p
)
2078 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2080 TRACE("(%p)->(%p)\n", This
, p
);
2082 return get_style_attr(This
, STYLEID_DISPLAY
, p
);
2085 static HRESULT WINAPI
HTMLStyle_put_visibility(IHTMLStyle
*iface
, BSTR v
)
2087 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2089 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2091 return set_style_attr(This
, STYLEID_VISIBILITY
, v
, 0);
2094 static HRESULT WINAPI
HTMLStyle_get_visibility(IHTMLStyle
*iface
, BSTR
*p
)
2096 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2098 TRACE("(%p)->(%p)\n", This
, p
);
2100 return get_style_attr(This
, STYLEID_VISIBILITY
, p
);
2103 static HRESULT WINAPI
HTMLStyle_put_listStyleType(IHTMLStyle
*iface
, BSTR v
)
2105 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2106 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2110 static HRESULT WINAPI
HTMLStyle_get_listStyleType(IHTMLStyle
*iface
, BSTR
*p
)
2112 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2113 FIXME("(%p)->(%p)\n", This
, p
);
2117 static HRESULT WINAPI
HTMLStyle_put_listStylePosition(IHTMLStyle
*iface
, BSTR v
)
2119 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2120 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2124 static HRESULT WINAPI
HTMLStyle_get_listStylePosition(IHTMLStyle
*iface
, BSTR
*p
)
2126 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2127 FIXME("(%p)->(%p)\n", This
, p
);
2131 static HRESULT WINAPI
HTMLStyle_put_listStyleImage(IHTMLStyle
*iface
, BSTR v
)
2133 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2134 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2138 static HRESULT WINAPI
HTMLStyle_get_listStyleImage(IHTMLStyle
*iface
, BSTR
*p
)
2140 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2141 FIXME("(%p)->(%p)\n", This
, p
);
2145 static HRESULT WINAPI
HTMLStyle_put_listStyle(IHTMLStyle
*iface
, BSTR v
)
2147 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2148 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2152 static HRESULT WINAPI
HTMLStyle_get_listStyle(IHTMLStyle
*iface
, BSTR
*p
)
2154 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2155 FIXME("(%p)->(%p)\n", This
, p
);
2159 static HRESULT WINAPI
HTMLStyle_put_whiteSpace(IHTMLStyle
*iface
, BSTR v
)
2161 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2162 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2166 static HRESULT WINAPI
HTMLStyle_get_whiteSpace(IHTMLStyle
*iface
, BSTR
*p
)
2168 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2169 FIXME("(%p)->(%p)\n", This
, p
);
2173 static HRESULT WINAPI
HTMLStyle_put_top(IHTMLStyle
*iface
, VARIANT v
)
2175 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2177 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2179 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_TOP
, &v
, 0);
2182 static HRESULT WINAPI
HTMLStyle_get_top(IHTMLStyle
*iface
, VARIANT
*p
)
2184 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2188 TRACE("(%p)->(%p)\n", This
, p
);
2190 hres
= get_style_attr(This
, STYLEID_TOP
, &ret
);
2199 static HRESULT WINAPI
HTMLStyle_put_left(IHTMLStyle
*iface
, VARIANT v
)
2201 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2203 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2205 return set_nsstyle_attr_var(This
->nsstyle
, STYLEID_LEFT
, &v
, 0);
2208 static HRESULT WINAPI
HTMLStyle_get_left(IHTMLStyle
*iface
, VARIANT
*p
)
2210 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2214 TRACE("(%p)->(%p)\n", This
, p
);
2216 hres
= get_style_attr(This
, STYLEID_LEFT
, &ret
);
2225 static HRESULT WINAPI
HTMLStyle_get_position(IHTMLStyle
*iface
, BSTR
*p
)
2227 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2228 TRACE("(%p)->(%p)\n", This
, p
);
2229 return IHTMLStyle2_get_position(&This
->IHTMLStyle2_iface
, p
);
2232 static HRESULT WINAPI
HTMLStyle_put_zIndex(IHTMLStyle
*iface
, VARIANT v
)
2234 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2236 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2240 return set_style_attr(This
, STYLEID_Z_INDEX
, V_BSTR(&v
), 0);
2243 static const WCHAR format
[] = {'%','d',0};
2245 wsprintfW(value
, format
, V_I4(&v
));
2246 return set_style_attr(This
, STYLEID_Z_INDEX
, value
, 0);
2249 FIXME("unimplemented vt %d\n", V_VT(&v
));
2256 static HRESULT WINAPI
HTMLStyle_get_zIndex(IHTMLStyle
*iface
, VARIANT
*p
)
2258 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2260 TRACE("(%p)->(%p)\n", This
, p
);
2262 return get_nsstyle_attr_var(This
->nsstyle
, STYLEID_Z_INDEX
, p
, ATTR_STR_TO_INT
);
2265 static HRESULT WINAPI
HTMLStyle_put_overflow(IHTMLStyle
*iface
, BSTR v
)
2267 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2268 static const WCHAR szVisible
[] = {'v','i','s','i','b','l','e',0};
2269 static const WCHAR szScroll
[] = {'s','c','r','o','l','l',0};
2270 static const WCHAR szHidden
[] = {'h','i','d','d','e','n',0};
2271 static const WCHAR szAuto
[] = {'a','u','t','o',0};
2273 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2275 /* overflow can only be one of the follow values. */
2276 if(!v
|| !*v
|| strcmpiW(szVisible
, v
) == 0 || strcmpiW(szScroll
, v
) == 0 ||
2277 strcmpiW(szHidden
, v
) == 0 || strcmpiW(szAuto
, v
) == 0)
2279 return set_nsstyle_attr(This
->nsstyle
, STYLEID_OVERFLOW
, v
, 0);
2282 return E_INVALIDARG
;
2286 static HRESULT WINAPI
HTMLStyle_get_overflow(IHTMLStyle
*iface
, BSTR
*p
)
2288 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2290 TRACE("(%p)->(%p)\n", This
, p
);
2293 return E_INVALIDARG
;
2295 return get_style_attr(This
, STYLEID_OVERFLOW
, p
);
2298 static HRESULT WINAPI
HTMLStyle_put_pageBreakBefore(IHTMLStyle
*iface
, BSTR v
)
2300 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2301 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2305 static HRESULT WINAPI
HTMLStyle_get_pageBreakBefore(IHTMLStyle
*iface
, BSTR
*p
)
2307 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2308 FIXME("(%p)->(%p)\n", This
, p
);
2312 static HRESULT WINAPI
HTMLStyle_put_pageBreakAfter(IHTMLStyle
*iface
, BSTR v
)
2314 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2315 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2319 static HRESULT WINAPI
HTMLStyle_get_pageBreakAfter(IHTMLStyle
*iface
, BSTR
*p
)
2321 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2322 FIXME("(%p)->(%p)\n", This
, p
);
2326 static HRESULT WINAPI
HTMLStyle_put_cssText(IHTMLStyle
*iface
, BSTR v
)
2328 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2332 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2334 nsAString_InitDepend(&text_str
, v
);
2335 nsres
= nsIDOMCSSStyleDeclaration_SetCssText(This
->nsstyle
, &text_str
);
2336 nsAString_Finish(&text_str
);
2337 if(NS_FAILED(nsres
)) {
2338 FIXME("SetCssStyle failed: %08x\n", nsres
);
2345 static HRESULT WINAPI
HTMLStyle_get_cssText(IHTMLStyle
*iface
, BSTR
*p
)
2347 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2351 TRACE("(%p)->(%p)\n", This
, p
);
2353 /* FIXME: Gecko style formatting is different than IE (uppercase). */
2354 nsAString_Init(&text_str
, NULL
);
2355 nsres
= nsIDOMCSSStyleDeclaration_GetCssText(This
->nsstyle
, &text_str
);
2356 if(NS_SUCCEEDED(nsres
)) {
2357 const PRUnichar
*text
;
2359 nsAString_GetData(&text_str
, &text
);
2360 *p
= *text
? SysAllocString(text
) : NULL
;
2362 FIXME("GetCssStyle failed: %08x\n", nsres
);
2366 nsAString_Finish(&text_str
);
2370 static HRESULT WINAPI
HTMLStyle_put_pixelTop(IHTMLStyle
*iface
, LONG v
)
2372 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2373 FIXME("(%p)->()\n", This
);
2377 static HRESULT WINAPI
HTMLStyle_get_pixelTop(IHTMLStyle
*iface
, LONG
*p
)
2379 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2380 FIXME("(%p)->()\n", This
);
2384 static HRESULT WINAPI
HTMLStyle_put_pixelLeft(IHTMLStyle
*iface
, LONG v
)
2386 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2387 FIXME("(%p)->()\n", This
);
2391 static HRESULT WINAPI
HTMLStyle_get_pixelLeft(IHTMLStyle
*iface
, LONG
*p
)
2393 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2394 FIXME("(%p)->()\n", This
);
2398 static HRESULT WINAPI
HTMLStyle_put_pixelWidth(IHTMLStyle
*iface
, LONG v
)
2400 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2401 FIXME("(%p)->()\n", This
);
2405 static HRESULT WINAPI
HTMLStyle_get_pixelWidth(IHTMLStyle
*iface
, LONG
*p
)
2407 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2408 FIXME("(%p)->()\n", This
);
2412 static HRESULT WINAPI
HTMLStyle_put_pixelHeight(IHTMLStyle
*iface
, LONG v
)
2414 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2415 FIXME("(%p)->()\n", This
);
2419 static HRESULT WINAPI
HTMLStyle_get_pixelHeight(IHTMLStyle
*iface
, LONG
*p
)
2421 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2422 FIXME("(%p)->()\n", This
);
2426 static HRESULT WINAPI
HTMLStyle_put_posTop(IHTMLStyle
*iface
, float v
)
2428 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2430 TRACE("(%p)->(%f)\n", This
, v
);
2432 return set_style_pos(This
, STYLEID_TOP
, v
);
2435 static HRESULT WINAPI
HTMLStyle_get_posTop(IHTMLStyle
*iface
, float *p
)
2437 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2439 TRACE("(%p)->(%p)\n", This
, p
);
2444 return get_nsstyle_pos(This
, STYLEID_TOP
, p
);
2447 static HRESULT WINAPI
HTMLStyle_put_posLeft(IHTMLStyle
*iface
, float v
)
2449 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2451 TRACE("(%p)->(%f)\n", This
, v
);
2453 return set_style_pos(This
, STYLEID_LEFT
, v
);
2456 static HRESULT WINAPI
HTMLStyle_get_posLeft(IHTMLStyle
*iface
, float *p
)
2458 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2460 TRACE("(%p)->(%p)\n", This
, p
);
2465 return get_nsstyle_pos(This
, STYLEID_LEFT
, p
);
2468 static HRESULT WINAPI
HTMLStyle_put_posWidth(IHTMLStyle
*iface
, float v
)
2470 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2472 TRACE("(%p)->(%f)\n", This
, v
);
2474 return set_style_pos(This
, STYLEID_WIDTH
, v
);
2477 static HRESULT WINAPI
HTMLStyle_get_posWidth(IHTMLStyle
*iface
, float *p
)
2479 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2481 TRACE("(%p)->(%p)\n", This
, p
);
2486 if(get_nsstyle_pos(This
, STYLEID_WIDTH
, p
) != S_OK
)
2492 static HRESULT WINAPI
HTMLStyle_put_posHeight(IHTMLStyle
*iface
, float v
)
2494 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2496 TRACE("(%p)->(%f)\n", This
, v
);
2498 return set_style_pos(This
, STYLEID_HEIGHT
, v
);
2501 static HRESULT WINAPI
HTMLStyle_get_posHeight(IHTMLStyle
*iface
, float *p
)
2503 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2505 TRACE("(%p)->(%p)\n", This
, p
);
2510 if(get_nsstyle_pos(This
, STYLEID_HEIGHT
, p
) != S_OK
)
2516 static HRESULT WINAPI
HTMLStyle_put_cursor(IHTMLStyle
*iface
, BSTR v
)
2518 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2520 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2522 return set_style_attr(This
, STYLEID_CURSOR
, v
, 0);
2525 static HRESULT WINAPI
HTMLStyle_get_cursor(IHTMLStyle
*iface
, BSTR
*p
)
2527 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2529 TRACE("(%p)->(%p)\n", This
, p
);
2531 return get_style_attr(This
, STYLEID_CURSOR
, p
);
2534 static HRESULT WINAPI
HTMLStyle_put_clip(IHTMLStyle
*iface
, BSTR v
)
2536 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2537 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2541 static HRESULT WINAPI
HTMLStyle_get_clip(IHTMLStyle
*iface
, BSTR
*p
)
2543 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2544 FIXME("(%p)->(%p)\n", This
, p
);
2548 static void set_opacity(HTMLStyle
*This
, const WCHAR
*val
)
2550 nsAString name_str
, val_str
, empty_str
;
2553 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y',0};
2555 TRACE("%s\n", debugstr_w(val
));
2557 nsAString_InitDepend(&name_str
, opacityW
);
2558 nsAString_InitDepend(&val_str
, val
);
2559 nsAString_InitDepend(&empty_str
, emptyW
);
2561 nsres
= nsIDOMCSSStyleDeclaration_SetProperty(This
->nsstyle
, &name_str
, &val_str
, &empty_str
);
2562 if(NS_FAILED(nsres
))
2563 ERR("SetProperty failed: %08x\n", nsres
);
2565 nsAString_Finish(&name_str
);
2566 nsAString_Finish(&val_str
);
2567 nsAString_Finish(&empty_str
);
2570 static void update_filter(HTMLStyle
*This
)
2572 const WCHAR
*ptr
= This
->filter
, *ptr2
;
2574 static const WCHAR alphaW
[] = {'a','l','p','h','a'};
2577 set_opacity(This
, emptyW
);
2582 while(isspaceW(*ptr
))
2588 while(isalnumW(*ptr
))
2591 WARN("unexpected char '%c'\n", *ptr
);
2595 WARN("expected '('\n");
2599 if(ptr2
+ sizeof(alphaW
)/sizeof(WCHAR
) == ptr
&& !memcmp(ptr2
, alphaW
, sizeof(alphaW
))) {
2600 static const WCHAR formatW
[] = {'%','f',0};
2601 static const WCHAR opacityW
[] = {'o','p','a','c','i','t','y','='};
2605 while(isspaceW(*ptr
))
2609 while(*ptr
&& *ptr
!= ',' && *ptr
!= ')')
2612 WARN("unexpected end of string\n");
2616 if(ptr
-ptr2
> sizeof(opacityW
)/sizeof(WCHAR
) && !memcmp(ptr2
, opacityW
, sizeof(opacityW
))) {
2617 float fval
= 0.0f
, e
= 0.1f
;
2620 ptr2
+= sizeof(opacityW
)/sizeof(WCHAR
);
2622 while(isdigitW(*ptr2
))
2623 fval
= fval
*10.0f
+ (float)(*ptr2
++ - '0');
2626 while(isdigitW(*++ptr2
)) {
2627 fval
+= e
* (float)(*ptr2
++ - '0');
2632 sprintfW(buf
, formatW
, fval
* 0.01f
);
2633 set_opacity(This
, buf
);
2635 FIXME("unknown param %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2640 }while(*ptr
!= ')');
2642 FIXME("unknown filter %s\n", debugstr_wn(ptr2
, ptr
-ptr2
));
2643 ptr
= strchrW(ptr
, ')');
2651 static HRESULT WINAPI
HTMLStyle_put_filter(IHTMLStyle
*iface
, BSTR v
)
2653 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2654 WCHAR
*new_filter
= NULL
;
2656 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2659 new_filter
= heap_strdupW(v
);
2661 return E_OUTOFMEMORY
;
2664 heap_free(This
->filter
);
2665 This
->filter
= new_filter
;
2667 update_filter(This
);
2671 static HRESULT WINAPI
HTMLStyle_get_filter(IHTMLStyle
*iface
, BSTR
*p
)
2673 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2675 TRACE("(%p)->(%p)\n", This
, p
);
2678 *p
= SysAllocString(This
->filter
);
2680 return E_OUTOFMEMORY
;
2688 static HRESULT WINAPI
HTMLStyle_setAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2689 VARIANT AttributeValue
, LONG lFlags
)
2691 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2695 TRACE("(%p)->(%s v%d %08x)\n", This
, debugstr_w(strAttributeName
),
2696 V_VT(&AttributeValue
), lFlags
);
2698 if(!strAttributeName
)
2699 return E_INVALIDARG
;
2702 FIXME("Parameter lFlags ignored\n");
2704 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2705 LOCALE_USER_DEFAULT
, &dispid
);
2709 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2713 params
.rgvarg
= &AttributeValue
;
2714 params
.cNamedArgs
= 1;
2715 params
.rgdispidNamedArgs
= &dispidNamed
;
2717 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2718 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2722 FIXME("Custom attributes not supported.\n");
2725 TRACE("ret: %08x\n", hres
);
2730 static HRESULT WINAPI
HTMLStyle_getAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2731 LONG lFlags
, VARIANT
*AttributeValue
)
2733 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2737 TRACE("(%p)->(%s v%p %08x)\n", This
, debugstr_w(strAttributeName
),
2738 AttributeValue
, lFlags
);
2740 if(!AttributeValue
|| !strAttributeName
)
2741 return E_INVALIDARG
;
2744 FIXME("Parameter lFlags ignored\n");
2746 hres
= HTMLStyle_GetIDsOfNames(iface
, &IID_NULL
, &strAttributeName
, 1,
2747 LOCALE_USER_DEFAULT
, &dispid
);
2750 DISPPARAMS params
= {NULL
, NULL
, 0, 0 };
2752 hres
= HTMLStyle_Invoke(iface
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2753 DISPATCH_PROPERTYGET
, ¶ms
, AttributeValue
, NULL
, NULL
);
2757 FIXME("Custom attributes not supported.\n");
2763 static HRESULT WINAPI
HTMLStyle_removeAttribute(IHTMLStyle
*iface
, BSTR strAttributeName
,
2764 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
2766 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2767 FIXME("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
),
2772 static HRESULT WINAPI
HTMLStyle_toString(IHTMLStyle
*iface
, BSTR
*String
)
2774 HTMLStyle
*This
= impl_from_IHTMLStyle(iface
);
2775 FIXME("(%p)->(%p)\n", This
, String
);
2779 static const IHTMLStyleVtbl HTMLStyleVtbl
= {
2780 HTMLStyle_QueryInterface
,
2783 HTMLStyle_GetTypeInfoCount
,
2784 HTMLStyle_GetTypeInfo
,
2785 HTMLStyle_GetIDsOfNames
,
2787 HTMLStyle_put_fontFamily
,
2788 HTMLStyle_get_fontFamily
,
2789 HTMLStyle_put_fontStyle
,
2790 HTMLStyle_get_fontStyle
,
2791 HTMLStyle_put_fontVariant
,
2792 HTMLStyle_get_fontVariant
,
2793 HTMLStyle_put_fontWeight
,
2794 HTMLStyle_get_fontWeight
,
2795 HTMLStyle_put_fontSize
,
2796 HTMLStyle_get_fontSize
,
2799 HTMLStyle_put_color
,
2800 HTMLStyle_get_color
,
2801 HTMLStyle_put_background
,
2802 HTMLStyle_get_background
,
2803 HTMLStyle_put_backgroundColor
,
2804 HTMLStyle_get_backgroundColor
,
2805 HTMLStyle_put_backgroundImage
,
2806 HTMLStyle_get_backgroundImage
,
2807 HTMLStyle_put_backgroundRepeat
,
2808 HTMLStyle_get_backgroundRepeat
,
2809 HTMLStyle_put_backgroundAttachment
,
2810 HTMLStyle_get_backgroundAttachment
,
2811 HTMLStyle_put_backgroundPosition
,
2812 HTMLStyle_get_backgroundPosition
,
2813 HTMLStyle_put_backgroundPositionX
,
2814 HTMLStyle_get_backgroundPositionX
,
2815 HTMLStyle_put_backgroundPositionY
,
2816 HTMLStyle_get_backgroundPositionY
,
2817 HTMLStyle_put_wordSpacing
,
2818 HTMLStyle_get_wordSpacing
,
2819 HTMLStyle_put_letterSpacing
,
2820 HTMLStyle_get_letterSpacing
,
2821 HTMLStyle_put_textDecoration
,
2822 HTMLStyle_get_textDecoration
,
2823 HTMLStyle_put_textDecorationNone
,
2824 HTMLStyle_get_textDecorationNone
,
2825 HTMLStyle_put_textDecorationUnderline
,
2826 HTMLStyle_get_textDecorationUnderline
,
2827 HTMLStyle_put_textDecorationOverline
,
2828 HTMLStyle_get_textDecorationOverline
,
2829 HTMLStyle_put_textDecorationLineThrough
,
2830 HTMLStyle_get_textDecorationLineThrough
,
2831 HTMLStyle_put_textDecorationBlink
,
2832 HTMLStyle_get_textDecorationBlink
,
2833 HTMLStyle_put_verticalAlign
,
2834 HTMLStyle_get_verticalAlign
,
2835 HTMLStyle_put_textTransform
,
2836 HTMLStyle_get_textTransform
,
2837 HTMLStyle_put_textAlign
,
2838 HTMLStyle_get_textAlign
,
2839 HTMLStyle_put_textIndent
,
2840 HTMLStyle_get_textIndent
,
2841 HTMLStyle_put_lineHeight
,
2842 HTMLStyle_get_lineHeight
,
2843 HTMLStyle_put_marginTop
,
2844 HTMLStyle_get_marginTop
,
2845 HTMLStyle_put_marginRight
,
2846 HTMLStyle_get_marginRight
,
2847 HTMLStyle_put_marginBottom
,
2848 HTMLStyle_get_marginBottom
,
2849 HTMLStyle_put_marginLeft
,
2850 HTMLStyle_get_marginLeft
,
2851 HTMLStyle_put_margin
,
2852 HTMLStyle_get_margin
,
2853 HTMLStyle_put_paddingTop
,
2854 HTMLStyle_get_paddingTop
,
2855 HTMLStyle_put_paddingRight
,
2856 HTMLStyle_get_paddingRight
,
2857 HTMLStyle_put_paddingBottom
,
2858 HTMLStyle_get_paddingBottom
,
2859 HTMLStyle_put_paddingLeft
,
2860 HTMLStyle_get_paddingLeft
,
2861 HTMLStyle_put_padding
,
2862 HTMLStyle_get_padding
,
2863 HTMLStyle_put_border
,
2864 HTMLStyle_get_border
,
2865 HTMLStyle_put_borderTop
,
2866 HTMLStyle_get_borderTop
,
2867 HTMLStyle_put_borderRight
,
2868 HTMLStyle_get_borderRight
,
2869 HTMLStyle_put_borderBottom
,
2870 HTMLStyle_get_borderBottom
,
2871 HTMLStyle_put_borderLeft
,
2872 HTMLStyle_get_borderLeft
,
2873 HTMLStyle_put_borderColor
,
2874 HTMLStyle_get_borderColor
,
2875 HTMLStyle_put_borderTopColor
,
2876 HTMLStyle_get_borderTopColor
,
2877 HTMLStyle_put_borderRightColor
,
2878 HTMLStyle_get_borderRightColor
,
2879 HTMLStyle_put_borderBottomColor
,
2880 HTMLStyle_get_borderBottomColor
,
2881 HTMLStyle_put_borderLeftColor
,
2882 HTMLStyle_get_borderLeftColor
,
2883 HTMLStyle_put_borderWidth
,
2884 HTMLStyle_get_borderWidth
,
2885 HTMLStyle_put_borderTopWidth
,
2886 HTMLStyle_get_borderTopWidth
,
2887 HTMLStyle_put_borderRightWidth
,
2888 HTMLStyle_get_borderRightWidth
,
2889 HTMLStyle_put_borderBottomWidth
,
2890 HTMLStyle_get_borderBottomWidth
,
2891 HTMLStyle_put_borderLeftWidth
,
2892 HTMLStyle_get_borderLeftWidth
,
2893 HTMLStyle_put_borderStyle
,
2894 HTMLStyle_get_borderStyle
,
2895 HTMLStyle_put_borderTopStyle
,
2896 HTMLStyle_get_borderTopStyle
,
2897 HTMLStyle_put_borderRightStyle
,
2898 HTMLStyle_get_borderRightStyle
,
2899 HTMLStyle_put_borderBottomStyle
,
2900 HTMLStyle_get_borderBottomStyle
,
2901 HTMLStyle_put_borderLeftStyle
,
2902 HTMLStyle_get_borderLeftStyle
,
2903 HTMLStyle_put_width
,
2904 HTMLStyle_get_width
,
2905 HTMLStyle_put_height
,
2906 HTMLStyle_get_height
,
2907 HTMLStyle_put_styleFloat
,
2908 HTMLStyle_get_styleFloat
,
2909 HTMLStyle_put_clear
,
2910 HTMLStyle_get_clear
,
2911 HTMLStyle_put_display
,
2912 HTMLStyle_get_display
,
2913 HTMLStyle_put_visibility
,
2914 HTMLStyle_get_visibility
,
2915 HTMLStyle_put_listStyleType
,
2916 HTMLStyle_get_listStyleType
,
2917 HTMLStyle_put_listStylePosition
,
2918 HTMLStyle_get_listStylePosition
,
2919 HTMLStyle_put_listStyleImage
,
2920 HTMLStyle_get_listStyleImage
,
2921 HTMLStyle_put_listStyle
,
2922 HTMLStyle_get_listStyle
,
2923 HTMLStyle_put_whiteSpace
,
2924 HTMLStyle_get_whiteSpace
,
2929 HTMLStyle_get_position
,
2930 HTMLStyle_put_zIndex
,
2931 HTMLStyle_get_zIndex
,
2932 HTMLStyle_put_overflow
,
2933 HTMLStyle_get_overflow
,
2934 HTMLStyle_put_pageBreakBefore
,
2935 HTMLStyle_get_pageBreakBefore
,
2936 HTMLStyle_put_pageBreakAfter
,
2937 HTMLStyle_get_pageBreakAfter
,
2938 HTMLStyle_put_cssText
,
2939 HTMLStyle_get_cssText
,
2940 HTMLStyle_put_pixelTop
,
2941 HTMLStyle_get_pixelTop
,
2942 HTMLStyle_put_pixelLeft
,
2943 HTMLStyle_get_pixelLeft
,
2944 HTMLStyle_put_pixelWidth
,
2945 HTMLStyle_get_pixelWidth
,
2946 HTMLStyle_put_pixelHeight
,
2947 HTMLStyle_get_pixelHeight
,
2948 HTMLStyle_put_posTop
,
2949 HTMLStyle_get_posTop
,
2950 HTMLStyle_put_posLeft
,
2951 HTMLStyle_get_posLeft
,
2952 HTMLStyle_put_posWidth
,
2953 HTMLStyle_get_posWidth
,
2954 HTMLStyle_put_posHeight
,
2955 HTMLStyle_get_posHeight
,
2956 HTMLStyle_put_cursor
,
2957 HTMLStyle_get_cursor
,
2960 HTMLStyle_put_filter
,
2961 HTMLStyle_get_filter
,
2962 HTMLStyle_setAttribute
,
2963 HTMLStyle_getAttribute
,
2964 HTMLStyle_removeAttribute
,
2968 static HRESULT
HTMLStyle_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
2970 int c
, i
, min
=0, max
= sizeof(style_tbl
)/sizeof(*style_tbl
)-1;
2975 c
= strcmpW(style_tbl
[i
].name
, name
);
2977 *dispid
= style_tbl
[i
].dispid
;
2987 return DISP_E_UNKNOWNNAME
;
2990 static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl
= {
2992 HTMLStyle_get_dispid
,
2996 static const tid_t HTMLStyle_iface_tids
[] = {
3003 static dispex_static_data_t HTMLStyle_dispex
= {
3004 &HTMLStyle_dispex_vtbl
,
3007 HTMLStyle_iface_tids
3010 HRESULT
HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*nsstyle
, HTMLStyle
**ret
)
3014 style
= heap_alloc_zero(sizeof(HTMLStyle
));
3016 return E_OUTOFMEMORY
;
3018 style
->IHTMLStyle_iface
.lpVtbl
= &HTMLStyleVtbl
;
3020 style
->nsstyle
= nsstyle
;
3021 HTMLStyle2_Init(style
);
3022 HTMLStyle3_Init(style
);
3024 nsIDOMCSSStyleDeclaration_AddRef(nsstyle
);
3026 init_dispex(&style
->dispex
, (IUnknown
*)&style
->IHTMLStyle_iface
, &HTMLStyle_dispex
);