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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 const IHTMLImgElementVtbl *lpHTMLImgElementVtbl;
39 nsIDOMHTMLImageElement *nsimg;
42 #define HTMLIMG(x) ((IHTMLImgElement*) &(x)->lpHTMLImgElementVtbl)
44 #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface)
46 static HRESULT WINAPI HTMLImgElement_QueryInterface(IHTMLImgElement *iface, REFIID riid, void **ppv)
48 HTMLImgElement *This = HTMLIMG_THIS(iface);
50 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
53 static ULONG WINAPI HTMLImgElement_AddRef(IHTMLImgElement *iface)
55 HTMLImgElement *This = HTMLIMG_THIS(iface);
57 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
60 static ULONG WINAPI HTMLImgElement_Release(IHTMLImgElement *iface)
62 HTMLImgElement *This = HTMLIMG_THIS(iface);
64 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
67 static HRESULT WINAPI HTMLImgElement_GetTypeInfoCount(IHTMLImgElement *iface, UINT *pctinfo)
69 HTMLImgElement *This = HTMLIMG_THIS(iface);
70 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
73 static HRESULT WINAPI HTMLImgElement_GetTypeInfo(IHTMLImgElement *iface, UINT iTInfo,
74 LCID lcid, ITypeInfo **ppTInfo)
76 HTMLImgElement *This = HTMLIMG_THIS(iface);
77 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
80 static HRESULT WINAPI HTMLImgElement_GetIDsOfNames(IHTMLImgElement *iface, REFIID riid,
81 LPOLESTR *rgszNames, UINT cNames,
82 LCID lcid, DISPID *rgDispId)
84 HTMLImgElement *This = HTMLIMG_THIS(iface);
85 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
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)
92 HTMLImgElement *This = HTMLIMG_THIS(iface);
93 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
94 pVarResult, pExcepInfo, puArgErr);
97 static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
99 HTMLImgElement *This = HTMLIMG_THIS(iface);
100 FIXME("(%p)->(%x)\n", This, v);
104 static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
106 HTMLImgElement *This = HTMLIMG_THIS(iface);
107 FIXME("(%p)->(%p)\n", This, p);
111 static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
113 HTMLImgElement *This = HTMLIMG_THIS(iface);
114 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
118 static HRESULT WINAPI HTMLImgElement_get_useMap(IHTMLImgElement *iface, BSTR *p)
120 HTMLImgElement *This = HTMLIMG_THIS(iface);
121 FIXME("(%p)->(%p)\n", This, p);
125 static HRESULT WINAPI HTMLImgElement_get_mimeType(IHTMLImgElement *iface, BSTR *p)
127 HTMLImgElement *This = HTMLIMG_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, p);
132 static HRESULT WINAPI HTMLImgElement_get_fileSize(IHTMLImgElement *iface, BSTR *p)
134 HTMLImgElement *This = HTMLIMG_THIS(iface);
135 FIXME("(%p)->(%p)\n", This, p);
139 static HRESULT WINAPI HTMLImgElement_get_fileCreatedDate(IHTMLImgElement *iface, BSTR *p)
141 HTMLImgElement *This = HTMLIMG_THIS(iface);
142 FIXME("(%p)->(%p)\n", This, p);
146 static HRESULT WINAPI HTMLImgElement_get_fileModifiedDate(IHTMLImgElement *iface, BSTR *p)
148 HTMLImgElement *This = HTMLIMG_THIS(iface);
149 FIXME("(%p)->(%p)\n", This, p);
153 static HRESULT WINAPI HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement *iface, BSTR *p)
155 HTMLImgElement *This = HTMLIMG_THIS(iface);
156 FIXME("(%p)->(%p)\n", This, p);
160 static HRESULT WINAPI HTMLImgElement_get_protocol(IHTMLImgElement *iface, BSTR *p)
162 HTMLImgElement *This = HTMLIMG_THIS(iface);
163 FIXME("(%p)->(%p)\n", This, p);
167 static HRESULT WINAPI HTMLImgElement_get_href(IHTMLImgElement *iface, BSTR *p)
169 HTMLImgElement *This = HTMLIMG_THIS(iface);
170 FIXME("(%p)->(%p)\n", This, p);
174 static HRESULT WINAPI HTMLImgElement_get_nameProp(IHTMLImgElement *iface, BSTR *p)
176 HTMLImgElement *This = HTMLIMG_THIS(iface);
177 FIXME("(%p)->(%p)\n", This, p);
181 static HRESULT WINAPI HTMLImgElement_put_border(IHTMLImgElement *iface, VARIANT v)
183 HTMLImgElement *This = HTMLIMG_THIS(iface);
184 FIXME("(%p)->()\n", This);
188 static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT *p)
190 HTMLImgElement *This = HTMLIMG_THIS(iface);
191 FIXME("(%p)->(%p)\n", This, p);
195 static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, LONG v)
197 HTMLImgElement *This = HTMLIMG_THIS(iface);
198 FIXME("(%p)->(%d)\n", This, v);
202 static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, LONG *p)
204 HTMLImgElement *This = HTMLIMG_THIS(iface);
205 FIXME("(%p)->(%p)\n", This, p);
209 static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, LONG v)
211 HTMLImgElement *This = HTMLIMG_THIS(iface);
212 FIXME("(%p)->(%d)\n", This, v);
216 static HRESULT WINAPI HTMLImgElement_get_hspace(IHTMLImgElement *iface, LONG *p)
218 HTMLImgElement *This = HTMLIMG_THIS(iface);
219 FIXME("(%p)->(%p)\n", This, p);
223 static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
225 HTMLImgElement *This = HTMLIMG_THIS(iface);
229 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
231 nsAString_Init(&alt_str, v);
232 nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
233 nsAString_Finish(&alt_str);
235 ERR("SetAlt failed: %08x\n", nsres);
240 static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
242 HTMLImgElement *This = HTMLIMG_THIS(iface);
246 TRACE("(%p)->(%p)\n", This, p);
248 nsAString_Init(&alt_str, NULL);
249 nsres = nsIDOMHTMLImageElement_GetAlt(This->nsimg, &alt_str);
250 if(NS_SUCCEEDED(nsres)) {
251 const PRUnichar *alt;
253 nsAString_GetData(&alt_str, &alt);
254 *p = *alt ? SysAllocString(alt) : NULL;
256 ERR("GetAlt failed: %08x\n", nsres);
258 nsAString_Finish(&alt_str);
260 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
263 static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
265 HTMLImgElement *This = HTMLIMG_THIS(iface);
269 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
271 nsAString_Init(&src_str, v);
272 nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
273 nsAString_Finish(&src_str);
275 ERR("SetSrc failed: %08x\n", nsres);
280 static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
282 HTMLImgElement *This = HTMLIMG_THIS(iface);
283 const PRUnichar *src;
288 TRACE("(%p)->(%p)\n", This, p);
290 nsAString_Init(&src_str, NULL);
291 nsres = nsIDOMHTMLImageElement_GetSrc(This->nsimg, &src_str);
292 if(NS_FAILED(nsres)) {
293 ERR("GetSrc failed: %08x\n", nsres);
297 nsAString_GetData(&src_str, &src);
298 hres = nsuri_to_url(src, TRUE, p);
299 nsAString_Finish(&src_str);
304 static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
306 HTMLImgElement *This = HTMLIMG_THIS(iface);
307 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
311 static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
313 HTMLImgElement *This = HTMLIMG_THIS(iface);
314 FIXME("(%p)->(%p)\n", This, p);
318 static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
320 HTMLImgElement *This = HTMLIMG_THIS(iface);
321 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
325 static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
327 HTMLImgElement *This = HTMLIMG_THIS(iface);
328 FIXME("(%p)->(%p)\n", This, p);
332 static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
334 HTMLImgElement *This = HTMLIMG_THIS(iface);
335 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
339 static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
341 HTMLImgElement *This = HTMLIMG_THIS(iface);
342 FIXME("(%p)->(%p)\n", This, p);
346 static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
348 HTMLImgElement *This = HTMLIMG_THIS(iface);
349 FIXME("(%p)->(%p)\n", This, p);
353 static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
355 HTMLImgElement *This = HTMLIMG_THIS(iface);
356 FIXME("(%p)->(%p)\n", This, p);
360 static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
362 HTMLImgElement *This = HTMLIMG_THIS(iface);
363 FIXME("(%p)->()\n", This);
367 static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
369 HTMLImgElement *This = HTMLIMG_THIS(iface);
370 FIXME("(%p)->(%p)\n", This, p);
374 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
376 HTMLImgElement *This = HTMLIMG_THIS(iface);
377 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
381 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
383 HTMLImgElement *This = HTMLIMG_THIS(iface);
384 FIXME("(%p)->(%p)\n", This, p);
388 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
390 HTMLImgElement *This = HTMLIMG_THIS(iface);
391 FIXME("(%p)->()\n", This);
395 static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
397 HTMLImgElement *This = HTMLIMG_THIS(iface);
398 FIXME("(%p)->(%p)\n", This, p);
402 static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
404 HTMLImgElement *This = HTMLIMG_THIS(iface);
405 FIXME("(%p)->()\n", This);
409 static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
411 HTMLImgElement *This = HTMLIMG_THIS(iface);
412 FIXME("(%p)->(%p)\n", This, p);
416 static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
418 HTMLImgElement *This = HTMLIMG_THIS(iface);
419 FIXME("(%p)->()\n", This);
423 static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
425 HTMLImgElement *This = HTMLIMG_THIS(iface);
426 FIXME("(%p)->(%p)\n", This, p);
430 static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
432 HTMLImgElement *This = HTMLIMG_THIS(iface);
433 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
437 static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
439 HTMLImgElement *This = HTMLIMG_THIS(iface);
443 TRACE("(%p)->(%p)\n", This, p);
445 nsAString_Init(&strName, NULL);
446 nsres = nsIDOMHTMLImageElement_GetName(This->nsimg, &strName);
447 if(NS_SUCCEEDED(nsres)) {
448 const PRUnichar *str;
450 nsAString_GetData(&strName, &str);
451 *p = *str ? SysAllocString(str) : NULL;
453 ERR("GetName failed: %08x\n", nsres);
455 nsAString_Finish(&strName);
457 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
460 static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, LONG v)
462 HTMLImgElement *This = HTMLIMG_THIS(iface);
463 FIXME("(%p)->(%d)\n", This, v);
467 static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, LONG *p)
469 HTMLImgElement *This = HTMLIMG_THIS(iface);
470 FIXME("(%p)->(%p)\n", This, p);
474 static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, LONG v)
476 HTMLImgElement *This = HTMLIMG_THIS(iface);
477 FIXME("(%p)->(%d)\n", This, v);
481 static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, LONG *p)
483 HTMLImgElement *This = HTMLIMG_THIS(iface);
484 FIXME("(%p)->(%p)\n", This, p);
488 static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
490 HTMLImgElement *This = HTMLIMG_THIS(iface);
491 FIXME("(%p)->()\n", This);
495 static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
497 HTMLImgElement *This = HTMLIMG_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
504 static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
505 HTMLImgElement_QueryInterface,
506 HTMLImgElement_AddRef,
507 HTMLImgElement_Release,
508 HTMLImgElement_GetTypeInfoCount,
509 HTMLImgElement_GetTypeInfo,
510 HTMLImgElement_GetIDsOfNames,
511 HTMLImgElement_Invoke,
512 HTMLImgElement_put_isMap,
513 HTMLImgElement_get_isMap,
514 HTMLImgElement_put_useMap,
515 HTMLImgElement_get_useMap,
516 HTMLImgElement_get_mimeType,
517 HTMLImgElement_get_fileSize,
518 HTMLImgElement_get_fileCreatedDate,
519 HTMLImgElement_get_fileModifiedDate,
520 HTMLImgElement_get_fileUpdatedDate,
521 HTMLImgElement_get_protocol,
522 HTMLImgElement_get_href,
523 HTMLImgElement_get_nameProp,
524 HTMLImgElement_put_border,
525 HTMLImgElement_get_border,
526 HTMLImgElement_put_vspace,
527 HTMLImgElement_get_vspace,
528 HTMLImgElement_put_hspace,
529 HTMLImgElement_get_hspace,
530 HTMLImgElement_put_alt,
531 HTMLImgElement_get_alt,
532 HTMLImgElement_put_src,
533 HTMLImgElement_get_src,
534 HTMLImgElement_put_lowsrc,
535 HTMLImgElement_get_lowsrc,
536 HTMLImgElement_put_vrml,
537 HTMLImgElement_get_vrml,
538 HTMLImgElement_put_dynsrc,
539 HTMLImgElement_get_dynsrc,
540 HTMLImgElement_get_readyState,
541 HTMLImgElement_get_complete,
542 HTMLImgElement_put_loop,
543 HTMLImgElement_get_loop,
544 HTMLImgElement_put_align,
545 HTMLImgElement_get_align,
546 HTMLImgElement_put_onload,
547 HTMLImgElement_get_onload,
548 HTMLImgElement_put_onerror,
549 HTMLImgElement_get_onerror,
550 HTMLImgElement_put_onabort,
551 HTMLImgElement_get_onabort,
552 HTMLImgElement_put_name,
553 HTMLImgElement_get_name,
554 HTMLImgElement_put_width,
555 HTMLImgElement_get_width,
556 HTMLImgElement_put_height,
557 HTMLImgElement_get_height,
558 HTMLImgElement_put_start,
559 HTMLImgElement_get_start
562 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
564 static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
566 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
570 if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
571 TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
572 *ppv = HTMLIMG(This);
574 return HTMLElement_QI(&This->element.node, riid, ppv);
577 IUnknown_AddRef((IUnknown*)*ppv);
581 static void HTMLImgElement_destructor(HTMLDOMNode *iface)
583 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
586 nsIDOMHTMLImageElement_Release(This->nsimg);
588 HTMLElement_destructor(&This->element.node);
591 static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
593 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
595 return IHTMLImgElement_get_readyState(HTMLIMG(This), p);
598 #undef HTMLIMG_NODE_THIS
600 static const NodeImplVtbl HTMLImgElementImplVtbl = {
602 HTMLImgElement_destructor,
608 HTMLImgElement_get_readystate
611 static const tid_t HTMLImgElement_iface_tids[] = {
620 static dispex_static_data_t HTMLImgElement_dispex = {
624 HTMLImgElement_iface_tids
627 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
629 HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
632 ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
633 ret->element.node.vtbl = &HTMLImgElementImplVtbl;
635 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
637 ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
639 HTMLElement_Init(&ret->element, doc, nselem, &HTMLImgElement_dispex);
641 return &ret->element;
644 #define HTMLIMGFACTORY_THIS(iface) DEFINE_THIS(HTMLImageElementFactory, HTMLImageElementFactory, iface)
646 static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFactory *iface,
647 REFIID riid, void **ppv)
649 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
653 if(IsEqualGUID(&IID_IUnknown, riid)) {
654 TRACE("(%p)->(IID_Unknown %p)\n", This, ppv);
655 *ppv = HTMLIMGFACTORY(This);
656 }else if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) {
657 TRACE("(%p)->(IID_IHTMLImageElementFactory %p)\n", This, ppv);
658 *ppv = HTMLIMGFACTORY(This);
659 }else if(dispex_query_interface(&This->dispex, riid, ppv))
660 return *ppv ? S_OK : E_NOINTERFACE;
663 IUnknown_AddRef((IUnknown*)*ppv);
667 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
668 return E_NOINTERFACE;
671 static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *iface)
673 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
674 LONG ref = InterlockedIncrement(&This->ref);
676 TRACE("(%p) ref=%d\n", This, ref);
681 static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *iface)
683 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
684 LONG ref = InterlockedDecrement(&This->ref);
686 TRACE("(%p) ref=%d\n", This, ref);
694 static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfoCount(IHTMLImageElementFactory *iface,
697 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
698 FIXME("(%p)->(%p)\n", This, pctinfo);
702 static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfo(IHTMLImageElementFactory *iface,
703 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
705 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
706 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
710 static HRESULT WINAPI HTMLImageElementFactory_GetIDsOfNames(IHTMLImageElementFactory *iface,
711 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
714 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
715 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames,
716 cNames, lcid, rgDispId);
720 static HRESULT WINAPI HTMLImageElementFactory_Invoke(IHTMLImageElementFactory *iface,
721 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
722 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
725 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
726 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
727 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
731 static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *iface,
732 VARIANT width, VARIANT height, IHTMLImgElement **img_elem)
734 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
736 nsIDOMHTMLElement *nselem;
739 static const PRUnichar imgW[] = {'I','M','G',0};
741 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
742 debugstr_variant(&height), img_elem);
744 if(!This->window || !This->window->doc) {
751 hres = create_nselem(This->window->doc, imgW, &nselem);
755 elem = HTMLElement_Create(This->window->doc, (nsIDOMNode*)nselem, FALSE);
757 ERR("HTMLElement_Create failed\n");
761 hres = IHTMLElement_QueryInterface(HTMLELEM(elem), &IID_IHTMLImgElement, (void**)img_elem);
763 ERR("IHTMLElement_QueryInterface failed: 0x%08x\n", hres);
767 nsIDOMHTMLElement_Release(nselem);
769 if(V_VT(&width) != VT_EMPTY || V_VT(&height) != VT_EMPTY)
770 FIXME("Not setting image dimensions\n");
775 static HRESULT HTMLImageElementFactory_value(IUnknown *iface, LCID lcid,
776 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
777 IServiceProvider *caller)
779 HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
780 IHTMLImgElement *img;
781 VARIANT empty, *width, *height;
783 int argc = params->cArgs - params->cNamedArgs;
787 V_VT(&empty) = VT_EMPTY;
789 width = argc >= 1 ? params->rgvarg + (params->cArgs - 1) : ∅
790 height = argc >= 2 ? params->rgvarg + (params->cArgs - 2) : ∅
792 hres = IHTMLImageElementFactory_create(HTMLIMGFACTORY(This), *width, *height, &img);
796 V_VT(res) = VT_DISPATCH;
797 V_DISPATCH(res) = (IDispatch*)img;
802 #undef HTMLIMGFACTORY_THIS
804 static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = {
805 HTMLImageElementFactory_QueryInterface,
806 HTMLImageElementFactory_AddRef,
807 HTMLImageElementFactory_Release,
808 HTMLImageElementFactory_GetTypeInfoCount,
809 HTMLImageElementFactory_GetTypeInfo,
810 HTMLImageElementFactory_GetIDsOfNames,
811 HTMLImageElementFactory_Invoke,
812 HTMLImageElementFactory_create
815 static const tid_t HTMLImageElementFactory_iface_tids[] = {
816 IHTMLImageElementFactory_tid,
820 static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = {
821 HTMLImageElementFactory_value,
826 static dispex_static_data_t HTMLImageElementFactory_dispex = {
827 &HTMLImageElementFactory_dispex_vtbl,
828 IHTMLImageElementFactory_tid,
830 HTMLImageElementFactory_iface_tids
833 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window)
835 HTMLImageElementFactory *ret;
837 ret = heap_alloc(sizeof(HTMLImageElementFactory));
839 ret->lpHTMLImageElementFactoryVtbl = &HTMLImageElementFactoryVtbl;
841 ret->window = window;
843 init_dispex(&ret->dispex, (IUnknown*)HTMLIMGFACTORY(ret), &HTMLImageElementFactory_dispex);