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