mshtml: Added noscript tag handling tests.
[wine] / dlls / mshtml / htmlinput.c
1 /*
2  * Copyright 2006 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 #include <assert.h>
21 #include <limits.h>
22
23 #define COBJMACROS
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29
30 #include "wine/debug.h"
31
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36
37 typedef struct {
38     HTMLElement element;
39
40     IHTMLInputElement IHTMLInputElement_iface;
41     IHTMLInputTextElement IHTMLInputTextElement_iface;
42
43     nsIDOMHTMLInputElement *nsinput;
44 } HTMLInputElement;
45
46 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
47 {
48     return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
49 }
50
51 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
52 {
53     return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
54 }
55
56 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
57                                                          REFIID riid, void **ppv)
58 {
59     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
60
61     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
62 }
63
64 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
65 {
66     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
67
68     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
69 }
70
71 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
72 {
73     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
74
75     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
76 }
77
78 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
79 {
80     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
81
82     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
83 }
84
85 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
86                                               LCID lcid, ITypeInfo **ppTInfo)
87 {
88     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
89
90     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
91             ppTInfo);
92 }
93
94 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
95                                                 LPOLESTR *rgszNames, UINT cNames,
96                                                 LCID lcid, DISPID *rgDispId)
97 {
98     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
99
100     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
101             cNames, lcid, rgDispId);
102 }
103
104 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
105                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
106                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
107 {
108     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
109
110     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
111             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
112 }
113
114 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
115 {
116     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
117     nsAString type_str;
118     nsresult nsres;
119
120     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
121
122     /*
123      * FIXME:
124      * On IE setting type works only on dynamically created elements before adding them to DOM tree.
125      */
126     nsAString_InitDepend(&type_str, v);
127     nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
128     nsAString_Finish(&type_str);
129     if(NS_FAILED(nsres)) {
130         ERR("SetType failed: %08x\n", nsres);
131         return E_FAIL;
132     }
133
134     return S_OK;
135 }
136
137 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
138 {
139     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
140     nsAString type_str;
141     nsresult nsres;
142
143     TRACE("(%p)->(%p)\n", This, p);
144
145     nsAString_Init(&type_str, NULL);
146     nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
147     return return_nsstr(nsres, &type_str, p);
148 }
149
150 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
151 {
152     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
153     nsAString val_str;
154     nsresult nsres;
155
156     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
157
158     nsAString_InitDepend(&val_str, v);
159     nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
160     nsAString_Finish(&val_str);
161     if(NS_FAILED(nsres))
162         ERR("SetValue failed: %08x\n", nsres);
163
164     return S_OK;
165 }
166
167 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
168 {
169     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
170     nsAString value_str;
171     nsresult nsres;
172
173     TRACE("(%p)->(%p)\n", This, p);
174
175     nsAString_Init(&value_str, NULL);
176     nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
177     return return_nsstr(nsres, &value_str, p);
178 }
179
180 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
181 {
182     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
183     nsAString name_str;
184     nsresult nsres;
185
186     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
187
188     nsAString_InitDepend(&name_str, v);
189     nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
190     nsAString_Finish(&name_str);
191     if(NS_FAILED(nsres)) {
192         ERR("SetName failed: %08x\n", nsres);
193         return E_FAIL;
194     }
195
196     return S_OK;
197 }
198
199 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
200 {
201     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
202     nsAString name_str;
203     nsresult nsres;
204
205     TRACE("(%p)->(%p)\n", This, p);
206
207     nsAString_Init(&name_str, NULL);
208     nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
209     return return_nsstr(nsres, &name_str, p);
210 }
211
212 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
213 {
214     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
215     FIXME("(%p)->(%x)\n", This, v);
216     return E_NOTIMPL;
217 }
218
219 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
220 {
221     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
222     FIXME("(%p)->(%p)\n", This, p);
223     return E_NOTIMPL;
224 }
225
226 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
227 {
228     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
229     nsresult nsres;
230
231     TRACE("(%p)->(%x)\n", This, v);
232
233     nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
234     if(NS_FAILED(nsres))
235         ERR("SetDisabled failed: %08x\n", nsres);
236
237     return S_OK;
238 }
239
240 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
241 {
242     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
243     cpp_bool disabled = FALSE;
244
245     TRACE("(%p)->(%p)\n", This, p);
246
247     nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
248
249     *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
250     return S_OK;
251 }
252
253 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
254 {
255     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
256     FIXME("(%p)->(%p)\n", This, p);
257     return E_NOTIMPL;
258 }
259
260 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
261 {
262     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
263     FIXME("(%p)->(%d)\n", This, v);
264     return E_NOTIMPL;
265 }
266
267 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
268 {
269     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
270     FIXME("(%p)->(%p)\n", This, p);
271     return E_NOTIMPL;
272 }
273
274 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
275 {
276     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
277     nsresult nsres;
278
279     TRACE("(%p)->(%d)\n", This, v);
280
281     nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
282     if(NS_FAILED(nsres)) {
283         /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
284         FIXME("SetMaxLength failed\n");
285         return E_FAIL;
286     }
287
288     return S_OK;
289 }
290
291 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
292 {
293     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
294     PRInt32 max_length;
295     nsresult nsres;
296
297     TRACE("(%p)->(%p)\n", This, p);
298
299     nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
300     assert(nsres == NS_OK);
301
302     /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
303     *p = max_length == -1 ? INT_MAX : max_length;
304     return S_OK;
305 }
306
307 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
308 {
309     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
310     nsresult nsres;
311
312     TRACE("(%p)\n", This);
313
314     nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
315     if(NS_FAILED(nsres)) {
316         ERR("Select failed: %08x\n", nsres);
317         return E_FAIL;
318     }
319
320     return S_OK;
321 }
322
323 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
324 {
325     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
326
327     TRACE("(%p)->()\n", This);
328
329     return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
330 }
331
332 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
333 {
334     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
335
336     TRACE("(%p)->(%p)\n", This, p);
337
338     return get_node_event(&This->element.node, EVENTID_CHANGE, p);
339 }
340
341 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
342 {
343     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
344     FIXME("(%p)->()\n", This);
345     return E_NOTIMPL;
346 }
347
348 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
349 {
350     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
351     FIXME("(%p)->(%p)\n", This, p);
352     return E_NOTIMPL;
353 }
354
355 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
356 {
357     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
358     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
359     return E_NOTIMPL;
360 }
361
362 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
363 {
364     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
365     FIXME("(%p)->(%p)\n", This, p);
366     return E_NOTIMPL;
367 }
368
369 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
370 {
371     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
372     FIXME("(%p)->(%x)\n", This, v);
373     return E_NOTIMPL;
374 }
375
376 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
377 {
378     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
379     FIXME("(%p)->(%p)\n", This, p);
380     return E_NOTIMPL;
381 }
382
383 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
384 {
385     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
386     FIXME("(%p)->(%p)\n", This, range);
387     return E_NOTIMPL;
388 }
389
390 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
391 {
392     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
393     FIXME("(%p)->(%x)\n", This, v);
394     return E_NOTIMPL;
395 }
396
397 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
398 {
399     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
400     FIXME("(%p)->(%p)\n", This, p);
401     return E_NOTIMPL;
402 }
403
404 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
405 {
406     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
407     nsresult nsres;
408
409     TRACE("(%p)->(%x)\n", This, v);
410
411     nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
412     if(NS_FAILED(nsres)) {
413         ERR("SetDefaultChecked failed: %08x\n", nsres);
414         return E_FAIL;
415     }
416
417     return S_OK;
418 }
419
420 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
421 {
422     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
423     cpp_bool default_checked = FALSE;
424     nsresult nsres;
425
426     TRACE("(%p)->(%p)\n", This, p);
427
428     nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
429     if(NS_FAILED(nsres)) {
430         ERR("GetDefaultChecked failed: %08x\n", nsres);
431         return E_FAIL;
432     }
433
434     *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
435     return S_OK;
436 }
437
438 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
439 {
440     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
441     nsresult nsres;
442
443     TRACE("(%p)->(%x)\n", This, v);
444
445     nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
446     if(NS_FAILED(nsres)) {
447         ERR("SetChecked failed: %08x\n", nsres);
448         return E_FAIL;
449     }
450
451     return S_OK;
452 }
453
454 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
455 {
456     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
457     cpp_bool checked;
458     nsresult nsres;
459
460     TRACE("(%p)->(%p)\n", This, p);
461
462     nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
463     if(NS_FAILED(nsres)) {
464         ERR("GetChecked failed: %08x\n", nsres);
465         return E_FAIL;
466     }
467
468     *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
469     TRACE("checked=%x\n", *p);
470     return S_OK;
471 }
472
473 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
474 {
475     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
476     FIXME("(%p)->()\n", This);
477     return E_NOTIMPL;
478 }
479
480 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
481 {
482     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
483     FIXME("(%p)->(%p)\n", This, p);
484     return E_NOTIMPL;
485 }
486
487 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
488 {
489     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
490     FIXME("(%p)->(%d)\n", This, v);
491     return E_NOTIMPL;
492 }
493
494 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
495 {
496     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
497     FIXME("(%p)->(%p)\n", This, p);
498     return E_NOTIMPL;
499 }
500
501 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
502 {
503     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
504     FIXME("(%p)->(%d)\n", This, v);
505     return E_NOTIMPL;
506 }
507
508 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
509 {
510     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
511     FIXME("(%p)->(%p)\n", This, p);
512     return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
516 {
517     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
518     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
519     return E_NOTIMPL;
520 }
521
522 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
523 {
524     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
525     FIXME("(%p)->(%p)\n", This, p);
526     return E_NOTIMPL;
527 }
528
529 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
530 {
531     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
532     nsAString nsstr;
533     nsresult nsres;
534
535     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
536
537     nsAString_InitDepend(&nsstr, v);
538     nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
539     nsAString_Finish(&nsstr);
540     if(NS_FAILED(nsres))
541         ERR("SetSrc failed: %08x\n", nsres);
542
543     return S_OK;
544 }
545
546 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
547 {
548     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
549     const PRUnichar *src;
550     nsAString src_str;
551     nsresult nsres;
552     HRESULT hres;
553
554     TRACE("(%p)->(%p)\n", This, p);
555
556     nsAString_Init(&src_str, NULL);
557     nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
558     if(NS_FAILED(nsres)) {
559         ERR("GetSrc failed: %08x\n", nsres);
560         return E_FAIL;
561     }
562
563     nsAString_GetData(&src_str, &src);
564     hres = nsuri_to_url(src, FALSE, p);
565     nsAString_Finish(&src_str);
566
567     return hres;
568 }
569
570 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
571 {
572     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
573     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
574     return E_NOTIMPL;
575 }
576
577 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
578 {
579     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
580     FIXME("(%p)->(%p)\n", This, p);
581     return E_NOTIMPL;
582 }
583
584 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
585 {
586     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
587     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
588     return E_NOTIMPL;
589 }
590
591 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
592 {
593     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
594     FIXME("(%p)->(%p)\n", This, p);
595     return E_NOTIMPL;
596 }
597
598 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
599 {
600     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
601     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
602     return E_NOTIMPL;
603 }
604
605 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
606 {
607     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
608     FIXME("(%p)->(%p)\n", This, p);
609     return E_NOTIMPL;
610 }
611
612 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
613 {
614     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
615     FIXME("(%p)->(%p)\n", This, p);
616     return E_NOTIMPL;
617 }
618
619 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
620 {
621     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
622     FIXME("(%p)->(%p)\n", This, p);
623     return E_NOTIMPL;
624 }
625
626 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
627 {
628     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
629     FIXME("(%p)->()\n", This);
630     return E_NOTIMPL;
631 }
632
633 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
634 {
635     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
636     FIXME("(%p)->(%p)\n", This, p);
637     return E_NOTIMPL;
638 }
639
640 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
641 {
642     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
643     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
644     return E_NOTIMPL;
645 }
646
647 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
648 {
649     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
650     FIXME("(%p)->(%p)\n", This, p);
651     return E_NOTIMPL;
652 }
653
654 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
655 {
656     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
657     FIXME("(%p)->()\n", This);
658     return E_NOTIMPL;
659 }
660
661 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
662 {
663     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
664     FIXME("(%p)->(%p)\n", This, p);
665     return E_NOTIMPL;
666 }
667
668 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
669 {
670     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
671     FIXME("(%p)->()\n", This);
672     return E_NOTIMPL;
673 }
674
675 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
676 {
677     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
678     FIXME("(%p)->(%p)\n", This, p);
679     return E_NOTIMPL;
680 }
681
682 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
683 {
684     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
685     FIXME("(%p)->()\n", This);
686     return E_NOTIMPL;
687 }
688
689 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
690 {
691     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
692     FIXME("(%p)->(%p)\n", This, p);
693     return E_NOTIMPL;
694 }
695
696 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
697 {
698     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
699     FIXME("(%p)->(%d)\n", This, v);
700     return E_NOTIMPL;
701 }
702
703 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
704 {
705     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
706     FIXME("(%p)->(%p)\n", This, p);
707     return E_NOTIMPL;
708 }
709
710 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
711 {
712     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
713     FIXME("(%p)->(%d)\n", This, v);
714     return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
718 {
719     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
720     FIXME("(%p)->(%p)\n", This, p);
721     return E_NOTIMPL;
722 }
723
724 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
725 {
726     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
727     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
728     return E_NOTIMPL;
729 }
730
731 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
732 {
733     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
734     FIXME("(%p)->(%p)\n", This, p);
735     return E_NOTIMPL;
736 }
737
738 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
739     HTMLInputElement_QueryInterface,
740     HTMLInputElement_AddRef,
741     HTMLInputElement_Release,
742     HTMLInputElement_GetTypeInfoCount,
743     HTMLInputElement_GetTypeInfo,
744     HTMLInputElement_GetIDsOfNames,
745     HTMLInputElement_Invoke,
746     HTMLInputElement_put_type,
747     HTMLInputElement_get_type,
748     HTMLInputElement_put_value,
749     HTMLInputElement_get_value,
750     HTMLInputElement_put_name,
751     HTMLInputElement_get_name,
752     HTMLInputElement_put_status,
753     HTMLInputElement_get_status,
754     HTMLInputElement_put_disabled,
755     HTMLInputElement_get_disabled,
756     HTMLInputElement_get_form,
757     HTMLInputElement_put_size,
758     HTMLInputElement_get_size,
759     HTMLInputElement_put_maxLength,
760     HTMLInputElement_get_maxLength,
761     HTMLInputElement_select,
762     HTMLInputElement_put_onchange,
763     HTMLInputElement_get_onchange,
764     HTMLInputElement_put_onselect,
765     HTMLInputElement_get_onselect,
766     HTMLInputElement_put_defaultValue,
767     HTMLInputElement_get_defaultValue,
768     HTMLInputElement_put_readOnly,
769     HTMLInputElement_get_readOnly,
770     HTMLInputElement_createTextRange,
771     HTMLInputElement_put_indeterminate,
772     HTMLInputElement_get_indeterminate,
773     HTMLInputElement_put_defaultChecked,
774     HTMLInputElement_get_defaultChecked,
775     HTMLInputElement_put_checked,
776     HTMLInputElement_get_checked,
777     HTMLInputElement_put_border,
778     HTMLInputElement_get_border,
779     HTMLInputElement_put_vspace,
780     HTMLInputElement_get_vspace,
781     HTMLInputElement_put_hspace,
782     HTMLInputElement_get_hspace,
783     HTMLInputElement_put_alt,
784     HTMLInputElement_get_alt,
785     HTMLInputElement_put_src,
786     HTMLInputElement_get_src,
787     HTMLInputElement_put_lowsrc,
788     HTMLInputElement_get_lowsrc,
789     HTMLInputElement_put_vrml,
790     HTMLInputElement_get_vrml,
791     HTMLInputElement_put_dynsrc,
792     HTMLInputElement_get_dynsrc,
793     HTMLInputElement_get_readyState,
794     HTMLInputElement_get_complete,
795     HTMLInputElement_put_loop,
796     HTMLInputElement_get_loop,
797     HTMLInputElement_put_align,
798     HTMLInputElement_get_align,
799     HTMLInputElement_put_onload,
800     HTMLInputElement_get_onload,
801     HTMLInputElement_put_onerror,
802     HTMLInputElement_get_onerror,
803     HTMLInputElement_put_onabort,
804     HTMLInputElement_get_onabort,
805     HTMLInputElement_put_width,
806     HTMLInputElement_get_width,
807     HTMLInputElement_put_height,
808     HTMLInputElement_get_height,
809     HTMLInputElement_put_start,
810     HTMLInputElement_get_start
811 };
812
813 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
814         REFIID riid, void **ppv)
815 {
816     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
817
818     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
819 }
820
821 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
822 {
823     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
824
825     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
826 }
827
828 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
829 {
830     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
831
832     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
833 }
834
835 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
836 {
837     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
838     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
839 }
840
841 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
842         LCID lcid, ITypeInfo **ppTInfo)
843 {
844     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
845     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
846             ppTInfo);
847 }
848
849 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
850         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
851 {
852     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
853     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
854             cNames, lcid, rgDispId);
855 }
856
857 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
858                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
859                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
860 {
861     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
862     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
863             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
864 }
865
866 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
867 {
868     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
869
870     TRACE("(%p)->(%p)\n", This, p);
871
872     return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
873 }
874
875 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
876 {
877     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
878
879     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
880
881     return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
882 }
883
884 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
885 {
886     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
887
888     TRACE("(%p)->(%p)\n", This, p);
889
890     return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
891 }
892
893 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
894 {
895     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
896
897     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
898
899     return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
900 }
901
902 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
903 {
904     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
905
906     TRACE("(%p)->(%p)\n", This, p);
907
908     return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
909 }
910
911 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
912 {
913     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
914     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
915     return E_NOTIMPL;
916 }
917
918 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
919 {
920     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
921     TRACE("(%p)->(%p)\n", This, p);
922     return E_NOTIMPL;
923 }
924
925 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
926 {
927     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
928
929     TRACE("(%p)->(%x)\n", This, v);
930
931     return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
932 }
933
934 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
935 {
936     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
937
938     TRACE("(%p)->(%p)\n", This, p);
939
940     return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
941 }
942
943 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
944 {
945     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
946
947     TRACE("(%p)->(%p)\n", This, p);
948
949     return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
950 }
951
952 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
953 {
954     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
955
956     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
957
958     return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
959 }
960
961 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
962 {
963     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
964
965     TRACE("(%p)->(%p)\n", This, p);
966
967     return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
968 }
969
970 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
971 {
972     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
973
974     TRACE("(%p)->(%d)\n", This, v);
975
976     return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
977 }
978
979 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
980 {
981     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
982
983     TRACE("(%p)->(%p)\n", This, p);
984
985     return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
986 }
987
988 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
989 {
990     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
991
992     TRACE("(%p)->(%d)\n", This, v);
993
994     return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
995 }
996
997 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
998 {
999     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1000
1001     TRACE("(%p)->(%p)\n", This, p);
1002
1003     return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1004 }
1005
1006 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1007 {
1008     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1009
1010     TRACE("(%p)\n", This);
1011
1012     return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1013 }
1014
1015 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1016 {
1017     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1018
1019     TRACE("(%p)->()\n", This);
1020
1021     return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1022 }
1023
1024 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1025 {
1026     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1027
1028     TRACE("(%p)->(%p)\n", This, p);
1029
1030     return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1031 }
1032
1033 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1034 {
1035     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1036
1037     TRACE("(%p)->()\n", This);
1038
1039     return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1040 }
1041
1042 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1043 {
1044     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1045
1046     TRACE("(%p)->(%p)\n", This, p);
1047
1048     return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1049 }
1050
1051 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1052 {
1053     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1054
1055     TRACE("(%p)->(%x)\n", This, v);
1056
1057     return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1058 }
1059
1060 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1061 {
1062     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1063
1064     TRACE("(%p)->(%p)\n", This, p);
1065
1066     return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1067 }
1068
1069 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1070 {
1071     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1072
1073     TRACE("(%p)->(%p)\n", This, range);
1074
1075     return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1076 }
1077
1078 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1079     HTMLInputTextElement_QueryInterface,
1080     HTMLInputTextElement_AddRef,
1081     HTMLInputTextElement_Release,
1082     HTMLInputTextElement_GetTypeInfoCount,
1083     HTMLInputTextElement_GetTypeInfo,
1084     HTMLInputTextElement_GetIDsOfNames,
1085     HTMLInputTextElement_Invoke,
1086     HTMLInputTextElement_get_type,
1087     HTMLInputTextElement_put_value,
1088     HTMLInputTextElement_get_value,
1089     HTMLInputTextElement_put_name,
1090     HTMLInputTextElement_get_name,
1091     HTMLInputTextElement_put_status,
1092     HTMLInputTextElement_get_status,
1093     HTMLInputTextElement_put_disabled,
1094     HTMLInputTextElement_get_disabled,
1095     HTMLInputTextElement_get_form,
1096     HTMLInputTextElement_put_defaultValue,
1097     HTMLInputTextElement_get_defaultValue,
1098     HTMLInputTextElement_put_size,
1099     HTMLInputTextElement_get_size,
1100     HTMLInputTextElement_put_maxLength,
1101     HTMLInputTextElement_get_maxLength,
1102     HTMLInputTextElement_select,
1103     HTMLInputTextElement_put_onchange,
1104     HTMLInputTextElement_get_onchange,
1105     HTMLInputTextElement_put_onselect,
1106     HTMLInputTextElement_get_onselect,
1107     HTMLInputTextElement_put_readOnly,
1108     HTMLInputTextElement_get_readOnly,
1109     HTMLInputTextElement_createTextRange
1110 };
1111
1112 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1113 {
1114     return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1115 }
1116
1117 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1118 {
1119     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1120
1121     *ppv = NULL;
1122
1123     if(IsEqualGUID(&IID_IUnknown, riid)) {
1124         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1125         *ppv = &This->IHTMLInputElement_iface;
1126     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1127         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1128         *ppv = &This->IHTMLInputElement_iface;
1129     }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1130         TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1131         *ppv = &This->IHTMLInputElement_iface;
1132     }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1133         TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1134         *ppv = &This->IHTMLInputTextElement_iface;
1135     }
1136
1137     if(*ppv) {
1138         IUnknown_AddRef((IUnknown*)*ppv);
1139         return S_OK;
1140     }
1141
1142     return HTMLElement_QI(&This->element.node, riid, ppv);
1143 }
1144
1145 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1146 {
1147     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1148
1149     if(eid == EVENTID_CLICK) {
1150         nsresult nsres;
1151
1152         *handled = TRUE;
1153
1154         nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1155         if(NS_FAILED(nsres)) {
1156             ERR("Click failed: %08x\n", nsres);
1157             return E_FAIL;
1158         }
1159     }
1160
1161     return S_OK;
1162 }
1163
1164 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1165 {
1166     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1167     return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1168 }
1169
1170 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1171 {
1172     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1173     return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1174 }
1175
1176 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1177     HTMLInputElement_QI,
1178     HTMLElement_destructor,
1179     HTMLElement_clone,
1180     HTMLElement_handle_event,
1181     HTMLElement_get_attr_col,
1182     NULL,
1183     HTMLInputElementImpl_fire_event,
1184     HTMLInputElementImpl_put_disabled,
1185     HTMLInputElementImpl_get_disabled,
1186 };
1187
1188 static const tid_t HTMLInputElement_iface_tids[] = {
1189     HTMLELEMENT_TIDS,
1190     IHTMLInputElement_tid,
1191     0
1192 };
1193 static dispex_static_data_t HTMLInputElement_dispex = {
1194     NULL,
1195     DispHTMLInputElement_tid,
1196     NULL,
1197     HTMLInputElement_iface_tids
1198 };
1199
1200 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1201 {
1202     HTMLInputElement *ret;
1203     nsresult nsres;
1204
1205     ret = heap_alloc_zero(sizeof(HTMLInputElement));
1206     if(!ret)
1207         return E_OUTOFMEMORY;
1208
1209     ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1210     ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1211     ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1212
1213     HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1214
1215     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1216
1217     /* Share nsinput reference with nsnode */
1218     assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1219     nsIDOMNode_Release(ret->element.node.nsnode);
1220
1221     *elem = &ret->element;
1222     return S_OK;
1223 }