comctl32/tests: Add NULL terminator to unicode string constant.
[wine/hramrach.git] / dlls / mshtml / htmlcurstyle.c
blob4f56e87e42811fac52143ebc80ed090b12e96261
1 /*
2 * Copyright 2008 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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
29 #include "htmlstyle.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLCurrentStyle {
36 DispatchEx dispex;
37 const IHTMLCurrentStyleVtbl *lpIHTMLCurrentStyleVtbl;
39 LONG ref;
41 nsIDOMCSSStyleDeclaration *nsstyle;
44 #define HTMLCURSTYLE(x) ((IHTMLCurrentStyle*) &(x)->lpIHTMLCurrentStyleVtbl)
46 #define HTMLCURSTYLE_THIS(iface) DEFINE_THIS(HTMLCurrentStyle, IHTMLCurrentStyle, iface)
48 static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
50 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
52 *ppv = NULL;
54 if(IsEqualGUID(&IID_IUnknown, riid)) {
55 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56 *ppv = HTMLCURSTYLE(This);
57 }else if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid)) {
58 TRACE("(%p)->(IID_IHTMLCurrentStyle %p)\n", This, ppv);
59 *ppv = HTMLCURSTYLE(This);
60 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
61 return *ppv ? S_OK : E_NOINTERFACE;
64 if(*ppv) {
65 IUnknown_AddRef((IUnknown*)*ppv);
66 return S_OK;
69 WARN("unsupported %s\n", debugstr_guid(riid));
70 return E_NOINTERFACE;
73 static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface)
75 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
76 LONG ref = InterlockedIncrement(&This->ref);
78 TRACE("(%p) ref=%d\n", This, ref);
80 return ref;
83 static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
85 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
86 LONG ref = InterlockedDecrement(&This->ref);
88 TRACE("(%p) ref=%d\n", This, ref);
90 if(!ref) {
91 if(This->nsstyle)
92 nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
93 release_dispex(&This->dispex);
94 heap_free(This);
97 return ref;
100 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo)
102 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
103 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
106 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo,
107 LCID lcid, ITypeInfo **ppTInfo)
109 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
110 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
113 static HRESULT WINAPI HTMLCurrentStyle_GetIDsOfNames(IHTMLCurrentStyle *iface, REFIID riid,
114 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
116 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
117 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
120 static HRESULT WINAPI HTMLCurrentStyle_Invoke(IHTMLCurrentStyle *iface, DISPID dispIdMember,
121 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
122 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
124 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
125 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
126 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
129 static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p)
131 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
133 TRACE("(%p)->(%p)\n", This, p);
135 return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p);
138 static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p)
140 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
141 FIXME("(%p)->(%p)\n", This, p);
142 return E_NOTIMPL;
145 static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p)
147 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
148 TRACE("(%p)->(%p)\n", This, p);
149 return get_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, p, 0);
152 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p)
154 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
155 TRACE("(%p)->(%p)\n", This, p);
156 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
159 static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p)
161 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
163 TRACE("(%p)->(%p)\n", This, p);
165 return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_FAMILY, p);
168 static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p)
170 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
171 TRACE("(%p)->(%p)\n", This, p);
172 return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, p);
175 static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p)
177 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
178 TRACE("(%p)->(%p)\n", This, p);
179 return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, p);
182 static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p)
184 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
185 TRACE("(%p)->(%p)\n", This, p);
186 return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_WEIGHT, p, ATTR_STR_TO_INT);
189 static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p)
191 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
192 TRACE("(%p)->(%p)\n", This, p);
193 return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
196 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p)
198 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
199 TRACE("(%p)->(%p)\n", This, p);
200 return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_IMAGE, p);
203 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p)
205 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
206 FIXME("(%p)->(%p)\n", This, p);
207 return E_NOTIMPL;
210 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p)
212 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
213 FIXME("(%p)->(%p)\n", This, p);
214 return E_NOTIMPL;
217 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p)
219 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
220 TRACE("(%p)->(%p)\n", This, p);
221 return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_REPEAT, p);
224 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
226 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
227 TRACE("(%p)->(%p)\n", This, p);
228 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_COLOR, p, 0);
231 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
233 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
234 TRACE("(%p)->(%p)\n", This, p);
235 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, p, 0);
238 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
240 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
241 TRACE("(%p)->(%p)\n", This, p);
242 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_COLOR, p, 0);
245 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
247 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
248 TRACE("(%p)->(%p)\n", This, p);
249 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_COLOR, p, 0);
252 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
254 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
255 TRACE("(%p)->(%p)\n", This, p);
256 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_TOP_STYLE, p);
259 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p)
261 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
262 TRACE("(%p)->(%p)\n", This, p);
263 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_RIGHT_STYLE, p);
266 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p)
268 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
269 TRACE("(%p)->(%p)\n", This, p);
270 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_BOTTOM_STYLE, p);
273 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p)
275 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
276 TRACE("(%p)->(%p)\n", This, p);
277 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_LEFT_STYLE, p);
280 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p)
282 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
283 TRACE("(%p)->(%p)\n", This, p);
284 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
287 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p)
289 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
290 TRACE("(%p)->(%p)\n", This, p);
291 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
294 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p)
296 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
297 TRACE("(%p)->(%p)\n", This, p);
298 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
301 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p)
303 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
304 TRACE("(%p)->(%p)\n", This, p);
305 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
308 static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p)
310 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
311 TRACE("(%p)->(%p)\n", This, p);
312 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
315 static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p)
317 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
318 TRACE("(%p)->(%p)\n", This, p);
319 return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
322 static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p)
324 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
325 TRACE("(%p)->(%p)\n", This, p);
326 return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
329 static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p)
331 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
332 TRACE("(%p)->(%p)\n", This, p);
333 return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
336 static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p)
338 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
339 TRACE("(%p)->(%p)\n", This, p);
340 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
343 static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
345 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
346 TRACE("(%p)->(%p)\n", This, p);
347 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_TOP, p, 0);
350 static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
352 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
353 TRACE("(%p)->(%p)\n", This, p);
354 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_RIGHT, p, 0);
357 static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
359 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
360 TRACE("(%p)->(%p)\n", This, p);
361 return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_BOTTOM, p, 0);
364 static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
366 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
367 TRACE("(%p)->(%p)\n", This, p);
368 return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_ALIGN, p);
371 static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p)
373 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
374 TRACE("(%p)->(%p)\n", This, p);
375 return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_DECORATION, p);
378 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
380 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
382 TRACE("(%p)->(%p)\n", This, p);
384 return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
387 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
389 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
391 TRACE("(%p)->(%p)\n", This, p);
393 return get_nsstyle_attr(This->nsstyle, STYLEID_VISIBILITY, p);
396 static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p)
398 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
399 TRACE("(%p)->(%p)\n", This, p);
400 return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
403 static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
405 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
406 TRACE("(%p)->(%p)\n", This, p);
407 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LETTER_SPACING, p, 0);
410 static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
412 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
413 TRACE("(%p)->(%p)\n", This, p);
414 return get_nsstyle_attr_var(This->nsstyle, STYLEID_LINE_HEIGHT, p, 0);
417 static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
419 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
420 TRACE("(%p)->(%p)\n", This, p);
421 return get_nsstyle_attr_var(This->nsstyle, STYLEID_TEXT_INDENT, p, 0);
424 static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
426 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
427 TRACE("(%p)->(%p)\n", This, p);
428 return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
431 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p)
433 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
434 FIXME("(%p)->(%p)\n", This, p);
435 return E_NOTIMPL;
438 static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
440 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
441 TRACE("(%p)->(%p)\n", This, p);
442 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_TOP, p, 0);
445 static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
447 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
448 TRACE("(%p)->(%p)\n", This, p);
449 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
452 static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
454 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
455 TRACE("(%p)->(%p)\n", This, p);
456 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_BOTTOM, p, 0);
459 static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
461 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
462 TRACE("(%p)->(%p)\n", This, p);
463 return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
466 static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p)
468 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
469 FIXME("(%p)->(%p)\n", This, p);
470 return E_NOTIMPL;
473 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p)
475 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
476 FIXME("(%p)->(%p)\n", This, p);
477 return E_NOTIMPL;
480 static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p)
482 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
483 FIXME("(%p)->(%p)\n", This, p);
484 return E_NOTIMPL;
487 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p)
489 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
490 FIXME("(%p)->(%p)\n", This, p);
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p)
496 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
501 static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p)
503 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
504 FIXME("(%p)->(%p)\n", This, p);
505 return E_NOTIMPL;
508 static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p)
510 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
511 FIXME("(%p)->(%p)\n", This, p);
512 return E_NOTIMPL;
515 static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p)
517 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
518 FIXME("(%p)->(%p)\n", This, p);
519 return E_NOTIMPL;
522 static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p)
524 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
525 TRACE("(%p)->(%p)\n", This, p);
526 return get_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, p);
529 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p)
531 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
532 FIXME("(%p)->(%p)\n", This, p);
533 return E_NOTIMPL;
536 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p)
538 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
539 FIXME("(%p)->(%p)\n", This, p);
540 return E_NOTIMPL;
543 static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p)
545 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
546 TRACE("(%p)->(%p)\n", This, p);
547 return get_nsstyle_attr(This->nsstyle, STYLEID_CURSOR, p);
550 static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p)
552 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
553 FIXME("(%p)->(%p)\n", This, p);
554 return E_NOTIMPL;
557 static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p)
559 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
560 FIXME("(%p)->(%p)\n", This, p);
561 return E_NOTIMPL;
564 static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p)
566 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
567 FIXME("(%p)->(%p)\n", This, p);
568 return E_NOTIMPL;
571 static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p)
573 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
574 FIXME("(%p)->(%p)\n", This, p);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName,
579 LONG lFlags, VARIANT *AttributeValue)
581 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
582 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
583 return E_NOTIMPL;
586 static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p)
588 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
589 FIXME("(%p)->(%p)\n", This, p);
590 return E_NOTIMPL;
593 static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
595 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
596 TRACE("(%p)->(%p)\n", This, p);
597 return get_nsstyle_attr_var(This->nsstyle, STYLEID_RIGHT, p, 0);
600 static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
602 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
603 TRACE("(%p)->(%p)\n", This, p);
604 return get_nsstyle_attr_var(This->nsstyle, STYLEID_BOTTOM, p, 0);
607 static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
609 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
610 FIXME("(%p)->(%p)\n", This, p);
611 return E_NOTIMPL;
614 static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p)
616 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
617 FIXME("(%p)->(%p)\n", This, p);
618 return E_NOTIMPL;
621 static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p)
623 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
624 FIXME("(%p)->(%p)\n", This, p);
625 return E_NOTIMPL;
628 static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p)
630 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
631 FIXME("(%p)->(%p)\n", This, p);
632 return E_NOTIMPL;
635 static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p)
637 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
638 FIXME("(%p)->(%p)\n", This, p);
639 return E_NOTIMPL;
642 static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p)
644 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
645 FIXME("(%p)->(%p)\n", This, p);
646 return E_NOTIMPL;
649 static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p)
651 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
652 FIXME("(%p)->(%p)\n", This, p);
653 return E_NOTIMPL;
656 static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p)
658 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
659 FIXME("(%p)->(%p)\n", This, p);
660 return E_NOTIMPL;
663 static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p)
665 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
666 FIXME("(%p)->(%p)\n", This, p);
667 return E_NOTIMPL;
670 static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p)
672 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
673 FIXME("(%p)->(%p)\n", This, p);
674 return E_NOTIMPL;
677 static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p)
679 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
680 FIXME("(%p)->(%p)\n", This, p);
681 return E_NOTIMPL;
684 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p)
686 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
687 FIXME("(%p)->(%p)\n", This, p);
688 return E_NOTIMPL;
691 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p)
693 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
694 FIXME("(%p)->(%p)\n", This, p);
695 return E_NOTIMPL;
698 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p)
700 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
701 FIXME("(%p)->(%p)\n", This, p);
702 return E_NOTIMPL;
705 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p)
707 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
708 FIXME("(%p)->(%p)\n", This, p);
709 return E_NOTIMPL;
712 static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p)
714 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
715 TRACE("(%p)->(%p)\n", This, p);
716 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, p);
719 static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p)
721 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
722 TRACE("(%p)->(%p)\n", This, p);
723 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_COLOR, p);
726 static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p)
728 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
729 TRACE("(%p)->(%p)\n", This, p);
730 return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_WIDTH, p);
733 static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p)
735 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
736 FIXME("(%p)->(%p)\n", This, p);
737 return E_NOTIMPL;
740 static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p)
742 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
743 TRACE("(%p)->(%p)\n", This, p);
744 return get_nsstyle_attr(This->nsstyle, STYLEID_MARGIN, p);
747 static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p)
749 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
750 FIXME("(%p)->(%p)\n", This, p);
751 return E_NOTIMPL;
754 static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p)
756 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
757 FIXME("(%p)->(%p)\n", This, p);
758 return E_NOTIMPL;
761 static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p)
763 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
764 FIXME("(%p)->(%p)\n", This, p);
765 return E_NOTIMPL;
768 static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p)
770 HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
771 FIXME("(%p)->(%p)\n", This, p);
772 return E_NOTIMPL;
775 #undef HTMLCURSTYLE_THIS
777 static const IHTMLCurrentStyleVtbl HTMLCurrentStyleVtbl = {
778 HTMLCurrentStyle_QueryInterface,
779 HTMLCurrentStyle_AddRef,
780 HTMLCurrentStyle_Release,
781 HTMLCurrentStyle_GetTypeInfoCount,
782 HTMLCurrentStyle_GetTypeInfo,
783 HTMLCurrentStyle_GetIDsOfNames,
784 HTMLCurrentStyle_Invoke,
785 HTMLCurrentStyle_get_position,
786 HTMLCurrentStyle_get_styleFloat,
787 HTMLCurrentStyle_get_color,
788 HTMLCurrentStyle_get_backgroundColor,
789 HTMLCurrentStyle_get_fontFamily,
790 HTMLCurrentStyle_get_fontStyle,
791 HTMLCurrentStyle_get_fontVariant,
792 HTMLCurrentStyle_get_fontWeight,
793 HTMLCurrentStyle_get_fontSize,
794 HTMLCurrentStyle_get_backgroundImage,
795 HTMLCurrentStyle_get_backgroundPositionX,
796 HTMLCurrentStyle_get_backgroundPositionY,
797 HTMLCurrentStyle_get_backgroundRepeat,
798 HTMLCurrentStyle_get_borderLeftColor,
799 HTMLCurrentStyle_get_borderTopColor,
800 HTMLCurrentStyle_get_borderRightColor,
801 HTMLCurrentStyle_get_borderBottomColor,
802 HTMLCurrentStyle_get_borderTopStyle,
803 HTMLCurrentStyle_get_borderRightStyle,
804 HTMLCurrentStyle_get_borderBottomStyle,
805 HTMLCurrentStyle_get_borderLeftStyle,
806 HTMLCurrentStyle_get_borderTopWidth,
807 HTMLCurrentStyle_get_borderRightWidth,
808 HTMLCurrentStyle_get_borderBottomWidth,
809 HTMLCurrentStyle_get_borderLeftWidth,
810 HTMLCurrentStyle_get_left,
811 HTMLCurrentStyle_get_top,
812 HTMLCurrentStyle_get_width,
813 HTMLCurrentStyle_get_height,
814 HTMLCurrentStyle_get_paddingLeft,
815 HTMLCurrentStyle_get_paddingTop,
816 HTMLCurrentStyle_get_paddingRight,
817 HTMLCurrentStyle_get_paddingBottom,
818 HTMLCurrentStyle_get_textAlign,
819 HTMLCurrentStyle_get_textDecoration,
820 HTMLCurrentStyle_get_display,
821 HTMLCurrentStyle_get_visibility,
822 HTMLCurrentStyle_get_zIndex,
823 HTMLCurrentStyle_get_letterSpacing,
824 HTMLCurrentStyle_get_lineHeight,
825 HTMLCurrentStyle_get_textIndent,
826 HTMLCurrentStyle_get_verticalAlign,
827 HTMLCurrentStyle_get_backgroundAttachment,
828 HTMLCurrentStyle_get_marginTop,
829 HTMLCurrentStyle_get_marginRight,
830 HTMLCurrentStyle_get_marginBottom,
831 HTMLCurrentStyle_get_marginLeft,
832 HTMLCurrentStyle_get_clear,
833 HTMLCurrentStyle_get_listStyleType,
834 HTMLCurrentStyle_get_listStylePosition,
835 HTMLCurrentStyle_get_listStyleImage,
836 HTMLCurrentStyle_get_clipTop,
837 HTMLCurrentStyle_get_clipRight,
838 HTMLCurrentStyle_get_clipBottom,
839 HTMLCurrentStyle_get_clipLeft,
840 HTMLCurrentStyle_get_overflow,
841 HTMLCurrentStyle_get_pageBreakBefore,
842 HTMLCurrentStyle_get_pageBreakAfter,
843 HTMLCurrentStyle_get_cursor,
844 HTMLCurrentStyle_get_tableLayout,
845 HTMLCurrentStyle_get_borderCollapse,
846 HTMLCurrentStyle_get_direction,
847 HTMLCurrentStyle_get_behavior,
848 HTMLCurrentStyle_getAttribute,
849 HTMLCurrentStyle_get_unicodeBidi,
850 HTMLCurrentStyle_get_right,
851 HTMLCurrentStyle_get_bottom,
852 HTMLCurrentStyle_get_imeMode,
853 HTMLCurrentStyle_get_rubyAlign,
854 HTMLCurrentStyle_get_rubyPosition,
855 HTMLCurrentStyle_get_rubyOverhang,
856 HTMLCurrentStyle_get_textAutospace,
857 HTMLCurrentStyle_get_lineBreak,
858 HTMLCurrentStyle_get_wordBreak,
859 HTMLCurrentStyle_get_textJustify,
860 HTMLCurrentStyle_get_textJustifyTrim,
861 HTMLCurrentStyle_get_textKashida,
862 HTMLCurrentStyle_get_blockDirection,
863 HTMLCurrentStyle_get_layoutGridChar,
864 HTMLCurrentStyle_get_layoutGridLine,
865 HTMLCurrentStyle_get_layoutGridMode,
866 HTMLCurrentStyle_get_layoutGridType,
867 HTMLCurrentStyle_get_borderStyle,
868 HTMLCurrentStyle_get_borderColor,
869 HTMLCurrentStyle_get_borderWidth,
870 HTMLCurrentStyle_get_padding,
871 HTMLCurrentStyle_get_margin,
872 HTMLCurrentStyle_get_accelerator,
873 HTMLCurrentStyle_get_overflowX,
874 HTMLCurrentStyle_get_overflowY,
875 HTMLCurrentStyle_get_textTransform
878 static const tid_t HTMLCurrentStyle_iface_tids[] = {
879 IHTMLCurrentStyle_tid,
880 IHTMLCurrentStyle2_tid,
881 IHTMLCurrentStyle3_tid,
882 IHTMLCurrentStyle4_tid,
885 static dispex_static_data_t HTMLCurrentStyle_dispex = {
886 NULL,
887 DispHTMLCurrentStyle_tid,
888 NULL,
889 HTMLCurrentStyle_iface_tids
892 HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
894 nsIDOMCSSStyleDeclaration *nsstyle;
895 nsIDOMDocumentView *nsdocview;
896 nsIDOMAbstractView *nsview;
897 nsIDOMViewCSS *nsviewcss;
898 nsAString nsempty_str;
899 HTMLCurrentStyle *ret;
900 nsresult nsres;
902 if(!elem->node.doc->nsdoc) {
903 WARN("NULL nsdoc\n");
904 return E_UNEXPECTED;
907 nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
908 if(NS_FAILED(nsres)) {
909 ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
910 return E_FAIL;
913 nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
914 nsIDOMDocumentView_Release(nsdocview);
915 if(NS_FAILED(nsres)) {
916 ERR("GetDefaultView failed: %08x\n", nsres);
917 return E_FAIL;
920 nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMViewCSS, (void**)&nsviewcss);
921 nsIDOMAbstractView_Release(nsview);
922 if(NS_FAILED(nsres)) {
923 ERR("Could not get nsIDOMViewCSS: %08x\n", nsres);
924 return E_FAIL;
927 nsAString_Init(&nsempty_str, NULL);
928 nsres = nsIDOMViewCSS_GetComputedStyle(nsviewcss, (nsIDOMElement*)elem->nselem, &nsempty_str, &nsstyle);
929 nsIDOMViewCSS_Release(nsviewcss);
930 nsAString_Finish(&nsempty_str);
931 if(NS_FAILED(nsres)) {
932 ERR("GetComputedStyle failed: %08x\n", nsres);
933 return E_FAIL;
936 ret = heap_alloc_zero(sizeof(HTMLCurrentStyle));
937 if(!ret) {
938 nsIDOMCSSStyleDeclaration_Release(nsstyle);
939 return E_OUTOFMEMORY;
942 ret->lpIHTMLCurrentStyleVtbl = &HTMLCurrentStyleVtbl;
943 ret->ref = 1;
944 ret->nsstyle = nsstyle;
946 init_dispex(&ret->dispex, (IUnknown*)HTMLCURSTYLE(ret), &HTMLCurrentStyle_dispex);
948 *p = HTMLCURSTYLE(ret);
949 return S_OK;