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 FIXME("(%p)->(%p)\n", This
, pctinfo
);
74 static HRESULT WINAPI
HTMLImgElement_GetTypeInfo(IHTMLImgElement
*iface
, UINT iTInfo
,
75 LCID lcid
, ITypeInfo
**ppTInfo
)
77 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
78 FIXME("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
82 static HRESULT WINAPI
HTMLImgElement_GetIDsOfNames(IHTMLImgElement
*iface
, REFIID riid
,
83 LPOLESTR
*rgszNames
, UINT cNames
,
84 LCID lcid
, DISPID
*rgDispId
)
86 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
87 FIXME("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
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
)
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
);
102 static HRESULT WINAPI
HTMLImgElement_put_isMap(IHTMLImgElement
*iface
, VARIANT_BOOL v
)
104 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
105 FIXME("(%p)->(%x)\n", This
, v
);
109 static HRESULT WINAPI
HTMLImgElement_get_isMap(IHTMLImgElement
*iface
, VARIANT_BOOL
*p
)
111 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
112 FIXME("(%p)->(%p)\n", This
, p
);
116 static HRESULT WINAPI
HTMLImgElement_put_useMap(IHTMLImgElement
*iface
, BSTR v
)
118 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
119 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
123 static HRESULT WINAPI
HTMLImgElement_get_useMap(IHTMLImgElement
*iface
, BSTR
*p
)
125 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
126 FIXME("(%p)->(%p)\n", This
, p
);
130 static HRESULT WINAPI
HTMLImgElement_get_mimeType(IHTMLImgElement
*iface
, BSTR
*p
)
132 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
133 FIXME("(%p)->(%p)\n", This
, p
);
137 static HRESULT WINAPI
HTMLImgElement_get_fileSize(IHTMLImgElement
*iface
, BSTR
*p
)
139 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
140 FIXME("(%p)->(%p)\n", This
, p
);
144 static HRESULT WINAPI
HTMLImgElement_get_fileCreatedDate(IHTMLImgElement
*iface
, BSTR
*p
)
146 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
147 FIXME("(%p)->(%p)\n", This
, p
);
151 static HRESULT WINAPI
HTMLImgElement_get_fileModifiedDate(IHTMLImgElement
*iface
, BSTR
*p
)
153 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
154 FIXME("(%p)->(%p)\n", This
, p
);
158 static HRESULT WINAPI
HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement
*iface
, BSTR
*p
)
160 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
161 FIXME("(%p)->(%p)\n", This
, p
);
165 static HRESULT WINAPI
HTMLImgElement_get_protocol(IHTMLImgElement
*iface
, BSTR
*p
)
167 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
168 FIXME("(%p)->(%p)\n", This
, p
);
172 static HRESULT WINAPI
HTMLImgElement_get_href(IHTMLImgElement
*iface
, BSTR
*p
)
174 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
175 FIXME("(%p)->(%p)\n", This
, p
);
179 static HRESULT WINAPI
HTMLImgElement_get_nameProp(IHTMLImgElement
*iface
, BSTR
*p
)
181 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
182 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
HTMLImgElement_put_border(IHTMLImgElement
*iface
, VARIANT v
)
188 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
189 FIXME("(%p)->()\n", This
);
193 static HRESULT WINAPI
HTMLImgElement_get_border(IHTMLImgElement
*iface
, VARIANT
*p
)
195 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
196 FIXME("(%p)->(%p)\n", This
, p
);
200 static HRESULT WINAPI
HTMLImgElement_put_vspace(IHTMLImgElement
*iface
, long v
)
202 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
203 FIXME("(%p)->(%ld)\n", This
, v
);
207 static HRESULT WINAPI
HTMLImgElement_get_vspace(IHTMLImgElement
*iface
, long *p
)
209 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
210 FIXME("(%p)->(%p)\n", This
, p
);
214 static HRESULT WINAPI
HTMLImgElement_put_hspace(IHTMLImgElement
*iface
, long v
)
216 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
217 FIXME("(%p)->(%ld)\n", This
, v
);
221 static HRESULT WINAPI
HTMLImgElement_get_hspace(IHTMLImgElement
*iface
, long *p
)
223 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
224 FIXME("(%p)->(%p)\n", This
, p
);
228 static HRESULT WINAPI
HTMLImgElement_put_alt(IHTMLImgElement
*iface
, BSTR v
)
230 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
234 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
236 nsAString_Init(&alt_str
, v
);
237 nsres
= nsIDOMHTMLImageElement_SetAlt(This
->nsimg
, &alt_str
);
238 nsAString_Finish(&alt_str
);
240 ERR("SetAlt failed: %08x\n", nsres
);
245 static HRESULT WINAPI
HTMLImgElement_get_alt(IHTMLImgElement
*iface
, BSTR
*p
)
247 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
251 TRACE("(%p)->(%p)\n", This
, p
);
253 nsAString_Init(&alt_str
, NULL
);
254 nsres
= nsIDOMHTMLImageElement_GetAlt(This
->nsimg
, &alt_str
);
255 if(NS_SUCCEEDED(nsres
)) {
256 const PRUnichar
*alt
;
258 nsAString_GetData(&alt_str
, &alt
);
259 *p
= *alt
? SysAllocString(alt
) : NULL
;
261 ERR("GetAlt failed: %08x\n", nsres
);
263 nsAString_Finish(&alt_str
);
265 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
268 static HRESULT WINAPI
HTMLImgElement_put_src(IHTMLImgElement
*iface
, BSTR v
)
270 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
274 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
276 nsAString_Init(&src_str
, v
);
277 nsres
= nsIDOMHTMLImageElement_SetSrc(This
->nsimg
, &src_str
);
278 nsAString_Finish(&src_str
);
280 ERR("SetSrc failed: %08x\n", nsres
);
285 static HRESULT WINAPI
HTMLImgElement_get_src(IHTMLImgElement
*iface
, BSTR
*p
)
287 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
288 FIXME("(%p)->(%p)\n", This
, p
);
292 static HRESULT WINAPI
HTMLImgElement_put_lowsrc(IHTMLImgElement
*iface
, BSTR v
)
294 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
295 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
299 static HRESULT WINAPI
HTMLImgElement_get_lowsrc(IHTMLImgElement
*iface
, BSTR
*p
)
301 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
302 FIXME("(%p)->(%p)\n", This
, p
);
306 static HRESULT WINAPI
HTMLImgElement_put_vrml(IHTMLImgElement
*iface
, BSTR v
)
308 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
309 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
313 static HRESULT WINAPI
HTMLImgElement_get_vrml(IHTMLImgElement
*iface
, BSTR
*p
)
315 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
316 FIXME("(%p)->(%p)\n", This
, p
);
320 static HRESULT WINAPI
HTMLImgElement_put_dynsrc(IHTMLImgElement
*iface
, BSTR v
)
322 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
323 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
327 static HRESULT WINAPI
HTMLImgElement_get_dynsrc(IHTMLImgElement
*iface
, BSTR
*p
)
329 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
330 FIXME("(%p)->(%p)\n", This
, p
);
334 static HRESULT WINAPI
HTMLImgElement_get_readyState(IHTMLImgElement
*iface
, BSTR
*p
)
336 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
337 FIXME("(%p)->(%p)\n", This
, p
);
341 static HRESULT WINAPI
HTMLImgElement_get_complete(IHTMLImgElement
*iface
, VARIANT_BOOL
*p
)
343 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
344 FIXME("(%p)->(%p)\n", This
, p
);
348 static HRESULT WINAPI
HTMLImgElement_put_loop(IHTMLImgElement
*iface
, VARIANT v
)
350 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
351 FIXME("(%p)->()\n", This
);
355 static HRESULT WINAPI
HTMLImgElement_get_loop(IHTMLImgElement
*iface
, VARIANT
*p
)
357 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
358 FIXME("(%p)->(%p)\n", This
, p
);
362 static HRESULT WINAPI
HTMLImgElement_put_align(IHTMLImgElement
*iface
, BSTR v
)
364 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
365 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
369 static HRESULT WINAPI
HTMLImgElement_get_align(IHTMLImgElement
*iface
, BSTR
*p
)
371 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
372 FIXME("(%p)->(%p)\n", This
, p
);
376 static HRESULT WINAPI
HTMLImgElement_put_onload(IHTMLImgElement
*iface
, VARIANT v
)
378 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
379 FIXME("(%p)->()\n", This
);
383 static HRESULT WINAPI
HTMLImgElement_get_onload(IHTMLImgElement
*iface
, VARIANT
*p
)
385 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
386 FIXME("(%p)->(%p)\n", This
, p
);
390 static HRESULT WINAPI
HTMLImgElement_put_onerror(IHTMLImgElement
*iface
, VARIANT v
)
392 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
393 FIXME("(%p)->()\n", This
);
397 static HRESULT WINAPI
HTMLImgElement_get_onerror(IHTMLImgElement
*iface
, VARIANT
*p
)
399 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
400 FIXME("(%p)->(%p)\n", This
, p
);
404 static HRESULT WINAPI
HTMLImgElement_put_onabort(IHTMLImgElement
*iface
, VARIANT v
)
406 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
407 FIXME("(%p)->()\n", This
);
411 static HRESULT WINAPI
HTMLImgElement_get_onabort(IHTMLImgElement
*iface
, VARIANT
*p
)
413 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
414 FIXME("(%p)->(%p)\n", This
, p
);
418 static HRESULT WINAPI
HTMLImgElement_put_name(IHTMLImgElement
*iface
, BSTR v
)
420 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
421 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
425 static HRESULT WINAPI
HTMLImgElement_get_name(IHTMLImgElement
*iface
, BSTR
*p
)
427 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
428 FIXME("(%p)->(%p)\n", This
, p
);
432 static HRESULT WINAPI
HTMLImgElement_put_width(IHTMLImgElement
*iface
, long v
)
434 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
435 FIXME("(%p)->(%ld)\n", This
, v
);
439 static HRESULT WINAPI
HTMLImgElement_get_width(IHTMLImgElement
*iface
, long *p
)
441 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
442 FIXME("(%p)->(%p)\n", This
, p
);
446 static HRESULT WINAPI
HTMLImgElement_put_height(IHTMLImgElement
*iface
, long v
)
448 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
449 FIXME("(%p)->(%ld)\n", This
, v
);
453 static HRESULT WINAPI
HTMLImgElement_get_height(IHTMLImgElement
*iface
, long *p
)
455 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
456 FIXME("(%p)->(%p)\n", This
, p
);
460 static HRESULT WINAPI
HTMLImgElement_put_start(IHTMLImgElement
*iface
, BSTR v
)
462 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
463 FIXME("(%p)->()\n", This
);
467 static HRESULT WINAPI
HTMLImgElement_get_start(IHTMLImgElement
*iface
, BSTR
*p
)
469 HTMLImgElement
*This
= HTMLIMG_THIS(iface
);
470 FIXME("(%p)->(%p)\n", This
, p
);
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
534 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
536 static HRESULT
HTMLImgElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
538 HTMLImgElement
*This
= HTMLIMG_NODE_THIS(iface
);
542 if(IsEqualGUID(&IID_IHTMLImgElement
, riid
)) {
543 TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This
, ppv
);
544 *ppv
= HTMLIMG(This
);
546 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
549 IUnknown_AddRef((IUnknown
*)*ppv
);
553 static void HTMLImgElement_destructor(HTMLDOMNode
*iface
)
555 HTMLImgElement
*This
= HTMLIMG_NODE_THIS(iface
);
558 nsIDOMHTMLImageElement_Release(This
->nsimg
);
560 HTMLElement_destructor(&This
->element
.node
);
563 #undef HTMLIMG_NODE_THIS
565 static const NodeImplVtbl HTMLImgElementImplVtbl
= {
567 HTMLImgElement_destructor
570 static const tid_t HTMLImgElement_iface_tids
[] = {
578 static dispex_static_data_t HTMLImgElement_dispex
= {
582 HTMLImgElement_iface_tids
585 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*nselem
)
587 HTMLImgElement
*ret
= heap_alloc_zero(sizeof(HTMLImgElement
));
590 ret
->lpHTMLImgElementVtbl
= &HTMLImgElementVtbl
;
591 ret
->element
.node
.vtbl
= &HTMLImgElementImplVtbl
;
593 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLImageElement
, (void**)&ret
->nsimg
);
595 ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres
);
597 init_dispex(&ret
->element
.node
.dispex
, (IUnknown
*)HTMLIMG(ret
), &HTMLImgElement_dispex
);
598 HTMLElement_Init(&ret
->element
);
600 return &ret
->element
;