atl80: Added AtlComModuleRegisterServer implementation (based on AtlModuleRegisterSer...
[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     nsAString nsstr;
359     nsresult nsres;
360
361     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
362
363     nsAString_InitDepend(&nsstr, v);
364     nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
365     nsAString_Finish(&nsstr);
366     if(NS_FAILED(nsres)) {
367         ERR("SetValue failed: %08x\n", nsres);
368         return E_FAIL;
369     }
370
371     return S_OK;
372 }
373
374 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
375 {
376     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
377     nsAString nsstr;
378     nsresult nsres;
379
380     TRACE("(%p)->(%p)\n", This, p);
381
382     nsAString_Init(&nsstr, NULL);
383     nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
384     return return_nsstr(nsres, &nsstr, p);
385 }
386
387 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
388 {
389     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
390     FIXME("(%p)->(%x)\n", This, v);
391     return E_NOTIMPL;
392 }
393
394 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
395 {
396     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
397     FIXME("(%p)->(%p)\n", This, p);
398     return E_NOTIMPL;
399 }
400
401 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
402 {
403     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
404     FIXME("(%p)->(%p)\n", This, range);
405     return E_NOTIMPL;
406 }
407
408 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
409 {
410     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
411     FIXME("(%p)->(%x)\n", This, v);
412     return E_NOTIMPL;
413 }
414
415 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
416 {
417     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
418     FIXME("(%p)->(%p)\n", This, p);
419     return E_NOTIMPL;
420 }
421
422 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
423 {
424     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
425     nsresult nsres;
426
427     TRACE("(%p)->(%x)\n", This, v);
428
429     nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
430     if(NS_FAILED(nsres)) {
431         ERR("SetDefaultChecked failed: %08x\n", nsres);
432         return E_FAIL;
433     }
434
435     return S_OK;
436 }
437
438 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
439 {
440     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
441     cpp_bool default_checked = FALSE;
442     nsresult nsres;
443
444     TRACE("(%p)->(%p)\n", This, p);
445
446     nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
447     if(NS_FAILED(nsres)) {
448         ERR("GetDefaultChecked failed: %08x\n", nsres);
449         return E_FAIL;
450     }
451
452     *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
453     return S_OK;
454 }
455
456 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
457 {
458     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
459     nsresult nsres;
460
461     TRACE("(%p)->(%x)\n", This, v);
462
463     nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
464     if(NS_FAILED(nsres)) {
465         ERR("SetChecked failed: %08x\n", nsres);
466         return E_FAIL;
467     }
468
469     return S_OK;
470 }
471
472 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
473 {
474     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
475     cpp_bool checked;
476     nsresult nsres;
477
478     TRACE("(%p)->(%p)\n", This, p);
479
480     nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
481     if(NS_FAILED(nsres)) {
482         ERR("GetChecked failed: %08x\n", nsres);
483         return E_FAIL;
484     }
485
486     *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
487     TRACE("checked=%x\n", *p);
488     return S_OK;
489 }
490
491 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
492 {
493     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
494     FIXME("(%p)->()\n", This);
495     return E_NOTIMPL;
496 }
497
498 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
499 {
500     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
501     FIXME("(%p)->(%p)\n", This, p);
502     return E_NOTIMPL;
503 }
504
505 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
506 {
507     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
508     FIXME("(%p)->(%d)\n", This, v);
509     return E_NOTIMPL;
510 }
511
512 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
513 {
514     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
515     FIXME("(%p)->(%p)\n", This, p);
516     return E_NOTIMPL;
517 }
518
519 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
520 {
521     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
522     FIXME("(%p)->(%d)\n", This, v);
523     return E_NOTIMPL;
524 }
525
526 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
527 {
528     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
529     FIXME("(%p)->(%p)\n", This, p);
530     return E_NOTIMPL;
531 }
532
533 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
534 {
535     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
536     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
537     return E_NOTIMPL;
538 }
539
540 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
541 {
542     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
543     FIXME("(%p)->(%p)\n", This, p);
544     return E_NOTIMPL;
545 }
546
547 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
548 {
549     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
550     nsAString nsstr;
551     nsresult nsres;
552
553     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
554
555     nsAString_InitDepend(&nsstr, v);
556     nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
557     nsAString_Finish(&nsstr);
558     if(NS_FAILED(nsres))
559         ERR("SetSrc failed: %08x\n", nsres);
560
561     return S_OK;
562 }
563
564 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
565 {
566     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
567     const PRUnichar *src;
568     nsAString src_str;
569     nsresult nsres;
570     HRESULT hres;
571
572     TRACE("(%p)->(%p)\n", This, p);
573
574     nsAString_Init(&src_str, NULL);
575     nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
576     if(NS_FAILED(nsres)) {
577         ERR("GetSrc failed: %08x\n", nsres);
578         return E_FAIL;
579     }
580
581     nsAString_GetData(&src_str, &src);
582     hres = nsuri_to_url(src, FALSE, p);
583     nsAString_Finish(&src_str);
584
585     return hres;
586 }
587
588 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
589 {
590     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
591     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
592     return E_NOTIMPL;
593 }
594
595 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
596 {
597     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
598     FIXME("(%p)->(%p)\n", This, p);
599     return E_NOTIMPL;
600 }
601
602 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
603 {
604     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
605     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
606     return E_NOTIMPL;
607 }
608
609 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
610 {
611     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
612     FIXME("(%p)->(%p)\n", This, p);
613     return E_NOTIMPL;
614 }
615
616 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
617 {
618     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
619     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
620     return E_NOTIMPL;
621 }
622
623 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
624 {
625     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
626     FIXME("(%p)->(%p)\n", This, p);
627     return E_NOTIMPL;
628 }
629
630 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
631 {
632     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
633     FIXME("(%p)->(%p)\n", This, p);
634     return E_NOTIMPL;
635 }
636
637 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
638 {
639     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
640     FIXME("(%p)->(%p)\n", This, p);
641     return E_NOTIMPL;
642 }
643
644 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
645 {
646     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
647     FIXME("(%p)->()\n", This);
648     return E_NOTIMPL;
649 }
650
651 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
652 {
653     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
654     FIXME("(%p)->(%p)\n", This, p);
655     return E_NOTIMPL;
656 }
657
658 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
659 {
660     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
661     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
662     return E_NOTIMPL;
663 }
664
665 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
666 {
667     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
668     FIXME("(%p)->(%p)\n", This, p);
669     return E_NOTIMPL;
670 }
671
672 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
673 {
674     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
675     FIXME("(%p)->()\n", This);
676     return E_NOTIMPL;
677 }
678
679 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
680 {
681     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
682     FIXME("(%p)->(%p)\n", This, p);
683     return E_NOTIMPL;
684 }
685
686 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
687 {
688     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
689     FIXME("(%p)->()\n", This);
690     return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
694 {
695     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
696     FIXME("(%p)->(%p)\n", This, p);
697     return E_NOTIMPL;
698 }
699
700 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
701 {
702     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
703     FIXME("(%p)->()\n", This);
704     return E_NOTIMPL;
705 }
706
707 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
708 {
709     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
710     FIXME("(%p)->(%p)\n", This, p);
711     return E_NOTIMPL;
712 }
713
714 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
715 {
716     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
717     FIXME("(%p)->(%d)\n", This, v);
718     return E_NOTIMPL;
719 }
720
721 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
722 {
723     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
724     FIXME("(%p)->(%p)\n", This, p);
725     return E_NOTIMPL;
726 }
727
728 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
729 {
730     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
731     FIXME("(%p)->(%d)\n", This, v);
732     return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
736 {
737     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
738     FIXME("(%p)->(%p)\n", This, p);
739     return E_NOTIMPL;
740 }
741
742 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
743 {
744     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
745     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
746     return E_NOTIMPL;
747 }
748
749 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
750 {
751     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
752     FIXME("(%p)->(%p)\n", This, p);
753     return E_NOTIMPL;
754 }
755
756 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
757     HTMLInputElement_QueryInterface,
758     HTMLInputElement_AddRef,
759     HTMLInputElement_Release,
760     HTMLInputElement_GetTypeInfoCount,
761     HTMLInputElement_GetTypeInfo,
762     HTMLInputElement_GetIDsOfNames,
763     HTMLInputElement_Invoke,
764     HTMLInputElement_put_type,
765     HTMLInputElement_get_type,
766     HTMLInputElement_put_value,
767     HTMLInputElement_get_value,
768     HTMLInputElement_put_name,
769     HTMLInputElement_get_name,
770     HTMLInputElement_put_status,
771     HTMLInputElement_get_status,
772     HTMLInputElement_put_disabled,
773     HTMLInputElement_get_disabled,
774     HTMLInputElement_get_form,
775     HTMLInputElement_put_size,
776     HTMLInputElement_get_size,
777     HTMLInputElement_put_maxLength,
778     HTMLInputElement_get_maxLength,
779     HTMLInputElement_select,
780     HTMLInputElement_put_onchange,
781     HTMLInputElement_get_onchange,
782     HTMLInputElement_put_onselect,
783     HTMLInputElement_get_onselect,
784     HTMLInputElement_put_defaultValue,
785     HTMLInputElement_get_defaultValue,
786     HTMLInputElement_put_readOnly,
787     HTMLInputElement_get_readOnly,
788     HTMLInputElement_createTextRange,
789     HTMLInputElement_put_indeterminate,
790     HTMLInputElement_get_indeterminate,
791     HTMLInputElement_put_defaultChecked,
792     HTMLInputElement_get_defaultChecked,
793     HTMLInputElement_put_checked,
794     HTMLInputElement_get_checked,
795     HTMLInputElement_put_border,
796     HTMLInputElement_get_border,
797     HTMLInputElement_put_vspace,
798     HTMLInputElement_get_vspace,
799     HTMLInputElement_put_hspace,
800     HTMLInputElement_get_hspace,
801     HTMLInputElement_put_alt,
802     HTMLInputElement_get_alt,
803     HTMLInputElement_put_src,
804     HTMLInputElement_get_src,
805     HTMLInputElement_put_lowsrc,
806     HTMLInputElement_get_lowsrc,
807     HTMLInputElement_put_vrml,
808     HTMLInputElement_get_vrml,
809     HTMLInputElement_put_dynsrc,
810     HTMLInputElement_get_dynsrc,
811     HTMLInputElement_get_readyState,
812     HTMLInputElement_get_complete,
813     HTMLInputElement_put_loop,
814     HTMLInputElement_get_loop,
815     HTMLInputElement_put_align,
816     HTMLInputElement_get_align,
817     HTMLInputElement_put_onload,
818     HTMLInputElement_get_onload,
819     HTMLInputElement_put_onerror,
820     HTMLInputElement_get_onerror,
821     HTMLInputElement_put_onabort,
822     HTMLInputElement_get_onabort,
823     HTMLInputElement_put_width,
824     HTMLInputElement_get_width,
825     HTMLInputElement_put_height,
826     HTMLInputElement_get_height,
827     HTMLInputElement_put_start,
828     HTMLInputElement_get_start
829 };
830
831 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
832         REFIID riid, void **ppv)
833 {
834     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
835
836     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
837 }
838
839 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
840 {
841     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
842
843     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
844 }
845
846 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
847 {
848     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
849
850     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
851 }
852
853 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
854 {
855     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
856     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
857 }
858
859 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
860         LCID lcid, ITypeInfo **ppTInfo)
861 {
862     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
863     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
864             ppTInfo);
865 }
866
867 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
868         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
869 {
870     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
871     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
872             cNames, lcid, rgDispId);
873 }
874
875 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
876                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
877                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
878 {
879     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
880     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
881             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
882 }
883
884 static HRESULT WINAPI HTMLInputTextElement_get_type(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_type(&This->IHTMLInputElement_iface, p);
891 }
892
893 static HRESULT WINAPI HTMLInputTextElement_put_value(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_value(&This->IHTMLInputElement_iface, v);
900 }
901
902 static HRESULT WINAPI HTMLInputTextElement_get_value(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_value(&This->IHTMLInputElement_iface, p);
909 }
910
911 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
912 {
913     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
914
915     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
916
917     return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
918 }
919
920 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
921 {
922     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
923
924     TRACE("(%p)->(%p)\n", This, p);
925
926     return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
927 }
928
929 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
930 {
931     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
932     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
933     return E_NOTIMPL;
934 }
935
936 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
937 {
938     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
939     TRACE("(%p)->(%p)\n", This, p);
940     return E_NOTIMPL;
941 }
942
943 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
944 {
945     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
946
947     TRACE("(%p)->(%x)\n", This, v);
948
949     return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
950 }
951
952 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
953 {
954     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
955
956     TRACE("(%p)->(%p)\n", This, p);
957
958     return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
959 }
960
961 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
962 {
963     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
964
965     TRACE("(%p)->(%p)\n", This, p);
966
967     return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
968 }
969
970 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
971 {
972     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
973
974     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
975
976     return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
977 }
978
979 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
980 {
981     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
982
983     TRACE("(%p)->(%p)\n", This, p);
984
985     return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
986 }
987
988 static HRESULT WINAPI HTMLInputTextElement_put_size(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_size(&This->IHTMLInputElement_iface, v);
995 }
996
997 static HRESULT WINAPI HTMLInputTextElement_get_size(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_size(&This->IHTMLInputElement_iface, p);
1004 }
1005
1006 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1007 {
1008     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1009
1010     TRACE("(%p)->(%d)\n", This, v);
1011
1012     return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1013 }
1014
1015 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1016 {
1017     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1018
1019     TRACE("(%p)->(%p)\n", This, p);
1020
1021     return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1022 }
1023
1024 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1025 {
1026     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1027
1028     TRACE("(%p)\n", This);
1029
1030     return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1031 }
1032
1033 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1034 {
1035     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1036
1037     TRACE("(%p)->()\n", This);
1038
1039     return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1040 }
1041
1042 static HRESULT WINAPI HTMLInputTextElement_get_onchange(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_onchange(&This->IHTMLInputElement_iface, p);
1049 }
1050
1051 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1052 {
1053     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1054
1055     TRACE("(%p)->()\n", This);
1056
1057     return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1058 }
1059
1060 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1061 {
1062     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1063
1064     TRACE("(%p)->(%p)\n", This, p);
1065
1066     return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1067 }
1068
1069 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1070 {
1071     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1072
1073     TRACE("(%p)->(%x)\n", This, v);
1074
1075     return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1076 }
1077
1078 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1079 {
1080     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1081
1082     TRACE("(%p)->(%p)\n", This, p);
1083
1084     return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1085 }
1086
1087 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1088 {
1089     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1090
1091     TRACE("(%p)->(%p)\n", This, range);
1092
1093     return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1094 }
1095
1096 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1097     HTMLInputTextElement_QueryInterface,
1098     HTMLInputTextElement_AddRef,
1099     HTMLInputTextElement_Release,
1100     HTMLInputTextElement_GetTypeInfoCount,
1101     HTMLInputTextElement_GetTypeInfo,
1102     HTMLInputTextElement_GetIDsOfNames,
1103     HTMLInputTextElement_Invoke,
1104     HTMLInputTextElement_get_type,
1105     HTMLInputTextElement_put_value,
1106     HTMLInputTextElement_get_value,
1107     HTMLInputTextElement_put_name,
1108     HTMLInputTextElement_get_name,
1109     HTMLInputTextElement_put_status,
1110     HTMLInputTextElement_get_status,
1111     HTMLInputTextElement_put_disabled,
1112     HTMLInputTextElement_get_disabled,
1113     HTMLInputTextElement_get_form,
1114     HTMLInputTextElement_put_defaultValue,
1115     HTMLInputTextElement_get_defaultValue,
1116     HTMLInputTextElement_put_size,
1117     HTMLInputTextElement_get_size,
1118     HTMLInputTextElement_put_maxLength,
1119     HTMLInputTextElement_get_maxLength,
1120     HTMLInputTextElement_select,
1121     HTMLInputTextElement_put_onchange,
1122     HTMLInputTextElement_get_onchange,
1123     HTMLInputTextElement_put_onselect,
1124     HTMLInputTextElement_get_onselect,
1125     HTMLInputTextElement_put_readOnly,
1126     HTMLInputTextElement_get_readOnly,
1127     HTMLInputTextElement_createTextRange
1128 };
1129
1130 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1131 {
1132     return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1133 }
1134
1135 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1136 {
1137     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1138
1139     *ppv = NULL;
1140
1141     if(IsEqualGUID(&IID_IUnknown, riid)) {
1142         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1143         *ppv = &This->IHTMLInputElement_iface;
1144     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1145         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1146         *ppv = &This->IHTMLInputElement_iface;
1147     }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1148         TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1149         *ppv = &This->IHTMLInputElement_iface;
1150     }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1151         TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1152         *ppv = &This->IHTMLInputTextElement_iface;
1153     }
1154
1155     if(*ppv) {
1156         IUnknown_AddRef((IUnknown*)*ppv);
1157         return S_OK;
1158     }
1159
1160     return HTMLElement_QI(&This->element.node, riid, ppv);
1161 }
1162
1163 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1164 {
1165     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1166
1167     if(eid == EVENTID_CLICK) {
1168         nsresult nsres;
1169
1170         *handled = TRUE;
1171
1172         nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1173         if(NS_FAILED(nsres)) {
1174             ERR("Click failed: %08x\n", nsres);
1175             return E_FAIL;
1176         }
1177     }
1178
1179     return S_OK;
1180 }
1181
1182 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1183 {
1184     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1185     return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1186 }
1187
1188 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1189 {
1190     HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1191     return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1192 }
1193
1194 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1195     HTMLInputElement_QI,
1196     HTMLElement_destructor,
1197     HTMLElement_clone,
1198     HTMLElement_handle_event,
1199     HTMLElement_get_attr_col,
1200     NULL,
1201     HTMLInputElementImpl_fire_event,
1202     HTMLInputElementImpl_put_disabled,
1203     HTMLInputElementImpl_get_disabled,
1204 };
1205
1206 static const tid_t HTMLInputElement_iface_tids[] = {
1207     HTMLELEMENT_TIDS,
1208     IHTMLInputElement_tid,
1209     0
1210 };
1211 static dispex_static_data_t HTMLInputElement_dispex = {
1212     NULL,
1213     DispHTMLInputElement_tid,
1214     NULL,
1215     HTMLInputElement_iface_tids
1216 };
1217
1218 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1219 {
1220     HTMLInputElement *ret;
1221     nsresult nsres;
1222
1223     ret = heap_alloc_zero(sizeof(HTMLInputElement));
1224     if(!ret)
1225         return E_OUTOFMEMORY;
1226
1227     ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1228     ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1229     ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1230
1231     HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1232
1233     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1234
1235     /* Share nsinput reference with nsnode */
1236     assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1237     nsIDOMNode_Release(ret->element.node.nsnode);
1238
1239     *elem = &ret->element;
1240     return S_OK;
1241 }