mshtml: Wrap nsIURL interface.
[wine] / dlls / mshtml / htmlcurstyle.c
1 /*
2  * Copyright 2008 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "mshtml_private.h"
29 #include "htmlstyle.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 struct HTMLCurrentStyle {
36     DispatchEx dispex;
37     const IHTMLCurrentStyleVtbl *lpIHTMLCurrentStyleVtbl;
38
39     LONG ref;
40
41     nsIDOMCSSStyleDeclaration *nsstyle;
42 };
43
44 #define HTMLCURSTYLE(x)  ((IHTMLCurrentStyle*)  &(x)->lpIHTMLCurrentStyleVtbl)
45
46 #define HTMLCURSTYLE_THIS(iface) DEFINE_THIS(HTMLCurrentStyle, IHTMLCurrentStyle, iface)
47
48 static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
49 {
50     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
51
52     *ppv = NULL;
53
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;
62     }
63
64     if(*ppv) {
65         IUnknown_AddRef((IUnknown*)*ppv);
66         return S_OK;
67     }
68
69     WARN("unsupported %s\n", debugstr_guid(riid));
70     return E_NOINTERFACE;
71 }
72
73 static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface)
74 {
75     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
76     LONG ref = InterlockedIncrement(&This->ref);
77
78     TRACE("(%p) ref=%d\n", This, ref);
79
80     return ref;
81 }
82
83 static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
84 {
85     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
86     LONG ref = InterlockedDecrement(&This->ref);
87
88     TRACE("(%p) ref=%d\n", This, ref);
89
90     if(!ref) {
91         if(This->nsstyle)
92             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
93         heap_free(This);
94     }
95
96     return ref;
97 }
98
99 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo)
100 {
101     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
102     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
103 }
104
105 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo,
106         LCID lcid, ITypeInfo **ppTInfo)
107 {
108     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
109     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
110 }
111
112 static HRESULT WINAPI HTMLCurrentStyle_GetIDsOfNames(IHTMLCurrentStyle *iface, REFIID riid,
113         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
114 {
115     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
116     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
117 }
118
119 static HRESULT WINAPI HTMLCurrentStyle_Invoke(IHTMLCurrentStyle *iface, DISPID dispIdMember,
120         REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
121         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 {
123     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
124     return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
125             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
126 }
127
128 static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p)
129 {
130     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
131
132     TRACE("(%p)->(%p)\n", This, p);
133
134     return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p);
135 }
136
137 static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p)
138 {
139     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
140     FIXME("(%p)->(%p)\n", This, p);
141     return E_NOTIMPL;
142 }
143
144 static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p)
145 {
146     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
147     TRACE("(%p)->(%p)\n", This, p);
148     return get_nsstyle_attr_var(This->nsstyle, STYLEID_COLOR, p, 0);
149 }
150
151 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p)
152 {
153     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
154     TRACE("(%p)->(%p)\n", This, p);
155     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
156 }
157
158 static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p)
159 {
160     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
161
162     TRACE("(%p)->(%p)\n", This, p);
163
164     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_FAMILY, p);
165 }
166
167 static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p)
168 {
169     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
170     TRACE("(%p)->(%p)\n", This, p);
171     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, p);
172 }
173
174 static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p)
175 {
176     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
177     TRACE("(%p)->(%p)\n", This, p);
178     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, p);
179 }
180
181 static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p)
182 {
183     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
184     TRACE("(%p)->(%p)\n", This, p);
185     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_WEIGHT, p, ATTR_STR_TO_INT);
186 }
187
188 static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p)
189 {
190     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
191     TRACE("(%p)->(%p)\n", This, p);
192     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
193 }
194
195 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p)
196 {
197     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
198     TRACE("(%p)->(%p)\n", This, p);
199     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_IMAGE, p);
200 }
201
202 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p)
203 {
204     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
205     FIXME("(%p)->(%p)\n", This, p);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p)
210 {
211     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
212     FIXME("(%p)->(%p)\n", This, p);
213     return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p)
217 {
218     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
219     TRACE("(%p)->(%p)\n", This, p);
220     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_REPEAT, p);
221 }
222
223 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
224 {
225     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
226     FIXME("(%p)->(%p)\n", This, p);
227     return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
231 {
232     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
233     FIXME("(%p)->(%p)\n", This, p);
234     return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
238 {
239     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
240     FIXME("(%p)->(%p)\n", This, p);
241     return E_NOTIMPL;
242 }
243
244 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
245 {
246     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
247     FIXME("(%p)->(%p)\n", This, p);
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
252 {
253     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
254     TRACE("(%p)->(%p)\n", This, p);
255     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_TOP_STYLE, p);
256 }
257
258 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p)
259 {
260     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
261     TRACE("(%p)->(%p)\n", This, p);
262     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_RIGHT_STYLE, p);
263 }
264
265 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p)
266 {
267     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
268     TRACE("(%p)->(%p)\n", This, p);
269     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_BOTTOM_STYLE, p);
270 }
271
272 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p)
273 {
274     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
275     TRACE("(%p)->(%p)\n", This, p);
276     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_LEFT_STYLE, p);
277 }
278
279 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p)
280 {
281     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
282     TRACE("(%p)->(%p)\n", This, p);
283     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_WIDTH, p, 0);
284 }
285
286 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p)
287 {
288     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
289     TRACE("(%p)->(%p)\n", This, p);
290     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_RIGHT_WIDTH, p, 0);
291 }
292
293 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p)
294 {
295     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
296     TRACE("(%p)->(%p)\n", This, p);
297     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_BOTTOM_WIDTH, p, 0);
298 }
299
300 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p)
301 {
302     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
303     TRACE("(%p)->(%p)\n", This, p);
304     return get_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_LEFT_WIDTH, p, 0);
305 }
306
307 static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p)
308 {
309     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
310     TRACE("(%p)->(%p)\n", This, p);
311     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
312 }
313
314 static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p)
315 {
316     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
317     TRACE("(%p)->(%p)\n", This, p);
318     return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
319 }
320
321 static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p)
322 {
323     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
324     TRACE("(%p)->(%p)\n", This, p);
325     return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
326 }
327
328 static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p)
329 {
330     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
331     TRACE("(%p)->(%p)\n", This, p);
332     return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
333 }
334
335 static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p)
336 {
337     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
338     TRACE("(%p)->(%p)\n", This, p);
339     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
340 }
341
342 static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
343 {
344     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
345     FIXME("(%p)->(%p)\n", This, p);
346     return E_NOTIMPL;
347 }
348
349 static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
350 {
351     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
352     FIXME("(%p)->(%p)\n", This, p);
353     return E_NOTIMPL;
354 }
355
356 static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
357 {
358     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
359     FIXME("(%p)->(%p)\n", This, p);
360     return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
364 {
365     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
366     TRACE("(%p)->(%p)\n", This, p);
367     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_ALIGN, p);
368 }
369
370 static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p)
371 {
372     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
373     TRACE("(%p)->(%p)\n", This, p);
374     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_DECORATION, p);
375 }
376
377 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
378 {
379     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
380
381     TRACE("(%p)->(%p)\n", This, p);
382
383     return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
384 }
385
386 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
387 {
388     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
389
390     TRACE("(%p)->(%p)\n", This, p);
391
392     return get_nsstyle_attr(This->nsstyle, STYLEID_VISIBILITY, p);
393 }
394
395 static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p)
396 {
397     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
398     TRACE("(%p)->(%p)\n", This, p);
399     return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
400 }
401
402 static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
403 {
404     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
405     FIXME("(%p)->(%p)\n", This, p);
406     return E_NOTIMPL;
407 }
408
409 static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
410 {
411     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
412     FIXME("(%p)->(%p)\n", This, p);
413     return E_NOTIMPL;
414 }
415
416 static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
417 {
418     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
419     FIXME("(%p)->(%p)\n", This, p);
420     return E_NOTIMPL;
421 }
422
423 static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
424 {
425     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
426     TRACE("(%p)->(%p)\n", This, p);
427     return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
428 }
429
430 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p)
431 {
432     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
433     FIXME("(%p)->(%p)\n", This, p);
434     return E_NOTIMPL;
435 }
436
437 static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
438 {
439     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
440     FIXME("(%p)->(%p)\n", This, p);
441     return E_NOTIMPL;
442 }
443
444 static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
445 {
446     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
447     TRACE("(%p)->(%p)\n", This, p);
448     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
449 }
450
451 static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
452 {
453     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
454     FIXME("(%p)->(%p)\n", This, p);
455     return E_NOTIMPL;
456 }
457
458 static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
459 {
460     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
461     TRACE("(%p)->(%p)\n", This, p);
462     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
463 }
464
465 static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p)
466 {
467     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
468     FIXME("(%p)->(%p)\n", This, p);
469     return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p)
473 {
474     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
475     FIXME("(%p)->(%p)\n", This, p);
476     return E_NOTIMPL;
477 }
478
479 static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p)
480 {
481     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
482     FIXME("(%p)->(%p)\n", This, p);
483     return E_NOTIMPL;
484 }
485
486 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p)
487 {
488     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
489     FIXME("(%p)->(%p)\n", This, p);
490     return E_NOTIMPL;
491 }
492
493 static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p)
494 {
495     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
496     FIXME("(%p)->(%p)\n", This, p);
497     return E_NOTIMPL;
498 }
499
500 static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p)
501 {
502     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
503     FIXME("(%p)->(%p)\n", This, p);
504     return E_NOTIMPL;
505 }
506
507 static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p)
508 {
509     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
510     FIXME("(%p)->(%p)\n", This, p);
511     return E_NOTIMPL;
512 }
513
514 static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p)
515 {
516     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
517     FIXME("(%p)->(%p)\n", This, p);
518     return E_NOTIMPL;
519 }
520
521 static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p)
522 {
523     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
524     TRACE("(%p)->(%p)\n", This, p);
525     return get_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, p);
526 }
527
528 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p)
529 {
530     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
531     FIXME("(%p)->(%p)\n", This, p);
532     return E_NOTIMPL;
533 }
534
535 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p)
536 {
537     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
538     FIXME("(%p)->(%p)\n", This, p);
539     return E_NOTIMPL;
540 }
541
542 static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p)
543 {
544     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
545     TRACE("(%p)->(%p)\n", This, p);
546     return get_nsstyle_attr(This->nsstyle, STYLEID_CURSOR, p);
547 }
548
549 static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p)
550 {
551     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
552     FIXME("(%p)->(%p)\n", This, p);
553     return E_NOTIMPL;
554 }
555
556 static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p)
557 {
558     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
559     FIXME("(%p)->(%p)\n", This, p);
560     return E_NOTIMPL;
561 }
562
563 static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p)
564 {
565     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
566     FIXME("(%p)->(%p)\n", This, p);
567     return E_NOTIMPL;
568 }
569
570 static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p)
571 {
572     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
573     FIXME("(%p)->(%p)\n", This, p);
574     return E_NOTIMPL;
575 }
576
577 static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName,
578         LONG lFlags, VARIANT *AttributeValue)
579 {
580     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
581     FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
582     return E_NOTIMPL;
583 }
584
585 static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p)
586 {
587     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
588     FIXME("(%p)->(%p)\n", This, p);
589     return E_NOTIMPL;
590 }
591
592 static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
593 {
594     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
595     FIXME("(%p)->(%p)\n", This, p);
596     return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
600 {
601     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
602     FIXME("(%p)->(%p)\n", This, p);
603     return E_NOTIMPL;
604 }
605
606 static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
607 {
608     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
609     FIXME("(%p)->(%p)\n", This, p);
610     return E_NOTIMPL;
611 }
612
613 static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p)
614 {
615     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
616     FIXME("(%p)->(%p)\n", This, p);
617     return E_NOTIMPL;
618 }
619
620 static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p)
621 {
622     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
623     FIXME("(%p)->(%p)\n", This, p);
624     return E_NOTIMPL;
625 }
626
627 static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p)
628 {
629     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
630     FIXME("(%p)->(%p)\n", This, p);
631     return E_NOTIMPL;
632 }
633
634 static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p)
635 {
636     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
637     FIXME("(%p)->(%p)\n", This, p);
638     return E_NOTIMPL;
639 }
640
641 static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p)
642 {
643     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
644     FIXME("(%p)->(%p)\n", This, p);
645     return E_NOTIMPL;
646 }
647
648 static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p)
649 {
650     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
651     FIXME("(%p)->(%p)\n", This, p);
652     return E_NOTIMPL;
653 }
654
655 static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p)
656 {
657     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
658     FIXME("(%p)->(%p)\n", This, p);
659     return E_NOTIMPL;
660 }
661
662 static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p)
663 {
664     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
665     FIXME("(%p)->(%p)\n", This, p);
666     return E_NOTIMPL;
667 }
668
669 static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p)
670 {
671     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
672     FIXME("(%p)->(%p)\n", This, p);
673     return E_NOTIMPL;
674 }
675
676 static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p)
677 {
678     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
679     FIXME("(%p)->(%p)\n", This, p);
680     return E_NOTIMPL;
681 }
682
683 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p)
684 {
685     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
686     FIXME("(%p)->(%p)\n", This, p);
687     return E_NOTIMPL;
688 }
689
690 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p)
691 {
692     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
693     FIXME("(%p)->(%p)\n", This, p);
694     return E_NOTIMPL;
695 }
696
697 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p)
698 {
699     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
700     FIXME("(%p)->(%p)\n", This, p);
701     return E_NOTIMPL;
702 }
703
704 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p)
705 {
706     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
707     FIXME("(%p)->(%p)\n", This, p);
708     return E_NOTIMPL;
709 }
710
711 static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p)
712 {
713     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
714     TRACE("(%p)->(%p)\n", This, p);
715     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, p);
716 }
717
718 static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p)
719 {
720     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
721     TRACE("(%p)->(%p)\n", This, p);
722     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_COLOR, p);
723 }
724
725 static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p)
726 {
727     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
728     TRACE("(%p)->(%p)\n", This, p);
729     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_WIDTH, p);
730 }
731
732 static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p)
733 {
734     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
735     FIXME("(%p)->(%p)\n", This, p);
736     return E_NOTIMPL;
737 }
738
739 static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p)
740 {
741     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
742     TRACE("(%p)->(%p)\n", This, p);
743     return get_nsstyle_attr(This->nsstyle, STYLEID_MARGIN, p);
744 }
745
746 static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p)
747 {
748     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
749     FIXME("(%p)->(%p)\n", This, p);
750     return E_NOTIMPL;
751 }
752
753 static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p)
754 {
755     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
756     FIXME("(%p)->(%p)\n", This, p);
757     return E_NOTIMPL;
758 }
759
760 static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p)
761 {
762     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
763     FIXME("(%p)->(%p)\n", This, p);
764     return E_NOTIMPL;
765 }
766
767 static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p)
768 {
769     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
770     FIXME("(%p)->(%p)\n", This, p);
771     return E_NOTIMPL;
772 }
773
774 #undef HTMLCURSTYLE_THIS
775
776 static const IHTMLCurrentStyleVtbl HTMLCurrentStyleVtbl = {
777     HTMLCurrentStyle_QueryInterface,
778     HTMLCurrentStyle_AddRef,
779     HTMLCurrentStyle_Release,
780     HTMLCurrentStyle_GetTypeInfoCount,
781     HTMLCurrentStyle_GetTypeInfo,
782     HTMLCurrentStyle_GetIDsOfNames,
783     HTMLCurrentStyle_Invoke,
784     HTMLCurrentStyle_get_position,
785     HTMLCurrentStyle_get_styleFloat,
786     HTMLCurrentStyle_get_color,
787     HTMLCurrentStyle_get_backgroundColor,
788     HTMLCurrentStyle_get_fontFamily,
789     HTMLCurrentStyle_get_fontStyle,
790     HTMLCurrentStyle_get_fontVariant,
791     HTMLCurrentStyle_get_fontWeight,
792     HTMLCurrentStyle_get_fontSize,
793     HTMLCurrentStyle_get_backgroundImage,
794     HTMLCurrentStyle_get_backgroundPositionX,
795     HTMLCurrentStyle_get_backgroundPositionY,
796     HTMLCurrentStyle_get_backgroundRepeat,
797     HTMLCurrentStyle_get_borderLeftColor,
798     HTMLCurrentStyle_get_borderTopColor,
799     HTMLCurrentStyle_get_borderRightColor,
800     HTMLCurrentStyle_get_borderBottomColor,
801     HTMLCurrentStyle_get_borderTopStyle,
802     HTMLCurrentStyle_get_borderRightStyle,
803     HTMLCurrentStyle_get_borderBottomStyle,
804     HTMLCurrentStyle_get_borderLeftStyle,
805     HTMLCurrentStyle_get_borderTopWidth,
806     HTMLCurrentStyle_get_borderRightWidth,
807     HTMLCurrentStyle_get_borderBottomWidth,
808     HTMLCurrentStyle_get_borderLeftWidth,
809     HTMLCurrentStyle_get_left,
810     HTMLCurrentStyle_get_top,
811     HTMLCurrentStyle_get_width,
812     HTMLCurrentStyle_get_height,
813     HTMLCurrentStyle_get_paddingLeft,
814     HTMLCurrentStyle_get_paddingTop,
815     HTMLCurrentStyle_get_paddingRight,
816     HTMLCurrentStyle_get_paddingBottom,
817     HTMLCurrentStyle_get_textAlign,
818     HTMLCurrentStyle_get_textDecoration,
819     HTMLCurrentStyle_get_display,
820     HTMLCurrentStyle_get_visibility,
821     HTMLCurrentStyle_get_zIndex,
822     HTMLCurrentStyle_get_letterSpacing,
823     HTMLCurrentStyle_get_lineHeight,
824     HTMLCurrentStyle_get_textIndent,
825     HTMLCurrentStyle_get_verticalAlign,
826     HTMLCurrentStyle_get_backgroundAttachment,
827     HTMLCurrentStyle_get_marginTop,
828     HTMLCurrentStyle_get_marginRight,
829     HTMLCurrentStyle_get_marginBottom,
830     HTMLCurrentStyle_get_marginLeft,
831     HTMLCurrentStyle_get_clear,
832     HTMLCurrentStyle_get_listStyleType,
833     HTMLCurrentStyle_get_listStylePosition,
834     HTMLCurrentStyle_get_listStyleImage,
835     HTMLCurrentStyle_get_clipTop,
836     HTMLCurrentStyle_get_clipRight,
837     HTMLCurrentStyle_get_clipBottom,
838     HTMLCurrentStyle_get_clipLeft,
839     HTMLCurrentStyle_get_overflow,
840     HTMLCurrentStyle_get_pageBreakBefore,
841     HTMLCurrentStyle_get_pageBreakAfter,
842     HTMLCurrentStyle_get_cursor,
843     HTMLCurrentStyle_get_tableLayout,
844     HTMLCurrentStyle_get_borderCollapse,
845     HTMLCurrentStyle_get_direction,
846     HTMLCurrentStyle_get_behavior,
847     HTMLCurrentStyle_getAttribute,
848     HTMLCurrentStyle_get_unicodeBidi,
849     HTMLCurrentStyle_get_right,
850     HTMLCurrentStyle_get_bottom,
851     HTMLCurrentStyle_get_imeMode,
852     HTMLCurrentStyle_get_rubyAlign,
853     HTMLCurrentStyle_get_rubyPosition,
854     HTMLCurrentStyle_get_rubyOverhang,
855     HTMLCurrentStyle_get_textAutospace,
856     HTMLCurrentStyle_get_lineBreak,
857     HTMLCurrentStyle_get_wordBreak,
858     HTMLCurrentStyle_get_textJustify,
859     HTMLCurrentStyle_get_textJustifyTrim,
860     HTMLCurrentStyle_get_textKashida,
861     HTMLCurrentStyle_get_blockDirection,
862     HTMLCurrentStyle_get_layoutGridChar,
863     HTMLCurrentStyle_get_layoutGridLine,
864     HTMLCurrentStyle_get_layoutGridMode,
865     HTMLCurrentStyle_get_layoutGridType,
866     HTMLCurrentStyle_get_borderStyle,
867     HTMLCurrentStyle_get_borderColor,
868     HTMLCurrentStyle_get_borderWidth,
869     HTMLCurrentStyle_get_padding,
870     HTMLCurrentStyle_get_margin,
871     HTMLCurrentStyle_get_accelerator,
872     HTMLCurrentStyle_get_overflowX,
873     HTMLCurrentStyle_get_overflowY,
874     HTMLCurrentStyle_get_textTransform
875 };
876
877 static const tid_t HTMLCurrentStyle_iface_tids[] = {
878     IHTMLCurrentStyle_tid,
879     IHTMLCurrentStyle2_tid,
880     IHTMLCurrentStyle3_tid,
881     IHTMLCurrentStyle4_tid,
882     0
883 };
884 static dispex_static_data_t HTMLCurrentStyle_dispex = {
885     NULL,
886     DispHTMLCurrentStyle_tid,
887     NULL,
888     HTMLCurrentStyle_iface_tids
889 };
890
891 HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
892 {
893     nsIDOMCSSStyleDeclaration *nsstyle;
894     nsIDOMDocumentView *nsdocview;
895     nsIDOMAbstractView *nsview;
896     nsIDOMViewCSS *nsviewcss;
897     nsAString nsempty_str;
898     HTMLCurrentStyle *ret;
899     nsresult nsres;
900
901     if(!elem->node.doc->nsdoc)  {
902         WARN("NULL nsdoc\n");
903         return E_UNEXPECTED;
904     }
905
906     nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
907     if(NS_FAILED(nsres)) {
908         ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
909         return E_FAIL;
910     }
911
912     nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
913     nsIDOMDocumentView_Release(nsdocview);
914     if(NS_FAILED(nsres)) {
915         ERR("GetDefaultView failed: %08x\n", nsres);
916         return E_FAIL;
917     }
918
919     nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMViewCSS, (void**)&nsviewcss);
920     nsIDOMAbstractView_Release(nsview);
921     if(NS_FAILED(nsres)) {
922         ERR("Could not get nsIDOMViewCSS: %08x\n", nsres);
923         return E_FAIL;
924     }
925
926     nsAString_Init(&nsempty_str, NULL);
927     nsres = nsIDOMViewCSS_GetComputedStyle(nsviewcss, (nsIDOMElement*)elem->nselem, &nsempty_str, &nsstyle);
928     nsIDOMViewCSS_Release(nsviewcss);
929     nsAString_Finish(&nsempty_str);
930     if(NS_FAILED(nsres)) {
931         ERR("GetComputedStyle failed: %08x\n", nsres);
932         return E_FAIL;
933     }
934
935     ret = heap_alloc_zero(sizeof(HTMLCurrentStyle));
936     if(!ret) {
937         nsIDOMCSSStyleDeclaration_Release(nsstyle);
938         return E_OUTOFMEMORY;
939     }
940
941     ret->lpIHTMLCurrentStyleVtbl = &HTMLCurrentStyleVtbl;
942     ret->ref = 1;
943     ret->nsstyle = nsstyle;
944
945     init_dispex(&ret->dispex, (IUnknown*)HTMLCURSTYLE(ret),  &HTMLCurrentStyle_dispex);
946
947     *p = HTMLCURSTYLE(ret);
948     return S_OK;
949 }