Release 1.5.29.
[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     LONG 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_cpc,
1198     HTMLElement_clone,
1199     HTMLElement_handle_event,
1200     HTMLElement_get_attr_col,
1201     NULL,
1202     HTMLInputElementImpl_fire_event,
1203     HTMLInputElementImpl_put_disabled,
1204     HTMLInputElementImpl_get_disabled,
1205 };
1206
1207 static const tid_t HTMLInputElement_iface_tids[] = {
1208     HTMLELEMENT_TIDS,
1209     IHTMLInputElement_tid,
1210     0
1211 };
1212 static dispex_static_data_t HTMLInputElement_dispex = {
1213     NULL,
1214     DispHTMLInputElement_tid,
1215     NULL,
1216     HTMLInputElement_iface_tids
1217 };
1218
1219 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1220 {
1221     HTMLInputElement *ret;
1222     nsresult nsres;
1223
1224     ret = heap_alloc_zero(sizeof(HTMLInputElement));
1225     if(!ret)
1226         return E_OUTOFMEMORY;
1227
1228     ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1229     ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1230     ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1231
1232     HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1233
1234     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1235
1236     /* Share nsinput reference with nsnode */
1237     assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1238     nsIDOMNode_Release(ret->element.node.nsnode);
1239
1240     *elem = &ret->element;
1241     return S_OK;
1242 }
1243
1244 typedef struct {
1245     HTMLElement element;
1246
1247     IHTMLLabelElement IHTMLLabelElement_iface;
1248 } HTMLLabelElement;
1249
1250 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1251 {
1252     return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1253 }
1254
1255 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1256                                                          REFIID riid, void **ppv)
1257 {
1258     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1259
1260     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1261 }
1262
1263 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1264 {
1265     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1266
1267     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1268 }
1269
1270 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1271 {
1272     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1273
1274     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1275 }
1276
1277 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1278 {
1279     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1280
1281     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1282 }
1283
1284 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1285         LCID lcid, ITypeInfo **ppTInfo)
1286 {
1287     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1288
1289     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1290 }
1291
1292 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1293         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1294 {
1295     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1296
1297     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1298             cNames, lcid, rgDispId);
1299 }
1300
1301 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1302                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1303                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1304 {
1305     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1306
1307     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1308             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1309 }
1310
1311 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1312 {
1313     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1314     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1315     return E_NOTIMPL;
1316 }
1317
1318 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1319 {
1320     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1321     FIXME("(%p)->(%p)\n", This, p);
1322     return E_NOTIMPL;
1323 }
1324
1325 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1326 {
1327     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1328     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1329     return E_NOTIMPL;
1330 }
1331
1332 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1333 {
1334     HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1335     FIXME("(%p)->(%p)\n", This, p);
1336     return E_NOTIMPL;
1337 }
1338
1339 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1340     HTMLLabelElement_QueryInterface,
1341     HTMLLabelElement_AddRef,
1342     HTMLLabelElement_Release,
1343     HTMLLabelElement_GetTypeInfoCount,
1344     HTMLLabelElement_GetTypeInfo,
1345     HTMLLabelElement_GetIDsOfNames,
1346     HTMLLabelElement_Invoke,
1347     HTMLLabelElement_put_htmlFor,
1348     HTMLLabelElement_get_htmlFor,
1349     HTMLLabelElement_put_accessKey,
1350     HTMLLabelElement_get_accessKey
1351 };
1352
1353 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1354 {
1355     return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1356 }
1357
1358 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1359 {
1360     HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1361
1362     *ppv = NULL;
1363
1364     if(IsEqualGUID(&IID_IUnknown, riid)) {
1365         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1366         *ppv = &This->IHTMLLabelElement_iface;
1367     }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1368         TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1369         *ppv = &This->IHTMLLabelElement_iface;
1370     }else {
1371         return HTMLElement_QI(&This->element.node, riid, ppv);
1372     }
1373
1374     IUnknown_AddRef((IUnknown*)*ppv);
1375     return S_OK;
1376 }
1377
1378 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1379     HTMLLabelElement_QI,
1380     HTMLElement_destructor,
1381     HTMLElement_cpc,
1382     HTMLElement_clone,
1383     HTMLElement_handle_event,
1384     HTMLElement_get_attr_col,
1385 };
1386
1387 static const tid_t HTMLLabelElement_iface_tids[] = {
1388     HTMLELEMENT_TIDS,
1389     IHTMLLabelElement_tid,
1390     0
1391 };
1392
1393 static dispex_static_data_t HTMLLabelElement_dispex = {
1394     NULL,
1395     DispHTMLLabelElement_tid,
1396     NULL,
1397     HTMLLabelElement_iface_tids
1398 };
1399
1400 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1401 {
1402     HTMLLabelElement *ret;
1403
1404     ret = heap_alloc_zero(sizeof(*ret));
1405     if(!ret)
1406         return E_OUTOFMEMORY;
1407
1408     ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1409     ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1410
1411     HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1412     *elem = &ret->element;
1413     return S_OK;
1414 }
1415
1416 typedef struct {
1417     HTMLElement element;
1418
1419     IHTMLButtonElement IHTMLButtonElement_iface;
1420
1421     nsIDOMHTMLButtonElement *nsbutton;
1422 } HTMLButtonElement;
1423
1424 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1425 {
1426     return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1427 }
1428
1429 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1430                                                          REFIID riid, void **ppv)
1431 {
1432     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1433
1434     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1435 }
1436
1437 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1438 {
1439     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1440
1441     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1442 }
1443
1444 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1445 {
1446     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1447
1448     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1449 }
1450
1451 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1452 {
1453     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1454
1455     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1456 }
1457
1458 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1459         LCID lcid, ITypeInfo **ppTInfo)
1460 {
1461     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1462
1463     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1464 }
1465
1466 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1467         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1468 {
1469     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1470
1471     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1472             cNames, lcid, rgDispId);
1473 }
1474
1475 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1476                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1477                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1478 {
1479     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1480
1481     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1482             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1483 }
1484
1485 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1486 {
1487     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1488     FIXME("(%p)->(%p)\n", This, p);
1489     return E_NOTIMPL;
1490 }
1491
1492 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1493 {
1494     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1495     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1496     return E_NOTIMPL;
1497 }
1498
1499 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1500 {
1501     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1502     FIXME("(%p)->(%p)\n", This, p);
1503     return E_NOTIMPL;
1504 }
1505
1506 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1507 {
1508     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1509     nsAString name_str;
1510     nsresult nsres;
1511
1512     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1513
1514     nsAString_InitDepend(&name_str, v);
1515     nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1516     nsAString_Finish(&name_str);
1517     if(NS_FAILED(nsres)) {
1518         ERR("SetName failed: %08x\n", nsres);
1519         return E_FAIL;
1520     }
1521
1522     return S_OK;
1523 }
1524
1525 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1526 {
1527     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1528     nsAString name_str;
1529     nsresult nsres;
1530
1531     TRACE("(%p)->(%p)\n", This, p);
1532
1533     nsAString_Init(&name_str, NULL);
1534     nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1535     return return_nsstr(nsres, &name_str, p);
1536 }
1537
1538 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1539 {
1540     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1541     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1542     return E_NOTIMPL;
1543 }
1544
1545 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1546 {
1547     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1548     FIXME("(%p)->(%p)\n", This, p);
1549     return E_NOTIMPL;
1550 }
1551
1552 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1553 {
1554     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1555     nsresult nsres;
1556
1557     TRACE("(%p)->(%x)\n", This, v);
1558
1559     nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1560     if(NS_FAILED(nsres)) {
1561         ERR("SetDisabled failed: %08x\n", nsres);
1562         return E_FAIL;
1563     }
1564
1565     return S_OK;
1566 }
1567
1568 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1569 {
1570     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1571     cpp_bool disabled;
1572     nsresult nsres;
1573
1574     TRACE("(%p)->(%p)\n", This, p);
1575
1576     nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1577     if(NS_FAILED(nsres)) {
1578         ERR("GetDisabled failed: %08x\n", nsres);
1579         return E_FAIL;
1580     }
1581
1582     *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1583     return S_OK;
1584 }
1585
1586 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1587 {
1588     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1589     FIXME("(%p)->(%p)\n", This, p);
1590     return E_NOTIMPL;
1591 }
1592
1593 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1594 {
1595     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1596     FIXME("(%p)->(%p)\n", This, range);
1597     return E_NOTIMPL;
1598 }
1599
1600 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1601     HTMLButtonElement_QueryInterface,
1602     HTMLButtonElement_AddRef,
1603     HTMLButtonElement_Release,
1604     HTMLButtonElement_GetTypeInfoCount,
1605     HTMLButtonElement_GetTypeInfo,
1606     HTMLButtonElement_GetIDsOfNames,
1607     HTMLButtonElement_Invoke,
1608     HTMLButtonElement_get_type,
1609     HTMLButtonElement_put_value,
1610     HTMLButtonElement_get_value,
1611     HTMLButtonElement_put_name,
1612     HTMLButtonElement_get_name,
1613     HTMLButtonElement_put_status,
1614     HTMLButtonElement_get_status,
1615     HTMLButtonElement_put_disabled,
1616     HTMLButtonElement_get_disabled,
1617     HTMLButtonElement_get_form,
1618     HTMLButtonElement_createTextRange
1619 };
1620
1621 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1622 {
1623     return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1624 }
1625
1626 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1627 {
1628     HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1629
1630     *ppv = NULL;
1631
1632     if(IsEqualGUID(&IID_IUnknown, riid)) {
1633         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1634         *ppv = &This->IHTMLButtonElement_iface;
1635     }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1636         TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1637         *ppv = &This->IHTMLButtonElement_iface;
1638     }else {
1639         return HTMLElement_QI(&This->element.node, riid, ppv);
1640     }
1641
1642     IUnknown_AddRef((IUnknown*)*ppv);
1643     return S_OK;
1644 }
1645
1646 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1647 {
1648     HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1649     return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1650 }
1651
1652 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1653 {
1654     HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1655     return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1656 }
1657
1658 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1659     HTMLButtonElement_QI,
1660     HTMLElement_destructor,
1661     HTMLElement_cpc,
1662     HTMLElement_clone,
1663     HTMLElement_handle_event,
1664     HTMLElement_get_attr_col,
1665     NULL,
1666     NULL,
1667     HTMLButtonElementImpl_put_disabled,
1668     HTMLButtonElementImpl_get_disabled
1669 };
1670
1671 static const tid_t HTMLButtonElement_iface_tids[] = {
1672     HTMLELEMENT_TIDS,
1673     IHTMLButtonElement_tid,
1674     0
1675 };
1676
1677 static dispex_static_data_t HTMLButtonElement_dispex = {
1678     NULL,
1679     DispHTMLButtonElement_tid,
1680     NULL,
1681     HTMLButtonElement_iface_tids
1682 };
1683
1684 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1685 {
1686     HTMLButtonElement *ret;
1687     nsresult nsres;
1688
1689     ret = heap_alloc_zero(sizeof(*ret));
1690     if(!ret)
1691         return E_OUTOFMEMORY;
1692
1693     ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1694     ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1695
1696     HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1697
1698     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1699
1700     /* Share nsbutton reference with nsnode */
1701     assert(nsres == NS_OK && (nsIDOMNode*)ret->nsbutton == ret->element.node.nsnode);
1702     nsIDOMNode_Release(ret->element.node.nsnode);
1703
1704     *elem = &ret->element;
1705     return S_OK;
1706 }