mshtml: Added IHTMLStyle::[get|put]_verticalAlign implementation.
[wine] / dlls / mshtml / htmlimg.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 "wine/debug.h"
29
30 #include "mshtml_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
33
34 typedef struct {
35     HTMLElement element;
36
37     const IHTMLImgElementVtbl *lpHTMLImgElementVtbl;
38
39     nsIDOMHTMLImageElement *nsimg;
40 } HTMLImgElement;
41
42 #define HTMLIMG(x)  ((IHTMLImgElement*)  &(x)->lpHTMLImgElementVtbl)
43
44 #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface)
45
46 static HRESULT WINAPI HTMLImgElement_QueryInterface(IHTMLImgElement *iface, REFIID riid, void **ppv)
47 {
48     HTMLImgElement *This = HTMLIMG_THIS(iface);
49
50     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
51 }
52
53 static ULONG WINAPI HTMLImgElement_AddRef(IHTMLImgElement *iface)
54 {
55     HTMLImgElement *This = HTMLIMG_THIS(iface);
56
57     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
58 }
59
60 static ULONG WINAPI HTMLImgElement_Release(IHTMLImgElement *iface)
61 {
62     HTMLImgElement *This = HTMLIMG_THIS(iface);
63
64     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
65 }
66
67 static HRESULT WINAPI HTMLImgElement_GetTypeInfoCount(IHTMLImgElement *iface, UINT *pctinfo)
68 {
69     HTMLImgElement *This = HTMLIMG_THIS(iface);
70     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
71 }
72
73 static HRESULT WINAPI HTMLImgElement_GetTypeInfo(IHTMLImgElement *iface, UINT iTInfo,
74                                               LCID lcid, ITypeInfo **ppTInfo)
75 {
76     HTMLImgElement *This = HTMLIMG_THIS(iface);
77     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
78 }
79
80 static HRESULT WINAPI HTMLImgElement_GetIDsOfNames(IHTMLImgElement *iface, REFIID riid,
81                                                 LPOLESTR *rgszNames, UINT cNames,
82                                                 LCID lcid, DISPID *rgDispId)
83 {
84     HTMLImgElement *This = HTMLIMG_THIS(iface);
85     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
86 }
87
88 static HRESULT WINAPI HTMLImgElement_Invoke(IHTMLImgElement *iface, DISPID dispIdMember,
89                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
90                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
91 {
92     HTMLImgElement *This = HTMLIMG_THIS(iface);
93     return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
94             pVarResult, pExcepInfo, puArgErr);
95 }
96
97 static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
98 {
99     HTMLImgElement *This = HTMLIMG_THIS(iface);
100     FIXME("(%p)->(%x)\n", This, v);
101     return E_NOTIMPL;
102 }
103
104 static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
105 {
106     HTMLImgElement *This = HTMLIMG_THIS(iface);
107     FIXME("(%p)->(%p)\n", This, p);
108     return E_NOTIMPL;
109 }
110
111 static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
112 {
113     HTMLImgElement *This = HTMLIMG_THIS(iface);
114     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
115     return E_NOTIMPL;
116 }
117
118 static HRESULT WINAPI HTMLImgElement_get_useMap(IHTMLImgElement *iface, BSTR *p)
119 {
120     HTMLImgElement *This = HTMLIMG_THIS(iface);
121     FIXME("(%p)->(%p)\n", This, p);
122     return E_NOTIMPL;
123 }
124
125 static HRESULT WINAPI HTMLImgElement_get_mimeType(IHTMLImgElement *iface, BSTR *p)
126 {
127     HTMLImgElement *This = HTMLIMG_THIS(iface);
128     FIXME("(%p)->(%p)\n", This, p);
129     return E_NOTIMPL;
130 }
131
132 static HRESULT WINAPI HTMLImgElement_get_fileSize(IHTMLImgElement *iface, BSTR *p)
133 {
134     HTMLImgElement *This = HTMLIMG_THIS(iface);
135     FIXME("(%p)->(%p)\n", This, p);
136     return E_NOTIMPL;
137 }
138
139 static HRESULT WINAPI HTMLImgElement_get_fileCreatedDate(IHTMLImgElement *iface, BSTR *p)
140 {
141     HTMLImgElement *This = HTMLIMG_THIS(iface);
142     FIXME("(%p)->(%p)\n", This, p);
143     return E_NOTIMPL;
144 }
145
146 static HRESULT WINAPI HTMLImgElement_get_fileModifiedDate(IHTMLImgElement *iface, BSTR *p)
147 {
148     HTMLImgElement *This = HTMLIMG_THIS(iface);
149     FIXME("(%p)->(%p)\n", This, p);
150     return E_NOTIMPL;
151 }
152
153 static HRESULT WINAPI HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement *iface, BSTR *p)
154 {
155     HTMLImgElement *This = HTMLIMG_THIS(iface);
156     FIXME("(%p)->(%p)\n", This, p);
157     return E_NOTIMPL;
158 }
159
160 static HRESULT WINAPI HTMLImgElement_get_protocol(IHTMLImgElement *iface, BSTR *p)
161 {
162     HTMLImgElement *This = HTMLIMG_THIS(iface);
163     FIXME("(%p)->(%p)\n", This, p);
164     return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI HTMLImgElement_get_href(IHTMLImgElement *iface, BSTR *p)
168 {
169     HTMLImgElement *This = HTMLIMG_THIS(iface);
170     FIXME("(%p)->(%p)\n", This, p);
171     return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI HTMLImgElement_get_nameProp(IHTMLImgElement *iface, BSTR *p)
175 {
176     HTMLImgElement *This = HTMLIMG_THIS(iface);
177     FIXME("(%p)->(%p)\n", This, p);
178     return E_NOTIMPL;
179 }
180
181 static HRESULT WINAPI HTMLImgElement_put_border(IHTMLImgElement *iface, VARIANT v)
182 {
183     HTMLImgElement *This = HTMLIMG_THIS(iface);
184     FIXME("(%p)->()\n", This);
185     return E_NOTIMPL;
186 }
187
188 static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT *p)
189 {
190     HTMLImgElement *This = HTMLIMG_THIS(iface);
191     FIXME("(%p)->(%p)\n", This, p);
192     return E_NOTIMPL;
193 }
194
195 static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, long v)
196 {
197     HTMLImgElement *This = HTMLIMG_THIS(iface);
198     FIXME("(%p)->(%ld)\n", This, v);
199     return E_NOTIMPL;
200 }
201
202 static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, long *p)
203 {
204     HTMLImgElement *This = HTMLIMG_THIS(iface);
205     FIXME("(%p)->(%p)\n", This, p);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, long v)
210 {
211     HTMLImgElement *This = HTMLIMG_THIS(iface);
212     FIXME("(%p)->(%ld)\n", This, v);
213     return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI HTMLImgElement_get_hspace(IHTMLImgElement *iface, long *p)
217 {
218     HTMLImgElement *This = HTMLIMG_THIS(iface);
219     FIXME("(%p)->(%p)\n", This, p);
220     return E_NOTIMPL;
221 }
222
223 static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
224 {
225     HTMLImgElement *This = HTMLIMG_THIS(iface);
226     nsAString alt_str;
227     nsresult nsres;
228
229     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
230
231     nsAString_Init(&alt_str, v);
232     nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
233     nsAString_Finish(&alt_str);
234     if(NS_FAILED(nsres))
235         ERR("SetAlt failed: %08x\n", nsres);
236
237     return S_OK;
238 }
239
240 static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
241 {
242     HTMLImgElement *This = HTMLIMG_THIS(iface);
243     nsAString alt_str;
244     nsresult nsres;
245
246     TRACE("(%p)->(%p)\n", This, p);
247
248     nsAString_Init(&alt_str, NULL);
249     nsres = nsIDOMHTMLImageElement_GetAlt(This->nsimg, &alt_str);
250     if(NS_SUCCEEDED(nsres)) {
251         const PRUnichar *alt;
252
253         nsAString_GetData(&alt_str, &alt);
254         *p = *alt ? SysAllocString(alt) : NULL;
255     }else {
256         ERR("GetAlt failed: %08x\n", nsres);
257     }
258     nsAString_Finish(&alt_str);
259
260     return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
261 }
262
263 static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
264 {
265     HTMLImgElement *This = HTMLIMG_THIS(iface);
266     nsAString src_str;
267     nsresult nsres;
268
269     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
270
271     nsAString_Init(&src_str, v);
272     nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
273     nsAString_Finish(&src_str);
274     if(NS_FAILED(nsres))
275         ERR("SetSrc failed: %08x\n", nsres);
276
277     return NS_OK;
278 }
279
280 static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
281 {
282     HTMLImgElement *This = HTMLIMG_THIS(iface);
283     FIXME("(%p)->(%p)\n", This, p);
284     return E_NOTIMPL;
285 }
286
287 static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
288 {
289     HTMLImgElement *This = HTMLIMG_THIS(iface);
290     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
291     return E_NOTIMPL;
292 }
293
294 static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
295 {
296     HTMLImgElement *This = HTMLIMG_THIS(iface);
297     FIXME("(%p)->(%p)\n", This, p);
298     return E_NOTIMPL;
299 }
300
301 static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
302 {
303     HTMLImgElement *This = HTMLIMG_THIS(iface);
304     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
305     return E_NOTIMPL;
306 }
307
308 static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
309 {
310     HTMLImgElement *This = HTMLIMG_THIS(iface);
311     FIXME("(%p)->(%p)\n", This, p);
312     return E_NOTIMPL;
313 }
314
315 static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
316 {
317     HTMLImgElement *This = HTMLIMG_THIS(iface);
318     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
319     return E_NOTIMPL;
320 }
321
322 static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
323 {
324     HTMLImgElement *This = HTMLIMG_THIS(iface);
325     FIXME("(%p)->(%p)\n", This, p);
326     return E_NOTIMPL;
327 }
328
329 static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
330 {
331     HTMLImgElement *This = HTMLIMG_THIS(iface);
332     FIXME("(%p)->(%p)\n", This, p);
333     return E_NOTIMPL;
334 }
335
336 static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
337 {
338     HTMLImgElement *This = HTMLIMG_THIS(iface);
339     FIXME("(%p)->(%p)\n", This, p);
340     return E_NOTIMPL;
341 }
342
343 static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
344 {
345     HTMLImgElement *This = HTMLIMG_THIS(iface);
346     FIXME("(%p)->()\n", This);
347     return E_NOTIMPL;
348 }
349
350 static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
351 {
352     HTMLImgElement *This = HTMLIMG_THIS(iface);
353     FIXME("(%p)->(%p)\n", This, p);
354     return E_NOTIMPL;
355 }
356
357 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
358 {
359     HTMLImgElement *This = HTMLIMG_THIS(iface);
360     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
361     return E_NOTIMPL;
362 }
363
364 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
365 {
366     HTMLImgElement *This = HTMLIMG_THIS(iface);
367     FIXME("(%p)->(%p)\n", This, p);
368     return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
372 {
373     HTMLImgElement *This = HTMLIMG_THIS(iface);
374     FIXME("(%p)->()\n", This);
375     return E_NOTIMPL;
376 }
377
378 static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
379 {
380     HTMLImgElement *This = HTMLIMG_THIS(iface);
381     FIXME("(%p)->(%p)\n", This, p);
382     return E_NOTIMPL;
383 }
384
385 static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
386 {
387     HTMLImgElement *This = HTMLIMG_THIS(iface);
388     FIXME("(%p)->()\n", This);
389     return E_NOTIMPL;
390 }
391
392 static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
393 {
394     HTMLImgElement *This = HTMLIMG_THIS(iface);
395     FIXME("(%p)->(%p)\n", This, p);
396     return E_NOTIMPL;
397 }
398
399 static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
400 {
401     HTMLImgElement *This = HTMLIMG_THIS(iface);
402     FIXME("(%p)->()\n", This);
403     return E_NOTIMPL;
404 }
405
406 static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
407 {
408     HTMLImgElement *This = HTMLIMG_THIS(iface);
409     FIXME("(%p)->(%p)\n", This, p);
410     return E_NOTIMPL;
411 }
412
413 static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
414 {
415     HTMLImgElement *This = HTMLIMG_THIS(iface);
416     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
417     return E_NOTIMPL;
418 }
419
420 static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
421 {
422     HTMLImgElement *This = HTMLIMG_THIS(iface);
423     FIXME("(%p)->(%p)\n", This, p);
424     return E_NOTIMPL;
425 }
426
427 static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, long v)
428 {
429     HTMLImgElement *This = HTMLIMG_THIS(iface);
430     FIXME("(%p)->(%ld)\n", This, v);
431     return E_NOTIMPL;
432 }
433
434 static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, long *p)
435 {
436     HTMLImgElement *This = HTMLIMG_THIS(iface);
437     FIXME("(%p)->(%p)\n", This, p);
438     return E_NOTIMPL;
439 }
440
441 static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, long v)
442 {
443     HTMLImgElement *This = HTMLIMG_THIS(iface);
444     FIXME("(%p)->(%ld)\n", This, v);
445     return E_NOTIMPL;
446 }
447
448 static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, long *p)
449 {
450     HTMLImgElement *This = HTMLIMG_THIS(iface);
451     FIXME("(%p)->(%p)\n", This, p);
452     return E_NOTIMPL;
453 }
454
455 static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
456 {
457     HTMLImgElement *This = HTMLIMG_THIS(iface);
458     FIXME("(%p)->()\n", This);
459     return E_NOTIMPL;
460 }
461
462 static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
463 {
464     HTMLImgElement *This = HTMLIMG_THIS(iface);
465     FIXME("(%p)->(%p)\n", This, p);
466     return E_NOTIMPL;
467 }
468
469 #undef HTMLIMG_THIS
470
471 static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
472     HTMLImgElement_QueryInterface,
473     HTMLImgElement_AddRef,
474     HTMLImgElement_Release,
475     HTMLImgElement_GetTypeInfoCount,
476     HTMLImgElement_GetTypeInfo,
477     HTMLImgElement_GetIDsOfNames,
478     HTMLImgElement_Invoke,
479     HTMLImgElement_put_isMap,
480     HTMLImgElement_get_isMap,
481     HTMLImgElement_put_useMap,
482     HTMLImgElement_get_useMap,
483     HTMLImgElement_get_mimeType,
484     HTMLImgElement_get_fileSize,
485     HTMLImgElement_get_fileCreatedDate,
486     HTMLImgElement_get_fileModifiedDate,
487     HTMLImgElement_get_fileUpdatedDate,
488     HTMLImgElement_get_protocol,
489     HTMLImgElement_get_href,
490     HTMLImgElement_get_nameProp,
491     HTMLImgElement_put_border,
492     HTMLImgElement_get_border,
493     HTMLImgElement_put_vspace,
494     HTMLImgElement_get_vspace,
495     HTMLImgElement_put_hspace,
496     HTMLImgElement_get_hspace,
497     HTMLImgElement_put_alt,
498     HTMLImgElement_get_alt,
499     HTMLImgElement_put_src,
500     HTMLImgElement_get_src,
501     HTMLImgElement_put_lowsrc,
502     HTMLImgElement_get_lowsrc,
503     HTMLImgElement_put_vrml,
504     HTMLImgElement_get_vrml,
505     HTMLImgElement_put_dynsrc,
506     HTMLImgElement_get_dynsrc,
507     HTMLImgElement_get_readyState,
508     HTMLImgElement_get_complete,
509     HTMLImgElement_put_loop,
510     HTMLImgElement_get_loop,
511     HTMLImgElement_put_align,
512     HTMLImgElement_get_align,
513     HTMLImgElement_put_onload,
514     HTMLImgElement_get_onload,
515     HTMLImgElement_put_onerror,
516     HTMLImgElement_get_onerror,
517     HTMLImgElement_put_onabort,
518     HTMLImgElement_get_onabort,
519     HTMLImgElement_put_name,
520     HTMLImgElement_get_name,
521     HTMLImgElement_put_width,
522     HTMLImgElement_get_width,
523     HTMLImgElement_put_height,
524     HTMLImgElement_get_height,
525     HTMLImgElement_put_start,
526     HTMLImgElement_get_start
527 };
528
529 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
530
531 static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
532 {
533     HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
534
535     *ppv = NULL;
536
537     if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
538         TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
539         *ppv = HTMLIMG(This);
540     }else {
541         return HTMLElement_QI(&This->element.node, riid, ppv);
542     }
543
544     IUnknown_AddRef((IUnknown*)*ppv);
545     return S_OK;
546 }
547
548 static void HTMLImgElement_destructor(HTMLDOMNode *iface)
549 {
550     HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
551
552     if(This->nsimg)
553         nsIDOMHTMLImageElement_Release(This->nsimg);
554
555     HTMLElement_destructor(&This->element.node);
556 }
557
558 #undef HTMLIMG_NODE_THIS
559
560 static const NodeImplVtbl HTMLImgElementImplVtbl = {
561     HTMLImgElement_QI,
562     HTMLImgElement_destructor
563 };
564
565 static const tid_t HTMLImgElement_iface_tids[] = {
566     IHTMLDOMNode_tid,
567     IHTMLDOMNode2_tid,
568     IHTMLElement_tid,
569     IHTMLElement2_tid,
570     IHTMLImgElement_tid,
571     0
572 };
573 static dispex_static_data_t HTMLImgElement_dispex = {
574     NULL,
575     DispHTMLImg_tid,
576     NULL,
577     HTMLImgElement_iface_tids
578 };
579
580 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
581 {
582     HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
583     nsresult nsres;
584
585     ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
586     ret->element.node.vtbl = &HTMLImgElementImplVtbl;
587
588     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
589     if(NS_FAILED(nsres))
590         ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
591
592     init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
593     HTMLElement_Init(&ret->element);
594
595     return &ret->element;
596 }